Ejemplo n.º 1
0
LexerConf::Ptr_t
ColoursAndFontsManager::CopyTheme(const wxString& lexerName, const wxString& themeName, const wxString& sourceTheme)
{
    LexerConf::Ptr_t sourceLexer = GetLexer(lexerName, sourceTheme);
    CHECK_PTR_RET_NULL(sourceLexer);

    wxXmlNode* sourceLexerXml = sourceLexer->ToXml();
    LexerConf::Ptr_t newLexer(new LexerConf());
    newLexer->FromXml(sourceLexerXml);

    // Update the theme name
    newLexer->SetThemeName(themeName);

    // Add it
    return DoAddLexer(newLexer->ToXml());
}
Ejemplo n.º 2
0
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());
}