]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_main.C
added a parseError signal to Buffer and use it
[lyx.git] / src / lyx_main.C
index f323a19069e7b52177e7380761f5a3267e131388..dee88dd305b48c049a4f4c923c2c37de9ce8482c 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "bufferlist.h"
 #include "buffer.h"
+#include "buffer_funcs.h"
 #include "lyxserver.h"
 #include "kbmap.h"
 #include "lyxfunc.h"
 #include "frontends/lyx_gui.h"
 
 #include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/signals/signal1.hpp>
 
 #include <cstdlib>
 #include <csignal>
+#include <iostream>
 
 using std::vector;
 using std::endl;
@@ -142,14 +146,17 @@ LyX::LyX(int & argc, char * argv[])
                vector<string>::iterator it = files.begin();
                vector<string>::iterator end = files.end();
                for (; it != end; ++it) {
-                       last_loaded = bufferlist.loadLyXFile(*it);
+                       last_loaded = bufferlist.newBuffer(*it, false);
+                       last_loaded->parseError.connect(boost::bind(&LyX::printError, this, _1));
+                       loadLyXFile(last_loaded, *it);
                }
 
                files.clear();
 
                // no buffer loaded, create one
+               string const tmpfile = "tmpfile";
                if (!last_loaded)
-                       last_loaded = bufferlist.newFile("tmpfile", string());
+                       last_loaded = newFile(tmpfile, string());
 
                bool success = false;
 
@@ -212,6 +219,14 @@ static void error_handler(int err_sig)
 }
 
 
+void LyX::printError(ErrorItem const & ei)
+{
+       std::cerr << _("LyX: ") << ei.error 
+                 << ':' << ei.description << std::endl;
+
+}
+
+
 void LyX::init(bool gui)
 {
        signal(SIGHUP, error_handler);