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>
26 // FIXME: move this stuff out again
27 #include "bufferlist.h"
29 #include "lyxserver.h"
30 #include "BufferView.h"
32 // Dear Lord, deliver us from Evil,
34 #include <boost/shared_ptr.hpp>
35 #include <boost/function/function0.hpp>
36 #include <boost/signals/signal1.hpp>
40 #include "qfont_loader.h"
42 #include <qapplication.h>
44 #ifndef CXX_GLOBAL_CSTD
53 extern BufferList bufferlist;
55 // FIXME: wrong place !
56 LyXServer * lyxserver;
58 void lyx_gui::parse_init(int & argc, char * argv[])
60 static QApplication a(argc, argv);
64 Image::newImage = boost::bind(&QLImage::newImage);
65 Image::loadableFormats = boost::bind(&QLImage::loadableFormats);
69 void lyx_gui::parse_lyxrc()
76 void lyx_gui::start(string const & batch, vector<string> files)
81 unsigned int width = 690;
82 unsigned int height = 510;
84 QtView view(width, height);
85 view.show(xpos, ypos, "LyX");
90 // FIXME: some code below needs moving
92 lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes);
94 vector<string>::const_iterator cit = files.begin();
95 vector<string>::const_iterator end = files.end();
96 for (; cit != end; ++cit) {
97 Buffer * b = bufferlist.loadLyXFile(*cit);
103 // switch to the last buffer successfully loaded
105 view.view()->buffer(last);
108 // handle the batch commands the user asked for
109 if (!batch.empty()) {
110 view.getLyXFunc()->verboseDispatch(batch, false);
114 qApp->processEvents();
122 string const lyx_gui::hexname(LColor::color col)
124 QColor color(lcolor.getX11Name(col).c_str());
125 return color.name().latin1();
129 void lyx_gui::update_color(LColor::color)
135 void lyx_gui::update_fonts()
141 bool lyx_gui::font_available(LyXFont const & font)
143 return fontloader.available(font);