]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
* InsetListings.cpp:
[lyx.git] / src / BufferParams.cpp
index f809ba4dcd511cd649b3f555d7f86df3a9aafd53..bfcae0e618777f40181b4f6a965ba9abd4ac897c 100644 (file)
@@ -404,8 +404,8 @@ BufferParams::BufferParams()
        html_be_strict = false;
        html_math_output = MathML;
        html_math_img_scale = 1.0;
-       html_latex_start = "<span class='latex'>";
-       html_latex_end = "</span>";
+
+       output_sync = false;
 }
 
 
@@ -836,6 +836,10 @@ string BufferParams::readToken(Lexer & lex, string const & token,
        } else if (token == "\\html_latex_end") {
                lex.eatLine();
                html_latex_end = lex.getString();
+       } else if (token == "\\output_sync") {
+               lex >> output_sync;
+       } else if (token == "\\output_sync_macro") {
+               lex >> output_sync_macro;
        } else {
                lyxerr << "BufferParams::readToken(): Unknown token: " << 
                        token << endl;
@@ -938,6 +942,9 @@ void BufferParams::writeFile(ostream & os) const
        }
        os << "\n\\graphics " << graphicsDriver << '\n';
        os << "\\default_output_format " << defaultOutputFormat << '\n';
+       os << "\\output_sync " << output_sync << '\n';
+       if (!output_sync_macro.empty())
+               os << "\\output_sync_macro \"" << output_sync_macro << "\"\n";
        os << "\\bibtex_command " << bibtex_command << '\n';
        os << "\\index_command " << index_command << '\n';
 
@@ -1056,10 +1063,14 @@ void BufferParams::writeFile(ostream & os) const
        os << "\\tracking_changes " << convert<string>(trackChanges) << '\n'
                 << "\\output_changes " << convert<string>(outputChanges) << '\n'
                 << "\\html_math_output " << html_math_output << '\n'
-                << "\\html_be_strict " << convert<string>(html_be_strict) << '\n'
-                << "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n'
-                << "\\html_latex_start " << html_latex_start << "\n"
-                << "\\html_latex_end " << html_latex_end << "\n";
+                << "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
+       
+       if (html_math_img_scale != 1.0)
+               os << "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n';
+       if (!html_latex_start.empty())
+               os << "\\html_latex_start " << html_latex_start << '\n';
+       if (!html_latex_end.empty())
+                os << "\\html_latex_end " << html_latex_end << '\n';
 
        os << pimpl_->authorlist;
 }
@@ -1651,6 +1662,15 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        // Now insert the LyX specific LaTeX commands...
        docstring lyxpreamble;
 
+       if (output_sync) {
+               if (!output_sync_macro.empty())
+                       lyxpreamble += from_utf8(output_sync_macro) +"\n";
+               else if (features.runparams().flavor == OutputParams::LATEX)
+                       lyxpreamble += "\\usepackage[active]{srcltx}\n";
+               else if (features.runparams().flavor == OutputParams::PDFLATEX)
+                       lyxpreamble += "\\synctex=-1\n";
+       }
+
        // due to interferences with babel and hyperref, the color package has to
        // be loaded (when it is not already loaded) before babel when hyperref
        // is used with the colorlinks option, see