From 0f0acfc777d92b45091e3dc1d81286faf0ce8cd6 Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Mon, 9 Dec 2002 23:53:37 +0000 Subject: [PATCH] no message svn path=/trunk/boinc/; revision=717 --- checkin_notes | 5 +- client/win/resource.aps | Bin 72000 -> 74348 bytes client/win/resource.h | 20 ++- client/win/resource.rc | 53 +++++- client/win/wingui.cpp | 351 ++++++++++++++++++++++++++++++---------- client/win/wingui.h | 29 +++- todo | 3 - 7 files changed, 363 insertions(+), 98 deletions(-) diff --git a/checkin_notes b/checkin_notes index 70f671059f..e179e0aeed 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2599,4 +2599,7 @@ Hamid Dec 9,2002 - The error mechanism right now is such that any failures regarding file_infos (download, upload or whatever) are recorded in the status of the file_infos and then garbage collect called report_project_error. However errors regarding starting and ending active tasks are reported from app.C and cs_apps.C. - \ No newline at end of file +Seth Dec 9, 2002 + - time tests run in their own thread when needed, if they are global state + won't do anything until they are done; threads communicate by a file + - windows host info complete except for cache diff --git a/client/win/resource.aps b/client/win/resource.aps index ad2b51de831d2f106588b29e8d79b741cce4c1a6..c1e6df95f6cb69a3e0cd9648696bff325fe3d41e 100644 GIT binary patch delta 3739 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 1e12) { - str->Format("%4.2f TB", nbytes/1e12); + str->Format("%0.2f TB", nbytes/(1024.0*1024*1024*1024)); } else if (nbytes > 1e9) { - str->Format("%4.2f GB", nbytes/1e9); + str->Format("%0.2f GB", nbytes/(1024.0*1024*1024)); } else if (nbytes > 1e6) { - str->Format("%4.2f MB", nbytes/1e6); + str->Format("%0.2f MB", nbytes/(1024.0*1024)); } else if (nbytes > 1e3) { - str->Format("%4.2f KB", nbytes/1e3); + str->Format("%0.2f KB", nbytes/(1024.0)); } else { - str->Format("%4f bytes", nbytes); + str->Format("%0.0f bytes", nbytes); } } @@ -1212,16 +1214,20 @@ void CPieChartCtrl::OnPaint() cb.CreateSolidBrush(m_Colors.GetAt(i)); oldbrush = memdc.SelectObject(&cb); + int texti = i; + if(texti == 2) texti = 3; + else if(texti == 3) texti = 2; + // display color box and label - if(PIE_BUFFER + 20 + i * 20 < wndrect.Height() / 2) { - textrect.SetRect(PIE_BUFFER + 0, PIE_BUFFER + i * 20 + 2, PIE_BUFFER + 10, PIE_BUFFER + 20 + i * 20 - 2); + if(PIE_BUFFER + 20 + texti * 20 < wndrect.Height() / 2) { + textrect.SetRect(PIE_BUFFER + 0, PIE_BUFFER + texti * 20 + 2, PIE_BUFFER + 10, PIE_BUFFER + 20 + texti * 20 - 2); memdc.FillRect(&textrect, &cb); memdc.MoveTo(textrect.left, textrect.top); memdc.LineTo(textrect.right, textrect.top); memdc.LineTo(textrect.right, textrect.bottom); memdc.LineTo(textrect.left, textrect.bottom); memdc.LineTo(textrect.left, textrect.top); - textrect.SetRect(PIE_BUFFER + 15, PIE_BUFFER + i * 20, wndrect.Width() - PIE_BUFFER, PIE_BUFFER + 20 + i * 20); + textrect.SetRect(PIE_BUFFER + 15, PIE_BUFFER + texti * 20, wndrect.Width() - PIE_BUFFER, PIE_BUFFER + 20 + texti * 20); CString sbytes; GetByteString(m_Values.GetAt(i), &sbytes); CString str; @@ -1283,12 +1289,14 @@ BOOL CMyApp::InitInstance() BEGIN_MESSAGE_MAP(CMainWindow, CWnd) ON_WM_CLOSE() - ON_COMMAND(ID_FILE_CLEAR, OnCommandClear) + ON_COMMAND(ID_FILE_CLEARINACTIVE, OnCommandFileClearInactive) + ON_COMMAND(ID_FILE_CLEARMESSAGES, OnCommandFileClearMessages) ON_COMMAND(ID_FILE_HIDE, OnCommandHide) ON_COMMAND(ID_FILE_SUSPEND, OnCommandSuspend) ON_COMMAND(ID_FILE_EXIT, OnCommandExit) - ON_COMMAND(ID_ACCT_LOGIN, OnCommandAccountLogin) - ON_COMMAND(ID_ACCT_QUIT, OnCommandAccountQuit) + ON_COMMAND(ID_SETTINGS_LOGIN, OnCommandSettingsLogin) + ON_COMMAND(ID_SETTINGS_QUIT, OnCommandSettingsQuit) + ON_COMMAND(ID_SETTINGS_PROXYSERVER, OnCommandSettingsProxyServer) ON_COMMAND(ID_HELP_ABOUT, OnCommandHelpAbout) ON_COMMAND(ID_PROJECT_RELOGIN, OnCommandProjectRelogin) ON_COMMAND(ID_PROJECT_QUIT, OnCommandProjectQuit) @@ -1448,14 +1456,17 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* cs) // to completion if(!at || at->fraction_done == 0) { - buf.Format("unable to calculate"); + double tocomp = at->wup->seconds_to_complete; + cpuhour = (int)(tocomp / (60 * 60)); + cpumin = (int)(tocomp / 60) % 60; + cpusec = (int)(tocomp) % 60; } else { double tocomp = at->est_time_to_completion(); cpuhour = (int)(tocomp / (60 * 60)); cpumin = (int)(tocomp / 60) % 60; cpusec = (int)(tocomp) % 60; - buf.Format("%0.2d:%0.2d:%0.2d", cpuhour, cpumin, cpusec); } + buf.Format("%0.2d:%0.2d:%0.2d", cpuhour, cpumin, cpusec); m_ResultListCtrl.SetItemText(i, 5, buf); // status @@ -1547,38 +1558,25 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* cs) // adds to message edit control. void CMainWindow::MessageUser(char* project, char* message, char* priority) { + if(!m_MessageListCtrl.GetSafeHwnd()) return; + + if(strcmp(project, "")) { + m_MessageListCtrl.InsertItem(0, project); + } else { + m_MessageListCtrl.InsertItem(0, "BOINC"); + } + CTime curTime = CTime::GetCurrentTime(); CString timeStr; - timeStr = curTime.Format("(%c) "); - if(strcmp(project, "")) { - timeStr.Insert(0, ": "); - timeStr.Insert(0, project); - } else { - timeStr.Insert(0, "BOINC: "); - } + timeStr = curTime.Format("%c"); + m_MessageListCtrl.SetItemText(0, 1, timeStr); + m_MessageListCtrl.SetItemText(0, 2, message); + + // set status icon to flash if(!strcmp(priority, "high") && (m_TabCtrl.GetCurSel() != MESSAGE_ID || GetForegroundWindow() != this)) { m_Message = true; } - - // put message in control, removing older messages if necessary - if(m_MessageEditCtrl.GetSafeHwnd()) { - CString text; - m_MessageEditCtrl.GetWindowText(text); - if(m_MessageEditCtrl.GetLineCount() > MAX_MESSAGE_LINES) { - text.MakeReverse(); - int first = text.Find("\n\r", 0); - if(first >= 0) { - text.Delete(0,first + 2); - } - text.MakeReverse(); - } - text.Insert(0, "\r\n"); - text.Insert(0, message); - text.Insert(0, timeStr); - m_MessageEditCtrl.SetWindowText(text); - m_MessageEditCtrl.RedrawWindow(); - } } ////////// @@ -1671,6 +1669,15 @@ void CMainWindow::SaveUserSettings() valbuf.Format("%d", m_XferListCtrl.GetColumnWidth(i)); WritePrivateProfileString("HEADERS", keybuf.GetBuffer(0), valbuf.GetBuffer(0), path); } + + // save xfer columns + m_MessageListCtrl.GetColumnOrderArray(colorder, MESSAGE_COLS); + WritePrivateProfileStruct("HEADERS", "messages-order", colorder, sizeof(colorder), path); + for(i = 0; i < m_MessageListCtrl.GetHeaderCtrl()->GetItemCount(); i ++) { + keybuf.Format("messages-%d", i); + valbuf.Format("%d", m_MessageListCtrl.GetColumnWidth(i)); + WritePrivateProfileString("HEADERS", keybuf.GetBuffer(0), valbuf.GetBuffer(0), path); + } } ////////// @@ -1716,6 +1723,19 @@ void CMainWindow::LoadUserSettings() intbuf = GetPrivateProfileInt("HEADERS", keybuf.GetBuffer(0), DEF_COL_WIDTH, path); m_XferListCtrl.SetColumnWidth(i, intbuf); } + + // load message columns + if(GetPrivateProfileStruct("HEADERS", "messages-order", colorder, sizeof(colorder), path)) { + m_MessageListCtrl.SetColumnOrderArray(MESSAGE_COLS, colorder); + } + for(i = 0; i < m_MessageListCtrl.GetHeaderCtrl()->GetItemCount(); i ++) { + keybuf.Format("messages-%d", i); + int width = DEF_COL_WIDTH; + if(i == 1) width *= 1.5; + if(i == 2) width *= 4; + intbuf = GetPrivateProfileInt("HEADERS", keybuf.GetBuffer(0), width, path); + m_MessageListCtrl.SetColumnWidth(i, intbuf); + } } ////////// @@ -1810,11 +1830,11 @@ void CMainWindow::OnClose() } ////////// -// CMainWindow::OnCommandAccountQuit +// CMainWindow::OnCommandSettingsQuit // arguments: void // returns: void // function: shows the account quit dialog box -void CMainWindow::OnCommandAccountQuit() +void CMainWindow::OnCommandSettingsQuit() { CQuitDialog dlg(IDD_QUIT); int retval = dlg.DoModal(); @@ -1832,11 +1852,11 @@ void CMainWindow::OnCommandAccountQuit() } ////////// -// CMainWindow::OnCommandAccountLogin +// CMainWindow::OnCommandSettingsLogin // arguments: void // returns: void // function: shows the account login dialog box -void CMainWindow::OnCommandAccountLogin() +void CMainWindow::OnCommandSettingsLogin() { CLoginDialog dlg(IDD_LOGIN, "", ""); int retval = dlg.DoModal(); @@ -1845,6 +1865,17 @@ void CMainWindow::OnCommandAccountLogin() } } +////////// +// CMainWindow::OnCommandSettingsProxyServer +// arguments: void +// returns: void +// function: shows the proxy dialog box +void CMainWindow::OnCommandSettingsProxyServer() +{ + CProxyDialog dlg(IDD_PROXY); + int retval = dlg.DoModal(); +} + ////////// // CMainWindow::OnCommandHelpAbout // arguments: void @@ -1857,11 +1888,11 @@ void CMainWindow::OnCommandHelpAbout() } ////////// -// CMainWindow::OnCommandClear +// CMainWindow::OnCommandFileClearInactive // arguments: void // returns: void // function: clears inactive items from lists -void CMainWindow::OnCommandClear() +void CMainWindow::OnCommandFileClearInactive() { int i; for(i = 0; i < m_ProjectListCtrl.GetItemCount();) { @@ -1885,7 +1916,16 @@ void CMainWindow::OnCommandClear() i ++; } } - m_ContextItem = -1; +} + +////////// +// CMainWindow::OnCommandFileClearMessages +// arguments: void +// returns: void +// function: clears messages +void CMainWindow::OnCommandFileClearMessages() +{ + m_MessageListCtrl.DeleteAllItems(); } ////////// @@ -2067,7 +2107,7 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs) m_ProjectListCtrl.Create(LVS_REPORT|WS_CHILD|WS_BORDER|WS_VISIBLE, CRect(0,0,0,0), this, PROJECT_ID); m_ProjectListCtrl.SetExtendedStyle(m_ProjectListCtrl.GetExtendedStyle()|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT); for(int i = 0; i < PROJECT_COLS; i ++) { - m_ProjectListCtrl.InsertColumn(i, column_titles[PROJECT_ID][i], LVCFMT_LEFT, 80); + m_ProjectListCtrl.InsertColumn(i, column_titles[PROJECT_ID][i], LVCFMT_LEFT, DEF_COL_WIDTH); } // create result list control @@ -2075,7 +2115,7 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs) m_ResultListCtrl.SetExtendedStyle(m_ResultListCtrl.GetExtendedStyle()|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT); m_ResultListCtrl.ModifyStyle(WS_VISIBLE, 0); for(i = 0; i < RESULT_COLS; i ++) { - m_ResultListCtrl.InsertColumn(i, column_titles[RESULT_ID][i], LVCFMT_LEFT, 80); + m_ResultListCtrl.InsertColumn(i, column_titles[RESULT_ID][i], LVCFMT_LEFT, DEF_COL_WIDTH); } // create xfer list control @@ -2083,20 +2123,34 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs) m_XferListCtrl.SetExtendedStyle(m_XferListCtrl.GetExtendedStyle()|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT); m_XferListCtrl.ModifyStyle(WS_VISIBLE, 0); for(i = 0; i < XFER_COLS; i ++) { - m_XferListCtrl.InsertColumn(i, column_titles[XFER_ID][i], LVCFMT_LEFT, 80); + m_XferListCtrl.InsertColumn(i, column_titles[XFER_ID][i], LVCFMT_LEFT, DEF_COL_WIDTH); + } + + // create message edit control + // create xfer list control + m_MessageListCtrl.Create(LVS_REPORT|WS_CHILD|WS_BORDER|WS_VISIBLE, CRect(0,0,0,0), this, MESSAGE_ID); + m_MessageListCtrl.SetExtendedStyle(m_MessageListCtrl.GetExtendedStyle()|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT); + m_MessageListCtrl.ModifyStyle(WS_VISIBLE, 0); + for(i = 0; i < MESSAGE_COLS; i ++) { + int width = DEF_COL_WIDTH; + if(i == 1) width *= 1.5; + if(i == 2) width *= 4; + m_MessageListCtrl.InsertColumn(i, column_titles[MESSAGE_ID][i], LVCFMT_LEFT, width); } // create usage pie control m_UsagePieCtrl.Create(WS_CHILD|WS_BORDER|WS_VISIBLE, CRect(0,0,0,0), this, USAGE_ID); m_UsagePieCtrl.ModifyStyle(WS_VISIBLE, 0); - m_UsagePieCtrl.AddPiece("Free not available for BOINC", RGB(192, 192, 192), 0); - m_UsagePieCtrl.AddPiece("Space used", RGB(0, 0, 255), 0); - m_UsagePieCtrl.AddPiece("Used by BOINC", RGB(255, 255, 0), 0); - m_UsagePieCtrl.AddPiece("Space available to BOINC", RGB(255, 128, 0), 0); - - // create message edit control - m_MessageEditCtrl.Create(ES_MULTILINE|ES_READONLY|WS_VSCROLL|WS_CHILD|WS_TABSTOP|WS_BORDER|WS_VISIBLE, CRect(0,0,0,0), this, MESSAGE_ID); - m_MessageEditCtrl.ModifyStyle(WS_VISIBLE, 0); + /* + m_UsagePieCtrl.AddPiece("Free space", RGB(192, 192, 192), 0); + m_UsagePieCtrl.AddPiece("Used space", RGB(0, 0, 255), 0); + m_UsagePieCtrl.AddPiece("Used space (BOINC)", RGB(255, 255, 0), 0); + m_UsagePieCtrl.AddPiece("Free space (BOINC)", RGB(255, 128, 0), 0); + */ + m_UsagePieCtrl.AddPiece("Free space (Non-BOINC)", RGB(255, 0, 255), 0); + m_UsagePieCtrl.AddPiece("Used space (Non-BOINC)", RGB(0, 0, 255), 0); + m_UsagePieCtrl.AddPiece("Used space (BOINC)", RGB(0, 0, 192), 0); + m_UsagePieCtrl.AddPiece("Free space (BOINC)", RGB(192, 0, 192), 0); // set up image list for tab control m_TabIL.Create(16, 16, ILC_COLOR8|ILC_MASK, 5, 1); @@ -2106,9 +2160,9 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs) m_TabIL.Add(&m_TabBMP[1], RGB(255, 0, 255)); m_TabBMP[2].LoadBitmap(IDB_XFER); m_TabIL.Add(&m_TabBMP[2], RGB(255, 0, 255)); - m_TabBMP[3].LoadBitmap(IDB_USAGE); + m_TabBMP[3].LoadBitmap(IDB_MESS); m_TabIL.Add(&m_TabBMP[3], RGB(255, 0, 255)); - m_TabBMP[4].LoadBitmap(IDB_MESS); + m_TabBMP[4].LoadBitmap(IDB_USAGE); m_TabIL.Add(&m_TabBMP[4], RGB(255, 0, 255)); // create tab control @@ -2117,8 +2171,8 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs) m_TabCtrl.InsertItem(1, "Projects", 0); m_TabCtrl.InsertItem(2, "Work", 1); m_TabCtrl.InsertItem(3, "Transfers", 2); - m_TabCtrl.InsertItem(4, "Usage", 3); - m_TabCtrl.InsertItem(5, "Messages", 4); + m_TabCtrl.InsertItem(4, "Messages", 3); + m_TabCtrl.InsertItem(5, "Usage", 4); // make all fonts the same nice font CFont* pcf; @@ -2129,7 +2183,6 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs) m_Font.CreateFontIndirect(&lf); m_TabCtrl.SetFont(&m_Font); m_UsagePieCtrl.SetFont(&m_Font); - m_MessageEditCtrl.SetFont(&m_Font); // remove button from taskbar and add status icon in taskbar ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW); @@ -2197,41 +2250,41 @@ BOOL CMainWindow::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) m_ProjectListCtrl.ModifyStyle(0, WS_VISIBLE); m_ResultListCtrl.ModifyStyle(WS_VISIBLE, 0); m_XferListCtrl.ModifyStyle(WS_VISIBLE, 0); + m_MessageListCtrl.ModifyStyle(WS_VISIBLE, 0); m_UsagePieCtrl.ModifyStyle(WS_VISIBLE, 0); - m_MessageEditCtrl.ModifyStyle(WS_VISIBLE, 0); m_ProjectListCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); } else if(newTab == RESULT_ID) { m_ProjectListCtrl.ModifyStyle(WS_VISIBLE, 0); m_ResultListCtrl.ModifyStyle(0, WS_VISIBLE); m_XferListCtrl.ModifyStyle(WS_VISIBLE, 0); + m_MessageListCtrl.ModifyStyle(WS_VISIBLE, 0); m_UsagePieCtrl.ModifyStyle(WS_VISIBLE, 0); - m_MessageEditCtrl.ModifyStyle(WS_VISIBLE, 0); m_ResultListCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); } else if(newTab == XFER_ID) { m_ProjectListCtrl.ModifyStyle(WS_VISIBLE, 0); m_ResultListCtrl.ModifyStyle(WS_VISIBLE, 0); m_XferListCtrl.ModifyStyle(0, WS_VISIBLE); + m_MessageListCtrl.ModifyStyle(WS_VISIBLE, 0); m_UsagePieCtrl.ModifyStyle(WS_VISIBLE, 0); - m_MessageEditCtrl.ModifyStyle(WS_VISIBLE, 0); m_XferListCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); - } else if(newTab == USAGE_ID) { - m_ProjectListCtrl.ModifyStyle(WS_VISIBLE, 0); - m_ResultListCtrl.ModifyStyle(WS_VISIBLE, 0); - m_XferListCtrl.ModifyStyle(WS_VISIBLE, 0); - m_UsagePieCtrl.ModifyStyle(0, WS_VISIBLE); - m_MessageEditCtrl.ModifyStyle(WS_VISIBLE, 0); - m_UsagePieCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); } else if(newTab == MESSAGE_ID) { m_ProjectListCtrl.ModifyStyle(WS_VISIBLE, 0); m_ResultListCtrl.ModifyStyle(WS_VISIBLE, 0); m_XferListCtrl.ModifyStyle(WS_VISIBLE, 0); + m_MessageListCtrl.ModifyStyle(0, WS_VISIBLE); m_UsagePieCtrl.ModifyStyle(WS_VISIBLE, 0); - m_MessageEditCtrl.ModifyStyle(0, WS_VISIBLE); if(m_Message) { m_Message = false; SetStatusIcon(ICON_NORMAL); } - m_MessageEditCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); + m_MessageListCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); + } else if(newTab == USAGE_ID) { + m_ProjectListCtrl.ModifyStyle(WS_VISIBLE, 0); + m_ResultListCtrl.ModifyStyle(WS_VISIBLE, 0); + m_XferListCtrl.ModifyStyle(WS_VISIBLE, 0); + m_MessageListCtrl.ModifyStyle(WS_VISIBLE, 0); + m_UsagePieCtrl.ModifyStyle(0, WS_VISIBLE); + m_UsagePieCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); } m_TabCtrl.RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); RedrawWindow(); @@ -2294,8 +2347,8 @@ void CMainWindow::OnSetFocus(CWnd* pOldWnd) m_ProjectListCtrl.ModifyStyle(WS_VISIBLE, 0); m_ResultListCtrl.ModifyStyle(WS_VISIBLE, 0); m_XferListCtrl.ModifyStyle(WS_VISIBLE, 0); + m_MessageListCtrl.ModifyStyle(0, WS_VISIBLE); m_UsagePieCtrl.ModifyStyle(WS_VISIBLE, 0); - m_MessageEditCtrl.ModifyStyle(0, WS_VISIBLE); m_Message = false; SetStatusIcon(ICON_NORMAL); Invalidate(false); @@ -2336,14 +2389,14 @@ void CMainWindow::OnSize(UINT nType, int cx, int cy) m_XferListCtrl.MoveWindow(&srt, false); m_XferListCtrl.RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); } + if(m_MessageListCtrl.GetSafeHwnd()) { + m_MessageListCtrl.MoveWindow(&srt, false); + m_MessageListCtrl.RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); + } if(m_UsagePieCtrl.GetSafeHwnd()) { m_UsagePieCtrl.MoveWindow(&srt, false); m_UsagePieCtrl.RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_NOERASE|RDW_FRAME); } - if(m_MessageEditCtrl.GetSafeHwnd()) { - m_MessageEditCtrl.MoveWindow(&srt, false); - m_MessageEditCtrl.RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_NOERASE|RDW_FRAME); - } m_TabCtrl.RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_NOERASE|RDW_FRAME); RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_FRAME); } @@ -2582,3 +2635,135 @@ BOOL CQuitDialog::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult) // message was handled return TRUE; } + +///////////////////////////////////////////////////////////////////////// +// CProxyDialog message map and member functions + +BEGIN_MESSAGE_MAP(CProxyDialog, CDialog) + ON_BN_CLICKED(IDC_CHECK_HTTP, OnHttp) + ON_BN_CLICKED(IDC_CHECK_SOCKS, OnSocks) + ON_BN_CLICKED(IDOK, OnOK) +END_MESSAGE_MAP() + +////////// +// CProxyDialog::CProxyDialog +// arguments: y: dialog box resource id +// returns: void +// function: calls parents contructor. +CProxyDialog::CProxyDialog(UINT y) : CDialog(y) +{ +} + +////////// +// CProxyDialog::OnInitDialog +// arguments: void +// returns: true if windows needs to give dialog focus, false if dialog has taken focus +// function: initializes and centers dialog box +BOOL CProxyDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + CButton* btnTmp; + + // fill in http + btnTmp = (CButton*)GetDlgItem(IDC_CHECK_HTTP); + if(btnTmp) btnTmp->SetCheck(gstate.use_proxy?BST_CHECKED:BST_UNCHECKED); + SetDlgItemText(IDC_EDIT_HTTP_ADDR, gstate.proxy_server_name); + CString portBuf; + if(gstate.proxy_server_port > 0) portBuf.Format("%d", gstate.proxy_server_port); + else portBuf.Format("80"); + SetDlgItemText(IDC_EDIT_HTTP_PORT, portBuf.GetBuffer(0)); + EnableHttp(gstate.use_proxy); + + // fill in socks + btnTmp = (CButton*)GetDlgItem(IDC_CHECK_SOCKS); + if(btnTmp) btnTmp->EnableWindow(false); + SetDlgItemText(IDC_EDIT_SOCKS_PORT, "1080"); + EnableSocks(false); + CenterWindow(); + return TRUE; +} + +////////// +// CProxyDialog::EnableHttp +// arguments: bEnable: true to enable, false to disable +// returns: void +// function: enables or disables the http section of the dialog +void CProxyDialog::EnableHttp(BOOL bEnable) +{ + CEdit* editTmp; + editTmp = (CEdit*)GetDlgItem(IDC_EDIT_HTTP_ADDR); + if(editTmp) editTmp->EnableWindow(bEnable); + editTmp = (CEdit*)GetDlgItem(IDC_EDIT_HTTP_PORT); + if(editTmp) editTmp->EnableWindow(bEnable); +} + +////////// +// CProxyDialog::EnableSocks +// arguments: bEnable: true to enable, false to disable +// returns: void +// function: enables or disables the socks section of the dialog +void CProxyDialog::EnableSocks(BOOL bEnable) +{ + CEdit* editTmp; + editTmp = (CEdit*)GetDlgItem(IDC_EDIT_SOCKS_ADDR); + if(editTmp) editTmp->EnableWindow(bEnable); + editTmp = (CEdit*)GetDlgItem(IDC_EDIT_SOCKS_PORT); + if(editTmp) editTmp->EnableWindow(bEnable); + editTmp = (CEdit*)GetDlgItem(IDC_EDIT_SOCKS_NAME); + if(editTmp) editTmp->EnableWindow(bEnable); + editTmp = (CEdit*)GetDlgItem(IDC_EDIT_SOCKS_PASS); + if(editTmp) editTmp->EnableWindow(bEnable); +} + +////////// +// CProxyDialog::OnOK +// arguments: void +// returns: void +// function: handles http check box +void CProxyDialog::OnHttp() +{ + CButton* btnTmp; + btnTmp = (CButton*)GetDlgItem(IDC_CHECK_HTTP); + if(btnTmp) { + if(btnTmp->GetCheck() == BST_CHECKED) { + EnableHttp(true); + } else { + EnableHttp(false); + } + } +} + +////////// +// CProxyDialog::OnSocks +// arguments: void +// returns: void +// function: handles socks check box +void CProxyDialog::OnSocks() +{ +} + +////////// +// CProxyDialog::OnOK +// arguments: void +// returns: void +// function: sets member variables, selected project to quit +void CProxyDialog::OnOK() +{ + CButton* btnTmp; + CString strTmp; + + // get http info + btnTmp = (CButton*)GetDlgItem(IDC_CHECK_HTTP); + if(btnTmp) { + if(btnTmp->GetCheck() == BST_CHECKED) { + gstate.use_proxy = true; + } else { + gstate.use_proxy = false; + } + } + GetDlgItemText(IDC_EDIT_HTTP_ADDR, strTmp); + strcpy(gstate.proxy_server_name, strTmp.GetBuffer(0)); + GetDlgItemText(IDC_EDIT_HTTP_PORT, strTmp); + gstate.proxy_server_port = atoi(strTmp.GetBuffer(0)); + CDialog::OnOK(); +} diff --git a/client/win/wingui.h b/client/win/wingui.h index 59a289a667..091e5d4818 100755 --- a/client/win/wingui.h +++ b/client/win/wingui.h @@ -212,8 +212,8 @@ protected: CProgressListCtrl m_ProjectListCtrl; // list control CProgressListCtrl m_XferListCtrl; // list control CProgressListCtrl m_ResultListCtrl; // list control + CProgressListCtrl m_MessageListCtrl; // list control for messages to user CPieChartCtrl m_UsagePieCtrl; // pie chart control - CEdit m_MessageEditCtrl; // edit control for messages to user CFont m_Font; // window's font CTabCtrl m_TabCtrl; // tab control for choosing display CImageList m_TabIL; // image list for tab control @@ -232,12 +232,14 @@ protected: virtual void PostNcDestroy(); afx_msg void OnClose(); - afx_msg void OnCommandAccountQuit(); - afx_msg void OnCommandAccountLogin(); + afx_msg void OnCommandSettingsQuit(); + afx_msg void OnCommandSettingsLogin(); + afx_msg void OnCommandSettingsProxyServer(); afx_msg void OnCommandHelpAbout(); afx_msg void OnCommandProjectRelogin(); afx_msg void OnCommandProjectQuit(); - afx_msg void OnCommandClear(); + afx_msg void OnCommandFileClearInactive(); + afx_msg void OnCommandFileClearMessages(); afx_msg void OnCommandHide(); afx_msg void OnCommandSuspend(); afx_msg void OnCommandExit(); @@ -285,6 +287,25 @@ protected: DECLARE_MESSAGE_MAP() }; +////////// +// class: CProxyDialog +// parent: CDialog +// description: allows user to set up proxy information +class CProxyDialog : public CDialog +{ +public: + CProxyDialog(UINT); + afx_msg BOOL OnInitDialog(); + +protected: + void EnableHttp(BOOL bEnable); + void EnableSocks(BOOL bEnable); + afx_msg void OnHttp(); + afx_msg void OnSocks(); + afx_msg void OnOK(); + DECLARE_MESSAGE_MAP() +}; + // globals extern CMyApp g_myApp; diff --git a/todo b/todo index 287b46a14f..78765bacd4 100755 --- a/todo +++ b/todo @@ -5,7 +5,6 @@ get timezone working on all platforms get benchmark working as separate process must do this before send first scheduler request -Windows hostinfo: memory, cache, swap validate in crontab Windows client @@ -14,7 +13,6 @@ Windows client test uninstall fix "unable to calculate" xfers: show file size, - completed xfers: show elapsed time completed results: show final CPU time ----------------------- @@ -136,7 +134,6 @@ CPU benchmarking check that bandwidth is measured correctly measure disk/mem size on all platforms get timezone to work - batteries on windows WU/result sequence mechanism design/implement/document