]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
gcc compile fix.
[lyx.git] / src / LyXRC.cpp
index 20daf4ac2059d1647f9c0437da16bdb5fc00d1f7..1d7b3c3d8e345a041b3ce615dbccaee477919155 100644 (file)
@@ -192,6 +192,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\template_path", LyXRC::RC_TEMPLATEPATH },
        { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
        { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
+       { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
        { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
        { "\\ui_file", LyXRC::RC_UIFILE },
        { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
@@ -227,6 +228,8 @@ void LyXRC::setDefaults()
        bind_file = "cua";
        def_file = "default";
        ui_file = "default";
+       // The current document directory
+       texinputs_prefix = ".";
        // Get printer from the environment. If fail, use default "",
        // assuming that everything is set up correctly.
        printer = getEnv("PRINTER");
@@ -499,6 +502,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                        lexrc >> tex_allows_spaces;
                        break;
 
+               case RC_TEXINPUTS_PREFIX:
+                       lexrc >> texinputs_prefix;
+                       break;
+
                case RC_KBMAP:
                        lexrc >> use_kbmap;
                        break;
@@ -1605,8 +1612,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
        case RC_TEX_EXPECTS_WINDOWS_PATHS:
-               if (ignore_system_lyxrc ||
-                   windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
+               // Don't write this setting to the preferences file,
+               // but allow temporary changes (bug 7557).
+               if (ignore_system_lyxrc) {
                        os << "\\tex_expects_windows_paths "
                           << convert<string>(windows_style_tex_paths) << '\n';
                }
@@ -2213,6 +2221,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                   << "# TEX SECTION #######################################\n"
                   << "#\n\n";
 
+       case RC_TEXINPUTS_PREFIX:
+               if (ignore_system_lyxrc ||
+                   texinputs_prefix != system_lyxrc.texinputs_prefix) {
+                       os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
+               }
+               if (tag != RC_LAST)
+                       break;
+
        case RC_FONT_ENCODING:
                if (ignore_system_lyxrc ||
                    fontenc != system_lyxrc.fontenc) {
@@ -2885,6 +2901,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        // if we forget an element.
        LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
        switch (tag) {
+       case LyXRC::RC_LAST:
        case LyXRC::RC_ACCEPT_COMPOUND:
        case LyXRC::RC_ALT_LANG:
        case LyXRC::RC_PLAINTEXT_LINELEN:
@@ -2938,9 +2955,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        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:
@@ -2969,7 +2983,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_PARAGRAPH_MARKERS:
        case LyXRC::RC_PATH_PREFIX:
                if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
-                       prependEnvPath("PATH", lyxrc.path_prefix);
+                       prependEnvPath("PATH", lyxrc_new.path_prefix);
                }
        case LyXRC::RC_PREVIEW:
        case LyXRC::RC_PREVIEW_HASHED_LABELS:
@@ -3020,6 +3034,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
                if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
                        os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
                }
+       case LyXRC::RC_TEXINPUTS_PREFIX:
        case LyXRC::RC_THESAURUSDIRPATH:
        case LyXRC::RC_UIFILE:
        case LyXRC::RC_USER_EMAIL:
@@ -3047,7 +3062,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_DEFAULT_DECIMAL_POINT:
        case LyXRC::RC_SCROLL_WHEEL_ZOOM:
        case LyXRC::RC_CURSOR_WIDTH:
-       case LyXRC::RC_LAST:
                break;
        }
 }
@@ -3313,7 +3327,7 @@ string const LyXRC::getDescription(LyXRCTags tag)
 
        case RC_PATH_PREFIX:
                str = _("Specify those directories which should be "
-                        "prepended to the PATH environment variable. "
+                        "prepended to the PATH environment variable.\n"
                         "Use the OS native format.");
                break;
 
@@ -3470,6 +3484,13 @@ string const LyXRC::getDescription(LyXRCTags tag)
        case RC_TEX_EXPECTS_WINDOWS_PATHS:
                break;
 
+       case RC_TEXINPUTS_PREFIX:
+               str = _("Specify those directories which should be "
+                        "prepended to the TEXINPUTS environment variable.\n"
+                        "A '.' represents the current document directory. "
+                        "Use the OS native format.");
+               break;
+
        case RC_UIFILE:
                str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
                break;