3 * Copyright 2002 the LyX Team
4 * Read the file COPYING
7 * \author John Levon <moz@compsoc.man.ac.uk>
12 #include "support/lyxlib.h"
13 #include "support/os.h"
14 #include "support/filetools.h"
19 #include <boost/bind.hpp>
25 // FIXME: move this stuff out again
26 #include "bufferlist.h"
28 #include "lyxserver.h"
29 #include "BufferView.h"
31 // Dear Lord, deliver us from Evil,
33 #include <boost/shared_ptr.hpp>
34 #include <boost/function/function0.hpp>
35 #include <boost/signals/signal1.hpp>
40 #include <qapplication.h>
42 #ifndef CXX_GLOBAL_CSTD
51 extern BufferList bufferlist;
53 // FIXME: wrong place !
54 LyXServer * lyxserver;
56 void lyx_gui::parse_init(int & argc, char * argv[])
58 static QApplication a(argc, argv);
62 void lyx_gui::parse_lyxrc()
69 void lyx_gui::start(string const & batch, vector<string> files)
74 unsigned int width = 690;
75 unsigned int height = 510;
77 QtView view(width, height);
78 view.show(xpos, ypos, "LyX");
83 // FIXME: some code below needs moving
85 lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes);
87 vector<string>::const_iterator cit = files.begin();
88 vector<string>::const_iterator end = files.end();
89 for (; cit != end; ++cit) {
90 Buffer * b = bufferlist.loadLyXFile(*cit);
96 // switch to the last buffer successfully loaded
98 view.view()->buffer(last);
101 // handle the batch commands the user asked for
102 if (!batch.empty()) {
103 view.getLyXFunc()->verboseDispatch(batch, false);
107 qApp->processEvents();
115 void lyx_gui::init_graphics()
117 using namespace grfx;
119 Image::newImage = boost::bind(&QLImage::newImage);
120 Image::loadableFormats = boost::bind(&QLImage::loadableFormats);
124 string const lyx_gui::hexname(LColor::color col)