2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2006-07-05 21:36:56 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2006-07-05 21:36:56 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC 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 3 of the License, or (at your option) any later version.
|
2006-07-05 21:36:56 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2006-07-05 21:36:56 +00:00
|
|
|
// 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.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2006-07-05 21:36:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "sg_BoincSimpleGUI.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
2009-11-25 00:49:29 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
#include "MacAccessiblity.h"
|
|
|
|
#endif
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "diagnostics.h"
|
2007-02-21 17:06:11 +00:00
|
|
|
#include "str_util.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "mfile.h"
|
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
|
|
|
#include "error_numbers.h"
|
2006-10-23 06:48:48 +00:00
|
|
|
#include "common/wxFlatNotebook.h"
|
2006-07-05 21:36:56 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "SkinManager.h"
|
|
|
|
#include "MainDocument.h"
|
2006-07-05 21:36:56 +00:00
|
|
|
#include "Events.h"
|
2006-07-20 19:33:08 +00:00
|
|
|
#include "BOINCBaseFrame.h"
|
2006-10-23 06:48:48 +00:00
|
|
|
#include "wizardex.h"
|
|
|
|
#include "BOINCWizards.h"
|
|
|
|
#include "BOINCBaseWizard.h"
|
|
|
|
#include "WizardAttachProject.h"
|
|
|
|
#include "error_numbers.h"
|
2007-08-16 18:53:42 +00:00
|
|
|
#include "version.h"
|
2006-07-20 19:33:08 +00:00
|
|
|
|
|
|
|
#include "sg_BoincSimpleGUI.h"
|
|
|
|
#include "sg_ImageLoader.h"
|
|
|
|
#include "sg_ProjectsComponent.h"
|
2006-08-18 21:45:17 +00:00
|
|
|
#include "sg_ClientStateIndicator.h"
|
2006-07-24 22:10:28 +00:00
|
|
|
#include "sg_StatImageLoader.h"
|
2006-07-11 23:26:37 +00:00
|
|
|
#include "sg_ViewTabPage.h"
|
2008-07-29 13:06:28 +00:00
|
|
|
#include "sg_DlgMessages.h"
|
2006-08-07 15:33:03 +00:00
|
|
|
|
2006-07-20 19:33:08 +00:00
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CSimpleFrame, CBOINCBaseFrame)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CSimpleFrame, CBOINCBaseFrame)
|
|
|
|
EVT_SIZE(CSimpleFrame::OnSize)
|
2009-10-14 17:11:57 +00:00
|
|
|
EVT_MENU(ID_CHANGEGUI, CSimpleFrame::OnChangeGUI)
|
2006-12-12 01:08:16 +00:00
|
|
|
EVT_HELP(wxID_ANY, CSimpleFrame::OnHelp)
|
2009-02-27 17:04:04 +00:00
|
|
|
EVT_FRAME_CONNECT(CSimpleFrame::OnConnect)
|
2006-10-25 14:09:47 +00:00
|
|
|
EVT_FRAME_RELOADSKIN(CSimpleFrame::OnReloadSkin)
|
2006-12-16 07:57:26 +00:00
|
|
|
// We can't eliminate the Mac Help menu, so we might as well make it useful.
|
2008-06-05 02:07:44 +00:00
|
|
|
EVT_MENU(ID_HELPBOINC, CSimpleFrame::OnHelpBOINC)
|
|
|
|
EVT_MENU(ID_HELPBOINCMANAGER, CSimpleFrame::OnHelpBOINC)
|
|
|
|
EVT_MENU(ID_HELPBOINCWEBSITE, CSimpleFrame::OnHelpBOINC)
|
2006-07-05 21:36:56 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
CSimpleFrame::CSimpleFrame() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Default Constructor Function Begin"));
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Default Constructor Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-09 18:02:37 +00:00
|
|
|
CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint position, wxSize size) :
|
|
|
|
CBOINCBaseFrame((wxFrame *)NULL, ID_SIMPLEFRAME, title, position, size,
|
|
|
|
wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
|
2006-07-05 21:36:56 +00:00
|
|
|
{
|
2006-08-23 21:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Overloaded Constructor Function Begin"));
|
2006-07-10 18:40:04 +00:00
|
|
|
|
2006-11-06 14:37:49 +00:00
|
|
|
// Initialize Application
|
2008-06-23 17:54:44 +00:00
|
|
|
wxIconBundle icons;
|
|
|
|
icons.AddIcon(*icon);
|
|
|
|
icons.AddIcon(*icon32);
|
|
|
|
SetIcons(icons);
|
2006-11-23 02:27:25 +00:00
|
|
|
|
2006-12-12 01:08:16 +00:00
|
|
|
#ifdef __WXMAC__
|
2006-12-16 07:57:26 +00:00
|
|
|
// We can't eliminate the Mac menu bar or the Help menu, so we
|
|
|
|
// might as well make them useful.
|
|
|
|
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
|
|
|
wxString strMenuName;
|
|
|
|
wxString strMenuDescription;
|
|
|
|
|
|
|
|
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
|
|
|
|
|
|
|
// File menu
|
|
|
|
wxMenu *menuFile = new wxMenu;
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Close the %s window"),
|
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
2009-11-26 10:45:29 +00:00
|
|
|
strMenuName = _("&Close Window");
|
|
|
|
strMenuName += wxT("\tCtrl+W");
|
2006-12-16 07:57:26 +00:00
|
|
|
menuFile->Append(
|
2009-10-14 17:11:57 +00:00
|
|
|
ID_CLOSEWINDOW,
|
2009-11-26 10:45:29 +00:00
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
2006-12-16 07:57:26 +00:00
|
|
|
);
|
|
|
|
|
2009-10-26 08:07:52 +00:00
|
|
|
// View menu
|
|
|
|
wxMenu *menuView = new wxMenu;
|
|
|
|
|
|
|
|
menuView->Append(
|
|
|
|
ID_CHANGEGUI,
|
2009-11-05 18:36:37 +00:00
|
|
|
_("Advanced View...\tCtrl+Shift+A"),
|
2009-10-26 08:07:52 +00:00
|
|
|
_("Display the advanced (accessible) graphical interface.")
|
|
|
|
);
|
|
|
|
|
2006-12-16 07:57:26 +00:00
|
|
|
// Help menu
|
|
|
|
wxMenu *menuHelp = new wxMenu;
|
|
|
|
|
2008-06-05 02:07:44 +00:00
|
|
|
// %s is the project name
|
2009-10-14 17:11:57 +00:00
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic'
|
2008-06-05 02:07:44 +00:00
|
|
|
strMenuName.Printf(
|
|
|
|
_("%s &help"),
|
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
|
|
|
);
|
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Show information about %s"),
|
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
|
|
|
);
|
|
|
|
menuHelp->Append(
|
|
|
|
ID_HELPBOINC,
|
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
|
|
|
);
|
|
|
|
|
2006-12-16 07:57:26 +00:00
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("&%s"),
|
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
2008-06-05 02:13:43 +00:00
|
|
|
// %s is the application name
|
2006-12-16 07:57:26 +00:00
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Show information about the %s"),
|
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
menuHelp->Append(
|
|
|
|
ID_HELPBOINCMANAGER,
|
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
|
|
|
);
|
|
|
|
|
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
strMenuName.Printf(
|
|
|
|
_("%s &website"),
|
2007-08-16 18:53:42 +00:00
|
|
|
pSkinAdvanced->GetApplicationShortName().c_str()
|
2006-12-16 07:57:26 +00:00
|
|
|
);
|
|
|
|
// %s is the application name
|
|
|
|
// i.e. 'BOINC Manager', 'GridRepublic Manager'
|
|
|
|
strMenuDescription.Printf(
|
|
|
|
_("Show information about BOINC and %s"),
|
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
menuHelp->Append(
|
2007-04-03 13:14:30 +00:00
|
|
|
ID_HELPBOINCWEBSITE,
|
2006-12-16 07:57:26 +00:00
|
|
|
strMenuName,
|
|
|
|
strMenuDescription
|
|
|
|
);
|
|
|
|
|
2006-11-23 02:27:25 +00:00
|
|
|
// Clear menubar
|
|
|
|
m_pMenubar = new wxMenuBar;
|
2006-12-16 07:57:26 +00:00
|
|
|
m_pMenubar->Append(
|
|
|
|
menuHelp,
|
|
|
|
_("&Help")
|
|
|
|
);
|
|
|
|
|
2006-11-23 02:27:25 +00:00
|
|
|
SetMenuBar(m_pMenubar);
|
|
|
|
m_pMenubar->MacInstallMenuBar();
|
2006-12-16 07:57:26 +00:00
|
|
|
::ClearMenuBar(); // Remove everything we can from the Mac menu bar
|
|
|
|
|
|
|
|
m_pMenubar->Insert( // Must be done after ClearMenuBar()
|
|
|
|
0,
|
|
|
|
menuFile,
|
|
|
|
_("&File")
|
|
|
|
);
|
2006-12-12 04:10:07 +00:00
|
|
|
|
2009-10-26 08:07:52 +00:00
|
|
|
m_pMenubar->Append(
|
|
|
|
menuView,
|
|
|
|
_("&View")
|
|
|
|
);
|
|
|
|
|
|
|
|
m_Shortcuts[0].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER);
|
2009-04-16 00:30:42 +00:00
|
|
|
m_pAccelTable = new wxAcceleratorTable(2, m_Shortcuts);
|
2006-12-12 04:10:07 +00:00
|
|
|
#else
|
2009-10-14 17:11:57 +00:00
|
|
|
m_Shortcuts[0].Set(wxACCEL_CTRL|wxACCEL_SHIFT, (int)'A', ID_CHANGEGUI);
|
2009-04-16 00:30:42 +00:00
|
|
|
m_pAccelTable = new wxAcceleratorTable(1, m_Shortcuts);
|
2006-11-23 02:27:25 +00:00
|
|
|
#endif
|
2006-12-12 01:08:16 +00:00
|
|
|
|
2006-12-12 04:10:07 +00:00
|
|
|
SetAcceleratorTable(*m_pAccelTable);
|
2008-07-30 12:49:10 +00:00
|
|
|
|
2008-07-29 13:06:28 +00:00
|
|
|
dlgMsgsPtr = NULL;
|
2006-12-12 04:10:07 +00:00
|
|
|
m_pBackgroundPanel = new CSimplePanel(this);
|
2006-10-25 20:48:23 +00:00
|
|
|
}
|
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2006-11-06 22:23:46 +00:00
|
|
|
CSimpleFrame::~CSimpleFrame() {
|
2006-08-23 21:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function Begin"));
|
2006-09-14 16:47:24 +00:00
|
|
|
|
2009-03-12 08:02:33 +00:00
|
|
|
SaveState();
|
|
|
|
|
2006-11-23 02:27:25 +00:00
|
|
|
if (m_pAccelTable)
|
|
|
|
delete m_pAccelTable;
|
|
|
|
|
2006-09-15 16:47:04 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function End"));
|
2006-09-14 16:47:24 +00:00
|
|
|
}
|
|
|
|
|
2006-10-25 20:48:23 +00:00
|
|
|
|
2006-09-14 16:47:24 +00:00
|
|
|
bool CSimpleFrame::SaveState() {
|
2006-09-15 16:47:04 +00:00
|
|
|
CBOINCBaseFrame::SaveState();
|
2006-09-14 16:47:24 +00:00
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
2009-03-09 18:02:37 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/Simple"));
|
2006-07-10 18:40:04 +00:00
|
|
|
|
2006-09-14 16:47:24 +00:00
|
|
|
wxASSERT(pConfig);
|
|
|
|
|
|
|
|
// 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;
|
2006-07-10 18:40:04 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Save Frame State
|
|
|
|
//
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2009-03-09 18:02:37 +00:00
|
|
|
pConfig->Write(wxT("XPos"), GetPosition().x);
|
|
|
|
pConfig->Write(wxT("YPos"), GetPosition().y);
|
|
|
|
|
|
|
|
return true;
|
2006-07-05 21:36:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
- client: include precompiled header in rr_sim.cpp so memory
leak detection will work.
- MGR: Have the BaseFrame call a function to determine if the
selection list should be saved instead of traversing
the application pointer. Each view just overrides the function
returning a true/false value. We don't have to worry about null
pointers and the like.
- MGR: BOINCGUIApp should never need to know how either the views
work or the document. Move the code that determines which
RPCs should be fired into each of the views. Have the document
look for it there.
- MGR: Reduce duplicate code for hiding and showing an application
- MGR: Move some Windows and Mac specific code into functions
and streamline the application startup and shutdown rountines.
- MGR: Move the event processing that was in BOINCGUIApp into the
BaseFrame.
- MGR: General cleanup.
- MGR: Doxygen comments.
- MGR: Cleanup some warnings.
client/
rr_sim.cpp
clientgui/
AdvancedFrame.cpp, .h
AsyncRPC.cpp, .h
BOINCBaseFrame.cpp, .h
BOINCBaseView.cpp, .h
BOINCClientManager.cpp
BOINCGUIApp.cpp, .h
BOINCTaskBar.cpp
MainDocument.cpp, .h
sg_BoincSimpleGUI.cpp, .h
ViewProjects.cpp, .h
ViewTransfers.cpp, .h
ViewWork.cpp, .h
WelcomePage.cpp
win_build/installerv2/
BOINC.ism
BOINCx64.ism
win_build/
sim.vcproj
svn path=/trunk/boinc/; revision=16357
2008-10-29 22:44:55 +00:00
|
|
|
int CSimpleFrame::_GetCurrentViewPage() {
|
|
|
|
if (isMessagesDlgOpen()) {
|
|
|
|
return VW_SGUI | VW_SMSG;
|
|
|
|
} else {
|
|
|
|
return VW_SGUI;
|
|
|
|
}
|
|
|
|
return 0; // Should never happen.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
void CSimpleFrame::OnChangeGUI(wxCommandEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnChangeGUI - Function Begin"));
|
2009-02-27 17:04:04 +00:00
|
|
|
|
|
|
|
wxGetApp().SetActiveGUI(BOINC_ADVANCEDGUI, true);
|
|
|
|
|
2009-10-14 17:11:57 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnChangeGUI - Function End"));
|
2009-02-27 17:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CSimpleFrame::OnHelpBOINC(wxCommandEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpBOINC - Function Begin"));
|
2006-12-12 01:08:16 +00:00
|
|
|
|
|
|
|
if (IsShown()) {
|
2009-01-15 18:57:44 +00:00
|
|
|
wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
|
2006-12-12 01:08:16 +00:00
|
|
|
|
|
|
|
wxString wxurl;
|
2007-08-16 18:53:42 +00:00
|
|
|
wxurl.Printf(
|
|
|
|
wxT("%s?target=simple&version=%s&controlid=%d"),
|
2009-01-15 18:57:44 +00:00
|
|
|
strURL.c_str(),
|
|
|
|
wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
|
2007-08-16 18:53:42 +00:00
|
|
|
event.GetId()
|
|
|
|
);
|
2009-02-27 17:04:04 +00:00
|
|
|
ExecuteBrowserLink(wxurl);
|
2006-12-12 01:08:16 +00:00
|
|
|
}
|
|
|
|
|
2009-02-27 17:04:04 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpBOINC - Function End"));
|
2006-12-12 01:08:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-27 17:04:04 +00:00
|
|
|
void CSimpleFrame::OnHelp(wxHelpEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function Begin"));
|
2006-12-16 07:57:26 +00:00
|
|
|
|
|
|
|
if (IsShown()) {
|
2009-01-15 18:57:44 +00:00
|
|
|
wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
|
2006-12-16 07:57:26 +00:00
|
|
|
|
2006-12-20 00:05:12 +00:00
|
|
|
wxString wxurl;
|
2007-08-16 18:53:42 +00:00
|
|
|
wxurl.Printf(
|
|
|
|
wxT("%s?target=simple&version=%s&controlid=%d"),
|
2009-01-15 18:57:44 +00:00
|
|
|
strURL.c_str(),
|
|
|
|
wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
|
2007-08-16 18:53:42 +00:00
|
|
|
event.GetId()
|
|
|
|
);
|
2009-02-27 17:04:04 +00:00
|
|
|
ExecuteBrowserLink(wxurl);
|
2006-12-16 07:57:26 +00:00
|
|
|
}
|
|
|
|
|
2009-02-27 17:04:04 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function End"));
|
2006-12-16 07:57:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimpleFrame::OnReloadSkin(CFrameEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnReloadSkin - Function Start"));
|
|
|
|
|
2006-12-12 01:08:16 +00:00
|
|
|
m_pBackgroundPanel->ReskinInterface();
|
2006-11-06 13:45:50 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnReloadSkin - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-29 13:06:28 +00:00
|
|
|
void CSimpleFrame::OnRefreshView(CFrameEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnRefreshView - Function Start"));
|
|
|
|
|
2008-10-10 03:36:42 +00:00
|
|
|
static bool bAlreadyRunning = false;
|
|
|
|
|
|
|
|
if (bAlreadyRunning) return;
|
|
|
|
bAlreadyRunning = true;
|
|
|
|
|
2008-07-29 13:06:28 +00:00
|
|
|
m_pBackgroundPanel->OnFrameRender();
|
|
|
|
|
|
|
|
if (dlgMsgsPtr) {
|
|
|
|
dlgMsgsPtr->OnRefresh();
|
|
|
|
}
|
|
|
|
|
2008-10-10 03:36:42 +00:00
|
|
|
bAlreadyRunning = false;
|
|
|
|
|
2008-07-29 13:06:28 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnRefreshView - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimpleFrame::OnProjectsAttachToProject() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
if (!pDoc->IsUserAuthorized())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (pDoc->IsConnected()) {
|
|
|
|
|
|
|
|
CWizardAttachProject* pWizard = new CWizardAttachProject(this);
|
|
|
|
|
|
|
|
wxString strName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
|
|
|
pWizard->Run( strName, strURL, false );
|
|
|
|
|
|
|
|
if (pWizard)
|
|
|
|
pWizard->Destroy();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ShowNotCurrentlyConnectedAlert();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
void CSimpleFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CWizardAttachProject* pAPWizard = NULL;
|
|
|
|
wxString strComputer = wxEmptyString;
|
|
|
|
wxString strName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
|
|
|
bool bCachedCredentials = false;
|
|
|
|
ACCT_MGR_INFO ami;
|
|
|
|
PROJECT_INIT_STATUS pis;
|
2007-08-07 20:10:36 +00:00
|
|
|
CC_STATUS status;
|
2006-07-05 21:36:56 +00:00
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2008-09-11 12:26:15 +00:00
|
|
|
pDoc->ForceCacheUpdate();
|
|
|
|
pDoc->GetCoreClientStatus(status, true);
|
2007-08-07 20:10:36 +00:00
|
|
|
|
2006-07-05 21:36:56 +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();
|
2009-10-14 17:11:57 +00:00
|
|
|
wxGetApp().StartBOINCDefaultScreensaverTest();
|
2006-07-05 21:36:56 +00:00
|
|
|
}
|
|
|
|
|
2009-05-15 08:21:04 +00:00
|
|
|
pAPWizard = new CWizardAttachProject(this);
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2008-01-16 22:10:34 +00:00
|
|
|
pDoc->rpc.get_project_init_status(pis);
|
2006-07-05 21:36:56 +00:00
|
|
|
pDoc->rpc.acct_mgr_info(ami);
|
|
|
|
if (ami.acct_mgr_url.size() && !ami.have_credentials) {
|
|
|
|
if (!IsShown()) {
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2009-05-15 08:21:04 +00:00
|
|
|
if (pAPWizard->SyncToAccountManager()) {
|
2006-07-05 21:36:56 +00:00
|
|
|
// If successful, hide the main window
|
|
|
|
Hide();
|
|
|
|
}
|
2008-09-30 09:36:07 +00:00
|
|
|
} else if ((pis.url.size() || (0 >= pDoc->GetSimpleProjectCount())) && !status.disallow_attach) {
|
2006-07-05 21:36:56 +00:00
|
|
|
if (!IsShown()) {
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
strName = wxString(pis.name.c_str(), wxConvUTF8);
|
|
|
|
strURL = wxString(pis.url.c_str(), wxConvUTF8);
|
|
|
|
bCachedCredentials = pis.url.length() && pis.has_account_key;
|
|
|
|
|
|
|
|
pAPWizard->Run(strName, strURL, bCachedCredentials);
|
|
|
|
}
|
|
|
|
|
2009-05-15 08:21:04 +00:00
|
|
|
if (pAPWizard){
|
2006-11-06 13:45:50 +00:00
|
|
|
pAPWizard->Destroy();
|
|
|
|
//update Project Component
|
|
|
|
m_pBackgroundPanel->UpdateProjectView();
|
2006-08-17 17:36:51 +00:00
|
|
|
}
|
2006-07-05 21:36:56 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function End"));
|
|
|
|
}
|
|
|
|
|
2006-10-25 20:48:23 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CSimplePanel, wxPanel)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CSimplePanel, wxPanel)
|
|
|
|
EVT_SIZE(CSimplePanel::OnSize)
|
|
|
|
EVT_ERASE_BACKGROUND(CSimplePanel::OnEraseBackground)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
CSimplePanel::CSimplePanel() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::CSimplePanel - Default Constructor Function Begin"));
|
2009-03-09 18:02:37 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::CSimplePanel - Default Constructor Function End"));
|
2006-11-06 13:45:50 +00:00
|
|
|
}
|
|
|
|
|
2009-11-26 10:45:29 +00:00
|
|
|
|
2006-11-06 14:37:49 +00:00
|
|
|
CSimplePanel::CSimplePanel(wxWindow* parent) :
|
2006-11-06 13:45:50 +00:00
|
|
|
wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER)
|
|
|
|
{
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::CSimplePanel - Overloaded Constructor Function Begin"));
|
|
|
|
|
|
|
|
wrkUnitNB = NULL;
|
|
|
|
clientState = NULL;
|
|
|
|
projComponent = NULL;
|
|
|
|
|
|
|
|
projectViewInitialized = false;
|
|
|
|
emptyViewInitialized = false;
|
|
|
|
notebookViewInitialized = false;
|
|
|
|
dlgOpen = false;
|
|
|
|
|
|
|
|
InitEmptyView();
|
|
|
|
|
2009-11-24 02:31:44 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
// Have the screen reader tell user to switch to advanced view.
|
|
|
|
oldSimpleGUIWorkCount = -1;
|
|
|
|
|
|
|
|
SetupMacAccessibilitySupport();
|
|
|
|
#endif
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::CSimplePanel - Overloaded Constructor Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSimplePanel::~CSimplePanel()
|
|
|
|
{
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::CSimplePanel - Destructor Function Begin"));
|
2008-07-29 13:06:28 +00:00
|
|
|
|
2009-11-24 02:31:44 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
RemoveMacAccessibilitySupport();
|
|
|
|
#endif
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::CSimplePanel - Destructor Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CSimplePanel::ReskinInterface() {
|
2006-11-06 14:37:49 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::ReskinInterface - Function Start"));
|
2006-10-25 21:51:37 +00:00
|
|
|
|
|
|
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
|
|
|
|
|
|
|
wxASSERT(pSkinSimple);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
|
|
|
|
2006-11-06 14:17:44 +00:00
|
|
|
Freeze();
|
|
|
|
//bg color
|
|
|
|
SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
2006-10-25 21:51:37 +00:00
|
|
|
|
|
|
|
if(notebookViewInitialized){
|
|
|
|
if (wrkUnitNB) wrkUnitNB->ReskinAppGUI();
|
|
|
|
} else {
|
|
|
|
if (clientState) clientState->ReskinInterface();
|
|
|
|
}
|
|
|
|
|
|
|
|
//reskin component
|
|
|
|
if (projComponent) projComponent->ReskinInterface();
|
|
|
|
|
2006-11-06 14:17:44 +00:00
|
|
|
Thaw();
|
2006-10-25 21:51:37 +00:00
|
|
|
Refresh();
|
|
|
|
|
2006-11-06 14:37:49 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::ReskinInterface - Function End"));
|
2006-10-25 14:09:47 +00:00
|
|
|
}
|
|
|
|
|
2006-10-25 20:48:23 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::OnProjectsAttachToProject() {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanel::OnProjectsAttachToProject - Function Begin"));
|
|
|
|
|
|
|
|
CSimpleFrame* pFrame = wxDynamicCast(GetParent(), CSimpleFrame);
|
|
|
|
wxASSERT(pFrame);
|
2006-07-18 21:08:36 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
pFrame->OnProjectsAttachToProject();
|
2006-07-18 21:08:36 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function End"));
|
2006-07-18 21:08:36 +00:00
|
|
|
}
|
|
|
|
|
2006-09-26 21:53:00 +00:00
|
|
|
|
2008-07-29 13:06:28 +00:00
|
|
|
// called from CSimpleFrame::OnRefreshView()
|
|
|
|
void CSimplePanel::OnFrameRender() {
|
2009-11-24 02:31:44 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2008-09-19 07:40:39 +00:00
|
|
|
wxASSERT(pDoc);
|
2009-11-24 02:31:44 +00:00
|
|
|
int workCount = pDoc->GetSimpleGUIWorkCount();
|
2008-09-19 07:40:39 +00:00
|
|
|
|
|
|
|
// OnFrameRender() may be called while SimpleGUI initialization is
|
|
|
|
// in progress due to completion of a periodic get_messages RPC,
|
|
|
|
// causing unintended recursion in CMainDocument::RequestRPC().
|
|
|
|
// Check for that situation here.
|
|
|
|
if (pDoc->WaitingForRPC()) return;
|
2007-01-25 19:08:56 +00:00
|
|
|
|
2007-01-26 06:45:55 +00:00
|
|
|
if (IsShown()) {
|
2006-09-26 21:53:00 +00:00
|
|
|
|
2007-01-26 06:45:55 +00:00
|
|
|
if (!projectViewInitialized) {
|
|
|
|
InitProjectView();
|
|
|
|
return;
|
|
|
|
} else if ( pDoc->IsConnected() ) {
|
|
|
|
UpdateProjectView();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now check to see if we show the empty state or results
|
2009-11-24 02:31:44 +00:00
|
|
|
if ( workCount > 0 ) {
|
2007-01-26 06:45:55 +00:00
|
|
|
// State changes can cause the BSG to crash if a dialogue is open.
|
|
|
|
// Defer state change until after the dialogue is closed
|
|
|
|
if ( (emptyViewInitialized || !notebookViewInitialized) && dlgOpen ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If empty was displayed, remove
|
|
|
|
if ( emptyViewInitialized ) {
|
|
|
|
DestroyEmptyView();
|
|
|
|
}
|
|
|
|
// If we hadn't previously shown the notebook, create it.
|
|
|
|
if ( !notebookViewInitialized ) {
|
|
|
|
InitNotebook();
|
|
|
|
}
|
|
|
|
wrkUnitNB->Update();
|
|
|
|
} else {
|
|
|
|
// State changes can cause the BSG to crash if a dialogue is open.
|
|
|
|
// Defer state change until after the dialogue is closed
|
|
|
|
if ( (!emptyViewInitialized || notebookViewInitialized) && dlgOpen ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( notebookViewInitialized ) {
|
|
|
|
DestroyNotebook();
|
|
|
|
}
|
|
|
|
if ( !emptyViewInitialized ) {
|
|
|
|
InitEmptyView();
|
|
|
|
}
|
|
|
|
UpdateEmptyView();
|
|
|
|
}
|
2009-11-24 02:31:44 +00:00
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
//Accessibility
|
|
|
|
// Hide all but top level view from accessibility support so that
|
|
|
|
// the screen reader will tell user to switch to advanced view.
|
|
|
|
if (oldSimpleGUIWorkCount != workCount) {
|
|
|
|
oldSimpleGUIWorkCount = workCount;
|
|
|
|
HIViewRef simple = (HIViewRef)GetHandle();
|
|
|
|
AccessibilityIgnoreAllChildren(simple, 1);
|
|
|
|
}
|
|
|
|
#endif
|
2007-01-25 19:08:56 +00:00
|
|
|
}
|
2006-08-23 21:22:41 +00:00
|
|
|
}
|
|
|
|
|
2006-10-25 20:48:23 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::UpdateEmptyView() {
|
2006-08-23 21:22:41 +00:00
|
|
|
clientState->DisplayState();
|
|
|
|
}
|
|
|
|
|
2006-10-25 20:48:23 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::DestroyEmptyView() {
|
2006-08-23 21:22:41 +00:00
|
|
|
delete clientState;
|
2006-10-25 22:18:16 +00:00
|
|
|
clientState = NULL;
|
2006-08-23 21:22:41 +00:00
|
|
|
emptyViewInitialized = false;
|
2006-07-05 21:36:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::InitEmptyView()
|
2006-07-05 21:36:56 +00:00
|
|
|
{
|
2006-10-23 06:48:48 +00:00
|
|
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
|
|
|
|
|
|
|
wxASSERT(pSkinSimple);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
//Set Background color
|
2006-10-30 03:41:32 +00:00
|
|
|
SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
2006-08-18 21:45:17 +00:00
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
// Flex Grid Sizer
|
|
|
|
mainSizer = new wxFlexGridSizer(3,2);
|
2006-08-18 21:45:17 +00:00
|
|
|
SetSizer(mainSizer);
|
|
|
|
|
2006-10-10 02:53:25 +00:00
|
|
|
clientState = new ClientStateIndicator(this,wxPoint(31,94));
|
2006-08-23 21:22:41 +00:00
|
|
|
clientState->DisplayState();
|
2006-08-18 21:45:17 +00:00
|
|
|
|
2006-08-23 21:22:41 +00:00
|
|
|
emptyViewInitialized = true;
|
2006-08-18 21:45:17 +00:00
|
|
|
}
|
2006-10-25 20:48:23 +00:00
|
|
|
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::UpdateProjectView()
|
2006-08-24 17:54:54 +00:00
|
|
|
{
|
|
|
|
//update Project Component
|
|
|
|
projComponent->UpdateInterface();
|
|
|
|
}
|
2006-10-25 20:48:23 +00:00
|
|
|
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::DestroyNotebook() {
|
2006-08-23 21:22:41 +00:00
|
|
|
mainSizer->Detach(wrkUnitNB);
|
|
|
|
delete wrkUnitNB;
|
2006-10-25 22:18:16 +00:00
|
|
|
wrkUnitNB = NULL;
|
2006-08-23 21:22:41 +00:00
|
|
|
notebookViewInitialized = false;
|
2006-08-18 21:45:17 +00:00
|
|
|
}
|
2006-10-25 20:48:23 +00:00
|
|
|
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::InitProjectView()
|
2006-08-18 21:45:17 +00:00
|
|
|
{
|
|
|
|
// Do not update screen at this point
|
2006-07-20 22:15:29 +00:00
|
|
|
/////////////// MY PROJECTS COMPONENT /////////////////////
|
2007-01-11 20:52:48 +00:00
|
|
|
projComponent = new CProjectsComponent(this,wxPoint(31,414));
|
2006-08-07 15:33:03 +00:00
|
|
|
///////////////////////////////////////////////////////////
|
2006-08-23 21:22:41 +00:00
|
|
|
projectViewInitialized = true;
|
2006-07-05 21:36:56 +00:00
|
|
|
}
|
2006-07-10 17:47:21 +00:00
|
|
|
|
2006-10-25 20:48:23 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::InitNotebook()
|
2006-08-17 17:36:51 +00:00
|
|
|
{
|
2006-08-23 21:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::InitNotebook - Function Start"));
|
2006-08-17 17:36:51 +00:00
|
|
|
// FlatNotebook
|
2007-01-26 06:45:55 +00:00
|
|
|
wrkUnitNB = new WorkunitNotebook(this, -1, wxDefaultPosition, wxSize(370,330), wxFNB_TABS_BORDER_SIMPLE | wxFNB_NO_X_BUTTON | wxFNB_NO_NAV_BUTTONS | wxFNB_FANCY_TABS | wxFNB_NODRAG );
|
2007-03-13 15:04:11 +00:00
|
|
|
SetSizer(mainSizer);
|
2006-10-10 02:53:25 +00:00
|
|
|
mainSizer->Add(31, 68,0);
|
|
|
|
mainSizer->Add(343, 68,0);
|
|
|
|
mainSizer->Add(31, 68,0);
|
|
|
|
mainSizer->Add(0, 0,1);
|
|
|
|
mainSizer->Add(wrkUnitNB);
|
|
|
|
mainSizer->Layout();
|
2006-08-23 21:22:41 +00:00
|
|
|
notebookViewInitialized = true;
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::InitNotebook - Function End"));
|
2006-08-17 17:36:51 +00:00
|
|
|
}
|
2006-10-25 20:48:23 +00:00
|
|
|
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
void CSimplePanel::OnEraseBackground(wxEraseEvent& event){
|
2006-10-23 06:48:48 +00:00
|
|
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
|
|
|
|
|
|
|
wxASSERT(pSkinSimple);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
|
|
|
|
2006-10-25 21:51:37 +00:00
|
|
|
wxDC *dc = event.GetDC();
|
|
|
|
dc->DrawBitmap(*pSkinSimple->GetBackgroundImage()->GetBitmap(), 0, 0);
|
2006-07-05 21:36:56 +00:00
|
|
|
}
|
|
|
|
|
2008-06-23 17:54:44 +00:00
|
|
|
|