]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
use ParagraphList::iterator a bit more
[lyx.git] / src / buffer.C
index 546f986c704f392198213ba488df867ca5e13fb6..030e4f3d556c1f0c619b0b500f3912b28d602156 100644 (file)
@@ -162,7 +162,7 @@ Buffer::Buffer(string const & file, bool ronly)
        }
 
        // set initial author
-       authorlist.record(Author(lyxrc.user_name, lyxrc.user_email)); 
+       authorlist.record(Author(lyxrc.user_name, lyxrc.user_email));
 }
 
 
@@ -396,7 +396,7 @@ namespace {
        // but this code is too b0rken to admit of a better solution yet
        Change current_change;
 };
+
 
 bool
 Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
@@ -772,7 +772,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                istringstream ss(lex.getString());
                Author a;
                ss >> a;
-               int aid(authorlist.record(a)); 
+               int aid(authorlist.record(a));
                lyxerr << "aid is " << aid << endl;
                lyxerr << "listed aid is " << author_ids.size() << endl;
                author_ids.push_back(authorlist.record(a));
@@ -1135,7 +1135,6 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par,
                        inset = new InsetParent(inscmd, *this);
                }
        } else {
-               bool alreadyread = false;
                if (tmptok == "Quotes") {
                        inset = new InsetQuotes;
                } else if (tmptok == "External") {
@@ -1144,16 +1143,8 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par,
                        inset = new InsetFormulaMacro;
                } else if (tmptok == "Formula") {
                        inset = new InsetFormula;
-               } else if (tmptok == "Figure") { // Backward compatibility
-//                     inset = new InsetFig(100, 100, *this);
-                       inset = new InsetGraphics;
                } else if (tmptok == "Graphics") {
                        inset = new InsetGraphics;
-               } else if (tmptok == "Info") {// backwards compatibility
-                       inset = new InsetNote(this,
-                                             lex.getLongString("\\end_inset"),
-                                             true);
-                       alreadyread = true;
                } else if (tmptok == "Note") {
                        inset = new InsetNote(params);
                } else if (tmptok == "Include") {
@@ -1193,7 +1184,8 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par,
                        inset = new InsetFloatList;
                }
 
-               if (inset && !alreadyread) inset->read(this, lex);
+               if (inset)
+                       inset->read(this, lex);
        }
 
        if (inset) {
@@ -1400,7 +1392,7 @@ bool Buffer::writeFile(string const & fname) const
                        ofs << "\\author " << it->second << "\n";
                }
        }
+
        Paragraph::depth_type depth = 0;
 
        // this will write out all the paragraphs
@@ -1786,7 +1778,7 @@ void Buffer::makeLaTeXFile(ostream & os,
                texrow.newline();
        }
 
-       latexParagraphs(os, &*(paragraphs.begin()), 0, texrow);
+       latexParagraphs(os, paragraphs.begin(), paragraphs.end(), texrow);
 
        // add this just in case after all the paragraphs
        os << endl;
@@ -1824,8 +1816,10 @@ void Buffer::makeLaTeXFile(ostream & os,
 //
 // LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
 //
-void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
-                            Paragraph * endpar, TexRow & texrow,
+void Buffer::latexParagraphs(ostream & ofs,
+                            ParagraphList::iterator par,
+                            ParagraphList::iterator endpar,
+                            TexRow & texrow,
                             bool moving_arg) const
 {
        bool was_title = false;
@@ -1873,12 +1867,12 @@ void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
                        if (layout->isEnvironment() ||
                                !par->params().leftIndent().zero())
                        {
-                               par = par->TeXEnvironment(this, params, ofs, texrow);
+                               par = TeXEnvironment(this, params, par, ofs, texrow);
                        } else {
-                               par = par->TeXOnePar(this, params, ofs, texrow, moving_arg);
+                               par = TeXOnePar(this, params, par, ofs, texrow, moving_arg);
                        }
                } else {
-                       par = par->TeXOnePar(this, params, ofs, texrow, moving_arg);
+                       par = TeXOnePar(this, params, par, ofs, texrow, moving_arg);
                }
        }
        // It might be that we only have a title in this document
@@ -2813,7 +2807,7 @@ void Buffer::validate(LaTeXFeatures & features) const
                features.require("dvipost");
                features.require("color");
        }
+
        // AMS Style is at document level
        if (params.use_amsmath || tclass.provides(LyXTextClass::amsmath))
                features.require("amsmath");
@@ -3014,7 +3008,7 @@ Paragraph * Buffer::getParFromID(int id) const
 {
        if (id < 0)
                return 0;
+
        // why should we allow < 0 ??
        //lyx::Assert(id >= 0);