85 : m_Template(
nullptr),
107 XRCCTRL(*
this,
"rbView",
wxRadioBox)->SetSelection(
Manager::Get()->GetConfigManager(
_T(
"new_from_template"))->ReadInt(
_T(
"/view"), 0));
114 XRCCTRL(*
this,
"lstUser",
wxListBox)->Clear();
115 for (
unsigned int i = 0; i < user_templates.GetCount(); ++i)
117 XRCCTRL(*
this,
"lstUser",
wxListBox)->Append(user_templates[i]);
149 ClearListFor(XRCCTRL(*
this,
"listProjects",
wxListCtrl));
150 ClearListFor(XRCCTRL(*
this,
"listTargets",
wxListCtrl));
151 ClearListFor(XRCCTRL(*
this,
"listFiles",
wxListCtrl));
152 ClearListFor(XRCCTRL(*
this,
"listCustoms",
wxListCtrl));
171 BuildCategoriesFor(
totFiles, XRCCTRL(*
this,
"cmbFileCategories",
wxChoice));
180 cat->Append(
_(
"<All categories>"));
183 for (
unsigned int i = 0; i < m_Wizards.GetCount(); ++i)
186 for (
int w = 0; w < plugin->
GetCount(); ++w)
198 #if wxCHECK_VERSION(3, 0, 0) 201 inline int wxCALLBACK
SortTemplates(
long item1,
long item2, cb_unused
long sortData)
216 return name1.CompareTo(name2.
wx_str());
241 for (
unsigned int i = 0; i < m_Wizards.GetCount(); ++i)
244 for (
int w = 0; w < plugin->
GetCount(); ++w)
284 case 0:
return XRCCTRL(*
this,
"listProjects",
wxListCtrl);
285 case 1:
return XRCCTRL(*
this,
"listTargets",
wxListCtrl);
286 case 2:
return XRCCTRL(*
this,
"listFiles",
wxListCtrl);
287 case 3:
return XRCCTRL(*
this,
"listCustoms",
wxListCtrl);
288 default:
return nullptr;
299 case 0:
return XRCCTRL(*
this,
"cmbProjectCategories",
wxChoice);
300 case 1:
return XRCCTRL(*
this,
"cmbTargetCategories",
wxChoice);
301 case 2:
return XRCCTRL(*
this,
"cmbFileCategories",
wxChoice);
302 case 3:
return XRCCTRL(*
this,
"cmbCustomCategories",
wxChoice);
303 default:
return nullptr;
343 XRCCTRL(*
this,
"lstUser",
wxListBox)->GetSelection() != -1;
348 int sel = XRCCTRL(*
this,
"lstUser",
wxListBox)->GetSelection();
349 return sel != -1 ? XRCCTRL(*
this,
"lstUser",
wxListBox)->GetString(sel) :
_T(
"");
358 bool first_time =
false;
386 int sel = XRCCTRL(*
this,
"rbView",
wxRadioBox)->GetSelection();
389 XRCCTRL(*
this,
"listProjects",
wxListCtrl)->SetSingleStyle(style);
390 XRCCTRL(*
this,
"listTargets",
wxListCtrl)->SetSingleStyle(style);
391 XRCCTRL(*
this,
"listFiles",
wxListCtrl)->SetSingleStyle(style);
392 XRCCTRL(*
this,
"listCustoms",
wxListCtrl)->SetSingleStyle(style);
414 menu->
Append(idEditWizardScript,
_(
"Edit this script"));
420 menu->
Append(idDiscardWizardScript,
_(
"Discard modifications of this script"));
421 menu->
Append(idInfoWizardScript,
_(
"Why is this script marked red?"));
425 menu->
Append(idEditGlobalWizardScript,
_(
"Edit global registration script"));
426 list->PopupMenu(menu);
437 BuildListFor(GetVisibleOutputType(), GetVisibleListCtrl(), GetVisibleCategory());
468 if (
cbMessageBox(
_(
"Are you sure you want to discard all local modifications to this script?"),
479 cbMessageBox(
_(
"Any changes you make to the global wizard registration script will " 480 "take effect after you restart Code::Blocks."),
482 EditScript(
_T(
"config.script"));
492 cbMessageBox(
_(
"When you edit a wizard's script, you actually edit a copy of it which " 493 "is automatically placed inside your user configuration directory.\n" 494 "This means that if a new version of the script is released, Code::Blocks " 495 "will still use your customized script, not the globally installed version.\n\n" 496 "These customized wizard scripts are coloured red just to remind you " 497 "that they are exactly that: customized scripts.\n" 498 "So, if you update your Code::Blocks copy and find that an updated wizard's " 499 "behaviour doesn't change, check if you have customized it. If you have, " 500 "the only way to re-enable the globally installed script is to remove " 501 "the customized one.\n\n" 502 "On this computer, the customized scripts are located under:\n") +
513 XRCCTRL(*
this,
"wxID_OK",
wxButton)->Enable((page != lb->
GetPageCount() - 1 && GetSelectedTemplate()) || SelectedUserTemplate());
519 int sel = XRCCTRL(*
this,
"rbView",
wxRadioBox)->GetSelection();
522 GetSelectedTemplate();
void EndModal(int retCode)
void OnViewChange(wxCommandEvent &event)
static wxString GetFolder(SearchDirs dir)
Access one of Code::Blocks' folders.
bool Matches(const wxString &mask) const
PluginManager * GetPluginManager() const
bool wxRemoveFile(const wxString &file)
virtual int GetSelection() const=0
Data folder in user's dir.
ConfigManager * GetConfigManager(const wxString &name_space) const
void ClearListFor(wxListCtrl *list)
wxChoice * GetVisibleCategory()
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
void EditScript(const wxString &filename)
long GetNextItem(long item, int geometry=wxLIST_NEXT_ALL, int state=wxLIST_STATE_DONTCARE) const
virtual wxString GetScriptFilename(int index) const =0
void OnListRightClick(wxListEvent &event)
ProjectTemplateLoader * pt
bool SelectedUserTemplate() const
virtual int GetSelection() const
void EndModal(int retCode) override
wxString GetSelectedUserTemplate() const
bool wxFileExists(const wxString &filename)
virtual wxString GetTitle(int index) const =0
~NewFromTemplateDlg() override
static int idEditGlobalWizardScript
void OnListActivate(wxListEvent &event)
virtual size_t GetPageCount() const
#define wxLIST_STATE_SELECTED
cbWizardPlugin * GetSelectedTemplate()
void OnCategoryChanged(wxCommandEvent &event)
#define wxICON_INFORMATION
void SetModified(bool modified=true) override
Set the editor's modification state to modified.
virtual wxString GetCategory(int index) const =0
void OnDiscardScript(wxCommandEvent &event)
virtual int SetSelection(size_t page)=0
wxListCtrl * GetVisibleListCtrl()
EditorManager * GetEditorManager() const
template produces custom output (entirely up to the wizard used)
ListItemData(ProjectTemplateLoader *t=nullptr, cbWizardPlugin *p=nullptr, int i=0)
long InsertItem(wxListItem &info)
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
template outputs a new file (or files)
bool SetItemData(long item, long data)
cbStyledTextCtrl * GetControl() const
Returns a pointer to the underlying cbStyledTextCtrl object (which itself is the wxWindows implementa...
static int idInfoWizardScript
void BuildListFor(TemplateOutputType otype, wxListCtrl *list, const wxChoice *cat)
virtual const wxBitmap & GetBitmap(int index) const =0
virtual int GetCount() const =0
void SetItemTextColour(long item, const wxColour &col)
void OnUpdateUI(wxUpdateUIEvent &event)
virtual void SetFilename(const wxString &filename)
Sets the editor's filename.
static wxColour GetColour(wxSystemColour index)
void BuildCategoriesFor(TemplateOutputType otype, wxChoice *cat)
const wxStringCharType * wx_str() const
int wxCALLBACK SortTemplates(wxIntPtr item1, wxIntPtr item2, cb_unused wxIntPtr sortData)
void OnEditScript(wxCommandEvent &event)
virtual TemplateOutputType GetOutputType(int index) const =0
cbEditor * Open(const wxString &filename, int pos=0, ProjectFile *data=nullptr)
ListItemData(const ListItemData &rhs)
const wxString & _(const wxString &string)
TemplateOutputType
Template output types.
bool SortItems(wxListCtrlCompare fnSortCallBack, wxIntPtr data)
wxUIntPtr GetItemData(long item) const
template adds a new target in a project
DLLIMPORT void SetSettingsIconsStyle(wxListCtrl *lc, SettingsIconsStyle style)
Set the icons style for the supplied list control.
void OnHelp(wxCommandEvent &event)
TemplateOutputType GetVisibleOutputType() const
PluginsArray GetOffersFor(PluginType type)
int Add(const wxBitmap &bitmap, const wxBitmap &mask=wxNullBitmap)
template outputs a new project
static wxXmlResource * Get()
DLLIMPORT bool CreateDirRecursively(const wxString &full_path, int perms=0755)
Base class for wizard plugins.
static int idDiscardWizardScript
virtual void SetSelection(int n)
wxListView * GetListView() const
static int idEditWizardScript
wxImageList * GetImageList(int which) const
void OnEditGlobalScript(wxCommandEvent &event)
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
virtual int FindString(const wxString &s, bool bCase=false) const