]> git.lyx.org Git - lyx.git/commitdiff
make frontend::Application a bit slimmer
authorAndré Pönitz <poenitz@gmx.net>
Sat, 17 Nov 2007 22:11:11 +0000 (22:11 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sat, 17 Nov 2007 22:11:11 +0000 (22:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21657 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/Application.cpp [deleted file]
src/frontends/Application.h
src/frontends/Makefile.am
src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiApplication.h

diff --git a/src/frontends/Application.cpp b/src/frontends/Application.cpp
deleted file mode 100644 (file)
index c62bf8d..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * \file frontend/Application.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Abdelrazak Younes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "frontends/Application.h"
-
-#include "frontends/NoGuiFontLoader.h"
-#include "frontends/NoGuiFontMetrics.h"
-#include "frontends/FontLoader.h"
-#include "frontends/FontMetrics.h"
-#include "frontends/LyXView.h"
-
-#include "FuncRequest.h"
-#include "FuncStatus.h"
-#include "LyX.h"  // for lyx::use_gui
-#include "Font.h"
-#include "LyXFunc.h"
-#include "LyXRC.h"
-
-#include "support/lstrings.h"
-#include "support/os.h"
-
-
-namespace lyx {
-
-
-frontend::FontLoader & theFontLoader()
-{
-       static frontend::NoGuiFontLoader no_gui_font_loader;
-
-       if (!use_gui)
-               return no_gui_font_loader;
-
-       BOOST_ASSERT(theApp());
-       return theApp()->fontLoader();
-}
-
-
-frontend::FontMetrics const & theFontMetrics(Font const & f)
-{
-       return theFontMetrics(f.fontInfo());
-}
-
-
-frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
-{
-       static frontend::NoGuiFontMetrics no_gui_font_metrics;
-
-       if (!use_gui)
-               return no_gui_font_metrics;
-
-       BOOST_ASSERT(theApp());
-       return theApp()->fontLoader().metrics(f);
-}
-
-
-frontend::Clipboard & theClipboard()
-{
-       BOOST_ASSERT(theApp());
-       return theApp()->clipboard();
-}
-
-
-frontend::Selection & theSelection()
-{
-       BOOST_ASSERT(theApp());
-       return theApp()->selection();
-}
-
-
-} // namespace lyx
index 28e74f10c835b7ba88b47243c871f78610e172d2..858bf3e77d5e1c9a5654ef01df363adc091ca34e 100644 (file)
@@ -187,10 +187,6 @@ public:
        */
        virtual void syncEvents() = 0;
        ///
-       virtual Clipboard & clipboard() = 0;
-       ///
-       virtual Selection & selection() = 0;
-       ///
        virtual FontLoader & fontLoader() = 0;
 
        /// return a suitable serif font name.
index 5c6cf8e7277ca09afaa3992cc5cd6338946b6b9b..baeaedf1bb6ce1359f7984de6fafbd9b4b8351ec 100644 (file)
@@ -10,7 +10,6 @@ AM_CPPFLAGS += -I$(srcdir)/..  $(BOOST_INCLUDES)
 
 liblyxfrontends_la_SOURCES = \
        alert.h \
-       Application.cpp \
        Application.h \
        NoGuiFontLoader.h \
        NoGuiFontMetrics.h \
index 6edfdd7c88f53021aa5b2ddfba715b3ed35542e4..08817607a737bc6a80c1d61c30913d438bf4e2f5 100644 (file)
 #include "Dialogs.h"
 
 #include "frontends/alert.h"
+#include "frontends/Application.h"
+#include "frontends/NoGuiFontLoader.h"
+#include "frontends/NoGuiFontMetrics.h"
+#include "frontends/FontLoader.h"
+#include "frontends/FontMetrics.h"
 
 #include "graphics/LoaderQueue.h"
 
@@ -32,6 +37,7 @@
 #include "BufferList.h"
 #include "BufferView.h"
 #include "debug.h"
+#include "Font.h"
 #include "FuncRequest.h"
 #include "gettext.h"
 #include "LyX.h"
@@ -563,6 +569,57 @@ bool GuiApplication::x11EventFilter(XEvent * xev)
 #endif
 
 } // namespace frontend
+
+
+////////////////////////////////////////////////////////////////////
+//
+// Font stuff
+//
+////////////////////////////////////////////////////////////////////
+
+frontend::FontLoader & theFontLoader()
+{
+       static frontend::NoGuiFontLoader no_gui_font_loader;
+
+       if (!use_gui)
+               return no_gui_font_loader;
+
+       BOOST_ASSERT(theApp());
+       return theApp()->fontLoader();
+}
+
+
+frontend::FontMetrics const & theFontMetrics(Font const & f)
+{
+       return theFontMetrics(f.fontInfo());
+}
+
+
+frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
+{
+       static frontend::NoGuiFontMetrics no_gui_font_metrics;
+
+       if (!use_gui)
+               return no_gui_font_metrics;
+
+       BOOST_ASSERT(theApp());
+       return theApp()->fontLoader().metrics(f);
+}
+
+
+frontend::Clipboard & theClipboard()
+{
+       BOOST_ASSERT(frontend::guiApp);
+       return frontend::guiApp->clipboard();
+}
+
+
+frontend::Selection & theSelection()
+{
+       BOOST_ASSERT(frontend::guiApp);
+       return frontend::guiApp->selection();
+}
+
 } // namespace lyx
 
 #include "GuiApplication_moc.cpp"
index 702051d38086dc1740761441da2fab48cc6091b6..c7e8f4f5a9fb41693ae8be1fb12ccaea393b87b2 100644 (file)
@@ -43,9 +43,6 @@ class SocketNotifier;
 /**
 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.
 */
 class GuiApplication : public QApplication, public Application
 {