3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
16 // FIXME: move this stuff out again
17 #include "BufferView.h"
19 #include "funcrequest.h"
22 #include "LyXAction.h"
25 #include "lyxserver.h"
26 #include "lyxsocket.h"
28 #include "support/lstrings.h"
29 #include "support/os.h"
30 #include "support/package.h"
33 // Dear Lord, deliver us from Evil, aka the Qt headers
34 // Qt defines a macro 'signals' that clashes with a boost namespace.
35 // All is well if the namespace is visible first.
36 #include <boost/signal.hpp> // FIXME: Is this needed? (Lgb)
37 #include <boost/bind.hpp>
38 #include <boost/shared_ptr.hpp>
39 #include "frontends/LyXView.h"
40 #include "frontends/WorkArea.h"
42 #include "GuiApplication.h"
44 #include "lcolorcache.h"
45 #include "qfont_loader.h"
47 #include "qt_helpers.h"
48 #include "socket_callback.h"
51 #include <Carbon/Carbon.h>
54 #include <qapplication.h>
55 #if QT_VERSION >= 0x030100
56 #include <qeventloop.h>
58 #include <qpaintdevicemetrics.h>
59 #include <qtranslator.h>
60 #include <qtextcodec.h>
62 using lyx::support::ltrim;
63 using lyx::support::package;
65 using lyx::frontend::GuiApplication;
66 using lyx::frontend::QtView;
68 namespace os = lyx::support::os;
70 using boost::shared_ptr;
79 map<int, shared_ptr<socket_callback> > socket_callbacks;
84 GuiApplication * guiApp;
88 int exec(int & argc, char * argv[])
90 GuiApplication app(argc, argv);
95 return LyX::ref().exec2(argc, argv);
101 // This is the ONLY place where processEvents may be called.
102 // During screen update/ redraw, this method is disabled to
103 // prevent keyboard events being handed to the LyX core, where
104 // they could cause re-entrant calls to screen update.
105 #if QT_VERSION >= 0x030100
106 qApp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
111 bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol)
113 QColor const & qcol = lcolorcache.get(col);
114 if (!qcol.isValid()) {
120 rgbcol.r = qcol.red();
121 rgbcol.g = qcol.green();
122 rgbcol.b = qcol.blue();
127 string const hexname(LColor_color col)
129 return ltrim(fromqstr(lcolorcache.get(col).name()), "#");
133 void update_color(LColor_color)
135 // FIXME: Bleh, can't we just clear them all at once ?
140 void register_socket_callback(int fd, boost::function<void()> func)
142 socket_callbacks[fd] = shared_ptr<socket_callback>(new socket_callback(fd, func));
146 void unregister_socket_callback(int fd)
148 socket_callbacks.erase(fd);
151 }; // namespace lyx_gui