]> git.lyx.org Git - lyx.git/blobdiff - src/buffer_funcs.C
revert recent change to development/FORMAT (don't change history)
[lyx.git] / src / buffer_funcs.C
index b4f4bf7bf7e2d35d456a1943fba6ddb84d331230..22544c76dc8cc90155cba751aca63b808bc87725 100644 (file)
@@ -33,6 +33,7 @@
 #include "lyxvc.h"
 #include "texrow.h"
 #include "vc-backend.h"
+#include "toc.h"
 
 #include "frontends/Alert.h"
 
@@ -193,7 +194,8 @@ Buffer * newFile(string const & filename, string const & templatename,
                        string const file = makeDisplayPath(tname, 50);
                        string const text  = bformat(_("The specified document template\n%1$s\ncould not be read."), file);
                        Alert::error(_("Could not read template"), text);
-                       // no template, start with empty buffer
+                       bufferlist.release(b);
+                       return 0;
                }
        }
 
@@ -210,7 +212,8 @@ Buffer * newFile(string const & filename, string const & templatename,
 }
 
 
-void bufferErrors(Buffer const & buf, TeXErrors const & terr)
+void bufferErrors(Buffer const & buf, TeXErrors const & terr,
+                                 ErrorList & errorList)
 {
        TeXErrors::Errors::const_iterator cit = terr.begin();
        TeXErrors::Errors::const_iterator end = terr.end();
@@ -229,23 +232,15 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr)
                                                          pos_end);
                } while (found && id_start == id_end && pos_start == pos_end);
 
-               buf.error(ErrorItem(cit->error_desc, cit->error_text,
-                                   id_start, pos_start, pos_end));
+               errorList.push_back(ErrorItem(cit->error_desc,
+                       cit->error_text, id_start, pos_start, pos_end));
        }
 }
 
 
-void bufferErrors(Buffer const & buf, ErrorList const & el)
-{
-       for_each(el.begin(), el.end(), bind(ref(buf.error), _1));
-}
-
-
 string const bufferFormat(Buffer const & buffer)
 {
-       if (buffer.isLinuxDoc())
-               return "linuxdoc";
-       else if (buffer.isDocBook())
+       if (buffer.isDocBook())
                return "docbook";
        else if (buffer.isLiterate())
                return "literate";
@@ -513,8 +508,11 @@ bool updateCurrentLabel(Buffer const & buf,
        ParIterator & it)       
 {
     if (it == par_iterator_end(buf.inset()))
-        return true;
-       
+        return false;
+
+//     if (it.lastpit == 0 && LyXText::isMainText())
+//             return false;
+
        switch (it->layout()->labeltype) {
                
        case LABEL_NO_LABEL:
@@ -582,6 +580,8 @@ void updateLabels(Buffer const & buf)
                // set the counter for this paragraph
                setLabel(buf, it);
        }
+
+       lyx::toc::updateToc(buf);
 }