]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
added a parseError signal to Buffer and use it
[lyx.git] / src / BufferView_pimpl.C
index f2c3be9d81219075fe9240bc149933b0bd004769..a2770b274f54b7582f6b68cead2be0715b01d7b8 100644 (file)
@@ -130,6 +130,12 @@ BufferView::Pimpl::Pimpl(BufferView * bv, LyXView * owner,
 }
 
 
+void BufferView::Pimpl::addError(ErrorItem const & ei)
+{
+       errorlist_.push_back(ei);
+
+}
+
 
 bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
 {
@@ -161,9 +167,14 @@ bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
        }
        Buffer * b = bufferlist.newBuffer(s);
 
-       //this is the point to attach to the error signal in the buffer
+       bv_->resetErrorList();
+       //attach to the error signal in the buffer
+       b->parseError.connect(boost::bind(&BufferView::Pimpl::addError, 
+                                         this, _1));
 
-       if (!::loadLyXFile(b, s)) {
+       bool loaded = true;
+
+       if (! ::loadLyXFile(b, s)) {
                bufferlist.release(b);
                string text = bformat(_("The document %1$s does "
                                        "not yet exist.\n\n"
@@ -176,13 +187,18 @@ bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
                        bufferlist.close(buffer_, false);
                        buffer(newFile(s, string(), true));
                }
-       }
+
+               loaded = false;
+       } 
 
        buffer(b);
 
        if (tolastfiles)
                lastfiles->newFile(b->fileName());
 
+       if (loaded)
+               bv_->showErrorList(_("Parse"));
+
        return true;
 }