]> git.lyx.org Git - features.git/blobdiff - src/bufferparams.C
change "support/std_sstream.h" to <sstream>
[features.git] / src / bufferparams.C
index a081842fbfc602c759ee1a99a9092d68dee20eb4..448edc75dc9ea4ae960fb3a706d767532134e414 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <boost/array.hpp>
 
-#include "support/std_sstream.h"
+#include <sstream>
 
 namespace support = lyx::support;
 using lyx::support::bformat;
@@ -55,6 +55,8 @@ using std::ostream;
 using std::ostringstream;
 using std::pair;
 
+namespace biblio = lyx::biblio;
+
 
 struct BufferParams::Impl
 {
@@ -113,9 +115,8 @@ BufferParams::BufferParams()
        orientation = ORIENTATION_PORTRAIT;
        use_geometry = false;
        use_amsmath = AMS_AUTO;
-       use_natbib = false;
-       use_numerical_citations = false;
-       use_jurabib = false;
+       cite_engine = biblio::ENGINE_BASIC;
+       use_bibtopic = false;
        tracking_changes = false;
        secnumdepth = 3;
        tocdepth = 3;
@@ -316,15 +317,21 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
                lex.nextToken();
                use_amsmath = static_cast<AMS>(
                        lex.getInteger());
-       } else if (token == "\\use_natbib") {
-               lex.nextToken();
-               use_natbib = lex.getInteger();
-       } else if (token == "\\use_numerical_citations") {
+       } else if (token == "\\cite_engine") {
                lex.nextToken();
-               use_numerical_citations = lex.getInteger();
-       } else if (token == "\\use_jurabib") {
+               string const engine = lex.getString();
+
+               cite_engine = biblio::ENGINE_BASIC;
+               if (engine == "natbib_numerical")
+                       cite_engine = biblio::ENGINE_NATBIB_NUMERICAL;
+               else if (engine == "natbib_authoryear")
+                       cite_engine = biblio::ENGINE_NATBIB_AUTHORYEAR;
+               else if (engine == "jurabib")
+                       cite_engine = biblio::ENGINE_JURABIB;
+
+       } else if (token == "\\use_bibtopic") {
                lex.nextToken();
-               use_jurabib = lex.getInteger();
+               use_bibtopic = lex.getInteger();
        } else if (token == "\\tracking_changes") {
                lex.nextToken();
                tracking_changes = lex.getInteger();
@@ -352,7 +359,8 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
                                // Update also the LColor table:
                                if (color == "none")
                                        color = lcolor.getX11Name(LColor::background);
-                               lcolor.setColor(lcolor.getFromLyXName(branch), color);
+                               lcolor.setColor(branch, color);
+
                        }
                }
        } else if (token == "\\author") {
@@ -535,13 +543,27 @@ void BufferParams::writeFile(ostream & os) const
 
        spacing().writeFile(os);
 
+       string cite_engine_str = "basic";
+       switch (cite_engine) {
+       case biblio::ENGINE_BASIC:
+               break;
+       case biblio::ENGINE_NATBIB_NUMERICAL:
+               cite_engine_str = "natbib_numerical";
+               break;
+       case biblio::ENGINE_NATBIB_AUTHORYEAR:
+               cite_engine_str = "natbib_authoryear";
+               break;
+       case biblio::ENGINE_JURABIB:
+               cite_engine_str = "jurabib";
+               break;
+       }
+
        os << "\\papersize " << string_papersize[papersize2]
           << "\n\\paperpackage " << string_paperpackages[paperpackage]
           << "\n\\use_geometry " << use_geometry
           << "\n\\use_amsmath " << use_amsmath
-          << "\n\\use_natbib " << use_natbib
-          << "\n\\use_numerical_citations " << use_numerical_citations
-          << "\n\\use_jurabib " << use_jurabib
+          << "\n\\cite_engine " << cite_engine_str
+          << "\n\\use_bibtopic " << use_bibtopic
           << "\n\\paperorientation " << string_orientation[orientation]
           << '\n';
 
@@ -931,7 +953,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                   << features.getBabelOptions();
                texrow.newline();
        }
-       
+
        // Now insert the LyX specific LaTeX commands...
 
        // The optional packages;
@@ -1000,7 +1022,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                lyxpreamble += bullets_def + "}\n\n";
 
        // We try to load babel late, in case it interferes
-       // with other packages. 
+       // with other packages.
        // Jurabib has to be called after babel, though.
        if (use_babel && !features.isRequired("jurabib")) {
                lyxpreamble += babelCall(language_options.str()) + '\n';