-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNewCodeBlocksProjectWizard.cpp
71 lines (63 loc) · 2.25 KB
/
NewCodeBlocksProjectWizard.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "NewCodeBlocksProjectWizard.h"
#include <globals.h>
#include <wx/tokenzr.h>
NewCodeBlocksProjectWizard::NewCodeBlocksProjectWizard(wxWindow* parent)
: NewCodeBlocksProjectWizardBase(parent)
{
}
NewCodeBlocksProjectWizard::~NewCodeBlocksProjectWizard()
{
}
void NewCodeBlocksProjectWizard::OnProjectFolderPathChanged(wxFileDirPickerEvent& event)
{
DoUpdateProjectPathPreview();
}
void NewCodeBlocksProjectWizard::OnProjectNameUpdated(wxCommandEvent& event)
{
DoUpdateProjectPathPreview();
}
void NewCodeBlocksProjectWizard::DoUpdateProjectPathPreview()
{
wxString path;
path << m_dirPickerProjectFolder->GetPath() << wxFILE_SEP_PATH << m_textCtrlProjectName->GetValue() << wxFILE_SEP_PATH << m_textCtrlProjectName->GetValue() << wxT(".cbp");
m_staticTextProjectPathPreview->SetLabel( path );
}
void NewCodeBlocksProjectWizard::OnPageChanging(wxWizardEvent& event)
{
if ( event.GetDirection() ) {
if ( event.GetPage() == m_pages.at(0) ) {
// Moving from page1 -> page2
if ( m_dirPickerProjectFolder->GetPath().IsEmpty() || m_textCtrlProjectName->IsEmpty() ) {
::cbMessageBox(_("Make sure you properly selected project name and location"), wxT("wxCrafter"), wxOK|wxICON_WARNING);
event.Veto();
return;
}
}
#ifdef __WXMSW__
else if ( event.GetPage() == m_pages.at(1) ) {
if ( m_dirPickerWxPath->GetPath().IsEmpty() || !wxFileName::DirExists( m_dirPickerWxPath->GetPath()) ) {
::cbMessageBox(_("Please select a valid wxWidgets installation folder"), wxT("wxCrafter"), wxOK|wxICON_WARNING);
event.Veto();
return;
}
}
#endif
}
}
ProjectInfo NewCodeBlocksProjectWizard::GetProjectDetails() const
{
ProjectInfo pi;
pi.cbp_path = m_staticTextProjectPathPreview->GetLabel();
pi.wx_components = ::wxStringTokenize(m_textCtrlComponents->GetValue(), wxT("\n"), wxTOKEN_STRTOK);
pi.wx_build_type = m_choiceBuildType->GetStringSelection();
pi.wx_prefix = m_dirPickerWxPath->GetPath();
return pi;
}
void NewCodeBlocksProjectWizard::OnEnableIfMSW(wxUpdateUIEvent& event)
{
#ifdef __WXMSW__
event.Enable( true );
#else
event.Enable( false );
#endif
}