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"
2011-06-15 21:00:02 +00:00
# include "res/windowsicon.xpm"
# include "res/macosicon.xpm"
# include "res/linuxicon.xpm"
2013-02-04 16:00:06 +00:00
# include "res/freebsdicon.xpm"
2011-06-15 21:00:02 +00:00
# include "res/atiicon.xpm"
# include "res/nvidiaicon.xpm"
2013-10-24 17:09:54 +00:00
# include "res/androidicon.xpm"
2013-11-18 17:30:01 +00:00
# include "res/virtualboxicon.xpm"
2011-06-16 00:40:59 +00:00
# include "res/blankicon.xpm"
2011-06-15 21:00:02 +00:00
/*!
* CProject type
*/
class CProjectInfo : public wxObject
{
DECLARE_DYNAMIC_CLASS ( CProjectInfo )
CProjectInfo ( ) {
m_bSupportedPlatformFound = false ;
m_bProjectSupportsWindows = false ;
m_bProjectSupportsMac = false ;
m_bProjectSupportsLinux = false ;
2013-02-04 16:00:06 +00:00
m_bProjectSupportsFreeBSD = false ;
2011-06-22 11:24:23 +00:00
m_bProjectSupportsCUDA = false ;
m_bProjectSupportsCAL = false ;
2013-10-24 17:09:54 +00:00
m_bProjectSupportsAndroid = false ;
2013-11-18 17:30:01 +00:00
m_bProjectSupportsVirtualBox = false ;
2011-06-15 21:00:02 +00:00
}
public :
wxString m_strURL ;
wxString m_strName ;
wxString m_strDescription ;
wxString m_strGeneralArea ;
wxString m_strSpecificArea ;
wxString m_strOrganization ;
bool m_bSupportedPlatformFound ;
bool m_bProjectSupportsWindows ;
bool m_bProjectSupportsMac ;
bool m_bProjectSupportsLinux ;
2013-02-04 16:00:06 +00:00
bool m_bProjectSupportsFreeBSD ;
2011-06-22 11:24:23 +00:00
bool m_bProjectSupportsCUDA ;
bool m_bProjectSupportsCAL ;
2013-10-24 17:09:54 +00:00
bool m_bProjectSupportsAndroid ;
2013-11-18 17:30:01 +00:00
bool m_bProjectSupportsVirtualBox ;
2011-06-15 21:00:02 +00:00
} ;
IMPLEMENT_DYNAMIC_CLASS ( CProjectInfo , wxObject )
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
2011-06-15 21:00:02 +00:00
EVT_COMBOBOX ( ID_CATEGORIES , CProjectInfoPage : : OnProjectCategorySelected )
EVT_LISTBOX ( ID_PROJECTS , CProjectInfoPage : : OnProjectSelected )
2015-01-12 20:08:36 +00:00
EVT_WIZARDEX_PAGE_CHANGED ( wxID_ANY , CProjectInfoPage : : OnPageChanged )
EVT_WIZARDEX_PAGE_CHANGING ( wxID_ANY , CProjectInfoPage : : OnPageChanging )
EVT_WIZARDEX_CANCEL ( wxID_ANY , CProjectInfoPage : : OnCancel )
2005-09-26 11:29:28 +00:00
////@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
2011-06-15 21:00:02 +00:00
/*!
* CProjectInfoPage destructor
*/
CProjectInfoPage : : ~ CProjectInfoPage ( )
{
for ( std : : vector < CProjectInfo * > : : iterator iter = m_Projects . begin ( ) ; iter ! = m_Projects . end ( ) ; + + iter )
{
CProjectInfo * pEntry = ( CProjectInfo * ) * iter ;
delete pEntry ;
}
m_Projects . clear ( ) ;
2014-09-11 07:35:41 +00:00
delete m_apl ;
2011-06-15 21:00:02 +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 ;
2011-06-15 21:00:02 +00:00
m_pProjectCategoriesStaticCtrl = NULL ;
m_pProjectCategoriesCtrl = NULL ;
m_pProjectsStaticCtrl = NULL ;
m_pProjectsCtrl = NULL ;
m_pProjectDetailsStaticCtrl = NULL ;
m_pProjectDetailsDescriptionCtrl = NULL ;
m_pProjectDetailsResearchAreaStaticCtrl = NULL ;
m_pProjectDetailsResearchAreaCtrl = NULL ;
m_pProjectDetailsOrganizationStaticCtrl = NULL ;
m_pProjectDetailsOrganizationCtrl = NULL ;
m_pProjectDetailsURLStaticCtrl = NULL ;
m_pProjectDetailsURLCtrl = NULL ;
m_pProjectDetailsSupportedPlatformsStaticCtrl = NULL ;
m_pProjectDetailsSupportedPlatformWindowsCtrl = NULL ;
m_pProjectDetailsSupportedPlatformMacCtrl = NULL ;
m_pProjectDetailsSupportedPlatformLinuxCtrl = NULL ;
2013-02-04 16:00:06 +00:00
m_pProjectDetailsSupportedPlatformFreeBSDCtrl = NULL ;
2011-06-15 21:00:02 +00:00
m_pProjectDetailsSupportedPlatformATICtrl = NULL ;
m_pProjectDetailsSupportedPlatformNvidiaCtrl = NULL ;
2013-10-24 17:09:54 +00:00
m_pProjectDetailsSupportedPlatformAndroidCtrl = NULL ;
2013-11-18 17:30:01 +00:00
m_pProjectDetailsSupportedPlatformVirtualBoxCtrl = NULL ;
2011-06-16 00:40:59 +00:00
m_pProjectDetailsSupportedPlatformBlankCtrl = NULL ;
2011-06-15 21:00:02 +00:00
m_pProjectURLStaticCtrl = NULL ;
m_pProjectURLCtrl = NULL ;
2005-09-26 11:29:28 +00:00
////@end CProjectInfoPage member initialisation
2011-06-15 21:00:02 +00:00
m_Projects . clear ( ) ;
2009-06-23 15:20:48 +00:00
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
2011-06-16 11:28:36 +00:00
# ifdef __WXMAC__
# define DESCRIPTIONSWIDTH 350
# else
2014-09-10 14:29:53 +00:00
# define DESCRIPTIONSWIDTH ADJUSTFORXDPI(310)
2011-06-16 11:28:36 +00:00
# endif
2014-09-10 13:31:05 +00:00
wxArrayString aCategories ;
CMainDocument * pDoc = wxGetApp ( ) . GetDocument ( ) ;
wxASSERT ( pDoc ) ;
wxASSERT ( wxDynamicCast ( pDoc , CMainDocument ) ) ;
2005-09-26 11:29:28 +00:00
CProjectInfoPage * itemWizardPage23 = this ;
wxBoxSizer * itemBoxSizer24 = new wxBoxSizer ( wxVERTICAL ) ;
itemWizardPage23 - > SetSizer ( itemBoxSizer24 ) ;
2006-01-27 00:34:53 +00:00
m_pTitleStaticCtrl = new wxStaticText ;
2015-01-12 20:08:36 +00:00
m_pTitleStaticCtrl - > Create ( itemWizardPage23 , wxID_STATIC , _ ( " Choose a project " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2006-01-27 00:34:53 +00:00
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 ;
2015-01-12 20:08:36 +00:00
m_pDescriptionStaticCtrl - > Create ( itemWizardPage23 , wxID_STATIC , _ ( " To choose a project, click its name or type its URL below. " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2006-01-27 00:34:53 +00:00
itemBoxSizer24 - > Add ( m_pDescriptionStaticCtrl , 0 , wxALIGN_LEFT | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2011-06-15 21:00:02 +00:00
itemBoxSizer24 - > Add ( 5 , 5 , 0 , wxALIGN_LEFT | wxALL , 5 ) ;
2012-10-28 10:40:48 +00:00
wxFlexGridSizer * itemFlexGridSizer4 = new wxFlexGridSizer ( 1 , 0 , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer4 - > AddGrowableRow ( 0 ) ;
itemFlexGridSizer4 - > AddGrowableCol ( 0 ) ;
itemBoxSizer24 - > Add ( itemFlexGridSizer4 , 0 , wxGROW | wxALL , 0 ) ;
2014-09-10 13:31:05 +00:00
wxFlexGridSizer * itemFlexGridSizer6 = new wxFlexGridSizer ( 2 , 0 , 0 ) ;
2014-04-30 22:37:06 +00:00
itemFlexGridSizer4 - > Add ( itemFlexGridSizer6 , 0 , wxGROW | wxALL , 0 ) ;
2007-03-06 00:35:04 +00:00
2011-06-15 21:00:02 +00:00
wxBoxSizer * itemBoxSizer7 = new wxBoxSizer ( wxVERTICAL ) ;
itemFlexGridSizer6 - > Add ( itemBoxSizer7 , 0 , wxALIGN_LEFT | wxALIGN_TOP , 0 ) ;
2007-03-06 00:35:04 +00:00
2015-01-12 20:08:36 +00:00
m_pProjectCategoriesStaticCtrl = new wxStaticText ( itemWizardPage23 , wxID_STATIC , _ ( " Categories: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-17 18:02:32 +00:00
itemBoxSizer7 - > Add ( m_pProjectCategoriesStaticCtrl , 0 , wxALIGN_LEFT | wxRIGHT | wxBOTTOM , 5 ) ;
2011-06-15 21:00:02 +00:00
2014-09-10 13:31:05 +00:00
// We must populate the combo box before our sizers can calculate its width.
// The combo box will be repopulated in CProjectInfoPage::OnPageChanged(),
// so we don't need to worry about duplicate entries here.
// Get the project list
2014-09-11 07:35:41 +00:00
m_apl = new ALL_PROJECTS_LIST ;
pDoc - > rpc . get_all_projects_list ( * m_apl ) ;
2015-10-06 05:22:01 +00:00
for ( unsigned int i = 0 ; i < m_apl - > projects . size ( ) ; i + + ) {
2014-09-11 07:35:41 +00:00
wxString strGeneralArea = wxGetTranslation ( wxString ( m_apl - > projects [ i ] - > general_area . c_str ( ) , wxConvUTF8 ) ) ;
2014-09-10 13:31:05 +00:00
aCategories . Add ( strGeneralArea ) ;
}
m_pProjectCategoriesCtrl = new wxComboBox ( itemWizardPage23 , ID_CATEGORIES , wxT ( " " ) , wxDefaultPosition , wxDefaultSize , aCategories , wxCB_READONLY
# ifndef __WXMAC__ // wxCB_SORT is not available in wxCocoa 3.0
2013-08-27 11:42:38 +00:00
| wxCB_SORT
# endif
2015-01-12 20:08:36 +00:00
) ;
2011-06-15 21:00:02 +00:00
itemBoxSizer7 - > Add ( m_pProjectCategoriesCtrl , 0 , wxGROW | wxLEFT | wxRIGHT , 5 ) ;
2015-01-12 20:08:36 +00:00
m_pProjectsStaticCtrl = new wxStaticText ( itemWizardPage23 , wxID_STATIC , _ ( " Projects: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-17 18:02:32 +00:00
itemBoxSizer7 - > Add ( m_pProjectsStaticCtrl , 0 , wxALIGN_LEFT | wxTOP | wxRIGHT | wxBOTTOM , 5 ) ;
2011-06-15 21:00:02 +00:00
2012-10-28 10:40:48 +00:00
wxFlexGridSizer * itemFlexGridSizer11 = new wxFlexGridSizer ( 1 , 0 , 0 ) ;
2007-03-06 00:35:04 +00:00
itemFlexGridSizer11 - > AddGrowableRow ( 0 ) ;
itemFlexGridSizer11 - > AddGrowableCol ( 0 ) ;
2011-06-16 00:40:59 +00:00
itemBoxSizer7 - > Add ( itemFlexGridSizer11 , 0 , wxGROW | wxALL , 0 ) ;
2011-06-15 21:00:02 +00:00
wxArrayString m_pProjectsCtrlStrings ;
2014-09-10 13:31:05 +00:00
m_pProjectsCtrl = new wxListBox ( itemWizardPage23 , ID_PROJECTS , wxDefaultPosition , wxSize ( - 1 , ADJUSTFORYDPI ( 175 ) ) , m_pProjectsCtrlStrings , wxLB_SINGLE | wxLB_SORT ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer11 - > Add ( m_pProjectsCtrl , 0 , wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT , 0 ) ;
2014-10-23 09:05:16 +00:00
m_pProjectDetailsStaticCtrl = new wxStaticBox ( itemWizardPage23 , wxID_ANY , _ ( " Project details " ) ) ;
2011-06-15 21:00:02 +00:00
wxStaticBoxSizer * itemStaticBoxSizer13 = new wxStaticBoxSizer ( m_pProjectDetailsStaticCtrl , wxVERTICAL ) ;
2011-06-16 00:40:59 +00:00
itemFlexGridSizer6 - > Add ( itemStaticBoxSizer13 , 0 , wxGROW | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2011-06-15 21:00:02 +00:00
2014-09-10 13:31:05 +00:00
m_pProjectDetailsDescriptionCtrl = new wxTextCtrl ( itemWizardPage23 , ID_PROJECTDESCRIPTION , wxT ( " " ) , wxDefaultPosition , wxSize ( DESCRIPTIONSWIDTH , ADJUSTFORYDPI ( 100 ) ) , wxTE_MULTILINE | wxTE_READONLY ) ;
2011-06-15 21:00:02 +00:00
itemStaticBoxSizer13 - > Add ( m_pProjectDetailsDescriptionCtrl , 0 , wxGROW | wxLEFT | wxTOP | wxBOTTOM , 5 ) ;
2012-10-28 10:40:48 +00:00
wxFlexGridSizer * itemFlexGridSizer16 = new wxFlexGridSizer ( 2 , 0 , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer16 - > AddGrowableCol ( 1 ) ;
itemStaticBoxSizer13 - > Add ( itemFlexGridSizer16 , 0 , wxGROW | wxALL , 0 ) ;
2015-01-12 20:08:36 +00:00
m_pProjectDetailsResearchAreaStaticCtrl = new wxStaticText ( itemWizardPage23 , wxID_STATIC , _ ( " Research area: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer16 - > Add ( m_pProjectDetailsResearchAreaStaticCtrl , 0 , wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM , 2 ) ;
m_pProjectDetailsResearchAreaCtrl = new wxStaticText ( itemWizardPage23 , wxID_STATIC , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-16 00:40:59 +00:00
itemFlexGridSizer16 - > Add ( m_pProjectDetailsResearchAreaCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT , 5 ) ;
2011-06-15 21:00:02 +00:00
2012-10-28 10:40:48 +00:00
wxFlexGridSizer * itemFlexGridSizer19 = new wxFlexGridSizer ( 2 , 0 , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer19 - > AddGrowableCol ( 1 ) ;
itemStaticBoxSizer13 - > Add ( itemFlexGridSizer19 , 0 , wxGROW | wxALL , 0 ) ;
2015-01-12 20:08:36 +00:00
m_pProjectDetailsOrganizationStaticCtrl = new wxStaticText ( itemWizardPage23 , wxID_STATIC , _ ( " Organization: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer19 - > Add ( m_pProjectDetailsOrganizationStaticCtrl , 0 , wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM , 2 ) ;
2007-03-06 00:35:04 +00:00
2011-06-15 21:00:02 +00:00
m_pProjectDetailsOrganizationCtrl = new wxStaticText ( itemWizardPage23 , wxID_STATIC , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-16 00:40:59 +00:00
itemFlexGridSizer19 - > Add ( m_pProjectDetailsOrganizationCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT , 5 ) ;
2007-03-06 00:35:04 +00:00
2012-10-28 10:40:48 +00:00
wxFlexGridSizer * itemFlexGridSizer20 = new wxFlexGridSizer ( 2 , 0 , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer20 - > AddGrowableCol ( 1 ) ;
itemStaticBoxSizer13 - > Add ( itemFlexGridSizer20 , 0 , wxGROW | wxALL , 0 ) ;
2005-09-26 11:29:28 +00:00
2015-01-12 20:08:36 +00:00
m_pProjectDetailsURLStaticCtrl = new wxStaticText ( itemWizardPage23 , wxID_STATIC , _ ( " Web site: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer20 - > Add ( m_pProjectDetailsURLStaticCtrl , 0 , wxALIGN_LEFT | wxRIGHT | wxBOTTOM , 2 ) ;
2005-09-26 11:29:28 +00:00
2016-03-08 20:04:28 +00:00
m_pProjectDetailsURLCtrl = new wxHyperlinkCtrl ( itemWizardPage23 , wxID_STATIC , wxT ( " BOINC " ) , wxT ( " https://boinc.berkeley.edu/ " ) , wxDefaultPosition , wxDefaultSize , wxNO_BORDER | wxHL_CONTEXTMENU | wxHL_ALIGN_LEFT ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer20 - > Add ( m_pProjectDetailsURLCtrl , 0 , wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
wxFlexGridSizer * itemFlexGridSizer24 = new wxFlexGridSizer ( 2 , 1 , 0 , 0 ) ;
itemFlexGridSizer24 - > AddGrowableRow ( 1 ) ;
itemFlexGridSizer24 - > AddGrowableCol ( 0 ) ;
itemStaticBoxSizer13 - > Add ( itemFlexGridSizer24 , 0 , wxGROW | wxALL , 0 ) ;
2015-01-12 20:08:36 +00:00
m_pProjectDetailsSupportedPlatformsStaticCtrl = new wxStaticText ( itemWizardPage23 , wxID_STATIC , _ ( " Supported systems: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer24 - > Add ( m_pProjectDetailsSupportedPlatformsStaticCtrl , 0 , wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM , 5 ) ;
wxBoxSizer * itemBoxSizer26 = new wxBoxSizer ( wxHORIZONTAL ) ;
itemFlexGridSizer24 - > Add ( itemBoxSizer26 , 0 , wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT , 0 ) ;
2011-06-16 00:40:59 +00:00
m_pProjectDetailsSupportedPlatformWindowsCtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " windowsicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
2011-06-15 21:00:02 +00:00
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformWindowsCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2011-06-16 00:40:59 +00:00
m_pProjectDetailsSupportedPlatformMacCtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " macosicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
2011-06-15 21:00:02 +00:00
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformMacCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2011-06-16 00:40:59 +00:00
m_pProjectDetailsSupportedPlatformLinuxCtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " linuxicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
2011-06-15 21:00:02 +00:00
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformLinuxCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2013-02-04 16:00:06 +00:00
m_pProjectDetailsSupportedPlatformFreeBSDCtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " freebsdicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformFreeBSDCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2011-06-16 00:40:59 +00:00
m_pProjectDetailsSupportedPlatformATICtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " atiicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
2011-06-15 21:00:02 +00:00
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformATICtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2011-06-16 00:40:59 +00:00
m_pProjectDetailsSupportedPlatformNvidiaCtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " nvidiaicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
2011-06-15 21:00:02 +00:00
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformNvidiaCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2013-10-24 17:09:54 +00:00
m_pProjectDetailsSupportedPlatformAndroidCtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " androidicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
2013-10-24 17:25:47 +00:00
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformAndroidCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2013-10-24 17:09:54 +00:00
2013-11-18 17:30:01 +00:00
m_pProjectDetailsSupportedPlatformVirtualBoxCtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " virtualboxicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformVirtualBoxCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2011-06-16 00:40:59 +00:00
m_pProjectDetailsSupportedPlatformBlankCtrl = new wxStaticBitmap ( itemWizardPage23 , wxID_STATIC , GetBitmapResource ( wxT ( " blankicon.xpm " ) ) , wxDefaultPosition , wxSize ( 16 , 16 ) , 0 ) ;
itemBoxSizer26 - > Add ( m_pProjectDetailsSupportedPlatformBlankCtrl , 0 , wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
2012-10-28 10:40:48 +00:00
wxFlexGridSizer * itemFlexGridSizer33 = new wxFlexGridSizer ( 2 , 0 , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer33 - > AddGrowableCol ( 1 ) ;
itemFlexGridSizer4 - > Add ( itemFlexGridSizer33 , 0 , wxGROW | wxALIGN_CENTER_VERTICAL | wxALL , 0 ) ;
2015-01-12 20:08:36 +00:00
m_pProjectURLStaticCtrl = new wxStaticText ( itemWizardPage23 , ID_PROJECTURLSTATICCTRL , _ ( " Project URL: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
2011-06-15 21:00:02 +00:00
itemFlexGridSizer33 - > Add ( m_pProjectURLStaticCtrl , 0 , wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
m_pProjectURLCtrl = new wxTextCtrl ( itemWizardPage23 , ID_PROJECTURLCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
2013-12-04 10:43:17 +00:00
itemFlexGridSizer33 - > Add ( m_pProjectURLCtrl , 0 , wxGROW | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2011-06-16 11:28:36 +00:00
2013-12-04 10:43:17 +00:00
itemFlexGridSizer33 - > Add ( 0 , 10 , 0 ) ;
2005-09-26 11:29:28 +00:00
// Set validators
2015-01-12 20:08:36 +00:00
m_pProjectURLCtrl - > SetValidator ( CValidateURL ( & m_strProjectURL ) ) ;
2009-11-19 11:58:35 +00:00
////@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
*/
2011-06-15 21:00:02 +00:00
wxBitmap CProjectInfoPage : : GetBitmapResource ( const wxString & name )
2005-09-26 11:29:28 +00:00
{
// Bitmap retrieval
////@begin CProjectInfoPage bitmap retrieval
2011-06-15 21:00:02 +00:00
wxUnusedVar ( name ) ;
if ( name = = wxT ( " windowsicon.xpm " ) )
{
wxBitmap bitmap ( Win32_xpm ) ;
return bitmap ;
}
else if ( name = = wxT ( " macosicon.xpm " ) )
{
wxBitmap bitmap ( MacOS_xpm ) ;
return bitmap ;
}
else if ( name = = wxT ( " linuxicon.xpm " ) )
{
wxBitmap bitmap ( Linux_xpm ) ;
return bitmap ;
}
2013-02-04 16:00:06 +00:00
else if ( name = = wxT ( " freebsdicon.xpm " ) )
{
wxBitmap bitmap ( FreeBSD_xpm ) ;
return bitmap ;
}
2011-06-15 21:00:02 +00:00
else if ( name = = wxT ( " atiicon.xpm " ) )
{
wxBitmap bitmap ( atiicon_xpm ) ;
return bitmap ;
}
else if ( name = = wxT ( " nvidiaicon.xpm " ) )
{
wxBitmap bitmap ( nvidiaicon_xpm ) ;
return bitmap ;
}
2013-10-24 17:09:54 +00:00
else if ( name = = wxT ( " androidicon.xpm " ) )
{
wxBitmap bitmap ( androidicon_xpm ) ;
return bitmap ;
}
2013-11-18 17:30:01 +00:00
else if ( name = = wxT ( " virtualboxicon.xpm " ) )
{
wxBitmap bitmap ( virtualboxicon_xpm ) ;
return bitmap ;
}
2011-06-16 00:40:59 +00:00
else if ( name = = wxT ( " blankicon.xpm " ) )
{
wxBitmap bitmap ( blankicon_xpm ) ;
return bitmap ;
}
2005-09-26 11:29:28 +00:00
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
2011-06-15 21:00:02 +00:00
/*
* wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_CATEGORIES
*/
void CProjectInfoPage : : OnProjectCategorySelected ( wxCommandEvent & WXUNUSED ( event ) ) {
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CProjectInfoPage::OnProjectCategorySelected - Function Begin " ) ) ;
m_pProjectsCtrl - > Clear ( ) ;
// Populate the list box with the list of project names that belong to eith the specific
// category or all of them.
for ( unsigned int i = 0 ; i < m_Projects . size ( ) ; i + + ) {
if ( ( m_pProjectCategoriesCtrl - > GetValue ( ) = = _ ( " All " ) ) | |
( m_pProjectCategoriesCtrl - > GetValue ( ) = = m_Projects [ i ] - > m_strGeneralArea )
) {
m_pProjectsCtrl - > Append ( m_Projects [ i ] - > m_strName , m_Projects [ i ] ) ;
}
}
// Set the first item to be the selected item and then pop the next event.
2013-02-06 12:33:54 +00:00
if ( m_pProjectsCtrl - > GetCount ( ) > 0 ) {
m_pProjectsCtrl - > SetSelection ( 0 ) ;
wxCommandEvent evtEvent ( wxEVT_COMMAND_LISTBOX_SELECTED , ID_PROJECTS ) ;
ProcessEvent ( evtEvent ) ;
}
2011-06-15 21:00:02 +00:00
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CProjectInfoPage::OnProjectCategorySelected - Function End " ) ) ;
}
/*
* wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_PROJECTS
*/
void CProjectInfoPage : : OnProjectSelected ( wxCommandEvent & WXUNUSED ( event ) ) {
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CProjectInfoPage::OnProjectSelected - Function Begin " ) ) ;
2012-05-30 19:44:14 +00:00
if ( m_pProjectsCtrl - > GetSelection ( ) ! = wxNOT_FOUND ) {
CProjectInfo * pProjectInfo = ( CProjectInfo * ) m_pProjectsCtrl - > GetClientData ( m_pProjectsCtrl - > GetSelection ( ) ) ;
wxString strURL = pProjectInfo - > m_strURL ;
EllipseStringIfNeeded ( strURL , m_pProjectDetailsURLCtrl ) ;
// Populate the project details area
wxString desc = pProjectInfo - > m_strDescription ;
// Change all occurrences of "<sup>n</sup>" to "^n"
desc . Replace ( wxT ( " <sup> " ) , wxT ( " ^ " ) , true ) ;
desc . Replace ( wxT ( " </sup> " ) , wxT ( " " ) , true ) ;
2013-10-23 11:36:33 +00:00
desc . Replace ( wxT ( " < " ) , wxT ( " < " ) , true ) ;
2012-05-30 19:44:14 +00:00
m_pProjectDetailsURLCtrl - > SetLabel ( strURL ) ;
m_pProjectDetailsURLCtrl - > SetURL ( pProjectInfo - > m_strURL ) ;
m_pProjectDetailsURLCtrl - > SetToolTip ( pProjectInfo - > m_strURL ) ;
2015-01-12 20:08:36 +00:00
m_pProjectDetailsDescriptionCtrl - > SetValue ( desc ) ;
2012-05-30 19:44:14 +00:00
m_pProjectDetailsSupportedPlatformWindowsCtrl - > Hide ( ) ;
m_pProjectDetailsSupportedPlatformMacCtrl - > Hide ( ) ;
m_pProjectDetailsSupportedPlatformLinuxCtrl - > Hide ( ) ;
2013-02-04 16:00:06 +00:00
m_pProjectDetailsSupportedPlatformFreeBSDCtrl - > Hide ( ) ;
2012-05-30 19:44:14 +00:00
m_pProjectDetailsSupportedPlatformATICtrl - > Hide ( ) ;
m_pProjectDetailsSupportedPlatformNvidiaCtrl - > Hide ( ) ;
2013-10-24 17:09:54 +00:00
m_pProjectDetailsSupportedPlatformAndroidCtrl - > Hide ( ) ;
2013-11-18 17:30:01 +00:00
m_pProjectDetailsSupportedPlatformVirtualBoxCtrl - > Hide ( ) ;
2012-05-30 19:44:14 +00:00
if ( pProjectInfo - > m_bProjectSupportsWindows ) m_pProjectDetailsSupportedPlatformWindowsCtrl - > Show ( ) ;
if ( pProjectInfo - > m_bProjectSupportsMac ) m_pProjectDetailsSupportedPlatformMacCtrl - > Show ( ) ;
if ( pProjectInfo - > m_bProjectSupportsLinux ) m_pProjectDetailsSupportedPlatformLinuxCtrl - > Show ( ) ;
2013-02-04 16:00:06 +00:00
if ( pProjectInfo - > m_bProjectSupportsFreeBSD ) m_pProjectDetailsSupportedPlatformFreeBSDCtrl - > Show ( ) ;
2012-05-30 19:44:14 +00:00
if ( pProjectInfo - > m_bProjectSupportsCAL ) m_pProjectDetailsSupportedPlatformATICtrl - > Show ( ) ;
if ( pProjectInfo - > m_bProjectSupportsCUDA ) m_pProjectDetailsSupportedPlatformNvidiaCtrl - > Show ( ) ;
2013-10-24 17:09:54 +00:00
if ( pProjectInfo - > m_bProjectSupportsAndroid ) m_pProjectDetailsSupportedPlatformAndroidCtrl - > Show ( ) ;
2013-11-18 17:30:01 +00:00
if ( pProjectInfo - > m_bProjectSupportsVirtualBox ) m_pProjectDetailsSupportedPlatformVirtualBoxCtrl - > Show ( ) ;
2012-05-30 19:44:14 +00:00
// Populate non-control data for use in other places of the wizard
2015-01-12 20:08:36 +00:00
m_strProjectURL = pProjectInfo - > m_strURL ;
m_bProjectSupported = pProjectInfo - > m_bSupportedPlatformFound ;
2012-05-30 19:44:14 +00:00
Layout ( ) ;
2015-01-12 20:08:36 +00:00
TransferDataToWindow ( ) ;
2012-05-30 19:44:14 +00:00
wxString strResearchArea = pProjectInfo - > m_strSpecificArea ;
EllipseStringIfNeeded ( strResearchArea , m_pProjectDetailsResearchAreaCtrl ) ;
wxString strOrganization = pProjectInfo - > m_strOrganization ;
EllipseStringIfNeeded ( strOrganization , m_pProjectDetailsOrganizationCtrl ) ;
2015-01-12 20:08:36 +00:00
m_pProjectDetailsResearchAreaCtrl - > SetLabel ( strResearchArea ) ;
m_pProjectDetailsResearchAreaCtrl - > SetToolTip ( pProjectInfo - > m_strSpecificArea ) ;
2012-05-30 19:44:14 +00:00
m_pProjectDetailsOrganizationCtrl - > SetLabel ( strOrganization ) ;
m_pProjectDetailsOrganizationCtrl - > SetToolTip ( pProjectInfo - > m_strOrganization ) ;
}
2011-06-16 11:28:36 +00:00
2011-06-15 21:00:02 +00:00
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CProjectInfoPage::OnProjectSelected - Function End " ) ) ;
}
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 " ) ) ;
CMainDocument * pDoc = wxGetApp ( ) . GetDocument ( ) ;
2011-06-15 21:00:02 +00:00
unsigned int i = 0 , j = 0 , k = 0 ;
wxArrayString aClientPlatforms ;
wxArrayString aProjectPlatforms ;
wxArrayString aCategories ;
bool bCategoryFound = false ;
CProjectInfo * pProjectInfo = NULL ;
2007-03-06 00:35:04 +00:00
2011-06-15 21:00:02 +00:00
// Populate the ProjectInfo data structure with the list of projects we want to show and
// any other activity we need to prep the page.
2009-01-29 22:20:14 +00:00
if ( ! m_bProjectListPopulated ) {
2015-01-12 20:08:36 +00:00
2011-06-15 21:00:02 +00:00
// Convert the supported client platforms into something useful
for ( i = 0 ; i < pDoc - > state . platforms . size ( ) ; i + + ) {
aClientPlatforms . Add ( wxString ( pDoc - > state . platforms [ i ] . c_str ( ) , wxConvUTF8 ) ) ;
}
// Iterate through the project list and add them to the ProjectInfo data structure
2014-09-11 07:35:41 +00:00
for ( i = 0 ; i < m_apl - > projects . size ( ) ; i + + ) {
2011-06-15 21:00:02 +00:00
pProjectInfo = new CProjectInfo ( ) ;
m_Projects . push_back ( pProjectInfo ) ;
2009-11-18 01:31:15 +00:00
2011-06-15 21:00:02 +00:00
// Convert the easy stuff
2014-09-11 07:35:41 +00:00
pProjectInfo - > m_strURL = wxGetTranslation ( wxString ( m_apl - > projects [ i ] - > url . c_str ( ) , wxConvUTF8 ) ) ;
pProjectInfo - > m_strName = wxGetTranslation ( wxString ( m_apl - > projects [ i ] - > name . c_str ( ) , wxConvUTF8 ) ) ;
pProjectInfo - > m_strDescription = wxGetTranslation ( wxString ( m_apl - > projects [ i ] - > description . c_str ( ) , wxConvUTF8 ) ) ;
pProjectInfo - > m_strGeneralArea = wxGetTranslation ( wxString ( m_apl - > projects [ i ] - > general_area . c_str ( ) , wxConvUTF8 ) ) ;
pProjectInfo - > m_strSpecificArea = wxGetTranslation ( wxString ( m_apl - > projects [ i ] - > specific_area . c_str ( ) , wxConvUTF8 ) ) ;
pProjectInfo - > m_strOrganization = wxGetTranslation ( wxString ( m_apl - > projects [ i ] - > home . c_str ( ) , wxConvUTF8 ) ) ;
2011-06-15 21:00:02 +00:00
// Add the category if it isn't already in the category list
bCategoryFound = false ;
for ( j = 0 ; j < aCategories . size ( ) ; j + + ) {
if ( aCategories [ j ] = = pProjectInfo - > m_strGeneralArea ) {
bCategoryFound = true ;
}
}
if ( ! bCategoryFound ) {
aCategories . Add ( pProjectInfo - > m_strGeneralArea ) ;
}
// Convert the supported project platforms into something useful
aProjectPlatforms . Clear ( ) ;
2014-09-11 07:35:41 +00:00
for ( j = 0 ; j < m_apl - > projects [ i ] - > platforms . size ( ) ; j + + ) {
aProjectPlatforms . Add ( wxString ( m_apl - > projects [ i ] - > platforms [ j ] . c_str ( ) , wxConvUTF8 ) ) ;
2011-06-15 21:00:02 +00:00
}
2009-01-29 22:20:14 +00:00
2011-06-15 21:00:02 +00:00
// Can the core client support a platform that this project supports?
2011-06-18 12:08:13 +00:00
//
2011-06-15 21:00:02 +00:00
for ( j = 0 ; j < aClientPlatforms . size ( ) ; j + + ) {
2011-07-12 00:07:34 +00:00
wxString strClientPlatform = aClientPlatforms [ j ] ;
2011-06-15 21:00:02 +00:00
for ( k = 0 ; k < aProjectPlatforms . size ( ) ; k + + ) {
wxString strProjectPlatform = aProjectPlatforms [ k ] ;
2009-11-18 01:31:15 +00:00
wxString strRootProjectPlatform = strProjectPlatform . SubString ( 0 , strProjectPlatform . Find ( _T ( " [ " ) ) - 1 ) ;
2011-06-15 21:00:02 +00:00
if ( strProjectPlatform . Find ( _T ( " windows " ) ) ! = wxNOT_FOUND ) {
pProjectInfo - > m_bProjectSupportsWindows = true ;
}
if ( strProjectPlatform . Find ( _T ( " apple " ) ) ! = wxNOT_FOUND ) {
pProjectInfo - > m_bProjectSupportsMac = true ;
}
2011-06-18 12:08:13 +00:00
2011-06-15 21:00:02 +00:00
if ( strProjectPlatform . Find ( _T ( " linux " ) ) ! = wxNOT_FOUND ) {
pProjectInfo - > m_bProjectSupportsLinux = true ;
}
2013-02-04 16:00:06 +00:00
if ( strProjectPlatform . Find ( _T ( " freebsd " ) ) ! = wxNOT_FOUND ) {
pProjectInfo - > m_bProjectSupportsFreeBSD = true ;
}
2011-06-18 12:08:13 +00:00
2013-10-24 17:09:54 +00:00
if ( strProjectPlatform . Find ( _T ( " android " ) ) ! = wxNOT_FOUND ) {
pProjectInfo - > m_bProjectSupportsAndroid = true ;
}
2011-06-17 16:49:19 +00:00
if ( strProjectPlatform . Find ( _T ( " [cuda " ) ) ! = wxNOT_FOUND ) {
2011-06-22 11:24:23 +00:00
pProjectInfo - > m_bProjectSupportsCUDA = true ;
2013-01-19 19:16:44 +00:00
if ( ! pDoc - > state . host_info . coprocs . have_nvidia ( ) ) continue ;
2009-11-18 01:31:15 +00:00
}
2011-06-17 16:49:19 +00:00
if ( strProjectPlatform . Find ( _T ( " [ati " ) ) ! = wxNOT_FOUND ) {
2011-06-22 11:24:23 +00:00
pProjectInfo - > m_bProjectSupportsCAL = true ;
2013-01-19 19:16:44 +00:00
if ( ! pDoc - > state . host_info . coprocs . have_ati ( ) ) continue ;
2009-11-18 01:31:15 +00:00
}
2013-11-18 17:30:01 +00:00
if ( strProjectPlatform . Find ( _T ( " [vbox " ) ) ! = wxNOT_FOUND ) {
pProjectInfo - > m_bProjectSupportsVirtualBox = true ;
}
2009-11-18 01:31:15 +00:00
if ( strClientPlatform = = strRootProjectPlatform ) {
2011-06-15 21:00:02 +00:00
pProjectInfo - > m_bSupportedPlatformFound = true ;
2009-01-29 23:42:32 +00:00
}
}
}
2009-01-29 22:20:14 +00:00
2011-07-12 00:07:34 +00:00
// If project doesn't export its platforms, assume we're supported
//
if ( aProjectPlatforms . size ( ) = = 0 ) {
pProjectInfo - > m_bSupportedPlatformFound = true ;
}
2007-06-07 16:10:38 +00:00
}
2009-06-30 02:05:46 +00:00
2011-06-15 21:00:02 +00:00
// Populate the category combo box
2012-10-28 10:40:48 +00:00
if ( ! m_pProjectCategoriesCtrl - > IsListEmpty ( ) ) {
m_pProjectCategoriesCtrl - > Clear ( ) ;
}
2011-06-15 21:00:02 +00:00
m_pProjectCategoriesCtrl - > Append ( _ ( " All " ) ) ;
for ( i = 0 ; i < aCategories . size ( ) ; i + + ) {
m_pProjectCategoriesCtrl - > Append ( aCategories [ i ] ) ;
2011-03-07 20:57:30 +00:00
}
2011-06-15 21:00:02 +00:00
m_pProjectCategoriesCtrl - > SetValue ( _ ( " All " ) ) ;
2009-11-18 01:31:15 +00:00
2011-06-15 21:00:02 +00:00
// Trigger initial event to populate the list control
wxCommandEvent evtEvent ( wxEVT_COMMAND_COMBOBOX_SELECTED , ID_CATEGORIES ) ;
ProcessEvent ( evtEvent ) ;
2009-06-30 02:05:46 +00:00
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
2011-06-15 21:00:02 +00:00
m_pProjectsCtrl - > 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 ;
2015-01-12 20:08:36 +00:00
CWizardAttach * pWA = ( ( CWizardAttach * ) GetParent ( ) ) ;
2009-11-30 19:58:54 +00:00
CMainDocument * pDoc = wxGetApp ( ) . GetDocument ( ) ;
2009-06-23 15:20:48 +00:00
CSkinAdvanced * pSkinAdvanced = wxGetApp ( ) . GetSkinManager ( ) - > GetAdvanced ( ) ;
wxString strTitle ;
int iAnswer ;
2015-01-12 20:08:36 +00:00
bool bAlreadyAttached = false ;
2009-06-23 15:20:48 +00:00
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:
2015-01-12 20:08:36 +00:00
if ( ! m_bProjectSupported ) {
2009-06-23 15:20:48 +00:00
iAnswer = wxGetApp ( ) . SafeMessageBox (
2010-10-06 20:13:34 +00:00
_ ( " This project may not have work for your type of computer. Do you want to add it anyway? " ) ,
2009-06-23 15:20:48 +00:00
strTitle ,
wxCENTER | wxYES_NO | wxICON_INFORMATION
) ;
// Project is not supported
if ( wxNO = = iAnswer ) {
event . Veto ( ) ;
}
2015-01-12 20:08:36 +00:00
}
2009-06-23 15:20:48 +00:00
2015-01-12 20:08:36 +00:00
// 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 ( ) ;
2009-06-23 15:20:48 +00:00
2015-01-12 20:08:36 +00:00
canonicalize_master_url ( project_url ) ;
canonicalize_master_url ( new_project_url ) ;
2009-06-23 15:20:48 +00:00
2015-01-12 20:08:36 +00:00
if ( project_url = = new_project_url ) {
bAlreadyAttached = true ;
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
2015-01-12 20:08:36 +00:00
if ( bAlreadyAttached ) {
wxGetApp ( ) . SafeMessageBox (
_ ( " You already added this project. Please choose a different project. " ) ,
strTitle ,
wxCENTER | wxOK | wxICON_INFORMATION
) ;
event . Veto ( ) ;
} else {
// Update authoritative data in CWizardAttach
pWA - > SetProjectURL ( m_strProjectURL ) ;
}
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_CANCEL event handler for ID_PROJECTINFOPAGE
*/
void CProjectInfoPage : : OnCancel ( wxWizardExEvent & event ) {
PROCESS_CANCELEVENT ( event ) ;
}
2011-06-16 11:28:36 +00:00
void CProjectInfoPage : : EllipseStringIfNeeded ( wxString & s , wxWindow * win ) {
int x , y ;
int w , h ;
wxSize sz = win - > GetParent ( ) - > GetSize ( ) ;
win - > GetPosition ( & x , & y ) ;
int maxWidth = sz . GetWidth ( ) - x - 10 ;
win - > GetTextExtent ( s , & w , & h ) ;
// Adapted from ellipis code in wxRendererGeneric::DrawHeaderButtonContents()
if ( w > maxWidth ) {
int ellipsisWidth ;
win - > GetTextExtent ( wxT ( " ... " ) , & ellipsisWidth , NULL ) ;
if ( ellipsisWidth > maxWidth ) {
s . Clear ( ) ;
w = 0 ;
} else {
do {
s . Truncate ( s . length ( ) - 1 ) ;
win - > GetTextExtent ( s , & w , & h ) ;
} while ( ( ( w + ellipsisWidth ) > maxWidth ) & & s . length ( ) ) ;
s . append ( wxT ( " ... " ) ) ;
w + = ellipsisWidth ;
}
}
}