2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-09-26 11:29:28 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2005-09-26 11:29:28 +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.
|
2005-09-26 11:29:28 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-09-26 11:29:28 +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/>.
|
2005-09-26 11:29:28 +00:00
|
|
|
//
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "ProjectInfoPage.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "diagnostics.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "mfile.h"
|
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
2009-11-05 18:11:20 +00:00
|
|
|
#include "url.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "error_numbers.h"
|
2009-11-05 18:11:20 +00:00
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
#include "wizardex.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "SkinManager.h"
|
|
|
|
#include "MainDocument.h"
|
2005-09-26 11:29:28 +00:00
|
|
|
#include "ValidateURL.h"
|
|
|
|
#include "BOINCBaseWizard.h"
|
2010-08-02 16:01:09 +00:00
|
|
|
#include "WizardAttach.h"
|
2005-09-26 11:29:28 +00:00
|
|
|
#include "ProjectInfoPage.h"
|
2007-03-17 19:37:56 +00:00
|
|
|
#include "ProjectListCtrl.h"
|
2005-09-26 11:29:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CProjectInfoPage type definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS( CProjectInfoPage, wxWizardPageEx )
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CProjectInfoPage event table definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( CProjectInfoPage, wxWizardPageEx )
|
|
|
|
|
|
|
|
////@begin CProjectInfoPage event table entries
|
|
|
|
EVT_WIZARDEX_PAGE_CHANGED( -1, CProjectInfoPage::OnPageChanged )
|
|
|
|
EVT_WIZARDEX_PAGE_CHANGING( -1, CProjectInfoPage::OnPageChanging )
|
2009-06-23 15:20:48 +00:00
|
|
|
EVT_PROJECTLIST_ITEM_CHANGE( CProjectInfoPage::OnProjectItemChange )
|
|
|
|
EVT_PROJECTLIST_ITEM_DISPLAY( CProjectInfoPage::OnProjectItemDisplay )
|
2005-09-26 11:29:28 +00:00
|
|
|
EVT_WIZARDEX_CANCEL( -1, CProjectInfoPage::OnCancel )
|
|
|
|
////@end CProjectInfoPage event table entries
|
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* CProjectInfoPage constructors
|
|
|
|
*/
|
|
|
|
|
|
|
|
CProjectInfoPage::CProjectInfoPage( )
|
|
|
|
{
|
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
CProjectInfoPage::CProjectInfoPage( CBOINCBaseWizard* parent )
|
|
|
|
{
|
|
|
|
Create( parent );
|
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
2009-06-19 07:51:22 +00:00
|
|
|
* CProjectInfoPage creator
|
2005-09-26 11:29:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
bool CProjectInfoPage::Create( CBOINCBaseWizard* parent )
|
|
|
|
{
|
|
|
|
////@begin CProjectInfoPage member initialisation
|
2006-01-27 00:34:53 +00:00
|
|
|
m_pTitleStaticCtrl = NULL;
|
|
|
|
m_pDescriptionStaticCtrl = NULL;
|
2007-03-17 19:37:56 +00:00
|
|
|
m_pProjectListCtrl = NULL;
|
2006-01-27 00:34:53 +00:00
|
|
|
m_pProjectUrlStaticCtrl = NULL;
|
|
|
|
m_pProjectUrlCtrl = NULL;
|
2005-09-26 11:29:28 +00:00
|
|
|
////@end CProjectInfoPage member initialisation
|
2009-06-23 15:20:48 +00:00
|
|
|
m_strProjectURL = wxEmptyString;
|
|
|
|
m_bProjectSupported = false;
|
2009-01-29 22:20:14 +00:00
|
|
|
m_bProjectListPopulated = false;
|
2005-09-26 11:29:28 +00:00
|
|
|
|
|
|
|
////@begin CProjectInfoPage creation
|
2009-11-17 19:19:50 +00:00
|
|
|
wxWizardPageEx::Create( parent, ID_PROJECTINFOPAGE );
|
2005-09-26 11:29:28 +00:00
|
|
|
|
|
|
|
CreateControls();
|
2009-06-23 15:20:48 +00:00
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
GetSizer()->Fit(this);
|
|
|
|
////@end CProjectInfoPage creation
|
|
|
|
return TRUE;
|
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* Control creation for WizardPage
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CProjectInfoPage::CreateControls()
|
|
|
|
{
|
|
|
|
////@begin CProjectInfoPage content construction
|
|
|
|
CProjectInfoPage* itemWizardPage23 = this;
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemWizardPage23->SetSizer(itemBoxSizer24);
|
|
|
|
|
2006-01-27 00:34:53 +00:00
|
|
|
m_pTitleStaticCtrl = new wxStaticText;
|
|
|
|
m_pTitleStaticCtrl->Create( itemWizardPage23, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
|
|
|
|
itemBoxSizer24->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2006-01-27 00:34:53 +00:00
|
|
|
m_pDescriptionStaticCtrl = new wxStaticText;
|
|
|
|
m_pDescriptionStaticCtrl->Create( itemWizardPage23, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemBoxSizer24->Add(m_pDescriptionStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2009-06-19 06:42:36 +00:00
|
|
|
wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(2, 1, 0, 0);
|
2007-03-17 19:37:56 +00:00
|
|
|
itemFlexGridSizer3->AddGrowableRow(0);
|
|
|
|
itemFlexGridSizer3->AddGrowableCol(0);
|
|
|
|
itemBoxSizer24->Add(itemFlexGridSizer3, 1, wxGROW|wxALL, 5);
|
2007-03-06 00:35:04 +00:00
|
|
|
|
2007-03-17 19:37:56 +00:00
|
|
|
m_pProjectListCtrl = new CProjectListCtrl;
|
2009-06-19 07:51:22 +00:00
|
|
|
m_pProjectListCtrl->Create( itemWizardPage23 );
|
2007-03-17 19:37:56 +00:00
|
|
|
itemFlexGridSizer3->Add(m_pProjectListCtrl, 0, wxGROW|wxRIGHT, 10);
|
2007-03-06 00:35:04 +00:00
|
|
|
|
|
|
|
wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(2, 1, 0, 0);
|
|
|
|
itemFlexGridSizer11->AddGrowableRow(0);
|
|
|
|
itemFlexGridSizer11->AddGrowableCol(0);
|
|
|
|
itemBoxSizer24->Add(itemFlexGridSizer11, 0, wxGROW|wxALL, 0);
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemFlexGridSizer11->Add(itemBoxSizer22, 0, wxGROW|wxALL, 0);
|
|
|
|
|
|
|
|
wxFlexGridSizer* itemFlexGridSizer14 = new wxFlexGridSizer(1, 2, 0, 0);
|
|
|
|
itemFlexGridSizer14->AddGrowableCol(1);
|
2009-06-19 06:42:36 +00:00
|
|
|
itemBoxSizer24->Add(itemFlexGridSizer14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxRIGHT, 10);
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2006-01-27 00:34:53 +00:00
|
|
|
m_pProjectUrlStaticCtrl = new wxStaticText;
|
|
|
|
m_pProjectUrlStaticCtrl->Create( itemWizardPage23, ID_PROJECTURLSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
2007-03-06 00:35:04 +00:00
|
|
|
itemFlexGridSizer14->Add(m_pProjectUrlStaticCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2006-01-27 00:34:53 +00:00
|
|
|
m_pProjectUrlCtrl = new wxTextCtrl;
|
|
|
|
m_pProjectUrlCtrl->Create( itemWizardPage23, ID_PROJECTURLCTRL, wxEmptyString, wxDefaultPosition, wxSize(200, -1), 0 );
|
2007-03-06 00:35:04 +00:00
|
|
|
itemFlexGridSizer14->Add(m_pProjectUrlCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2005-09-26 11:29:28 +00:00
|
|
|
|
|
|
|
// Set validators
|
2009-06-04 05:48:01 +00:00
|
|
|
m_pProjectUrlCtrl->SetValidator( CValidateURL( & m_strProjectURL ) );
|
2009-11-19 11:58:35 +00:00
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
//Accessibility
|
|
|
|
HIViewRef listView = (HIViewRef)m_pProjectListCtrl->GetHandle();
|
|
|
|
HIObjectRef theObject = (HIObjectRef)HIViewGetSuperview(listView);
|
|
|
|
HIObjectSetAccessibilityIgnored(theObject, true);
|
|
|
|
#endif
|
|
|
|
////@end CProjectInfoPage content construction
|
2005-09-26 11:29:28 +00:00
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* Gets the previous page.
|
|
|
|
*/
|
|
|
|
wxWizardPageEx* CProjectInfoPage::GetPrev() const
|
|
|
|
{
|
|
|
|
return PAGE_TRANSITION_BACK;
|
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* Gets the next page.
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxWizardPageEx* CProjectInfoPage::GetNext() const
|
|
|
|
{
|
|
|
|
if (CHECK_CLOSINGINPROGRESS()) {
|
|
|
|
// Cancel Event Detected
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
|
|
|
|
} else {
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_PROJECTPROPERTIESPAGE);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* Should we show tooltips?
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool CProjectInfoPage::ShowToolTips()
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* Get bitmap resources
|
|
|
|
*/
|
|
|
|
|
2006-07-21 08:23:26 +00:00
|
|
|
wxBitmap CProjectInfoPage::GetBitmapResource( const wxString& WXUNUSED(name) )
|
2005-09-26 11:29:28 +00:00
|
|
|
{
|
|
|
|
// Bitmap retrieval
|
|
|
|
////@begin CProjectInfoPage bitmap retrieval
|
|
|
|
return wxNullBitmap;
|
|
|
|
////@end CProjectInfoPage bitmap retrieval
|
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* Get icon resources
|
|
|
|
*/
|
|
|
|
|
2006-07-21 08:23:26 +00:00
|
|
|
wxIcon CProjectInfoPage::GetIconResource( const wxString& WXUNUSED(name) )
|
2005-09-26 11:29:28 +00:00
|
|
|
{
|
|
|
|
// Icon retrieval
|
|
|
|
////@begin CProjectInfoPage icon retrieval
|
|
|
|
return wxNullIcon;
|
|
|
|
////@end CProjectInfoPage icon retrieval
|
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_PROJECTINFOPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) {
|
2006-01-27 00:34:53 +00:00
|
|
|
if (event.GetDirection() == false) return;
|
2009-01-29 23:42:32 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanged - Function Begin"));
|
|
|
|
|
|
|
|
unsigned int i, j, k;
|
|
|
|
bool bSupportedPlatformFound = false;
|
2009-11-18 01:31:15 +00:00
|
|
|
bool bProjectSupportsNvidiaGPU = false;
|
|
|
|
bool bProjectSupportsATIGPU = false;
|
|
|
|
bool bProjectSupportsMulticore = false;
|
2009-01-29 23:42:32 +00:00
|
|
|
ALL_PROJECTS_LIST pl;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2007-03-06 00:35:04 +00:00
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2006-01-27 00:34:53 +00:00
|
|
|
wxASSERT(m_pTitleStaticCtrl);
|
|
|
|
wxASSERT(m_pDescriptionStaticCtrl);
|
2007-03-17 19:37:56 +00:00
|
|
|
wxASSERT(m_pProjectListCtrl);
|
2006-01-27 00:34:53 +00:00
|
|
|
wxASSERT(m_pProjectUrlStaticCtrl);
|
|
|
|
wxASSERT(m_pProjectUrlCtrl);
|
|
|
|
|
|
|
|
m_pTitleStaticCtrl->SetLabel(
|
2007-07-16 20:57:19 +00:00
|
|
|
_("Choose a project")
|
2006-01-27 00:34:53 +00:00
|
|
|
);
|
|
|
|
m_pDescriptionStaticCtrl->SetLabel(
|
2009-06-23 15:20:48 +00:00
|
|
|
_("To choose a project, click its name or type its URL below.")
|
2006-01-27 00:34:53 +00:00
|
|
|
);
|
|
|
|
m_pProjectUrlStaticCtrl->SetLabel(
|
|
|
|
_("Project &URL:")
|
|
|
|
);
|
2007-03-06 00:35:04 +00:00
|
|
|
|
|
|
|
|
2009-01-29 22:20:14 +00:00
|
|
|
// Populate the virtual list control with project information
|
2007-03-06 00:35:04 +00:00
|
|
|
//
|
2009-01-29 22:20:14 +00:00
|
|
|
if (!m_bProjectListPopulated) {
|
2009-01-29 23:59:33 +00:00
|
|
|
std::vector<std::string> &client_platforms = pDoc->state.platforms;
|
2009-01-29 23:42:32 +00:00
|
|
|
pDoc->rpc.get_all_projects_list(pl);
|
|
|
|
|
|
|
|
for (i=0; i<pl.projects.size(); i++) {
|
2009-01-29 22:20:14 +00:00
|
|
|
bSupportedPlatformFound = false;
|
2009-11-18 01:31:15 +00:00
|
|
|
bProjectSupportsNvidiaGPU = false;
|
|
|
|
bProjectSupportsATIGPU = false;
|
|
|
|
bProjectSupportsMulticore = false;
|
|
|
|
|
|
|
|
wxLogTrace(
|
|
|
|
wxT("Function Status"),
|
|
|
|
wxT("CProjectInfoPage::OnPageChanged - Name: '%s', URL: '%s'"),
|
|
|
|
wxString(pl.projects[i]->name.c_str(), wxConvUTF8).c_str(),
|
|
|
|
wxString(pl.projects[i]->url.c_str(), wxConvUTF8).c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
std::vector<std::string> &project_platforms = pl.projects[i]->platforms;
|
2009-01-29 22:20:14 +00:00
|
|
|
|
2009-01-29 23:42:32 +00:00
|
|
|
// Can the core client support a platform that this project
|
|
|
|
// supports?
|
|
|
|
for (j = 0;j < client_platforms.size(); j++) {
|
|
|
|
for (k = 0;k < project_platforms.size(); k++) {
|
2009-11-18 01:31:15 +00:00
|
|
|
wxString strClientPlatform = wxString(client_platforms[j].c_str(), wxConvUTF8);
|
|
|
|
wxString strProjectPlatform = wxString(project_platforms[k].c_str(), wxConvUTF8);
|
|
|
|
wxString strRootProjectPlatform = strProjectPlatform.SubString(0, strProjectPlatform.Find(_T("[")) - 1);
|
|
|
|
|
|
|
|
if (strProjectPlatform.Find(_T("[cuda")) != wxNOT_FOUND) {
|
|
|
|
if ((pDoc->state.have_cuda) && (strClientPlatform == strRootProjectPlatform)) {
|
2009-12-01 17:42:12 +00:00
|
|
|
bProjectSupportsNvidiaGPU = true;
|
2009-11-18 01:31:15 +00:00
|
|
|
bSupportedPlatformFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strProjectPlatform.Find(_T("[ati")) != wxNOT_FOUND) {
|
|
|
|
if ((pDoc->state.have_ati) && (strClientPlatform == strRootProjectPlatform)) {
|
2009-12-01 17:42:12 +00:00
|
|
|
bProjectSupportsATIGPU = true;
|
2009-11-18 01:31:15 +00:00
|
|
|
bSupportedPlatformFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strProjectPlatform.Find(_T("[mt")) != wxNOT_FOUND) {
|
2009-12-01 17:42:12 +00:00
|
|
|
if ((pDoc->host.p_ncpus >= 4) && (strClientPlatform == strRootProjectPlatform)) {
|
|
|
|
bProjectSupportsMulticore = true;
|
2009-11-18 01:31:15 +00:00
|
|
|
bSupportedPlatformFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strClientPlatform == strRootProjectPlatform) {
|
2009-01-29 23:42:32 +00:00
|
|
|
bSupportedPlatformFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-01-29 22:20:14 +00:00
|
|
|
|
2009-02-05 05:57:30 +00:00
|
|
|
wxLogTrace(
|
|
|
|
wxT("Function Status"),
|
2009-11-18 01:31:15 +00:00
|
|
|
wxT("CProjectInfoPage::OnPageChanged - Nvidia: '%d', ATI: '%d', Multicore: '%d', Platform: '%d'"),
|
|
|
|
bProjectSupportsNvidiaGPU,
|
|
|
|
bProjectSupportsATIGPU,
|
|
|
|
bProjectSupportsMulticore,
|
2009-02-05 05:57:30 +00:00
|
|
|
bSupportedPlatformFound
|
|
|
|
);
|
|
|
|
|
|
|
|
m_pProjectListCtrl->Append(
|
|
|
|
wxString(pl.projects[i]->url.c_str(), wxConvUTF8),
|
2009-06-30 02:05:46 +00:00
|
|
|
wxString(pl.projects[i]->name.c_str(), wxConvUTF8),
|
2009-11-18 01:31:15 +00:00
|
|
|
wxString(pl.projects[i]->image.c_str(), wxConvUTF8),
|
2009-06-30 02:05:46 +00:00
|
|
|
wxString(pl.projects[i]->description.c_str(), wxConvUTF8),
|
2009-11-18 01:31:15 +00:00
|
|
|
bProjectSupportsNvidiaGPU,
|
|
|
|
bProjectSupportsATIGPU,
|
|
|
|
bProjectSupportsMulticore,
|
2009-02-05 05:57:30 +00:00
|
|
|
bSupportedPlatformFound
|
|
|
|
);
|
2007-06-07 16:10:38 +00:00
|
|
|
}
|
2009-06-30 02:05:46 +00:00
|
|
|
|
|
|
|
// Pre select the first element
|
|
|
|
m_pProjectListCtrl->SetSelection(0);
|
|
|
|
m_strProjectURL = m_pProjectListCtrl->GetItem(0)->GetURL();
|
|
|
|
m_bProjectSupported = m_pProjectListCtrl->GetItem(0)->IsPlatformSupported();
|
2009-11-18 01:31:15 +00:00
|
|
|
|
2009-06-30 02:05:46 +00:00
|
|
|
TransferDataToWindow();
|
|
|
|
|
2009-01-29 22:20:14 +00:00
|
|
|
m_bProjectListPopulated = true;
|
2007-03-06 00:35:04 +00:00
|
|
|
}
|
2006-01-27 00:34:53 +00:00
|
|
|
|
2007-03-17 19:37:56 +00:00
|
|
|
Layout();
|
2009-06-19 07:51:22 +00:00
|
|
|
FitInside();
|
2007-03-17 19:37:56 +00:00
|
|
|
m_pProjectListCtrl->SetFocus();
|
2009-01-29 23:42:32 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanged - Function End"));
|
2005-09-26 11:29:28 +00:00
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_PAGE_CHANGING event handler for ID_PROJECTINFOPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CProjectInfoPage::OnPageChanging( wxWizardExEvent& event ) {
|
2009-11-30 19:58:54 +00:00
|
|
|
if (event.GetDirection() == false) return;
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanging - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2009-06-23 15:20:48 +00:00
|
|
|
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
|
|
|
wxString strTitle;
|
|
|
|
int iAnswer;
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(pSkinAdvanced);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
|
|
|
|
|
|
|
|
|
|
|
strTitle.Printf(
|
|
|
|
wxT("%s"),
|
|
|
|
pSkinAdvanced->GetApplicationName().c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// Check to see if the project is supported:
|
|
|
|
if ( !GetProjectSupported() ) {
|
|
|
|
|
|
|
|
iAnswer = wxGetApp().SafeMessageBox(
|
|
|
|
_("This project may not have work for your type of computer. Are you sure you wish to continue?"),
|
|
|
|
strTitle,
|
|
|
|
wxCENTER | wxYES_NO | wxICON_INFORMATION
|
|
|
|
);
|
|
|
|
|
|
|
|
// Project is not supported
|
|
|
|
if (wxNO == iAnswer) {
|
|
|
|
event.Veto();
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Check if we are already attached to that project:
|
|
|
|
for (int i = 0; i < pDoc->GetProjectCount(); ++i) {
|
|
|
|
PROJECT* project = pDoc->project(i);
|
|
|
|
if (project) {
|
|
|
|
std::string project_url = project->master_url;
|
|
|
|
std::string new_project_url = (const char*)m_strProjectURL.mb_str();
|
|
|
|
|
|
|
|
canonicalize_master_url(project_url);
|
|
|
|
canonicalize_master_url(new_project_url);
|
|
|
|
|
|
|
|
if (project_url == new_project_url) {
|
|
|
|
wxGetApp().SafeMessageBox(
|
|
|
|
_("You are already attached to this project. Please choose a different project."),
|
|
|
|
strTitle,
|
|
|
|
wxCENTER | wxICON_INFORMATION
|
|
|
|
);
|
|
|
|
|
|
|
|
// We are already attached to that project,
|
|
|
|
event.Veto();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-03-05 20:25:00 +00:00
|
|
|
}
|
2009-06-23 15:20:48 +00:00
|
|
|
}
|
2009-11-30 19:58:54 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanging - Function End"));
|
2005-09-26 11:29:28 +00:00
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2007-03-06 00:35:04 +00:00
|
|
|
/*!
|
2009-06-23 15:20:48 +00:00
|
|
|
* wxEVT_PROJECTLIST_ITEM_CHANGE event handler for ID_PROJECTSELECTIONCTRL
|
2007-03-06 00:35:04 +00:00
|
|
|
*/
|
|
|
|
|
2009-06-23 15:20:48 +00:00
|
|
|
void CProjectInfoPage::OnProjectItemChange( ProjectListCtrlEvent& event ) {
|
|
|
|
SetProjectURL( event.GetURL() );
|
|
|
|
SetProjectSupported( event.IsSupported() );
|
|
|
|
TransferDataToWindow();
|
|
|
|
}
|
2009-02-05 05:57:30 +00:00
|
|
|
|
|
|
|
|
2009-06-23 15:20:48 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_PROJECTLIST_ITEM_DISPLAY event handler for ID_PROJECTSELECTIONCTRL
|
|
|
|
*/
|
2009-02-05 05:57:30 +00:00
|
|
|
|
2009-06-23 15:20:48 +00:00
|
|
|
void CProjectInfoPage::OnProjectItemDisplay( ProjectListCtrlEvent& event ) {
|
2009-12-19 05:16:41 +00:00
|
|
|
wxLaunchDefaultBrowser( event.GetURL() );
|
2007-03-06 00:35:04 +00:00
|
|
|
}
|
2007-03-06 05:36:54 +00:00
|
|
|
|
|
|
|
|
2005-09-26 11:29:28 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_CANCEL event handler for ID_PROJECTINFOPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CProjectInfoPage::OnCancel( wxWizardExEvent& event ) {
|
|
|
|
PROCESS_CANCELEVENT(event);
|
|
|
|
}
|
|
|
|
|