Code::Blocks  SVN r11506
compilerpanel.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  *
5  * $Revision: 10548 $
6  * $Id: compilerpanel.cpp 10548 2015-10-25 11:37:05Z mortenmacfly $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/scriptedwizard/compilerpanel.cpp $
8  */
9 
10 #include "sdk.h"
11 #ifndef CB_PRECOMP
12 #include <wx/event.h>
13 //(*InternalHeadersPCH(CompilerPanel)
14 #include <wx/string.h>
15 #include <wx/intl.h>
16 //*)
17 #include "globals.h"
18 #endif
19 #include "compilerpanel.h"
20 
21 //(*IdInit(CompilerPanel)
37 //*)
38 
39 BEGIN_EVENT_TABLE(CompilerPanel,wxPanel)
40  //(*EventTable(CompilerPanel)
41  //*)
42 END_EVENT_TABLE()
43 
44 CompilerPanel::CompilerPanel(wxWindow* parent, wxWindow* parentDialog) :
45  m_parentDialog(parentDialog)
46 {
47  //(*Initialize(CompilerPanel)
48  wxFlexGridSizer* FlexGridSizer1;
49  wxFlexGridSizer* FlexGridSizer2;
50  wxBoxSizer* BoxSizer3;
51  wxBoxSizer* BoxSizer2;
52  wxStaticText* StaticText3;
53  wxStaticText* StaticText8;
54  wxStaticText* StaticText7;
55  wxStaticText* StaticText4;
56  wxBoxSizer* BoxSizer1;
57  wxStaticText* StaticText2;
58 
59  Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("wxID_ANY"));
60  BoxSizer1 = new wxBoxSizer(wxVERTICAL);
61  StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Please select the compiler to use and which configurations\nyou want enabled in your project."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
62  BoxSizer1->Add(StaticText1, 0, wxALL|wxEXPAND, 8);
63  StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Compiler:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
64  BoxSizer1->Add(StaticText2, 0, wxTOP|wxLEFT|wxRIGHT|wxEXPAND, 8);
65  cmbCompiler = new wxComboBox(this, ID_COMBOBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_SIMPLE|wxCB_READONLY, wxDefaultValidator, _T("ID_COMBOBOX1"));
66  BoxSizer1->Add(cmbCompiler, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 8);
67  BoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
68  chkConfDebug = new wxCheckBox(this, ID_CHECKBOX1, _("Create \"Debug\" configuration:"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
69  chkConfDebug->SetValue(true);
70  BoxSizer4->Add(chkConfDebug, 0, wxALIGN_CENTER_VERTICAL, 5);
71  txtDbgName = new wxTextCtrl(this, ID_TEXTCTRL3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL3"));
72  BoxSizer4->Add(txtDbgName, 1, wxLEFT|wxALIGN_CENTER_VERTICAL, 4);
73  BoxSizer1->Add(BoxSizer4, 0, wxALL|wxEXPAND, 8);
74  BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
75  BoxSizer2->Add(16,-1,0, wxALIGN_TOP, 5);
76  StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("\"Debug\" options"));
77  FlexGridSizer1 = new wxFlexGridSizer(0, 2, 5, 5);
78  FlexGridSizer1->AddGrowableCol(1);
79  StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Output dir.:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
80  FlexGridSizer1->Add(StaticText3, 1, wxALIGN_CENTER_VERTICAL, 5);
81  txtDbgOut = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
82  FlexGridSizer1->Add(txtDbgOut, 1, wxEXPAND, 5);
83  StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("Objects output dir.:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
84  FlexGridSizer1->Add(StaticText4, 1, wxALIGN_CENTER_VERTICAL, 5);
85  txtDbgObjOut = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
86  FlexGridSizer1->Add(txtDbgObjOut, 1, wxEXPAND, 5);
87  StaticBoxSizer1->Add(FlexGridSizer1, 1, wxEXPAND, 5);
88  BoxSizer2->Add(StaticBoxSizer1, 1, wxALIGN_TOP, 5);
89  BoxSizer1->Add(BoxSizer2, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 8);
90  BoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
91  chkConfRelease = new wxCheckBox(this, ID_CHECKBOX3, _("Create \"Release\" configuration:"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX3"));
92  chkConfRelease->SetValue(true);
93  BoxSizer5->Add(chkConfRelease, 0, wxALIGN_CENTER_VERTICAL, 5);
94  txtRelName = new wxTextCtrl(this, ID_TEXTCTRL4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL4"));
95  BoxSizer5->Add(txtRelName, 1, wxLEFT|wxALIGN_CENTER_VERTICAL, 4);
96  BoxSizer1->Add(BoxSizer5, 0, wxALL|wxEXPAND, 8);
97  BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
98  BoxSizer3->Add(16,-1,0, wxALIGN_TOP, 5);
99  StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("\"Release\" options"));
100  FlexGridSizer2 = new wxFlexGridSizer(0, 2, 5, 5);
101  FlexGridSizer2->AddGrowableCol(1);
102  StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("Output dir.:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7"));
103  FlexGridSizer2->Add(StaticText7, 1, wxALIGN_CENTER_VERTICAL, 5);
104  txtRelOut = new wxTextCtrl(this, ID_TEXTCTRL5, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL5"));
105  FlexGridSizer2->Add(txtRelOut, 1, wxEXPAND, 5);
106  StaticText8 = new wxStaticText(this, ID_STATICTEXT8, _("Objects output dir.:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT8"));
107  FlexGridSizer2->Add(StaticText8, 1, wxALIGN_CENTER_VERTICAL, 5);
108  txtRelObjOut = new wxTextCtrl(this, ID_TEXTCTRL6, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL6"));
109  FlexGridSizer2->Add(txtRelObjOut, 1, wxEXPAND, 5);
110  StaticBoxSizer2->Add(FlexGridSizer2, 1, wxEXPAND, 5);
111  BoxSizer3->Add(StaticBoxSizer2, 1, wxALIGN_CENTER_VERTICAL, 5);
112  BoxSizer1->Add(BoxSizer3, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 8);
113  SetSizer(BoxSizer1);
114  BoxSizer1->Fit(this);
115  BoxSizer1->SetSizeHints(this);
116 
117  Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&CompilerPanel::OnDebugChange);
118  Connect(ID_CHECKBOX3,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&CompilerPanel::OnReleaseChange);
119  //*)
120 }
121 
123 {
124 }
125 
126 
128 {
129  if (!event.IsChecked() && !chkConfRelease->IsChecked())
130  {
131  cbMessageBox(_("At least one configuration must be set..."), _("Notice"), wxICON_WARNING, m_parentDialog);
132  chkConfDebug->SetValue(true);
133  return;
134  }
135  txtDbgName->Enable(event.IsChecked());
136  txtDbgOut->Enable(event.IsChecked());
137  txtDbgObjOut->Enable(event.IsChecked());
138 }
139 
141 {
142  if (!event.IsChecked() && !chkConfDebug->IsChecked())
143  {
144  cbMessageBox(_("At least one configuration must be set..."), _("Notice"), wxICON_WARNING, m_parentDialog);
145  chkConfRelease->SetValue(true);
146  return;
147  }
148  txtRelName->Enable(event.IsChecked());
149  txtRelOut->Enable(event.IsChecked());
150  txtRelObjOut->Enable(event.IsChecked());
151 }
152 
154 {
155  chkConfRelease->Show(en);
156  txtRelName->Show(en);
157  txtRelOut->Show(en);
158  txtRelObjOut->Show(en);
159  StaticBoxSizer1->Show(en);
160  chkConfDebug->Show(en);
161  txtDbgName->Show(en);
162  txtDbgOut->Show(en);
163  txtDbgObjOut->Show(en);
164  StaticBoxSizer2->Show(en);
165 
166  StaticText1->SetLabel(en
167  ? _("Please select the compiler to use and which configurations\nyou want enabled in your project.")
168  : _("Please select the compiler to use."));
169 }
wxCheckBox * chkConfDebug
Definition: compilerpanel.h:87
wxSize Fit(wxWindow *window)
wxTextCtrl * txtDbgOut
Definition: compilerpanel.h:84
wxStaticText * StaticText1
Definition: compilerpanel.h:78
int wxNewId()
#define wxICON_WARNING
virtual ~CompilerPanel()
void OnDebugChange(wxCommandEvent &event)
const wxValidator wxDefaultValidator
static const long ID_CHECKBOX3
Definition: compilerpanel.h:58
static const long ID_TEXTCTRL4
Definition: compilerpanel.h:59
wxTextCtrl * txtRelObjOut
Definition: compilerpanel.h:82
static const long ID_STATICTEXT2
Definition: compilerpanel.h:50
wxTextCtrl * txtDbgName
Definition: compilerpanel.h:81
#define _T(string)
wxTextCtrl * txtRelOut
Definition: compilerpanel.h:83
#define wxCB_SIMPLE
void AddGrowableCol(size_t idx, int proportion=0)
static const long ID_STATICTEXT1
Definition: compilerpanel.h:49
const long ID_TEXTCTRL1
static const long ID_TEXTCTRL2
Definition: compilerpanel.h:57
wxStaticBoxSizer * StaticBoxSizer1
Definition: compilerpanel.h:86
wxCheckBox * chkConfRelease
Definition: compilerpanel.h:80
static const long ID_TEXTCTRL6
Definition: compilerpanel.h:63
#define wxTAB_TRAVERSAL
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
void OnReleaseChange(wxCommandEvent &event)
static const long ID_TEXTCTRL5
Definition: compilerpanel.h:61
wxWindow * m_parentDialog
Definition: compilerpanel.h:90
static const long ID_STATICTEXT8
Definition: compilerpanel.h:62
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
void EnableConfigurationTargets(bool en)
wxString wxEmptyString
static const long ID_CHECKBOX1
Definition: compilerpanel.h:52
#define wxCB_READONLY
static const long ID_STATICTEXT7
Definition: compilerpanel.h:60
static const long ID_STATICTEXT3
Definition: compilerpanel.h:54
const wxString & _(const wxString &string)
bool IsChecked() const
wxStaticBoxSizer * StaticBoxSizer2
Definition: compilerpanel.h:74
static const long ID_COMBOBOX1
Definition: compilerpanel.h:51
wxTextCtrl * txtDbgObjOut
Definition: compilerpanel.h:75
static const long ID_STATICTEXT4
Definition: compilerpanel.h:56
bool Show(wxWindow *window, bool show=true, bool recursive=false)
static const long ID_TEXTCTRL1
Definition: compilerpanel.h:55
wxTextCtrl * txtRelName
Definition: compilerpanel.h:77
void SetSizeHints(wxWindow *window)
static const long ID_TEXTCTRL3
Definition: compilerpanel.h:53
virtual void SetValue(bool state)
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
Definition: globals.cpp:1395