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-05-17 22:15:10 +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-04-10 09:11:03 +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.
|
2004-05-17 22:15:10 +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
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "MainFrame.h"
|
|
|
|
#endif
|
|
|
|
|
2006-01-30 13:19:32 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include "mac/MacGUI.pch"
|
|
|
|
#endif
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
#include "stdwx.h"
|
2005-06-28 22:22:29 +00:00
|
|
|
#include "hyperlink.h"
|
2004-04-10 20:25:27 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "MainFrame.h"
|
2004-07-13 05:56:03 +00:00
|
|
|
#include "Events.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "BOINCBaseView.h"
|
2006-02-16 18:26:30 +00:00
|
|
|
#include "BOINCDialupManager.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "ViewProjects.h"
|
2005-04-21 06:04:26 +00:00
|
|
|
#include "ViewWork.h"
|
|
|
|
#include "ViewTransfers.h"
|
|
|
|
#include "ViewMessages.h"
|
|
|
|
#include "ViewStatistics.h"
|
|
|
|
#include "ViewResources.h"
|
2004-04-10 20:25:27 +00:00
|
|
|
#include "DlgAbout.h"
|
2006-01-23 11:30:25 +00:00
|
|
|
#include "DlgGenericMessage.h"
|
|
|
|
#include "DlgOptions.h"
|
2005-03-30 09:24:31 +00:00
|
|
|
#include "DlgSelectComputer.h"
|
2005-10-03 23:14:39 +00:00
|
|
|
#include "wizardex.h"
|
|
|
|
#include "BOINCWizards.h"
|
|
|
|
#include "BOINCBaseWizard.h"
|
|
|
|
#include "WizardAttachProject.h"
|
|
|
|
#include "WizardAccountManager.h"
|
2006-02-16 18:26:30 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
#include "mac/MacGUI.pch"
|
|
|
|
#endif
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-10-28 07:03:06 +00:00
|
|
|
#include "res/connect.xpm"
|
|
|
|
#include "res/disconnect.xpm"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
enum STATUSBARFIELDS {
|
2004-10-28 22:51:38 +00:00
|
|
|
STATUS_TEXT,
|
|
|
|
STATUS_CONNECTION_STATUS
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-03-10 05:07:01 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CStatusBar, wxStatusBar)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CStatusBar, wxStatusBar)
|
|
|
|
EVT_SIZE(CStatusBar::OnSize)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CStatusBar::CStatusBar() {
|
2005-03-10 05:07:01 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Default Constructor Function Begin"));
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Default Constructor Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CStatusBar::CStatusBar(wxWindow *parent) :
|
|
|
|
wxStatusBar(parent, ID_STATUSBAR, wxST_SIZEGRIP, _T("statusBar"))
|
2005-03-10 05:07:01 +00:00
|
|
|
{
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Function Begin"));
|
|
|
|
|
2005-04-10 19:01:23 +00:00
|
|
|
const int widths[] = {-1, 200, 20};
|
2005-03-10 05:07:01 +00:00
|
|
|
SetFieldsCount(WXSIZEOF(widths), widths);
|
|
|
|
|
|
|
|
m_pbmpConnected = new wxStaticBitmap(this, -1, wxIcon(connect_xpm));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pbmpConnected);
|
2005-03-10 05:07:01 +00:00
|
|
|
m_pbmpConnected->Hide();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_ptxtConnected = new wxStaticText(this, -1, _("Connected"), wxPoint(0, 0), wxDefaultSize, wxALIGN_LEFT);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_ptxtConnected);
|
2005-03-10 05:07:01 +00:00
|
|
|
m_ptxtConnected->Hide();
|
|
|
|
|
|
|
|
m_pbmpDisconnect = new wxStaticBitmap(this, -1, wxIcon(disconnect_xpm));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pbmpDisconnect);
|
2005-03-10 05:07:01 +00:00
|
|
|
m_pbmpDisconnect->Hide();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_ptxtDisconnect = new wxStaticText(this, -1, _("Disconnected"), wxPoint(0, 0), wxDefaultSize, wxALIGN_LEFT);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_ptxtDisconnect);
|
2005-03-10 05:07:01 +00:00
|
|
|
m_ptxtDisconnect->Hide();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::CStatusBar - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CStatusBar::~CStatusBar()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CStatusBar::OnSize(wxSizeEvent& event) {
|
2005-03-10 05:07:01 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::OnSize - Function Begin"));
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (IsShown()) {
|
2005-03-10 05:07:01 +00:00
|
|
|
wxRect rect;
|
|
|
|
wxSize size;
|
|
|
|
|
|
|
|
GetFieldRect(STATUS_CONNECTION_STATUS, rect);
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_pbmpConnected) {
|
2005-03-10 05:07:01 +00:00
|
|
|
size = m_pbmpConnected->GetSize();
|
|
|
|
m_pbmpConnected->Move(rect.x + 1,
|
|
|
|
rect.y + (rect.height - size.y) / 2);
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_ptxtConnected) {
|
2005-03-10 05:07:01 +00:00
|
|
|
m_ptxtConnected->Move((rect.x + size.x) + 2,
|
|
|
|
(rect.y + (rect.height - size.y) / 2) + 1);
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_pbmpDisconnect) {
|
2005-03-10 05:07:01 +00:00
|
|
|
size = m_pbmpConnected->GetSize();
|
|
|
|
m_pbmpDisconnect->Move(rect.x + 1,
|
|
|
|
rect.y + (rect.height - size.y) / 2);
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_ptxtDisconnect) {
|
2005-03-10 05:07:01 +00:00
|
|
|
m_ptxtDisconnect->Move((rect.x + size.x) + 2,
|
|
|
|
(rect.y + (rect.height - size.y) / 2) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CStatusBar::OnSize - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-17 04:53:35 +00:00
|
|
|
DEFINE_EVENT_TYPE(wxEVT_MAINFRAME_ALERT)
|
2005-04-08 16:58:55 +00:00
|
|
|
DEFINE_EVENT_TYPE(wxEVT_MAINFRAME_CONNECT)
|
|
|
|
DEFINE_EVENT_TYPE(wxEVT_MAINFRAME_INITIALIZED)
|
|
|
|
DEFINE_EVENT_TYPE(wxEVT_MAINFRAME_REFRESHVIEW)
|
2005-04-08 04:23:37 +00:00
|
|
|
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CMainFrame, wxFrame)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE (CMainFrame, wxFrame)
|
2005-07-22 06:56:34 +00:00
|
|
|
EVT_MENU(ID_FILERUNBENCHMARKS, CMainFrame::OnRunBenchmarks)
|
|
|
|
EVT_MENU(ID_FILESELECTCOMPUTER, CMainFrame::OnSelectComputer)
|
2004-09-24 02:01:53 +00:00
|
|
|
EVT_MENU(wxID_EXIT, CMainFrame::OnExit)
|
2005-10-05 19:01:28 +00:00
|
|
|
EVT_MENU_RANGE(ID_FILEACTIVITYRUNALWAYS, ID_FILEACTIVITYSUSPEND, CMainFrame::OnActivitySelection)
|
|
|
|
EVT_MENU_RANGE(ID_FILENETWORKRUNALWAYS, ID_FILENETWORKSUSPEND, CMainFrame::OnNetworkSelection)
|
2005-09-06 08:58:56 +00:00
|
|
|
EVT_MENU(ID_PROJECTSATTACHACCOUNTMANAGER, CMainFrame::OnProjectsAttachToAccountManager)
|
2006-02-02 12:32:21 +00:00
|
|
|
EVT_MENU(ID_TOOLSAMUPDATENOW, CMainFrame::OnAccountManagerUpdate)
|
|
|
|
EVT_MENU(ID_ADVANCEDAMDEFECT, CMainFrame::OnAccountManagerDetach)
|
2005-09-06 08:58:56 +00:00
|
|
|
EVT_MENU(ID_PROJECTSATTACHPROJECT, CMainFrame::OnProjectsAttachToProject)
|
2006-02-02 12:32:21 +00:00
|
|
|
EVT_MENU(ID_COMMANDSRETRYCOMMUNICATIONS, CMainFrame::OnCommandsRetryCommunications)
|
2005-09-06 08:58:56 +00:00
|
|
|
EVT_MENU(ID_OPTIONSOPTIONS, CMainFrame::OnOptionsOptions)
|
2005-06-21 17:27:39 +00:00
|
|
|
EVT_HELP(ID_FRAME, CMainFrame::OnHelp)
|
2005-06-17 04:53:35 +00:00
|
|
|
EVT_MENU(ID_HELPBOINCMANAGER, CMainFrame::OnHelpBOINCManager)
|
2005-05-05 06:07:14 +00:00
|
|
|
EVT_MENU(ID_HELPBOINC, CMainFrame::OnHelpBOINCWebsite)
|
|
|
|
EVT_MENU(wxID_ABOUT, CMainFrame::OnHelpAbout)
|
2004-10-24 07:38:38 +00:00
|
|
|
EVT_CLOSE(CMainFrame::OnClose)
|
2006-04-14 03:09:24 +00:00
|
|
|
EVT_SHOW(CMainFrame::OnShow)
|
2005-06-17 04:53:35 +00:00
|
|
|
EVT_MAINFRAME_ALERT(CMainFrame::OnAlert)
|
2005-04-08 04:23:37 +00:00
|
|
|
EVT_MAINFRAME_CONNECT(CMainFrame::OnConnect)
|
|
|
|
EVT_MAINFRAME_INITIALIZED(CMainFrame::OnInitialized)
|
|
|
|
EVT_MAINFRAME_REFRESH(CMainFrame::OnRefreshView)
|
2005-03-07 23:52:28 +00:00
|
|
|
EVT_TIMER(ID_REFRESHSTATETIMER, CMainFrame::OnRefreshState)
|
2004-12-10 20:46:43 +00:00
|
|
|
EVT_TIMER(ID_FRAMERENDERTIMER, CMainFrame::OnFrameRender)
|
|
|
|
EVT_TIMER(ID_FRAMELISTRENDERTIMER, CMainFrame::OnListPanelRender)
|
2005-04-10 02:24:08 +00:00
|
|
|
EVT_TIMER(ID_DOCUMENTPOLLTIMER, CMainFrame::OnDocumentPoll)
|
2004-10-21 14:29:59 +00:00
|
|
|
EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CMainFrame::OnNotebookSelectionChanged)
|
2004-05-21 06:27:15 +00:00
|
|
|
END_EVENT_TABLE ()
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-10-23 07:13:18 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CMainFrame::CMainFrame() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CMainFrame - Default Constructor Function Begin"));
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CMainFrame - Default Constructor Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
CMainFrame::CMainFrame(wxString title, wxIcon* icon) :
|
|
|
|
wxFrame ((wxFrame *)NULL, ID_FRAME, title, wxDefaultPosition, wxDefaultSize,
|
2004-04-10 09:11:03 +00:00
|
|
|
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
|
|
|
{
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CMainFrame - Function Begin"));
|
2004-12-03 22:06:39 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
m_pMenubar = NULL;
|
|
|
|
m_pNotebook = NULL;
|
|
|
|
m_pStatusbar = NULL;
|
2005-06-29 05:21:47 +00:00
|
|
|
|
|
|
|
// Configuration Settings
|
2005-03-10 05:07:01 +00:00
|
|
|
m_iSelectedLanguage = 0;
|
2005-06-24 10:49:42 +00:00
|
|
|
m_iReminderFrequency = 0;
|
2006-01-23 11:30:25 +00:00
|
|
|
m_iDisplayExitWarning = 1;
|
2004-10-28 22:51:38 +00:00
|
|
|
|
2006-04-14 11:27:37 +00:00
|
|
|
m_Top = 30;
|
|
|
|
m_Left = 30;
|
|
|
|
m_Width = 800;
|
|
|
|
m_Height = 600;
|
|
|
|
|
2005-06-29 05:21:47 +00:00
|
|
|
m_strNetworkDialupConnectionName = wxEmptyString;
|
|
|
|
|
|
|
|
|
|
|
|
// Working Variables
|
2005-12-28 12:33:18 +00:00
|
|
|
m_strBaseTitle = title;
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-03-30 09:24:31 +00:00
|
|
|
m_aSelectedComputerMRU.Clear();
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2005-06-29 05:21:47 +00:00
|
|
|
// Initialize Application
|
2005-12-28 12:33:18 +00:00
|
|
|
SetIcon(*icon);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
wxCHECK_RET(CreateMenu(), _T("Failed to create menu bar."));
|
|
|
|
wxCHECK_RET(CreateNotebook(), _T("Failed to create notebook."));
|
|
|
|
wxCHECK_RET(CreateStatusbar(), _T("Failed to create status bar."));
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2005-06-28 15:55:59 +00:00
|
|
|
RestoreState();
|
|
|
|
|
|
|
|
SetStatusBarPane(0);
|
|
|
|
|
|
|
|
|
2006-02-13 10:20:42 +00:00
|
|
|
m_pDialupManager = new CBOINCDialUpManager();
|
|
|
|
wxASSERT(m_pDialupManager->IsOk());
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2005-03-07 23:52:28 +00:00
|
|
|
m_pRefreshStateTimer = new wxTimer(this, ID_REFRESHSTATETIMER);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pRefreshStateTimer);
|
2005-03-07 23:52:28 +00:00
|
|
|
|
2004-10-28 22:51:38 +00:00
|
|
|
m_pFrameRenderTimer = new wxTimer(this, ID_FRAMERENDERTIMER);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pFrameRenderTimer);
|
2004-10-28 22:51:38 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
m_pFrameListPanelRenderTimer = new wxTimer(this, ID_FRAMELISTRENDERTIMER);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pFrameListPanelRenderTimer);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2005-04-10 02:24:08 +00:00
|
|
|
m_pDocumentPollTimer = new wxTimer(this, ID_DOCUMENTPOLLTIMER);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pDocumentPollTimer);
|
2005-04-10 02:24:08 +00:00
|
|
|
|
2005-06-28 15:55:59 +00:00
|
|
|
m_pRefreshStateTimer->Start(300000); // Send event every 5 minutes
|
2004-10-28 22:51:38 +00:00
|
|
|
m_pFrameRenderTimer->Start(1000); // Send event every 1 second
|
2006-02-09 21:51:07 +00:00
|
|
|
m_pFrameListPanelRenderTimer->Start(1000); // Send event every 1 second
|
2005-04-10 02:24:08 +00:00
|
|
|
m_pDocumentPollTimer->Start(250); // Send event every 250 milliseconds
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2005-05-24 21:46:20 +00:00
|
|
|
// Limit the number of times the UI can update itself to two times a second
|
|
|
|
// NOTE: Linux and Mac were updating several times a second and eating
|
|
|
|
// CPU time
|
|
|
|
wxUpdateUIEvent::SetUpdateInterval(500);
|
|
|
|
|
2005-05-24 21:26:49 +00:00
|
|
|
// The second half of the initialization process picks up in the OnFrameRender()
|
|
|
|
// routine since the menus' and status bars' are drawn in the frameworks
|
|
|
|
// on idle routines, on idle events are sent in between the end of the
|
|
|
|
// constructor and the first call to OnFrameRender
|
|
|
|
//
|
|
|
|
// Look for the 'if (!bAlreadyRunOnce) {' statement
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CMainFrame - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-10 19:01:23 +00:00
|
|
|
CMainFrame::~CMainFrame() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::~CMainFrame - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-04-10 19:01:23 +00:00
|
|
|
wxASSERT(m_pRefreshStateTimer);
|
|
|
|
wxASSERT(m_pFrameRenderTimer);
|
|
|
|
wxASSERT(m_pFrameListPanelRenderTimer);
|
|
|
|
wxASSERT(m_pDocumentPollTimer);
|
|
|
|
wxASSERT(m_pMenubar);
|
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
wxASSERT(m_pStatusbar);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-05-22 01:36:36 +00:00
|
|
|
SaveState();
|
|
|
|
|
2005-03-10 05:07:01 +00:00
|
|
|
if (m_pRefreshStateTimer) {
|
|
|
|
m_pRefreshStateTimer->Stop();
|
|
|
|
delete m_pRefreshStateTimer;
|
|
|
|
}
|
2004-05-22 01:36:36 +00:00
|
|
|
|
2004-10-28 22:51:38 +00:00
|
|
|
if (m_pFrameRenderTimer) {
|
|
|
|
m_pFrameRenderTimer->Stop();
|
|
|
|
delete m_pFrameRenderTimer;
|
|
|
|
}
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if (m_pFrameListPanelRenderTimer) {
|
|
|
|
m_pFrameListPanelRenderTimer->Stop();
|
|
|
|
delete m_pFrameListPanelRenderTimer;
|
2004-05-21 06:27:15 +00:00
|
|
|
}
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-04-10 02:24:08 +00:00
|
|
|
if (m_pDocumentPollTimer) {
|
|
|
|
m_pDocumentPollTimer->Stop();
|
|
|
|
delete m_pDocumentPollTimer;
|
|
|
|
}
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
if (m_pStatusbar)
|
|
|
|
wxCHECK_RET(DeleteStatusbar(), _T("Failed to delete status bar."));
|
2004-05-21 06:27:15 +00:00
|
|
|
|
|
|
|
if (m_pNotebook)
|
|
|
|
wxCHECK_RET(DeleteNotebook(), _T("Failed to delete notebook."));
|
|
|
|
|
|
|
|
if (m_pMenubar)
|
|
|
|
wxCHECK_RET(DeleteMenu(), _T("Failed to delete menu bar."));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-06-28 22:22:29 +00:00
|
|
|
#ifdef __WXMSW__
|
2005-06-24 10:49:42 +00:00
|
|
|
if (m_pDialupManager)
|
|
|
|
delete m_pDialupManager;
|
2005-06-28 22:22:29 +00:00
|
|
|
#endif
|
2005-06-24 10:49:42 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::~CMainFrame - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::CreateMenu() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateMenu - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
ACCT_MGR_INFO ami;
|
|
|
|
bool is_acct_mgr_detected = false;
|
|
|
|
wxString strMenuName;
|
|
|
|
wxString strMenuDescription;
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
// Account managers have a different menu arrangement
|
|
|
|
pDoc->rpc.acct_mgr_info(ami);
|
|
|
|
is_acct_mgr_detected = ami.acct_mgr_url.size() ? true : false;
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
// File menu
|
|
|
|
wxMenu *menuFile = new wxMenu;
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Exit the %s"),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
2005-09-06 08:58:56 +00:00
|
|
|
menuFile->Append(
|
|
|
|
wxID_EXIT,
|
|
|
|
_("E&xit"),
|
2005-12-28 12:33:18 +00:00
|
|
|
strMenuDescription
|
2005-09-06 08:58:56 +00:00
|
|
|
);
|
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
// Tools menu
|
|
|
|
wxMenu *menuTools = new wxMenu;
|
|
|
|
|
|
|
|
if (!is_acct_mgr_detected) {
|
|
|
|
menuTools->Append(
|
|
|
|
ID_PROJECTSATTACHPROJECT,
|
|
|
|
_("Attach to &project"),
|
2006-02-15 22:29:06 +00:00
|
|
|
_("Attach to a project")
|
2006-02-02 12:32:21 +00:00
|
|
|
);
|
|
|
|
menuTools->Append(
|
|
|
|
ID_PROJECTSATTACHACCOUNTMANAGER,
|
|
|
|
_("&Account manager"),
|
|
|
|
_("Attach to an account manager")
|
|
|
|
);
|
|
|
|
} else {
|
2006-02-15 02:38:38 +00:00
|
|
|
strMenuName.Printf(
|
|
|
|
_("&Synchronize with %s"),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-15 02:38:38 +00:00
|
|
|
);
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Get current settings from %s"),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-15 02:38:38 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuTools->Append(
|
|
|
|
ID_TOOLSAMUPDATENOW,
|
2006-02-15 02:38:38 +00:00
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
2006-02-02 12:32:21 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Activity menu
|
|
|
|
wxMenu *menuActivity = new wxMenu;
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2005-07-22 06:56:34 +00:00
|
|
|
ID_FILEACTIVITYRUNALWAYS,
|
2004-10-24 07:38:38 +00:00
|
|
|
_("&Run always"),
|
2006-02-15 22:29:06 +00:00
|
|
|
_("Allow work regardless of preferences")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2005-07-22 06:56:34 +00:00
|
|
|
ID_FILEACTIVITYRUNBASEDONPREPERENCES,
|
2004-10-24 07:38:38 +00:00
|
|
|
_("Run based on &preferences"),
|
2006-02-15 22:29:06 +00:00
|
|
|
_("Allow work according to your preferences")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2005-07-22 06:56:34 +00:00
|
|
|
ID_FILEACTIVITYSUSPEND,
|
2004-10-24 07:38:38 +00:00
|
|
|
_("&Suspend"),
|
2006-02-15 00:06:39 +00:00
|
|
|
_("Stop work regardless of preferences")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendSeparator();
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2005-07-22 06:56:34 +00:00
|
|
|
ID_FILENETWORKRUNALWAYS,
|
2005-06-29 05:54:12 +00:00
|
|
|
_("&Network activity always available"),
|
2006-02-15 22:29:06 +00:00
|
|
|
_("Allow network activity regardless of preferences")
|
2005-06-29 05:54:12 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2005-07-22 06:56:34 +00:00
|
|
|
ID_FILENETWORKRUNBASEDONPREPERENCES,
|
2005-06-29 05:54:12 +00:00
|
|
|
_("Network activity based on &preferences"),
|
2006-02-15 22:29:06 +00:00
|
|
|
_("Allow network activity according to your preferences")
|
2005-06-29 05:54:12 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity->AppendRadioItem(
|
2005-07-22 06:56:34 +00:00
|
|
|
ID_FILENETWORKSUSPEND,
|
2005-06-29 05:54:12 +00:00
|
|
|
_("&Network activity suspended"),
|
2006-02-15 00:06:39 +00:00
|
|
|
_("Stop BOINC network activity")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
// Advanced menu
|
|
|
|
wxMenu *menuAdvanced = new wxMenu;
|
|
|
|
menuAdvanced->Append(
|
|
|
|
ID_OPTIONSOPTIONS,
|
|
|
|
_("&Options"),
|
|
|
|
_("Configure GUI options and proxy settings")
|
2005-10-05 19:01:28 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Connect to another computer running %s"),
|
|
|
|
wxGetApp().GetBrand()->GetProjectName().c_str()
|
|
|
|
);
|
|
|
|
menuAdvanced->Append(
|
|
|
|
ID_FILESELECTCOMPUTER,
|
|
|
|
_("Select computer..."),
|
|
|
|
strMenuDescription
|
|
|
|
);
|
|
|
|
menuAdvanced->Append(
|
2005-07-22 06:56:34 +00:00
|
|
|
ID_FILERUNBENCHMARKS,
|
2006-02-02 12:32:21 +00:00
|
|
|
_("Run CPU &benchmarks"),
|
2004-11-22 19:17:13 +00:00
|
|
|
_("Runs BOINC CPU benchmarks")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
menuAdvanced->Append(
|
|
|
|
ID_COMMANDSRETRYCOMMUNICATIONS,
|
|
|
|
_("Retry &communications"),
|
|
|
|
_("Report completed work, get latest credit, "
|
|
|
|
"get latest preferences, and possibly get more work.")
|
2005-09-22 08:46:51 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
if (is_acct_mgr_detected) {
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("&Defect from %s"),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-02 12:32:21 +00:00
|
|
|
);
|
|
|
|
menuAdvanced->Append(
|
|
|
|
ID_ADVANCEDAMDEFECT,
|
|
|
|
strMenuName,
|
|
|
|
_("Remove client from account manager control.")
|
|
|
|
);
|
|
|
|
menuAdvanced->Append(
|
|
|
|
ID_PROJECTSATTACHPROJECT,
|
|
|
|
_("Attach to &project"),
|
|
|
|
_("Attach to a project to begin processing work")
|
|
|
|
);
|
|
|
|
}
|
2005-03-11 22:10:56 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// Help menu
|
|
|
|
wxMenu *menuHelp = new wxMenu;
|
2005-12-28 12:33:18 +00:00
|
|
|
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("&%s\tF1"),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Show information about the %s"),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
2005-05-05 06:07:14 +00:00
|
|
|
menuHelp->Append(
|
|
|
|
ID_HELPBOINCMANAGER,
|
2005-12-28 12:33:18 +00:00
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
2005-05-05 06:07:14 +00:00
|
|
|
);
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("%s &website"),
|
2006-01-05 10:14:30 +00:00
|
|
|
wxGetApp().GetBrand()->GetProjectName().c_str()
|
2005-12-28 12:33:18 +00:00
|
|
|
);
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Show information about BOINC and %s"),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
2005-05-05 06:07:14 +00:00
|
|
|
menuHelp->Append(
|
|
|
|
ID_HELPBOINC,
|
2005-12-28 12:33:18 +00:00
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
2005-05-05 06:07:14 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
menuHelp->AppendSeparator();
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("&About %s..."),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
2005-04-08 16:58:55 +00:00
|
|
|
menuHelp->Append(
|
2004-10-09 03:05:01 +00:00
|
|
|
wxID_ABOUT,
|
2005-12-28 12:33:18 +00:00
|
|
|
strMenuName,
|
2005-05-05 06:07:14 +00:00
|
|
|
_("Licensing and copyright information.")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// construct menu
|
|
|
|
m_pMenubar = new wxMenuBar;
|
2006-02-16 11:01:57 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
// WxWidgets automatically prevents the Exit item from showing in the File menu
|
|
|
|
// because Mac OSX has its Quit item in "BOINCManager" menu, not in File menu.
|
|
|
|
// Don't show File menu on the Mac unless it has additional items.
|
|
|
|
if (menuFile->GetMenuItemCount() > 1)
|
|
|
|
#endif
|
|
|
|
m_pMenubar->Append(
|
|
|
|
menuFile,
|
|
|
|
_("&File")
|
|
|
|
);
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pMenubar->Append(
|
2006-02-02 12:32:21 +00:00
|
|
|
menuTools,
|
|
|
|
_("&Tools")
|
2005-09-06 08:58:56 +00:00
|
|
|
);
|
|
|
|
m_pMenubar->Append(
|
2006-02-02 12:32:21 +00:00
|
|
|
menuActivity,
|
|
|
|
_("&Activity")
|
2005-09-06 08:58:56 +00:00
|
|
|
);
|
|
|
|
m_pMenubar->Append(
|
2006-02-02 12:32:21 +00:00
|
|
|
menuAdvanced,
|
|
|
|
_("A&dvanced")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pMenubar->Append(
|
|
|
|
menuHelp,
|
|
|
|
_("&Help")
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
|
|
|
|
wxMenuBar* m_pOldMenubar = GetMenuBar();
|
2004-04-10 09:11:03 +00:00
|
|
|
SetMenuBar(m_pMenubar);
|
2006-02-16 11:01:57 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
m_pMenubar->MacInstallMenuBar();
|
|
|
|
#endif
|
2006-02-02 12:32:21 +00:00
|
|
|
if (m_pOldMenubar) {
|
|
|
|
delete m_pOldMenubar;
|
|
|
|
}
|
2006-03-31 02:30:06 +00:00
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
MenuRef prefsMenuRef;
|
|
|
|
MenuItemIndex prefsMenuItemIndex;
|
|
|
|
|
|
|
|
// Hide Mac OS X's standard Preferences menu ite, since we don't use it
|
|
|
|
if (GetIndMenuItemWithCommandID(NULL, kHICommandPreferences, 1, &prefsMenuRef, &prefsMenuItemIndex) == noErr)
|
|
|
|
ChangeMenuItemAttributes(prefsMenuRef, prefsMenuItemIndex, kMenuItemAttrHidden, 0);
|
|
|
|
#endif
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateMenu - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::CreateNotebook() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateNotebook - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
// create frame panel
|
|
|
|
wxPanel *pPanel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxTAB_TRAVERSAL|wxCLIP_CHILDREN|wxNO_BORDER);
|
2004-12-15 23:08:18 +00:00
|
|
|
pPanel->SetAutoLayout(TRUE);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// initialize notebook
|
2004-10-21 14:29:59 +00:00
|
|
|
m_pNotebook = new wxNotebook(pPanel, ID_FRAMENOTEBOOK, wxDefaultPosition, wxDefaultSize,
|
2004-04-10 09:11:03 +00:00
|
|
|
wxNB_FIXEDWIDTH|wxCLIP_CHILDREN);
|
|
|
|
|
|
|
|
// layout frame panel
|
|
|
|
wxBoxSizer *pPanelSizer = new wxBoxSizer(wxVERTICAL);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
pPanelSizer->Add(new wxStaticLine(pPanel, -1), 0, wxEXPAND);
|
2005-04-04 06:02:36 +00:00
|
|
|
pPanelSizer->Add(0, 5);
|
2005-04-26 04:20:35 +00:00
|
|
|
pPanelSizer->Add(m_pNotebook, 1, wxEXPAND);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-12-15 22:50:21 +00:00
|
|
|
|
|
|
|
// create the various notebook pages
|
2005-04-07 07:04:50 +00:00
|
|
|
CreateNotebookPage(new CViewProjects(m_pNotebook));
|
2005-04-21 06:04:26 +00:00
|
|
|
CreateNotebookPage(new CViewWork(m_pNotebook));
|
|
|
|
CreateNotebookPage(new CViewTransfers(m_pNotebook));
|
|
|
|
CreateNotebookPage(new CViewMessages(m_pNotebook));
|
|
|
|
CreateNotebookPage(new CViewStatistics(m_pNotebook));
|
|
|
|
CreateNotebookPage(new CViewResources(m_pNotebook));
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-12-15 22:11:14 +00:00
|
|
|
|
2005-04-27 06:32:40 +00:00
|
|
|
pPanel->SetSizer(pPanelSizer);
|
|
|
|
pPanel->Layout();
|
2004-12-15 22:11:14 +00:00
|
|
|
|
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateNotebook - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
template < class T >
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::CreateNotebookPage(T pwndNewNotebookPage) {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateNotebookPage - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
wxImageList* pImageList;
|
2005-04-10 19:01:23 +00:00
|
|
|
int iImageIndex = 0;
|
2004-04-13 00:33:40 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pwndNewNotebookPage);
|
|
|
|
wxASSERT(m_pNotebook);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNewNotebookPage, CBOINCBaseView));
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
|
|
|
pImageList = m_pNotebook->GetImageList();
|
|
|
|
if (!pImageList) {
|
|
|
|
pImageList = new wxImageList(16, 16, true, 0);
|
|
|
|
wxASSERT(pImageList != NULL);
|
2004-04-13 02:06:27 +00:00
|
|
|
m_pNotebook->SetImageList(pImageList);
|
2004-04-13 00:33:40 +00:00
|
|
|
}
|
|
|
|
|
2006-02-01 10:58:26 +00:00
|
|
|
iImageIndex = pImageList->Add(wxBitmap(pwndNewNotebookPage->GetViewIcon()));
|
2004-05-27 06:17:58 +00:00
|
|
|
m_pNotebook->AddPage(pwndNewNotebookPage, pwndNewNotebookPage->GetViewName(), TRUE, iImageIndex);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateNotebookPage - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::CreateStatusbar() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateStatusbar - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
if (m_pStatusbar)
|
|
|
|
return true;
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pStatusbar = new CStatusBar(this);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pStatusbar);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
SetStatusBar(m_pStatusbar);
|
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateStatusbar - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::DeleteMenu() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::DeleteMenu - Function Begin"));
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::DeleteMenu - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::DeleteNotebook() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::DeleteNotebook - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
wxImageList* pImageList;
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pNotebook);
|
2004-04-13 02:18:03 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
pImageList = m_pNotebook->GetImageList();
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pImageList);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
if (pImageList)
|
|
|
|
delete pImageList;
|
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::DeleteNotebook - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::DeleteStatusbar() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::DeleteStatusbar - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
if (!m_pStatusbar)
|
|
|
|
return true;
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
SetStatusBar(NULL);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
delete m_pStatusbar;
|
|
|
|
m_pStatusbar = NULL;
|
2004-10-28 22:51:38 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::DeleteStatusbar - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::SaveState() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::SaveState - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
2004-05-27 06:17:58 +00:00
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
2004-05-29 00:09:41 +00:00
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
2004-10-26 01:59:44 +00:00
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
wxString strConfigLocation = wxEmptyString;
|
|
|
|
wxString strPreviousLocation = wxEmptyString;
|
2005-03-30 09:24:31 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2005-04-08 16:58:55 +00:00
|
|
|
int iIndex = 0;
|
|
|
|
int iItemCount = 0;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
wxASSERT(pConfig);
|
|
|
|
wxASSERT(m_pNotebook);
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
// An odd case happens every once and awhile where wxWidgets looses
|
|
|
|
// the pointer to the config object, or it is cleaned up before
|
|
|
|
// the window has finished it's cleanup duty. If we detect a NULL
|
|
|
|
// pointer, return false.
|
|
|
|
if (!pConfig) return false;
|
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
//
|
|
|
|
// Save Frame State
|
|
|
|
//
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2005-02-07 04:47:18 +00:00
|
|
|
pConfig->Write(wxT("Language"), m_iSelectedLanguage);
|
2005-06-24 10:49:42 +00:00
|
|
|
pConfig->Write(wxT("ReminderFrequency"), m_iReminderFrequency);
|
2006-01-23 11:30:25 +00:00
|
|
|
pConfig->Write(wxT("DisplayExitWarning"), m_iDisplayExitWarning);
|
2005-02-07 04:47:18 +00:00
|
|
|
|
2005-06-29 05:21:47 +00:00
|
|
|
pConfig->Write(wxT("NetworkDialupConnectionName"), m_strNetworkDialupConnectionName);
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
pConfig->Write(wxT("CurrentPage"), m_pNotebook->GetSelection());
|
2005-02-07 04:47:18 +00:00
|
|
|
|
|
|
|
pConfig->Write(wxT("WindowIconized"), IsIconized());
|
2005-03-09 07:46:39 +00:00
|
|
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
2005-02-07 04:47:18 +00:00
|
|
|
pConfig->Write(wxT("WindowMaximized"), IsMaximized());
|
2005-03-09 07:46:39 +00:00
|
|
|
#endif
|
2006-04-14 11:27:37 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (!IsIconized() && !IsMaximized()) {
|
2006-04-14 13:13:55 +00:00
|
|
|
GetWindowDimensions();
|
2006-04-14 11:27:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pConfig->Write(wxT("Width"), m_Width);
|
|
|
|
pConfig->Write(wxT("Height"), m_Height);
|
2005-03-26 13:45:21 +00:00
|
|
|
#ifdef __WXMAC__
|
2006-04-14 11:27:37 +00:00
|
|
|
pConfig->Write(wxT("XPos"), m_Left);
|
|
|
|
pConfig->Write(wxT("YPos"), m_Top);
|
2005-03-26 13:45:21 +00:00
|
|
|
#endif
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Save Page(s) State
|
|
|
|
//
|
2004-05-29 00:09:41 +00:00
|
|
|
|
|
|
|
// Convert to a zero based index
|
2005-03-30 09:24:31 +00:00
|
|
|
iItemCount = m_pNotebook->GetPageCount() - 1;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
for (iIndex = 0; iIndex <= iItemCount; iIndex++) {
|
2004-05-27 06:17:58 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(iIndex);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pView);
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
strPreviousLocation = pConfig->GetPath();
|
|
|
|
strConfigLocation = strPreviousLocation + pView->GetViewName();
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
pConfig->SetPath(strConfigLocation);
|
2005-04-07 07:04:50 +00:00
|
|
|
pView->FireOnSaveState(pConfig);
|
2004-10-26 01:59:44 +00:00
|
|
|
pConfig->SetPath(strPreviousLocation);
|
|
|
|
}
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2005-03-30 09:24:31 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Save Computer MRU list
|
|
|
|
//
|
|
|
|
strPreviousLocation = pConfig->GetPath();
|
|
|
|
strConfigLocation = strPreviousLocation + wxT("ComputerMRU");
|
|
|
|
|
|
|
|
pConfig->SetPath(strConfigLocation);
|
|
|
|
|
|
|
|
iItemCount = m_aSelectedComputerMRU.GetCount() - 1;
|
2005-04-07 07:04:50 +00:00
|
|
|
for (iIndex = 0; iIndex <= iItemCount; iIndex++) {
|
2005-03-30 09:24:31 +00:00
|
|
|
strBuffer.Printf(wxT("%d"), iIndex);
|
|
|
|
pConfig->Write(
|
|
|
|
strBuffer,
|
|
|
|
m_aSelectedComputerMRU.Item(iIndex)
|
2005-04-10 19:01:23 +00:00
|
|
|
);
|
2005-03-30 09:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pConfig->SetPath(strPreviousLocation);
|
|
|
|
|
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::SaveState - Function End"));
|
2004-05-27 06:17:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CMainFrame::RestoreState() {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::RestoreState - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
2004-05-27 06:17:58 +00:00
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
2004-05-29 00:09:41 +00:00
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
2004-10-26 01:59:44 +00:00
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
wxString strConfigLocation = wxEmptyString;
|
|
|
|
wxString strPreviousLocation = wxEmptyString;
|
2005-03-30 09:24:31 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
|
|
|
wxString strValue = wxEmptyString;
|
|
|
|
long iIndex = 0;
|
|
|
|
long iPageCount = 0;
|
2006-04-14 03:09:24 +00:00
|
|
|
long iCurrentPage;
|
2005-03-30 09:24:31 +00:00
|
|
|
bool bKeepEnumerating = false;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pConfig);
|
|
|
|
wxASSERT(m_pNotebook);
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
// An odd case happens every once and awhile where wxWidgets looses
|
|
|
|
// the pointer to the config object, or it is cleaned up before
|
|
|
|
// the window has finished it's cleanup duty. If we detect a NULL
|
|
|
|
// pointer, return false.
|
|
|
|
if (!pConfig) return false;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Restore Frame State
|
|
|
|
//
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2005-02-07 04:47:18 +00:00
|
|
|
pConfig->Read(wxT("Language"), &m_iSelectedLanguage, 0L);
|
2005-06-24 10:49:42 +00:00
|
|
|
pConfig->Read(wxT("ReminderFrequency"), &m_iReminderFrequency, 60L);
|
2006-01-23 11:30:25 +00:00
|
|
|
pConfig->Read(wxT("DisplayExitWarning"), &m_iDisplayExitWarning, 1L);
|
2005-02-07 04:47:18 +00:00
|
|
|
|
2005-06-29 05:21:47 +00:00
|
|
|
pConfig->Read(wxT("NetworkDialupConnectionName"), &m_strNetworkDialupConnectionName, wxEmptyString);
|
2005-02-07 04:47:18 +00:00
|
|
|
|
2006-01-19 12:22:22 +00:00
|
|
|
if (wxGetApp().GetBrand()->IsBranded() &&
|
|
|
|
wxGetApp().GetBrand()->IsDefaultTabSpecified()) {
|
|
|
|
m_pNotebook->SetSelection(wxGetApp().GetBrand()->GetDefaultTab());
|
|
|
|
} else {
|
|
|
|
pConfig->Read(wxT("CurrentPage"), &iCurrentPage, (ID_LIST_WORKVIEW - ID_LIST_BASE));
|
|
|
|
m_pNotebook->SetSelection(iCurrentPage);
|
|
|
|
}
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2006-04-17 07:58:19 +00:00
|
|
|
// Read window dimensions now, so SaveState can write them even if we never open the window
|
|
|
|
pConfig->Read(wxT("Width"), &m_Width, 800);
|
|
|
|
pConfig->Read(wxT("Height"), &m_Height, 600);
|
|
|
|
|
2006-04-17 23:32:07 +00:00
|
|
|
#ifdef __WXMAC__
|
2006-04-17 07:58:19 +00:00
|
|
|
pConfig->Read(wxT("YPos"), &m_Top, 30);
|
|
|
|
pConfig->Read(wxT("XPos"), &m_Left, 30);
|
|
|
|
|
|
|
|
// If the user has changed the arrangement of multiple
|
|
|
|
// displays, make sure the window title bar is still on-screen.
|
|
|
|
Rect titleRect = {m_Top, m_Left, m_Top+22, m_Left+m_Width };
|
|
|
|
InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible
|
|
|
|
RgnHandle displayRgn = NewRgn();
|
|
|
|
CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays
|
|
|
|
Rect menuRect = ((**GetMainDevice())).gdRect;
|
|
|
|
menuRect.bottom = GetMBarHeight() + menuRect.top;
|
|
|
|
RgnHandle menuRgn = NewRgn();
|
|
|
|
RectRgn(menuRgn, &menuRect); // Region hidden by menu bar
|
|
|
|
DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar retion
|
|
|
|
if (!RectInRgn(&titleRect, displayRgn))
|
|
|
|
m_Top = m_Left = 30;
|
|
|
|
DisposeRgn(menuRgn);
|
|
|
|
DisposeRgn(displayRgn);
|
|
|
|
|
|
|
|
SetSize(m_Left, m_Top, m_Width, m_Height);
|
|
|
|
#endif
|
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
//
|
|
|
|
// Restore Page(s) State
|
|
|
|
//
|
|
|
|
|
2004-05-29 00:09:41 +00:00
|
|
|
// Convert to a zero based index
|
2004-05-27 06:17:58 +00:00
|
|
|
iPageCount = m_pNotebook->GetPageCount() - 1;
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
for (iIndex = 0; iIndex <= iPageCount; iIndex++) {
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(iIndex);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pView);
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
strPreviousLocation = pConfig->GetPath();
|
|
|
|
strConfigLocation = strPreviousLocation + pView->GetViewName();
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
pConfig->SetPath(strConfigLocation);
|
2005-04-07 07:04:50 +00:00
|
|
|
pView->FireOnRestoreState(pConfig);
|
2004-10-26 01:59:44 +00:00
|
|
|
pConfig->SetPath(strPreviousLocation);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-10-26 01:59:44 +00:00
|
|
|
}
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2005-03-30 09:24:31 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Restore Computer MRU list
|
|
|
|
//
|
|
|
|
strPreviousLocation = pConfig->GetPath();
|
|
|
|
strConfigLocation = strPreviousLocation + wxT("ComputerMRU");
|
|
|
|
|
|
|
|
pConfig->SetPath(strConfigLocation);
|
|
|
|
|
|
|
|
m_aSelectedComputerMRU.Clear();
|
|
|
|
bKeepEnumerating = pConfig->GetFirstEntry(strBuffer, iIndex);
|
2005-04-07 07:04:50 +00:00
|
|
|
while (bKeepEnumerating) {
|
2005-03-30 09:24:31 +00:00
|
|
|
pConfig->Read(strBuffer, &strValue);
|
|
|
|
|
|
|
|
m_aSelectedComputerMRU.Add(strValue);
|
|
|
|
bKeepEnumerating = pConfig->GetNextEntry(strBuffer, iIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
pConfig->SetPath(strPreviousLocation);
|
|
|
|
|
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::RestoreState - Function End"));
|
2004-05-27 06:17:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CMainFrame::OnActivitySelection(wxCommandEvent& event) {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnActivitySelection - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-10-24 07:38:38 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2004-10-24 07:38:38 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2006-02-22 20:12:53 +00:00
|
|
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
|
|
|
CTaskBarIcon* pTaskbar = wxGetApp().GetTaskBarIcon();
|
|
|
|
|
|
|
|
wxASSERT(pTaskbar);
|
|
|
|
wxASSERT(wxDynamicCast(pTaskbar, CTaskBarIcon));
|
|
|
|
|
|
|
|
pTaskbar->ResetSuspendState();
|
|
|
|
#endif
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
switch(event.GetId()) {
|
2005-07-22 06:56:34 +00:00
|
|
|
case ID_FILEACTIVITYRUNALWAYS:
|
2005-05-29 07:12:00 +00:00
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_ALWAYS);
|
2005-04-07 07:04:50 +00:00
|
|
|
break;
|
2005-07-22 06:56:34 +00:00
|
|
|
case ID_FILEACTIVITYSUSPEND:
|
2005-05-29 07:12:00 +00:00
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_NEVER);
|
2005-04-07 07:04:50 +00:00
|
|
|
break;
|
2005-07-22 06:56:34 +00:00
|
|
|
case ID_FILEACTIVITYRUNBASEDONPREPERENCES:
|
2005-05-29 07:12:00 +00:00
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_AUTO);
|
2005-04-07 07:04:50 +00:00
|
|
|
break;
|
2004-10-24 07:38:38 +00:00
|
|
|
}
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnActivitySelection - Function End"));
|
2004-10-24 07:38:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CMainFrame::OnNetworkSelection(wxCommandEvent& event) {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnNetworkSelection - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-10-24 07:38:38 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2004-10-24 07:38:38 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2006-02-22 20:12:53 +00:00
|
|
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
|
|
|
CTaskBarIcon* pTaskbar = wxGetApp().GetTaskBarIcon();
|
|
|
|
|
|
|
|
wxASSERT(pTaskbar);
|
|
|
|
wxASSERT(wxDynamicCast(pTaskbar, CTaskBarIcon));
|
|
|
|
|
|
|
|
pTaskbar->ResetSuspendState();
|
|
|
|
#endif
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
switch(event.GetId()) {
|
2005-07-22 06:56:34 +00:00
|
|
|
case ID_FILENETWORKRUNALWAYS:
|
2005-06-29 05:54:12 +00:00
|
|
|
pDoc->SetNetworkRunMode(RUN_MODE_ALWAYS);
|
|
|
|
break;
|
2005-07-22 06:56:34 +00:00
|
|
|
case ID_FILENETWORKSUSPEND:
|
2005-06-29 05:54:12 +00:00
|
|
|
pDoc->SetNetworkRunMode(RUN_MODE_NEVER);
|
|
|
|
break;
|
2005-07-22 06:56:34 +00:00
|
|
|
case ID_FILENETWORKRUNBASEDONPREPERENCES:
|
2005-06-29 05:54:12 +00:00
|
|
|
pDoc->SetNetworkRunMode(RUN_MODE_AUTO);
|
|
|
|
break;
|
2004-10-23 23:40:11 +00:00
|
|
|
}
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnNetworkSelection - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CMainFrame::OnRunBenchmarks(wxCommandEvent& WXUNUSED(event)) {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnRunBenchmarks - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-10-27 23:19:50 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
wxASSERT(pDoc);
|
2004-10-27 23:19:50 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pNotebook->SetSelection(ID_LIST_MESSAGESVIEW - ID_LIST_BASE);
|
2004-10-27 23:19:50 +00:00
|
|
|
pDoc->RunBenchmarks();
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnRunBenchmarks - Function End"));
|
2004-10-27 23:19:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CMainFrame::OnSelectComputer(wxCommandEvent& WXUNUSED(event)) {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnSelectComputer - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-03-30 09:24:31 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CDlgSelectComputer* pDlg = new CDlgSelectComputer(this);
|
|
|
|
long lAnswer = 0;
|
2005-04-04 18:55:42 +00:00
|
|
|
size_t lIndex = 0;
|
2005-03-30 09:24:31 +00:00
|
|
|
long lRetVal = -1;
|
|
|
|
wxArrayString aComputerNames;
|
2004-10-28 07:03:06 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2004-10-28 07:03:06 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDlg);
|
2004-10-28 07:03:06 +00:00
|
|
|
|
|
|
|
|
2005-03-30 09:24:31 +00:00
|
|
|
// Lets copy the template store in the system state
|
|
|
|
aComputerNames = m_aSelectedComputerMRU;
|
|
|
|
|
|
|
|
// Lets populate the combo control with the MRU list
|
|
|
|
pDlg->m_ComputerNameCtrl->Clear();
|
2005-04-07 07:04:50 +00:00
|
|
|
for (lIndex = 0; lIndex < aComputerNames.Count(); lIndex++) {
|
|
|
|
pDlg->m_ComputerNameCtrl->Append(aComputerNames.Item(lIndex));
|
2005-03-30 09:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
lAnswer = pDlg->ShowModal();
|
2005-04-07 07:04:50 +00:00
|
|
|
if (wxID_OK == lAnswer) {
|
2005-11-14 23:12:07 +00:00
|
|
|
|
|
|
|
// Make a null hostname be the same thing as localhost
|
|
|
|
if (wxEmptyString == pDlg->m_ComputerNameCtrl->GetValue()) {
|
2005-11-29 00:29:43 +00:00
|
|
|
lRetVal = pDoc->Connect(
|
|
|
|
wxT("localhost"),
|
|
|
|
wxEmptyString,
|
|
|
|
TRUE,
|
|
|
|
TRUE
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
// Connect up to the remote machine
|
|
|
|
lRetVal = pDoc->Connect(
|
|
|
|
pDlg->m_ComputerNameCtrl->GetValue(),
|
|
|
|
pDlg->m_ComputerPasswordCtrl->GetValue(),
|
|
|
|
TRUE,
|
|
|
|
FALSE
|
|
|
|
);
|
2005-11-14 23:12:07 +00:00
|
|
|
}
|
2005-04-10 18:36:12 +00:00
|
|
|
if (lRetVal) {
|
2005-11-27 01:28:56 +00:00
|
|
|
ShowConnectionFailedAlert();
|
2005-03-31 23:54:12 +00:00
|
|
|
}
|
2005-03-30 09:24:31 +00:00
|
|
|
|
|
|
|
// Insert a copy of the current combo box value to the head of the
|
|
|
|
// computer names string array
|
2005-11-14 23:12:07 +00:00
|
|
|
if (wxEmptyString != pDlg->m_ComputerNameCtrl->GetValue()) {
|
|
|
|
aComputerNames.Insert(pDlg->m_ComputerNameCtrl->GetValue(), 0);
|
|
|
|
}
|
2005-03-30 09:24:31 +00:00
|
|
|
|
|
|
|
// Loops through the computer names and remove any duplicates that
|
|
|
|
// might exist with the new head value
|
2005-04-07 07:04:50 +00:00
|
|
|
for (lIndex = 1; lIndex < aComputerNames.Count(); lIndex++) {
|
|
|
|
if (aComputerNames.Item(lIndex) == aComputerNames.Item(0))
|
2005-04-26 04:20:35 +00:00
|
|
|
aComputerNames.RemoveAt(lIndex);
|
2005-03-30 09:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Store the modified computer name MRU list back to the system state
|
|
|
|
m_aSelectedComputerMRU = aComputerNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pDlg)
|
|
|
|
pDlg->Destroy();
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnSelectComputer - Function End"));
|
2004-10-28 07:03:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CMainFrame::OnExit(wxCommandEvent& WXUNUSED(event)) {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnExit - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2006-01-23 11:30:25 +00:00
|
|
|
if (m_iDisplayExitWarning &&
|
|
|
|
wxGetApp().GetBrand()->IsBranded() &&
|
|
|
|
!wxGetApp().GetBrand()->GetExitMessage().IsEmpty()) {
|
|
|
|
|
|
|
|
CDlgGenericMessage* pDlg = new CDlgGenericMessage(this);
|
|
|
|
long lAnswer = 0;
|
|
|
|
|
|
|
|
wxString strMessage;
|
|
|
|
if (wxGetApp().GetBrand()->IsBranded() &&
|
|
|
|
!wxGetApp().GetBrand()->GetExitMessage().IsEmpty()) {
|
|
|
|
strMessage = wxGetApp().GetBrand()->GetExitMessage();
|
|
|
|
} else {
|
|
|
|
strMessage =
|
|
|
|
_("This will shut down your tasks until it restarts automatically\n"
|
|
|
|
"following your user preferences. Close window to close the manager\n"
|
|
|
|
"without stopping the tasks.");
|
|
|
|
}
|
|
|
|
|
|
|
|
pDlg->SetTitle(_("Close Confirmation"));
|
|
|
|
pDlg->m_DialogMessage->SetLabel(strMessage);
|
|
|
|
pDlg->Fit();
|
|
|
|
pDlg->Centre();
|
|
|
|
|
|
|
|
lAnswer = pDlg->ShowModal();
|
|
|
|
if (wxID_OK == lAnswer) {
|
|
|
|
if (pDlg->m_DialogDisableMessage->GetValue()) {
|
|
|
|
m_iDisplayExitWarning = 0;
|
|
|
|
}
|
|
|
|
Close(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pDlg)
|
|
|
|
pDlg->Destroy();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
Close(true);
|
|
|
|
}
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnExit - Function End"));
|
2004-10-24 07:38:38 +00:00
|
|
|
}
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-09-06 08:58:56 +00:00
|
|
|
void CMainFrame::OnProjectsAttachToAccountManager(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnProjectsAttachToAccountManager - Function Begin"));
|
2005-03-11 22:10:56 +00:00
|
|
|
|
2005-06-20 01:45:13 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-03-11 22:10:56 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-03-11 22:10:56 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-09-28 01:06:35 +00:00
|
|
|
|
2005-11-02 08:02:16 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
if (!Mac_Authorize())
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
if (pDoc->IsConnected()) {
|
|
|
|
m_pRefreshStateTimer->Stop();
|
|
|
|
m_pFrameRenderTimer->Stop();
|
|
|
|
m_pFrameListPanelRenderTimer->Stop();
|
|
|
|
m_pDocumentPollTimer->Stop();
|
|
|
|
|
2005-12-19 13:30:01 +00:00
|
|
|
CWizardAccountManager* pWizard = new CWizardAccountManager(this);
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
pWizard->Run(ACCOUNTMANAGER_ATTACH);
|
2005-11-26 11:17:48 +00:00
|
|
|
|
2005-12-19 13:30:01 +00:00
|
|
|
if (pWizard)
|
|
|
|
pWizard->Destroy();
|
2005-11-26 11:17:48 +00:00
|
|
|
|
2006-02-14 21:41:22 +00:00
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
2005-12-19 13:30:01 +00:00
|
|
|
FireRefreshView();
|
2005-03-11 22:10:56 +00:00
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
m_pRefreshStateTimer->Start();
|
|
|
|
m_pFrameRenderTimer->Start();
|
|
|
|
m_pFrameListPanelRenderTimer->Start();
|
|
|
|
m_pDocumentPollTimer->Start();
|
|
|
|
} else {
|
|
|
|
ShowNotCurrentlyConnectedAlert();
|
|
|
|
}
|
2005-03-11 22:10:56 +00:00
|
|
|
|
2005-09-06 08:58:56 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnProjectsAttachToAccountManager - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
void CMainFrame::OnAccountManagerUpdate(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAccountManagerUpdate - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
if (!Mac_Authorize())
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (pDoc->IsConnected()) {
|
|
|
|
m_pRefreshStateTimer->Stop();
|
|
|
|
m_pFrameRenderTimer->Stop();
|
|
|
|
m_pFrameListPanelRenderTimer->Stop();
|
|
|
|
m_pDocumentPollTimer->Stop();
|
|
|
|
|
|
|
|
CWizardAccountManager* pWizard = new CWizardAccountManager(this);
|
|
|
|
|
|
|
|
pWizard->Run(ACCOUNTMANAGER_UPDATE);
|
|
|
|
|
|
|
|
if (pWizard)
|
|
|
|
pWizard->Destroy();
|
|
|
|
|
2006-02-14 21:41:22 +00:00
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
2006-02-02 12:32:21 +00:00
|
|
|
FireRefreshView();
|
2006-02-17 20:59:15 +00:00
|
|
|
ResetReminderTimers();
|
2006-02-02 12:32:21 +00:00
|
|
|
|
|
|
|
m_pRefreshStateTimer->Start();
|
|
|
|
m_pFrameRenderTimer->Start();
|
|
|
|
m_pFrameListPanelRenderTimer->Start();
|
|
|
|
m_pDocumentPollTimer->Start();
|
|
|
|
} else {
|
|
|
|
ShowNotCurrentlyConnectedAlert();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAccountManagerUpdate - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::OnAccountManagerDetach(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAccountManagerDetach - Function Begin"));
|
|
|
|
|
2006-02-17 19:18:24 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxString strTitle = wxEmptyString;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
ACCT_MGR_INFO ami;
|
2006-02-02 12:32:21 +00:00
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
if (!Mac_Authorize())
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (pDoc->IsConnected()) {
|
|
|
|
|
2006-02-17 19:18:24 +00:00
|
|
|
pDoc->rpc.acct_mgr_info(ami);
|
|
|
|
|
|
|
|
strTitle.Printf(
|
|
|
|
_("BOINC Manager - Detach from %s"),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-17 19:18:24 +00:00
|
|
|
);
|
|
|
|
strMessage.Printf(
|
|
|
|
_("If you defect from %s,\n"
|
|
|
|
"you'll keep all your current projects,\n"
|
|
|
|
"but you'll have to manage projects manually.\n"
|
|
|
|
"\n"
|
|
|
|
"Do you want to defect from %s?"),
|
2006-06-14 07:14:09 +00:00
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str(),
|
|
|
|
wxString(ami.acct_mgr_name.c_str(), wxConvUTF8).c_str()
|
2006-02-17 19:18:24 +00:00
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2006-02-17 19:18:24 +00:00
|
|
|
iAnswer = ::wxMessageBox(
|
|
|
|
strMessage,
|
|
|
|
strTitle,
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2006-02-17 19:18:24 +00:00
|
|
|
if (wxYES == iAnswer) {
|
2006-03-01 10:10:22 +00:00
|
|
|
std::string url, name, passwd;
|
2006-02-17 19:18:24 +00:00
|
|
|
pDoc->rpc.acct_mgr_rpc(
|
2006-03-01 10:10:22 +00:00
|
|
|
url.c_str(),
|
|
|
|
name.c_str(),
|
|
|
|
passwd.c_str(),
|
2006-02-17 19:18:24 +00:00
|
|
|
false
|
|
|
|
);
|
|
|
|
}
|
2006-02-02 12:32:21 +00:00
|
|
|
|
2006-02-14 21:41:22 +00:00
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
2006-02-02 12:32:21 +00:00
|
|
|
FireRefreshView();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ShowNotCurrentlyConnectedAlert();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAccountManagerDetach - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-06 08:58:56 +00:00
|
|
|
void CMainFrame::OnProjectsAttachToProject( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnProjectsAttachToProject - Function Begin"));
|
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2005-11-02 08:02:16 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
if (!Mac_Authorize())
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
if (pDoc->IsConnected()) {
|
|
|
|
UpdateStatusText(_("Attaching to project..."));
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
m_pRefreshStateTimer->Stop();
|
|
|
|
m_pFrameRenderTimer->Stop();
|
|
|
|
m_pFrameListPanelRenderTimer->Stop();
|
|
|
|
m_pDocumentPollTimer->Stop();
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
CWizardAttachProject* pWizard = new CWizardAttachProject(this);
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
wxString strName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
|
|
|
pWizard->Run( strName, strURL, false );
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
if (pWizard)
|
|
|
|
pWizard->Destroy();
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2006-02-14 21:41:22 +00:00
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
m_pRefreshStateTimer->Start();
|
|
|
|
m_pFrameRenderTimer->Start();
|
|
|
|
m_pFrameListPanelRenderTimer->Start();
|
|
|
|
m_pDocumentPollTimer->Start();
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
UpdateStatusText(wxT(""));
|
2005-09-06 08:58:56 +00:00
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
FireRefreshView();
|
|
|
|
} else {
|
|
|
|
ShowNotCurrentlyConnectedAlert();
|
|
|
|
}
|
2005-09-06 08:58:56 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnProjectsAttachToProject - Function End"));
|
2005-03-11 22:10:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-05 19:01:28 +00:00
|
|
|
void CMainFrame::OnCommandsRetryCommunications( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnCommandsRetryCommunications - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
UpdateStatusText(_("Retrying communications for project(s)..."));
|
|
|
|
pDoc->rpc.network_available();
|
|
|
|
UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnCommandsRetryCommunications - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-06 08:58:56 +00:00
|
|
|
void CMainFrame::OnOptionsOptions(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnOptionsOptions - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-10-25 00:56:16 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CDlgOptions* pDlg = new CDlgOptions(this);
|
2005-06-24 10:49:42 +00:00
|
|
|
int iAnswer = 0;
|
|
|
|
int iBuffer = 0;
|
2004-10-27 03:17:40 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2005-06-28 15:55:59 +00:00
|
|
|
wxArrayString astrDialupConnections;
|
2005-06-29 05:21:47 +00:00
|
|
|
bool bRetrievedProxyConfiguration = false;
|
2004-10-25 00:56:16 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2004-10-25 00:56:16 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDlg);
|
2005-06-28 22:22:29 +00:00
|
|
|
|
2004-04-11 04:12:44 +00:00
|
|
|
|
2005-06-28 15:55:59 +00:00
|
|
|
// General Tab
|
|
|
|
pDlg->m_LanguageSelectionCtrl->Append(wxGetApp().GetSupportedLanguages());
|
2005-06-29 05:21:47 +00:00
|
|
|
|
2005-06-28 15:55:59 +00:00
|
|
|
pDlg->m_LanguageSelectionCtrl->SetSelection(m_iSelectedLanguage);
|
2005-06-29 05:21:47 +00:00
|
|
|
pDlg->m_ReminderFrequencyCtrl->SetValue(m_iReminderFrequency);
|
2005-06-28 15:55:59 +00:00
|
|
|
|
2006-02-16 11:01:57 +00:00
|
|
|
#ifdef __WXMSW__
|
2005-06-28 15:55:59 +00:00
|
|
|
// Connection Tab
|
2005-10-21 02:16:11 +00:00
|
|
|
if (m_pDialupManager) {
|
|
|
|
m_pDialupManager->GetISPNames(astrDialupConnections);
|
2005-06-29 05:21:47 +00:00
|
|
|
|
2005-10-21 02:16:11 +00:00
|
|
|
pDlg->m_DialupConnectionsCtrl->Append(astrDialupConnections);
|
2006-02-21 21:38:55 +00:00
|
|
|
pDlg->SetDefaultDialupConnection(m_strNetworkDialupConnectionName);
|
2005-10-21 02:16:11 +00:00
|
|
|
} else {
|
|
|
|
pDlg->m_DialupSetDefaultCtrl->Disable();
|
|
|
|
pDlg->m_DialupClearDefaultCtrl->Disable();
|
|
|
|
}
|
2006-02-16 11:01:57 +00:00
|
|
|
#endif
|
2005-06-28 15:55:59 +00:00
|
|
|
|
|
|
|
// Proxy Tabs
|
2005-06-29 05:21:47 +00:00
|
|
|
bRetrievedProxyConfiguration = (0 == pDoc->GetProxyConfiguration());
|
|
|
|
if(!bRetrievedProxyConfiguration) {
|
|
|
|
// We were unable to get the proxy configuration, so disable
|
|
|
|
// the controls
|
|
|
|
pDlg->m_EnableHTTPProxyCtrl->Enable(false);
|
|
|
|
pDlg->m_EnableSOCKSProxyCtrl->Enable(false);
|
|
|
|
} else {
|
|
|
|
pDlg->m_EnableHTTPProxyCtrl->Enable(true);
|
|
|
|
pDlg->m_EnableSOCKSProxyCtrl->Enable(true);
|
|
|
|
}
|
|
|
|
|
2005-06-28 22:22:29 +00:00
|
|
|
pDlg->m_EnableHTTPProxyCtrl->SetValue(pDoc->proxy_info.use_http_proxy);
|
2006-03-23 01:17:07 +00:00
|
|
|
pDlg->m_HTTPAddressCtrl->SetValue(wxString(pDoc->proxy_info.http_server_name.c_str(), wxConvUTF8));
|
|
|
|
pDlg->m_HTTPUsernameCtrl->SetValue(wxString(pDoc->proxy_info.http_user_name.c_str(), wxConvUTF8));
|
|
|
|
pDlg->m_HTTPPasswordCtrl->SetValue(wxString(pDoc->proxy_info.http_user_passwd.c_str(), wxConvUTF8));
|
2005-06-28 22:22:29 +00:00
|
|
|
|
|
|
|
strBuffer.Printf(wxT("%d"), pDoc->proxy_info.http_server_port);
|
|
|
|
pDlg->m_HTTPPortCtrl->SetValue(strBuffer);
|
|
|
|
|
|
|
|
pDlg->m_EnableSOCKSProxyCtrl->SetValue(pDoc->proxy_info.use_socks_proxy);
|
2006-03-23 01:17:07 +00:00
|
|
|
pDlg->m_SOCKSAddressCtrl->SetValue(wxString(pDoc->proxy_info.socks_server_name.c_str(), wxConvUTF8));
|
|
|
|
pDlg->m_SOCKSUsernameCtrl->SetValue(wxString(pDoc->proxy_info.socks5_user_name.c_str(), wxConvUTF8));
|
|
|
|
pDlg->m_SOCKSPasswordCtrl->SetValue(wxString(pDoc->proxy_info.socks5_user_passwd.c_str(), wxConvUTF8));
|
2005-06-28 22:22:29 +00:00
|
|
|
|
|
|
|
strBuffer.Printf(wxT("%d"), pDoc->proxy_info.socks_server_port);
|
|
|
|
pDlg->m_SOCKSPortCtrl->SetValue(strBuffer);
|
2004-10-26 01:59:44 +00:00
|
|
|
|
2004-10-25 00:56:16 +00:00
|
|
|
iAnswer = pDlg->ShowModal();
|
2005-04-07 07:04:50 +00:00
|
|
|
if (wxID_OK == iAnswer) {
|
2005-06-28 22:22:29 +00:00
|
|
|
// General Tab
|
|
|
|
if (m_iSelectedLanguage != pDlg->m_LanguageSelectionCtrl->GetSelection()) {
|
2005-12-28 12:33:18 +00:00
|
|
|
wxString strDialogTitle;
|
|
|
|
wxString strDialogMessage;
|
|
|
|
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strDialogTitle.Printf(
|
|
|
|
_("%s - Language Selection"),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strDialogMessage.Printf(
|
|
|
|
_("The %s's default language has been changed, in order for this "
|
|
|
|
"change to take affect you must restart the %s."),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str(),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
|
2005-06-28 22:22:29 +00:00
|
|
|
ShowAlert(
|
2005-12-28 12:33:18 +00:00
|
|
|
strDialogTitle,
|
|
|
|
strDialogMessage,
|
2006-04-14 22:30:59 +00:00
|
|
|
wxOK | wxICON_INFORMATION
|
2005-06-28 22:22:29 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_iSelectedLanguage = pDlg->m_LanguageSelectionCtrl->GetSelection();
|
2005-06-29 05:21:47 +00:00
|
|
|
m_iReminderFrequency = pDlg->m_ReminderFrequencyCtrl->GetValue();
|
2005-06-28 22:22:29 +00:00
|
|
|
|
2006-02-16 11:01:57 +00:00
|
|
|
#ifdef __WXMSW__
|
2005-06-29 05:21:47 +00:00
|
|
|
// Connection Tab
|
|
|
|
m_strNetworkDialupConnectionName = pDlg->GetDefaultDialupConnection();
|
2006-02-16 11:01:57 +00:00
|
|
|
#endif
|
2005-06-28 22:22:29 +00:00
|
|
|
|
|
|
|
// Proxy Tabs
|
2005-06-29 05:21:47 +00:00
|
|
|
if (bRetrievedProxyConfiguration) {
|
|
|
|
pDoc->proxy_info.use_http_proxy = pDlg->m_EnableHTTPProxyCtrl->GetValue();
|
2006-03-23 01:17:07 +00:00
|
|
|
pDoc->proxy_info.http_server_name = (const char*)pDlg->m_HTTPAddressCtrl->GetValue().mb_str();
|
|
|
|
pDoc->proxy_info.http_user_name = (const char*)pDlg->m_HTTPUsernameCtrl->GetValue().mb_str();
|
|
|
|
pDoc->proxy_info.http_user_passwd = (const char*)pDlg->m_HTTPPasswordCtrl->GetValue().mb_str();
|
2005-06-29 05:21:47 +00:00
|
|
|
|
|
|
|
strBuffer = pDlg->m_HTTPPortCtrl->GetValue();
|
|
|
|
strBuffer.ToLong((long*)&iBuffer);
|
|
|
|
pDoc->proxy_info.http_server_port = iBuffer;
|
|
|
|
|
|
|
|
pDoc->proxy_info.use_socks_proxy = pDlg->m_EnableSOCKSProxyCtrl->GetValue();
|
2006-03-23 01:17:07 +00:00
|
|
|
pDoc->proxy_info.socks_server_name = (const char*)pDlg->m_SOCKSAddressCtrl->GetValue().mb_str();
|
|
|
|
pDoc->proxy_info.socks5_user_name = (const char*)pDlg->m_SOCKSUsernameCtrl->GetValue().mb_str();
|
|
|
|
pDoc->proxy_info.socks5_user_passwd = (const char*)pDlg->m_SOCKSPasswordCtrl->GetValue().mb_str();
|
2005-06-29 05:21:47 +00:00
|
|
|
|
|
|
|
strBuffer = pDlg->m_SOCKSPortCtrl->GetValue();
|
|
|
|
strBuffer.ToLong((long*)&iBuffer);
|
|
|
|
pDoc->proxy_info.socks_server_port = iBuffer;
|
|
|
|
|
|
|
|
pDoc->SetProxyConfiguration();
|
|
|
|
}
|
2004-10-25 00:56:16 +00:00
|
|
|
}
|
|
|
|
|
2004-04-11 04:12:44 +00:00
|
|
|
if (pDlg)
|
2004-05-29 00:09:41 +00:00
|
|
|
pDlg->Destroy();
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-09-06 08:58:56 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnOptionsOptions - Function End"));
|
2004-04-11 04:12:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-21 17:21:16 +00:00
|
|
|
void CMainFrame::OnHelp(wxHelpEvent& event) {
|
2005-05-05 06:07:14 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnHelpBOINCManager - Function Begin"));
|
|
|
|
|
|
|
|
if (IsShown()) {
|
|
|
|
if (ID_FRAME == event.GetId()) {
|
2005-12-28 12:33:18 +00:00
|
|
|
wxString url = wxGetApp().GetBrand()->GetCompanyWebsite().c_str();
|
|
|
|
url += wxT("manager.php");
|
|
|
|
ExecuteBrowserLink(url);
|
2005-05-05 06:07:14 +00:00
|
|
|
} else {
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnHelpBOINCManager - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-17 04:53:35 +00:00
|
|
|
void CMainFrame::OnHelpBOINCManager(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnHelpBOINCManager - Function Begin"));
|
|
|
|
|
|
|
|
if (IsShown()) {
|
2005-12-28 12:33:18 +00:00
|
|
|
wxString url = wxGetApp().GetBrand()->GetCompanyWebsite().c_str();
|
|
|
|
url += wxT("manager.php");
|
|
|
|
ExecuteBrowserLink(url);
|
2005-06-17 04:53:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnHelpBOINCManager - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-05 06:07:14 +00:00
|
|
|
void CMainFrame::OnHelpBOINCWebsite(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnHelpBOINCWebsite - Function Begin"));
|
|
|
|
|
|
|
|
if (IsShown()) {
|
2005-12-28 12:33:18 +00:00
|
|
|
wxString url = wxGetApp().GetBrand()->GetCompanyWebsite().c_str();
|
|
|
|
ExecuteBrowserLink(url);
|
2005-05-05 06:07:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnHelpBOINCWebsite - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::OnHelpAbout(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnHelpAbout - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
CDlgAbout* pDlg = new CDlgAbout(this);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDlg);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
|
|
|
pDlg->ShowModal();
|
|
|
|
|
|
|
|
if (pDlg)
|
2004-05-29 00:09:41 +00:00
|
|
|
pDlg->Destroy();
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-05-05 06:07:14 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnHelpAbout - Function End"));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CMainFrame::OnClose(wxCloseEvent& event) {
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnClose - Function Begin"));
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-10-01 08:56:37 +00:00
|
|
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
2005-09-06 06:18:36 +00:00
|
|
|
if (!event.CanVeto()) {
|
2004-10-24 07:38:38 +00:00
|
|
|
Destroy();
|
2005-09-06 06:18:36 +00:00
|
|
|
} else {
|
2004-10-24 07:38:38 +00:00
|
|
|
Hide();
|
2005-09-06 06:18:36 +00:00
|
|
|
}
|
2005-02-21 17:36:19 +00:00
|
|
|
#else
|
|
|
|
event.Skip();
|
|
|
|
#endif
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2004-12-04 00:43:39 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnClose - Function End"));
|
2004-10-24 07:38:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-14 03:09:24 +00:00
|
|
|
void CMainFrame::OnShow(wxShowEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnShow - Function Begin"));
|
2006-04-14 10:41:31 +00:00
|
|
|
|
|
|
|
if (event.GetShow())
|
2006-04-14 11:27:37 +00:00
|
|
|
SetWindowDimensions();
|
|
|
|
else
|
2006-04-14 10:41:31 +00:00
|
|
|
GetWindowDimensions();
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnShow - Function End"));
|
|
|
|
}
|
|
|
|
|
2006-04-14 11:27:37 +00:00
|
|
|
|
2006-04-14 10:41:31 +00:00
|
|
|
void CMainFrame::GetWindowDimensions() {
|
2006-04-14 11:27:37 +00:00
|
|
|
if (!IsIconized() && !IsMaximized()) {
|
|
|
|
m_Top = GetPosition().y;
|
|
|
|
m_Left = GetPosition().x;
|
|
|
|
m_Width = GetSize().GetWidth();
|
|
|
|
m_Height = GetSize().GetHeight();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::SetWindowDimensions() {
|
2006-04-17 07:58:19 +00:00
|
|
|
#ifndef __WXMAC__
|
2006-04-14 03:09:24 +00:00
|
|
|
static bool bFirstTime = true;
|
|
|
|
|
2006-04-14 10:41:31 +00:00
|
|
|
if (bFirstTime) {
|
2006-04-14 03:09:24 +00:00
|
|
|
bFirstTime = false;
|
|
|
|
|
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
|
|
|
bool bWindowIconized = false;
|
2006-04-17 07:58:19 +00:00
|
|
|
#ifdef __WXMSW__
|
2006-04-14 03:09:24 +00:00
|
|
|
bool bWindowMaximized = false;
|
2006-04-17 07:58:19 +00:00
|
|
|
#endif
|
2006-04-14 03:09:24 +00:00
|
|
|
|
|
|
|
wxASSERT(pConfig);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Restore Frame State
|
|
|
|
//
|
|
|
|
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
|
|
|
pConfig->Read(wxT("WindowIconized"), &bWindowIconized, false);
|
2006-04-17 07:58:19 +00:00
|
|
|
pConfig->Read(wxT("Width"), &m_Width, 800);
|
|
|
|
pConfig->Read(wxT("Height"), &m_Height, 600);
|
|
|
|
SetSize(-1, -1, m_Width, m_Height);
|
2006-04-14 03:09:24 +00:00
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
2006-04-17 07:58:19 +00:00
|
|
|
pConfig->Read(wxT("WindowMaximized"), &bWindowMaximized, false);
|
2006-04-14 03:09:24 +00:00
|
|
|
Maximize(bWindowMaximized);
|
|
|
|
#endif
|
|
|
|
}
|
2006-04-17 07:58:19 +00:00
|
|
|
#endif // ! __WXMAC__
|
2006-04-14 03:09:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-17 04:53:35 +00:00
|
|
|
void CMainFrame::OnAlert(CMainFrameAlertEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAlert - Function Begin"));
|
2005-06-24 10:49:42 +00:00
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
2005-07-14 20:27:32 +00:00
|
|
|
CTaskBarIcon* pTaskbar = wxGetApp().GetTaskBarIcon();
|
|
|
|
wxASSERT(pTaskbar);
|
|
|
|
|
|
|
|
if ((IsShown() && !event.m_notification_only) || (IsShown() && !pTaskbar->IsBalloonsSupported())) {
|
2005-10-10 18:24:04 +00:00
|
|
|
if (!event.m_notification_only) {
|
2005-11-27 01:28:56 +00:00
|
|
|
int retval = 0;
|
2006-04-14 03:09:24 +00:00
|
|
|
|
|
|
|
if (!IsShown()) {
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2005-11-27 01:28:56 +00:00
|
|
|
retval = ::wxMessageBox(event.m_message, event.m_title, event.m_style, this);
|
|
|
|
if (event.m_alert_event_type == AlertProcessResponse) {
|
|
|
|
event.ProcessResponse(retval);
|
|
|
|
}
|
2005-10-10 18:24:04 +00:00
|
|
|
}
|
2005-06-24 10:49:42 +00:00
|
|
|
} else {
|
|
|
|
// If the main window is hidden or minimzed use the system tray ballon
|
|
|
|
// to notify the user instead. This keeps dialogs from interfering
|
|
|
|
// with people typing email messages or any other activity where they
|
|
|
|
// do not want keyboard focus changed to another window while typing.
|
|
|
|
unsigned int icon_type;
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
if (wxICON_ERROR & event.m_style) {
|
2005-06-24 10:49:42 +00:00
|
|
|
icon_type = NIIF_ERROR;
|
2005-07-07 22:26:49 +00:00
|
|
|
} else if (wxICON_WARNING & event.m_style) {
|
2005-06-24 10:49:42 +00:00
|
|
|
icon_type = NIIF_WARNING;
|
2005-07-07 22:26:49 +00:00
|
|
|
} else if (wxICON_INFORMATION & event.m_style) {
|
2005-06-24 10:49:42 +00:00
|
|
|
icon_type = NIIF_INFO;
|
|
|
|
} else {
|
|
|
|
icon_type = NIIF_NONE;
|
|
|
|
}
|
|
|
|
|
2005-07-14 20:27:32 +00:00
|
|
|
pTaskbar->SetBalloon(
|
|
|
|
pTaskbar->m_iconTaskBarIcon,
|
2005-07-07 22:26:49 +00:00
|
|
|
event.m_title,
|
|
|
|
event.m_message,
|
2005-06-24 10:49:42 +00:00
|
|
|
5000,
|
|
|
|
icon_type
|
|
|
|
);
|
|
|
|
}
|
|
|
|
#else
|
2006-03-29 02:26:56 +00:00
|
|
|
// Notification only events on platforms other than Windows are currently
|
|
|
|
// discarded. On the Mac a model dialog box for a hidden window causes
|
|
|
|
// the menus to be locked and the application to become unresponsive. On
|
|
|
|
// Linux the application is restored and input focus is set on the
|
|
|
|
// notification which interrupts whatever the user was up to.
|
|
|
|
if (IsShown() && !event.m_notification_only) {
|
|
|
|
if (!event.m_notification_only) {
|
|
|
|
int retval = 0;
|
2006-04-14 03:09:24 +00:00
|
|
|
|
|
|
|
if (!IsShown()) {
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2006-03-29 02:26:56 +00:00
|
|
|
retval = ::wxMessageBox(event.m_message, event.m_title, event.m_style, this);
|
|
|
|
if (event.m_alert_event_type == AlertProcessResponse) {
|
|
|
|
event.ProcessResponse(retval);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-06-24 10:49:42 +00:00
|
|
|
#endif
|
|
|
|
|
2005-06-17 04:53:35 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAlert - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
void CMainFrame::OnConnect(CMainFrameEvent&) {
|
2005-04-08 04:23:37 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnConnect - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-03-07 21:31:07 +00:00
|
|
|
CWizardAccountManager* pAMWizard = NULL;
|
|
|
|
CWizardAttachProject* pAPWizard = NULL;
|
2006-05-02 09:31:04 +00:00
|
|
|
wxString strComputer = wxEmptyString;
|
2006-03-07 21:31:07 +00:00
|
|
|
wxString strName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
|
|
|
bool bCachedCredentials = false;
|
|
|
|
ACCT_MGR_INFO ami;
|
|
|
|
PROJECT_INIT_STATUS pis;
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
wxASSERT(pDoc);
|
2005-04-08 04:23:37 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2006-02-02 12:32:21 +00:00
|
|
|
// Update the menus
|
|
|
|
DeleteMenu();
|
|
|
|
CreateMenu();
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2005-09-27 09:55:54 +00:00
|
|
|
// Only present one of the wizards if no projects are currently
|
2005-04-08 04:23:37 +00:00
|
|
|
// detected.
|
2006-03-07 21:31:07 +00:00
|
|
|
m_pRefreshStateTimer->Stop();
|
|
|
|
m_pFrameRenderTimer->Stop();
|
|
|
|
m_pFrameListPanelRenderTimer->Stop();
|
|
|
|
m_pDocumentPollTimer->Stop();
|
2004-10-26 01:59:44 +00:00
|
|
|
|
2006-05-02 09:31:04 +00:00
|
|
|
|
|
|
|
// If we are connected to the localhost, run a really quick screensaver
|
|
|
|
// test to trigger a firewall popup.
|
|
|
|
pDoc->GetConnectedComputerName(strComputer);
|
|
|
|
if (pDoc->IsComputerNameLocal(strComputer)) {
|
|
|
|
wxGetApp().StartBOINCScreensaverTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-07 21:31:07 +00:00
|
|
|
pDoc->rpc.acct_mgr_info(ami);
|
|
|
|
if (ami.acct_mgr_url.size() && !ami.have_credentials) {
|
|
|
|
pAMWizard = new CWizardAccountManager(this);
|
2006-04-14 03:09:24 +00:00
|
|
|
|
|
|
|
if (!IsShown()) {
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2006-03-07 21:31:07 +00:00
|
|
|
if (pAMWizard->Run()) {
|
|
|
|
// If successful, hide the main window
|
|
|
|
Hide();
|
2005-09-27 09:55:54 +00:00
|
|
|
} else {
|
2006-03-07 21:31:07 +00:00
|
|
|
// If failure, display the messages tab
|
|
|
|
m_pNotebook->SetSelection(ID_LIST_MESSAGESVIEW - ID_LIST_BASE);
|
|
|
|
}
|
|
|
|
} else if (0 >= pDoc->GetProjectCount()) {
|
|
|
|
pAPWizard = new CWizardAttachProject(this);
|
2006-04-14 03:09:24 +00:00
|
|
|
|
|
|
|
if (!IsShown()) {
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2006-03-07 21:31:07 +00:00
|
|
|
pDoc->rpc.get_project_init_status(pis);
|
2006-03-23 01:17:07 +00:00
|
|
|
strName = wxString(pis.name.c_str(), wxConvUTF8);
|
|
|
|
strURL = wxString(pis.url.c_str(), wxConvUTF8);
|
2006-03-07 21:31:07 +00:00
|
|
|
bCachedCredentials = pis.url.length() && pis.has_account_key;
|
|
|
|
|
|
|
|
if (pAPWizard->Run(strName, strURL, bCachedCredentials)) {
|
|
|
|
// If successful, display the work tab
|
|
|
|
m_pNotebook->SetSelection(ID_LIST_WORKVIEW - ID_LIST_BASE);
|
|
|
|
} else {
|
|
|
|
// If failure, display the messages tab
|
|
|
|
m_pNotebook->SetSelection(ID_LIST_MESSAGESVIEW - ID_LIST_BASE);
|
2005-09-27 09:55:54 +00:00
|
|
|
}
|
2006-03-07 21:31:07 +00:00
|
|
|
}
|
2005-09-27 09:55:54 +00:00
|
|
|
|
2006-03-07 21:31:07 +00:00
|
|
|
m_pRefreshStateTimer->Start();
|
|
|
|
m_pFrameRenderTimer->Start();
|
|
|
|
m_pFrameListPanelRenderTimer->Start();
|
|
|
|
m_pDocumentPollTimer->Start();
|
2004-10-21 14:29:59 +00:00
|
|
|
|
2006-03-07 21:31:07 +00:00
|
|
|
if (pAMWizard)
|
|
|
|
pAMWizard->Destroy();
|
|
|
|
if (pAPWizard)
|
|
|
|
pAPWizard->Destroy();
|
2005-08-25 22:00:39 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnConnect - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
void CMainFrame::OnInitialized(CMainFrameEvent&) {
|
2005-04-15 20:49:23 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnInitialized - Function Begin"));
|
2005-04-08 04:23:37 +00:00
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-08 04:23:37 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2005-05-24 21:26:49 +00:00
|
|
|
if (!pDoc->IsConnected()) {
|
2005-11-29 00:29:43 +00:00
|
|
|
pDoc->Connect(wxT("localhost"), wxEmptyString, TRUE, TRUE);
|
2005-05-24 21:26:49 +00:00
|
|
|
}
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-04-15 20:49:23 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnInitialized - Function End"));
|
2005-04-08 04:23:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
void CMainFrame::OnRefreshView(CMainFrameEvent&) {
|
2005-04-08 04:23:37 +00:00
|
|
|
static bool bAlreadyRunningLoop = false;
|
|
|
|
|
|
|
|
if (!bAlreadyRunningLoop) {
|
|
|
|
bAlreadyRunningLoop = true;
|
|
|
|
|
|
|
|
if (IsShown()) {
|
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
wxTimerEvent timerEvent;
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pNotebook);
|
2005-04-08 04:23:37 +00:00
|
|
|
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(m_pNotebook->GetSelection());
|
2005-04-08 16:58:55 +00:00
|
|
|
wxASSERT(pwndNotebookPage);
|
2005-04-08 04:23:37 +00:00
|
|
|
|
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pView);
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
pView->FireOnListRender(timerEvent);
|
2005-04-08 04:23:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bAlreadyRunningLoop = false;
|
|
|
|
}
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CMainFrame::OnRefreshState(wxTimerEvent &event) {
|
2005-03-12 01:09:24 +00:00
|
|
|
static bool bAlreadyRunningLoop = false;
|
2005-03-07 23:52:28 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (!bAlreadyRunningLoop) {
|
2005-03-12 01:09:24 +00:00
|
|
|
bAlreadyRunningLoop = true;
|
|
|
|
|
2005-03-31 23:54:12 +00:00
|
|
|
// Write a snapshot of the current state to the config
|
|
|
|
// module, on Win9x systems we don't always shutdown
|
|
|
|
// in a nice way, if we are terminated by the user
|
|
|
|
// we still want the UI state to have been stored
|
|
|
|
// for their next use
|
|
|
|
SaveState();
|
|
|
|
|
2005-03-12 01:09:24 +00:00
|
|
|
bAlreadyRunningLoop = false;
|
2005-03-07 23:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CMainFrame::OnFrameRender(wxTimerEvent &event) {
|
2005-06-24 10:49:42 +00:00
|
|
|
static bool bAlreadyRunningLoop = false;
|
|
|
|
static bool bAlreadyRunOnce = false;
|
|
|
|
static wxString strCachedStatusText = wxEmptyString;
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-03-07 23:52:28 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (!bAlreadyRunningLoop) {
|
2005-03-12 01:09:24 +00:00
|
|
|
bAlreadyRunningLoop = true;
|
|
|
|
|
|
|
|
wxGetApp().UpdateSystemIdleDetection();
|
|
|
|
|
2005-05-24 21:26:49 +00:00
|
|
|
if (!bAlreadyRunOnce) {
|
|
|
|
// Complete any remaining initialization that has to happen after we are up
|
|
|
|
// and running
|
|
|
|
FireInitialize();
|
|
|
|
bAlreadyRunOnce = true;
|
|
|
|
}
|
|
|
|
|
2006-02-09 21:51:07 +00:00
|
|
|
// Check to see if there is anything that we need to do from the
|
|
|
|
// dial up user perspective.
|
2005-08-23 20:26:28 +00:00
|
|
|
if (pDoc->IsConnected()) {
|
2006-02-09 21:51:07 +00:00
|
|
|
if (m_pDialupManager) {
|
|
|
|
m_pDialupManager->poll();
|
2005-06-24 10:49:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (IsShown()) {
|
2005-04-27 06:55:28 +00:00
|
|
|
if (pDoc) {
|
2005-03-12 01:09:24 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-03-09 19:15:20 +00:00
|
|
|
|
2005-03-12 01:09:24 +00:00
|
|
|
// Update the menu bar
|
2005-06-24 10:49:42 +00:00
|
|
|
wxMenuBar* pMenuBar = GetMenuBar();
|
2005-04-10 19:01:23 +00:00
|
|
|
int iActivityMode = -1;
|
|
|
|
int iNetworkMode = -1;
|
2005-03-09 19:15:20 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pMenuBar);
|
2005-03-12 01:09:24 +00:00
|
|
|
wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar));
|
2005-03-09 19:15:20 +00:00
|
|
|
|
2005-07-22 06:56:34 +00:00
|
|
|
pMenuBar->Check(ID_FILEACTIVITYRUNALWAYS, false);
|
|
|
|
pMenuBar->Check(ID_FILEACTIVITYSUSPEND, false);
|
|
|
|
pMenuBar->Check(ID_FILEACTIVITYRUNBASEDONPREPERENCES, false);
|
2005-04-08 16:58:55 +00:00
|
|
|
if ((pDoc->IsConnected()) && (0 == pDoc->GetActivityRunMode(iActivityMode))) {
|
2005-05-29 07:12:00 +00:00
|
|
|
if (iActivityMode == RUN_MODE_ALWAYS)
|
2005-07-22 06:56:34 +00:00
|
|
|
pMenuBar->Check(ID_FILEACTIVITYRUNALWAYS, true);
|
2005-05-29 07:12:00 +00:00
|
|
|
if (iActivityMode == RUN_MODE_NEVER)
|
2005-07-22 06:56:34 +00:00
|
|
|
pMenuBar->Check(ID_FILEACTIVITYSUSPEND, true);
|
2005-05-29 07:12:00 +00:00
|
|
|
if (iActivityMode == RUN_MODE_AUTO)
|
2005-07-22 06:56:34 +00:00
|
|
|
pMenuBar->Check(ID_FILEACTIVITYRUNBASEDONPREPERENCES, true);
|
2005-03-12 01:09:24 +00:00
|
|
|
}
|
2005-03-09 19:15:20 +00:00
|
|
|
|
2005-07-22 06:56:34 +00:00
|
|
|
pMenuBar->Check(ID_FILENETWORKRUNALWAYS, false);
|
|
|
|
pMenuBar->Check(ID_FILENETWORKSUSPEND, false);
|
|
|
|
pMenuBar->Check(ID_FILENETWORKRUNBASEDONPREPERENCES, false);
|
2005-04-08 16:58:55 +00:00
|
|
|
if ((pDoc->IsConnected()) && (0 == pDoc->GetNetworkRunMode(iNetworkMode))) {
|
2005-05-29 07:12:00 +00:00
|
|
|
if (RUN_MODE_ALWAYS == iNetworkMode)
|
2005-07-22 06:56:34 +00:00
|
|
|
pMenuBar->Check(ID_FILENETWORKRUNALWAYS, true);
|
2005-05-29 07:12:00 +00:00
|
|
|
if (RUN_MODE_NEVER == iNetworkMode)
|
2005-07-22 06:56:34 +00:00
|
|
|
pMenuBar->Check(ID_FILENETWORKSUSPEND, true);
|
2005-05-29 07:12:00 +00:00
|
|
|
if (RUN_MODE_AUTO == iNetworkMode)
|
2005-07-22 06:56:34 +00:00
|
|
|
pMenuBar->Check(ID_FILENETWORKRUNBASEDONPREPERENCES, true);
|
2005-03-12 01:09:24 +00:00
|
|
|
}
|
2005-03-09 19:15:20 +00:00
|
|
|
|
2005-03-12 01:09:24 +00:00
|
|
|
// Update the statusbar
|
|
|
|
wxASSERT(wxDynamicCast(m_pStatusbar, CStatusBar));
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsConnected() || pDoc->IsReconnecting()) {
|
2005-03-12 01:09:24 +00:00
|
|
|
m_pStatusbar->m_pbmpConnected->Show();
|
|
|
|
m_pStatusbar->m_ptxtConnected->Show();
|
|
|
|
m_pStatusbar->m_pbmpDisconnect->Hide();
|
|
|
|
m_pStatusbar->m_ptxtDisconnect->Hide();
|
|
|
|
|
|
|
|
wxString strBuffer = wxEmptyString;
|
2005-04-06 23:28:49 +00:00
|
|
|
wxString strComputerName = wxEmptyString;
|
2005-03-12 01:09:24 +00:00
|
|
|
wxString strStatusText = wxEmptyString;
|
|
|
|
wxString strTitle = m_strBaseTitle;
|
2006-03-23 01:17:07 +00:00
|
|
|
wxString strLocale = wxString(setlocale(LC_NUMERIC, NULL), wxConvUTF8);
|
2005-03-12 01:09:24 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsReconnecting())
|
|
|
|
pDoc->GetConnectingComputerName(strComputerName);
|
2005-04-06 23:28:49 +00:00
|
|
|
else
|
2005-04-07 07:04:50 +00:00
|
|
|
pDoc->GetConnectedComputerName(strComputerName);
|
2005-04-06 23:28:49 +00:00
|
|
|
|
2005-11-27 01:28:56 +00:00
|
|
|
if (pDoc->IsComputerNameLocal(strComputerName)) {
|
2005-03-12 01:09:24 +00:00
|
|
|
strTitle += wxT(" - (localhost)");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2005-04-06 23:28:49 +00:00
|
|
|
strStatusText += strComputerName;
|
2005-03-12 01:09:24 +00:00
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsReconnecting()) {
|
2005-04-06 23:28:49 +00:00
|
|
|
strTitle.Printf(_("%s - (%s)"), m_strBaseTitle.c_str(), strComputerName.c_str());
|
|
|
|
strStatusText.Printf(_("Connecting to %s"), strComputerName.c_str());
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2005-04-06 23:28:49 +00:00
|
|
|
strTitle.Printf(_("%s - (%s)"), m_strBaseTitle.c_str(), strComputerName.c_str());
|
2005-04-08 22:52:40 +00:00
|
|
|
strStatusText.Printf(_("Connected to %s"), strComputerName.c_str());
|
2005-04-06 23:28:49 +00:00
|
|
|
}
|
2005-03-12 01:09:24 +00:00
|
|
|
|
2005-08-30 11:34:27 +00:00
|
|
|
// The Mac takes a huge performance hit redrawing this window,
|
2005-05-25 03:36:16 +00:00
|
|
|
// window, so don't change the text unless we really have too.
|
2005-08-30 11:34:27 +00:00
|
|
|
if (GetTitle() != strTitle)
|
|
|
|
SetTitle(strTitle);
|
|
|
|
|
2005-05-25 03:36:16 +00:00
|
|
|
if (strStatusText != strCachedStatusText) {
|
|
|
|
strCachedStatusText = strStatusText;
|
|
|
|
m_pStatusbar->m_ptxtConnected->SetLabel(strStatusText);
|
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2005-03-12 01:09:24 +00:00
|
|
|
m_pStatusbar->m_pbmpConnected->Hide();
|
|
|
|
m_pStatusbar->m_ptxtConnected->Hide();
|
|
|
|
m_pStatusbar->m_pbmpDisconnect->Show();
|
|
|
|
m_pStatusbar->m_ptxtDisconnect->Show();
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-08-30 11:34:27 +00:00
|
|
|
if (GetTitle() != m_strBaseTitle)
|
|
|
|
SetTitle(m_strBaseTitle);
|
2005-01-10 20:24:09 +00:00
|
|
|
}
|
2004-10-28 22:51:38 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-12 01:09:24 +00:00
|
|
|
|
|
|
|
bAlreadyRunningLoop = false;
|
2004-10-28 22:51:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
2004-09-25 21:33:24 +00:00
|
|
|
|
|
|
|
|
2005-04-08 16:58:55 +00:00
|
|
|
void CMainFrame::OnListPanelRender(wxTimerEvent&) {
|
2005-06-22 10:51:34 +00:00
|
|
|
FireRefreshView();
|
2005-08-31 05:40:59 +00:00
|
|
|
SetFrameListPanelRenderTimerRate(); // Set to refresh every 5 or 60 seconds
|
2005-04-08 04:23:37 +00:00
|
|
|
}
|
2004-05-21 06:27:15 +00:00
|
|
|
|
|
|
|
|
2005-04-15 19:33:47 +00:00
|
|
|
void CMainFrame::OnDocumentPoll(wxTimerEvent& /*event*/) {
|
2005-04-10 02:24:08 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
pDoc->OnPoll();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
void CMainFrame::OnNotebookSelectionChanged(wxNotebookEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnNotebookSelectionChanged - Function Begin"));
|
2004-10-21 14:29:59 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
if ((-1 != event.GetSelection()) && IsShown()) {
|
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
|
|
|
CBOINCBaseView* pView = NULL;
|
|
|
|
wxTimerEvent timerEvent;
|
2005-03-12 01:09:24 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pNotebook);
|
2005-03-12 01:09:24 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(event.GetSelection());
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pwndNotebookPage);
|
2004-10-26 01:59:44 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pView);
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-04-23 07:21:00 +00:00
|
|
|
FireRefreshView();
|
2005-08-31 05:40:59 +00:00
|
|
|
|
|
|
|
SetFrameListPanelRenderTimerRate();
|
2004-05-27 06:17:58 +00:00
|
|
|
}
|
2004-10-21 14:29:59 +00:00
|
|
|
|
|
|
|
event.Skip();
|
2004-12-03 20:30:24 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnNotebookSelectionChanged - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-17 20:59:15 +00:00
|
|
|
void CMainFrame::ExecuteBrowserLink(const wxString &strLink) {
|
|
|
|
wxHyperLink::ExecuteLink(strLink);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::FireInitialize() {
|
|
|
|
CMainFrameEvent event(wxEVT_MAINFRAME_INITIALIZED, this);
|
|
|
|
AddPendingEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::FireRefreshView() {
|
|
|
|
CMainFrameEvent event(wxEVT_MAINFRAME_REFRESHVIEW, this);
|
|
|
|
AddPendingEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::FireConnect() {
|
|
|
|
CMainFrameEvent event(wxEVT_MAINFRAME_CONNECT, this);
|
|
|
|
AddPendingEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::ResetReminderTimers() {
|
2006-02-18 15:56:16 +00:00
|
|
|
#ifdef __WXMSW__
|
2006-02-17 20:59:15 +00:00
|
|
|
wxASSERT(m_pDialupManager);
|
|
|
|
wxASSERT(wxDynamicCast(m_pDialupManager, CBOINCDialUpManager));
|
|
|
|
|
|
|
|
m_pDialupManager->ResetReminderTimers();
|
2006-02-18 15:56:16 +00:00
|
|
|
#endif
|
2006-02-17 20:59:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-31 05:40:59 +00:00
|
|
|
void CMainFrame::SetFrameListPanelRenderTimerRate() {
|
|
|
|
static wxWindowID previousPane = -1;
|
|
|
|
static int connectedCount = 0;
|
|
|
|
wxWindowID currentPane;
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(m_pNotebook);
|
|
|
|
wxASSERT(m_pFrameListPanelRenderTimer);
|
|
|
|
wxASSERT(pDoc);
|
2005-11-27 01:28:56 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-08-31 05:40:59 +00:00
|
|
|
|
|
|
|
// Keep timer at faster rate until we have been connected > 10 seconds
|
|
|
|
if (!pDoc->IsConnected())
|
|
|
|
connectedCount = 0;
|
|
|
|
|
|
|
|
if (connectedCount < 3) {
|
|
|
|
connectedCount++;
|
|
|
|
previousPane = -1; // Ensure an update when connectedCount reaches 3
|
|
|
|
|
|
|
|
if (m_pFrameListPanelRenderTimer->IsRunning())
|
|
|
|
m_pFrameListPanelRenderTimer->Stop();
|
2006-02-15 08:18:48 +00:00
|
|
|
m_pFrameListPanelRenderTimer->Start(1000); // Refresh every 1 seconds
|
2005-08-31 05:40:59 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentPane = m_pNotebook->GetSelection() + ID_TASK_BASE;
|
|
|
|
if (currentPane == previousPane)
|
|
|
|
return;
|
|
|
|
|
|
|
|
previousPane = currentPane;
|
|
|
|
if (m_pFrameListPanelRenderTimer->IsRunning())
|
|
|
|
m_pFrameListPanelRenderTimer->Stop();
|
|
|
|
|
|
|
|
switch (currentPane) {
|
|
|
|
case ID_TASK_STATISTICSVIEW:
|
|
|
|
m_pFrameListPanelRenderTimer->Start(60000); // Refresh every 1 minute
|
|
|
|
break;
|
|
|
|
default:
|
2006-02-15 08:18:48 +00:00
|
|
|
m_pFrameListPanelRenderTimer->Start(1000); // Refresh every 1 seconds
|
2005-08-31 05:40:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
void CMainFrame::ShowConnectionBadPasswordAlert() {
|
|
|
|
wxString strDialogTitle = wxEmptyString;
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::ShowConnectionBadPasswordAlert - Function Begin"));
|
|
|
|
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strDialogTitle.Printf(
|
|
|
|
_("%s - Connection Error"),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
ShowAlert(
|
|
|
|
strDialogTitle,
|
|
|
|
_("The password you have provided is incorrect, please try again."),
|
2006-04-14 22:30:59 +00:00
|
|
|
wxOK | wxICON_ERROR
|
2005-12-28 12:33:18 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::ShowConnectionBadPasswordAlert - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-27 01:28:56 +00:00
|
|
|
void CMainFrame::ShowConnectionFailedAlert() {
|
2005-12-28 12:33:18 +00:00
|
|
|
wxString strDialogTitle = wxEmptyString;
|
|
|
|
wxString strDialogMessage = wxEmptyString;
|
|
|
|
|
2005-11-27 01:28:56 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::ShowConnectionFailedAlert - Function Begin"));
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strDialogTitle.Printf(
|
|
|
|
_("%s - Connection Failed"),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
// 1st %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
// 2st %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strDialogMessage.Printf(
|
|
|
|
_("%s is not able to connect to a %s client.\n"
|
2005-11-27 01:28:56 +00:00
|
|
|
"Would you like to try to connect again?"),
|
2005-12-28 12:33:18 +00:00
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str(),
|
|
|
|
wxGetApp().GetBrand()->GetProjectName().c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
ShowAlert(
|
|
|
|
strDialogTitle,
|
|
|
|
strDialogMessage,
|
2005-11-27 01:28:56 +00:00
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
false,
|
|
|
|
AlertProcessResponse
|
|
|
|
);
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::ShowConnectionFailedAlert - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
void CMainFrame::ShowNotCurrentlyConnectedAlert() {
|
2005-12-28 12:33:18 +00:00
|
|
|
wxString strDialogTitle = wxEmptyString;
|
|
|
|
wxString strDialogMessage = wxEmptyString;
|
|
|
|
|
2005-11-26 11:17:48 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::ShowNotCurrentlyConnectedAlert - Function Begin"));
|
|
|
|
|
2005-12-28 12:33:18 +00:00
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strDialogTitle.Printf(
|
|
|
|
_("%s - Connection Status"),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
// 1st %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
// 2nd %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
// 3nd %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strDialogMessage.Printf(
|
|
|
|
_("%s is not currently connected to a %s client.\n"
|
|
|
|
"Please use the 'File\\Select Computer...' menu option to connect up to a %s client.\n"
|
|
|
|
"To connect up to your local computer please use 'localhost' as the host name."),
|
|
|
|
wxGetApp().GetBrand()->GetApplicationName().c_str(),
|
|
|
|
wxGetApp().GetBrand()->GetProjectName().c_str(),
|
|
|
|
wxGetApp().GetBrand()->GetProjectName().c_str()
|
|
|
|
);
|
2005-11-26 11:17:48 +00:00
|
|
|
ShowAlert(
|
2005-12-28 12:33:18 +00:00
|
|
|
strDialogTitle,
|
|
|
|
strDialogMessage,
|
2006-04-14 22:30:59 +00:00
|
|
|
wxOK | wxICON_ERROR
|
2005-11-26 11:17:48 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::ShowNotCurrentlyConnectedAlert - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-27 01:28:56 +00:00
|
|
|
void CMainFrame::ShowAlert( const wxString title, const wxString message, const int style, const bool notification_only, const MainFrameAlertEventType alert_event_type ) {
|
|
|
|
CMainFrameAlertEvent event(wxEVT_MAINFRAME_ALERT, this, title, message, style, notification_only, alert_event_type);
|
2005-04-08 21:18:30 +00:00
|
|
|
AddPendingEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-17 20:59:15 +00:00
|
|
|
void CMainFrame::UpdateStatusText(const wxChar* szStatus) {
|
|
|
|
wxString strStatus = szStatus;
|
|
|
|
m_pStatusbar->SetStatusText(strStatus);
|
|
|
|
::wxSleep(0);
|
2005-04-08 06:24:58 +00:00
|
|
|
}
|
|
|
|
|
2005-11-27 01:28:56 +00:00
|
|
|
|
2005-07-06 05:16:53 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
|
|
|
|
bool CMainFrame::Show(bool show) {
|
|
|
|
ProcessSerialNumber psn;
|
|
|
|
|
|
|
|
GetCurrentProcess(&psn);
|
|
|
|
if (show) {
|
|
|
|
SetFrontProcess(&psn); // Shows process if hidden
|
2006-04-14 11:27:37 +00:00
|
|
|
} else {
|
2006-04-14 10:41:31 +00:00
|
|
|
GetWindowDimensions();
|
2005-07-06 05:16:53 +00:00
|
|
|
if (IsProcessVisible(&psn))
|
|
|
|
ShowHideProcess(&psn, false);
|
2006-04-14 11:27:37 +00:00
|
|
|
}
|
2005-07-06 05:16:53 +00:00
|
|
|
|
|
|
|
return wxFrame::Show(show);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __WXMAC__
|
2005-04-08 06:24:58 +00:00
|
|
|
|
2005-11-27 01:28:56 +00:00
|
|
|
|
|
|
|
void CMainFrameAlertEvent::ProcessResponse(const int response) const {
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
if ((AlertProcessResponse == m_alert_event_type) && (wxYES == response)) {
|
|
|
|
pDoc->Reconnect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_d881a56dc5 = "$Id$";
|