]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
Support new languages in tex2lyx
[lyx.git] / src / LyXRC.cpp
index 6c7809c7e5811ea933e1021f9e059e3df8fdfe16..2cc0369a631f633b3bc3e3148b2ccc05be5dd3a6 100644 (file)
@@ -40,6 +40,7 @@
 #include "support/lstrings.h"
 #include "support/os.h"
 #include "support/Package.h"
+#include "support/TempFile.h"
 #include "support/userinfo.h"
 
 #include <fstream>
@@ -55,7 +56,9 @@ namespace os = support::os;
 
 namespace {
 
-static unsigned int const LYXRC_FILEFORMAT = 13; // vfr: System theme's icons
+// 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 +96,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 +113,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 },
@@ -255,6 +260,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";
@@ -402,7 +408,8 @@ bool LyXRC::read(FileName const & filename, bool check_format)
                return retval == ReadOK;
 
        LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
-       FileName const tempfile = FileName::tempName("convert_lyxrc");
+       TempFile tmp("convert_lyxrc");
+       FileName const tempfile = tmp.name();
        bool const success = prefs2prefs(filename, tempfile, false);
        if (!success) {
                LYXERR0 ("Unable to convert " << filename.absFileName() <<
@@ -417,7 +424,6 @@ bool LyXRC::read(FileName const & filename, bool check_format)
                LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
                retval = read(lexrc2, check_format);
        }
-       tempfile.removeFile();
        return retval == ReadOK;
 }
 
@@ -1162,6 +1168,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                        break;
                }
 
+               case RC_DEFAULT_OTF_VIEW_FORMAT:
+                       lexrc >> default_otf_view_format;
+                       break;
+
                case RC_DEFAULT_VIEW_FORMAT:
                        lexrc >> default_view_format;
                        break;
@@ -1231,6 +1241,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;
@@ -1939,6 +1952,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) {
@@ -2807,6 +2829,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                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)
+            && !default_otf_view_format.empty()) {
+                       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) {
@@ -2929,6 +2959,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:
@@ -2977,6 +3008,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:
@@ -3047,6 +3080,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:
@@ -3162,6 +3196,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;