]> git.lyx.org Git - lyx.git/blobdiff - src/bufferparams.C
Add margin to paragraph dialog.
[lyx.git] / src / bufferparams.C
index 03d3758a838f571d0b87f5540ea65df762006cc7..2bdcf37fb4faaf696a988cb4fdc08029c97a5c4d 100644 (file)
@@ -303,7 +303,7 @@ BufferParams::BufferParams()
        use_geometry = false;
        use_amsmath = package_auto;
        use_esint = package_auto;
-       cite_engine = biblio::ENGINE_BASIC;
+       cite_engine_ = biblio::ENGINE_BASIC;
        use_bibtopic = false;
        trackChanges = false;
        outputChanges = false;
@@ -495,7 +495,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
        } else if (token == "\\cite_engine") {
                string engine;
                lex >> engine;
-               cite_engine = citeenginetranslator().find(engine);
+               cite_engine_ = citeenginetranslator().find(engine);
        } else if (token == "\\use_bibtopic") {
                lex >> use_bibtopic;
        } else if (token == "\\tracking_changes") {
@@ -603,7 +603,7 @@ void BufferParams::writeFile(ostream & os) const
        // the textclass
        os << "\\textclass " << textclasslist[textclass].name() << '\n';
 
-       // then the the preamble
+       // then the preamble
        if (!preamble.empty()) {
                // remove '\n' from the end of preamble
                string const tmppreamble = rtrim(preamble, "\n");
@@ -642,7 +642,7 @@ void BufferParams::writeFile(ostream & os) const
           << "\n\\use_geometry " << convert<string>(use_geometry)
           << "\n\\use_amsmath " << use_amsmath
           << "\n\\use_esint " << use_esint
-          << "\n\\cite_engine " << citeenginetranslator().find(cite_engine)
+          << "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
           << "\n\\use_bibtopic " << convert<string>(use_bibtopic)
           << "\n\\paperorientation " << string_orientation[orientation]
           << '\n';
@@ -876,7 +876,8 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                        os << "]{inputenc}\n";
                        texrow.newline();
                }
-       } else if (inputenc != "default" && inputenc != "tis620-0") {
+       } else if (inputenc != "default" && inputenc != "tis620-0" &&
+                  inputenc != "ascii") {
                os << "\\usepackage[" << from_ascii(inputenc)
                   << "]{inputenc}\n";
                texrow.newline();
@@ -956,19 +957,19 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                        }
                }
                if (!topmargin.empty())
-                       os << ",tmargin=" << from_ascii(topmargin);
+                       os << ",tmargin=" << from_ascii(LyXLength(topmargin).asLatexString());
                if (!bottommargin.empty())
-                       os << ",bmargin=" << from_ascii(bottommargin);
+                       os << ",bmargin=" << from_ascii(LyXLength(bottommargin).asLatexString());
                if (!leftmargin.empty())
-                       os << ",lmargin=" << from_ascii(leftmargin);
+                       os << ",lmargin=" << from_ascii(LyXLength(leftmargin).asLatexString());
                if (!rightmargin.empty())
-                       os << ",rmargin=" << from_ascii(rightmargin);
+                       os << ",rmargin=" << from_ascii(LyXLength(rightmargin).asLatexString());
                if (!headheight.empty())
-                       os << ",headheight=" << from_ascii(headheight);
+                       os << ",headheight=" << from_ascii(LyXLength(headheight).asLatexString());
                if (!headsep.empty())
-                       os << ",headsep=" << from_ascii(headsep);
+                       os << ",headsep=" << from_ascii(LyXLength(headsep).asLatexString());
                if (!footskip.empty())
-                       os << ",footskip=" << from_ascii(footskip);
+                       os << ",footskip=" << from_ascii(LyXLength(footskip).asLatexString());
                os << "}\n";
                texrow.newline();
        }
@@ -1481,4 +1482,21 @@ Encoding const & BufferParams::encoding() const
        return *(language->encoding());
 }
 
+
+biblio::CiteEngine BufferParams::getEngine() const
+{
+       // FIXME the class should provide the numerical/
+       // authoryear choice
+       if (getLyXTextClass().provides("natbib")
+           && cite_engine_ != biblio::ENGINE_NATBIB_NUMERICAL)
+               return biblio::ENGINE_NATBIB_AUTHORYEAR;
+       return cite_engine_;
+}
+
+
+void BufferParams::setCiteEngine(biblio::CiteEngine const cite_engine)
+{
+       cite_engine_ = cite_engine;
+}
+
 } // namespace lyx