]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
GuiDelimiter: Synchronise the vertical scrollbars
[lyx.git] / src / BufferParams.cpp
index e3121c77700dca202e75ba831f026c757d3eb01d..9d121cb4f410dc3a322521ee58024de9e085558f 100644 (file)
@@ -369,6 +369,7 @@ BufferParams::BufferParams()
        biblio_style = "plain";
        use_bibtopic = false;
        use_indices = false;
+       save_transient_properties = true;
        track_changes = false;
        output_changes = false;
        use_default_options = true;
@@ -673,6 +674,8 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                        frontend::Alert::warning(_("Document class not available"),
                                       msg, true);
                }
+       } else if (token == "\\save_transient_properties") {
+               lex >> save_transient_properties;
        } else if (token == "\\origin") {
                lex.eatLine();
                origin = lex.getString();
@@ -1015,16 +1018,19 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
        // The top of the file is written by the buffer.
        // Prints out the buffer info into the .lyx file given by file
 
-       // the document directory
-       // use realPath() instead of absFileName() for comparing
-       // so we can catch also eventually used symbolic parts of the path.
-       string filepath = buf->fileName().onlyPath().realPath();
-       string const sysdir = package().system_support().realPath();
+       os << "\\save_transient_properties "
+          << convert<string>(save_transient_properties) << '\n';
+
+       // the document directory (must end with a path separator)
+       // realPath() is used to resolve symlinks, while addPath(..., "")
+       // ensures a trailing path separator.
+       string filepath = addPath(buf->fileName().onlyPath().realPath(), "");
+       string const sysdir = addPath(package().system_support().realPath(), "");
        string const relpath =
                to_utf8(makeRelPath(from_utf8(filepath), from_utf8(sysdir)));
        if (!prefixIs(relpath, "../") && !FileName::isAbsolute(relpath))
                filepath = addPath("/systemlyxdir", relpath);
-       else if (!lyxrc.save_origin)
+       else if (!save_transient_properties || !lyxrc.save_origin)
                filepath = "unavailable";
        os << "\\origin " << quoteIfNeeded(filepath) << '\n';
 
@@ -1273,15 +1279,16 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
                }
        }
 
-       os << "\\tracking_changes " << convert<string>(track_changes) << '\n'
-          << "\\html_math_output " << html_math_output << '\n'
+       os << "\\tracking_changes "
+          << (save_transient_properties ? convert<string>(track_changes) : "false")
+          << '\n';
+
+       os << "\\output_changes "
+          << (save_transient_properties ? convert<string>(output_changes) : "false")
+          << '\n';
+
+       os << "\\html_math_output " << html_math_output << '\n'
           << "\\html_css_as_file " << html_css_as_file << '\n'
-               // \output_changes is output at a distance from \tracking changes as a
-               // workaround to bug #9841: both parameters can be seen as per-user
-               // preferences and therefore can cause undesirable merge conflicts, in a
-               // multi-author setting, if it were treated as a single block by the
-               // version control system.
-          << "\\output_changes " << convert<string>(output_changes) << '\n'
           << "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
 
        if (html_math_img_scale != 1.0)
@@ -1399,11 +1406,8 @@ void BufferParams::validate(LaTeXFeatures & features) const
        }
 
        // some languages are only available via polyglossia
-       if ((features.runparams().flavor == OutputParams::XETEX
-            || features.runparams().flavor == OutputParams::LUATEX)
-           && (features.hasPolyglossiaExclusiveLanguages()
-               || useNonTeXFonts))
-               features.require("polyglossia");
+       if (features.hasPolyglossiaExclusiveLanguages())
+          features.require("polyglossia");
 
        if (useNonTeXFonts && fontsMath() != "auto")
                features.require("unicode-math");