]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
Fix problem with python and change of PATH
[lyx.git] / src / LyXRC.cpp
index 0d4c9197cc90cec6a47cf0dc1ca49018fe665e45..80b85141d25145e2a3eab443aae6030d480e19b1 100644 (file)
@@ -55,7 +55,9 @@ namespace os = support::os;
 
 namespace {
 
-static unsigned int const LYXRC_FILEFORMAT = 9; // spitz: remove \\default_language
+// The format should also be updated in configure.py, and conversion code
+// should be added to prefs2prefs_prefs.py.
+static unsigned int const LYXRC_FILEFORMAT = 15; // prannoy: statusbar on/off in full screen
 
 // when adding something to this array keep it sorted!
 LexerKeyword lyxrcTags[] = {
@@ -93,6 +95,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\def_file", LyXRC::RC_DEFFILE },
        { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
        { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
+       { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT },
        { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
        { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
        { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
@@ -109,6 +112,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
        { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
        { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
+       { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
        { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
        { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
        { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
@@ -134,7 +138,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
        { "\\load_session", LyXRC::RC_LOADSESSION },
        { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
-       { "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT },
+       { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
        { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
        { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
        { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
@@ -203,6 +207,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\use_qimage", LyXRC::RC_USE_QIMAGE },
        // compatibility with versions older than 1.4.0 only
        { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
+       { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
        { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
        { "\\user_email", LyXRC::RC_USER_EMAIL },
        { "\\user_name", LyXRC::RC_USER_NAME },
@@ -228,6 +233,7 @@ LyXRC::LyXRC()
 void LyXRC::setDefaults()
 {
        icon_set = string();
+       use_system_theme_icons = false;
        bind_file = "cua";
        def_file = "default";
        ui_file = "default";
@@ -253,6 +259,7 @@ void LyXRC::setDefaults()
        document_path.erase();
        view_dvi_paper_option.erase();
        default_view_format = "pdf2";
+       default_otf_view_format = "pdf4";
        chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
        bibtex_command = "bibtex";
        fontenc = "default";
@@ -329,7 +336,7 @@ void LyXRC::setDefaults()
        scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
        paragraph_markers = false;
        mac_dontswap_ctrl_meta = false;
-       mac_like_word_movement = false;
+       mac_like_cursor_movement = false;
        macro_edit_style = MACRO_EDIT_INLINE_BOX;
        dialogs_iconify_with_main = false;
        preview = PREVIEW_OFF;
@@ -833,6 +840,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                        lexrc >> icon_set;
                        break;
 
+               case RC_USE_SYSTEM_THEME_ICONS:
+                       lexrc >> use_system_theme_icons;
+                       break;
+
                case RC_SCREEN_FONT_ROMAN:
                        if (lexrc.next()) {
                                roman_font_name = lexrc.getString();
@@ -925,8 +936,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                        lexrc >> mac_dontswap_ctrl_meta;
                        break;
 
-               case RC_MAC_LIKE_WORD_MOVEMENT:
-                       lexrc >> mac_like_word_movement;
+               case RC_MAC_LIKE_CURSOR_MOVEMENT:
+                       lexrc >> mac_like_cursor_movement;
                        break;
 
                case RC_MACRO_EDIT_STYLE:
@@ -1143,23 +1154,23 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                }
                case RC_VIEWER_ALTERNATIVES:  {
                        string format, command;
-                       if (lexrc.next())
-                               format = lexrc.getString();
-                       if (lexrc.eatLine())
-                               command = lexrc.getString();
+                       lexrc >> format;
+                       lexrc >> command;
                        viewer_alternatives[format].insert(command);
                        break;
                }
                case RC_EDITOR_ALTERNATIVES:  {
                        string format, command;
-                       if (lexrc.next())
-                               format = lexrc.getString();
-                       if (lexrc.eatLine())
-                               command = lexrc.getString();
+                       lexrc >> format;
+                       lexrc >> command;
                        editor_alternatives[format].insert(command);
                        break;
                }
 
+               case RC_DEFAULT_OTF_VIEW_FORMAT:
+                       lexrc >> default_otf_view_format;
+                       break;
+
                case RC_DEFAULT_VIEW_FORMAT:
                        lexrc >> default_view_format;
                        break;
@@ -1229,6 +1240,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                case RC_FULL_SCREEN_SCROLLBAR:
                        lexrc >> full_screen_scrollbar;
                        break;
+               case RC_FULL_SCREEN_STATUSBAR:
+                       lexrc >> full_screen_statusbar;
+                       break;
                case RC_FULL_SCREEN_TABBAR:
                        lexrc >> full_screen_tabbar;
                        break;
@@ -1705,6 +1719,16 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
 
+       case RC_USE_SYSTEM_THEME_ICONS:
+               if (ignore_system_lyxrc ||
+                         use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
+                       os << "\\use_system_theme_icons "
+                               << convert<string>(use_system_theme_icons)
+                               << "\n";
+               }
+               if (tag != RC_LAST)
+                       break;
+
        case RC_SCREEN_DPI:
                if (ignore_system_lyxrc ||
                    dpi != system_lyxrc.dpi) {
@@ -1772,12 +1796,12 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
-       case RC_MAC_LIKE_WORD_MOVEMENT:
+       case RC_MAC_LIKE_CURSOR_MOVEMENT:
                if (ignore_system_lyxrc ||
-                   mac_like_word_movement
-                   != system_lyxrc.mac_like_word_movement) {
-                       os << "\\mac_like_word_movement "
-                          << convert<string>(mac_like_word_movement) << '\n';
+                   mac_like_cursor_movement
+                   != system_lyxrc.mac_like_cursor_movement) {
+                       os << "\\mac_like_cursor_movement "
+                          << convert<string>(mac_like_cursor_movement) << '\n';
                }
                if (tag != RC_LAST)
                        break;
@@ -1927,6 +1951,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
+       case RC_FULL_SCREEN_STATUSBAR:
+               if (ignore_system_lyxrc ||
+                   full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
+                       os << "\\fullscreen_statusbar "
+                          << convert<string>(full_screen_statusbar)
+                          << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
        case RC_FULL_SCREEN_TABBAR:
                if (ignore_system_lyxrc ||
                    full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
@@ -2764,7 +2797,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                                    || sysfmt == sysend               // format not found
                                         || sysfmt->second.count(cmd) == 0 // this command not found
                                   )
-                                       os << "\\viewer_alternatives " << fmt << " " << cmd << "\n";
+                                       os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
                        }
                }
                if (tag != RC_LAST)
@@ -2789,12 +2822,19 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                                    || sysfmt == sysend               // format not found
                                    || sysfmt->second.count(cmd) == 0 // this command not found
                                   )
-                                       os << "\\editor_alternatives " << fmt << " " << cmd << "\n";
+                                       os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
                        }
                }
                if (tag != RC_LAST)
                        break;
        }
+       case RC_DEFAULT_OTF_VIEW_FORMAT:
+               if (ignore_system_lyxrc ||
+                   default_otf_view_format != system_lyxrc.default_otf_view_format) {
+                       os << "\\default_otf_view_format " << default_otf_view_format << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
        case RC_DEFAULT_VIEW_FORMAT:
                if (ignore_system_lyxrc ||
                    default_view_format != system_lyxrc.default_view_format) {
@@ -2917,6 +2957,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
        case LyXRC::RC_DATE_INSERT_FORMAT:
        case LyXRC::RC_GUI_LANGUAGE:
+       case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
        case LyXRC::RC_DEFAULT_VIEW_FORMAT:
        case LyXRC::RC_DEFFILE:
        case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
@@ -2955,7 +2996,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
        case LyXRC::RC_LYXRCFORMAT:
        case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
-       case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
+       case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
        case LyXRC::RC_MACRO_EDIT_STYLE:
        case LyXRC::RC_MAKE_BACKUP:
        case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
@@ -2965,6 +3006,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_PATH_PREFIX:
                if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
                        prependEnvPath("PATH", lyxrc_new.path_prefix);
+                       // Resets python path
+                       support::os::python(true);
                }
        case LyXRC::RC_PREVIEW:
        case LyXRC::RC_PREVIEW_HASHED_LABELS:
@@ -3027,6 +3070,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_USE_TOOLTIP:
        case LyXRC::RC_USE_PIXMAP_CACHE:
        case LyXRC::RC_USE_QIMAGE:
+       case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
        case LyXRC::RC_VIEWDVI_PAPEROPTION:
        case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
        case LyXRC::RC_SINGLE_INSTANCE:
@@ -3034,6 +3078,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_FULL_SCREEN_LIMIT:
        case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
        case LyXRC::RC_FULL_SCREEN_MENUBAR:
+       case LyXRC::RC_FULL_SCREEN_STATUSBAR:
        case LyXRC::RC_FULL_SCREEN_TABBAR:
        case LyXRC::RC_FULL_SCREEN_TOOLBARS:
        case LyXRC::RC_FULL_SCREEN_WIDTH:
@@ -3132,8 +3177,8 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Make Apple key act as Meta and Control key as Ctrl.");
                break;
 
-       case RC_MAC_LIKE_WORD_MOVEMENT:
-               str = _("Use the Mac OS X conventions for the word-level cursor movement");
+       case RC_MAC_LIKE_CURSOR_MOVEMENT:
+               str = _("Use the Mac OS X conventions for cursor movement");
                break;
 
        case RC_SHOW_MACRO_LABEL:
@@ -3149,6 +3194,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
                break;
 
+       case RC_DEFAULT_OTF_VIEW_FORMAT:
+               str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
+               break;
+
        case RC_DEFAULT_VIEW_FORMAT:
                str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
                break;