Toolbars.C
WorkArea.C
guiapi.C
+ lyx_gui.C
nullpainter.C
''')
///
virtual Selection & selection() = 0;
+ /// return a suitable serif font name.
+ virtual std::string const romanFontName() = 0;
+
+ /// return a suitable sans serif font name.
+ virtual std::string const sansFontName() = 0;
+
+ /// return a suitable monospaced font name.
+ virtual std::string const typewriterFontName() = 0;
+
///
LyXFunc & lyxFunc();
LyXFunc const & lyxFunc() const;
guiapi.h \
guiapi.C \
key_state.h \
+ lyx_gui.C \
lyx_gui.h \
mouse_state.h \
nullpainter.C \
}
+string const GuiApplication::romanFontName()
+{
+ return "times";
+}
+
+
+string const GuiApplication::sansFontName()
+{
+ return "helvetica";
+}
+
+
+string const GuiApplication::typewriterFontName()
+{
+ return "courier";
+}
+
+
} // namespace frontend
} // namespace lyx
{
public:
GuiApplication(int & argc, char ** argv);
+ ///
+ virtual ~GuiApplication() {}
/// Method inherited from \c Application class
//@{
virtual int const exec();
virtual Gui & gui() { return gui_; }
virtual void exit(int status);
+ virtual std::string const romanFontName();
+ virtual std::string const sansFontName();
+ virtual std::string const typewriterFontName();
//@}
///
using lyx::frontend::GView;
-bool lyx_gui::use_gui = true;
-
namespace {
/// estimate DPI from X server
} // namespace anon
-lyx::frontend::Application * theApp;
GuiApplication * guiApp;
int lyx_gui::exec(int & argc, char * argv[])
}
-void lyx_gui::parse_lyxrc()
-{
-}
-
-
-LyXView * lyx_gui::create_view(unsigned int width, unsigned int height,
- int posx, int posy, bool maximize)
-{
- return &guiApp->createView(width, height, posx, posy, maximize);
-}
-
-
-int lyx_gui::start(LyXView *, string const & batch)
-{
- return guiApp->start(batch);
-}
-
-
void lyx_gui::exit(int status)
{
guiApp->exit(status);
}
-FuncStatus lyx_gui::getStatus(FuncRequest const & ev)
-{
- FuncStatus flag;
- switch (ev.action) {
- case LFUN_TOOLTIPS_TOGGLE:
- flag.unknown(true);
- break;
- default:
- break;
- }
-
- return flag;
-}
-
-
bool lyx_gui::getRGBColor(LColor_color col, lyx::RGBColor & rgbcol)
{
Gdk::Color gdkColor;
}
-string const lyx_gui::roman_font_name()
-{
- return "times";
-}
-
-
-string const lyx_gui::sans_font_name()
-{
- return "helvetica";
-}
-
-
-string const lyx_gui::typewriter_font_name()
-{
- return "courier";
-}
-
-
void lyx_gui::sync_events()
{
// FIXME
--- /dev/null
+/**
+ * \file frontends/lyx_gui.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "lyx_gui.h"
+
+#include "LyXView.h"
+#include "Application.h"
+
+#include "funcrequest.h"
+
+using std::string;
+
+lyx::frontend::Application * theApp;
+
+
+namespace lyx_gui {
+
+bool use_gui = true;
+
+void parse_lyxrc()
+{}
+
+
+LyXView * create_view(unsigned int width, unsigned int height, int posx, int posy,
+ bool maximize)
+{
+ return &theApp->createView(width, height, posx, posy, maximize);
+}
+
+
+int start(LyXView * view, string const & batch)
+{
+ return theApp->start(batch);
+}
+
+
+FuncStatus getStatus(FuncRequest const & ev)
+{
+ FuncStatus flag;
+ switch (ev.action) {
+ case LFUN_TOOLTIPS_TOGGLE:
+ flag.unknown(true);
+ break;
+ default:
+ break;
+ }
+
+ return flag;
+}
+
+
+string const roman_font_name()
+{
+ if (!use_gui)
+ return "serif";
+
+ return theApp->romanFontName();
+}
+
+
+string const sans_font_name()
+{
+ if (!use_gui)
+ return "sans";
+
+ return theApp->sansFontName();
+}
+
+
+string const typewriter_font_name()
+{
+ if (!use_gui)
+ return "monospace";
+
+ return theApp->typewriterFontName();
+}
+
+}; // namespace lyx_gui
}
+string const GuiApplication::romanFontName()
+{
+ QFont font;
+ font.setStyleHint(QFont::Serif);
+ font.setFamily("serif");
+
+ return fromqstr(QFontInfo(font).family());
+}
+
+
+string const GuiApplication::sansFontName()
+{
+ QFont font;
+ font.setStyleHint(QFont::SansSerif);
+ font.setFamily("sans");
+
+ return fromqstr(QFontInfo(font).family());
+}
+
+
+string const GuiApplication::typewriterFontName()
+{
+ QFont font;
+ font.setStyleHint(QFont::TypeWriter);
+ font.setFamily("monospace");
+
+ return fromqstr(QFontInfo(font).family());
+}
+
+
////////////////////////////////////////////////////////////////////////
// X11 specific stuff goes here...
#ifdef Q_WS_X11
{
public:
GuiApplication(int & argc, char ** argv);
+ ///
+ virtual ~GuiApplication() {}
/// Method inherited from \c Application class
//@{
virtual int const exec();
virtual Gui & gui() { return gui_; }
virtual void exit(int status);
+ virtual std::string const romanFontName();
+ virtual std::string const sansFontName();
+ virtual std::string const typewriterFontName();
//@}
///
} // namespace anon
-lyx::frontend::Application * theApp;
GuiApplication * guiApp;
namespace lyx_gui {
-bool use_gui = true;
-
-
int exec(int & argc, char * argv[])
{
GuiApplication app(argc, argv);
}
-void parse_lyxrc()
-{}
-
-
-LyXView* create_view(unsigned int width, unsigned int height, int posx, int posy,
- bool maximize)
-{
- return &guiApp->createView(width, height, posx, posy, maximize);
-}
-
-
-int start(LyXView *, string const & batch)
-{
- return theApp->start(batch);
-}
-
-
void sync_events()
{
// This is the ONLY place where processEvents may be called.
}
-FuncStatus getStatus(FuncRequest const & ev)
-{
- FuncStatus flag;
- switch (ev.action) {
- case LFUN_TOOLTIPS_TOGGLE:
- flag.unknown(true);
- break;
- default:
- break;
- }
-
- return flag;
-}
-
-
bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol)
{
QColor const & qcol = lcolorcache.get(col);
socket_callbacks.erase(fd);
}
-
-string const roman_font_name()
-{
- if (!use_gui)
- return "serif";
-
- QFont font;
- font.setStyleHint(QFont::Serif);
- font.setFamily("serif");
-
- return fromqstr(QFontInfo(font).family());
-}
-
-
-string const sans_font_name()
-{
- if (!use_gui)
- return "sans";
-
- QFont font;
- font.setStyleHint(QFont::SansSerif);
- font.setFamily("sans");
-
- return fromqstr(QFontInfo(font).family());
-}
-
-
-string const typewriter_font_name()
-{
- if (!use_gui)
- return "monospace";
-
- QFont font;
- font.setStyleHint(QFont::TypeWriter);
- font.setFamily("monospace");
-
- return fromqstr(QFontInfo(font).family());
-}
-
}; // namespace lyx_gui
}
+string const GuiApplication::romanFontName()
+{
+ QFont font;
+ font.setStyleHint(QFont::Serif);
+ font.setFamily("serif");
+
+ return fromqstr(QFontInfo(font).family());
+}
+
+
+string const GuiApplication::sansFontName()
+{
+ QFont font;
+ font.setStyleHint(QFont::SansSerif);
+ font.setFamily("sans");
+
+ return fromqstr(QFontInfo(font).family());
+}
+
+
+string const GuiApplication::typewriterFontName()
+{
+ QFont font;
+ font.setStyleHint(QFont::TypeWriter);
+ font.setFamily("monospace");
+
+ return fromqstr(QFontInfo(font).family());
+}
////////////////////////////////////////////////////////////////////////
{
public:
GuiApplication(int & argc, char ** argv);
+ ///
+ virtual ~GuiApplication() {}
/// Method inherited from \c Application class
//@{
virtual int const exec();
virtual Gui & gui() { return gui_; }
virtual void exit(int status);
+ virtual std::string const romanFontName();
+ virtual std::string const sansFontName();
+ virtual std::string const typewriterFontName();
//@}
///
#include "support/lstrings.h"
-
#include "GuiView.h"
#include "QLImage.h"
#include "qt_helpers.h"
using std::string;
lyx::frontend::GuiApplication * guiApp;
-lyx::frontend::Application * theApp;
-
namespace {
namespace lyx_gui {
-bool use_gui = true;
-
int exec(int & argc, char * argv[])
{
/*
}
-void parse_lyxrc()
-{}
-
-
-LyXView * create_view(unsigned int width, unsigned int height, int posx, int posy,
- bool maximize)
-{
- return &guiApp->createView(width, height, posx, posy, maximize);
-}
-
-
-int start(LyXView * view, string const & batch)
-{
- return theApp->start(batch);
-}
-
-
void sync_events()
{
// This is the ONLY place where processEvents may be called.
}
-FuncStatus getStatus(FuncRequest const & ev)
-{
- FuncStatus flag;
- switch (ev.action) {
- case LFUN_TOOLTIPS_TOGGLE:
- flag.unknown(true);
- break;
- default:
- break;
- }
-
- return flag;
-}
-
-
bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol)
{
QColor const & qcol = guiApp->colorCache().get(col);
socket_callbacks.erase(fd);
}
-
-string const roman_font_name()
-{
- if (!use_gui)
- return "serif";
-
- QFont font;
- font.setStyleHint(QFont::Serif);
- font.setFamily("serif");
-
- return fromqstr(QFontInfo(font).family());
-}
-
-
-string const sans_font_name()
-{
- if (!use_gui)
- return "sans";
-
- QFont font;
- font.setStyleHint(QFont::SansSerif);
- font.setFamily("sans");
-
- return fromqstr(QFontInfo(font).family());
-}
-
-
-string const typewriter_font_name()
-{
- if (!use_gui)
- return "monospace";
-
- QFont font;
- font.setStyleHint(QFont::TypeWriter);
- font.setFamily("monospace");
-
- return fromqstr(QFontInfo(font).family());
-}
-
}; // namespace lyx_gui