]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
More fixes to the autocollapsing of paragraphs.
[lyx.git] / src / buffer.C
index fd042864410e98aed704a8533afbdcdf68b8f41e..7ae0873b3715c7cc0c0819677febdeb8b9b85a50 100644 (file)
 
 #include <config.h>
 
-#include <fstream>
-#include <iomanip>
-#include <map>
-#include <stack>
-#include <list>
-
-#include <cstdlib>
-#include <cmath>
-#include <unistd.h>
-#include <sys/types.h>
-#include <utime.h>
-
-#include <algorithm>
-
-#ifdef HAVE_LOCALE
-#include <locale>
-#endif
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 #include "bufferview_funcs.h"
 #include "lyxfont.h"
 #include "version.h"
+#include "LaTeX.h"
+#include "Chktex.h"
+#include "LyXView.h"
+#include "debug.h"
+#include "LaTeXFeatures.h"
+#include "lyxtext.h"
+#include "gettext.h"
+#include "language.h"
+#include "encoding.h"
+#include "exporter.h"
+#include "Lsstream.h"
+#include "converter.h"
+#include "BufferView.h"
+#include "ParagraphParameters.h"
+#include "iterators.h"
+
 #include "mathed/formulamacro.h"
 #include "mathed/formula.h"
+
 #include "insets/inset.h"
 #include "insets/inseterror.h"
 #include "insets/insetlabel.h"
 #endif
 #include "insets/insetcaption.h"
 #include "insets/insetfloatlist.h"
+
+#include "frontends/Dialogs.h"
+#include "frontends/Alert.h"
+
 #include "support/textutils.h"
 #include "support/filetools.h"
 #include "support/path.h"
 #include "support/os.h"
-#include "LaTeX.h"
-#include "Chktex.h"
-#include "LyXView.h"
-#include "debug.h"
-#include "LaTeXFeatures.h"
 #include "support/syscall.h"
 #include "support/lyxlib.h"
 #include "support/FileInfo.h"
 #include "support/lyxmanip.h"
-#include "lyxtext.h"
-#include "gettext.h"
-#include "language.h"
-#include "frontends/Dialogs.h"
-#include "frontends/Alert.h"
-#include "encoding.h"
-#include "exporter.h"
-#include "Lsstream.h"
-#include "converter.h"
-#include "BufferView.h"
-#include "ParagraphParameters.h"
-#include "iterators.h"
+
+#include <fstream>
+#include <iomanip>
+#include <map>
+#include <stack>
+#include <list>
+#include <algorithm>
+
+#include <cstdlib>
+#include <cmath>
+#include <unistd.h>
+#include <sys/types.h>
+#include <utime.h>
+
+
+#ifdef HAVE_LOCALE
+#include <locale>
+#endif
+
 
 using std::ostream;
 using std::ofstream;
@@ -188,7 +193,7 @@ Buffer::~Buffer()
 
 string const Buffer::getLatexName(bool no_path) const
 {
-       string name = ChangeExtension(MakeLatexName(filename), ".tex");
+       string const name = ChangeExtension(MakeLatexName(filename), ".tex");
        if (no_path)
                return OnlyFilename(name);
        else
@@ -245,7 +250,8 @@ void Buffer::setReadonly(bool flag)
 // Should work on a list
 void Buffer::updateTitles() const
 {
-       if (users) users->owner()->updateWindowTitle();
+       if (users)
+               users->owner()->updateWindowTitle();
 }
 
 
@@ -253,7 +259,8 @@ void Buffer::updateTitles() const
 // Should work on a list
 void Buffer::resetAutosaveTimers() const
 {
-       if (users) users->owner()->resetAutosaveTimer();
+       if (users)
+               users->owner()->resetAutosaveTimer();
 }
 
 
@@ -388,12 +395,14 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
 
 #ifndef NO_COMPABILITY
 void Buffer::insertErtContents(Paragraph * par, int & pos,
-                              LyXFont const & font, bool set_inactive) 
+                       LyXFont const & f, bool set_inactive) 
 {
        if (!ert_comp.contents.empty()) {
-               lyxerr[Debug::INSETS] << "ERT contents:\n"
-                      << ert_comp.contents << endl;
+               lyxerr[Debug::INSETS] << "ERT contents:\n'"
+                                     << ert_comp.contents << "'" << endl;
                Inset * inset = new InsetERT(ert_comp.contents, true);
+               LyXFont font;
+               font.setLanguage(f.language());
                par->insertInset(pos++, inset, font);
                ert_comp.contents.erase();
        }
@@ -533,9 +542,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                                        + layoutname + _(" to ")
                                        + textclasslist.NameOfLayout(params.textclass, par->layout);
                                InsetError * new_inset = new InsetError(s);
-                               par->insertInset(0, new_inset);
-                               par->setFont(0, LyXFont(LyXFont::ALL_INHERIT,
-                                                       params.language));
+                               par->insertInset(0, new_inset
+                                                LyXFont(LyXFont::ALL_INHERIT,
+                                                        params.language));
                        }
                        // Test whether the layout is obsolete.
                        LyXLayout const & layout =
@@ -1173,9 +1182,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                        + " " + lex.text()  + "\n";
 
                InsetError * new_inset = new InsetError(s);
-               par->insertInset(pos, new_inset);
-               par->setFont(pos, LyXFont(LyXFont::ALL_INHERIT,
-                                         params.language));
+               par->insertInset(pos, new_inset, LyXFont(LyXFont::ALL_INHERIT,
+                                                        params.language));
 
 #ifndef NO_COMPABILITY
                }
@@ -2440,6 +2448,7 @@ void Buffer::makeLaTeXFile(string const & fname,
        }
        
        lyxerr[Debug::INFO] << "Finished making latex file." << endl;
+       lyxerr[Debug::INFO] << "Row count was " << texrow.rows()-1 << "." << endl;
 }
 
 
@@ -2890,7 +2899,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
                }
 
                list < PAR_TAG > temp;
-               while(!tag_state.empty() && tag_close ) {
+               while (!tag_state.empty() && tag_close ) {
                        PAR_TAG k =  tag_state.top();
                        tag_state.pop();
                        os << "</" << tag_name(k) << ">";
@@ -2971,8 +2980,8 @@ void Buffer::sgmlError(Paragraph * par, int pos,
 {
        // insert an error marker in text
        InsetError * new_inset = new InsetError(message);
-       par->insertInset(pos, new_inset);
-       par->setFont(pos, LyXFont(LyXFont::ALL_INHERIT, params.language));
+       par->insertInset(pos, new_inset, LyXFont(LyXFont::ALL_INHERIT, 
+                                                params.language));
 }