35 #if wxCHECK_VERSION(3, 0, 0) 132 void UpdateChoices();
136 DECLARE_EVENT_TABLE()
154 wxString package = variable.AfterLast(wxT('#')).BeforeFirst(wxT('.')).MakeLower();
174 msg.
Printf(
_(
"In the currently active set, Code::Blocks does not know\n" 175 "the global compiler variable \"%s\".\n\n" 176 "Please define it."), package.
wx_str());
185 if (member.IsEmpty() || member.IsSameAs(
cBase))
188 if (member.IsSameAs(
cInclude) || member.IsSameAs(
cLib) || member.IsSameAs(
cObj) || member.IsSameAs(
cBin))
190 wxString ret = m_CfgMan->Read(path + member);
192 ret = base +
_T(
'/') + member;
197 wxString ret = m_CfgMan->Read(path + member, wtf);
201 msg.
Printf(
_(
"In the currently active set, Code::Blocks does not know\n" 202 "the member \"%s\" of the global compiler variable \"%s\".\n\n" 203 "Please define it."), member.
wx_str(), package.wx_str());
218 if (!m_CfgMan->Exists(
cSets + m_ActiveSet +
_T(
'/') + member +
_T(
"/base")) &&
221 m_Preempted.Add(member);
231 return !m_CfgMan->Exists(
cSets + m_ActiveSet +
_T(
'/') + member +
_T(
"/base"));
236 if (m_Preempted.GetCount() == 0)
243 for (
unsigned int i = 0; i < m_Preempted.GetCount(); ++i)
246 peList << m_Preempted[i] <<
_T(
'\n');
251 if (m_Preempted.GetCount() == 1)
252 msg.
Printf(
_(
"In the currently active set, Code::Blocks does not know\n" 253 "the global compiler variable \"%s\".\n\n" 254 "Please define it."), peList.
wx_str());
256 msg.
Printf(
_(
"In the currently active set, Code::Blocks does not know\n" 257 "the following global compiler variables:\n" 259 "Please define them."), peList.
wx_str());
263 InfoWindow::Display(
_(
"Global Compiler Variables"), msg , 8000 + 800*m_Preempted.GetCount(), 100);
278 m_ActiveSet = cfgman_gcv->
Read(
_T(
"/active"));
280 if (!m_ActiveSet.IsEmpty())
283 m_ActiveSet =
_T(
"default");
284 cfgman_gcv->
Exists(
_T(
"/sets/default/foo"));
285 cfgman_gcv->
Write(
_T(
"/active"), m_ActiveSet);
292 for (
unsigned int i = 0; i < vars.
GetCount(); ++i)
294 vars[i].Prepend(
_T(
'/'));
297 for (
unsigned j = 0; j < members.
GetCount(); ++j)
299 oldpath.
assign(vars[i] +
_T(
"/") + members[j]);
300 newpath.
assign(
_T(
"/sets/default") + vars[i] +
_T(
"/") + members[j]);
302 cfgman_gcv->
Write(newpath, cfgman_old->
Read(oldpath));
342 var[0] = tmp.Before(
'.');
343 var[1] = tmp.After(
'.');
345 wxTreeItemIdValue cookie;
384 for (wxArrayString::iterator var_itr = vars.begin(); var_itr != vars.end() ; ++var_itr)
389 for (wxArrayString::iterator subItr = subItems.begin(); subItr != subItems.end() ; ++subItr)
458 m_CurrentSet(
Manager::Get()->GetConfigManager(_T("gcv"))->Read(_T("/active"))),
462 m_SelSet = XRCCTRL(*
this,
"selSet",
wxChoice);
463 m_SelVar = XRCCTRL(*
this,
"selVar",
wxListBox);
464 m_DeleteSet = XRCCTRL(*
this,
"deleteSet",
wxButton);
467 m_Include = XRCCTRL(*
this,
"include",
wxTextCtrl);
477 for (
unsigned int i = 0; i < 7; ++i)
487 m_CfgMan->
Exists(
_T(
"/sets/default/foo"));
503 wxTextEntryDialog d(
this,
_(
"Please specify a name for the new clone:"),
_(
"Clone Variable"));
514 wxString srcPath(
_T(
"/sets/") + m_CurrentSet +
_T(
'/') + m_CurrentVar +
_T(
'/'));
515 wxString dstPath(
_T(
"/sets/") + m_CurrentSet +
_T(
'/') + clone +
_T(
'/'));
517 wxArrayString existing = m_CfgMan->EnumerateSubPaths(
_T(
"/sets/" + m_CurrentSet));
522 msg.
Printf(
_(
"Cowardly refusing to overwrite existing variable \"%s\"."), clone.
wx_str());
529 for (
unsigned j = 0; j < members.
GetCount(); ++j)
530 m_CfgMan->Write(dstPath + members[j], m_CfgMan->Read(srcPath + members[j]));
532 m_CurrentVar = clone;
554 msg.
Printf(
_(
"Cowardly refusing overwrite existing set \"%s\"."), clone.
wx_str());
565 for (
unsigned int i = 0; i < vars.
GetCount(); ++i)
567 wxArrayString members = m_CfgMan->EnumerateKeys(srcPath + vars[i]);
569 for (
unsigned j = 0; j < members.
GetCount(); ++j)
571 wxString item = vars[i] +
_T(
"/") + members[j];
572 m_CfgMan->Write(dstPath + item, m_CfgMan->Read(srcPath + item));
575 m_CurrentSet = clone;
584 msg.
Printf(
_(
"Delete the global compiler variable \"%s\" from this set?"), m_CurrentVar.
wx_str());
589 m_CfgMan->DeleteSubPath(
cSets + m_CurrentSet +
_T(
'/') + m_CurrentVar +
_T(
'/'));
599 msg.
Printf(
_(
"Do you really want to delete the entire\n" 600 "global compiler variable set \"%s\"?\n\n" 601 "This cannot be undone."), m_CurrentSet.
wx_str());
606 m_CfgMan->DeleteSubPath(
cSets + m_CurrentSet +
_T(
'/'));
619 m_CfgMan->Exists(
_T(
"/sets/") + m_CurrentSet +
_T(
'/') + name +
_T(
'/'));
636 for (
unsigned int i = 0; i < s.
length(); ++i)
652 wxTextEntryDialog d(
this,
_(
"Please specify a name for the new variable:"),
_(
"New Variable"));
675 m_CfgMan->Exists(
_T(
"/sets/") + name +
_T(
'/'));
686 m_CurrentVar = m_SelVar->GetStringSelection();
693 m_CurrentSet = m_SelSet->GetStringSelection();
694 m_CfgMan->Write(
_T(
"/active"), m_CurrentSet);
702 m_DeleteSet->Enable(!m_CurrentSet.IsSameAs(
_T(
"default")));
717 for (
unsigned int i = 0; i < 7; ++i)
723 for (
unsigned int i = 0; i < knownMembers.
GetCount(); ++i)
725 m_Name[i]->SetValue(knownMembers[i].Lower());
726 m_Value[i]->SetValue(m_CfgMan->Read(path + knownMembers[i]));
735 m_CfgMan->DeleteSubPath(path);
743 && ( ( !m_CurrentVar.IsEmpty()
747 if (
cbMessageBox(
_(
"Are you sure you want to save an invalid global variable?"),
_(
"Global variables"),
761 for (
unsigned int i = 0; i < 7; ++i)
763 s = m_Name[i]->GetValue();
764 t = m_Value[i]->GetValue();
770 m_CfgMan->Write(path + s, t);
776 if (m_CurrentSet.IsEmpty())
777 m_CurrentSet =
_T(
"default");
785 m_SelSet->Append(sets);
787 m_SelVar->Append(vars);
789 if (m_CurrentVar.IsEmpty() && m_SelVar->GetCount() > 0)
790 m_CurrentVar = m_SelVar->GetString(0);
792 m_SelSet->SetStringSelection(m_CurrentSet);
793 m_SelVar->SetStringSelection(m_CurrentVar);
800 int id =
event.GetId();
802 if (
id == XRCID(
"fs1"))
804 else if (
id == XRCID(
"fs2"))
806 else if (
id == XRCID(
"fs3"))
808 else if (
id == XRCID(
"fs4"))
810 else if (
id == XRCID(
"fs5"))
813 cbThrow(
_T(
"Encountered invalid button ID"));
virtual wxTreeItemId GetNextChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
void Preempt(const wxString &variable)
wxString AfterLast(wxUniChar ch) const
static void Display(const wxString &title, const wxString &message, unsigned int delay=5000, unsigned int hysteresis=1)
void EndModal(int retCode)
bool Exists(const wxString &variable) const
const wxString cLib(_T("lib"))
const wxString cCflags(_T("cflags"))
const wxString cLflags(_T("lflags"))
const wxChar cSlash(_T('/'))
virtual wxTreeItemId GetItemParent(const wxTreeItemId &item) const
const wxArrayString builtinMembers((size_t) 7, bim)
ConfigManager * GetConfigManager(const wxString &name_space) const
UserVariableManager * GetUserVariableManager() const
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
void SelectSet(wxCommandEvent &event)
virtual void DeleteAllItems()
void CloseHandler(cb_unused wxCloseEvent &event)
const wxString cSets(_T("/sets/"))
void OnOK(cb_unused wxCommandEvent &event)
DLLIMPORT wxString ChooseDirectory(wxWindow *parent, const wxString &message=_("Select directory"), const wxString &initialPath=_T(""), const wxString &basePath=_T(""), bool askToMakeRelative=false, bool showCreateDirButton=false)
void OnActivated(wxTreeEvent &event)
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
wxString GetSelectedVariable()
void SelectVar(wxCommandEvent &event)
const wxString cBase(_T("base"))
virtual wxTreeItemId GetSelection() const
virtual void EnsureVisible(const wxTreeItemId &item)
wxString Replace(const wxString &variable)
const wxString cInclude(_T("include"))
void SetValue(WatchesProperty *prop)
void DeleteSet(wxCommandEvent &event)
wxString BeforeLast(wxUniChar ch, wxString *rest=NULL) const
void OnOK(cb_unused wxCommandEvent &event)
bool IsLoading()
Check if the project manager is loading a project/workspace.
void SetSashGravity(double gravity)
virtual wxString GetItemText(const wxTreeItemId &item) const
void NewSet(wxCommandEvent &event)
wxString AfterFirst(wxUniChar ch) const
size_t find(const wxString &str, size_t nStart=0) const
const wxString cDir(_T("dir"))
void LogError(const wxString &msg, int i=app_log)
void DeleteVar(wxCommandEvent &event)
wxUSE_UNICODE_dependent wxChar
void CloneSet(wxCommandEvent &event)
wxString BeforeFirst(wxUniChar ch, wxString *rest=NULL) const
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
virtual wxTreeItemId GetFirstChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
bool Contains(const wxString &str) const
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
void Sanitise(wxString &s)
void NewVar(wxCommandEvent &event)
void OnCancel(cb_unused wxCommandEvent &event)
wxArrayString EnumerateSubPaths(const wxString &path)
bool Exists(const wxString &name)
void OnFS(wxCommandEvent &event)
wxString GetVariable(wxWindow *parent, const wxString &old)
virtual void SelectItem(const wxTreeItemId &item, bool select=true)
#define wxCHECK_VERSION(major, minor, release)
bool IsSameAs(const wxString &s, bool caseSensitive=true) const
LogManager * GetLogManager() const
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
const wxStringCharType * wx_str() const
wxString & assign(const wxString &str, size_t pos, size_t n)
const wxString & _(const wxString &string)
wxString & Trim(bool fromRight=true)
const wxString cObj(_T("obj"))
bool wxIsalnum(const wxUniChar &c)
void SetMinSize(wxPropertyGrid *grid)
virtual void Expand(const wxTreeItemId &item)
void Help(wxCommandEvent &event)
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
wxString & Prepend(const wxString &str)
GetUserVariableDialog(wxWindow *parent, const wxString &old)
const wxString cBin(_T("bin"))
virtual wxTreeItemId AddRoot(const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
const wxString cSlashBase(_T("/base"))
void Sort(bool reverseOrder=false)
virtual wxTreeItemId GetRootItem() const
void AddVar(const wxString &var)
static wxXmlResource * Get()
wxUniChar GetChar(size_t n) const
void OnConfig(cb_unused wxCommandEvent &event)
void OnCancel(cb_unused wxCommandEvent &event)
bool wxLaunchDefaultBrowser(const wxString &url, int flags=0)
void RemoveAt(size_t nIndex, size_t count=1)
int Printf(const wxString &pszFormat,...)
wxArrayString EnumerateKeys(const wxString &path)
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
Dialog that contains a "Don't annoy me" checkbox.
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
void CloneVar(wxCommandEvent &event)