Code::Blocks  SVN r11506
projectoptionsdlg.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 11222 $
6  * $Id: projectoptionsdlg.cpp 11222 2017-10-31 07:56:18Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/src/projectoptionsdlg.cpp $
8  */
9 
10 #include "sdk.h"
11 
12 #ifndef CB_PRECOMP
13  #include "manager.h"
14  #include "logmanager.h"
15  #include "macrosmanager.h"
16  #include "pluginmanager.h"
17  #include "projectmanager.h"
18  #include "scriptingmanager.h"
19  #include "compilerfactory.h"
20  #include "globals.h"
21  #include "cbproject.h"
22  #include "cbplugin.h"
23  #include "sdk_events.h"
24 
25  #include <wx/button.h>
26  #include <wx/checkbox.h>
27  #include <wx/checklst.h>
28  #include <wx/combobox.h>
29  #include <wx/filedlg.h>
30  #include <wx/filefn.h> // wxMatchWild
31  #include <wx/notebook.h>
32  #include <wx/sizer.h>
33  #include <wx/spinctrl.h>
34  #include <wx/stattext.h>
35  #include <wx/treectrl.h>
36  #include <wx/xrc/xmlres.h>
37 #endif
38 
39 #include <wx/radiobox.h>
40 
41 #include "scripting/sqplus/sqplus.h"
42 
43 #include "annoyingdialog.h"
44 #include "configurationpanel.h"
45 #include "editarrayorderdlg.h"
46 #include "editarrayfiledlg.h"
47 #include "editpathdlg.h"
48 #include "externaldepsdlg.h"
49 #include "filefilters.h"
50 #include "multiselectdlg.h"
51 #include "projectdepsdlg.h"
52 #include "projectloader.h"
53 #include "projectoptionsdlg.h" // class's header file
54 #include "virtualbuildtargetsdlg.h"
55 
56 
57 BEGIN_EVENT_TABLE(ProjectOptionsDlg, wxScrollingDialog)
58  EVT_UPDATE_UI( -1, ProjectOptionsDlg::OnUpdateUI)
59  EVT_BUTTON( XRCID("wxID_OK"), ProjectOptionsDlg::OnOK)
60  EVT_BUTTON( XRCID("btnPlatform"), ProjectOptionsDlg::OnPlatform)
61  EVT_BUTTON( XRCID("btnPlatformProj"), ProjectOptionsDlg::OnPlatform)
62  EVT_BUTTON( XRCID("btnProjectBuildOptions"), ProjectOptionsDlg::OnProjectBuildOptionsClick)
63  EVT_BUTTON( XRCID("btnProjectDeps"), ProjectOptionsDlg::OnProjectDepsClick)
64  EVT_BUTTON( XRCID("btnTargetBuildOptions"), ProjectOptionsDlg::OnTargetBuildOptionsClick)
65  EVT_LISTBOX_DCLICK(XRCID("lstBuildTarget"), ProjectOptionsDlg::OnTargetBuildOptionsClick)
66  EVT_BUTTON( XRCID("btnBuildOrder"), ProjectOptionsDlg::OnBuildOrderClick)
67  EVT_BUTTON( XRCID("btnAddBuildTarget"), ProjectOptionsDlg::OnAddBuildTargetClick)
68  EVT_BUTTON( XRCID("btnEditBuildTarget"), ProjectOptionsDlg::OnEditBuildTargetClick)
69  EVT_BUTTON( XRCID("btnCopyBuildTarget"), ProjectOptionsDlg::OnCopyBuildTargetClick)
70  EVT_BUTTON( XRCID("btnDelBuildTarget"), ProjectOptionsDlg::OnRemoveBuildTargetClick)
71  EVT_BUTTON( XRCID("btnBrowseOutputFilename"), ProjectOptionsDlg::OnBrowseOutputFilenameClick)
72  EVT_BUTTON( XRCID("btnBrowseImportLibraryFilename"), ProjectOptionsDlg::OnBrowseImportLibraryFilenameClick)
73  EVT_BUTTON( XRCID("btnBrowseDefinitionFileFilename"), ProjectOptionsDlg::OnBrowseDefinitionFileFilenameClick)
74  EVT_BUTTON( XRCID("btnBrowseWorkingDir"), ProjectOptionsDlg::OnBrowseDirClick)
75  EVT_BUTTON( XRCID("btnBrowseObjectDir"), ProjectOptionsDlg::OnBrowseDirClick)
76  EVT_BUTTON( XRCID("btnExecutionDir"), ProjectOptionsDlg::OnBrowseDirClick)
77  EVT_BUTTON( XRCID("btnVirtualBuildTargets"), ProjectOptionsDlg::OnVirtualTargets)
78  EVT_BUTTON( XRCID("btnExternalDeps"), ProjectOptionsDlg::OnEditDepsClick)
79  EVT_BUTTON( XRCID("btnExportTarget"), ProjectOptionsDlg::OnExportTargetClick)
80  EVT_LISTBOX_DCLICK(XRCID("lstFiles"), ProjectOptionsDlg::OnFileOptionsClick)
81  EVT_BUTTON( XRCID("btnFileOptions"), ProjectOptionsDlg::OnFileOptionsClick)
82  EVT_BUTTON( XRCID("btnToggleCheckmarks"), ProjectOptionsDlg::OnFileToggleMarkClick)
83  EVT_BUTTON( XRCID("btnCheckmarksOn"), ProjectOptionsDlg::OnFileMarkOnClick)
84  EVT_BUTTON( XRCID("btnCheckmarksOff"), ProjectOptionsDlg::OnFileMarkOffClick)
85  EVT_LISTBOX( XRCID("lstBuildTarget"), ProjectOptionsDlg::OnBuildTargetChanged)
86  EVT_COMBOBOX( XRCID("cmbProjectType"), ProjectOptionsDlg::OnProjectTypeChanged)
87  EVT_CHECKBOX( XRCID("chkCreateStaticLib"), ProjectOptionsDlg::OnCreateImportFileClick)
88  EVT_CHECKBOX( XRCID("chkCreateDefFile"), ProjectOptionsDlg::OnCreateDefFileClick)
89 
90  EVT_TREE_SEL_CHANGED(XRCID("tcOverview"), ProjectOptionsDlg::OnScriptsOverviewSelChanged)
91  EVT_BUTTON(XRCID("btnCheckScripts"), ProjectOptionsDlg::OnCheckScripts)
92  EVT_BUTTON(XRCID("btnAddPreScripts"), ProjectOptionsDlg::OnAddScript)
93  EVT_BUTTON(XRCID("btnRemovePreScripts"), ProjectOptionsDlg::OnRemoveScript)
94  EVT_SPIN_UP(XRCID("spnPreScripts"), ProjectOptionsDlg::OnScriptMoveUp)
95  EVT_SPIN_DOWN(XRCID("spnPreScripts"), ProjectOptionsDlg::OnScriptMoveDown)
96 END_EVENT_TABLE()
97 
98 // class constructor
100  : m_Project(project),
101  m_Current_Sel(-1),
102  m_pCompiler(nullptr)
103 {
104  wxXmlResource::Get()->LoadObject(this, parent, _T("dlgProjectOptions"),_T("wxScrollingDialog"));
105  XRCCTRL(*this, "wxID_OK", wxButton)->SetDefault();
106 
107  wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
108 
109  for (int i=0; i< m_Project->GetFilesCount(); ++i)
110  list->Append(m_Project->GetFile(i)->relativeFilename);
111 
112  // this fixes the minsize of the file list
113  // which becomes huge when we add items in it (!)
114  list->SetMinSize(wxSize(50,50));
115 
116  // general
117  XRCCTRL(*this, "txtProjectName", wxTextCtrl)->SetValue(m_Project->GetTitle());
118  XRCCTRL(*this, "txtProjectFilename", wxStaticText)->SetLabel(m_Project->GetFilename());
119  XRCCTRL(*this, "txtPlatformProj", wxTextCtrl)->SetValue(GetStringFromPlatforms(m_Project->GetPlatforms()));
120  XRCCTRL(*this, "txtProjectMakefile", wxTextCtrl)->SetValue(m_Project->GetMakefile());
121  XRCCTRL(*this, "chkCustomMakefile", wxCheckBox)->SetValue(m_Project->IsMakefileCustom());
122  XRCCTRL(*this, "txtExecutionDir", wxTextCtrl)->SetValue(m_Project->GetMakefileExecutionDir());
123  XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->SetSelection((int)m_Project->GetModeForPCH());
124 
125  Compiler* compiler = CompilerFactory::GetCompiler(project->GetCompilerID());
126  bool hasPCH = compiler && compiler->GetSwitches().supportsPCH;
127  XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->Enable(hasPCH);
128 
129  XRCCTRL(*this, "chkExtendedObjNames", wxCheckBox)->SetValue(m_Project->GetExtendedObjectNamesGeneration());
130 
131  XRCCTRL(*this, "chkShowNotes", wxCheckBox)->SetValue(m_Project->GetShowNotesOnLoad());
132  XRCCTRL(*this, "txtNotes", wxTextCtrl)->SetValue(m_Project->GetNotes());
133 
134  XRCCTRL(*this, "chkCheckFiles", wxCheckBox)->SetValue(m_Project->GetCheckForExternallyModifiedFiles());
135 
136  FillBuildTargets();
137  DoTargetChange(false);
138 
139  m_pCompiler = Manager::Get()->GetPluginManager()->GetFirstCompiler();
140 
141  XRCCTRL(*this, "txtNotes", wxTextCtrl)->Connect(wxEVT_KEY_DOWN,wxKeyEventHandler(ProjectOptionsDlg::OnKeyDown),nullptr,this);
142 
143  // scripts
144  BuildScriptsTree();
145 
146  // make sure everything is laid out properly
147  // before adding panels from plugins
148  // we don't want the dialog to become huge ;)
149  // note that a similar situation in editor settings had been solved by commenting
150  // the following line out...
151  GetSizer()->SetSizeHints(this);
152 
153  // other plugins configuration
154  AddPluginPanels();
155 
156  CentreOnParent();
157 }
158 
159 // class destructor
161 {
162  // insert your code here
163  XRCCTRL(*this, "txtNotes", wxTextCtrl)->Disconnect(wxEVT_KEY_DOWN,wxKeyEventHandler(ProjectOptionsDlg::OnKeyDown),nullptr,this);
164 }
165 
167 {
168  if (event.ControlDown())
169  {
170  if (event.GetKeyCode() == 'J')
171  {
172  wxString buffer = XRCCTRL(*this, "txtNotes", wxTextCtrl)->GetValue();
173  Manager::Get()->GetMacrosManager()->ReplaceMacros(buffer,nullptr);
174  XRCCTRL(*this, "txtNotes", wxTextCtrl)->SetValue(buffer);
175  }
176  }
177  event.Skip();
178 }
179 
181 {
182  wxTreeCtrl* tc = XRCCTRL(*this, "tcOverview", wxTreeCtrl);
183  tc->DeleteAllItems();
184 
185  wxTreeItemId root = tc->AddRoot(m_Project->GetTitle());
186  for (int x = 0; x < m_Project->GetBuildTargetsCount(); ++x)
187  {
189  tc->AppendItem(root, target->GetTitle());
190  }
191  tc->Expand(root);
192  tc->SelectItem(root);
193  FillScripts();
194 }
195 
197 {
198  wxNotebook* nb = XRCCTRL(*this, "nbMain", wxNotebook);
199 
201 
202  for (size_t i = 0; i < m_PluginPanels.GetCount(); ++i)
203  {
205  panel->SetParentDialog(this);
206  nb->AddPage(panel, panel->GetTitle());
207  }
208 }
209 
211 {
212  wxTreeCtrl* tc = XRCCTRL(*this, "tcOverview", wxTreeCtrl);
213  wxTreeItemId sel = tc->GetSelection();
214  CompileOptionsBase* base = sel == tc->GetRootItem()
215  ? static_cast<CompileOptionsBase*>(m_Project)
216  : static_cast<CompileOptionsBase*>(m_Project->GetBuildTarget(tc->GetItemText(sel)));
217 
218  wxListBox* lstScripts = XRCCTRL(*this, "lstPreScripts", wxListBox);
219  lstScripts->Clear();
220  for (size_t i = 0; i < base->GetBuildScripts().GetCount(); ++i)
221  lstScripts->Append(base->GetBuildScripts().Item(i));
222 }
223 
225 {
226  // add build targets to list
227  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
228  lstTargets->Clear();
229  for (int i = 0; i < m_Project->GetBuildTargetsCount(); ++i)
230  lstTargets->Append(m_Project->GetBuildTarget(i)->GetTitle());
231  lstTargets->SetSelection(0);
232 }
233 
235 {
236  if (saveOld)
238 
239  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
240 
241  if (lstTargets->GetSelection() == -1)
242  lstTargets->SetSelection(0);
243  ProjectBuildTarget* target = m_Project->GetBuildTarget(lstTargets->GetSelection());
244  if (!target || m_Current_Sel == lstTargets->GetSelection())
245  return;
246 
247  // global project options
248  wxTextCtrl* txtP = XRCCTRL(*this, "txtPlatform", wxTextCtrl);
249  wxComboBox* cmb = XRCCTRL(*this, "cmbProjectType", wxComboBox);
250  wxCheckBox* chkCR = XRCCTRL(*this, "chkUseConsoleRunner", wxCheckBox);
251  wxCheckBox* chkSL = XRCCTRL(*this, "chkCreateStaticLib", wxCheckBox);
252  wxCheckBox* chkCD = XRCCTRL(*this, "chkCreateDefFile", wxCheckBox);
253  wxTextCtrl* txt = XRCCTRL(*this, "txtOutputFilename", wxTextCtrl);
254  wxTextCtrl* txtI = XRCCTRL(*this, "txtImportLibraryFilename", wxTextCtrl);
255  wxTextCtrl* txtD = XRCCTRL(*this, "txtDefinitionFileFilename", wxTextCtrl);
256  wxTextCtrl* txtW = XRCCTRL(*this, "txtWorkingDir", wxTextCtrl);
257  wxTextCtrl* txtO = XRCCTRL(*this, "txtObjectDir", wxTextCtrl);
258  wxButton* browse = XRCCTRL(*this, "btnBrowseOutputFilename", wxButton);
259  wxButton* browseI = XRCCTRL(*this, "btnBrowseImportLibraryFilename", wxButton);
260  wxButton* browseD = XRCCTRL(*this, "btnBrowseDefinitionFileFilename", wxButton);
261  wxButton* browseW = XRCCTRL(*this, "btnBrowseWorkingDir", wxButton);
262  wxButton* browseO = XRCCTRL(*this, "btnBrowseObjectDir", wxButton);
263 
264  wxString platforms = GetStringFromPlatforms(target->GetPlatforms());
265  txtP->SetValue(platforms);
266 
267  chkCR->SetValue(false);
268  chkCD->SetValue(target->GetCreateDefFile());
269  chkSL->SetValue(target->GetCreateStaticLib());
270 
271  TargetFilenameGenerationPolicy prefixPolicy;
272  TargetFilenameGenerationPolicy extensionPolicy;
273  target->GetTargetFilenameGenerationPolicy(prefixPolicy, extensionPolicy);
274  XRCCTRL(*this, "chkAutoGenPrefix", wxCheckBox)->SetValue(prefixPolicy == tgfpPlatformDefault);
275  XRCCTRL(*this, "chkAutoGenExt", wxCheckBox)->SetValue(extensionPolicy == tgfpPlatformDefault);
276 
277  chkCR->Enable(false);
278  chkSL->Enable(target->GetTargetType() == ttDynamicLib);
279  chkCD->Enable(target->GetTargetType() == ttDynamicLib);
280  if (cmb && chkCR && txt && browse)
281  {
282  cmb->SetSelection(target->GetTargetType());
283 // Compiler* compiler = CompilerFactory::Compilers[target->GetCompilerIndex()];
284  switch ((TargetType)cmb->GetSelection())
285  {
286  case ttConsoleOnly:
287  chkCR->Enable(true);
288  chkCR->SetValue(target->GetUseConsoleRunner());
289  // purposely fall-through
290 
291  case ttExecutable:
292  case ttDynamicLib:
293  case ttNative:
294  case ttStaticLib:
295  txt->SetValue(target->GetOutputFilename());
296  txt->Enable(true);
297  txtI->SetValue(target->GetDynamicLibImportFilename());
298  txtI->Enable(chkSL->IsChecked() && (TargetType)cmb->GetSelection() == ttDynamicLib);
299  txtD->SetValue(target->GetDynamicLibDefFilename());
300  txtD->Enable(chkCD->IsChecked() && (TargetType)cmb->GetSelection() == ttDynamicLib);
301  txtW->SetValue(target->GetWorkingDir());
302  txtW->Enable((TargetType)cmb->GetSelection() == ttExecutable ||
303  (TargetType)cmb->GetSelection() == ttConsoleOnly ||
304  (TargetType)cmb->GetSelection() == ttNative ||
305  (TargetType)cmb->GetSelection() == ttDynamicLib);
306  txtO->SetValue(target->GetObjectOutput());
307  txtO->Enable(true);
308  browse->Enable(true);
309  browseI->Enable(chkSL->IsChecked() && (TargetType)cmb->GetSelection() == ttDynamicLib);
310  browseD->Enable(chkCD->IsChecked() && (TargetType)cmb->GetSelection() == ttDynamicLib);
311  browseW->Enable((TargetType)cmb->GetSelection() == ttExecutable ||
312  (TargetType)cmb->GetSelection() == ttConsoleOnly ||
313  (TargetType)cmb->GetSelection() == ttNative ||
314  (TargetType)cmb->GetSelection() == ttDynamicLib);
315  browseO->Enable(true);
316  break;
317 
318  case ttCommandsOnly: // fall-through
319  default: // for commands-only targets
320  txt->SetValue(_T(""));
321  txt->Enable(false);
322  txtI->SetValue(_T(""));
323  txtI->Enable(false);
324  txtD->SetValue(_T(""));
325  txtD->Enable(false);
326  txtW->SetValue(_T(""));
327  txtW->Enable(false);
328  txtO->SetValue(_T(""));
329  txtO->Enable(false);
330  browse->Enable(false);
331  browseI->Enable(false);
332  browseD->Enable(false);
333  browseW->Enable(false);
334  browseO->Enable(false);
335  break;
336  }
337  }
338 
339  // files options
340  wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
341  int count = list->GetCount();
342  for (int i = 0; i < count; ++i)
343  {
345  if (!pf)
346  break;
347 
348  bool doit = pf->buildTargets.Index(target->GetTitle()) >= 0;
349  list->Check(i, doit);
350  }
351 
352  // update currently selected target
353  m_Current_Sel = lstTargets->GetSelection();
354 }
355 
357 {
358  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
359 
360  // if no previously selected target, exit
361  if (m_Current_Sel == -1)
362  return;
363 
364  if (force || lstTargets->GetSelection() != m_Current_Sel)
365  {
366  // selected another build target
367  // save changes to the previously selected target
368  wxArrayString array;
370  if (!target)
371  return;
372 
373  wxString platforms = XRCCTRL(*this, "txtPlatform", wxTextCtrl)->GetValue();
374  int p = GetPlatformsFromString(platforms);
375  target->SetPlatforms(p);
376 
378  XRCCTRL(*this, "chkAutoGenPrefix", wxCheckBox)->GetValue() ? tgfpPlatformDefault : tgfpNone,
379  XRCCTRL(*this, "chkAutoGenExt", wxCheckBox)->GetValue() ? tgfpPlatformDefault : tgfpNone);
380 
381  target->SetTargetType(TargetType(XRCCTRL(*this, "cmbProjectType", wxComboBox)->GetSelection()));
382  wxFileName fname(XRCCTRL(*this, "txtOutputFilename", wxTextCtrl)->GetValue());
383  target->SetOutputFilename(fname.GetFullPath());
384 
385  fname.Assign(XRCCTRL(*this, "txtImportLibraryFilename", wxTextCtrl)->GetValue());
386  target->SetImportLibraryFilename(fname.GetFullPath());
387 
388  fname.Assign(XRCCTRL(*this, "txtDefinitionFileFilename", wxTextCtrl)->GetValue());
389  target->SetDefinitionFileFilename(fname.GetFullPath());
390 
391  fname.Assign(XRCCTRL(*this, "txtWorkingDir", wxTextCtrl)->GetValue());
392  target->SetWorkingDir(fname.GetFullPath());
393 
394  fname.Assign(XRCCTRL(*this, "txtObjectDir", wxTextCtrl)->GetValue());
395  target->SetObjectOutput(fname.GetFullPath());
396 
397  target->SetUseConsoleRunner(XRCCTRL(*this, "chkUseConsoleRunner", wxCheckBox)->GetValue());
398  target->SetCreateDefFile(XRCCTRL(*this, "chkCreateDefFile", wxCheckBox)->GetValue());
399  target->SetCreateStaticLib(XRCCTRL(*this, "chkCreateStaticLib", wxCheckBox)->GetValue());
400 
401  // files options
402  wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
403  size_t count = list->GetCount();
404  for (size_t i = 0; i < count; ++i)
405  {
407  if (!pf)
408  break;
409 
410  if (list->IsChecked(i))
411  pf->AddBuildTarget(target->GetTitle());
412  else
413  pf->RemoveBuildTarget(target->GetTitle());
414  }
415  }
416 }
417 
418 // events
419 
421 {
423  if (!target)
424  return;
425 
426  wxComboBox* cmb = XRCCTRL(*this, "cmbProjectType", wxComboBox);
427  wxCheckBox* chkSL = XRCCTRL(*this, "chkCreateStaticLib", wxCheckBox);
428  wxCheckBox* chkCD = XRCCTRL(*this, "chkCreateDefFile", wxCheckBox);
429  wxTextCtrl* txt = XRCCTRL(*this, "txtOutputFilename", wxTextCtrl);
430  wxTextCtrl* txtI = XRCCTRL(*this, "txtImportLibraryFilename", wxTextCtrl);
431  wxTextCtrl* txtD = XRCCTRL(*this, "txtDefinitionFileFilename", wxTextCtrl);
432  wxTextCtrl* txtW = XRCCTRL(*this, "txtWorkingDir", wxTextCtrl);
433  wxTextCtrl* txtO = XRCCTRL(*this, "txtObjectDir", wxTextCtrl);
434  wxButton* browse = XRCCTRL(*this, "btnBrowseOutputFilename", wxButton);
435  wxButton* browseI = XRCCTRL(*this, "btnBrowseImportLibraryFilename", wxButton);
436  wxButton* browseD = XRCCTRL(*this, "btnBrowseDefinitionFileFilename", wxButton);
437  wxButton* browseW = XRCCTRL(*this, "btnBrowseWorkingDir", wxButton);
438  wxButton* browseO = XRCCTRL(*this, "btnBrowseObjectDir", wxButton);
439  if (!cmb || !txt || !browse)
440  return;
441 
442  XRCCTRL(*this, "chkUseConsoleRunner", wxCheckBox)->Enable(cmb->GetSelection() == ttConsoleOnly);
443  XRCCTRL(*this, "chkCreateDefFile", wxCheckBox)->Enable(cmb->GetSelection() == ttDynamicLib);
444  XRCCTRL(*this, "chkCreateStaticLib", wxCheckBox)->Enable(cmb->GetSelection() == ttDynamicLib);
445 
446  txt->Enable(true);
447  txtI->Enable(chkSL->IsChecked() && cmb->GetSelection() == ttDynamicLib);
448  txtD->Enable(chkCD->IsChecked() && cmb->GetSelection() == ttDynamicLib);
449  txtW->SetValue(target->GetWorkingDir());
450  txtW->Enable((TargetType)cmb->GetSelection() == ttExecutable ||
451  (TargetType)cmb->GetSelection() == ttConsoleOnly ||
452  (TargetType)cmb->GetSelection() == ttDynamicLib);
453  txtO->Enable(true);
454  txtO->SetValue(target->GetObjectOutput());
455  browse->Enable(true);
456  browseI->Enable(chkSL->IsChecked() && cmb->GetSelection() == ttDynamicLib);
457  browseD->Enable(chkCD->IsChecked() && cmb->GetSelection() == ttDynamicLib);
458  browseW->Enable((TargetType)cmb->GetSelection() == ttExecutable ||
459  (TargetType)cmb->GetSelection() == ttConsoleOnly ||
460  (TargetType)cmb->GetSelection() == ttDynamicLib);
461  browseO->Enable(true);
462 
463  Compiler* compiler = CompilerFactory::GetCompiler(target->GetCompilerID());
464 
465  wxFileName fname = target->GetOutputFilename();
466  wxFileName fnameI = target->GetDynamicLibImportFilename();
467  wxFileName fnameD = target->GetDynamicLibDefFilename();
468  wxString name = fname.GetName();
469  wxString nameI = fnameI.GetName();
470  wxString nameD = fnameD.GetName();
471  wxString ext = fname.GetExt();
472  wxString extI = fname.GetExt();
473  wxString extD = fname.GetExt();
474  wxString libext = compiler ? compiler->GetSwitches().libExtension : _T("");
475  wxString libextI = compiler ? compiler->GetSwitches().libExtension : _T(""); // TODO: add specialized compiler option for this
476  wxString libextD = _T("def"); // TODO: add specialized compiler option for this
477  wxString libpre = compiler ? compiler->GetSwitches().libPrefix : _T("");
478  wxString libpreI = compiler ? compiler->GetSwitches().libPrefix : _T(""); // TODO: add specialized compiler option for this
479  wxString libpreD = compiler ? compiler->GetSwitches().libPrefix : _T(""); // TODO: add specialized compiler option for this
480 
481  switch ((TargetType)cmb->GetSelection())
482  {
483  case ttConsoleOnly:
484  case ttExecutable:
485  if (ext != FileFilters::EXECUTABLE_EXT)
486  fname.SetExt(FileFilters::EXECUTABLE_EXT);
487  if (!libpre.IsEmpty() && name.StartsWith(libpre))
488  {
489  name.Remove(0, libpre.Length());
490  fname.SetName(name);
491  }
492  txt->SetValue(fname.GetFullPath());
493  txtI->SetValue(_T(""));
494  txtD->SetValue(_T(""));
495  break;
496  case ttDynamicLib:
497  if (ext != FileFilters::DYNAMICLIB_EXT)
498  fname.SetExt(FileFilters::DYNAMICLIB_EXT);
499  if (extI != FileFilters::STATICLIB_EXT)
501  if (extD != _T("def"))
502  fnameD.SetExt(_T("def"));
503  if (!libpre.IsEmpty() && name.StartsWith(libpre))
504  {
505  name.Remove(0, libpre.Length());
506  fname.SetName(name);
507  }
508  if (!libpreI.IsEmpty() && nameI.StartsWith(libpreI))
509  {
510  nameI.Remove(0, libpreI.Length());
511  fnameI.SetName(nameI);
512  }
513  if (!libpreD.IsEmpty() && nameD.StartsWith(libpreD))
514  {
515  nameD.Remove(0, libpreD.Length());
516  fnameD.SetName(nameD);
517  }
518  txt->SetValue(fname.GetFullPath());
519  txtI->SetValue(fnameI.GetFullPath());
520  txtD->SetValue(fnameD.GetFullPath());
521  break;
522  case ttStaticLib:
523  if (ext != libext)
524  fname.SetExt(libext);
525  if (!libpre.IsEmpty() && !name.StartsWith(libpre))
526  {
527  name.Prepend(libpre);
528  fname.SetName(name);
529  }
530  txt->SetValue(fname.GetFullPath());
531  txtI->SetValue(_T(""));
532  txtD->SetValue(_T(""));
533  break;
534  case ttNative:
535  if (ext != FileFilters::NATIVE_EXT)
536  fname.SetExt(FileFilters::NATIVE_EXT);
537  if (!libpre.IsEmpty() && name.StartsWith(libpre))
538  {
539  name.Remove(0, libpre.Length());
540  fname.SetName(name);
541  }
542  txt->SetValue(fname.GetFullPath());
543  txtI->SetValue(_T(""));
544  txtD->SetValue(_T(""));
545  break;
546  case ttCommandsOnly: // fall-through
547  default:
548  txt->SetValue(_T(""));
549  txtI->SetValue(_T(""));
550  txtD->SetValue(_T(""));
551  txtW->SetValue(_T(""));
552  txtO->SetValue(_T(""));
553  txt->Enable(false);
554  txtI->Enable(false);
555  txtD->Enable(false);
556  txtW->Enable(false);
557  txtO->Enable(false);
558  browse->Enable(false);
559  browseI->Enable(false);
560  browseD->Enable(false);
561  browseW->Enable(false);
562  browseO->Enable(false);
563  break;
564  }
565 }
566 
568 {
569  DoTargetChange();
573 }
574 
576 {
577  wxArrayString array;
578  for (int i = 0; i < m_Project->GetBuildTargetsCount(); ++i)
579  array.Add(m_Project->GetBuildTarget(i)->GetTitle());
580 
581  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
582  wxString ActiveTarget;
583  if (lstTargets->GetSelection() != wxNOT_FOUND)
584  ActiveTarget = lstTargets->GetString(lstTargets->GetSelection());
585 
586  EditArrayOrderDlg dlg(this, array);
587  PlaceWindow(&dlg);
588  if (dlg.ShowModal() == wxID_OK)
589  {
592  // Retrieve active target.
593  if (!ActiveTarget.IsEmpty())
594  {
595  m_Current_Sel = lstTargets->FindString(ActiveTarget, true);
596  lstTargets->SetSelection(m_Current_Sel);
597  }
598 
602  }
603 }
604 
606 {
608 }
609 
611 {
612  if (m_pCompiler)
614 }
615 
617 {
618  if (m_pCompiler)
619  {
620  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
621  int targetIdx = lstTargets->GetSelection();
622 
623  ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
624  if (target)
625  m_pCompiler->Configure(m_Project, target);
626  }
627 }
628 
630 {
631  wxString targetName = cbGetTextFromUser(_("Enter the new build target name:"),
632  _("New build target"));
633  if (!ValidateTargetName(targetName))
634  return;
635 
636  ProjectBuildTarget* target = m_Project->AddBuildTarget(targetName);
637  if (!target)
638  {
639  cbMessageBox(_("The new target could not be added..."),
640  _("Error"), wxOK | wxICON_ERROR, this);
641  return;
642  }
643 
644  // add target to targets combo
645  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
646  lstTargets->Append(targetName);
647  lstTargets->SetSelection(lstTargets->GetCount() - 1);
648  DoTargetChange();
653 }
654 
656 {
657  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
658  int targetIdx = lstTargets->GetSelection();
659 
660  ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
661  if (!target)
662  {
663  cbMessageBox(_("Could not locate target..."),
664  _("Error"), wxOK | wxICON_ERROR, this);
665  return;
666  }
667 
668  wxString oldTargetName = target->GetTitle();
669  wxString newTargetName = cbGetTextFromUser(_("Change the build target name:"),
670  _("Rename build target"),
671  oldTargetName);
672  if (newTargetName == oldTargetName || !ValidateTargetName(newTargetName))
673  return;
674 
675  m_Project->RenameBuildTarget(targetIdx, newTargetName);
676  lstTargets->SetString(targetIdx, newTargetName);
677  lstTargets->SetSelection(targetIdx);
682 }
683 
685 {
686  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
687  int targetIdx = lstTargets->GetSelection();
688 
689  ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
690  if (!target)
691  {
692  cbMessageBox(_("Could not locate target..."),
693  _("Error"), wxOK | wxICON_ERROR, this);
694  return;
695  }
696 
697  wxString newTargetName = cbGetTextFromUser(_("Enter the duplicated build target's name:"),
698  _("Duplicate build target"),
699  _("Copy of ") + target->GetTitle());
700  if (!ValidateTargetName(newTargetName))
701  return;
702  if (!m_Project->DuplicateBuildTarget(targetIdx, newTargetName))
703  {
704  cbMessageBox(_("Failed to duplicate this build target..."), _("Error"), wxICON_ERROR, this);
705  return;
706  }
707 
708  // add target to targets combo
709  lstTargets->Append(newTargetName);
710  lstTargets->SetSelection(lstTargets->GetCount() - 1);
711  DoTargetChange();
716 }
717 
719 {
720  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
721  int targetIdx = lstTargets->GetSelection();
722  if (targetIdx == wxNOT_FOUND)
723  {
724  Manager::Get()->GetLogManager()->Log(_("No target removed, because nothing is selected in the Build target list box!"));
725  return;
726  }
727 
728  wxString caption;
729  caption.Printf(_("Are you sure you want to delete build target \"%s\"?"), lstTargets->GetStringSelection().c_str());
730  if (cbMessageBox(caption, _("Confirmation"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION, this) == wxID_NO)
731  return;
732 
733  lstTargets->Delete(targetIdx);
734  if (lstTargets->GetCount() > 0)
735  {
736  if (static_cast<unsigned>(targetIdx) >= lstTargets->GetCount())
737  lstTargets->SetSelection(lstTargets->GetCount() - 1);
738  else
739  lstTargets->SetSelection(targetIdx);
740  }
741  // the target name in the units is changed by the project...
742  m_Project->RemoveBuildTarget(targetIdx);
743  m_Current_Sel = -1;
744  DoTargetChange();
749 }
750 
752 {
753  VirtualBuildTargetsDlg dlg(this, -1, m_Project);
754  dlg.ShowModal();
755 }
756 
758 {
759  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
760  ProjectBuildTarget* target = m_Project->GetBuildTarget(lstTargets->GetSelection());
761  if (!target)
762  return;
763 
764  ExternalDepsDlg dlg(this, m_Project, target);
765  PlaceWindow(&dlg);
766  dlg.ShowModal();
767 }
768 
770 {
771  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
772  ProjectBuildTarget* target = m_Project->GetBuildTarget(lstTargets->GetSelection());
773  if (!target)
774  return;
775 
776  AnnoyingDialog dlg(_("Create project from target confirmation"),
777  _("This project will be saved before exporting the build target.\n"
778  "Are you sure you want to export the selected "
779  "build target to a new project?"),
781  if (dlg.ShowModal() == AnnoyingDialog::rtYES)
782  {
783  if (m_Project->ExportTargetAsProject(target->GetTitle()))
784  cbMessageBox(_("New project created successfully!"), _("Information"), wxICON_INFORMATION, this);
785  }
786 }
787 
789 {
790  wxTextCtrl* targettext = nullptr;
791  if (event.GetId() == XRCID("btnBrowseWorkingDir"))
792  targettext = XRCCTRL(*this, "txtWorkingDir", wxTextCtrl);
793  else if (event.GetId() == XRCID("btnBrowseObjectDir"))
794  targettext = XRCCTRL(*this, "txtObjectDir", wxTextCtrl);
795  else if (event.GetId() == XRCID("btnExecutionDir"))
796  targettext = XRCCTRL(*this, "txtExecutionDir", wxTextCtrl);
797  else
798  return;
799 
800  wxFileName fname(targettext->GetValue() + wxFileName::GetPathSeparator());
802 
803  wxString path = ChooseDirectory(this,
804  _("Select directory"),
805  fname.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR),
807  true,
808  true);
809  if (path.IsEmpty())
810  return;
811 
812  fname.Assign(path);
813  targettext->SetValue(path);
814 }
815 
817 {
818  wxFileName fname;
819  fname.Assign(XRCCTRL(*this, "txtOutputFilename", wxTextCtrl)->GetValue());
821  wxFileDialog dlg(this,
822  _("Select output filename"),
823  fname.GetPath(),
824  fname.GetFullName(),
827 
828  PlaceWindow(&dlg);
829  if (dlg.ShowModal() != wxID_OK)
830  return;
831  fname.Assign(dlg.GetPath());
833  XRCCTRL(*this, "txtOutputFilename", wxTextCtrl)->SetValue(fname.GetFullPath());
834 }
835 
837 {
838  wxFileName fname;
839  fname.Assign(XRCCTRL(*this, "txtImportLibraryFilename", wxTextCtrl)->GetValue());
841  wxFileDialog dlg(this,
842  _("Select import library filename"),
843  fname.GetPath(),
844  fname.GetFullName(),
847 
848  PlaceWindow(&dlg);
849  if (dlg.ShowModal() != wxID_OK)
850  return;
851  fname.Assign(dlg.GetPath());
853  XRCCTRL(*this, "txtImportLibraryFilename", wxTextCtrl)->SetValue(fname.GetFullPath());
854 }
855 
857 {
858  wxFileName fname;
859  fname.Assign(XRCCTRL(*this, "txtDefinitionFileFilename", wxTextCtrl)->GetValue());
861  wxFileDialog dlg(this,
862  _("Select definition file filename"),
863  fname.GetPath(),
864  fname.GetFullName(),
867 
868  PlaceWindow(&dlg);
869  if (dlg.ShowModal() != wxID_OK)
870  return;
871  fname.Assign(dlg.GetPath());
873  XRCCTRL(*this, "txtDefinitionFileFilename", wxTextCtrl)->SetValue(fname.GetFullPath());
874 }
875 
877 {
878  wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
879 
880  if (list->GetSelection() >= 0)
881  {
882  // show file options dialog
884  pf->ShowOptions(this);
885  }
886 }
887 
889 {
890  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
891  int targetIdx = lstTargets->GetSelection();
892  ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
893  if (!target)
894  return;
895 
896  wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
897  for (unsigned int i = 0; i < list->GetCount(); ++i)
898  {
900  if (pf)
901  {
902  list->Check(i, !list->IsChecked(i));
903  if (list->IsChecked(i))
904  pf->AddBuildTarget(target->GetTitle());
905  else
906  pf->RemoveBuildTarget(target->GetTitle());
907  }
908  }
909 }
910 
912 {
913  wxString wildcard = cbGetTextFromUser(_("Select wildcard (file mask) to toggle on:"),
914  _("Select files"), _T("*.*"));
915  if (wildcard.IsEmpty()) return; // user pressed Cancel
916 
917  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
918  int targetIdx = lstTargets->GetSelection();
919  ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
920  if (!target)
921  return;
922 
923  wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
924  for (unsigned int i=0; i<list->GetCount(); ++i)
925  {
927  if (pf && wxMatchWild(wildcard, list->GetString(i), false))
928  {
929  list->Check(i, true);
930  pf->AddBuildTarget(target->GetTitle());
931  }
932  }
933 }
934 
936 {
937  wxString wildcard = cbGetTextFromUser(_("Select wildcard (file mask) to toggle off:"),
938  _("Select files"), _T("*.*"));
939  if (wildcard.IsEmpty()) return; // user pressed Cancel
940 
941  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
942  int targetIdx = lstTargets->GetSelection();
943  ProjectBuildTarget* target = m_Project->GetBuildTarget(targetIdx);
944  if (!target)
945  return;
946 
947  wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
948  for (unsigned int i=0; i<list->GetCount(); ++i)
949  {
951  if (pf && wxMatchWild(wildcard, list->GetString(i), false))
952  {
953  list->Check(i, false);
954  pf->RemoveBuildTarget(target->GetTitle());
955  }
956  }
957 }
958 
960 {
961  FillScripts();
962 }
963 
965 {
966  static const wxString clearout_buildscripts = _T("SetBuildOptions <- null;");
967  try
968  {
969  wxString script_nomacro = script;
970  Manager::Get()->GetMacrosManager()->ReplaceMacros(script_nomacro, target);
971  script_nomacro = wxFileName(script_nomacro).IsAbsolute() ? script_nomacro : m_Project->GetBasePath() + wxFILE_SEP_PATH + script_nomacro;
972  Manager::Get()->GetScriptingManager()->LoadBuffer(clearout_buildscripts); // clear previous script's context
973  Manager::Get()->GetScriptingManager()->LoadScript(script_nomacro);
974  SqPlus::SquirrelFunction<void> setopts("SetBuildOptions");
975 
976  if (setopts.func.IsNull())
977  return false;
978 
979  return true;
980  }
981  catch (SquirrelError& e)
982  {
984  return false;
985  }
986 }
987 
989 {
990  if (name.IsEmpty())
991  return false;
992 
993  if (m_Project->GetBuildTarget(name))
994  {
995  cbMessageBox(_("A target with this name already exists in this project!"),
996  _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
997  return false;
998  }
999 
1000  if (m_Project->HasVirtualBuildTarget(name))
1001  {
1002  cbMessageBox(_("A virtual target with this name already exists in this project!"),
1003  _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
1004  return false;
1005  }
1006 
1007  const wxString forbidden = _T(";,!@#$%^&*\"':`~=?\\><");
1008  if (name.find_first_of(forbidden, 0) != wxString::npos)
1009  {
1010  cbMessageBox(_("The name contains at least one invalid character:\n\n") + forbidden,
1011  _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
1012  return false;
1013  }
1014 
1015  return true;
1016 }
1017 
1019 {
1020  const wxArrayString& scripts = base->GetBuildScripts();
1021  for (size_t i = 0; i < scripts.GetCount(); ++i)
1022  {
1023  ProjectBuildTarget* bt = dynamic_cast<ProjectBuildTarget*>(base);
1024  if (!IsScriptValid(bt, scripts[i]))
1025  {
1026  wxString msg;
1027  msg << _("Invalid build script: ") + scripts[i] << _T('\n');
1028  msg << _("First seen in: ") + base->GetTitle() << _T('\n');
1029  cbMessageBox(msg, _("Error"), wxICON_ERROR, this);
1030  return false;
1031  }
1032  }
1033  return true;
1034 }
1035 
1037 {
1038  if (!DoCheckScripts(m_Project))
1039  return;
1040 
1041  for (int i = 0; i < m_Project->GetBuildTargetsCount(); ++i)
1042  {
1044  return;
1045  }
1046 
1047  cbMessageBox(_("All scripts seem to be valid!"), _("Information"), wxICON_INFORMATION, this);
1048 }
1049 
1051 {
1052  wxListBox* ctrl = XRCCTRL(*this, "lstPreScripts", wxListBox);
1053  if (!ctrl)
1054  return;
1055 
1056  wxFileName fname;
1057  if (ctrl->GetSelection())
1058  fname.Assign(ctrl->GetStringSelection());
1059  else if (ctrl->GetCount())
1060  fname.Assign(ctrl->GetString(ctrl->GetCount() - 1));
1062 
1063  EditPathDlg dlg(this,
1064  fname.GetFullName(),
1065  wxEmptyString,//fname.GetPath(),
1066  _("Add script(s)"),
1067  _("Select script file(s)"),
1068  false,
1069  true,
1070  _("Script files (*.script)|*.script"));
1071 
1072  PlaceWindow(&dlg);
1073  if (dlg.ShowModal() != wxID_OK)
1074  return;
1075 
1076  wxArrayString paths = GetArrayFromString(dlg.GetPath());
1077  for (size_t i = 0; i < paths.GetCount(); ++i)
1078  {
1079  fname.Assign(paths[i]);
1081  ctrl->Append(fname.GetFullPath());
1082  ctrl->SetSelection(ctrl->GetCount()-1);
1083 
1084  wxTreeCtrl* tc = XRCCTRL(*this, "tcOverview", wxTreeCtrl);
1085  wxTreeItemId sel = tc->GetSelection();
1086  CompileOptionsBase* base = sel == tc->GetRootItem()
1087  ? static_cast<CompileOptionsBase*>(m_Project)
1088  : static_cast<CompileOptionsBase*>(m_Project->GetBuildTarget(tc->GetItemText(sel)));
1089  base->AddBuildScript(fname.GetFullPath());
1090  }
1091 }
1092 
1094 {
1095  wxListBox* ctrl = XRCCTRL(*this, "lstPreScripts", wxListBox);
1096  if (!ctrl || ctrl->GetSelection() == -1)
1097  return;
1098 
1099  wxString script = ctrl->GetStringSelection();
1100  if (script.IsEmpty())
1101  return;
1102 
1103  wxTreeCtrl* tc = XRCCTRL(*this, "tcOverview", wxTreeCtrl);
1104  wxTreeItemId sel = tc->GetSelection();
1105  CompileOptionsBase* base = sel == tc->GetRootItem()
1106  ? static_cast<CompileOptionsBase*>(m_Project)
1107  : static_cast<CompileOptionsBase*>(m_Project->GetBuildTarget(tc->GetItemText(sel)));
1108  base->RemoveBuildScript(script);
1109  int isel = ctrl->GetSelection();
1110  ctrl->Delete(isel);
1111  ctrl->SetSelection(isel < (int)(ctrl->GetCount()) ? isel : --isel );
1112 }
1113 
1115 {
1116  wxTextCtrl* txtP;
1117  if (event.GetId() == XRCID("btnPlatform"))
1118  txtP = XRCCTRL(*this, "txtPlatform", wxTextCtrl);
1119  else
1120  txtP = XRCCTRL(*this, "txtPlatformProj", wxTextCtrl);
1121  bool isAll = txtP->GetValue().Contains(_("All"));
1122 
1124  MultiSelectDlg dlg(this, arr, isAll, _("Select supported platforms:"), _("Build target platforms"));
1125  if (!isAll)
1126  {
1127  wxArrayString sel = GetArrayFromString(txtP->GetValue());
1128  for (size_t i = 0; i < sel.GetCount(); ++i)
1129  dlg.SelectWildCard(sel[i].Lower(), true, false);
1130  }
1131 
1132  if (dlg.ShowModal() == wxID_OK)
1133  {
1134  wxArrayString ret = dlg.GetSelectedStrings();
1135  if (ret.GetCount() == 3)
1136  txtP->SetValue(_("All"));
1137  else
1138  {
1140  txtP->SetValue(platform);
1141  }
1142  }
1143 }
1144 
1146 {
1147  wxListBox* ctrl = XRCCTRL(*this, "lstPreScripts", wxListBox);
1148  if (!ctrl || ctrl->GetSelection() <= 0)
1149  return;
1150 
1151  wxTreeCtrl* tc = XRCCTRL(*this, "tcOverview", wxTreeCtrl);
1152  wxTreeItemId sel = tc->GetSelection();
1153  CompileOptionsBase* base = sel == tc->GetRootItem()
1154  ? static_cast<CompileOptionsBase*>(m_Project)
1155  : static_cast<CompileOptionsBase*>(m_Project->GetBuildTarget(tc->GetItemText(sel)));
1156 
1157  int isel = ctrl->GetSelection();
1158  wxString ssel = ctrl->GetStringSelection();
1159  wxArrayString scripts = base->GetBuildScripts();
1160  scripts.RemoveAt(isel);
1161  ctrl->Delete(isel);
1162  --isel;
1163  ctrl->Insert(ssel, isel);
1164  scripts.Insert(ssel, isel);
1165  ctrl->SetSelection(isel);
1166  base->SetBuildScripts(scripts);
1167 }
1168 
1170 {
1171  wxListBox* ctrl = XRCCTRL(*this, "lstPreScripts", wxListBox);
1172  if (!ctrl || ctrl->GetSelection() == (int)(ctrl->GetCount()) - 1)
1173  return;
1174 
1175  wxTreeCtrl* tc = XRCCTRL(*this, "tcOverview", wxTreeCtrl);
1176  wxTreeItemId sel = tc->GetSelection();
1177  CompileOptionsBase* base = sel == tc->GetRootItem()
1178  ? static_cast<CompileOptionsBase*>(m_Project)
1179  : static_cast<CompileOptionsBase*>(m_Project->GetBuildTarget(tc->GetItemText(sel)));
1180 
1181  int isel = ctrl->GetSelection();
1182  wxString ssel = ctrl->GetStringSelection();
1183  wxArrayString scripts = base->GetBuildScripts();
1184  scripts.RemoveAt(isel);
1185  ctrl->Delete(isel);
1186  ++isel;
1187  ctrl->Insert(ssel, isel);
1188  scripts.Insert(ssel, isel);
1189  ctrl->SetSelection(isel);
1190  base->SetBuildScripts(scripts);
1191 }
1192 
1194 {
1195  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
1196  wxCheckListBox* list = XRCCTRL(*this, "lstFiles", wxCheckListBox);
1197 
1198  bool filesEn = list->GetSelection() >= 0;
1199  bool en = lstTargets->GetSelection() >= 0;
1200 
1201  // files options
1202  XRCCTRL(*this, "btnFileOptions", wxButton)->Enable(filesEn);
1203 
1204  // target options
1205  XRCCTRL(*this, "btnBuildOrder", wxButton)->Enable(lstTargets->GetCount() > 1);
1206  XRCCTRL(*this, "btnEditBuildTarget", wxButton)->Enable(en);
1207  XRCCTRL(*this, "btnCopyBuildTarget", wxButton)->Enable(en);
1208  XRCCTRL(*this, "btnDelBuildTarget", wxButton)->Enable(en && lstTargets->GetCount() > 1);
1209 
1210  // edit project/target build options
1211  XRCCTRL(*this, "btnProjectBuildOptions", wxButton)->Enable(m_pCompiler);
1212  XRCCTRL(*this, "btnTargetBuildOptions", wxButton)->Enable(m_pCompiler && en);
1213  XRCCTRL(*this, "btnExportTarget", wxButton)->Enable(en);
1214 
1215  // disable some stuff if using a custom makefile
1216  bool customMake = XRCCTRL(*this, "chkCustomMakefile", wxCheckBox)->GetValue();
1217  XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->Enable(!customMake);
1218  XRCCTRL(*this, "txtObjectDir", wxTextCtrl)->Enable(!customMake && en);
1219  XRCCTRL(*this, "txtObjectDir", wxTextCtrl)->Enable(!customMake && en);
1220  XRCCTRL(*this, "btnBrowseObjectDir", wxButton)->Enable(!customMake && en);
1221  XRCCTRL(*this, "btnToggleCheckmarks", wxButton)->Enable(!customMake && en);
1222  XRCCTRL(*this, "btnCheckmarksOn", wxButton)->Enable(!customMake && en);
1223  XRCCTRL(*this, "btnCheckmarksOff", wxButton)->Enable(!customMake && en);
1224  list->Enable(!customMake);
1225 
1226  // enable some stuff if using a custom makefile
1227  XRCCTRL(*this, "txtExecutionDir", wxTextCtrl)->Enable(customMake);
1228  XRCCTRL(*this, "btnExecutionDir", wxButton)->Enable(customMake);
1229 
1230  // scripts page
1231  wxTreeCtrl* tc = XRCCTRL(*this, "tcOverview", wxTreeCtrl);
1232  tc->Enable(!customMake);
1233  bool scrsel = !customMake && tc->GetSelection().IsOk();
1234 
1235  wxListBox* lstPreScripts = XRCCTRL(*this, "lstPreScripts", wxListBox);
1236  lstPreScripts->Enable(scrsel);
1237  bool presel = lstPreScripts->GetSelection() != -1;
1238  XRCCTRL(*this, "btnAddPreScripts", wxButton)->Enable(scrsel);
1239  XRCCTRL(*this, "btnRemovePreScripts", wxButton)->Enable(scrsel && presel);
1240  XRCCTRL(*this, "spnPreScripts", wxSpinButton)->Enable(scrsel && presel && lstPreScripts->GetCount() > 1);
1241  XRCCTRL(*this, "btnCheckScripts", wxButton)->Enable(!customMake);
1242 }
1243 
1245 {
1246  if (XRCCTRL(*this, "txtProjectName", wxTextCtrl)->GetValue().Trim().IsEmpty())
1247  {
1248  cbMessageBox(_("The project title (name) cannot be empty."), _("Error"),
1249  wxOK | wxCENTRE | wxICON_ERROR, this);
1250  return; // Stop propagating the event
1251  }
1252  event.Skip();
1253 }
1254 
1256 {
1257  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
1258 
1259  if (lstTargets->GetSelection() == -1)
1260  lstTargets->SetSelection(0);
1261 
1262  ProjectBuildTarget* target = m_Project->GetBuildTarget(lstTargets->GetSelection());
1263  if (!target)
1264  return;
1265 
1266  wxComboBox* cmb = XRCCTRL(*this, "cmbProjectType", wxComboBox);
1267  wxCheckBox* chkSL = XRCCTRL(*this, "chkCreateStaticLib", wxCheckBox);
1268  wxCheckBox* chkCD = XRCCTRL(*this, "chkCreateDefFile", wxCheckBox);
1269  wxTextCtrl* txtI = XRCCTRL(*this, "txtImportLibraryFilename", wxTextCtrl);
1270  wxTextCtrl* txtD = XRCCTRL(*this, "txtDefinitionFileFilename", wxTextCtrl);
1271  wxButton* browseI = XRCCTRL(*this, "btnBrowseImportLibraryFilename", wxButton);
1272  wxButton* browseD = XRCCTRL(*this, "btnBrowseDefinitionFileFilename", wxButton);
1273 
1274  wxString platforms = GetStringFromPlatforms(target->GetPlatforms());
1275 
1276  txtI->Enable(chkSL->IsChecked() && cmb->GetSelection() == ttDynamicLib);
1277  txtD->Enable(chkCD->IsChecked() && cmb->GetSelection() == ttDynamicLib);
1278  browseI->Enable(chkSL->IsChecked() && cmb->GetSelection() == ttDynamicLib);
1279  browseD->Enable(chkCD->IsChecked() && cmb->GetSelection() == ttDynamicLib);
1280 }
1281 
1283 {
1284  wxListBox* lstTargets = XRCCTRL(*this, "lstBuildTarget", wxListBox);
1285 
1286  if (lstTargets->GetSelection() == -1)
1287  lstTargets->SetSelection(0);
1288 
1289  ProjectBuildTarget* target = m_Project->GetBuildTarget(lstTargets->GetSelection());
1290  if (!target)
1291  return;
1292 
1293  wxComboBox* cmb = XRCCTRL(*this, "cmbProjectType", wxComboBox);
1294  wxCheckBox* chkSL = XRCCTRL(*this, "chkCreateStaticLib", wxCheckBox);
1295  wxCheckBox* chkCD = XRCCTRL(*this, "chkCreateDefFile", wxCheckBox);
1296  wxTextCtrl* txtI = XRCCTRL(*this, "txtImportLibraryFilename", wxTextCtrl);
1297  wxTextCtrl* txtD = XRCCTRL(*this, "txtDefinitionFileFilename", wxTextCtrl);
1298  wxButton* browseI = XRCCTRL(*this, "btnBrowseImportLibraryFilename", wxButton);
1299  wxButton* browseD = XRCCTRL(*this, "btnBrowseDefinitionFileFilename", wxButton);
1300 
1301  wxString platforms = GetStringFromPlatforms(target->GetPlatforms());
1302 
1303  txtI->Enable(chkSL->IsChecked() && cmb->GetSelection() == ttDynamicLib);
1304  txtD->Enable(chkCD->IsChecked() && cmb->GetSelection() == ttDynamicLib);
1305  browseI->Enable(chkSL->IsChecked() && cmb->GetSelection() == ttDynamicLib);
1306  browseD->Enable(chkCD->IsChecked() && cmb->GetSelection() == ttDynamicLib);
1307 }
1308 
1309 
1310 namespace
1311 {
1312 static void UpdateNameInTree(cbProject *project)
1313 {
1315  if (!tree || !project->GetProjectNode())
1316  return;
1317  tree->SetItemText(project->GetProjectNode(), project->GetTitle());
1318 }
1319 } // anonymous namespace
1320 
1322 {
1323  if (retCode == wxID_OK)
1324  {
1325  m_Project->SetTitle(XRCCTRL(*this, "txtProjectName", wxTextCtrl)->GetValue());
1326  m_Project->SetPlatforms(GetPlatformsFromString(XRCCTRL(*this, "txtPlatformProj", wxTextCtrl)->GetValue()));
1327  UpdateNameInTree(m_Project);
1328  m_Project->SetMakefile(XRCCTRL(*this, "txtProjectMakefile", wxTextCtrl)->GetValue());
1329  m_Project->SetMakefileCustom(XRCCTRL(*this, "chkCustomMakefile", wxCheckBox)->GetValue());
1330  m_Project->SetMakefileExecutionDir(XRCCTRL(*this, "txtExecutionDir", wxTextCtrl)->GetValue());
1331  m_Project->SetTargetType(TargetType(XRCCTRL(*this, "cmbProjectType", wxComboBox)->GetSelection()));
1332  m_Project->SetModeForPCH((PCHMode)XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->GetSelection());
1333  m_Project->SetExtendedObjectNamesGeneration(XRCCTRL(*this, "chkExtendedObjNames", wxCheckBox)->GetValue());
1334  m_Project->SetShowNotesOnLoad(XRCCTRL(*this, "chkShowNotes", wxCheckBox)->GetValue());
1335  m_Project->SetCheckForExternallyModifiedFiles(XRCCTRL(*this, "chkCheckFiles", wxCheckBox)->GetValue());
1336  m_Project->SetNotes(XRCCTRL(*this, "txtNotes", wxTextCtrl)->GetValue());
1337 
1338  if (m_Current_Sel == -1)
1339  m_Current_Sel = 0; // force update of global options
1340 
1341  DoBeforeTargetChange(true);
1342 
1343  // finally, apply settings in all plugins' panels
1344  for (size_t i = 0; i < m_PluginPanels.GetCount(); ++i)
1345  {
1347  panel->OnApply();
1348  }
1349  }
1350  else
1351  {
1352  // finally, cancel settings in all plugins' panels
1353  for (size_t i = 0; i < m_PluginPanels.GetCount(); ++i)
1354  {
1356  panel->OnCancel();
1357  }
1358  }
1359 
1360  wxScrollingDialog::EndModal(retCode);
1361 }
1362 
void DoBeforeTargetChange(bool force=false)
wxTreeItemId GetProjectNode()
Definition: cbproject.h:311
wxArrayString GetSelectedStrings() const
ProjectFile * GetFileByFilename(const wxString &filename, bool isRelative=true, bool isUnixFilename=false)
Access a file of the project.
Definition: cbproject.cpp:1049
void EndModal(int retCode)
void OnCreateImportFileClick(wxCommandEvent &event)
DLLIMPORT wxArrayString GetArrayFromString(const wxString &text, const wxString &separator=DEFAULT_ARRAY_SEP, bool trimSpaces=true)
Definition: globals.cpp:134
ProjectBuildTarget * DuplicateBuildTarget(int index, const wxString &newName=wxEmptyString)
Duplicate a build target.
Definition: cbproject.cpp:1216
void EndModal(int retCode)
Definition: sc_dialog.cpp:112
void OnRemoveBuildTargetClick(wxCommandEvent &event)
virtual bool AddPage(wxWindow *page, const wxString &text, bool select=false, int imageId=NO_IMAGE)
virtual void GetTargetFilenameGenerationPolicy(TargetFilenameGenerationPolicy &prefixOut, TargetFilenameGenerationPolicy &extensionOut) const
int GetKeyCode() const
void SetMakefileCustom(bool custom)
Mark if the project should use a custom Makefile for compilation.
Definition: cbproject.cpp:194
cbCompilerPlugin * m_pCompiler
void OnPlatform(wxCommandEvent &event)
void OnCreateDefFileClick(wxCommandEvent &event)
bool DoCheckScripts(CompileTargetBase *base)
TargetFilenameGenerationPolicy
A target&#39;s filename can either be auto-generated based on the running platform, or completely specifi...
PluginManager * GetPluginManager() const
Definition: manager.cpp:444
#define wxICON_QUESTION
void OnExportTargetClick(wxCommandEvent &event)
void SetModeForPCH(PCHMode mode)
Set the mode to handle precompiled headers.
Definition: cbproject.h:306
virtual bool GetCreateDefFile() const
Valid only for targets generating dynamic libraries (DLLs or SOs).
virtual bool GetUseConsoleRunner() const
Valid only for targets generating a console executable.
virtual void SetObjectOutput(const wxString &dirname)
Set the target&#39;s objects output dir.
void Assign(const wxFileName &filepath)
void ReOrderTargets(const wxArrayString &nameOrder)
Reorder the list of build targets.
Definition: cbproject.cpp:1405
bool IsOk() const
void OnFileOptionsClick(wxCommandEvent &event)
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
Definition: manager.cpp:182
void OnRemoveScript(wxCommandEvent &event)
void OnOK(wxCommandEvent &event)
void OnAddScript(wxCommandEvent &event)
virtual void SetCreateDefFile(bool createIt)
Set if the target creates a DEF imports file.
bool ShowOptions(wxWindow *parent)
Show the file properties dialog.
void SetShowNotesOnLoad(bool show)
Set show project notes on load automatically.
Definition: cbproject.cpp:1605
DLLIMPORT wxString GetStringFromPlatforms(int platforms, bool forceSeparate=false)
Return a string representation of a platform / multiple platforms.
Definition: globals.cpp:90
virtual wxString GetString(unsigned int n) const
void OnTargetBuildOptionsClick(wxCommandEvent &event)
void OnScriptMoveDown(wxSpinEvent &event)
#define wxICON_ERROR
virtual void DeleteAllItems()
DLLIMPORT wxString cbGetTextFromUser(const wxString &message, const wxString &caption=cbGetTextFromUserPromptStr, const wxString &default_value=wxEmptyString, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true)
Definition: globals.cpp:1465
bool ValidateTargetName(const wxString &name)
DLLIMPORT wxString ChooseDirectory(wxWindow *parent, const wxString &message=_("Select directory"), const wxString &initialPath=_T(""), const wxString &basePath=_T(""), bool askToMakeRelative=false, bool showCreateDirButton=false)
Definition: globals.cpp:639
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
virtual void SetSelection(int n)
virtual wxString GetTitle() const =0
void OnBrowseImportLibraryFilenameClick(wxCommandEvent &event)
virtual wxTreeItemId GetSelection() const
Target produces an executable.
void OnEditBuildTargetClick(wxCommandEvent &event)
PCHMode
Precompiled headers mode.
Definition: cbproject.h:83
size_t Length() const
virtual void AddBuildScript(const wxString &script)
static Compiler * GetCompiler(size_t index)
void OnCheckScripts(wxCommandEvent &event)
virtual void OnApply()=0
Called when the user chooses to apply the configuration.
Generate filename based on running platform defaults.
#define wxNO_DEFAULT
#define _T(string)
virtual void OnCancel()=0
Called when the user chooses to cancel the configuration.
#define wxYES_NO
void OnScriptMoveUp(wxSpinEvent &event)
cbProjectManagerUI & GetUI()
DLLIMPORT wxString GetStringFromArray(const wxArrayString &array, const wxString &separator=DEFAULT_ARRAY_SEP, bool SeparatorAtEnd=true)
Definition: globals.cpp:122
bool IsAbsolute(wxPathFormat format=wxPATH_NATIVE) const
virtual int GetPlatforms() const
DLLIMPORT wxString GetFilterAll()
Generates a simple special filter "All files".
Definition: filefilters.cpp:98
virtual void SetTargetFilenameGenerationPolicy(TargetFilenameGenerationPolicy prefix, TargetFilenameGenerationPolicy extension)
A target&#39;s filename can either be auto-generated based on the running platform, or completely specifi...
#define wxICON_INFORMATION
bool IsChecked(unsigned int item) const
virtual wxString GetItemText(const wxTreeItemId &item) const
wxString & Remove(size_t pos)
wxString GetName() const
void OnEditDepsClick(wxCommandEvent &event)
virtual void ConfigureProjectDependencies(cbProject *base=nullptr)=0
Displays a dialog to setup project dependencies.
virtual void SetUseConsoleRunner(bool useIt)
Set if ConsoleRunner should be used.
virtual void SetImportLibraryFilename(const wxString &filename)
Set the target&#39;s import library filename.
virtual const wxArrayString & GetBuildScripts() const
#define wxNOT_FOUND
Represents a file in a Code::Blocks project.
Definition: projectfile.h:39
virtual void SetPlatforms(int platforms)
A generic Code::Blocks event.
Definition: sdk_events.h:20
virtual wxString GetOutputFilename()
Read the target&#39;s output filename.
virtual bool GetCreateStaticLib()
Valid only for targets generating dynamic libraries (DLLs or SOs).
void OnProjectDepsClick(wxCommandEvent &event)
void OnBrowseOutputFilenameClick(wxCommandEvent &event)
const DLLIMPORT wxString DYNAMICLIB_EXT
virtual TargetType GetTargetType() const
Read the target&#39;s type.
virtual void SetDefinitionFileFilename(const wxString &filename)
Set the target&#39;s definition file filename.
void OnBrowseDirClick(wxCommandEvent &event)
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
Definition: manager.cpp:429
const wxArrayString & GetArray()
bool LoadScript(const wxString &filename)
Loads a script.
bool MakeRelativeTo(const wxString &pathBase=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
void Insert(wxString lItem, size_t nIndex, size_t copies=1)
bool wxMatchWild(const wxString &pattern, const wxString &text, bool dot_special)
Represents a Code::Blocks project.
Definition: cbproject.h:96
void OnAddBuildTargetClick(wxCommandEvent &event)
size_t find_first_of(const char *sz, size_t nStart=0) const
wxArtID wxART_QUESTION
void OnBuildOrderClick(wxCommandEvent &event)
virtual wxString GetDynamicLibImportFilename()
Read the target&#39;s dynamic library import filename (produced if target type is ttDynamicLib) ...
virtual void SetOutputFilename(const wxString &filename)
Set the target&#39;s output filename.
void OnProjectTypeChanged(wxCommandEvent &event)
virtual const wxString & GetTitle() const
Read the target&#39;s title.
void GetProjectConfigurationPanels(wxWindow *parent, cbProject *project, ConfigurationPanelsArray &arrayToFill)
void RemoveBuildTarget(const wxString &targetName)
Remove this file from the specified build target.
Target produces a dynamic library.
void Check(unsigned int item, bool check=true)
virtual void SelectItem(const wxTreeItemId &item, bool select=true)
const DLLIMPORT wxString STATICLIB_EXT
void SetCheckForExternallyModifiedFiles(bool check)
Set check for externally modified files.
Definition: cbproject.cpp:1619
virtual cbTreeCtrl * GetTree()=0
Retrieve a pointer to the project manager&#39;s tree (GUI).
Target produces a native binary.
LogManager * GetLogManager() const
Definition: manager.cpp:439
bool IsScriptValid(ProjectBuildTarget *target, const wxString &script)
wxString & Item(size_t nIndex)
virtual wxString GetBasePath() const
Read the target&#39;s base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
wxString libExtension
Definition: compiler.h:224
void DisplayErrors(SquirrelError *exception=nullptr, bool clearErrors=true)
Display error dialog.
virtual wxString GetWorkingDir()
Read the target&#39;s working dir for execution (valid only for executable targets)
This is a base class for all classes needing compilation parameters.
static wxUniChar GetPathSeparator(wxPathFormat format=wxPATH_NATIVE)
virtual void SetWorkingDir(const wxString &dirname)
Set the target&#39;s working dir on execution (valid only for executable targets)
virtual int ShowModal()
wxString wxEmptyString
#define wxOK
virtual int Configure(cbProject *project, ProjectBuildTarget *target=nullptr)=0
Display configuration dialog.
void SelectWildCard(const wxString &wild, bool select=true, bool clearOld=false)
void NotifyPlugins(CodeBlocksEvent &event)
const DLLIMPORT wxString NATIVE_EXT
EVTIMPORT const wxEventType cbEVT_PROJECT_TARGETS_MODIFIED
Definition: sdk_events.cpp:108
virtual void SetCreateStaticLib(bool createIt)
Set if an import library should be created.
MacrosManager * GetMacrosManager() const
Definition: manager.cpp:454
No automatic generation; let the user specify the full filename.
virtual void SetItemText(const wxTreeItemId &item, const wxString &text)
const wxString & _(const wxString &string)
void ReplaceMacros(wxString &buffer, ProjectBuildTarget *target=nullptr, bool subrequest=false)
Base class for plugin configuration panels.
wxEventType wxEVT_KEY_DOWN
void OnCopyBuildTargetClick(wxCommandEvent &event)
int GetBuildTargetsCount()
Definition: cbproject.h:200
void SetMakefile(const wxString &makefile)
Set the Makefile filename used when exporting a Makefile for the project, or when using a custom Make...
Definition: cbproject.h:148
virtual int GetSelection() const
bool IsChecked() const
Target produces a static library.
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
Definition: cbproject.cpp:1392
virtual void Expand(const wxTreeItemId &item)
const DLLIMPORT wxString EXECUTABLE_EXT
Abstract base class for compilers.
Definition: compiler.h:274
void OnKeyDown(wxKeyEvent &event)
void OnBuildTargetChanged(wxCommandEvent &event)
virtual void RemoveBuildScript(const wxString &script)
wxString libPrefix
Definition: compiler.h:223
void OnFileMarkOffClick(wxCommandEvent &event)
bool IsEmpty() const
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
Definition: globals.cpp:1177
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
void SetProject(cbProject *project)
Definition: sdk_events.h:42
virtual const wxString & GetCompilerID() const
Read the target&#39;s compiler.
static const size_t npos
Target produces a console executable (without GUI) (distinction between ttExecutable and ttConsoleOnl...
void OnBrowseDefinitionFileFilenameClick(wxCommandEvent &event)
void Log(const wxString &msg, int i=app_log, Logger::level lv=Logger::info)
Definition: logmanager.h:140
wxString GetFullName() const
bool ControlDown() const
void OnProjectBuildOptionsClick(wxCommandEvent &event)
virtual const CompilerSwitches & GetSwitches() const
Get the compiler&#39;s generic switches.
Definition: compiler.h:301
int ShowModal() override
void SetTargetType(TargetType pt) override
Set the target&#39;s type to pt.
void SetExt(const wxString &ext)
void DoTargetChange(bool saveOld=true)
void OnUpdateUI(wxUpdateUIEvent &event)
void OnScriptsOverviewSelChanged(wxTreeEvent &event)
wxString & Prepend(const wxString &str)
cbCompilerPlugin * GetFirstCompiler() const
virtual wxTreeItemId AddRoot(const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
size_t Add(const wxString &str, size_t copies=1)
bool HasVirtualBuildTarget(const wxString &alias) const
Does a virtual build target exist?
Definition: cbproject.cpp:1470
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
void SetTitle(const wxString &title) override
Changes project title.
Definition: cbproject.cpp:1650
Represents a Code::Blocks project build target.
bool Normalize(int flags=wxPATH_NORM_ALL, const wxString &cwd=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
void SetExtendedObjectNamesGeneration(bool ext)
Sets object names generation to extended/normal mode.
Definition: cbproject.cpp:1565
virtual wxTreeItemId GetRootItem() const
size_t GetCount() const
void OnVirtualTargets(wxCommandEvent &event)
DLLIMPORT int GetPlatformsFromString(const wxString &platforms)
Return an integer representation of a platform string.
Definition: globals.cpp:73
static wxXmlResource * Get()
virtual void SetTargetType(TargetType pt)
Set the target&#39;s type to pt.
void SetNotes(const wxString &notes)
Set notes on the project.
Definition: cbproject.cpp:1591
ProjectBuildTarget * AddBuildTarget(const wxString &targetName)
Add a new build target.
Definition: cbproject.cpp:1150
ScriptingManager * GetScriptingManager() const
Definition: manager.cpp:469
void RemoveAt(size_t nIndex, size_t count=1)
void AddBuildTarget(const wxString &targetName)
Make this file belong to an additional build target.
Definition: projectfile.cpp:78
int Printf(const wxString &pszFormat,...)
void SetName(const wxString &name)
virtual wxString GetObjectOutput() const
Read the target&#39;s objects output dir.
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
TargetType
Enum to define the type of output the target produces.
void SetParentDialog(wxWindow *dialog)
Sets the panel&#39;s parent dialog.
bool LoadBuffer(const wxString &buffer, const wxString &debugName=_T("CommandLine"))
Loads a string buffer.
virtual void SetValue(bool state)
bool RemoveBuildTarget(int index)
Remove a build target.
Definition: cbproject.cpp:1284
virtual wxString GetDynamicLibDefFilename()
Read the target&#39;s dynamic library definition file filename (produced if target type is ttDynamicLib) ...
virtual void SetBuildScripts(const wxArrayString &scripts)
void OnFileMarkOnClick(wxCommandEvent &event)
void SetMakefileExecutionDir(const wxString &dir)
Allow the specification of specific execution directory if the project use a custom Makefile...
Definition: cbproject.cpp:1004
Definition: globals.h:161
void OnFileToggleMarkClick(wxCommandEvent &event)
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
ConfigurationPanelsArray m_PluginPanels
Dialog that contains a "Don&#39;t annoy me" checkbox.
virtual unsigned int GetCount() const
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
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
bool RenameBuildTarget(int index, const wxString &targetName)
Rename a build target.
Definition: cbproject.cpp:1178
wxArrayString buildTargets
An array of strings, containing the names of all the build targets this file belongs to...
Definition: projectfile.h:190
bool ExportTargetAsProject(int index)
Export a target as a new project.
Definition: cbproject.cpp:1246
Base class for build target classes Each Code::Blocks project consists of at least one target...
Target only runs commands in pre-build and/or post-build steps.