2006-06-26 17:18:28 +00:00
|
|
|
/**
|
2007-08-31 22:16:11 +00:00
|
|
|
* \file GuiApplication.h
|
2006-06-26 17:18:28 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author unknown
|
|
|
|
* \author John Levon
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIAPPLICATION_H
|
|
|
|
#define GUIAPPLICATION_H
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2006-09-26 09:57:47 +00:00
|
|
|
#include "ColorCache.h"
|
2006-10-03 16:17:32 +00:00
|
|
|
#include "GuiFontLoader.h"
|
2006-09-22 15:02:41 +00:00
|
|
|
#include "GuiClipboard.h"
|
|
|
|
#include "GuiImplementation.h"
|
|
|
|
#include "GuiSelection.h"
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2006-09-22 09:47:39 +00:00
|
|
|
#include "frontends/Application.h"
|
|
|
|
|
2006-06-26 17:18:28 +00:00
|
|
|
#include <QApplication>
|
2007-01-04 11:05:57 +00:00
|
|
|
#include <QTranslator>
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2007-08-27 06:35:24 +00:00
|
|
|
class QSessionManager;
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2006-06-26 17:18:28 +00:00
|
|
|
class BufferView;
|
2007-09-15 17:47:35 +00:00
|
|
|
class SocketCallback;
|
2006-06-26 17:18:28 +00:00
|
|
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
class GuiWorkArea;
|
2007-08-07 21:23:40 +00:00
|
|
|
class MenuTranslator;
|
2006-06-26 17:18:28 +00:00
|
|
|
|
|
|
|
/// The Qt main application class
|
|
|
|
/**
|
|
|
|
There should be only one instance of this class. No Qt object
|
|
|
|
initialisation should be done before the instanciation of this class.
|
|
|
|
|
|
|
|
\todo The work areas handling could be moved to a base virtual class
|
|
|
|
comon to all frontends.
|
|
|
|
*/
|
2006-09-22 09:47:39 +00:00
|
|
|
class GuiApplication : public QApplication, public Application
|
2006-06-26 17:18:28 +00:00
|
|
|
{
|
2006-10-23 16:29:24 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2006-06-26 17:18:28 +00:00
|
|
|
public:
|
2006-09-22 09:47:39 +00:00
|
|
|
GuiApplication(int & argc, char ** argv);
|
2006-10-03 10:34:10 +00:00
|
|
|
///
|
2006-10-13 16:48:12 +00:00
|
|
|
virtual ~GuiApplication();
|
2006-09-22 09:47:39 +00:00
|
|
|
|
|
|
|
/// Method inherited from \c Application class
|
|
|
|
//@{
|
2007-08-31 22:16:11 +00:00
|
|
|
virtual Clipboard & clipboard();
|
|
|
|
virtual Selection & selection();
|
2006-10-03 16:17:32 +00:00
|
|
|
virtual FontLoader & fontLoader() { return font_loader_; }
|
2007-09-15 17:47:35 +00:00
|
|
|
virtual int exec();
|
2006-09-22 09:47:39 +00:00
|
|
|
virtual Gui & gui() { return gui_; }
|
|
|
|
virtual void exit(int status);
|
2006-11-29 09:06:37 +00:00
|
|
|
virtual bool event(QEvent * e);
|
2006-10-12 14:10:13 +00:00
|
|
|
void syncEvents();
|
2006-10-03 10:34:10 +00:00
|
|
|
virtual std::string const romanFontName();
|
|
|
|
virtual std::string const sansFontName();
|
|
|
|
virtual std::string const typewriterFontName();
|
2007-04-26 17:34:20 +00:00
|
|
|
virtual bool getRgbColor(Color_color col, RGBColor & rgbcol);
|
|
|
|
virtual std::string const hexName(Color_color col);
|
|
|
|
virtual void updateColor(Color_color col);
|
2006-10-12 14:10:13 +00:00
|
|
|
virtual void registerSocketCallback(
|
|
|
|
int fd, boost::function<void()> func);
|
2006-12-02 17:39:31 +00:00
|
|
|
void unregisterSocketCallback(int fd);
|
2006-09-22 09:47:39 +00:00
|
|
|
//@}
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2007-08-27 06:35:24 +00:00
|
|
|
/// Methods inherited from \c QApplication class
|
2007-04-01 16:06:43 +00:00
|
|
|
//@{
|
2007-08-27 06:35:24 +00:00
|
|
|
bool notify(QObject * receiver, QEvent * event);
|
|
|
|
void commitData(QSessionManager & sm);
|
2007-04-01 16:06:43 +00:00
|
|
|
//@}
|
|
|
|
|
2006-09-26 09:57:47 +00:00
|
|
|
///
|
|
|
|
ColorCache & colorCache() { return color_cache_; }
|
2006-06-26 17:18:28 +00:00
|
|
|
///
|
2006-10-03 16:17:32 +00:00
|
|
|
///
|
|
|
|
GuiFontLoader & guiFontLoader() { return font_loader_; }
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2006-11-26 02:18:32 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
///
|
|
|
|
void execBatchCommands();
|
|
|
|
|
2006-09-22 09:47:39 +00:00
|
|
|
private:
|
2006-06-26 17:18:28 +00:00
|
|
|
///
|
|
|
|
GuiImplementation gui_;
|
2006-09-22 15:02:41 +00:00
|
|
|
///
|
|
|
|
GuiClipboard clipboard_;
|
|
|
|
///
|
|
|
|
GuiSelection selection_;
|
2006-06-26 17:18:28 +00:00
|
|
|
///
|
2006-10-03 16:17:32 +00:00
|
|
|
GuiFontLoader font_loader_;
|
2006-09-26 09:57:47 +00:00
|
|
|
///
|
|
|
|
ColorCache color_cache_;
|
2006-10-12 14:10:13 +00:00
|
|
|
///
|
2007-01-04 11:05:57 +00:00
|
|
|
QTranslator qt_trans_;
|
|
|
|
///
|
2007-09-15 17:47:35 +00:00
|
|
|
std::map<int, SocketCallback *> socket_callbacks_;
|
2006-06-26 17:18:28 +00:00
|
|
|
|
|
|
|
#ifdef Q_WS_X11
|
|
|
|
public:
|
2007-09-15 17:47:35 +00:00
|
|
|
bool x11EventFilter(XEvent * ev);
|
2006-06-26 17:18:28 +00:00
|
|
|
#endif
|
|
|
|
|
2007-08-07 21:23:40 +00:00
|
|
|
/// A translator suitable for the entries in the LyX menu.
|
|
|
|
/// Only needed with Qt/Mac.
|
|
|
|
void addMenuTranslator();
|
|
|
|
///
|
2007-09-15 17:47:35 +00:00
|
|
|
MenuTranslator * menu_trans_;
|
2006-09-22 09:47:39 +00:00
|
|
|
}; // GuiApplication
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
extern GuiApplication * guiApp;
|
|
|
|
|
2006-06-26 17:18:28 +00:00
|
|
|
} // namespace frontend
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIAPPLICATION_H
|