void ColoursAndFontsManager::SetActiveTheme(const wxString& lexerName, const wxString& themeName) { wxArrayString themes = GetAvailableThemesForLexer(lexerName); for(size_t i = 0; i < themes.GetCount(); ++i) { LexerConf::Ptr_t lexer = GetLexer(lexerName, themes.Item(i)); if(lexer && lexer->GetName() == lexerName) { lexer->SetIsActive(lexer->GetThemeName() == themeName); } } }
void ColoursAndFontsManager::Save(LexerConf::Ptr_t lexer) { wxXmlDocument doc; doc.SetRoot(lexer->ToXml()); wxString filename; wxString themeName = lexer->GetThemeName().Lower(); themeName.Replace(" ", "_"); themeName.Replace("::", "_"); themeName.Replace("(", "_"); themeName.Replace(")", "_"); themeName.Replace(":", "_"); themeName.Replace(",", "_"); themeName.Replace(".", "_"); themeName.Replace(";", "_"); filename << "lexer_" << lexer->GetName().Lower() << "_" << themeName << ".xml"; wxFileName xmlFile(clStandardPaths::Get().GetUserDataDir(), filename); xmlFile.AppendDir("lexers"); ::SaveXmlToFile(&doc, xmlFile.GetFullPath()); }