]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
more guii moving around.
[lyx.git] / src / buffer.C
index 930074c404f6a4421d4cbaaea9b7df119c60d9db..3da303c63136701d815010840e97f2d198cf8b94 100644 (file)
@@ -31,7 +31,7 @@
 #include "version.h"
 #include "LaTeX.h"
 #include "Chktex.h"
-#include "LyXView.h"
+#include "frontends/LyXView.h"
 #include "debug.h"
 #include "LaTeXFeatures.h"
 #include "lyxtext.h"
@@ -330,8 +330,11 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
 
        Paragraph * first_par = 0;
        LyXFont font(LyXFont::ALL_INHERIT, params.language);
+
+#if 0
        if (file_format < 216 && params.language->lang() == "hebrew")
                font.setLanguage(default_language);
+#endif
 
        if (!par) {
                par = new Paragraph;
@@ -418,8 +421,10 @@ Inset * Buffer::isErtInset(Paragraph * par, int pos) const
 
 void Buffer::insertErtContents(Paragraph * par, int & pos, bool set_inactive)
 {
-       string str = frontStrip(strip(ert_comp.contents, ' '), ' ');
-       if (!str.empty()) {
+       if (ert_comp.contents.find_first_not_of(' ') != string::npos) {
+               // we only skip completely empty ERT (only spaces) otherwise
+               // we have to insert it as is.
+               string str(ert_comp.contents);
                lyxerr[Debug::INSETS] << "ERT contents:\n'"
                        << str << "'" << endl;
                // check if we have already an ert inset a position earlier
@@ -519,8 +524,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                // not ALL_INHERIT,document_language then it will be set to the
                // right values after this tag (Jug 20020420)
                font = LyXFont(LyXFont::ALL_INHERIT, params.language);
+
+#if 0
                if (file_format < 216 && params.language->lang() == "hebrew")
                        font.setLanguage(default_language);
+#endif
 
                lex.eatLine();
                string layoutname = lex.getString();
@@ -727,7 +735,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                LyXLex nylex(0, 0);
                nylex.setStream(istr);
                inset->read(this, nylex);
-
                par->insertInset(pos, inset, font);
                ++pos;
                insertErtContents(par, pos);
@@ -1080,7 +1087,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                if (ert_comp.active && ert_comp.contents.empty()) {
                        ert_comp.font.setLanguage(font.language());
                }
-#endif                 
+#endif
        } else if (token == "\\numeric") {
                lex.next();
                font.setNumber(font.setLyXMisc(lex.getString()));
@@ -1695,13 +1702,21 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
                                                   _("Old LyX file format found. "
                                                     "Use LyX 0.10.x to read this!"));
                                        return false;
+                               } else if (file_format < 220) {
+                                       Alert::alert(_("ERROR!"),
+                                                    _("Old LyX file format found. "
+                                                      "User LyX 1.2.x to read this!"));
+                                       return false;
                                }
                        }
                        bool the_end = readLyXformat2(lex, par);
                        params.setPaperStuff();
+
+#if 0
                        // the_end was added in 213
                        if (file_format < 213)
                                the_end = true;
+#endif
 
                        if (!the_end) {
                                Alert::alert(_("Warning!"),
@@ -1752,7 +1767,6 @@ bool Buffer::save() const
                */
 
                // Should probably have some more error checking here.
-               // Should be cleaned up in 0.13, at least a bit.
                // Doing it this way, also makes the inodes stay the same.
                // This is still not a very good solution, in particular we
                // might loose the owner of the backup.
@@ -2644,7 +2658,8 @@ void Buffer::makeLaTeXFile(string const & fname,
 // 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) const
+                            Paragraph * endpar, TexRow & texrow,
+                            bool moving_arg) const
 {
        bool was_title = false;
        bool already_title = false;
@@ -2679,10 +2694,10 @@ void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
                        {
                                par = par->TeXEnvironment(this, params, ofs, texrow);
                        } else {
-                               par = par->TeXOnePar(this, params, ofs, texrow, false);
+                               par = par->TeXOnePar(this, params, ofs, texrow, moving_arg);
                        }
                } else {
-                       par = par->TeXOnePar(this, params, ofs, texrow, false);
+                       par = par->TeXOnePar(this, params, ofs, texrow, moving_arg);
                }
        }
        // It might be that we only have a title in this document
@@ -3593,7 +3608,6 @@ void Buffer::simpleDocBookOnePar(ostream & os,
 }
 
 
-// This should be enabled when the Chktex class is implemented. (Asger)
 // chktex should be run with these flags disabled: 3, 22, 25, 30, 38(?)
 // Other flags: -wall -v0 -x
 int Buffer::runChktex()