]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
(finishing patch -- question was restored, but there were still problems)
[lyx.git] / src / BufferParams.cpp
index 71601d58171c3a7f79b6dfb888fb3c5a2ffe289b..2a3841f85dd976b9999fd834588cc4654589fc30 100644 (file)
@@ -415,6 +415,7 @@ BufferParams::BufferParams()
        html_math_img_scale = 1.0;
 
        output_sync = false;
+       use_refstyle = true;
 }
 
 
@@ -533,6 +534,8 @@ VSpace const & BufferParams::getDefSkip() const
 
 void BufferParams::setDefSkip(VSpace const & vs)
 {
+       // DEFSKIP will cause an infinite loop
+       LASSERT(vs.kind() != VSpace::DEFSKIP, return);
        pimpl_->defskip = vs;
 }
 
@@ -644,11 +647,11 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                pimpl_->indentation = HSpace(indentation);
        } else if (token == "\\defskip") {
                lex.next();
-               string defskip = lex.getString();
-               if (defskip == "defskip")
-                       // this is invalid
-                       defskip = "medskip";
+               string const defskip = lex.getString();
                pimpl_->defskip = VSpace(defskip);
+               if (pimpl_->defskip.kind() == VSpace::DEFSKIP)
+                       // that is invalid
+                       pimpl_->defskip = VSpace(VSpace::MEDSKIP);
        } else if (token == "\\quotes_language") {
                string quotes_lang;
                lex >> quotes_lang;
@@ -853,6 +856,8 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                lex >> output_sync;
        } else if (token == "\\output_sync_macro") {
                lex >> output_sync_macro;
+       } else if (token == "\\use_refstyle") {
+               lex >> use_refstyle;
        } else {
                lyxerr << "BufferParams::readToken(): Unknown token: " << 
                        token << endl;
@@ -980,6 +985,7 @@ void BufferParams::writeFile(ostream & os) const
           << "\n\\use_indices " << convert<string>(use_indices)
           << "\n\\paperorientation " << string_orientation[orientation]
           << "\n\\suppress_date " << convert<string>(suppress_date)
+                << "\n\\use_refstyle " << use_refstyle
           << '\n';
        if (isbackgroundcolor == true)
                os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
@@ -1942,12 +1948,14 @@ DocumentClass const & BufferParams::documentClass() const
 }
 
 
-DocumentClass const * BufferParams::documentClassPtr() const {
+DocumentClass const * BufferParams::documentClassPtr() const
+{
        return doc_class_;
 }
 
 
-void BufferParams::setDocumentClass(DocumentClass const * const tc) {
+void BufferParams::setDocumentClass(DocumentClass const * const tc)
+{
        // evil, but this function is evil
        doc_class_ = const_cast<DocumentClass *>(tc);
 }