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 ad2b51de83..c1e6df95f6 100644 Binary files a/client/win/resource.aps and b/client/win/resource.aps differ diff --git a/client/win/resource.h b/client/win/resource.h index 577ae570fa..d8dcee6bde 100755 --- a/client/win/resource.h +++ b/client/win/resource.h @@ -20,10 +20,20 @@ #define IDR_STATUS_ICON 124 #define IDR_CONTEXT 124 #define IDD_QUIT 125 +#define IDD_PROXY 127 #define IDC_LOGIN_URL 1000 #define IDC_LOGIN_AUTH 1002 #define IDC_LIST 1006 +#define IDC_CHECK_HTTP 1013 +#define IDC_EDIT_HTTP_ADDR 1014 +#define IDC_EDIT_HTTP_PORT 1015 +#define IDC_EDIT_SOCKS_NAME 1017 +#define IDC_EDIT_SOCKS_PASS 1018 +#define IDC_CHECK_SOCKS 1022 +#define IDC_EDIT_SOCKS_ADDR 1023 +#define IDC_EDIT_SOCKS_PORT 1024 #define ID_ACCT_LOGIN 40001 +#define ID_SETTINGS_LOGIN 40001 #define ID_HELP_ABOUT 40002 #define ID_POPUP_1 40003 #define ID_POPUP_2 40004 @@ -34,6 +44,7 @@ #define ID_STATUSICON_HIDE 40015 #define ID_STATUSICON_SUSPEND 40016 #define ID_ACCT_QUIT 40017 +#define ID_SETTINGS_QUIT 40017 #define ID_FILE_SUSPEND 40018 #define ID_FILE_EXIT 40019 #define ID_FILE_HIDE 40020 @@ -44,14 +55,17 @@ #define ID_XFER_CLEAR 40025 #define ID_FILE_DISPLAY 40026 #define ID_FILE_CLEAR 40027 +#define ID_FILE_CLEARINACTIVE 40027 +#define ID_FILE_CLEARMESSAGES 40028 +#define ID_SETTINGS_PROXYSERVER 40029 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 127 -#define _APS_NEXT_COMMAND_VALUE 40028 -#define _APS_NEXT_CONTROL_VALUE 1013 +#define _APS_NEXT_RESOURCE_VALUE 128 +#define _APS_NEXT_COMMAND_VALUE 40030 +#define _APS_NEXT_CONTROL_VALUE 1019 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/client/win/resource.rc b/client/win/resource.rc index 68c2aa0eeb..dbd765f300 100755 --- a/client/win/resource.rc +++ b/client/win/resource.rc @@ -88,6 +88,40 @@ BEGIN WS_VSCROLL | WS_TABSTOP END +IDD_PROXY DIALOG DISCARDABLE 0, 0, 212, 278 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "BOINC Proxy Server Setup" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,7,257,50,14 + PUSHBUTTON "Cancel",IDCANCEL,155,257,50,14 + LTEXT "Some organizations use an ""HTTP proxy"" or a ""SOCKS proxy"" (or both) for increased security. If you need to use a proxy, fill in the information below. If you need help, ask your System Administrator or Internet Serevice Provider.", + IDC_STATIC,17,7,176,46 + GROUPBOX "HTTP Proxy",IDC_STATIC,7,59,198,62 + CONTROL "Connect via HTTP proxy server",IDC_CHECK_HTTP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,19,71,115,10 + LTEXT "http://",IDC_STATIC,32,86,22,8 + LTEXT "Port number:",IDC_STATIC,32,104,41,8 + EDITTEXT IDC_EDIT_HTTP_ADDR,57,83,135,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_HTTP_PORT,77,101,40,14,ES_AUTOHSCROLL | + ES_NUMBER + GROUPBOX "SOCKS Proxy",IDC_STATIC,7,131,198,122 + CONTROL "Connect via SOCKS server",IDC_CHECK_SOCKS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,19,143,101,10 + LTEXT "SOCKS host:",IDC_STATIC,32,158,42,8 + LTEXT "Port number:",IDC_STATIC,32,176,41,8 + EDITTEXT IDC_EDIT_SOCKS_ADDR,77,155,115,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SOCKS_PORT,77,173,40,14,ES_AUTOHSCROLL | + ES_NUMBER + GROUPBOX "Leave these blank if not needed",IDC_STATIC,13,193,186, + 54 + LTEXT "SOCKS user name:",IDC_STATIC,32,209,62,8 + LTEXT "SOCKS password:",IDC_STATIC,32,230,59,8 + EDITTEXT IDC_EDIT_SOCKS_NAME,97,206,91,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SOCKS_PASS,97,227,91,14,ES_PASSWORD | + ES_AUTOHSCROLL +END + ///////////////////////////////////////////////////////////////////////////// // @@ -120,6 +154,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 63 END + + IDD_PROXY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 205 + TOPMARGIN, 7 + BOTTOMMARGIN, 271 + END END #endif // APSTUDIO_INVOKED @@ -133,17 +175,20 @@ IDR_MAINFRAME MENU DISCARDABLE BEGIN POPUP "&File" BEGIN - MENUITEM "Clear Inactive", ID_FILE_CLEAR + MENUITEM "Clear &Messages", ID_FILE_CLEARMESSAGES + MENUITEM "Clear &Inactive", ID_FILE_CLEARINACTIVE MENUITEM SEPARATOR MENUITEM "&Hide", ID_FILE_HIDE MENUITEM "&Suspend", ID_FILE_SUSPEND MENUITEM SEPARATOR MENUITEM "E&xit", ID_FILE_EXIT END - POPUP "&Account" + POPUP "&Settings" BEGIN - MENUITEM "&Login to Project...", ID_ACCT_LOGIN - MENUITEM "&Quit Project...", ID_ACCT_QUIT + MENUITEM "&Login to Project...", ID_SETTINGS_LOGIN + MENUITEM "&Quit Project...", ID_SETTINGS_QUIT + MENUITEM SEPARATOR + MENUITEM "&Proxy Server...", ID_SETTINGS_PROXYSERVER END POPUP "&Help" BEGIN diff --git a/client/win/wingui.cpp b/client/win/wingui.cpp index a5dad2c2cf..f9c3b44508 100755 --- a/client/win/wingui.cpp +++ b/client/win/wingui.cpp @@ -36,20 +36,22 @@ CMyApp g_myApp; #define PROJECT_ID 0 #define RESULT_ID 1 #define XFER_ID 2 -#define MAX_LIST_ID 3 -#define USAGE_ID 3 -#define MESSAGE_ID 4 +#define MESSAGE_ID 3 +#define MAX_LIST_ID 4 +#define USAGE_ID 4 #define TAB_ID 5 #define PROJECT_COLS 5 #define RESULT_COLS 7 #define XFER_COLS 6 +#define MESSAGE_COLS 3 #define MAX_COLS 7 char* column_titles[MAX_LIST_ID][MAX_COLS] = { {"Project", "Account", "Total Credit", "Avg. Credit", "Resource Share", NULL, NULL}, {"Project", "Application", "Name", "CPU time", "Progress", "To Completion", "Status"}, - {"Project", "File", "Progress", "Size", "Time", "Direction", NULL} + {"Project", "File", "Progress", "Size", "Time", "Direction", NULL}, + {"Project", "Time", "Message", NULL, NULL, NULL, NULL} }; double GetDiskSize(); @@ -77,15 +79,15 @@ int get_initial_project() { void GetByteString(double nbytes, CString* str) { if (nbytes > 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