]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
See r37176. Let's keep this a Windows only "feature".
[lyx.git] / src / LyXRC.cpp
index b196c1c838fb2cb2223c55eaba7cf50dfa7d460a..20daf4ac2059d1647f9c0437da16bdb5fc00d1f7 100644 (file)
@@ -113,6 +113,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
        { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
        { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
+       { "\\icon_set", LyXRC::RC_ICON_SET },
        { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
        { "\\index_command", LyXRC::RC_INDEX_COMMAND },
        { "\\input", LyXRC::RC_INPUT },
@@ -222,6 +223,7 @@ LyXRC::LyXRC()
 
 void LyXRC::setDefaults()
 {
+       icon_set = string();
        bind_file = "cua";
        def_file = "default";
        ui_file = "default";
@@ -532,7 +534,7 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                case RC_FORCE_PAINT_SINGLE_CHAR:
                        lexrc >> force_paint_single_char;
                        break;
-                               
+
                case RC_PRINTER:
                        lexrc >> printer;
                        break;
@@ -829,6 +831,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                        lexrc >> check_lastfiles;
                        break;
 
+               case RC_ICON_SET:
+                       lexrc >> icon_set;
+                       break;
+
                case RC_SCREEN_FONT_ROMAN:
                        if (lexrc.next()) {
                                roman_font_name = lexrc.getString();
@@ -1133,7 +1139,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                }
                case RC_EDITOR_ALTERNATIVES:  {
                        string format, command;
-                       lexrc >> format >> command;
+                       if (lexrc.next())
+                               format = lexrc.getString();
+                       if (lexrc.eatLine())
+                               command = lexrc.getString();
                        editor_alternatives[format].insert(command);
                        break;
                }
@@ -1141,7 +1150,7 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                case RC_DEFAULT_VIEW_FORMAT:
                        lexrc >> default_view_format;
                        break;
-                       
+
                case RC_DEFAULT_LANGUAGE:
                        lexrc >> default_language;
                        break;
@@ -1232,11 +1241,11 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                                run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
                        break;
                case RC_FORWARD_SEARCH_DVI:
-                       if (lexrc.next(true)) 
+                       if (lexrc.next(true))
                                forward_search_dvi = lexrc.getString();
                        break;
                case RC_FORWARD_SEARCH_PDF:
-                       if (lexrc.next(true)) 
+                       if (lexrc.next(true))
                                forward_search_pdf = lexrc.getString();
                        break;
                case RC_EXPORT_OVERWRITE:
@@ -1329,7 +1338,7 @@ namespace {
 
        // Escape \ and " so that LyXLex can read the string later
        string escapeCommand(string const & str) {
-               return subst(subst(str , "\\", "\\\\"), 
+               return subst(subst(str , "\\", "\\\\"),
                             "\"", "\\\"");
        }
 
@@ -1339,7 +1348,7 @@ namespace {
 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
 {
        LyXRCTags tag = RC_LAST;
-       
+
        if (!name.empty()) {
                for (int i = 0; i != lyxrcCount; ++i)
                        if ("\\" + name == lyxrcTags[i].tag)
@@ -1729,6 +1738,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                   << "# SCREEN & FONTS SECTION ############################\n"
                   << "#\n\n";
 
+       case RC_ICON_SET:
+               if (ignore_system_lyxrc ||
+                   icon_set != system_lyxrc.icon_set) {
+                       os << "\\icon_set \"" << icon_set
+                          << "\"\n";
+               }
+               if (tag != RC_LAST)
+                       break;
+
        case RC_SCREEN_DPI:
                if (ignore_system_lyxrc ||
                    dpi != system_lyxrc.dpi) {
@@ -2546,7 +2564,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                    language_package_selection != system_lyxrc.language_package_selection) {
                        os << "\\language_package_selection ";
                        switch (language_package_selection) {
-                       case LP_AUTO: 
+                       case LP_AUTO:
                                os << "0\n";
                                break;
                        case LP_BABEL:
@@ -2702,7 +2720,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                            format->viewer() != cit->viewer() ||
                            format->editor() != cit->editor() ||
                            format->documentFormat() != cit->documentFormat() ||
-                           format->vectorFormat() != cit->vectorFormat()) {
+                           format->vectorFormat() != cit->vectorFormat() ||
+                           format->inExportMenu() != cit->inExportMenu()) {
                                os << "\\format \"" << cit->name() << "\" \""
                                   << cit->extension() << "\" \""
                                   << cit->prettyname() << "\" \""
@@ -2714,6 +2733,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                                        flags.push_back("document");
                                if (cit->vectorFormat())
                                        flags.push_back("vector");
+                               if (cit->inExportMenu())
+                                       flags.push_back("menu=export");
+
                                os << getStringFromVector(flags);
                                os << "\"\n";
                        }
@@ -2730,19 +2752,19 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
        case RC_VIEWER_ALTERNATIVES: {
                Alternatives::const_iterator it = viewer_alternatives.begin();
                Alternatives::const_iterator const en = viewer_alternatives.end();
-               Alternatives::const_iterator const sysend = 
+               Alternatives::const_iterator const sysend =
                                system_lyxrc.viewer_alternatives.end();
                for (; it != en; ++it) {
                        string const & fmt = it->first;
                        CommandSet const & cmd = it->second;
                        CommandSet::const_iterator sit = cmd.begin();
                        CommandSet::const_iterator const sen = cmd.end();
-                       Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ? 
+                       Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
                                        system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
                                        system_lyxrc.viewer_alternatives.find(fmt);
                        for (; sit != sen; ++sit) {
                                string const & cmd = *sit;
-                               if (ignore_system_lyxrc 
+                               if (ignore_system_lyxrc
                                    || sysfmt == sysend               // format not found
                                         || sysfmt->second.count(cmd) == 0 // this command not found
                                   )
@@ -2755,19 +2777,19 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
        case RC_EDITOR_ALTERNATIVES: {
                Alternatives::const_iterator it = editor_alternatives.begin();
                Alternatives::const_iterator const en = editor_alternatives.end();
-               Alternatives::const_iterator const sysend = 
+               Alternatives::const_iterator const sysend =
                                system_lyxrc.editor_alternatives.end();
                for (; it != en; ++it) {
                        string const & fmt = it->first;
                        CommandSet const & cmd = it->second;
                        CommandSet::const_iterator sit = cmd.begin();
                        CommandSet::const_iterator const sen = cmd.end();
-                       Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ? 
+                       Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
                                        system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
                                        system_lyxrc.editor_alternatives.find(fmt);
                        for (; sit != sen; ++sit) {
                                string const & cmd = *sit;
-                               if (ignore_system_lyxrc 
+                               if (ignore_system_lyxrc
                                    || sysfmt == sysend               // format not found
                                    || sysfmt->second.count(cmd) == 0 // this command not found
                                   )
@@ -2817,7 +2839,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                                   << "\" \"" << cit->to << "\" \"\" \"\"\n";
                if (tag != RC_LAST)
                        break;
-       
+
        case RC_COPIER:
                if (tag == RC_LAST)
                        os << "\n#\n"
@@ -2915,6 +2937,10 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_FILEFORMAT:
        case LyXRC::RC_GROUP_LAYOUTS:
        case LyXRC::RC_HUNSPELLDIR_PATH:
+       case LyXRC::RC_ICON_SET:
+               if (lyxrc_orig.icon_set != lyxrc_new.icon_set) {
+                       lyxrc.icon_set = lyxrc_new.icon_set;
+               }
        case LyXRC::RC_INDEX_ALTERNATIVES:
        case LyXRC::RC_INDEX_COMMAND:
        case LyXRC::RC_JBIBTEX_COMMAND: