]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
* src/LaTeXFeatures.cpp: simplify greektext definition. Patch by G. Milde (bug #6458)
[lyx.git] / src / LyXRC.cpp
index 1d8ad46008acec35c7c8e9708727f3c65c3a9ccc..3b363fd3f764abb2617227f10890fac7dc596fa8 100644 (file)
@@ -111,7 +111,6 @@ LexerKeyword lyxrcTags[] = {
        { "\\kbmap", LyXRC::RC_KBMAP },
        { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
        { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
-       { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
        { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
        { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
        { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
@@ -156,6 +155,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
        { "\\printer", LyXRC::RC_PRINTER },
        { "\\rtl", LyXRC::RC_RTL_SUPPORT },
+       { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
        { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
        { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
        { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
@@ -170,9 +170,11 @@ LexerKeyword lyxrcTags[] = {
        { "\\serverpipe", LyXRC::RC_SERVERPIPE },
        { "\\set_color", LyXRC::RC_SET_COLOR },
        { "\\show_banner", LyXRC::RC_SHOW_BANNER },
+       { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
        { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
        { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
        { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
+       { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
        { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
        { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
        { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
@@ -273,12 +275,20 @@ void LyXRC::setDefaults()
        use_lastfilepos = true;
        load_session = false;
        make_backup = true;
+       save_compressed = false;
        backupdir_path.erase();
        display_graphics = true;
        // Spellchecker settings:
+#if defined(USE_ASPELL)
        spellchecker = "aspell";
+#elif defined(USE_HUNSPELL)
+       spellchecker = "hunspell";
+#else
+       spellchecker = "aspell";
+#endif
        spellchecker_accept_compound = false;
        spellcheck_continuously = false;
+       spellcheck_notes = true;
        use_kbmap = false;
        rtl_support = true;
        visual_cursor = false;
@@ -305,7 +315,6 @@ void LyXRC::setDefaults()
        mac_like_word_movement = false;
        macro_edit_style = MACRO_EDIT_INLINE_BOX;
        dialogs_iconify_with_main = false;
-       label_init_length = 3;
        preview = PREVIEW_OFF;
        preview_hashed_labels  = false;
        preview_scale_factor = 1.0;
@@ -316,6 +325,7 @@ void LyXRC::setDefaults()
        user_name = to_utf8(support::user_name());
        user_email = to_utf8(support::user_email());
        open_buffers_in_tabs = true;
+       single_close_tab_button = false;
 
        // Fullscreen settings
        full_screen_limit = false;
@@ -907,9 +917,15 @@ int LyXRC::read(Lexer & lexrc)
                case RC_SPELLCHECK_CONTINUOUSLY:
                        lexrc >> spellcheck_continuously;
                        break;
+               case RC_SPELLCHECK_NOTES:
+                       lexrc >> spellcheck_notes;
+                       break;
                case RC_MAKE_BACKUP:
                        lexrc >> make_backup;
                        break;
+               case RC_SAVE_COMPRESSED:
+                       lexrc >> save_compressed;
+                       break;
                case RC_BACKUPDIR_PATH:
                        if (lexrc.next()) {
                                backupdir_path = os::internal_path(lexrc.getString());
@@ -1042,13 +1058,13 @@ int LyXRC::read(Lexer & lexrc)
                                format = lexrc.getString();
                        if (lexrc.eatLine())
                                command = lexrc.getString();
-                       viewer_alternatives.push_back(make_pair(format, command));
+                       viewer_alternatives[format].insert(command);
                        break;
                }
                case RC_EDITOR_ALTERNATIVES:  {
                        string format, command;
                        lexrc >> format >> command;
-                       editor_alternatives.push_back(make_pair(format, command));
+                       editor_alternatives[format].insert(command);
                        break;
                }
 
@@ -1064,10 +1080,6 @@ int LyXRC::read(Lexer & lexrc)
                        lexrc >> gui_language;
                        break;
 
-               case RC_LABEL_INIT_LENGTH:
-                       lexrc >> label_init_length;
-                       break;
-
                case RC_SHOW_BANNER:
                        lexrc >> show_banner;
                        break;
@@ -1141,6 +1153,9 @@ int LyXRC::read(Lexer & lexrc)
                case RC_OPEN_BUFFERS_IN_TABS:
                        lexrc >> open_buffers_in_tabs;
                        break;
+               case RC_SINGLE_CLOSE_TAB_BUTTON:
+                       lexrc >> single_close_tab_button;
+                       break;
 
                // Obsoteted in 1.4.0
                case RC_USETEMPDIR:
@@ -1388,8 +1403,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
        case RC_BIBTEX_ALTERNATIVES: {
-               set<string>::const_iterator it = bibtex_alternatives.begin();
-               set<string>::const_iterator end = bibtex_alternatives.end();
+               CommandSet::const_iterator it = bibtex_alternatives.begin();
+               CommandSet::const_iterator end = bibtex_alternatives.end();
                for ( ; it != end; ++it) {
                        if (ignore_system_lyxrc
                            || !system_lyxrc.bibtex_alternatives.count(*it))
@@ -1414,8 +1429,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
        case RC_INDEX_ALTERNATIVES: {
-               set<string>::const_iterator it = index_alternatives.begin();
-               set<string>::const_iterator end = index_alternatives.end();
+               CommandSet::const_iterator it = index_alternatives.begin();
+               CommandSet::const_iterator end = index_alternatives.end();
                for ( ; it != end; ++it) {
                        if (ignore_system_lyxrc
                            || !system_lyxrc.index_alternatives.count(*it))
@@ -1507,14 +1522,6 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
-       case RC_LABEL_INIT_LENGTH:
-               if (ignore_system_lyxrc ||
-                   label_init_length != system_lyxrc.label_init_length) {
-                       os << "\\label_init_length " << label_init_length
-                          << '\n';
-               }
-               if (tag != RC_LAST)
-                       break;
 
        case RC_USER_NAME:
                os << "\\user_name \"" << user_name << "\"\n";
@@ -1833,6 +1840,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                           << convert<string>(open_buffers_in_tabs)
                           << '\n';
                }
+       case RC_SINGLE_CLOSE_TAB_BUTTON:
+               if (ignore_system_lyxrc ||
+                   single_close_tab_button != system_lyxrc.single_close_tab_button) {
+                       os << "\\single_close_tab_button "
+                          << convert<string>(single_close_tab_button)
+                          << '\n';
+               }
                if (tag != RC_LAST)
                        break;
 
@@ -2209,6 +2223,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
+       case RC_SAVE_COMPRESSED:
+               if (ignore_system_lyxrc ||
+                   save_compressed != system_lyxrc.save_compressed) {
+                       os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
        case RC_BACKUPDIR_PATH:
                if (ignore_system_lyxrc ||
                    backupdir_path != system_lyxrc.backupdir_path) {
@@ -2315,6 +2336,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
 
+       case RC_SPELLCHECK_NOTES:
+               if (ignore_system_lyxrc ||
+                   spellcheck_notes != system_lyxrc.spellcheck_notes) {
+                       os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
+                          << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
+
        case RC_RTL_SUPPORT:
                if (ignore_system_lyxrc ||
                    rtl_support != system_lyxrc.rtl_support) {
@@ -2479,26 +2509,56 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                                   << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
                if (tag != RC_LAST)
                        break;
-       case RC_VIEWER_ALTERNATIVES:
-               if (ignore_system_lyxrc ||
-                   viewer_alternatives != system_lyxrc.viewer_alternatives) {
-                       for (vector<pair<string, string> >::const_iterator it = viewer_alternatives.begin();
-                            it != viewer_alternatives.end(); ++it)
-                       os << "\\viewer_alternatives "
-                          << it->first << " " << it->second << "\n";
+       case RC_VIEWER_ALTERNATIVES: {
+               Alternatives::const_iterator it = viewer_alternatives.begin();
+               Alternatives::const_iterator const en = viewer_alternatives.end();
+               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 ? 
+                                       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 
+                                   || sysfmt == sysend               // format not found
+                                        || sysfmt->second.count(cmd) == 0 // this command not found
+                                  )
+                                       os << "\\viewer_alternatives " << fmt << " " << cmd << "\n";
+                       }
                }
                if (tag != RC_LAST)
                        break;
-       case RC_EDITOR_ALTERNATIVES:
-               if (ignore_system_lyxrc ||
-                   editor_alternatives != system_lyxrc.editor_alternatives) {
-                       for (vector<pair<string, string> >::const_iterator it = editor_alternatives.begin();
-                            it != editor_alternatives.end(); ++it)
-                       os << "\\editor_alternatives "
-                          << it->first << " " << it->second << "\n";
+       }
+       case RC_EDITOR_ALTERNATIVES: {
+               Alternatives::const_iterator it = editor_alternatives.begin();
+               Alternatives::const_iterator const en = editor_alternatives.end();
+               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 ? 
+                                       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 
+                                   || sysfmt == sysend               // format not found
+                                   || sysfmt->second.count(cmd) == 0 // this command not found
+                                  )
+                                       os << "\\editor_alternatives " << fmt << " " << cmd << "\n";
+                       }
                }
                if (tag != RC_LAST)
                        break;
+       }
        case RC_DEFAULT_VIEW_FORMAT:
                if (ignore_system_lyxrc ||
                    default_view_format != system_lyxrc.default_view_format) {
@@ -2646,7 +2706,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_KBMAP:
        case LyXRC::RC_KBMAP_PRIMARY:
        case LyXRC::RC_KBMAP_SECONDARY:
-       case LyXRC::RC_LABEL_INIT_LENGTH:
        case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
        case LyXRC::RC_LANGUAGE_AUTO_END:
        case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
@@ -2689,6 +2748,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_PRINT_ADAPTOUTPUT:
        case LyXRC::RC_PRINT_COMMAND:
        case LyXRC::RC_RTL_SUPPORT:
+       case LyXRC::RC_SAVE_COMPRESSED:
        case LyXRC::RC_SCREEN_DPI:
        case LyXRC::RC_SCREEN_FONT_ROMAN:
        case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
@@ -2707,6 +2767,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_SPELL_COMMAND:
        case LyXRC::RC_SPELLCHECKER:
        case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
+       case LyXRC::RC_SPELLCHECK_NOTES:
        case LyXRC::RC_SPLITINDEX_COMMAND:
        case LyXRC::RC_TEMPDIRPATH:
        case LyXRC::RC_TEMPLATEPATH:
@@ -2729,6 +2790,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_USE_PIXMAP_CACHE:
        case LyXRC::RC_USE_SPELL_LIB:
        case LyXRC::RC_VIEWDVI_PAPEROPTION:
+       case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
        case LyXRC::RC_SORT_LAYOUTS:
        case LyXRC::RC_FULL_SCREEN_LIMIT:
        case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
@@ -2899,10 +2961,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard.");
                break;
 
-       case RC_LABEL_INIT_LENGTH:
-               str = _("Maximum number of words in the initialization string for a new label");
-               break;
-
        case RC_LANGUAGE_AUTO_BEGIN:
                str = _("Select if a language switching command is needed at the beginning of the document.");
                break;