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"
|
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 "WizardAccountManager.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)
|
2006-12-12 01:08:16 +00:00
|
|
|
EVT_MENU(wxID_EXIT, CSimpleFrame::OnExit)
|
2006-07-05 21:36:56 +00:00
|
|
|
EVT_FRAME_CONNECT(CSimpleFrame::OnConnect)
|
2006-12-12 01:08:16 +00:00
|
|
|
EVT_HELP(wxID_ANY, CSimpleFrame::OnHelp)
|
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"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-23 17:54:44 +00:00
|
|
|
CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32) :
|
2006-10-31 13:01:59 +00:00
|
|
|
CBOINCBaseFrame((wxFrame *)NULL, ID_SIMPLEFRAME, title, wxDefaultPosition,
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
wxSize(409, 561),
|
|
|
|
#else
|
|
|
|
wxSize(416, 570),
|
|
|
|
#endif
|
2006-10-10 02:53:25 +00:00
|
|
|
wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE)
|
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 13:45:50 +00:00
|
|
|
RestoreState();
|
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;
|
|
|
|
|
|
|
|
menuFile->Append(
|
|
|
|
ID_FILECLOSEWINDOW,
|
|
|
|
_("&Close Window\tCTRL+W"),
|
|
|
|
_("Close BOINC Manager Window.")
|
|
|
|
);
|
|
|
|
|
|
|
|
// Help menu
|
|
|
|
wxMenu *menuHelp = new wxMenu;
|
|
|
|
|
2008-06-05 02:07:44 +00:00
|
|
|
// %s is the project name
|
|
|
|
// i.e. 'BOINC', 'GridRepublic'
|
|
|
|
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
|
|
|
|
|
|
|
// wxMac maps Command key to wxACCEL_ALT for wxAcceleratorTable but CTRL for wxMenu.
|
2006-12-16 07:57:26 +00:00
|
|
|
m_Shortcuts[0].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER);
|
2006-12-12 04:10:07 +00:00
|
|
|
#else
|
|
|
|
m_Shortcuts[0].Set(wxACCEL_CTRL, (int)'W', ID_FILECLOSEWINDOW);
|
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
|
|
|
m_pAccelTable = new wxAcceleratorTable(1, m_Shortcuts);
|
|
|
|
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
|
|
|
|
|
|
|
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::RestoreState() {
|
2006-11-06 13:45:50 +00:00
|
|
|
CBOINCBaseFrame::RestoreState();
|
2006-09-14 16:47:24 +00:00
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
|
|
|
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;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Restore Frame State
|
|
|
|
//
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2006-09-29 16:00:48 +00:00
|
|
|
// Read the last coordinates of the BSG
|
2006-09-28 01:34:59 +00:00
|
|
|
int x = pConfig->Read(wxT("X_Position"), ((wxPoint) wxDefaultPosition).x);
|
|
|
|
int y = pConfig->Read(wxT("Y_Position"), ((wxPoint) wxDefaultPosition).y);
|
2006-09-29 16:00:48 +00:00
|
|
|
|
2006-10-30 04:07:41 +00:00
|
|
|
// Read the size of the BSG
|
|
|
|
int width, height;
|
|
|
|
GetSize(&width, &height);
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
|
|
|
|
// If the user has changed the arrangement of multiple
|
|
|
|
// displays, make sure the window title bar is still on-screen.
|
|
|
|
Rect titleRect = {y, x, y+22, x+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))
|
|
|
|
x = y = 30;
|
|
|
|
DisposeRgn(menuRgn);
|
|
|
|
DisposeRgn(displayRgn);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2006-09-29 16:00:48 +00:00
|
|
|
// If either co-ordinate is less then 0 then set it equal to 0 to ensure
|
|
|
|
// it displays on the screen.
|
|
|
|
if ( x < 0 ) x = 0;
|
|
|
|
if ( y < 0 ) y = 0;
|
|
|
|
|
|
|
|
// Read the size of the screen
|
2006-10-23 06:48:48 +00:00
|
|
|
int maxX = wxSystemSettings::GetMetric( wxSYS_SCREEN_X );
|
|
|
|
int maxY = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
|
2006-09-29 16:00:48 +00:00
|
|
|
|
|
|
|
// Max sure that it doesn't go off to the right or bottom
|
|
|
|
if ( x + width > maxX ) x=maxX-width;
|
|
|
|
if ( y + height > maxY ) y=maxY-height;
|
2006-10-30 04:07:41 +00:00
|
|
|
#endif
|
2006-09-29 16:00:48 +00:00
|
|
|
|
2006-09-28 01:34:59 +00:00
|
|
|
Move(x,y);
|
|
|
|
|
2006-09-14 16:47:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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);
|
2006-08-23 21:22:41 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
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
|
|
|
|
2006-09-28 01:34:59 +00:00
|
|
|
int x,y;
|
|
|
|
GetPosition(&x, &y);
|
|
|
|
pConfig->Write(wxT("X_Position"), x);
|
|
|
|
pConfig->Write(wxT("Y_Position"), y);
|
2006-09-14 16:47:24 +00:00
|
|
|
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.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-12 01:08:16 +00:00
|
|
|
void CSimpleFrame::OnHelp(wxHelpEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function Begin"));
|
|
|
|
|
|
|
|
if (IsShown()) {
|
2006-12-20 00:05:12 +00:00
|
|
|
std::string url;
|
2007-08-16 18:53:42 +00:00
|
|
|
url = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl().mb_str();
|
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"),
|
|
|
|
url.c_str(),
|
|
|
|
BOINC_VERSION_STRING,
|
|
|
|
event.GetId()
|
|
|
|
);
|
2006-12-12 01:08:16 +00:00
|
|
|
ExecuteBrowserLink(wxurl);
|
|
|
|
}
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-05 02:07:44 +00:00
|
|
|
void CSimpleFrame::OnHelpBOINC(wxCommandEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpBOINC - Function Begin"));
|
2006-12-16 07:57:26 +00:00
|
|
|
|
|
|
|
if (IsShown()) {
|
2006-12-20 00:05:12 +00:00
|
|
|
std::string url;
|
2007-08-16 18:53:42 +00:00
|
|
|
url = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl().mb_str();
|
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"),
|
|
|
|
url.c_str(),
|
|
|
|
BOINC_VERSION_STRING,
|
|
|
|
event.GetId()
|
|
|
|
);
|
2006-12-16 07:57:26 +00:00
|
|
|
ExecuteBrowserLink(wxurl);
|
|
|
|
}
|
|
|
|
|
2008-06-05 02:07:44 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpBOINC - 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()) {
|
|
|
|
|
2008-07-29 13:06:28 +00:00
|
|
|
// TODO: Should we stop updating while running the wizard?
|
|
|
|
// m_pBackgroundPanel->m_pFrameRenderTimer->Stop();
|
2006-11-06 13:45:50 +00:00
|
|
|
|
|
|
|
CWizardAttachProject* pWizard = new CWizardAttachProject(this);
|
|
|
|
|
|
|
|
wxString strName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
|
|
|
pWizard->Run( strName, strURL, false );
|
|
|
|
|
|
|
|
if (pWizard)
|
|
|
|
pWizard->Destroy();
|
|
|
|
|
2008-07-29 13:06:28 +00:00
|
|
|
// m_pBackgroundPanel->m_pFrameRenderTimer->Start();
|
2006-11-06 13:45:50 +00:00
|
|
|
} 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();
|
|
|
|
CWizardAccountManager* pAMWizard = NULL;
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2008-01-16 22:10:34 +00:00
|
|
|
pAMWizard = new CWizardAccountManager(this);
|
|
|
|
if (pAMWizard->Run()) {
|
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();
|
|
|
|
}
|
|
|
|
|
2008-01-16 22:10:34 +00:00
|
|
|
pAPWizard = new CWizardAttachProject(this);
|
2006-07-05 21:36:56 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pAMWizard)
|
|
|
|
pAMWizard->Destroy();
|
2006-08-17 17:36:51 +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"));
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CSimplePanels::CSimplePanel - Default Constructor Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
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
|
|
|
|
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() {
|
2007-01-25 19:08:56 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2008-09-19 07:40:39 +00:00
|
|
|
wxASSERT(pDoc);
|
|
|
|
|
|
|
|
// 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
|
|
|
|
if ( pDoc->GetSimpleGUIWorkCount() > 0 ) {
|
|
|
|
// 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();
|
|
|
|
}
|
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
|
|
|
|