]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
more 'informational' messages removed?
[lyx.git] / src / buffer.C
index 3ba5c4509326fac046d5e88243e4bb6ad7e33a0e..bd51584ec751c2446b4bfe17389e2df1e4733c60 100644 (file)
@@ -45,6 +45,7 @@
 #include "BufferView.h"
 #include "ParagraphParameters.h"
 #include "iterators.h"
+#include "lyxtextclasslist.h"
 
 #include "mathed/formulamacro.h"
 #include "mathed/formula.h"
@@ -460,9 +461,14 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
 #endif
                lex.eatLine();
                string const layoutname = lex.getString();
+               //lyxerr << "Looking for layout '"
+               // << layoutname << "'!" << endl;
+               
                pair<bool, layout_type> pp
                  = textclasslist.NumberOfLayout(params.textclass, layoutname);
 
+               //lyxerr << "Result: " << pp.first << "/" << pp.second << endl;
+               
 #ifndef NO_COMPABILITY
                if (compare_no_case(layoutname, "latex") == 0) {
                        ert_comp.active = true;
@@ -536,6 +542,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                        } else {
                                // layout not found
                                // use default layout "Standard" (0)
+                               //lyxerr << "Layout '" << layoutname
+                               //       << "' was not found!" << endl;
+                               
                                par->layout = 0;
                                ++unknown_layouts;
                                string const s = _("Layout had to be changed from\n")
@@ -728,21 +737,25 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                par->params().startOfAppendix(true);
        } else if (token == "\\paragraph_separation") {
                int tmpret = lex.findToken(string_paragraph_separation);
-               if (tmpret == -1) ++tmpret;
+               if (tmpret == -1)
+                       ++tmpret;
                if (tmpret != LYX_LAYOUT_DEFAULT) 
                        params.paragraph_separation =
                                static_cast<BufferParams::PARSEP>(tmpret);
        } else if (token == "\\defskip") {
                lex.nextToken();
                params.defskip = VSpace(lex.getString());
+#ifndef NO_COMPABILITY
        } else if (token == "\\epsfig") { // obsolete
                // Indeed it is obsolete, but we HAVE to be backwards
                // compatible until 0.14, because otherwise all figures
                // in existing documents are irretrivably lost. (Asger)
                params.readGraphicsDriver(lex);
+#endif
        } else if (token == "\\quotes_language") {
                int tmpret = lex.findToken(string_quotes_language);
-               if (tmpret == -1) ++tmpret;
+               if (tmpret == -1)
+                       ++tmpret;
                if (tmpret != LYX_LAYOUT_DEFAULT) {
                        InsetQuotes::quote_language tmpl = 
                                InsetQuotes::EnglishQ;
@@ -805,7 +818,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                params.use_numerical_citations = lex.getInteger();
        } else if (token == "\\paperorientation") {
                int tmpret = lex.findToken(string_orientation);
-               if (tmpret == -1) ++tmpret;
+               if (tmpret == -1)
+                       ++tmpret;
                if (tmpret != LYX_LAYOUT_DEFAULT) 
                        params.orientation = static_cast<BufferParams::PAPER_ORIENTATION>(tmpret);
        } else if (token == "\\paperwidth") {
@@ -1768,7 +1782,8 @@ bool Buffer::writeFile(string const & fname, bool flag) const
 
 
 string const Buffer::asciiParagraph(Paragraph const * par,
-                                    unsigned int linelen) const
+                                    unsigned int linelen,
+                                    bool noparbreak) const
 {
        ostringstream buffer;
        ostringstream word;
@@ -1777,8 +1792,6 @@ string const Buffer::asciiParagraph(Paragraph const * par,
        Paragraph::depth_type ltype_depth = 0;
        string::size_type currlinelen = 0;
        bool ref_printed = false;
-
-       int noparbreak = 0;
 //     if (!par->previous()) {
 #if 0
        // begins or ends a deeper area ?
@@ -1907,7 +1920,7 @@ string const Buffer::asciiParagraph(Paragraph const * par,
                        if (inset) {
                                if (linelen > 0)
                                        buffer << word.str();
-                               if (inset->ascii(this, buffer)) {
+                               if (inset->ascii(this, buffer, linelen)) {
                                        // to be sure it breaks paragraph
                                        currlinelen += linelen;
                                }
@@ -1999,14 +2012,16 @@ void Buffer::writeFileAscii(ostream & ofs, int linelen)
 {
        Paragraph * par = paragraph;
        while (par) {
-               ofs << asciiParagraph(par, linelen);
+               ofs << asciiParagraph(par, linelen, par->previous() == 0);
                par = par->next();
        }
        ofs << "\n";
 }
 
+
 bool use_babel;
 
+
 void Buffer::makeLaTeXFile(string const & fname, 
                           string const & original_path,
                           bool nice, bool only_body)