wxString FilesGroupsAndMasks::GetFileMasks(unsigned int group) const { if (group >= m_Groups.GetCount()) return wxEmptyString; const FileGroups* fg = m_Groups[group]; return GetStringFromArray(fg->fileMasks); }
void AdvancedCompilerOptionsDlg::ReadExtensions(int nr) { wxChoice* cmb = XRCCTRL(*this, "lstExt", wxChoice); cmb->Clear(); for (size_t i = 0; i < m_Commands[nr].size(); ++i) cmb->Append(GetStringFromArray(m_Commands[nr][i].extensions, DEFAULT_ARRAY_SEP, false)); cmb->SetSelection(cmb->FindString(wxEmptyString)); }
wxString FilesGroupsAndMasks::GetFileMasks(unsigned int group) const { if (group >= m_Groups.GetCount()) return wxEmptyString; const FileGroups* fg = m_Groups[group]; // Clean-up file masks that appear twice or more return GetStringFromArray( MakeUniqueArray(fg->fileMasks, false) ); }
wxString ExecuteAndGetOutput(const wxString& command) { if (!SecurityAllows(_T("Execute"), command)) return wxEmptyString; wxArrayString output; wxExecute(command, output, wxEXEC_NODISABLE); return GetStringFromArray(output, _T("\n")); }
wxString ExecuteAndGetOutputAndError(const wxString& command, bool prepend_error = true) { if (!SecurityAllows(_T("Execute"), command)) return wxEmptyString; wxArrayString output; wxArrayString error; wxExecute(command, output, error, wxEXEC_NODISABLE); wxString str_out; if ( prepend_error && !error.IsEmpty()) str_out += GetStringFromArray(error, _T("\n")); if (!output.IsEmpty()) str_out += GetStringFromArray(output, _T("\n")); if (!prepend_error && !error.IsEmpty()) str_out += GetStringFromArray(error, _T("\n")); return str_out; }
wxString ExpandBackticks(wxString& str) // backticks are written in-place to str { wxString ret; // this function is not windows-only anymore because we parse the backticked command's output // for compiler/linker search dirs size_t start = str.find(_T('`')); if (start == wxString::npos) return ret; // no backticks here size_t end = str.find(_T('`'), start + 1); if (end == wxString::npos) return ret; // no ending backtick; error? while (start != wxString::npos && end != wxString::npos) { wxString cmd = str.substr(start + 1, end - start - 1); cmd.Trim(true); cmd.Trim(false); if (cmd.IsEmpty()) break; wxString bt; BackticksMap::iterator it = m_Backticks.find(cmd); if (it != m_Backticks.end()) // in the cache :) bt = it->second; else { Manager::Get()->GetLogManager()->DebugLog(F(_T("Caching result of `%s`"), cmd.wx_str())); wxArrayString output; if (platform::WindowsVersion() >= platform::winver_WindowsNT2000) wxExecute(_T("cmd /c ") + cmd, output, wxEXEC_NODISABLE); else wxExecute(cmd, output, wxEXEC_NODISABLE); bt = GetStringFromArray(output, _T(" "), false); // add it in the cache m_Backticks[cmd] = bt; Manager::Get()->GetLogManager()->DebugLog(_T("Cached")); } ret << bt << _T(' '); str = str.substr(0, start) + bt + str.substr(end + 1, wxString::npos); // find next occurrence start = str.find(_T('`')); end = str.find(_T('`'), start + 1); } return ret; // return a list of the replaced expressions }
void FilesGroupsAndMasks::Save() { ConfigManager* conf = Manager::Get()->GetConfigManager(_T("project_manager")); conf->DeleteSubPath(_T("/file_groups")); for (unsigned int i = 0; i < m_Groups.GetCount(); ++i) { FileGroups* fg = m_Groups[i]; wxString key; key << _T("/file_groups/group") << wxString::Format(_T("%d"), i) << _T("/") << _T("name"); conf->Write(key, fg->groupName); key.Clear(); key << _T("/file_groups/group") << wxString::Format(_T("%d"), i) << _T("/") << _T("mask"); conf->Write(key, GetStringFromArray(fg->fileMasks, _T(";"))); } }
void AdvancedCompilerOptionsDlg::SaveCommands(int cmd, int ext) { if (cmd == -1 || ext == -1) return; if (CompilerTool* tool = GetCompilerTool(cmd, ext)) { wxTextCtrl* text = XRCCTRL(*this, "txtCommand", wxTextCtrl); wxTextCtrl* gen = XRCCTRL(*this, "txtGenerated", wxTextCtrl); if (text->GetValue() != tool->command) // last command was changed; save it tool->command = text->GetValue(); wxString gens = GetStringFromArray(tool->generatedFiles, _T("\n"), false); if (gen->GetValue() != gens) // last genfiles are changed; save it tool->generatedFiles = GetArrayFromString(gen->GetValue(), _T("\n")); } }
void AdvancedCompilerOptionsDlg::DisplayCommand(int cmd, int ext) { wxTextCtrl* text = XRCCTRL(*this, "txtCommand", wxTextCtrl); wxTextCtrl* gen = XRCCTRL(*this, "txtGenerated", wxTextCtrl); if (CompilerTool* tool = GetCompilerTool(cmd,ext)) { text->SetValue(tool->command); gen->SetValue(GetStringFromArray(tool->generatedFiles, _T("\n"), false)); } else { text->Clear(); gen->Clear(); } m_LastCmdIndex = cmd; m_LastExtIndex = ext; } // end of DisplayCommand
void DebuggerTree::BuildTreeCDB(Watch* watch, const wxString& infoText) { //Local variables // hThisInstance = 0x00400000 // hPrevInstance = 0x00000000 // lpszArgument = 0x00151ef5 "" // nCmdShow = 10 // hwnd = 0x7ffd8000 // messages = struct tagMSG // wincl = struct tagWNDCLASSEXA wxTreeItemId parent = m_pTree->GetRootItem(); wxTreeItemId node = parent; wxArrayString lines = GetArrayFromString(infoText, _T('\n'), false); for (unsigned int i = 0; i < lines.GetCount(); ++i) { size_t thiscol = lines[i].find_first_not_of(_T(" \t")); size_t nextcol = i < lines.GetCount() - 1 ? lines[i + 1].find_first_not_of(_T(" \t")) : wxString::npos; bool opbrace = false; bool clbrace = false; if (thiscol < nextcol) { // add child node parent = node; opbrace = true; } else if (thiscol > nextcol) { // go one level up parent = m_pTree->GetItemParent(parent); clbrace = true; } if (opbrace) lines[i].Append(_T(" = {")); if (clbrace) lines[i].Append(_T("}")); } wxString str = GetStringFromArray(lines, _T(",")); ParseEntry(m_RootEntry, watch, str); }
DirListDlg::DirListDlg(wxWindow* parent,wxWindowID id) { //(*Initialize(DirListDlg) wxButton* Button1; wxButton* Button2; wxStaticBoxSizer* StaticBoxSizer1; Create(parent, id, _("List of directories with libraries"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0); StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Scanned directories:")); DirList = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxSize(292,194), wxTE_MULTILINE, wxDefaultValidator, _T("ID_TEXTCTRL1")); StaticBoxSizer1->Add(DirList, 1, wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1 = new wxBoxSizer(wxVERTICAL); Button1 = new wxButton(this, ID_BUTTON1, _("Add dir"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); BoxSizer1->Add(Button1, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL, 5); Button2 = new wxButton(this, ID_BUTTON2, _("Clear All"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); BoxSizer1->Add(Button2, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL, 5); StaticBoxSizer1->Add(BoxSizer1, 0, wxALIGN_TOP, 0); FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer2 = new wxBoxSizer(wxHORIZONTAL); Button3 = new wxButton(this, ID_BUTTON3, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); BoxSizer2->Add(Button3, 1, wxBOTTOM|wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5); Button4 = new wxButton(this, ID_BUTTON4, _("Next"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); Button4->SetDefault(); BoxSizer2->Add(Button4, 1, wxBOTTOM|wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(BoxSizer2, 1, wxALIGN_CENTER_VERTICAL, 0); SetSizer(FlexGridSizer1); FlexGridSizer1->Fit(this); FlexGridSizer1->SetSizeHints(this); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&DirListDlg::OnButton1Click); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&DirListDlg::OnButton2Click); Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&DirListDlg::OnButton3Click); Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&DirListDlg::OnButton4Click); //*) ConfigManager* mgr = Manager::Get()->GetConfigManager( _T("lib_finder") ); wxArrayString DirsLoc = mgr->ReadArrayString(_T("search_dirs")); DirList->SetValue( GetStringFromArray(DirsLoc, _T("\n")) ); }
void EditPathDlg::OnBrowse(wxCommandEvent& /*event*/) { wxFileName path; wxArrayString multi; wxString val = XRCCTRL(*this, "txtPath", wxTextCtrl)->GetValue(); int idx = val.Find(DEFAULT_ARRAY_SEP); if (idx != -1) val.Remove(idx); wxFileName fname(val); if (m_WantDir) { // try to "decode" custom var wxString bkp = val; Manager::Get()->GetMacrosManager()->ReplaceEnvVars(val); fname = val; fname.MakeAbsolute(m_Basepath); m_Path = fname.GetFullPath(); path = ChooseDirectory(this, m_Message, (m_Path.IsEmpty() ? s_LastPath : m_Path), m_Basepath, false, m_ShowCreateDirButton); if (path.GetFullPath().IsEmpty()) return; // if it was a custom var, see if we can re-insert it if (bkp != val) { wxString tmp = path.GetFullPath(); if (tmp.Replace(val, bkp) != 0) { // done here XRCCTRL(*this, "txtPath", wxTextCtrl)->SetValue(tmp); return; } } } else { wxFileDialog dlg(this, m_Message, (fname.GetPath().IsEmpty() ? s_LastPath : fname.GetPath()), fname.GetFullName(), m_Filter, wxFD_CHANGE_DIR | (m_AllowMultiSel ? wxFD_MULTIPLE : 0) ); PlaceWindow(&dlg); if (dlg.ShowModal() == wxID_OK) { if (m_AllowMultiSel) dlg.GetPaths(multi); else path = dlg.GetPath(); } else return; } if (m_AllowMultiSel && multi.GetCount() != 0 && !multi[0].IsEmpty()) s_LastPath = multi[0]; else if (!path.GetFullPath().IsEmpty()) s_LastPath = path.GetFullPath(); wxString result; if (m_AskMakeRelative && !m_Basepath.IsEmpty()) { // ask the user if he wants it to be kept as relative if (cbMessageBox(_("Keep this as a relative path?"), _("Question"), wxICON_QUESTION | wxYES_NO, this) == wxID_YES) { if (m_AllowMultiSel) { for (unsigned int i = 0; i < multi.GetCount(); ++i) { path = multi[i]; path.MakeRelativeTo(m_Basepath); multi[i] = path.GetFullPath(); } result = GetStringFromArray(multi); } else { path.MakeRelativeTo(m_Basepath); result = path.GetFullPath(); } } else { if (m_AllowMultiSel) result = GetStringFromArray(multi); else result = path.GetFullPath(); } } else // always absolute path { if (m_AllowMultiSel) result = GetStringFromArray(multi); else result = path.GetFullPath(); } // finally set the path XRCCTRL(*this, "txtPath", wxTextCtrl)->SetValue(result); }
void Compiler::SaveSettings(const wxString& baseKey) { ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("compiler")); // save settings version cfg->Write(_T("settings_version"), CompilerSettingsVersion); wxString tmp; // delete old-style keys (using integer IDs) tmp.Printf(_T("%s/set%3.3d"), baseKey.c_str(), CompilerFactory::GetCompilerIndex(this) + 1); cfg->DeleteSubPath(tmp); tmp.Printf(_T("%s/%s"), baseKey.c_str(), m_ID.c_str()); cfg->Write(tmp + _T("/name"), m_Name); cfg->Write(tmp + _T("/parent"), m_ParentID, true); if (m_Mirror.CompilerOptions_ != m_CompilerOptions) { wxString key = GetStringFromArray(m_CompilerOptions); cfg->Write(tmp + _T("/compiler_options"), key, false); } if (m_Mirror.LinkerOptions != m_LinkerOptions) { wxString key = GetStringFromArray(m_LinkerOptions); cfg->Write(tmp + _T("/linker_options"), key, false); } if (m_Mirror.IncludeDirs != m_IncludeDirs) { wxString key = GetStringFromArray( MakeUniqueArray(m_IncludeDirs, true) ); cfg->Write(tmp + _T("/include_dirs"), key, false); } if (m_Mirror.ResIncludeDirs != m_ResIncludeDirs) { wxString key = GetStringFromArray( MakeUniqueArray(m_ResIncludeDirs, true) ); cfg->Write(tmp + _T("/res_include_dirs"), key, false); } if (m_Mirror.LibDirs != m_LibDirs) { wxString key = GetStringFromArray( MakeUniqueArray(m_LibDirs, true) ); cfg->Write(tmp + _T("/library_dirs"), key, false); } if (m_Mirror.LinkLibs != m_LinkLibs) { wxString key = GetStringFromArray(m_LinkLibs); cfg->Write(tmp + _T("/libraries"), key, false); } if (m_Mirror.CmdsBefore != m_CmdsBefore) { wxString key = GetStringFromArray(m_CmdsBefore); cfg->Write(tmp + _T("/commands_before"), key, true); } if (m_Mirror.CmdsAfter != m_CmdsAfter) { wxString key = GetStringFromArray(m_CmdsAfter); cfg->Write(tmp + _T("/commands_after"), key, true); } if (m_Mirror.MasterPath != m_MasterPath) cfg->Write(tmp + _T("/master_path"), m_MasterPath, true); if (m_Mirror.ExtraPaths != m_ExtraPaths) cfg->Write(tmp + _T("/extra_paths"), GetStringFromArray( MakeUniqueArray(m_ExtraPaths, true), _T(";") ), true); if (m_Mirror.Programs.C != m_Programs.C) cfg->Write(tmp + _T("/c_compiler"), m_Programs.C, true); if (m_Mirror.Programs.CPP != m_Programs.CPP) cfg->Write(tmp + _T("/cpp_compiler"), m_Programs.CPP, true); if (m_Mirror.Programs.LD != m_Programs.LD) cfg->Write(tmp + _T("/linker"), m_Programs.LD, true); if (m_Mirror.Programs.LIB != m_Programs.LIB) cfg->Write(tmp + _T("/lib_linker"), m_Programs.LIB, true); if (m_Mirror.Programs.WINDRES != m_Programs.WINDRES) cfg->Write(tmp + _T("/res_compiler"), m_Programs.WINDRES, true); if (m_Mirror.Programs.MAKE != m_Programs.MAKE) cfg->Write(tmp + _T("/make"), m_Programs.MAKE, true); if (m_Mirror.Programs.DBG != m_Programs.DBG) cfg->Write(tmp + _T("/debugger"), m_Programs.DBG, true); for (int i = 0; i < ctCount; ++i) { for (size_t n = 0; n < m_Commands[i].size(); ++n) { if (n >= m_Mirror.Commands[i].size() || m_Mirror.Commands[i][n] != m_Commands[i][n]) { wxString key = wxString::Format(_T("%s/macros/%s/tool%d/"), tmp.c_str(), CommandTypeDescriptions[i].c_str(), n); cfg->Write(key + _T("command"), m_Commands[i][n].command); cfg->Write(key + _T("extensions"), m_Commands[i][n].extensions); cfg->Write(key + _T("generatedFiles"), m_Commands[i][n].generatedFiles); } } } // switches if (m_Mirror.Switches.includeDirs != m_Switches.includeDirs) cfg->Write(tmp + _T("/switches/includes"), m_Switches.includeDirs, true); if (m_Mirror.Switches.libDirs != m_Switches.libDirs) cfg->Write(tmp + _T("/switches/libs"), m_Switches.libDirs, true); if (m_Mirror.Switches.linkLibs != m_Switches.linkLibs) cfg->Write(tmp + _T("/switches/link"), m_Switches.linkLibs, true); if (m_Mirror.Switches.defines != m_Switches.defines) cfg->Write(tmp + _T("/switches/define"), m_Switches.defines, true); if (m_Mirror.Switches.genericSwitch != m_Switches.genericSwitch) cfg->Write(tmp + _T("/switches/generic"), m_Switches.genericSwitch, true); if (m_Mirror.Switches.objectExtension != m_Switches.objectExtension) cfg->Write(tmp + _T("/switches/objectext"), m_Switches.objectExtension, true); if (m_Mirror.Switches.needDependencies != m_Switches.needDependencies) cfg->Write(tmp + _T("/switches/deps"), m_Switches.needDependencies); if (m_Mirror.Switches.forceCompilerUseQuotes != m_Switches.forceCompilerUseQuotes) cfg->Write(tmp + _T("/switches/forceCompilerQuotes"), m_Switches.forceCompilerUseQuotes); if (m_Mirror.Switches.forceLinkerUseQuotes != m_Switches.forceLinkerUseQuotes) cfg->Write(tmp + _T("/switches/forceLinkerQuotes"), m_Switches.forceLinkerUseQuotes); if (m_Mirror.Switches.logging != m_Switches.logging) cfg->Write(tmp + _T("/switches/logging"), m_Switches.logging); if (m_Mirror.Switches.libPrefix != m_Switches.libPrefix) cfg->Write(tmp + _T("/switches/libPrefix"), m_Switches.libPrefix, true); if (m_Mirror.Switches.libExtension != m_Switches.libExtension) cfg->Write(tmp + _T("/switches/libExtension"), m_Switches.libExtension, true); if (m_Mirror.Switches.linkerNeedsLibPrefix != m_Switches.linkerNeedsLibPrefix) cfg->Write(tmp + _T("/switches/linkerNeedsLibPrefix"), m_Switches.linkerNeedsLibPrefix); if (m_Mirror.Switches.linkerNeedsLibExtension != m_Switches.linkerNeedsLibExtension) cfg->Write(tmp + _T("/switches/linkerNeedsLibExtension"), m_Switches.linkerNeedsLibExtension); if (m_Mirror.Switches.forceFwdSlashes != m_Switches.forceFwdSlashes) cfg->Write(tmp + _T("/switches/forceFwdSlashes"), m_Switches.forceFwdSlashes); if (m_Mirror.Switches.supportsPCH != m_Switches.supportsPCH) cfg->Write(tmp + _T("/switches/supportsPCH"), m_Switches.supportsPCH); if (m_Mirror.Switches.PCHExtension != m_Switches.PCHExtension) cfg->Write(tmp + _T("/switches/pchExtension"), m_Switches.PCHExtension); if (m_Mirror.Switches.UseFlatObjects != m_Switches.UseFlatObjects) cfg->Write(tmp + _T("/switches/UseFlatObjects"), m_Switches.UseFlatObjects); if (m_Mirror.Switches.UseFullSourcePaths != m_Switches.UseFullSourcePaths) cfg->Write(tmp + _T("/switches/UseFullSourcePaths"), m_Switches.UseFullSourcePaths); if (m_Mirror.Switches.Use83Paths != m_Switches.Use83Paths) cfg->Write(tmp + _T("/switches/Use83Paths"), m_Switches.Use83Paths); // regexes cfg->DeleteSubPath(tmp + _T("/regex")); wxString group; for (size_t i = 0; i < m_RegExes.Count(); ++i) { if (i < m_Mirror.RegExes.GetCount() && m_Mirror.RegExes[i] == m_RegExes[i]) continue; group.Printf(_T("%s/regex/re%3.3d"), tmp.c_str(), i + 1); RegExStruct& rs = m_RegExes[i]; cfg->Write(group + _T("/description"), rs.desc, true); if (rs.lt != 0) cfg->Write(group + _T("/type"), rs.lt); cfg->Write(group + _T("/regex"), rs.regex, true); if (rs.msg[0] != 0) cfg->Write(group + _T("/msg1"), rs.msg[0]); if (rs.msg[1] != 0) cfg->Write(group + _T("/msg2"), rs.msg[1]); if (rs.msg[2] != 0) cfg->Write(group + _T("/msg3"), rs.msg[2]); if (rs.filename != 0) cfg->Write(group + _T("/filename"), rs.filename); if (rs.line != 0) cfg->Write(group + _T("/line"), rs.line); } // custom vars wxString configpath = tmp + _T("/custom_variables/"); cfg->DeleteSubPath(configpath); const StringHash& v = GetAllVars(); for (StringHash::const_iterator it = v.begin(); it != v.end(); ++it) cfg->Write(configpath + it->first, it->second); }
wxString cbAuiNotebook::SavePerspective(const wxString projectTitle) { // Build list of panes/tabs wxString tabs, tabsTmp; wxArrayString panes; // first get all tab-controls UpdateTabControlsArray(); wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); const size_t pane_count = all_panes.GetCount(); for (size_t i = 0; i < pane_count; ++i) { wxAuiPaneInfo& pane = all_panes.Item(i); if (pane.name == wxT("dummy")) continue; wxAuiTabCtrl* tabCtrl = nullptr; for (size_t j = 0; j < m_TabCtrls.GetCount(); ++j) { if (pane.window == GetTabFrameFromTabCtrl(m_TabCtrls.Item(j))) { tabCtrl = m_TabCtrls.Item(j); break; } } if (tabCtrl) { tabsTmp.Clear(); // add tab id's size_t page_count = tabCtrl->GetPageCount(); for (size_t p = 0; p < page_count; ++p) { wxAuiNotebookPage& page = tabCtrl->GetPage(p); const size_t page_idx = m_tabs.GetIdxFromWindow(page.window); wxString id = UniqueIdFromTooltip(GetPageToolTip(page_idx)); // file does not belong to any project, so don't save if (id.BeforeLast(':').empty()) continue; // if we save a project (projectTitle non empty), but file does not belong to the project // skip it if (!projectTitle.empty() && id.BeforeLast(':') != projectTitle) continue; if (!tabsTmp.empty()) tabsTmp += wxT(","); #if wxCHECK_VERSION(3, 0, 0) if ((int)page_idx == m_curPage) #else if ((int)page_idx == m_curpage) #endif tabsTmp += wxT("*"); else if ((int)p == tabCtrl->GetActivePage()) tabsTmp += wxT("+"); tabsTmp += wxString::Format(wxT("%lu"), static_cast<unsigned long>(page_idx)); tabsTmp += wxT(";"); tabsTmp += id; } if (!tabsTmp.empty()) { if (!tabs.empty()) tabs += wxT("|"); panes.Add(pane.name); tabs += pane.name; tabs += wxT("="); tabs += tabsTmp; } } } tabs += wxT("@"); tabsTmp = m_mgr.SavePerspective(); wxArrayString arTabsTmp = GetArrayFromString(tabsTmp, wxT("|")); for (size_t i = arTabsTmp.GetCount(); i > 0 ; ) { if (arTabsTmp.Item(--i).StartsWith(wxT("name="))) { wxString strTmp = arTabsTmp.Item(i).AfterFirst('=').BeforeFirst(';'); if (strTmp == wxT("dummy")) continue; if (panes.Index(strTmp) < 0) arTabsTmp.RemoveAt(i); } } tabsTmp = GetStringFromArray(arTabsTmp, wxT("|")); // Add frame perspective tabs += tabsTmp; return tabs; }
tstring CNetworkAdapter::GetGatewayAddr( int nGateway ) const { return GetStringFromArray( &m_GatewayList, nGateway ); }
tstring CNetworkAdapter::GetDnsAddr( int nDns ) const { return GetStringFromArray( &m_DnsAddresses, nDns ); }
void EditorColourSet::Save() { // no need for syntax highlighting if batch building if (Manager::IsBatchBuild()) return; wxString key; ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor")); //FIXME: Commenting out the following line is no definite cure, but it hides the annoying disappearing colourset for now //NOTE (mandrav): uncommenting it doesn't seem to cause any trouble (at least now). What was the problem? cfg->DeleteSubPath(_T("/colour_sets/") + m_Name); // write the theme name cfg->Write(_T("/colour_sets/") + m_Name + _T("/name"), m_Name); for (OptionSetsMap::iterator it = m_Sets.begin(); it != m_Sets.end(); ++it) { if (it->first == HL_NONE || it->first == HL_AUTO) continue; wxString lang = it->first; bool gsaved = false; key.Clear(); key << _T("/colour_sets/") << m_Name << _T('/') << lang; for (unsigned int i = 0; i < it->second.m_Colours.GetCount(); ++i) { OptionColour* opt = it->second.m_Colours.Item(i); wxString tmpKey; tmpKey << key << _T("/style") << wxString::Format(_T("%u"), i); bool saved = false; if (opt->fore != opt->originalfore) { cfg->Write(tmpKey + _T("/fore"), opt->fore); saved = true; } if (opt->back != opt->originalback) { cfg->Write(tmpKey + _T("/back"), opt->back); saved = true; } if (opt->bold != opt->originalbold) { cfg->Write(tmpKey + _T("/bold"), opt->bold); saved = true; } if (opt->italics != opt->originalitalics) { cfg->Write(tmpKey + _T("/italics"), opt->italics); saved = true; } if (opt->underlined != opt->originalunderlined) { cfg->Write(tmpKey + _T("/underlined"), opt->underlined); saved = true; } if (opt->isStyle != opt->originalisStyle) { cfg->Write(tmpKey + _T("/isStyle"), opt->isStyle); saved = true; } if (saved) { cfg->Write(tmpKey + _T("/name"), opt->name, true); gsaved = true; } } wxString tmpkey; for (int i = 0; i <= wxSCI_KEYWORDSET_MAX; ++i) { if (it->second.m_Keywords[i] != it->second.m_originalKeywords[i]) { tmpkey.Printf(_T("%s/editor/keywords/set%d"), key.c_str(), i); cfg->Write(tmpkey, it->second.m_Keywords[i]); gsaved = true; } } tmpkey.Printf(_T("%s/editor/filemasks"), key.c_str()); wxString tmparr = GetStringFromArray(it->second.m_FileMasks, _T(",")); wxString tmparrorig = GetStringFromArray(it->second.m_originalFileMasks, _T(",")); if (tmparr != tmparrorig) { cfg->Write(tmpkey, tmparr); gsaved = true; } if (gsaved) cfg->Write(key + _T("/name"), it->second.m_Langs); } }
wxString MakeUniqueString(const wxString& text, const wxString& separator, bool caseSens) { return GetStringFromArray( MakeUniqueArray( GetArrayFromString(text, separator), caseSens ), separator, false ); }