language/caption file

svn path=/trunk/boinc/; revision=804
This commit is contained in:
Seth Cooper 2003-01-08 23:55:21 +00:00
parent 2927cbc97f
commit a713d4fa21
6 changed files with 446 additions and 129 deletions

View File

@ -31,9 +31,24 @@
#define IDC_EDIT_SOCKS_NAME 1017
#define IDC_EDIT_SOCKS_PASS 1018
#define IDC_DONTASK 1019
#define IDC_STATIC_URL 1020
#define IDC_STATIC_AUTH 1021
#define IDC_CHECK_SOCKS 1022
#define IDC_STATIC_ASK 1022
#define IDC_EDIT_SOCKS_ADDR 1023
#define IDC_STATIC_TOP 1023
#define IDC_EDIT_SOCKS_PORT 1024
#define IDC_STATIC_BOTTOM 1024
#define IDC_STATIC_PROXY 1025
#define IDC_STATIC_HTTP 1026
#define IDC_STATIC_SOCKS 1027
#define IDC_STATIC_HTTP_ADDR 1028
#define IDC_STATIC_HTTP_PORT 1029
#define IDC_STATIC_SOCKS_ADDR 1030
#define IDC_STATIC_SOCKS_PORT 1031
#define IDC_STATIC_SOCKS_BLANK 1032
#define IDC_STATIC_SOCKS_NAME 1033
#define IDC_STATIC_SOCKS_PASS 1034
#define ID_ACCT_LOGIN 40001
#define ID_SETTINGS_LOGIN 40001
#define ID_HELP_ABOUT 40002
@ -73,7 +88,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 40036
#define _APS_NEXT_CONTROL_VALUE 1020
#define _APS_NEXT_CONTROL_VALUE 1035
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -59,22 +59,22 @@ FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,226,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,226,24,50,14
EDITTEXT IDC_LOGIN_URL,66,7,147,14,ES_AUTOHSCROLL
EDITTEXT IDC_LOGIN_AUTH,66,32,147,14,ES_AUTOHSCROLL
LTEXT "URL:",IDC_STATIC,7,7,56,8
LTEXT "Account Key:",IDC_STATIC,7,32,44,8
EDITTEXT IDC_LOGIN_URL,72,7,147,14,ES_AUTOHSCROLL
EDITTEXT IDC_LOGIN_AUTH,72,32,147,14,ES_AUTOHSCROLL
LTEXT "URL:",IDC_STATIC_URL,7,7,63,8
LTEXT "Account Key:",IDC_STATIC_AUTH,7,32,63,8
END
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 300, 67
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
CAPTION "Boinc Beta version"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,243,7,50,14
CTEXT "Berkeley Open Infrastructure for Network Computing",
IDC_STATIC,61,17,171,14
IDC_STATIC_TOP,61,17,171,14
CONTROL 110,IDC_STATIC,"Static",SS_BITMAP,13,17,33,31
CTEXT "Open Beta",IDC_STATIC,61,36,171,13
CTEXT "Open Beta",IDC_STATIC_BOTTOM,61,36,171,13
END
IDD_QUIT DIALOG DISCARDABLE 0, 0, 186, 70
@ -95,30 +95,30 @@ 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
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 Service Provider.",
IDC_STATIC_PROXY,17,7,176,46
GROUPBOX "HTTP Proxy",IDC_STATIC_HTTP,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
BS_AUTOCHECKBOX | WS_TABSTOP,19,71,173,10
LTEXT "http://",IDC_STATIC_HTTP_ADDR,32,86,22,8
LTEXT "Port number:",IDC_STATIC_HTTP_PORT,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
GROUPBOX "SOCKS Proxy",IDC_STATIC_SOCKS,7,131,198,122
CONTROL "Connect via SOCKS proxy server",IDC_CHECK_SOCKS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,19,143,173,10
LTEXT "SOCKS host:",IDC_STATIC_SOCKS_ADDR,32,158,42,8
LTEXT "Port number:",IDC_STATIC_SOCKS_PORT,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 |
GROUPBOX "Leave these blank if not needed",IDC_STATIC_SOCKS_BLANK,
13,193,186,54
LTEXT "SOCKS user name:",IDC_STATIC_SOCKS_NAME,32,209,64,8
LTEXT "SOCKS password:",IDC_STATIC_SOCKS_PASS,32,230,65,8
EDITTEXT IDC_EDIT_SOCKS_NAME,99,206,91,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_SOCKS_PASS,99,227,91,14,ES_PASSWORD |
ES_AUTOHSCROLL
END
@ -130,10 +130,10 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,153,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,153,24,50,14
LTEXT "BOINC needs to connect to the network. May it do so now?",
IDC_STATIC,7,7,138,24
IDC_STATIC_ASK,7,7,138,24
CONTROL "Don't ask this again (connect automatically)",
IDC_DONTASK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,47,
158,10
196,10
END
@ -230,7 +230,7 @@ END
IDR_CONTEXT MENU DISCARDABLE
BEGIN
POPUP "Status Icon"
POPUP "StatusIcon"
BEGIN
MENUITEM "Suspend", ID_STATUSICON_SUSPEND
MENUITEM "Resume", ID_STATUSICON_RESUME
@ -240,7 +240,7 @@ BEGIN
POPUP "Project"
BEGIN
MENUITEM "Relogin...", ID_PROJECT_RELOGIN
MENUITEM "Quit Project", ID_PROJECT_QUIT
MENUITEM "Quit Project...", ID_PROJECT_QUIT
END
END

