2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-07-13 10:36:18 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2004-07-13 10:36:18 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-12-18 20:24:56 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2002-12-18 20:24:56 +00:00
|
|
|
|
2004-12-06 23:02:47 +00:00
|
|
|
#include "stdafx.h"
|
2004-03-04 11:41:43 +00:00
|
|
|
|
2002-12-18 20:24:56 +00:00
|
|
|
#include "wingui_dialog.h"
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
// CLoginDialog message map and member functions
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CLoginDialog, CDialog)
|
|
|
|
ON_BN_CLICKED(IDOK, OnOK)
|
2004-03-19 03:12:40 +00:00
|
|
|
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify)
|
2002-12-18 20:24:56 +00:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
//////////
|
|
|
|
// CLoginDialog::CLoginDialog
|
|
|
|
// arguments: y: dialog box resource id
|
|
|
|
// szUrl: the initial url
|
|
|
|
// szAuth: the initial autorization
|
|
|
|
// returns: void
|
|
|
|
// function: calls parents contructor, sets member variables
|
|
|
|
CLoginDialog::CLoginDialog(UINT y, LPCTSTR szUrl, LPCTSTR szAuth) : CDialog(y)
|
|
|
|
{
|
|
|
|
m_strUrl.Format("%s", szUrl);
|
|
|
|
m_strAuth.Format("%s", szAuth);
|
|
|
|
}
|
|
|
|
|
2003-01-08 23:55:21 +00:00
|
|
|
//////////
|
|
|
|
// CLoginDialog::LoadLanguage
|
|
|
|
// arguments: void
|
|
|
|
// returns: void
|
|
|
|
// function: loads new captions from language file
|
|
|
|
void CLoginDialog::LoadLanguage()
|
|
|
|
{
|
2003-07-31 23:11:53 +00:00
|
|
|
int const static nIDs[] = { IDC_STATIC_URL, IDC_STATIC_AUTH, IDOK, IDCANCEL, 0 };
|
|
|
|
CString * const pStrs[] = { &m_strUrlTT, &m_strAuthTT, 0 };
|
|
|
|
UpdateLanguageStrings(this, "DIALOG-LOGIN", nIDs, pStrs);
|
2003-01-08 23:55:21 +00:00
|
|
|
}
|
|
|
|
|
2002-12-18 20:24:56 +00:00
|
|
|
//////////
|
|
|
|
// CLoginDialog::OnInitDialog
|
|
|
|
// arguments: void
|
|
|
|
// returns: true if windows needs to give dialog focus, false if dialog has taken focus
|
|
|
|
// function: initializes and centers dialog box
|
2004-07-13 10:36:18 +00:00
|
|
|
BOOL CLoginDialog::OnInitDialog()
|
2002-12-18 20:24:56 +00:00
|
|
|
{
|
|
|
|
CDialog::OnInitDialog();
|
2003-01-08 23:55:21 +00:00
|
|
|
m_strUrlTT.Format("The URL for the website of the project.");
|
2004-07-11 21:54:00 +00:00
|
|
|
m_strAuthTT.Format("The account ID received in your confirmation email.");
|
2003-01-08 23:55:21 +00:00
|
|
|
LoadLanguage();
|
2002-12-18 20:24:56 +00:00
|
|
|
CWnd* pWndUrl = GetDlgItem(IDC_LOGIN_URL);
|
|
|
|
if(pWndUrl) {
|
|
|
|
pWndUrl->SetWindowText(m_strUrl);
|
|
|
|
}
|
|
|
|
CWnd* pWndAuth = GetDlgItem(IDC_LOGIN_AUTH);
|
|
|
|
if(pWndAuth) {
|
|
|
|
pWndAuth->SetWindowText(m_strAuth);
|
|
|
|
}
|
|
|
|
CWnd* pWndFocus = GetDlgItem(IDC_LOGIN_URL);
|
|
|
|
if(pWndFocus) pWndFocus->SetFocus();
|
|
|
|
CenterWindow();
|
|
|
|
EnableToolTips(TRUE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////
|
|
|
|
// CLoginDialog::OnOK
|
|
|
|
// arguments: void
|
|
|
|
// returns: void
|
|
|
|
// function: copies strings from edit controls to member variables.
|
2004-07-13 10:36:18 +00:00
|
|
|
void CLoginDialog::OnOK()
|
2002-12-18 20:24:56 +00:00
|
|
|
{
|
|
|
|
GetDlgItemText(IDC_LOGIN_URL, m_strUrl);
|
|
|
|
GetDlgItemText(IDC_LOGIN_AUTH, m_strAuth);
|
|
|
|
CDialog::OnOK();
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////
|
|
|
|
// CLoginDialog::OnToolTipNotify
|
|
|
|
// arguments: id: id of the window, actually its hwnd
|
|
|
|
// pNMHDR: pointer to notification message header
|
|
|
|
// pResult: pointer to result of notification
|
|
|
|
// returns: true if the notification is processed, otherwise false
|
2004-07-13 10:36:18 +00:00
|
|
|
// function: handles notifications of tool tips by filling in
|
2002-12-18 20:24:56 +00:00
|
|
|
// text for tool tips
|
|
|
|
BOOL CLoginDialog::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
|
|
|
|
{
|
2004-03-19 03:12:40 +00:00
|
|
|
TOOLTIPTEXT* pTTT = (TOOLTIPTEXT*)pNMHDR;
|
2002-12-18 20:24:56 +00:00
|
|
|
|
2004-03-19 03:12:40 +00:00
|
|
|
if(pTTT->uFlags & TTF_IDISHWND) {
|
|
|
|
|
|
|
|
// idFrom is actually the HWND of the tool
|
|
|
|
UINT nID = ::GetDlgCtrlID((HWND)pNMHDR->idFrom);
|
|
|
|
|
|
|
|
if(nID == IDC_LOGIN_URL) {
|
|
|
|
lstrcpyn(pTTT->szText, m_strUrlTT, (sizeof(pTTT->szText)/sizeof(TCHAR)));
|
|
|
|
}
|
|
|
|
if(nID == IDC_LOGIN_AUTH) {
|
|
|
|
lstrcpyn(pTTT->szText, m_strAuthTT, (sizeof(pTTT->szText)/sizeof(TCHAR)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*pResult = 0;
|
2002-12-18 20:24:56 +00:00
|
|
|
|
|
|
|
// message was handled
|
2004-03-19 03:12:40 +00:00
|
|
|
return TRUE;
|
2002-12-18 20:24:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
// CConnectDialog message map and member functions
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CConnectDialog, CDialog)
|
|
|
|
ON_BN_CLICKED(IDOK, OnOK)
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
//////////
|
|
|
|
// CConnectDialog::CConnectDialog
|
|
|
|
// arguments: y: dialog box resource id
|
|
|
|
// returns: void
|
|
|
|
// function: calls parents contructor.
|
|
|
|
CConnectDialog::CConnectDialog(UINT y) : CDialog(y)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-08 23:55:21 +00:00
|
|
|
//////////
|
|
|
|
// CConnectDialog::LoadLanguage
|
|
|
|
// arguments: void
|
|
|
|
// returns: void
|
|
|
|
// function: loads new captions from language file
|
|
|
|
void CConnectDialog::LoadLanguage()
|
|
|
|
{
|
2003-07-31 23:11:53 +00:00
|
|
|
int const static nIDs[] = { IDC_STATIC_ASK, IDC_DONTASK, IDOK, IDCANCEL, 0 };
|
|
|
|
UpdateLanguageStrings(this, "DIALOG-CONNECT", nIDs);
|
2003-01-08 23:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////
|
|
|
|
// 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
|
2004-07-13 10:36:18 +00:00
|
|
|
BOOL CConnectDialog::OnInitDialog()
|
2003-01-08 23:55:21 +00:00
|
|
|
{
|
|
|
|
CDialog::OnInitDialog();
|
|
|
|
LoadLanguage();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-12-18 20:24:56 +00:00
|
|
|
//////////
|
|
|
|
// CConnectDialog::OnOK
|
|
|
|
// arguments: void
|
|
|
|
// returns: void
|
|
|
|
// function: sets member variables
|
2004-07-13 10:36:18 +00:00
|
|
|
void CConnectDialog::OnOK()
|
2002-12-18 20:24:56 +00:00
|
|
|
{
|
|
|
|
CDialog::OnOK();
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
// CAboutDialog message map and member functions
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CAboutDialog, CDialog)
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
//////////
|
|
|
|
// CAboutDialog::CAboutDialog
|
|
|
|
// arguments: y: dialog box resource id
|
|
|
|
// returns: void
|
|
|
|
// function: calls parents contructor.
|
|
|
|
CAboutDialog::CAboutDialog(UINT y) : CDialog(y)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-08 23:55:21 +00:00
|
|
|
//////////
|
|
|
|
// CAboutDialog::LoadLanguage
|
|
|
|
// arguments: void
|
|
|
|
// returns: void
|
|
|
|
// function: loads new captions from language file
|
|
|
|
void CAboutDialog::LoadLanguage()
|
|
|
|
{
|
2003-07-31 23:11:53 +00:00
|
|
|
const int nIDs[] = { IDC_STATIC_TOP, IDC_STATIC_BOTTOM, IDOK, 0 };
|
|
|
|
UpdateLanguageStrings(this, "DIALOG-ABOUT", nIDs);
|
2003-01-08 23:55:21 +00:00
|
|
|
}
|
|
|
|
|
2002-12-18 20:24:56 +00:00
|
|
|
//////////
|
|
|
|
// CAboutDialog::OnInitDialog
|
|
|
|
// arguments: void
|
|
|
|
// returns: true if windows needs to give dialog focus, false if dialog has taken focus
|
|
|
|
// function: initializes and centers dialog box
|
2004-07-13 10:36:18 +00:00
|
|
|
BOOL CAboutDialog::OnInitDialog()
|
2002-12-18 20:24:56 +00:00
|
|
|
{
|
|
|
|
CDialog::OnInitDialog();
|
2004-07-13 10:36:18 +00:00
|
|
|
LoadLanguage();
|
2002-12-18 20:24:56 +00:00
|
|
|
|
2004-07-13 10:36:18 +00:00
|
|
|
CString strOldTitle, strTitle;
|
|
|
|
GetWindowText(strOldTitle);
|
2004-06-01 23:15:54 +00:00
|
|
|
#ifdef _DEBUG
|
2004-07-13 10:36:18 +00:00
|
|
|
strTitle.Format("%s %s (DEBUG)", strOldTitle, BOINC_VERSION_STRING);
|
2004-06-01 23:15:54 +00:00
|
|
|
#else
|
2004-07-13 10:36:18 +00:00
|
|
|
strTitle.Format("%s %s", strOldTitle, BOINC_VERSION_STRING);
|
2004-06-01 23:15:54 +00:00
|
|
|
#endif
|
|
|
|
SetWindowText(strTitle);
|
2002-12-18 20:24:56 +00:00
|
|
|
CenterWindow();
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_5a34f25aa3 = "$Id$";
|