View File

@ -41,6 +41,42 @@ CLoginDialog::CLoginDialog(UINT y, LPCTSTR szUrl, LPCTSTR szAuth) : CDialog(y)
m_strAuth.Format("%s", szAuth);
}
//////////
// CLoginDialog::LoadLanguage
// arguments: void
// returns: void
// function: loads new captions from language file
void CLoginDialog::LoadLanguage()
{
char szPath[256];
CString strSection;
GetCurrentDirectory(256, szPath);
strcat(szPath, "\\");
strcat(szPath, LANGUAGE_FILE_NAME);
CString strKey;
char szVal[256];
GetWindowText(strKey);
GetPrivateProfileString("DIALOG-LOGIN", "Title", strKey, szVal, 256, szPath);
SetWindowText(szVal);
GetDlgItemText(IDC_STATIC_URL, strKey);
GetPrivateProfileString("DIALOG-LOGIN", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_URL, szVal);
GetDlgItemText(IDC_STATIC_AUTH, strKey);
GetPrivateProfileString("DIALOG-LOGIN", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_AUTH, szVal);
GetDlgItemText(IDOK, strKey);
GetPrivateProfileString("DIALOG-LOGIN", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDOK, szVal);
GetDlgItemText(IDCANCEL, strKey);
GetPrivateProfileString("DIALOG-LOGIN", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDCANCEL, szVal);
GetPrivateProfileString("DIALOG-LOGIN", m_strUrlTT, m_strUrlTT, szVal, 256, szPath);
m_strUrlTT.Format("%s", szVal);
GetPrivateProfileString("DIALOG-LOGIN", m_strAuthTT, m_strAuthTT, szVal, 256, szPath);
m_strAuthTT.Format("%s", szVal);
}
//////////
// CLoginDialog::OnInitDialog
// arguments: void
@ -49,6 +85,9 @@ CLoginDialog::CLoginDialog(UINT y, LPCTSTR szUrl, LPCTSTR szAuth) : CDialog(y)
BOOL CLoginDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_strUrlTT.Format("The URL for the website of the project.");
m_strAuthTT.Format("The authorization code recieved in your confirmation email.");
LoadLanguage();
CWnd* pWndUrl = GetDlgItem(IDC_LOGIN_URL);
if(pWndUrl) {
pWndUrl->SetWindowText(m_strUrl);
@ -99,8 +138,8 @@ BOOL CLoginDialog::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
if(wnd) nID = wnd->GetDlgCtrlID();
}
if(nID == IDC_LOGIN_URL) strTipText.Format("The url for the website of the project.");
if(nID == IDC_LOGIN_AUTH) strTipText.Format("The authorization code recieved in your confirmation email.");
if(nID == IDC_LOGIN_URL) strTipText = m_strUrlTT;
if(nID == IDC_LOGIN_AUTH) strTipText = m_strAuthTT;
if(pNMHDR->code == TTN_NEEDTEXTA) {
lstrcpyn(pTTTA->szText, strTipText, sizeof(pTTTA->szText));
} else {
@ -130,6 +169,34 @@ CQuitDialog::CQuitDialog(UINT y) : CDialog(y)
{
}
//////////
// CQuitDialog::LoadLanguage
// arguments: void
// returns: void
// function: loads new captions from language file
void CQuitDialog::LoadLanguage()
{
char szPath[256];
CString strSection;
GetCurrentDirectory(256, szPath);
strcat(szPath, "\\");
strcat(szPath, LANGUAGE_FILE_NAME);
CString strKey;
char szVal[256];
GetWindowText(strKey);
GetPrivateProfileString("DIALOG-QUIT", "Title", strKey, szVal, 256, szPath);
SetWindowText(szVal);
GetDlgItemText(IDOK, strKey);
GetPrivateProfileString("DIALOG-QUIT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDOK, szVal);
GetDlgItemText(IDCANCEL, strKey);
GetPrivateProfileString("DIALOG-QUIT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDCANCEL, szVal);
GetPrivateProfileString("DIALOG-QUIT", m_strSelTT, m_strSelTT, szVal, 256, szPath);
m_strSelTT.Format("%s", szVal);
}
//////////
// CQuitDialog::OnInitDialog
// arguments: void
@ -138,6 +205,8 @@ CQuitDialog::CQuitDialog(UINT y) : CDialog(y)
BOOL CQuitDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_strSelTT.Format("Select the project you wish to quit.");
LoadLanguage();
CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST);
if(pListBox) {
for(int i = 0; i < gstate.projects.size(); i ++) {
@ -193,7 +262,7 @@ BOOL CQuitDialog::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
if(wnd) nID = wnd->GetDlgCtrlID();
}
if(nID == IDC_LIST) strTipText.Format("Select the project you wish to quit.");
if(nID == IDC_LIST) strTipText = m_strSelTT;
if(pNMHDR->code == TTN_NEEDTEXTA) {
lstrcpyn(pTTTA->szText, strTipText, sizeof(pTTTA->szText));
} else {
@ -223,6 +292,67 @@ CProxyDialog::CProxyDialog(UINT y) : CDialog(y)
{
}
//////////
// CProxyDialog::LoadLanguage
// arguments: void
// returns: void
// function: loads new captions from language file
void CProxyDialog::LoadLanguage()
{
char szPath[256];
CString strSection;
GetCurrentDirectory(256, szPath);
strcat(szPath, "\\");
strcat(szPath, LANGUAGE_FILE_NAME);
CString strKey;
char szVal[512];
GetWindowText(strKey);
GetPrivateProfileString("DIALOG-PROXY", "Title", strKey, szVal, 256, szPath);
SetWindowText(szVal);
GetDlgItemText(IDC_STATIC_PROXY, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 512, szPath);
SetDlgItemText(IDC_STATIC_PROXY, szVal);
GetDlgItemText(IDC_STATIC_HTTP, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_HTTP, szVal);
GetDlgItemText(IDC_CHECK_HTTP, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_CHECK_HTTP, szVal);
GetDlgItemText(IDC_STATIC_HTTP_ADDR, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_HTTP_ADDR, szVal);
GetDlgItemText(IDC_STATIC_HTTP_PORT, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_HTTP_PORT, szVal);
GetDlgItemText(IDC_STATIC_SOCKS, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_SOCKS, szVal);
GetDlgItemText(IDC_CHECK_SOCKS, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_CHECK_SOCKS, szVal);
GetDlgItemText(IDC_STATIC_SOCKS_ADDR, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_SOCKS_ADDR, szVal);
GetDlgItemText(IDC_STATIC_SOCKS_PORT, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_SOCKS_PORT, szVal);
GetDlgItemText(IDC_STATIC_SOCKS_BLANK, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_SOCKS_BLANK, szVal);
GetDlgItemText(IDC_STATIC_SOCKS_NAME, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_SOCKS_NAME, szVal);
GetDlgItemText(IDC_STATIC_SOCKS_PASS, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_SOCKS_PASS, szVal);
GetDlgItemText(IDOK, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDOK, szVal);
GetDlgItemText(IDCANCEL, strKey);
GetPrivateProfileString("DIALOG-PROXY", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDCANCEL, szVal);
}
//////////
// CProxyDialog::OnInitDialog
// arguments: void
@ -231,6 +361,7 @@ CProxyDialog::CProxyDialog(UINT y) : CDialog(y)
BOOL CProxyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
LoadLanguage();
CButton* pBtn;
// fill in http
@ -353,6 +484,49 @@ CConnectDialog::CConnectDialog(UINT y) : CDialog(y)
{
}
//////////
// CConnectDialog::LoadLanguage
// arguments: void
// returns: void
// function: loads new captions from language file
void CConnectDialog::LoadLanguage()
{
char szPath[256];
CString strSection;
GetCurrentDirectory(256, szPath);
strcat(szPath, "\\");
strcat(szPath, LANGUAGE_FILE_NAME);
CString strKey;
char szVal[256];
GetWindowText(strKey);
GetPrivateProfileString("DIALOG-CONNECT", "Title", strKey, szVal, 256, szPath);
SetWindowText(szVal);
GetDlgItemText(IDC_STATIC_ASK, strKey);
GetPrivateProfileString("DIALOG-CONNECT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_ASK, szVal);
GetDlgItemText(IDC_DONTASK, strKey);
GetPrivateProfileString("DIALOG-CONNECT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_DONTASK, szVal);
GetDlgItemText(IDOK, strKey);
GetPrivateProfileString("DIALOG-CONNECT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDOK, szVal);
GetDlgItemText(IDCANCEL, strKey);
GetPrivateProfileString("DIALOG-CONNECT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDCANCEL, szVal);
}
//////////
// CConnectDialog::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 CConnectDialog::OnInitDialog()
{
CDialog::OnInitDialog();
LoadLanguage();
return FALSE;
}
//////////
// CConnectDialog::OnOK
// arguments: void
@ -384,6 +558,34 @@ CAboutDialog::CAboutDialog(UINT y) : CDialog(y)
{
}
//////////
// CAboutDialog::LoadLanguage
// arguments: void
// returns: void
// function: loads new captions from language file
void CAboutDialog::LoadLanguage()
{
char szPath[256];
CString strSection;
GetCurrentDirectory(256, szPath);
strcat(szPath, "\\");
strcat(szPath, LANGUAGE_FILE_NAME);
CString strKey;
char szVal[256];
GetWindowText(strKey);
GetPrivateProfileString("DIALOG-ABOUT", "Title", strKey, szVal, 256, szPath);
SetWindowText(szVal);
GetDlgItemText(IDC_STATIC_TOP, strKey);
GetPrivateProfileString("DIALOG-ABOUT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_TOP, szVal);
GetDlgItemText(IDC_STATIC_BOTTOM, strKey);
GetPrivateProfileString("DIALOG-ABOUT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDC_STATIC_BOTTOM, szVal);
GetDlgItemText(IDOK, strKey);
GetPrivateProfileString("DIALOG-ABOUT", strKey, strKey, szVal, 256, szPath);
SetDlgItemText(IDOK, szVal);
}
//////////
// CAboutDialog::OnInitDialog
// arguments: void
@ -392,11 +594,14 @@ CAboutDialog::CAboutDialog(UINT y) : CDialog(y)
BOOL CAboutDialog::OnInitDialog()
{
CDialog::OnInitDialog();
LoadLanguage();
double xVersion = MAJOR_VERSION + MINOR_VERSION / 100.0;
CString strVersion;
strVersion.Format("BOINC Beta Version %0.2f", xVersion);
SetWindowText(strVersion);
CString strOldTitle, strVersion, strTitle;
GetWindowText(strOldTitle);
strVersion.Format("%0.2f", xVersion);
strTitle.Format("%s %s", strOldTitle, strVersion);
SetWindowText(strTitle);
CenterWindow();
return TRUE;
}

View File

@ -35,6 +35,10 @@ public:
CString m_strAuth;
protected:
CString m_strUrlTT;
CString m_strAuthTT;
void LoadLanguage();
afx_msg void OnOK();
afx_msg BOOL OnToolTipNotify(UINT, NMHDR*, LRESULT*);
DECLARE_MESSAGE_MAP()
@ -52,6 +56,9 @@ public:
int m_nSel;
protected:
CString m_strSelTT;
void LoadLanguage();
afx_msg void OnOK();
afx_msg BOOL OnToolTipNotify(UINT, NMHDR*, LRESULT*);
DECLARE_MESSAGE_MAP()
@ -70,6 +77,8 @@ public:
protected:
void EnableHttp(BOOL bEnable);
void EnableSocks(BOOL bEnable);
void LoadLanguage();
afx_msg void OnHttp();
afx_msg void OnSocks();
afx_msg void OnOK();
@ -84,8 +93,12 @@ class CConnectDialog : public CDialog
{
public:
CConnectDialog(UINT);
afx_msg BOOL OnInitDialog();
BOOL m_bDontAsk;
protected:
void LoadLanguage();
afx_msg void OnOK();
DECLARE_MESSAGE_MAP()
};
@ -101,6 +114,8 @@ public:
afx_msg BOOL OnInitDialog();
protected:
void LoadLanguage();
DECLARE_MESSAGE_MAP()
};

View File

@ -21,11 +21,41 @@
CMyApp g_myApp;
CMainWindow* g_myWnd = NULL;
char* g_szColumnTitles[MAX_LIST_ID][MAX_COLS] = {
{"Project", "Account", "Total Credit", "Avg. Credit", "Resource Share", NULL, NULL},
char g_szTabItems[MAX_TABS][256] = {
"Projects",
"Work",
"Transfers",
"Messages",
"Disk"
};
char g_szColumnTitles[MAX_LIST_ID][MAX_COLS][256] = {
{"Project", "Account", "Total Credit", "Avg. Credit", "Resource Share", "", ""},
{"Project", "Application", "Name", "CPU time", "Progress", "To Completion", "Status"},
{"Project", "File", "Progress", "Size", "Time", "Direction", NULL},
{"Project", "Time", "Message", NULL, NULL, NULL, NULL}
{"Project", "File", "Progress", "Size", "Time", "Direction", ""},
{"Project", "Time", "Message", "", "", "", ""}
};
char g_szUsageItems[MAX_USAGE_STR][256] = {
"Free space: not available for use",
"Free space: available for use",
"Used space: other than BOINC",
"Used space: BOINC",
"Used space:"
};
char g_szMiscItems[MAX_MISC_STR][256] = {
"New",
"Running",
"Ready to run",
"Computation done",
"Results uploaded",
"Acknowledged",
"Error: invalid state",
"Completed",
"Upload",
"Download"
};
/////////////////////////////////////////////////////////////////////////
@ -250,21 +280,21 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
// status
switch(re->state) {
case RESULT_NEW:
strBuf.Format("%s", "New"); break;
strBuf.Format(g_szMiscItems[0]); break;
case RESULT_FILES_DOWNLOADED:
if (at)
strBuf.Format("%s", "Running");
strBuf.Format(g_szMiscItems[1]);
else
strBuf.Format("%s", "Ready to run");
strBuf.Format(g_szMiscItems[2]);
break;
case RESULT_COMPUTE_DONE:
strBuf.Format("%s", "Computation done"); break;
strBuf.Format(g_szMiscItems[3]); break;
case RESULT_READY_TO_ACK:
strBuf.Format("%s", "Results uploaded"); break;
strBuf.Format(g_szMiscItems[4]); break;
case RESULT_SERVER_ACK:
strBuf.Format("%s", "Acknowledged"); break;
strBuf.Format(g_szMiscItems[5]); break;
default:
strBuf.Format("%s", "Error: invalid state"); break;
strBuf.Format(g_szMiscItems[6]); break;
}
m_ResultListCtrl.SetItemText(i, 6, strBuf);
}
@ -278,7 +308,7 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
if(!fi) {
m_XferListCtrl.SetItemColor(i, RGB(128, 128, 128));
m_XferListCtrl.SetItemProgress(i, 2, 100);
m_XferListCtrl.SetItemText(i, 3, "Completed");
m_XferListCtrl.SetItemText(i, 3, g_szMiscItems[7]);
continue;
}
@ -315,7 +345,7 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
m_XferListCtrl.SetItemText(i, 4, strBuf.GetBuffer(0));
// direction
m_XferListCtrl.SetItemText(i, 5, fi->fip->generated_locally?"Upload":"Download");
m_XferListCtrl.SetItemText(i, 5, fi->fip->generated_locally?g_szMiscItems[8]:g_szMiscItems[9]);
}
m_XferListCtrl.SetRedraw(TRUE);
@ -341,7 +371,7 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
for(i = 0; i < gstate.projects.size(); i ++) {
double xUsage;
CString strLabel;
strLabel.Format("Used space: %s", gstate.projects[i]->project_name);
strLabel.Format("%s: %s", g_szUsageItems[4], gstate.projects[i]->project_name);
gstate.project_disk_usage(gstate.projects[i], xUsage);
m_UsagePieCtrl.SetPieceLabel(i + 4, strLabel.GetBuffer(0));
m_UsagePieCtrl.SetPiece(i + 4, xUsage);
@ -522,13 +552,14 @@ void CMainWindow::SetStatusIcon(DWORD dwMessage)
// CMainWindow::SaveUserSettings
// arguments: void
// returns: void
// function: saves relevant user settings to boinc.ini
// function: saves relevant user settings to boinc ini file
void CMainWindow::SaveUserSettings()
{
char szPath[256];
CString strKey, strVal;
GetCurrentDirectory(256, szPath);
strcat(szPath, "\\boinc.ini");
strcat(szPath, "\\");
strcat(szPath, INI_FILE_NAME);
int colorder[MAX_COLS];
int i;
@ -596,13 +627,14 @@ void CMainWindow::SaveUserSettings()
// CMainWindow::LoadUserSettings
// arguments: void
// returns: void
// function: loads relevant user settings from boinc.ini
// function: loads relevant user settings from boinc ini file
void CMainWindow::LoadUserSettings()
{
char szPath[256], szVal[256];
CString strKey;
GetCurrentDirectory(256, szPath);
strcat(szPath, "\\boinc.ini");
strcat(szPath, "\\");
strcat(szPath, INI_FILE_NAME);
int i, nBuf;
int colorder[MAX_COLS];
@ -671,6 +703,93 @@ void CMainWindow::LoadUserSettings()
}
}
//////////
// CMainWindow::LoadLanguage
// arguments: void
// returns: void
// function: loads new captions from language file
void CMainWindow::LoadLanguage()
{
char szPath[256];
int col;
CString strSection;
GetCurrentDirectory(256, szPath);
strcat(szPath, "\\");
strcat(szPath, LANGUAGE_FILE_NAME);
// load column headers
strSection.Format("HEADER-%s", g_szTabItems[PROJECT_ID]);
for(col = 0; col < PROJECT_COLS; col ++) {
GetPrivateProfileString(strSection, g_szColumnTitles[PROJECT_ID][col], g_szColumnTitles[PROJECT_ID][col], g_szColumnTitles[PROJECT_ID][col], 256, szPath);
}
GetPrivateProfileString(strSection, "Title", g_szTabItems[PROJECT_ID], g_szTabItems[PROJECT_ID], 16, szPath);
strSection.Format("HEADER-%s", g_szTabItems[RESULT_ID]);
for(col = 0; col < RESULT_COLS; col ++) {
GetPrivateProfileString(strSection, g_szColumnTitles[RESULT_ID][col], g_szColumnTitles[RESULT_ID][col], g_szColumnTitles[RESULT_ID][col], 256, szPath);
}
GetPrivateProfileString(strSection, "Title", g_szTabItems[RESULT_ID], g_szTabItems[RESULT_ID], 16, szPath);
strSection.Format("HEADER-%s", g_szTabItems[XFER_ID]);
for(col = 0; col < XFER_COLS; col ++) {
GetPrivateProfileString(strSection, g_szColumnTitles[XFER_ID][col], g_szColumnTitles[XFER_ID][col], g_szColumnTitles[XFER_ID][col], 256, szPath);
}
GetPrivateProfileString(strSection, "Title", g_szTabItems[XFER_ID], g_szTabItems[XFER_ID], 16, szPath);
strSection.Format("HEADER-%s", g_szTabItems[MESSAGE_ID]);
for(col = 0; col < MESSAGE_COLS; col ++) {
GetPrivateProfileString(strSection, g_szColumnTitles[MESSAGE_ID][col], g_szColumnTitles[MESSAGE_ID][col], g_szColumnTitles[MESSAGE_ID][col], 256, szPath);
}
GetPrivateProfileString(strSection, "Title", g_szTabItems[MESSAGE_ID], g_szTabItems[MESSAGE_ID], 16, szPath);
// load usage labels
strSection.Format("HEADER-%s", g_szTabItems[USAGE_ID]);
for(col = 0; col < MAX_USAGE_STR; col ++) {
GetPrivateProfileString(strSection, g_szUsageItems[col], g_szUsageItems[col], g_szUsageItems[col], 256, szPath);
}
GetPrivateProfileString(strSection, "Title", g_szTabItems[USAGE_ID], g_szTabItems[USAGE_ID], 16, szPath);
// load miscellaneous text
strSection.Format("HEADER-MISC");
for(col = 0; col < MAX_MISC_STR; col ++) {
GetPrivateProfileString(strSection, g_szMiscItems[col], g_szMiscItems[col], g_szMiscItems[col], 256, szPath);
}
// load menu items
CString strItem, strItemNoAmp;
char szItem[256];
int i, is;
for(i = 0; i < m_MainMenu.GetMenuItemCount(); i ++) {
m_MainMenu.GetMenuString(i, strItem, MF_BYPOSITION);
strItemNoAmp = strItem; strItemNoAmp.Remove('&');
strSection.Format("MENU-%s", strItemNoAmp);
GetPrivateProfileString(strSection, "Title", strItem, szItem, 256, szPath);
m_MainMenu.ModifyMenu(i, MF_BYPOSITION|MF_STRING, 0, szItem);
CMenu* pSubMenu = m_MainMenu.GetSubMenu(i);
if(!pSubMenu) continue;
for(is = 0; is < pSubMenu->GetMenuItemCount(); is ++) {
pSubMenu->GetMenuString(is, strItem, MF_BYPOSITION);
if(strItem.IsEmpty()) continue;
strItemNoAmp = strItem; strItemNoAmp.Remove('&');
GetPrivateProfileString(strSection, strItemNoAmp, strItem, szItem, 256, szPath);
pSubMenu->ModifyMenu(is, MF_BYPOSITION|MF_STRING, pSubMenu->GetMenuItemID(is), szItem);
}
}
for(i = 0; i < m_ContextMenu.GetMenuItemCount(); i ++) {
m_ContextMenu.GetMenuString(i, strItem, MF_BYPOSITION);
strItemNoAmp = strItem; strItemNoAmp.Remove('&');
strSection.Format("MENU-%s", strItemNoAmp);
GetPrivateProfileString(strSection, "Title", strItem, szItem, 256, szPath);
m_ContextMenu.ModifyMenu(i, MF_BYPOSITION|MF_STRING, 0, szItem);
CMenu* pSubMenu = m_ContextMenu.GetSubMenu(i);
if(!pSubMenu) continue;
for(is = 0; is < pSubMenu->GetMenuItemCount(); is ++) {
pSubMenu->GetMenuString(is, strItem, MF_BYPOSITION);
if(strItem.IsEmpty()) continue;
strItemNoAmp = strItem; strItemNoAmp.Remove('&');
GetPrivateProfileString(strSection, strItemNoAmp, strItem, szItem, 256, szPath);
pSubMenu->ModifyMenu(is, MF_BYPOSITION|MF_STRING, pSubMenu->GetMenuItemID(is), szItem);
}
}
}
//////////
// CMainWindow::GetUserIdleTime
// arguments: void
@ -744,51 +863,6 @@ void CMainWindow::Syncronize(CProgressListCtrl* pProg, vector<void*>* pVect)
}
}
//////////
// CMainWindow::SyncronizePie
// arguments: pPie: pointer to a pie chart control
// pVect: pointer to a vector of projects
// returns: void
// function: like syncronize but for pie charts
void CMainWindow::SyncronizePie(CPieChartCtrl* pPie, vector<PROJECT*>* pVect)
{
/*
int i, j;
// add items to list that are not already in it
for(i = 0; i < pVect->size(); i ++) {
PROJECT* item = (*pVect)[i];
BOOL contained = false;
for(j = 0; j < pPie->GetItemCount(); j ++) {
if((DWORD)item == pPie->GetPieceData(j)) {
contained = true;
break;
}
}
if(!contained) {
pPie->AddPiece(item->project_name, RGB());
pPie->SetPieceData(i, (DWORD)item);
}
}
// remove items from list that are not in vector
// now just set the pointer to NULL but leave the item in the list
for(i = 0; i < pPie->GetItemCount(); i ++) {
DWORD item = pPie->GetItemData(i);
BOOL contained = false;
for(j = 0; j < pVect->size(); j ++) {
if(item == (DWORD)(*pVect)[j]) {
contained = true;
break;
}
}
if(!contained) {
pPie->SetPieceData(i, (DWORD)NULL);
}
}
*/
}
//////////
// CMainWindow::PostNcDestroy
// arguments: void
@ -1120,7 +1194,7 @@ void CMainWindow::OnCommandResume()
void CMainWindow::OnCommandExit()
{
// quit
gstate.exit();
gstate.cleanup_and_exit();
PostQuitMessage(0);
KillTimer(ID_TIMER);
@ -1136,6 +1210,7 @@ void CMainWindow::OnCommandExit()
m_TabBMP[4].DeleteObject();
m_TabIL.DeleteImageList();
m_MainMenu.DestroyMenu();
m_ContextMenu.DestroyMenu();
// free dll and idle detection
if(m_hIdleDll) {
@ -1164,6 +1239,8 @@ void CMainWindow::OnCommandExit()
int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
{
char curDir[512];
char* szTitles[MAX_COLS];
int i;
if (CWnd::OnCreate(lpcs) == -1) {
return -1;
@ -1175,15 +1252,19 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
m_bRequest = false;
m_nContextItem = -1;
// load main menu
// load menus
m_ContextMenu.LoadMenu(IDR_CONTEXT);
m_MainMenu.LoadMenu(IDR_MAINFRAME);
SetMenu(&m_MainMenu);
LoadLanguage();
// create project list control
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);
m_ProjectListCtrl.SetMenuItems(g_szColumnTitles[PROJECT_ID], PROJECT_COLS);
for(int i = 0; i < PROJECT_COLS; i ++) {
for(i = 0; i < MAX_COLS; i ++) szTitles[i] = g_szColumnTitles[PROJECT_ID][i];
m_ProjectListCtrl.SetMenuItems(szTitles, PROJECT_COLS);
for(i = 0; i < PROJECT_COLS; i ++) {
m_ProjectListCtrl.InsertColumn(i, g_szColumnTitles[PROJECT_ID][i], LVCFMT_LEFT, DEF_COL_WIDTH, -1);
}
@ -1191,7 +1272,8 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
m_ResultListCtrl.Create(LVS_REPORT|WS_CHILD|WS_BORDER|WS_VISIBLE, CRect(0,0,0,0), this, RESULT_ID);
m_ResultListCtrl.SetExtendedStyle(m_ResultListCtrl.GetExtendedStyle()|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT);
m_ResultListCtrl.ModifyStyle(WS_VISIBLE, 0);
m_ResultListCtrl.SetMenuItems(g_szColumnTitles[RESULT_ID], RESULT_COLS);
for(i = 0; i < MAX_COLS; i ++) szTitles[i] = g_szColumnTitles[RESULT_ID][i];
m_ResultListCtrl.SetMenuItems(szTitles, RESULT_COLS);
for(i = 0; i < RESULT_COLS; i ++) {
m_ResultListCtrl.InsertColumn(i, g_szColumnTitles[RESULT_ID][i], LVCFMT_LEFT, DEF_COL_WIDTH, -1);
}
@ -1200,7 +1282,8 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
m_XferListCtrl.Create(LVS_REPORT|WS_CHILD|WS_BORDER|WS_VISIBLE, CRect(0,0,0,0), this, XFER_ID);
m_XferListCtrl.SetExtendedStyle(m_XferListCtrl.GetExtendedStyle()|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT);
m_XferListCtrl.ModifyStyle(WS_VISIBLE, 0);
m_XferListCtrl.SetMenuItems(g_szColumnTitles[XFER_ID], XFER_COLS);
for(i = 0; i < MAX_COLS; i ++) szTitles[i] = g_szColumnTitles[XFER_ID][i];
m_XferListCtrl.SetMenuItems(szTitles, XFER_COLS);
for(i = 0; i < XFER_COLS; i ++) {
m_XferListCtrl.InsertColumn(i, g_szColumnTitles[XFER_ID][i], LVCFMT_LEFT, DEF_COL_WIDTH, -1);
}
@ -1210,7 +1293,8 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
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);
m_MessageListCtrl.SetMenuItems(g_szColumnTitles[MESSAGE_ID], MESSAGE_COLS);
for(i = 0; i < MAX_COLS; i ++) szTitles[i] = g_szColumnTitles[MESSAGE_ID][i];
m_MessageListCtrl.SetMenuItems(szTitles, MESSAGE_COLS);
for(i = 0; i < MESSAGE_COLS; i ++) {
int width = DEF_COL_WIDTH;
if(i == 1) width *= 1.5;
@ -1221,13 +1305,13 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
// 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 space: not available for use", GetPieColor(0), 0);
m_UsagePieCtrl.AddPiece("Free space: available for use", GetPieColor(1), 0);
m_UsagePieCtrl.AddPiece("Used space: other than BOINC", GetPieColor(2), 0);
m_UsagePieCtrl.AddPiece("Used space: BOINC", GetPieColor(3), 0);
m_UsagePieCtrl.AddPiece(g_szUsageItems[0], GetPieColor(0), 0);
m_UsagePieCtrl.AddPiece(g_szUsageItems[1], GetPieColor(1), 0);
m_UsagePieCtrl.AddPiece(g_szUsageItems[2], GetPieColor(2), 0);
m_UsagePieCtrl.AddPiece(g_szUsageItems[3], GetPieColor(3), 0);
// set up image list for tab control
m_TabIL.Create(16, 16, ILC_COLOR8|ILC_MASK, 5, 1);
m_TabIL.Create(16, 16, ILC_COLOR8|ILC_MASK, MAX_TABS, 1);
m_TabBMP[0].LoadBitmap(IDB_PROJ);
m_TabIL.Add(&m_TabBMP[0], RGB(255, 0, 255));
m_TabBMP[1].LoadBitmap(IDB_RESULT);
@ -1242,11 +1326,11 @@ int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
// create tab control
m_TabCtrl.Create(TCS_FIXEDWIDTH|TCS_BUTTONS|TCS_FLATBUTTONS|TCS_FOCUSNEVER|WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), this, TAB_ID);
m_TabCtrl.SetImageList(&m_TabIL);
m_TabCtrl.InsertItem(1, "Projects", 0);
m_TabCtrl.InsertItem(2, "Work", 1);
m_TabCtrl.InsertItem(3, "Transfers", 2);
m_TabCtrl.InsertItem(4, "Messages", 3);
m_TabCtrl.InsertItem(5, "Disk", 4);
m_TabCtrl.InsertItem(1, g_szTabItems[0], 0);
m_TabCtrl.InsertItem(2, g_szTabItems[1], 1);
m_TabCtrl.InsertItem(3, g_szTabItems[2], 2);
m_TabCtrl.InsertItem(4, g_szTabItems[3], 3);
m_TabCtrl.InsertItem(5, g_szTabItems[4], 4);
// make all fonts the same nice font
CFont* pFont;
@ -1357,7 +1441,6 @@ BOOL CMainWindow::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
// function: shows context menu for list items
void CMainWindow::OnRButtonDown(UINT nFlags, CPoint point)
{
CMenu WholeMenu;
CMenu* pContextMenu = NULL;
GetCursorPos(&point);
CRect rt;
@ -1378,8 +1461,7 @@ void CMainWindow::OnRButtonDown(UINT nFlags, CPoint point)
pMenuCtrl->GetItemRect(i, &rt, LVIR_BOUNDS);
pMenuCtrl->ClientToScreen(&rt);
if(rt.PtInRect(point)) {
WholeMenu.LoadMenu(IDR_CONTEXT);
pContextMenu = WholeMenu.GetSubMenu(nMenuId);
pContextMenu = m_ContextMenu.GetSubMenu(nMenuId);
if(pContextMenu) {
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, point.x, point.y, this);
m_nContextItem = i;
@ -1476,22 +1558,16 @@ LRESULT CMainWindow::OnStatusIcon(WPARAM wParam, LPARAM lParam)
CPoint point;
SetForegroundWindow();
GetCursorPos(&point);
CMenu Menu, *pSubmenu;
if(!Menu.LoadMenu(IDR_CONTEXT)) {
return FALSE;
}
pSubmenu = Menu.GetSubMenu(STATUS_MENU);
if(!pSubmenu) {
Menu.DestroyMenu();
return FALSE;
}
CMenu* pSubmenu;
pSubmenu = m_ContextMenu.GetSubMenu(STATUS_MENU);
if(m_bSuspend) {
pSubmenu->EnableMenuItem(ID_STATUSICON_SUSPEND, MF_GRAYED);
pSubmenu->EnableMenuItem(ID_STATUSICON_RESUME, MF_ENABLED);
} else {
pSubmenu->EnableMenuItem(ID_STATUSICON_SUSPEND, MF_ENABLED);
pSubmenu->EnableMenuItem(ID_STATUSICON_RESUME, MF_GRAYED);
}
pSubmenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, point.x, point.y, this);
Menu.DestroyMenu();
} else if(lParam == WM_LBUTTONDOWN) {
if(IsWindowVisible()) {
SetForegroundWindow();

View File

@ -64,6 +64,10 @@
#define MESSAGE_COLS 3
#define MAX_COLS 7
#define MAX_TABS 5
#define MAX_USAGE_STR 5
#define MAX_MISC_STR 10
//////////
// class: CMyApp
// parent: CWinApp
@ -90,6 +94,7 @@ public:
protected:
CMenu m_MainMenu; // window's main menu
CMenu m_ContextMenu; // context menu for status icon and lists
CProgressListCtrl m_ProjectListCtrl; // list control
CProgressListCtrl m_XferListCtrl; // list control
CProgressListCtrl m_ResultListCtrl; // list control
@ -98,7 +103,7 @@ protected:
CFont m_Font; // window's font
CTabCtrl m_TabCtrl; // tab control for choosing display
CImageList m_TabIL; // image list for tab control
CBitmap m_TabBMP[5]; // bitmaps for tab image list
CBitmap m_TabBMP[MAX_TABS]; // bitmaps for tab image list
HINSTANCE m_hIdleDll; // handle to dll for user idle
int m_nIconState; // state of the status icon
BOOL m_bMessage; // does the user have a new message?
@ -111,6 +116,7 @@ protected:
void SetStatusIcon(DWORD);
void SaveUserSettings();
void LoadUserSettings();
void LoadLanguage();
DWORD GetUserIdleTime();
void Syncronize(CProgressListCtrl*, vector<void*>*);
void SyncronizePie(CPieChartCtrl*, vector<PROJECT*>*);