]> git.lyx.org Git - features.git/commitdiff
This commit cleans up everything related to singleton. The other important change...
authorAbdelrazak Younes <younes@lyx.org>
Wed, 11 Oct 2006 17:24:46 +0000 (17:24 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 11 Oct 2006 17:24:46 +0000 (17:24 +0000)
* lyxfunc.h:
  - theLyXFunc(): new function in the global namespace.
  - lyx::dispatch():  new function in the lyx namespace.
  - lyx::getStatus():  new function in the lyx namespace.

* bufferlist.h:
  - theBufferList(): new function in the global namespace.

* Clipboard.h:
  - theClipboard(): new function in the global namespace.

* Selection.h:
  - theSelection(): new function in the global namespace.

* FontLoader.h:
  - theFontLoader(): new function in the global namespace.

* FontMetrics.h:
  - theFontMetrics(LyXFont const &): new function in the global namespace.

* Application.C: implements the functions defined above.

* LyXView.h:
  - getLyXFunc(): deleted.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15298 a592a061-630c-0410-9148-cb99ea01b6c8

68 files changed:
src/BufferView.C
src/CutAndPaste.C
src/LaTeX.C
src/MenuBackend.C
src/buffer.C
src/buffer_funcs.C
src/bufferlist.h
src/cursor.C
src/dimension.C
src/frontends/Application.C
src/frontends/Clipboard.h
src/frontends/FontLoader.h
src/frontends/FontMetrics.h
src/frontends/LyXView.C
src/frontends/LyXView.h
src/frontends/Painter.C
src/frontends/Selection.h
src/frontends/Toolbars.C
src/frontends/WorkArea.C
src/frontends/controllers/ControlCommandBuffer.C
src/frontends/controllers/ControlPrefs.C
src/frontends/controllers/ControlRef.C
src/frontends/controllers/Dialog.C
src/frontends/controllers/Kernel.C
src/frontends/gtk/GMenubar.C
src/frontends/gtk/GToolbar.C
src/frontends/gtk/GView.C
src/frontends/qt3/QLToolbar.C
src/frontends/qt3/QtView.C
src/frontends/qt4/Action.C
src/frontends/qt4/GuiView.C
src/frontends/qt4/InsertTableWidget.C
src/frontends/qt4/QLPainter.C
src/frontends/qt4/QLToolbar.C
src/insets/insetbibitem.C
src/insets/insetcaption.C
src/insets/insetcharstyle.C
src/insets/insetcollapsable.C
src/insets/insetinclude.C
src/insets/insetlatexaccent.C
src/insets/insetnewline.C
src/insets/insetpagebreak.C
src/insets/insetquotes.C
src/insets/insetref.C
src/insets/insetspace.C
src/insets/insetspecialchar.C
src/insets/insettabular.C
src/insets/insetvspace.C
src/insets/render_button.C
src/insets/render_graphic.C
src/insets/render_preview.C
src/lyx_cb.C
src/lyx_main.C
src/lyxfunc.C
src/lyxfunc.h
src/lyxlength.C
src/mathed/InsetFormulaMacro.C
src/mathed/InsetMathBig.C
src/mathed/InsetMathChar.C
src/mathed/InsetMathHull.C
src/mathed/InsetMathNest.C
src/mathed/MathFactory.C
src/mathed/MathMacroTemplate.C
src/mathed/MathSupport.C
src/rowpainter.C
src/text.C
src/text2.C
src/text3.C

index a88a68f94b11fd67eadab73c6efd76a56a845e92..af1c147400c508a0fb4fd3ec736641a1fad73abf 100644 (file)
@@ -60,9 +60,7 @@
 #include "insets/insettext.h"
 
 #include "frontends/Alert.h"
-#include "frontends/Application.h"
 #include "frontends/FileDialog.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 
 #include "graphics/Previews.h"
@@ -188,7 +186,7 @@ void BufferView::setBuffer(Buffer * b)
                lyxerr[Debug::INFO] << BOOST_CURRENT_FUNCTION
                                    << " No Buffer!" << endl;
                // We are closing the buffer, use the first buffer as current
-               buffer_ = theApp->bufferList().first();
+               buffer_ = theBufferList().first();
        } else {
                // Set current buffer
                buffer_ = b;
@@ -235,7 +233,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
                s = filename;
 
        // File already open?
-       if (theApp->bufferList().exists(s)) {
+       if (theBufferList().exists(s)) {
                docstring const file = makeDisplayPath(s, 20);
                docstring text = bformat(_("The document %1$s is already "
                                                     "loaded.\n\nDo you want to revert "
@@ -244,11 +242,11 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
                        text, 0, 1,  _("&Revert"), _("&Switch to document"));
 
                if (ret != 0) {
-                       setBuffer(theApp->bufferList().getBuffer(s));
+                       setBuffer(theBufferList().getBuffer(s));
                        return true;
                }
                // FIXME: should be LFUN_REVERT
-               if (!theApp->bufferList().close(theApp->bufferList().getBuffer(s), false))
+               if (!theBufferList().close(theBufferList().getBuffer(s), false))
                        return false;
                // Fall through to new load. (Asger)
        }
@@ -256,9 +254,9 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
        Buffer * b = 0;
 
        if (found) {
-               b = theApp->bufferList().newBuffer(s);
+               b = theBufferList().newBuffer(s);
                if (!::loadLyXFile(b, s)) {
-                       theApp->bufferList().release(b);
+                       theBufferList().release(b);
                        return false;
                }
        } else {
@@ -312,7 +310,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
 void BufferView::reload()
 {
        string const fn = buffer_->fileName();
-       if (theApp->bufferList().close(buffer_, false))
+       if (theBufferList().close(buffer_, false))
                loadLyXFile(fn);
 }
 
@@ -333,8 +331,8 @@ void BufferView::resize()
 bool BufferView::fitCursor()
 {
        if (bv_funcs::status(this, cursor_) == bv_funcs::CUR_INSIDE) {
-               lyx::frontend::FontMetrics const & fm 
-                       = theApp->fontLoader().metrics(cursor_.getFont());
+               lyx::frontend::FontMetrics const & fm =
+                       theFontMetrics(cursor_.getFont());
                int const asc = fm.maxAscent();
                int const des = fm.maxDescent();
                Point const p = bv_funcs::getPos(cursor_, cursor_.boundary());
@@ -538,10 +536,10 @@ void BufferView::restorePosition(unsigned int i)
 
        if (fname != buffer_->fileName()) {
                Buffer * b = 0;
-               if (theApp->bufferList().exists(fname))
-                       b = theApp->bufferList().getBuffer(fname);
+               if (theBufferList().exists(fname))
+                       b = theBufferList().getBuffer(fname);
                else {
-                       b = theApp->bufferList().newBuffer(fname);
+                       b = theBufferList().newBuffer(fname);
                        // Don't ask, just load it
                        ::loadLyXFile(b, fname);
                }
index 846c4041fb43df1801a72fb895aa8147de429a8e..20c3f85bd8e252d7e7edb9e704a910b6b5ace7ff 100644 (file)
@@ -44,7 +44,6 @@
 
 #include "support/lstrings.h"
 
-#include "frontends/Application.h"
 #include "frontends/Clipboard.h"
 
 #include <boost/tuple/tuple.hpp>
@@ -510,8 +509,8 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
                // solved by running the line below only when the selection has
                // finished. The solution used currently just works, to make it
                // faster we need to be more clever and probably also have more
-               // calls to theApp->selection().put. (Lgb)
-//             theApp->selection().put(cur.selectionAsString(true));
+               // calls to theSelection().put. (Lgb)
+//             theSelection().put(cur.selectionAsString(true));
 
 
                // make sure that the depth behind the selection are restored, too
@@ -575,7 +574,7 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
 void copySelection(LCursor & cur)
 {
        // stuff the selection onto the X clipboard, from an explicit copy request
-       theApp->clipboard().put(cur.selectionAsString(true));
+       theClipboard().put(cur.selectionAsString(true));
 
        // this doesn't make sense, if there is no selection
        if (!cur.selection())
index 17854a217adce14fd55370a6ac049d3fdc45cedf..5588e6bb452d1846057391854eff48a5cd6a4745 100644 (file)
@@ -21,8 +21,6 @@
 #include "debug.h"
 #include "DepTable.h"
 
-#include "frontends/Application.h"
-
 #include "support/filetools.h"
 #include "support/convert.h"
 #include "support/lstrings.h"
@@ -180,7 +178,7 @@ int LaTeX::run(TeXErrors & terr)
        bool rerun = false; // rerun requested
 
        // The class LaTeX does not know the temp path.
-       theApp->bufferList().updateIncludedTeXfiles(getcwd(), runparams);
+       theBufferList().updateIncludedTeXfiles(getcwd(), runparams);
 
        // Never write the depfile if an error was encountered.
 
index 35de35677d3fae42c493a8d3a475379186f2b8b6..c099129f156357341997245deb88fb3843b228ed 100644 (file)
@@ -37,8 +37,6 @@
 #include "lyxlex.h"
 #include "toc.h"
 
-#include "frontends/Application.h"
-
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/convert.h"
@@ -169,7 +167,7 @@ Menu & Menu::addWithStatusCheck(MenuItem const & i)
 
        case MenuItem::Command: {
                FuncStatus status =
-                       theApp->lyxFunc().getStatus(i.func());
+                       lyx::getStatus(i.func());
                if (status.unknown()
                    || (!status.enabled() && i.optional()))
                        break;
@@ -449,7 +447,7 @@ void expandLastfiles(Menu & tomenu)
 void expandDocuments(Menu & tomenu)
 {
        typedef vector<string> Strings;
-       Strings const names = theApp->bufferList().getFileNames();
+       Strings const names = theBufferList().getFileNames();
 
        if (names.empty()) {
                tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"),
index aab0435001bf49d21304de46593753307d282598..473075ff7f42ada6a561421102dda1488c9110f7 100644 (file)
@@ -60,7 +60,6 @@
 #include "mathed/MathSupport.h"
 
 #include "frontends/Alert.h"
-#include "frontends/Application.h"
 
 #include "graphics/Previews.h"
 
@@ -1482,8 +1481,8 @@ void Buffer::setParentName(string const & name)
 Buffer const * Buffer::getMasterBuffer() const
 {
        if (!params().parentname.empty()
-           && theApp->bufferList().exists(params().parentname)) {
-               Buffer const * buf = theApp->bufferList().getBuffer(params().parentname);
+           && theBufferList().exists(params().parentname)) {
+               Buffer const * buf = theBufferList().getBuffer(params().parentname);
                if (buf)
                        return buf->getMasterBuffer();
        }
@@ -1495,8 +1494,8 @@ Buffer const * Buffer::getMasterBuffer() const
 Buffer * Buffer::getMasterBuffer()
 {
        if (!params().parentname.empty()
-           && theApp->bufferList().exists(params().parentname)) {
-               Buffer * buf = theApp->bufferList().getBuffer(params().parentname);
+           && theBufferList().exists(params().parentname)) {
+               Buffer * buf = theBufferList().getBuffer(params().parentname);
                if (buf)
                        return buf->getMasterBuffer();
        }
index ce0f60c7d1871c6031705ac770603eb6ea4ef86f..706f0ccf81f36a7b8b6b3a02e26c91c4dfe1ab10 100644 (file)
@@ -36,7 +36,6 @@
 #include "toc.h"
 
 #include "frontends/Alert.h"
-#include "frontends/Application.h"
 
 #include "insets/insetbibitem.h"
 
@@ -180,7 +179,7 @@ Buffer * newFile(string const & filename, string const & templatename,
                 bool const isNamed)
 {
        // get a free buffer
-       Buffer * b = theApp->bufferList().newBuffer(filename);
+       Buffer * b = theBufferList().newBuffer(filename);
        BOOST_ASSERT(b);
 
        string tname;
@@ -197,7 +196,7 @@ Buffer * newFile(string const & filename, string const & templatename,
                                _("The specified document template\n%1$s\ncould not be read."),
                                file);
                        Alert::error(_("Could not read template"), text);
-                       theApp->bufferList().release(b);
+                       theBufferList().release(b);
                        return 0;
                }
        }
index 2ca9fefe551d2db3404e8b16ba85323abf66b422..c948d1b1ce9cfea1a9abe4fb557c8bde938a684b 100644 (file)
@@ -99,4 +99,6 @@ private:
        void emergencyWrite(Buffer * buf);
 };
 
+extern BufferList & theBufferList();
+
 #endif // BUFFERLIST_H
index c93d642390c238efbed226cacd7ab304cb2c89aa..fb66b06f54e39ebfc96350013255ef47eea69855 100644 (file)
@@ -43,8 +43,6 @@
 
 #include "support/limited_stack.h"
 
-#include "frontends/Application.h"
-
 #include <boost/assert.hpp>
 #include <boost/bind.hpp>
 #include <boost/current_function.hpp>
@@ -1105,13 +1103,13 @@ void LCursor::handleFont(string const & font)
 
 void LCursor::message(docstring const & msg) const
 {
-       theApp->lyxFunc().setMessage(msg);
+       theLyXFunc().setMessage(msg);
 }
 
 
 void LCursor::errorMessage(docstring const & msg) const
 {
-       theApp->lyxFunc().setErrorMessage(msg);
+       theLyXFunc().setErrorMessage(msg);
 }
 
 
index 1edb794ebcc22f73f13130bb854a987a9beb8a05..ab374347c315b3dd434c977383d416e50ab5b5b7 100644 (file)
@@ -11,8 +11,6 @@
 #include <config.h>
 
 #include "dimension.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 
 
@@ -28,7 +26,7 @@ void Dimension::operator+=(Dimension const & dim)
 
 void Dimension::clear(LyXFont const & font)
 {
-       lyx::frontend::FontMetrics const & fm = theApp->fontLoader().metrics(font);
+       lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
        asc = fm.maxAscent();
        des = fm.maxDescent();
        wid = 0;
index 66fcbfbd7c280bda1f329a85594253b5a8fb29ba..545b15e33ab961f181f0d902b9d9d163c71e4887 100644 (file)
 
 #include <config.h>
 
-#include "Application.h"
+#include "frontends/Application.h"
 
-#include "Gui.h"
-#include "LyXView.h"
-#include "WorkArea.h"
+#include "frontends/FontLoader.h"
+#include "frontends/FontMetrics.h"
+#include "frontends/Gui.h"
+#include "frontends/LyXView.h"
+#include "frontends/WorkArea.h"
 
 #include "bufferlist.h"
 #include "funcrequest.h"
+#include "FuncStatus.h"
 #include "LyXAction.h"
+#include "lyxfont.h"
 #include "lyxfunc.h"
 #include "lyxrc.h"
 #include "lyxserver.h"
@@ -151,4 +155,53 @@ int Application::start(std::string const & batch)
 
 
 } // namespace frontend
+
+
+FuncStatus getStatus(FuncRequest const & action)
+{
+       return theApp->lyxFunc().getStatus(action);
+}
+
+
+void dispatch(FuncRequest const & action)
+{
+       theApp->lyxFunc().dispatch(action);
+}
+
 } // namespace lyx
+
+
+LyXFunc & theLyXFunc()
+{
+       return theApp->lyxFunc();
+}
+
+
+BufferList & theBufferList()
+{
+       return theApp->bufferList();
+}
+
+
+lyx::frontend::FontLoader & theFontLoader()
+{
+       return theApp->fontLoader();
+}
+
+
+lyx::frontend::FontMetrics const & theFontMetrics(LyXFont const & f)
+{
+       return theApp->fontLoader().metrics(f);
+}
+
+
+lyx::frontend::Clipboard & theClipboard()
+{
+       return theApp->clipboard();
+}
+
+
+lyx::frontend::Selection & theSelection()
+{
+       return theApp->selection();
+}
index c49bd4b0c61c009d9c94dd2ae5e18afca9a02c9a..d75f3cf4a4e3b6d84084f7d157f8854ef0ef0b14 100644 (file)
@@ -44,4 +44,6 @@ public:
 } // namespace frontend
 } // namespace lyx
 
+extern lyx::frontend::Clipboard & theClipboard();
+
 #endif // BASE_CLIPBOARD_H
index e674a26ff1de3e9c14475b91bbc16e8095274ff3..9000353cf38b267828c419988a9b5791b9c9fcf9 100644 (file)
@@ -41,4 +41,6 @@ public:
 } // namespace frontend
 } // namespace lyx
 
+extern lyx::frontend::FontLoader & theFontLoader();
+
 #endif // QFONT_LOADER_H
index 9a190f439399746c90a13c22a778a793e9df8c7a..16dbf00f70a31b1fab966c4dcf45a82fbf4e0869 100644 (file)
@@ -114,4 +114,8 @@ public:
 } // namespace frontend
 } // namespace lyx
 
+class LyXFont;
+
+extern lyx::frontend::FontMetrics const & theFontMetrics(LyXFont const & f);
+
 #endif // FONT_METRICS_H
index 0eeaacee0381cc4d5f2de6a1ea446a8c58aae38b..9598c5fbe19636ec2a2d5e327df6ce37a13d1588 100644 (file)
@@ -280,7 +280,7 @@ void LyXView::updateToolbars()
 {
        bool const math = work_area_->bufferView().cursor().inMathed();
        bool const table =
-               getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
+               lyx::getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
        toolbars_->update(math, table);
        // update redaonly status of open dialogs. This could also be in
        // updateMenubar(), but since updateToolbars() and updateMenubar()
@@ -367,7 +367,7 @@ void LyXView::updateWindowTitle()
 
 void LyXView::dispatch(FuncRequest const & cmd)
 {
-       getLyXFunc().dispatch(cmd);
+       lyx::dispatch(cmd);
 }
 
 
index a52d484c20ac02346bf8eb96cc8572d6e7a3ba8f..07d83edb9fa33724b07f82d9c6de8d6f4bb260f3 100644 (file)
@@ -93,20 +93,6 @@ public:
        /// return the buffer currently shown in this window
        Buffer * buffer() const;
 
-       /* FIXME: Abdel 22/09/71
-       there is only one lyxFunc() for now but there is maybe a need
-       for more in the feature. Something like that:
-       
-               LyXFunc & getLyXFunc() { return theApp->lyxFunc(id_); }
-
-       where id_ would be the this LyXView ID.
-       That's the reason why I didn't remove these methods for now.
-       */
-       /// return the LyX function handler for this view
-       LyXFunc & getLyXFunc() { return theApp->lyxFunc(); }
-       ///
-       LyXFunc const & getLyXFunc() const { return theApp->lyxFunc(); }
-
        /// return the toolbar for this view
        Toolbars & getToolbars() { return *toolbars_.get(); }
        ///
index 8d14ae3cf0c62a66da66c2c040fe58e35b43324b..25f8edf2beb6ee5905c6b615a4b5efb89d8c8309 100644 (file)
@@ -13,8 +13,6 @@
 
 #include "frontends/Painter.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 
 #include "LColor.h"
@@ -62,7 +60,7 @@ void Painter::rectText(int x, int y,
        int ascent;
        int descent;
 
-       FontMetrics const & fm = theApp->fontLoader().metrics(font);
+       FontMetrics const & fm = theFontMetrics(font);
        fm.rectText(str, width, ascent, descent);
 
        if (back != LColor::none)
@@ -82,7 +80,7 @@ void Painter::buttonText(int x, int y, docstring const & str, LyXFont const & fo
        int ascent;
        int descent;
 
-       FontMetrics const & fm = theApp->fontLoader().metrics(font);
+       FontMetrics const & fm = theFontMetrics(font);
        fm.buttonText(str, width, ascent, descent);
 
        button(x, y - ascent, width, descent + ascent);
@@ -92,7 +90,7 @@ void Painter::buttonText(int x, int y, docstring const & str, LyXFont const & fo
 
 void Painter::underline(LyXFont const & f, int x, int y, int width)
 {
-       FontMetrics const & fm = theApp->fontLoader().metrics(f);
+       FontMetrics const & fm = theFontMetrics(f);
 
        int const below = max(fm.maxDescent() / 2, 2);
        int const height = max((fm.maxDescent() / 4) - 1, 1);
index cc24d4445082d832a4d00e0a9b38aac9cb060aba..c281d72cc5ad8e1723fe9f804e0d4458d04920c7 100644 (file)
@@ -48,4 +48,6 @@ public:
 } // namespace frontend
 } // namespace lyx
 
+extern lyx::frontend::Selection & theSelection();
+
 #endif // BASE_SELECTION_H
index 3d1bf5e1f0f04a0432597f1a666ad428eb4bbf3e..7f563284278ece2288084b4f13d175f3ba2656b1 100644 (file)
@@ -149,8 +149,8 @@ void Toolbars::update()
        for (; it != end; ++it)
                it->second->update();
 
-       bool const enable = owner_.getLyXFunc().
-               getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
+       bool const enable =
+               lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
 
        if (layout_)
                layout_->setEnabled(enable);
@@ -169,7 +169,7 @@ void layoutSelected(LyXView & lv, string const & name)
                if (lyx::to_utf8(_(itname)) == name) {
                        FuncRequest const func(LFUN_LAYOUT, itname,
                                               FuncRequest::UI);
-                       lv.getLyXFunc().dispatch(func);
+                       lv.dispatch(func);
                        return;
                }
        }
index 0f6d88d6895d1e275d0c251bd38d3f69565fade2..548cc276a5c58cb23d9b73d313bd227f468f8151 100644 (file)
@@ -16,7 +16,6 @@
 #include "frontends/WorkArea.h"
 
 #include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 
 #include "funcrequest.h"
@@ -235,7 +234,7 @@ void WorkArea::processKeySym(LyXKeySymPtr key,
                                                         key_modifier::state state)
 {
        hideCursor();
-       lyx_view_.getLyXFunc().processKeySym(key, state);
+       theLyXFunc().processKeySym(key, state);
 
        /* This is perhaps a bit of a hack. When we move
         * around, or type, it's nice to be able to see
@@ -375,7 +374,7 @@ void WorkArea::showCursor()
                shape = BAR_SHAPE;
 
        LyXFont const font = buffer_view_->cursor().getFont();
-       FontMetrics const & fm = theApp->fontLoader().metrics(font);
+       FontMetrics const & fm = theFontMetrics(font);
        int const asc = fm.maxAscent();
        int const des = fm.maxDescent();
        int h = asc + des;
index a5ad6fada576aa60269c7bb9b58eea034adbd9e6..e6d0d7ef1689ec0de8396559d4d2075b72882b97 100644 (file)
@@ -133,7 +133,7 @@ void ControlCommandBuffer::dispatch(string const & str)
        history_pos_ = history_.end();
        FuncRequest func = lyxaction.lookupFunc(str);
        func.origin = FuncRequest::COMMANDBUFFER;
-       lv_.getLyXFunc().dispatch(func);
+       lv_.dispatch(func);
 }
 
 } // namespace frontend
index e8a9b2926bab0311933f38d1e69e4df0c417323b..6e0b360eec491714e9ef48faea4a64a928f63cb0 100644 (file)
@@ -21,8 +21,6 @@
 #include "paper.h"
 #include "LColor.h"
 
-#include "frontends/Application.h"
-
 #include "support/filefilterlist.h"
 
 #include <sstream>
@@ -69,7 +67,7 @@ void ControlPrefs::dispatchParams()
        kernel().dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str()));
 
        // FIXME: these need lfuns
-       theApp->bufferList().setCurrentAuthor(rc_.user_name, rc_.user_email);
+       theBufferList().setCurrentAuthor(rc_.user_name, rc_.user_email);
 
        ::formats = formats_;
 
index 69b705306b1cd0caaf62a9fa9490800ad1026d9f..37a9b33e8ce0603004ca3b7ff5619a81b24df6cb 100644 (file)
@@ -17,8 +17,6 @@
 #include "bufferlist.h"
 #include "funcrequest.h"
 
-#include "frontends/Application.h"
-
 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
 
 using std::vector;
@@ -38,7 +36,7 @@ ControlRef::ControlRef(Dialog & d)
 
 vector<string> const ControlRef::getLabelList(string const & name) const
 {
-       Buffer const & buf = *theApp->bufferList().getBuffer(makeAbsPath(name));
+       Buffer const & buf = *theBufferList().getBuffer(makeAbsPath(name));
        vector<string> list;
        buf.getLabelList(list);
        return list;
@@ -60,7 +58,7 @@ void ControlRef::gotoBookmark()
 
 vector<string> const ControlRef::getBufferList() const
 {
-       vector<string> buffers = theApp->bufferList().getFileNames();
+       vector<string> buffers = theBufferList().getFileNames();
        for (vector<string>::iterator it = buffers.begin();
             it != buffers.end(); ++it) {
                *it = lyx::to_utf8(makeDisplayPath(*it));
@@ -72,7 +70,7 @@ vector<string> const ControlRef::getBufferList() const
 
 int ControlRef::getBufferNum() const
 {
-       vector<string> buffers = theApp->bufferList().getFileNames();
+       vector<string> buffers = theBufferList().getFileNames();
        string const name = kernel().buffer().fileName();
        vector<string>::const_iterator cit =
                find(buffers.begin(), buffers.end(), name);
@@ -83,7 +81,7 @@ int ControlRef::getBufferNum() const
 
 string const ControlRef::getBufferName(int num) const
 {
-       return theApp->bufferList().getFileNames()[num];
+       return theBufferList().getFileNames()[num];
 }
 
 } // namespace frontend
index a25f9bcdef553257ef90adadbc6a7b13497f4382..f90baf2cebdf48756e593d6d7aa9a99f944b3919 100644 (file)
@@ -208,7 +208,7 @@ Dialog::Controller::Controller(Dialog & parent)
 bool Dialog::Controller::canApply() const
 {
        FuncRequest const fr(getLfun(), dialog().name());
-       FuncStatus const fs(kernel().lyxview().getLyXFunc().getStatus(fr));
+       FuncStatus const fs(lyx::getStatus(fr));
        return fs.enabled();
 }
 
index c604f767b09303eeda04c3af677d4da6862c7345..b01657e6d2c1a745e20da408095ac0df91d79bc6 100644 (file)
@@ -32,7 +32,7 @@ Kernel::Kernel(LyXView & lyxview)
 
 void Kernel::dispatch(FuncRequest const & fr) const
 {
-       lyxview_.getLyXFunc().dispatch(fr);
+       lyxview_.dispatch(fr);
 }
 
 
index e397af9d01bb55e3c1b45d91b02db5807c702602..9cd7322574d5089838e904f242e8a1acb100ea5f 100644 (file)
@@ -268,7 +268,7 @@ void GMenubar::onSubMenuActivate(MenuItem const * item,
 void GMenubar::onCommandActivate(MenuItem const * item,
                                       Gtk::MenuItem * /*gitem*/)
 {
-       view_->getLyXFunc().dispatch(item->func());
+       view_.dispatch(item->func());
 }
 
 } // namespace frontend
index 70485a9f8c5f07534e59fbe6001fdbf859a0cb70..e79005d25de115ce880fbf14232c23abd5121345 100644 (file)
@@ -274,7 +274,7 @@ void GToolbar::add(FuncRequest const & func, lyx::docstring const & tooltip)
 
 void GToolbar::clicked(FuncRequest func)
 {
-       owner_.getLyXFunc().dispatch(func);
+       owner_.dispatch(func);
 }
 
 
@@ -300,7 +300,7 @@ void GToolbar::update()
                FuncRequest const * func = reinterpret_cast<FuncRequest *>(
                        item->get_data(gToolData));
                if (func) {
-                       FuncStatus const status = owner_.getLyXFunc().getStatus(*func);
+                       FuncStatus const status = lyx::getStatus(*func);
                        item->set_sensitive(status.enabled());
                }
        }
index 73edeb76e3d0afa51bef27d16c3ee4f4e3c48f6d..b16c0c853ab5fd1383a4dab1fc5019f2b4f839b3 100644 (file)
@@ -162,7 +162,7 @@ bool GView::on_delete_event(GdkEventAny * /*event*/)
        // trigger LFUN_LYX_QUIT instead of quit directly
        // since LFUN_LYX_QUIT may have more cleanup stuff
        //
-       getLyXFunc().dispatch(FuncRequest(LFUN_LYX_QUIT));
+       dispatch(FuncRequest(LFUN_LYX_QUIT));
        return true;
 }
 
@@ -197,7 +197,7 @@ void GView::message(docstring const & msg)
 
 void GView::updateStatusBar()
 {
-       message(lyx::from_utf8(getLyXFunc().viewStatusMessage()));
+       message(lyx::from_utf8(theLyXFunc().viewStatusMessage()));
 }
 
 
@@ -225,7 +225,7 @@ void GView::busy(bool yes) const
 
 void GView::clearMessage()
 {
-       message(lyx::from_utf8(getLyXFunc().viewStatusMessage()));
+       message(lyx::from_utf8(theLyXFunc().viewStatusMessage()));
 }
 
 
index b29397da059e94d1ef6a142ab5192710885e3b70..c10210d55a8553bb04d700adf27ae026d1e8943f 100644 (file)
@@ -192,7 +192,7 @@ void QLToolbar::add(FuncRequest const & func, lyx::docstring const & tooltip)
                toolbar_->setHorizontalStretchable(true);
                break;
        default: {
-               if (owner_.getLyXFunc().getStatus(func).unknown())
+               if (lyx::getStatus(func).unknown())
                        break;
                QPixmap p = QPixmap(toolbarbackend.getIcon(func).c_str());
                QToolButton * button =
@@ -227,8 +227,7 @@ void QLToolbar::update()
                QToolButton * button = p->first;
                FuncRequest const & func = p->second;
 
-               FuncStatus const status =
-                       owner_.getLyXFunc().getStatus(func);
+               FuncStatus const status = lyx::getStatus(func);
 
                button->setToggleButton(true);
                button->setOn(status.onoff(true));
@@ -247,7 +246,7 @@ void QLToolbar::clicked()
        ButtonMap::const_iterator it = map_.find(button);
 
        if (it != map_.end())
-               owner_.getLyXFunc().dispatch(it->second);
+               owner_.dispatch(it->second);
        else
                lyxerr << "non existent tool button selected !" << endl;
 }
index 8b62a9c844a1885433f449029881e1dca65ca0d9..dc0927df481e2a5e65f2bb06b4ddfbf6db01f8c6 100644 (file)
@@ -152,7 +152,7 @@ void QtView::focus_command_widget()
 
 void QtView::update_view_state_qt()
 {
-       statusBar()->message(toqstr(getLyXFunc().viewStatusMessage()));
+       statusBar()->message(toqstr(theLyXFunc().viewStatusMessage()));
        statusbar_timer_.stop();
 }
 
@@ -163,13 +163,13 @@ void QtView::updateStatusBar()
        if (statusbar_timer_.isActive())
                return;
 
-       statusBar()->message(toqstr(getLyXFunc().viewStatusMessage()));
+       statusBar()->message(toqstr(theLyXFunc().viewStatusMessage()));
 }
 
 
 void QtView::activated(FuncRequest const & func)
 {
-       getLyXFunc().dispatch(func);
+       dispatch(func);
 }
 
 
@@ -223,7 +223,7 @@ void QtView::closeEvent(QCloseEvent *)
        }
        // trigger LFUN_LYX_QUIT instead of quit directly
        // since LFUN_LYX_QUIT may have more cleanup stuff
-       getLyXFunc().dispatch(FuncRequest(LFUN_LYX_QUIT));
+       dispatch(FuncRequest(LFUN_LYX_QUIT));
 }
 
 
index 47774486c640bb4250bf69d45263eda876127bf1..504012308e024332752bb9e67d8e234f439ee166 100644 (file)
@@ -72,7 +72,7 @@ void Action::setAction(FuncRequest const & func)
 
 void Action::update()
 {
-       FuncStatus const status = lyxView_.getLyXFunc().getStatus(func_);
+       FuncStatus const status = lyx::getStatus(func_);
 
        if (status.onoff(true)) {
                setCheckable(true);
@@ -92,7 +92,7 @@ void Action::action()
 {
 //     lyxerr[Debug::ACTION] << "calling LyXFunc::dispatch: func_: " << func_ << endl;
 
-       lyxView_.getLyXFunc().dispatch(func_);
+       lyxView_.dispatch(func_);
 }
 
 } // namespace frontend
index 14f9a1bfd82657cabdda4a65969eba2e2dc5016b..aeeba51e1fb6f738bdcaffd9acd43651fad7d323 100644 (file)
@@ -36,7 +36,6 @@
 #include "GuiView.h"
 #include "QLMenubar.h"
 #include "QLToolbar.h"
-#include "FontLoader.h"
 #include "QCommandBuffer.h"
 #include "qt_helpers.h"
 
@@ -181,7 +180,7 @@ void GuiView::focus_command_widget()
 
 void GuiView::update_view_state_qt()
 {
-       statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage()));
+       statusBar()->showMessage(toqstr(theLyXFunc().viewStatusMessage()));
        statusbar_timer_.stop();
 }
 
@@ -192,13 +191,13 @@ void GuiView::updateStatusBar()
        if (statusbar_timer_.isActive())
                return;
 
-       statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage()));
+       statusBar()->showMessage(toqstr(theLyXFunc().viewStatusMessage()));
 }
 
 
 void GuiView::activated(FuncRequest const & func)
 {
-       getLyXFunc().dispatch(func);
+       dispatch(func);
 }
 
 
@@ -254,7 +253,7 @@ void GuiView::closeEvent(QCloseEvent *)
        }
        // trigger LFUN_LYX_QUIT instead of quit directly
        // since LFUN_LYX_QUIT may have more cleanup stuff
-       getLyXFunc().dispatch(FuncRequest(LFUN_LYX_QUIT));
+       dispatch(FuncRequest(LFUN_LYX_QUIT));
 }
 
 
index 424b5dbb1f57bbd62607b27cf7b9f50b264993ca..8b6b01efbf59615da01ccd8bd10e000fb5e5dd6c 100644 (file)
@@ -108,7 +108,7 @@ void InsertTableWidget::mouseReleaseEvent(QMouseEvent * /*event*/)
 {
        if (underMouse_) {
                QString const data = QString("%1 %2").arg(bottom_).arg(right_);
-               lyxView_.getLyXFunc().dispatch(FuncRequest(LFUN_TABULAR_INSERT, fromqstr(data)));
+               lyxView_.dispatch(FuncRequest(LFUN_TABULAR_INSERT, fromqstr(data)));
        }
        // emit signal
        visible(false);
@@ -147,7 +147,7 @@ void InsertTableWidget::drawGrid(int const rows, int const cols, Qt::GlobalColor
 
 void InsertTableWidget::updateParent()
 {
-       bool status = lyxView_.getLyXFunc().getStatus(FuncRequest(LFUN_TABULAR_INSERT)).enabled();
+       bool status = lyx::getStatus(FuncRequest(LFUN_TABULAR_INSERT)).enabled();
        parentWidget()->setEnabled(status);
 }
 
index 9bd17c44b426e3b4b1142a39e18b5f71afa27035..ca6aebcbb38b2a4b779f6335fe8f65792387dda0 100644 (file)
@@ -16,7 +16,6 @@
 #include "GuiApplication.h"
 #include "GuiWorkArea.h"
 #include "QLImage.h"
-#include "FontLoader.h"
 
 #include "GuiApplication.h"
 #include "qt_helpers.h"
index 8a28f36bf12f315f4821cfa530d87b439c8fd9eb..311646b5c78c02a622731982b5141a9cc9b0c9a4 100644 (file)
@@ -192,7 +192,7 @@ void QLToolbar::add(FuncRequest const & func, docstring const & tooltip)
                break;
                }
        default: {
-               if (owner_.getLyXFunc().getStatus(func).unknown())
+               if (lyx::getStatus(func).unknown())
                        break;
 
                Action * action = new Action(owner_, toolbarbackend.getIcon(func), lyx::docstring(), func, tooltip);
index 294839b6fd683fdf94e4b2a2548d91f4e8e2bc2d..f81d02e456f6cf16e9bf4d8b07eafbaa52465d14 100644 (file)
@@ -21,8 +21,6 @@
 #include "paragraph.h"
 #include "ParagraphList.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 
 #include "support/lstrings.h"
@@ -144,8 +142,7 @@ string const bibitemWidest(Buffer const & buffer)
        InsetBibitem const * bitem = 0;
        // FIXME font is used unitialized, is that correct?
        LyXFont font;
-       lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+       lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
 
        ParagraphList::const_iterator it = buffer.paragraphs().begin();
        ParagraphList::const_iterator end = buffer.paragraphs().end();
index 6c6c1755b4d0ae1b9e8d31ea8797c4a3faeb60a3..3b8818faaa242bb5bd7340c3ebb1d09f3e45a7a1 100644 (file)
@@ -26,8 +26,6 @@
 #include "metricsinfo.h"
 #include "paragraph.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -127,7 +125,7 @@ void InsetCaption::metrics(MetricsInfo & mi, Dimension & dim) const
        LCursor cur = mi.base.bv->cursor();
        setLabel(cur);
        docstring dlab(label.begin(), label.end());
-       labelwidth_ = theApp->fontLoader().metrics(mi.base.font).width(dlab);
+       labelwidth_ = theFontMetrics(mi.base.font).width(dlab);
        dim.wid = labelwidth_;
        Dimension textdim;
        InsetText::metrics(mi, textdim);
@@ -157,7 +155,7 @@ void InsetCaption::draw(PainterInfo & pi, int x, int y) const
        docstring dlab(label.begin(), label.end());
        // FXIME: instead of using the fontLoader metrics, we should make
        // painter::text() returns the drawn text witdh.
-       labelwidth_ = theApp->fontLoader().metrics(pi.base.font).width(dlab);
+       labelwidth_ = theFontMetrics(pi.base.font).width(dlab);
        pi.pain.text(x, y, dlab, pi.base.font);
        InsetText::draw(pi, x + labelwidth_, y);
        setPosCache(pi, x, y);
index 77bb8698db4b427379ec17ee721885f82202fd70..d509beb1ea3bb32f91ce3159280adf53883a1519 100644 (file)
@@ -31,8 +31,6 @@
 #include "paragraph_funcs.h"
 #include "sgml.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -159,7 +157,7 @@ void InsetCharStyle::metrics(MetricsInfo & mi, Dimension & dim) const
                        // FIXME UNICODE
                        s = lyx::to_utf8(_("Undef: ")) + s;
                docstring ds(s.begin(), s.end());
-               theApp->fontLoader().metrics(font).rectText(ds, w, a, d);
+               theFontMetrics(font).rectText(ds, w, a, d);
                dim.wid = max(dim.wid, w);
        }
        dim.asc += TEXT_TO_INSET_OFFSET;
@@ -207,7 +205,7 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
                        // FIXME UNICODE
                        s = lyx::to_utf8(_("Undef: ")) + s;
                docstring ds(s.begin(), s.end());
-               theApp->fontLoader().metrics(font).rectText(ds, w, a, d);
+               theFontMetrics(font).rectText(ds, w, a, d);
                pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
                        ds, font, LColor::none, LColor::none);
        }
index 3607e42d3279cf2c75cb17702994bfe2c3f6e992..16b0d68f75a24c847657ab0123893762a3bb14f8 100644 (file)
@@ -29,8 +29,6 @@
 #include "metricsinfo.h"
 #include "paragraph.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -127,7 +125,7 @@ Dimension InsetCollapsable::dimensionCollapsed() const
 {
        Dimension dim;
        docstring dlab(label.begin(), label.end());
-       theApp->fontLoader().metrics(labelfont_).buttonText(
+       theFontMetrics(labelfont_).buttonText(
                dlab, dim.wid, dim.asc, dim.des);
        return dim;
 }
index daa2a436783e5f0e9fc2ee4b84ac2cf5c889d678..47198006c2e5858044ec46f84f78c664fc4d698b 100644 (file)
@@ -32,7 +32,6 @@
 #include "outputparams.h"
 
 #include "frontends/Alert.h"
-#include "frontends/Application.h"
 #include "frontends/Painter.h"
 
 #include "graphics/PreviewImage.h"
@@ -319,7 +318,7 @@ Buffer * getChildBuffer(Buffer const & buffer, InsetCommandParams const & params
        if (!isLyXFilename(included_file))
                return 0;
 
-       return theApp->bufferList().getBuffer(included_file);
+       return theBufferList().getBuffer(included_file);
 }
 
 
@@ -333,12 +332,12 @@ bool loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params)
        if (!isLyXFilename(included_file))
                return false;
 
-       Buffer * buf = theApp->bufferList().getBuffer(included_file);
+       Buffer * buf = theBufferList().getBuffer(included_file);
        if (!buf) {
                // the readonly flag can/will be wrong, not anymore I think.
                if (!fs::exists(included_file))
                        return false;
-               buf = theApp->bufferList().newBuffer(included_file);
+               buf = theBufferList().newBuffer(included_file);
                if (!loadLyXFile(buf, included_file))
                        return false;
        }
@@ -386,7 +385,7 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
                // Don't try to load or copy the file
                ;
        else if (loadIfNeeded(buffer, params_)) {
-               Buffer * tmp = theApp->bufferList().getBuffer(included_file);
+               Buffer * tmp = theBufferList().getBuffer(included_file);
 
                if (tmp->params().textclass != m_buffer->params().textclass) {
                        // FIXME UNICODE
@@ -499,7 +498,7 @@ int InsetInclude::docbook(Buffer const & buffer, ostream & os,
        string writefile = changeExtension(included_file, ".sgml");
 
        if (loadIfNeeded(buffer, params_)) {
-               Buffer * tmp = theApp->bufferList().getBuffer(included_file);
+               Buffer * tmp = theBufferList().getBuffer(included_file);
 
                string const mangled = FileName(writefile).mangledFilename();
                writefile = makeAbsPath(mangled,
@@ -560,7 +559,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
        // to be loaded:
        if (loadIfNeeded(buffer, params_)) {
                // a file got loaded
-               Buffer * const tmp = theApp->bufferList().getBuffer(included_file);
+               Buffer * const tmp = theBufferList().getBuffer(included_file);
                if (tmp) {
                        // We must temporarily change features.buffer,
                        // otherwise it would always be the master buffer,
@@ -578,7 +577,7 @@ void InsetInclude::getLabelList(Buffer const & buffer,
 {
        if (loadIfNeeded(buffer, params_)) {
                string const included_file = includedFilename(buffer, params_);
-               Buffer * tmp = theApp->bufferList().getBuffer(included_file);
+               Buffer * tmp = theBufferList().getBuffer(included_file);
                tmp->setParentName("");
                tmp->getLabelList(list);
                tmp->setParentName(parentFilename(buffer));
@@ -591,7 +590,7 @@ void InsetInclude::fillWithBibKeys(Buffer const & buffer,
 {
        if (loadIfNeeded(buffer, params_)) {
                string const included_file = includedFilename(buffer, params_);
-               Buffer * tmp = theApp->bufferList().getBuffer(included_file);
+               Buffer * tmp = theBufferList().getBuffer(included_file);
                tmp->setParentName("");
                tmp->fillWithBibKeys(keys);
                tmp->setParentName(parentFilename(buffer));
index 9f15861be3c7d944f9445532a4d343a8938348e7..429bfbea588e15545572c600aff0e16d966f6f83 100644 (file)
@@ -19,8 +19,6 @@
 #include "lyxrc.h"
 #include "metricsinfo.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -246,8 +244,7 @@ void InsetLatexAccent::checkContents()
 void InsetLatexAccent::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        LyXFont & font = mi.base.font;
-       lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+       lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
 
        // This function is a bit too simplistic and is just a
        // "try to make a fit for all accents" approach, to
@@ -331,8 +328,7 @@ void InsetLatexAccent::drawAccent(PainterInfo const & pi, int x, int y,
        char_type accent) const
 {
        LyXFont const & font = pi.base.font;
-       lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+       lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
 
        x -= fm.center(accent);
        y -= fm.ascent(ic);
@@ -356,8 +352,7 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
        if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
                font.setLanguage(english_language);
 
-       lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+       lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
 
        if (candisp) {
                int x2 = int(x + (fm.rbearing(ic) - fm.lbearing(ic)) / 2);
index e9fa97b89ecfb26249e3c65a64366a217399b386..7b09eae190ab3466a63a6e5dff3b8d035abb3eb5 100644 (file)
@@ -19,8 +19,6 @@
 #include "paragraph.h"
 #include "paragraph_funcs.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -42,8 +40,8 @@ void InsetNewline::write(Buffer const &, ostream & os) const
 
 void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(mi.base.font);
+       lyx::frontend::FontMetrics const & fm 
+               =       theFontMetrics(mi.base.font);
        dim.asc = fm.maxAscent();
        dim.des = fm.maxDescent();
        dim.wid = fm.width('n');
@@ -78,7 +76,7 @@ int InsetNewline::docbook(Buffer const &, std::ostream & os,
 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
 {
        lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(pi.base.font);
+               theFontMetrics(pi.base.font);
        int const wid = fm.width('n');
        int const asc = fm.maxAscent();
 
index 037e9b7293381b2f89ec43e0b5c8596ec6e10449..96d27662de6988a1d663e5ed4b836a3c60eaaa1d 100644 (file)
@@ -18,8 +18,6 @@
 #include "metricsinfo.h"
 #include "gettext.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -62,7 +60,7 @@ void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
        int w = 0;
        int a = 0;
        int d = 0;
-       theApp->fontLoader().metrics(font).rectText(label, w, a, d);
+       theFontMetrics(font).rectText(label, w, a, d);
 
        int const text_start = int(x + (dim_.wid - w) / 2);
        int const text_end = text_start + w;
index 26f5e53916d83f149dc2eeb35ef5b4916836671f..de8ec480322d2a1e48adf396d0cd5ac58ed191a5 100644 (file)
@@ -24,8 +24,6 @@
 #include "paragraph.h"
 #include "paragraph_funcs.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -202,7 +200,7 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        LyXFont & font = mi.base.font;
        lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+               theFontMetrics(font);
        dim.asc = fm.maxAscent();
        dim.des = fm.maxDescent();
        dim.wid = 0;
@@ -239,7 +237,7 @@ void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
 
        if (text.length() == 2 && text[0] == text[1]) {
                pi.pain.text(x, y, text[0], pi.base.font);
-               int const t = theApp->fontLoader().metrics(pi.base.font)
+               int const t = theFontMetrics(pi.base.font)
                        .width(',');
                pi.pain.text(x + t, y, text[0], pi.base.font);
        } else {
index 3ca4803bdaec24a7fc7e75d9d05bbf8c281770f4..11a24ffe0a52fd660bd5b332444faf58d456cbb6 100644 (file)
@@ -21,8 +21,6 @@
 #include "outputparams.h"
 #include "sgml.h"
 
-#include "frontends/Application.h"
-
 #include "support/lstrings.h"
 
 
@@ -48,7 +46,7 @@ void InsetRef::doDispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_MOUSE_PRESS:
                // Eventually trigger dialog with button 3 not 1
                if (cmd.button() == mouse_button::button3)
-                       theApp->lyxFunc().dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents()));
+                       lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents()));
                else {
                        InsetCommandMailer("ref", *this).showDialog(&cur.bv());
                        cur.undispatched();
index 9be6ee484a4ef7759dcb4c072290d3995656619a..8ececce4e5ba2994f863fd233627840ff34d1b90 100644 (file)
@@ -21,8 +21,6 @@
 #include "metricsinfo.h"
 #include "outputparams.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -51,7 +49,7 @@ InsetSpace::Kind InsetSpace::kind() const
 void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(mi.base.font);
+               theFontMetrics(mi.base.font);
        dim.asc = fm.maxAscent();
        dim.des = fm.maxDescent();
 
@@ -82,7 +80,7 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 void InsetSpace::draw(PainterInfo & pi, int x, int y) const
 {
        int const w = width();
-       int const h = theApp->fontLoader().metrics(pi.base.font)
+       int const h = theFontMetrics(pi.base.font)
                .ascent('x');
        int xp[4], yp[4];
 
index edf1053557a04802525faf7cd1ff7d6fac15f4c1..b2c01b68a820b89447b7d224f4a250255379657e 100644 (file)
@@ -20,8 +20,6 @@
 #include "lyxlex.h"
 #include "metricsinfo.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -46,7 +44,7 @@ InsetSpecialChar::Kind InsetSpecialChar::kind() const
 void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(mi.base.font);
+               theFontMetrics(mi.base.font);
        dim.asc = fm.maxAscent();
        dim.des = fm.maxDescent();
 
@@ -100,7 +98,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
        case MENU_SEPARATOR:
        {
                lyx::frontend::FontMetrics const & fm =
-                       theApp->fontLoader().metrics(font);
+                       theFontMetrics(font);
 
                // A triangle the width and height of an 'x'
                 int w = fm.width(lyx::char_type('x'));
index 95fc6310a5a8280d85f414ac5bf095d610243178..39fc6c32f10b73cd1aa04e0084b393ce02a282c5 100644 (file)
@@ -37,7 +37,6 @@
 #include "support/convert.h"
 
 #include "frontends/Alert.h"
-#include "frontends/Application.h"
 #include "frontends/Clipboard.h"
 #include "frontends/Painter.h"
 #include "frontends/Selection.h"
@@ -701,8 +700,8 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_CLIPBOARD_PASTE:
        case LFUN_PRIMARY_SELECTION_PASTE: {
                docstring const clip = (cmd.action == LFUN_CLIPBOARD_PASTE) ?
-                       theApp->clipboard().get() :
-                       theApp->selection().get();
+                       theClipboard().get() :
+                       theSelection().get();
                if (clip.empty())
                        break;
                // pass to InsertAsciiString, but
@@ -1792,7 +1791,7 @@ bool InsetTabular::copySelection(LCursor & cur)
        ostringstream os;
        OutputParams const runparams;
        paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
-       theApp->clipboard().put(lyx::from_utf8(os.str()));
+       theClipboard().put(lyx::from_utf8(os.str()));
        // mark tabular stack dirty
        // FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
        // when we (hopefully) have a one-for-all paste mechanism.
index 7a42d5024dc2ad30e211198b38e9ef0cb31b7def..e5cb547a9c17f11c5da84b05be429785dc224f93 100644 (file)
@@ -23,8 +23,6 @@
 #include "lyxtext.h"
 #include "metricsinfo.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -133,7 +131,7 @@ void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
        int d = 0;
        string lab = label();
        docstring dlab(lab.begin(), lab.end());
-       theApp->fontLoader().metrics(font).rectText(dlab, w, a, d);
+       theFontMetrics(font).rectText(dlab, w, a, d);
 
        height = max(height, a + d);
 
@@ -185,7 +183,7 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
        font.decSize();
        string lab = label();
        docstring dlab(lab.begin(), lab.end());
-       theApp->fontLoader().metrics(font).rectText(dlab, w, a, d);
+       theFontMetrics(font).rectText(dlab, w, a, d);
 
        pi.pain.rectText(x + 2 * arrow_size + 5,
                         start + (end - start) / 2 + (a - d) / 2,
index 883b6244fe7bbbd4ae4fa4b7538973a0596757c2..16a153fcdf6f487826176e1ef7e509e178103341 100644 (file)
@@ -15,8 +15,6 @@
 #include "LColor.h"
 #include "metricsinfo.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -49,7 +47,7 @@ void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
        LyXFont font(LyXFont::ALL_SANE);
        font.decSize();
        lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+               theFontMetrics(font);
        
        docstring dtext(text_.begin(), text_.end());
         
index 3b470bde30cf6653b3fe6fb06d4e539e24ee87b9..73cdf27c5d6d1d5bb4b2637d89c7f3ea282f26f1 100644 (file)
@@ -20,8 +20,6 @@
 #include "lyxrc.h"
 #include "metricsinfo.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -165,7 +163,7 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const
                docstring djust(justname.begin(), justname.end());
                if (!justname.empty()) {
                        msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
-                       font_width = theApp->fontLoader().metrics(msgFont)
+                       font_width = theFontMetrics(msgFont)
                                .width(djust);
                }
 
@@ -173,8 +171,8 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const
                if (!msg.empty()) {
                        docstring dmsg(msg.begin(), msg.end());
                        msgFont.setSize(LyXFont::SIZE_TINY);
-                       font_width = std::max(font_width, theApp->fontLoader()
-                               .metrics(msgFont).width(dmsg));
+                       font_width = std::max(font_width,
+                               theFontMetrics(msgFont).width(dmsg));
                }
 
                dim.wid = std::max(50, font_width + 15);
@@ -219,7 +217,7 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
                        docstring djust(justname.begin(), justname.end());
                        msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
                        pi.pain.text(x + InsetOld::TEXT_TO_INSET_OFFSET + 6,
-                                  y - theApp->fontLoader().metrics(msgFont).maxAscent() - 4,
+                                  y - theFontMetrics(msgFont).maxAscent() - 4,
                                   djust, msgFont);
                }
 
index c6532a4e55e03f351e5a2dc125d1dcfcf4cd0de6..d219e39c1077b14a2aa995dbcc04173a37cddc86 100644 (file)
@@ -21,8 +21,6 @@
 #include "lyxrc.h"
 #include "metricsinfo.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -135,7 +133,7 @@ void RenderPreview::metrics(MetricsInfo & mi, Dimension & dim) const
                font.setSize(LyXFont::SIZE_FOOTNOTE);
                string stat = statusMessage(mi.base.bv, snippet_);
                docstring dstat(stat.begin(), stat.end());
-               dim.wid = 15 + theApp->fontLoader().metrics(font).width(dstat);
+               dim.wid = 15 + theFontMetrics(font).width(dstat);
        }
 
        dim_ = dim;
@@ -170,7 +168,7 @@ void RenderPreview::draw(PainterInfo & pi, int x, int y) const
                string stat = statusMessage(pi.base.bv, snippet_);
                docstring dstat(stat.begin(), stat.end());
                pi.pain.text(x + offset + 6,
-                            y - theApp->fontLoader().metrics(font).maxAscent() - 4,
+                            y - theFontMetrics(font).maxAscent() - 4,
                             dstat, font);
        }
 }
index 341aa45c36dc145d54d6218cdb0ec120914ae4d3..6cbe384d13e0b1df17045669d0f8065e162d458a 100644 (file)
@@ -193,7 +193,7 @@ void quitLyX(bool noask)
        lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
 
        if (lyx_gui::use_gui) {
-               if (!noask && !theApp->bufferList().quitWriteAll())
+               if (!noask && !theBufferList().quitWriteAll())
                        return;
 
                LyX::cref().session().writeFile();
@@ -204,7 +204,7 @@ void quitLyX(bool noask)
        quitting = true;
 
        // close buffers first
-       theApp->bufferList().closeAll();
+       theBufferList().closeAll();
 
        // do any other cleanup procedures now
        lyxerr[Debug::INFO] << "Deleting tmp dir " << package().temp_dir() << endl;
index 6e2b8ba530539714a37736d93eb57faa68d52c5f..0f98482706610fda0251d3d22b35f565d7429128 100644 (file)
@@ -279,7 +279,7 @@ int LyX::exec2(int & argc, char * argv[])
                                if (b)
                                        last_loaded = b;
                        } else {
-                               Buffer * buf = theApp->bufferList().newBuffer(s, false);
+                               Buffer * buf = theBufferList().newBuffer(s, false);
                                if (loadLyXFile(buf, s)) {
                                        last_loaded = buf;
                                        ErrorList const & el = buf->errorList("Parse");
@@ -288,7 +288,7 @@ int LyX::exec2(int & argc, char * argv[])
                                                        boost::bind(&LyX::printError, this, _1));
                                }
                                else
-                                       theApp->bufferList().release(buf);
+                                       theBufferList().release(buf);
                        }
                }
 
@@ -668,7 +668,7 @@ void LyX::emergencyCleanup() const
        // contain documents etc. which might be helpful on
        // a crash
 
-       theApp->bufferList().emergencyWriteAll();
+       theBufferList().emergencyWriteAll();
        theApp->server().emergencyCleanup();
 }
 
index 923d61f6692b91e6ae9812735b6f0bd872de6055..6d25032ddcef78d47e97ecb2dfecbf75faac38bf 100644 (file)
@@ -1079,15 +1079,15 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                // --- buffers ----------------------------------------
                case LFUN_BUFFER_SWITCH:
-                       owner->setBuffer(theApp->bufferList().getBuffer(argument));
+                       owner->setBuffer(theBufferList().getBuffer(argument));
                        break;
 
                case LFUN_BUFFER_NEXT:
-                       owner->setBuffer(theApp->bufferList().next(view()->buffer()));
+                       owner->setBuffer(theBufferList().next(view()->buffer()));
                        break;
 
                case LFUN_BUFFER_PREVIOUS:
-                       owner->setBuffer(theApp->bufferList().previous(view()->buffer()));
+                       owner->setBuffer(theBufferList().previous(view()->buffer()));
                        break;
 
                case LFUN_FILE_NEW:
@@ -1127,14 +1127,14 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        if (prefixIs(file_name, package().temp_dir())) {
                                // Needed by inverse dvi search. If it is a file
                                // in tmpdir, call the apropriated function
-                               owner->setBuffer(theApp->bufferList().getBufferFromTmp(file_name));
+                               owner->setBuffer(theBufferList().getBufferFromTmp(file_name));
                        } else {
                                // Must replace extension of the file to be .lyx
                                // and get full path
                                string const s = changeExtension(file_name, ".lyx");
                                // Either change buffer or load the file
-                               if (theApp->bufferList().exists(s)) {
-                                       owner->setBuffer(theApp->bufferList().getBuffer(s));
+                               if (theBufferList().exists(s)) {
+                                       owner->setBuffer(theBufferList().getBuffer(s));
                                } else {
                                        owner->loadLyXFile(s);
                                }
@@ -1284,8 +1284,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                         makeDisplayPath(filename) + lyx::from_ascii("..."));
                        view()->savePosition(0);
                        string const parentfilename = owner->buffer()->fileName();
-                       if (theApp->bufferList().exists(filename))
-                               owner->setBuffer(theApp->bufferList().getBuffer(filename));
+                       if (theBufferList().exists(filename))
+                               owner->setBuffer(theBufferList().getBuffer(filename));
                        else
                                owner->loadLyXFile(filename);
                        // Set the parent name of the child document.
@@ -1350,7 +1350,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                case LFUN_SCREEN_FONT_UPDATE:
                        // handle the screen font changes.
                        lyxrc.set_font_norm_type();
-                       theApp->fontLoader().update();
+                       theFontLoader().update();
                        // All visible buffers will need resize
                        view()->resize();
                        break;
@@ -1696,7 +1696,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
        if (filename.empty()) {
                filename = addName(lyxrc.document_path,
                            "newfile" + convert<string>(++newfile_number) + ".lyx");
-               while (theApp->bufferList().exists(filename) || fs::is_readable(filename)) {
+               while (theBufferList().exists(filename) || fs::is_readable(filename)) {
                        ++newfile_number;
                        filename = addName(lyxrc.document_path,
                                           "newfile" +  convert<string>(newfile_number) +
@@ -1855,8 +1855,8 @@ void LyXFunc::doImport(string const & argument)
        string const lyxfile = changeExtension(filename, ".lyx");
 
        // Check if the document already is open
-       if (lyx_gui::use_gui && theApp->bufferList().exists(lyxfile)) {
-               if (!theApp->bufferList().close(theApp->bufferList().getBuffer(lyxfile), true)) {
+       if (lyx_gui::use_gui && theBufferList().exists(lyxfile)) {
+               if (!theBufferList().close(theBufferList().getBuffer(lyxfile), true)) {
                        owner->message(_("Canceled."));
                        return;
                }
@@ -1889,14 +1889,14 @@ void LyXFunc::closeBuffer()
        // save current cursor position
        LyX::ref().session().saveFilePosition(owner->buffer()->fileName(),
                boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
-       if (theApp->bufferList().close(owner->buffer(), true) && !quitting) {
-               if (theApp->bufferList().empty()) {
+       if (theBufferList().close(owner->buffer(), true) && !quitting) {
+               if (theBufferList().empty()) {
                        // need this otherwise SEGV may occur while
                        // trying to set variables that don't exist
                        // since there's no current buffer
                        owner->getDialogs().hideBufferDependent();
                } else {
-                       owner->setBuffer(theApp->bufferList().first());
+                       owner->setBuffer(theBufferList().first());
                }
        }
 }
index 47c0108eed94332831af80a2da00457ffaeecdfe..f557e7787ad026ea3dc28db3f5a40f9bd1f35c57 100644 (file)
@@ -112,4 +112,13 @@ private:
        bool ensureBufferClean(BufferView * bv);
 };
 
+extern LyXFunc & theLyXFunc();
+
+namespace lyx {
+
+extern FuncStatus getStatus(FuncRequest const & action);
+
+extern void dispatch(FuncRequest const & action);
+}
+
 #endif
index f08d9191a4cc494c57e9f4c5364f83fe6daa39d3..d139a4793d7e358527abac659462e796d71ad94f 100644 (file)
@@ -136,7 +136,7 @@ int LyXLength::inPixels(int text_width, int em_width_base) const
                ? em_width_base
                : 10*(dpi/72.27)*zoom;
        // A different estimate for em_width is
-       // theApp->fontLoader().metrics(LyXFont(LyXFont::ALL_SANE)).width('M')
+       // theFontMetrics(LyXFont(LyXFont::ALL_SANE)).width('M')
        // but this estimate might not be more accurate as the screen font
        // is different then the latex font.
 
index 3b644b65e45243abac603dd5cb3946e5de5fbd56..ea9076f75f8faf1369c668c8e7b4b617c4db6bde 100644 (file)
@@ -24,8 +24,6 @@
 #include "lyxlex.h"
 #include "outputparams.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -129,8 +127,7 @@ void InsetFormulaMacro::metrics(MetricsInfo & mi, Dimension & dim) const
        tmpl()->metrics(mi, dim);
        dim.asc += 5;
        dim.des += 5;
-       dim.wid += 10 
-               + theApp->fontLoader().metrics(mi.base.font).width(prefix());
+       dim.wid += 10 + theFontMetrics(mi.base.font).width(prefix());
        dim_ = dim;
 }
 
@@ -166,7 +163,7 @@ void InsetFormulaMacro::draw(PainterInfo & p, int x, int y) const
 
        // body
        tmpl()->draw(pi,
-               x + theApp->fontLoader().metrics(p.base.font).width(prefix()) + 5,
+               x + theFontMetrics(p.base.font).width(prefix()) + 5,
                y);
 
        setPosCache(pi, x, y);
index 3b8b87abe38c38275da66b2d406f4d7bd24e5696..90900360df2217834f72ac4c003882939a7d60b3 100644 (file)
@@ -15,8 +15,6 @@
 #include "MathMLStream.h"
 #include "MathStream.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 
 #include "support/lstrings.h"
@@ -65,8 +63,7 @@ double InsetMathBig::increase() const
 
 void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       double const h 
-               = theApp->fontLoader().metrics(mi.base.font).ascent('I');
+       double const h = theFontMetrics(mi.base.font).ascent('I');
        double const f = increase();
        dim_.wid = 6;
        dim_.asc = int(h + f * h);
index 2d3c12026d68d87cf95bb9df1746d9474c4c5d54..9307a721eef5ca4e48e7d27a0f4f0c53afe42647 100644 (file)
@@ -20,8 +20,6 @@
 #include "support/lstrings.h"
 #include "TextPainter.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 
 using std::auto_ptr;
@@ -80,7 +78,7 @@ void InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const
        whichFont(font_, code_, mi);
        mathed_char_dim(font_, char_, dim_);
        if (isBinaryOp(char_, code_))
-               width_ += 2 * theApp->fontLoader().metrics(font_).width(' ');
+               width_ += 2 * theFontMetrics(font_).width(' ');
        lyxerr << "InsetMathChar::metrics: " << dim << endl;
 #endif
        width_ = dim.wid;
index 547ad9a108160555f353aee0717b88db7bbd120d..c6f12f352397debe43d04ce429d990689f936bdd 100644 (file)
@@ -1275,7 +1275,7 @@ void InsetMathHull::mutateToText()
                view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt);
 
        // remove ourselves
-       //theApp->lyxFunc().dispatch(LFUN_ESCAPE);
+       //lyx::dispatch(LFUN_ESCAPE);
 #endif
 }
 
index 1a0bbb8d2beaf4768b37333063191799ca5bad3e..b23dc673d7ab2cb402690711501588e44b1b8eb9 100644 (file)
 
 #include "support/lstrings.h"
 
-#include "frontends/Application.h"
 #include "frontends/Painter.h"
 #include "frontends/Selection.h"
 #include "frontends/nullpainter.h"
 
-//#include "bufferlist.h"
 #include "funcrequest.h"
 #include "lyxserver.h"
 #include "lyxsocket.h"
@@ -67,8 +65,6 @@ using lyx::cap::cutSelection;
 using lyx::cap::replaceSelection;
 using lyx::cap::selClearOrDel;
 
-using lyx::frontend::Clipboard;
-
 using std::endl;
 using std::string;
 using std::istringstream;
@@ -1110,7 +1106,7 @@ void InsetMathNest::lfunMousePress(LCursor & cur, FuncRequest & cmd)
                if (cur.selection())
                        asArray(lyx::to_utf8(bv.cursor().selectionAsString(false)), ar);
                else
-                       asArray(lyx::to_utf8(theApp->selection().get()), ar);
+                       asArray(lyx::to_utf8(theSelection().get()), ar);
 
                cur.insert(ar);
                bv.mouseSetCursor(cur);
@@ -1141,7 +1137,7 @@ void InsetMathNest::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
        //lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
 
        if (cmd.button() == mouse_button::button1) {
-               //theApp->selection().put(cur.grabSelection());
+               //theSelection().put(cur.grabSelection());
                return;
        }
 
index e9e40b4f49484d82910f68734ed4e6a1d9e7654b..6bc40bbea90b7e012d284e83ecf55ed00e8be955 100644 (file)
@@ -60,7 +60,6 @@
 #include "support/filetools.h" // LibFileSearch
 #include "support/lstrings.h"
 
-#include "frontends/Application.h"
 #include "frontends/FontLoader.h"
 
 #include <fstream>
@@ -89,7 +88,7 @@ bool math_font_available(string & name)
        augmentFont(f, name);
 
        // Do we have the font proper?
-       if (theApp->fontLoader().available(f))
+       if (theFontLoader().available(f))
                return true;
 
        // can we fake it?
index 32e7bc885bb2192d8f397f9a258335d93f5cff4d..b546e76720d74e8317c7f90681a1fed9108d8e45 100644 (file)
@@ -21,8 +21,6 @@
 #include "lyxlex.h"
 #include "LColor.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -119,7 +117,7 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
        cell(1).metrics(mi);
        docstring dp = prefix();
        dim.wid = cell(0).width() + cell(1).width() + 20
-               + theApp->fontLoader().metrics(mi.base.font).width(dp);
+               + theFontMetrics(mi.base.font).width(dp);
        dim.asc = std::max(cell(0).ascent(),  cell(1).ascent())  + 7;
        dim.des = std::max(cell(0).descent(), cell(1).descent()) + 7;
        dim_ = dim;
@@ -158,7 +156,7 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const
        docstring dp = prefix();
        pi.pain.text(x + 2, y, dp, font);
        // FIXME: Painter text should retain the drawn text width
-       x += theApp->fontLoader().metrics(font).width(dp) + 6;
+       x += theFontMetrics(font).width(dp) + 6;
 
        int const w0 = cell(0).width();
        int const w1 = cell(1).width();
index f89289b5b77d32383bbccbd5140eed6283df9c7e..02c224ffff85305e9c4cce0c42a6a9c3b3a049d3 100644 (file)
@@ -20,7 +20,6 @@
 #include "debug.h"
 #include "LColor.h"
 
-#include "frontends/Application.h"
 #include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
@@ -368,8 +367,7 @@ deco_struct const * search_deco(string const & name)
 
 void mathed_char_dim(LyXFont const & font, unsigned char c, Dimension & dim)
 {
-       lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+       lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
        dim.des = fm.descent(c);
        dim.asc = fm.ascent(c);
        dim.wid = fm.width(c);
@@ -378,14 +376,13 @@ void mathed_char_dim(LyXFont const & font, unsigned char c, Dimension & dim)
 
 int mathed_char_width(LyXFont const & font, unsigned char c)
 {
-       return theApp->fontLoader().metrics(font).width(c);
+       return theFontMetrics(font).width(c);
 }
 
 
 void mathed_string_dim(LyXFont const & font, string const & s, Dimension & dim)
 {
-       lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+       lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
 #if 1
        dim.asc = 0;
        dim.des = 0;
@@ -405,7 +402,7 @@ void mathed_string_dim(LyXFont const & font, string const & s, Dimension & dim)
 int mathed_string_width(LyXFont const & font, string const & s)
 {
        docstring ds(s.begin(), s.end());
-       return theApp->fontLoader().metrics(font).width(ds);
+       return theFontMetrics(font).width(ds);
 }
 
 
@@ -499,8 +496,7 @@ void drawStrBlack(PainterInfo & pi, int x, int y, string const & str)
 
 void math_font_max_dim(LyXFont const & font, int & asc, int & des)
 {
-       lyx::frontend::FontMetrics const & fm =
-               theApp->fontLoader().metrics(font);
+       lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
        asc = fm.maxAscent();
        des = fm.maxDescent();
 }
@@ -665,9 +661,9 @@ void augmentFont(LyXFont & font, string const & name)
        if (!initialized) {
                initialized = true;
                // fake fonts if necessary
-               if (!theApp->fontLoader().available(getFont("mathfrak")))
+               if (!theFontLoader().available(getFont("mathfrak")))
                        fakeFont("mathfrak", "lyxfakefrak");
-               if (!theApp->fontLoader().available(getFont("mathcal")))
+               if (!theFontLoader().available(getFont("mathcal")))
                        fakeFont("mathcal", "lyxfakecal");
        }
        fontinfo * info = searchFont(name);
index 10ecef35b90247b96b5054aa0339a71a90ed1b7f..bb35ab8ad0db7750b4594c6c83ff24496af06897 100644 (file)
@@ -32,8 +32,6 @@
 #include "ParagraphParameters.h"
 #include "vspace.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/nullpainter.h"
 #include "frontends/Painter.h"
@@ -202,7 +200,7 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
        str += c;
        ++vpos;
 
-       int const width = theApp->fontLoader().metrics(font).width(c);
+       int const width = theFontMetrics(font).width(c);
        int dx = 0;
 
        for (pos_type i = pos - 1; i >= 0; --i) {
@@ -237,7 +235,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
        str += c;
        ++vpos;
 
-       int const width = theApp->fontLoader().metrics(font).width(c);
+       int const width = theFontMetrics(font).width(c);
        int dx = 0;
 
        for (pos_type i = pos - 1; i >= 0; --i) {
@@ -463,7 +461,7 @@ int RowPainter::paintAppendixStart(int y)
        int a = 0;
        int d = 0;
         docstring dlab(label.begin(), label.end());
-       theApp->fontLoader().metrics(pb_font).rectText(dlab, w, a, d);
+       theFontMetrics(pb_font).rectText(dlab, w, a, d);
 
        int const text_start = int(xo_ + (width_ - w) / 2);
        int const text_end = text_start + w;
@@ -518,8 +516,7 @@ void RowPainter::paintFirst()
                      || is_seq)) {
 
                LyXFont const font = getLabelFont();
-               FontMetrics const & fm =
-                       theApp->fontLoader().metrics(font);
+               FontMetrics const & fm = theFontMetrics(font);
 
                string const str = par_.getLabelstring();
                if (!str.empty()) {
@@ -579,8 +576,7 @@ void RowPainter::paintFirst()
                        else
                                spacing_val = buffer.params().spacing().getValue();
 
-                       FontMetrics const & fm =
-                               theApp->fontLoader().metrics(font);
+                       FontMetrics const & fm = theFontMetrics(font);
 
                        int const labeladdon = int(fm.maxHeight()
                                * layout->spacing.getValue() * spacing_val);
@@ -614,7 +610,7 @@ void RowPainter::paintLast()
        case END_LABEL_BOX:
        case END_LABEL_FILLED_BOX: {
                LyXFont const font = getLabelFont();
-               FontMetrics const & fm = theApp->fontLoader().metrics(font);
+               FontMetrics const & fm = theFontMetrics(font);
                int const size = int(0.75 * fm.maxAscent());
                int const y = yo_ - size;
                int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
@@ -631,7 +627,7 @@ void RowPainter::paintLast()
 
        case END_LABEL_STATIC: {
                LyXFont font = getLabelFont();
-               FontMetrics const & fm = theApp->fontLoader().metrics(font);
+               FontMetrics const & fm = theFontMetrics(font);
                string const & str = par_.layout()->endlabelstring();
                 docstring dstr(str.begin(), str.end());
                double const x = is_rtl ?
@@ -706,8 +702,8 @@ void RowPainter::paintText()
                // We also don't paint across things like tables
                if (running_strikeout && (highly_editable_inset || !is_struckout)) {
                        // Calculate 1/3 height of the buffer's default font
-                       FontMetrics const & fm = theApp->fontLoader().metrics(
-                               bv_.buffer()->params().getFont());
+                       FontMetrics const & fm 
+                               = theFontMetrics(bv_.buffer()->params().getFont());
                        int const middle = yo_ - fm.maxAscent() / 3;
                        pain_.line(last_strikeout_x, middle, int(x_), middle,
                                LColor::strikeout, Painter::line_solid, Painter::line_thin);
@@ -717,8 +713,8 @@ void RowPainter::paintText()
                if (body_pos > 0 && pos == body_pos - 1) {
                         string lab = layout->labelsep;
                         docstring dlab(lab.begin(), lab.end());
-                       int const lwidth =
-                               theApp->fontLoader().metrics(getLabelFont()).width(dlab);
+                       int const lwidth 
+                               = theFontMetrics(getLabelFont()).width(dlab);
 
                        x_ += label_hfill_ + lwidth - width_pos;
                }
@@ -762,8 +758,8 @@ void RowPainter::paintText()
        // if we reach the end of a struck out range, paint it
        if (running_strikeout) {
                // calculate 1/3 height of the buffer's default font
-               FontMetrics const & fm = theApp->fontLoader().metrics(
-                       bv_.buffer()->params().getFont());
+               FontMetrics const & fm 
+                       = theFontMetrics(bv_.buffer()->params().getFont());
                int const middle = yo_ - fm.maxAscent() / 3;
                pain_.line(last_strikeout_x, middle, int(x_), middle,
                        LColor::strikeout, Painter::line_solid, Painter::line_thin);
index 26b31905114c84d7c4a3b012f83cc5851da46e15..a224f124ac4b8f7ee9de1ded4bdc39e27b01f41d 100644 (file)
@@ -51,8 +51,6 @@
 #include "vspace.h"
 #include "WordLangTuple.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
@@ -466,13 +464,13 @@ int LyXText::singleWidth(Paragraph const & par,
                                   Encodings::isComposeChar_hebrew(c))
                                return 0;
                }
-               return theApp->fontLoader().metrics(font).width(c);
+               return theFontMetrics(font).width(c);
        }
 
        if (c == Paragraph::META_INSET)
                return par.getInset(pos)->width();
 
-       return theApp->fontLoader().metrics(font).width(c);
+       return theFontMetrics(font).width(c);
 }
 
 
@@ -505,7 +503,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
 
        string leftm = tclass.leftmargin();
        docstring dleft(leftm.begin(), leftm.end());
-       l_margin += theApp->fontLoader().metrics(params.getFont()).signedWidth(dleft);
+       l_margin += theFontMetrics(params.getFont()).signedWidth(dleft);
 
        if (par.getDepth() != 0) {
                // find the next level paragraph
@@ -531,14 +529,14 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
                parindent.erase();
 
        LyXFont const labelfont = getLabelFont(par);
-       FontMetrics const & labelfont_metrics = theApp->fontLoader().metrics(labelfont);
+       FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
 
        switch (layout->margintype) {
        case MARGIN_DYNAMIC:
                if (!layout->leftmargin.empty()) {
                        string leftm = layout->leftmargin;
                        docstring dleft(leftm.begin(), leftm.end());
-                       l_margin += theApp->fontLoader().metrics(params.getFont()).signedWidth(dleft);
+                       l_margin += theFontMetrics(params.getFont()).signedWidth(dleft);
                }
                if (!par.getLabelstring().empty()) {
                        string labin = layout->labelindent;
@@ -574,8 +572,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
        case MARGIN_STATIC: {
                string leftm = layout->leftmargin;
                docstring dleft(leftm.begin(), leftm.end());
-               l_margin += 
-                       theApp->fontLoader().metrics(params.getFont()).signedWidth(dleft)
+               l_margin += theFontMetrics(params.getFont()).signedWidth(dleft)
                        * 4     / (par.getDepth() + 4);
                break;
        }
@@ -629,7 +626,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
                for ( ; rit != end; ++rit)
                        if (rit->fill() < minfill)
                                minfill = rit->fill();
-               l_margin += theApp->fontLoader().metrics(params.getFont()).signedWidth(layout->leftmargin);
+               l_margin += theFontMetrics(params.getFont()).signedWidth(layout->leftmargin);
                l_margin += minfill;
 #endif
                // also wrong, but much shorter.
@@ -669,7 +666,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
                   BufferParams::PARSEP_INDENT))
        {
                docstring din(parindent.begin(), parindent.end());
-               l_margin += theApp->fontLoader().metrics(params.getFont()).signedWidth(din);
+               l_margin += theFontMetrics(params.getFont()).signedWidth(din);
        }
 
        return l_margin;
@@ -691,7 +688,7 @@ int LyXText::rightMargin(Paragraph const & par) const
        docstring dtrmarg(trmarg.begin(), trmarg.end());
        string lrmarg = par.layout()->rightmargin;
        docstring dlrmarg(lrmarg.begin(), lrmarg.end());
-       FontMetrics const & fm = theApp->fontLoader().metrics(params.getFont());
+       FontMetrics const & fm = theFontMetrics(params.getFont());
        int const r_margin =
                ::rightMargin()
                + fm.signedWidth(dtrmarg)
@@ -769,7 +766,7 @@ void LyXText::rowBreakPoint(pit_type const pit, Row & row) const
        FontIterator fi = FontIterator(*this, par, pos);
        pos_type point = end;
        pos_type i = pos;
-       FontMetrics const & fm = theApp->fontLoader().metrics(getLabelFont(par));
+       FontMetrics const & fm = theFontMetrics(getLabelFont(par));
        for ( ; i < end; ++i, ++fi) {
                char_type const c = par.getChar(i);
                int thiswidth = singleWidth(par, i, c, *fi);
@@ -858,7 +855,7 @@ void LyXText::setRowWidth(pit_type const pit, Row & row) const
        pos_type const body_pos = par.beginOfBody();
        pos_type i = row.pos();
 
-       FontMetrics const & fm = theApp->fontLoader().metrics(getLabelFont(par));
+       FontMetrics const & fm = theFontMetrics(getLabelFont(par));
 
        if (i < end) {
                FontIterator fi = FontIterator(*this, par, i);
@@ -909,7 +906,7 @@ int LyXText::labelFill(Paragraph const & par, Row const & row) const
 
        docstring dlab(label.begin(), label.end());
 
-       FontMetrics const & fm = theApp->fontLoader().metrics(getLabelFont(par));
+       FontMetrics const & fm = theFontMetrics(getLabelFont(par));
 
        return max(0, fm.width(dlab) - w);
 }
@@ -946,8 +943,8 @@ void LyXText::setHeightOfRow(pit_type const pit, Row & row)
 
        LyXFont labelfont = getLabelFont(par);
 
-       FontMetrics const & labelfont_metrics = theApp->fontLoader().metrics(labelfont);
-       FontMetrics const & fontmetrics = theApp->fontLoader().metrics(font);
+       FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
+       FontMetrics const & fontmetrics = theFontMetrics(font);
 
        // these are minimum values
        double const spacing_val = layout->spacing.getValue() * spacing(par);
@@ -1396,7 +1393,7 @@ LyXText::computeRowMetrics(pit_type const pit, Row const & row) const
                {
                        string lsep = layout->labelsep;
                        docstring dlsep(lsep.begin(), lsep.end());
-                       result.x += theApp->fontLoader().metrics(getLabelFont(par)).width(dlsep);
+                       result.x += theFontMetrics(getLabelFont(par)).width(dlsep);
                        if (body_pos <= end)
                                result.x += result.label_hfill;
                }
@@ -2300,7 +2297,7 @@ int LyXText::cursorX(CursorSlice const & sl, bool boundary) const
        // Use font span to speed things up, see below
        FontSpan font_span;
        LyXFont font;
-       FontMetrics const & labelfm = theApp->fontLoader().metrics(getLabelFont(par));
+       FontMetrics const & labelfm = theFontMetrics(getLabelFont(par));
 
        for (pos_type vpos = row_pos; vpos < cursor_vpos; ++vpos) {
                pos_type pos = bidi.vis2log(vpos);
index 2ce03f2d0984b4e5f4658bc1771babe4732bee7a..f9f4134399661745490fc8a1c7259b893ac92625 100644 (file)
@@ -50,8 +50,6 @@
 #include "undo.h"
 #include "vspace.h"
 
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 
 #include "insets/insetenv.h"
@@ -371,13 +369,13 @@ void LyXText::setLayout(LCursor & cur, string const & layout)
        if (lyxlayout->is_environment) {
                // move everything in a new environment inset
                lyxerr[Debug::DEBUG] << "setting layout " << layout << endl;
-               theApp->lyxFunc().dispatch(FuncRequest(LFUN_LINE_BEGIN));
-               theApp->lyxFunc().dispatch(FuncRequest(LFUN_LINE_END_SELECT));
-               theApp->lyxFunc().dispatch(FuncRequest(LFUN_CUT));
+               lyx::dispatch(FuncRequest(LFUN_LINE_BEGIN));
+               lyx::dispatch(FuncRequest(LFUN_LINE_END_SELECT));
+               lyx::dispatch(FuncRequest(LFUN_CUT));
                InsetBase * inset = new InsetEnvironment(params, layout);
                insertInset(cur, inset);
                //inset->edit(cur, true);
-               //theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
+               //lyx::dispatch(FuncRequest(LFUN_PASTE));
                return;
        }
 
@@ -805,8 +803,8 @@ pos_type LyXText::getColumnNearX(pit_type const pit,
                return 0;
        }
 
-       lyx::frontend::FontMetrics const & fm = theApp->fontLoader().metrics(
-               getLabelFont(par));
+       lyx::frontend::FontMetrics const & fm 
+               = theFontMetrics(getLabelFont(par));
 
        while (vc < end && tmpx <= x) {
                c = bidi.vis2log(vc);
@@ -1345,5 +1343,5 @@ void LyXText::recUndo(pit_type par) const
 
 int defaultRowHeight()
 {
-       return int(theApp->fontLoader().metrics(LyXFont(LyXFont::ALL_SANE)).maxHeight() *  1.2);
+       return int(theFontMetrics(LyXFont(LyXFont::ALL_SANE)).maxHeight() *  1.2);
 }
index 47fc8ceab030fbae191923c84d40e6f9c175bda5..7de85b6c6f754e8a00d32d917d6b7ae7ec0ec152 100644 (file)
@@ -47,7 +47,6 @@
 #include "vspace.h"
 #include "pariterator.h"
 
-#include "frontends/Application.h"
 #include "frontends/Clipboard.h"
 #include "frontends/Selection.h"
 
@@ -123,7 +122,7 @@ namespace {
                if (selecting || cur.mark())
                        cur.setSelection();
                if (!cur.selection())
-                       theApp->selection().haveSelection(false);
+                       theSelection().haveSelection(false);
                cur.bv().switchKeyMap();
        }
 
@@ -264,7 +263,7 @@ bool doInsertInset(LCursor & cur, LyXText * text,
        recordUndo(cur);
        bool gotsel = false;
        if (cur.selection()) {
-               theApp->lyxFunc().dispatch(FuncRequest(LFUN_CUT));
+               lyx::dispatch(FuncRequest(LFUN_CUT));
                gotsel = true;
        }
        text->insertInset(cur, inset);
@@ -273,7 +272,7 @@ bool doInsertInset(LCursor & cur, LyXText * text,
                inset->edit(cur, true);
 
        if (gotsel && pastesel) {
-               theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
+               lyx::dispatch(FuncRequest(LFUN_PASTE));
                // reset first par to default
                if (cur.lastpit() != 0 || cur.lastpos() != 0) {
                        LyXLayout_ptr const layout =
@@ -882,7 +881,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_CLIPBOARD_PASTE: {
                cur.clearSelection();
-               docstring const clip = theApp->clipboard().get();
+               docstring const clip = theClipboard().get();
                if (!clip.empty()) {
                        recordUndo(cur);
                        if (cmd.argument() == "paragraph")
@@ -895,7 +894,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_PRIMARY_SELECTION_PASTE: {
                cur.clearSelection();
-               docstring const clip = theApp->selection().get();
+               docstring const clip = theSelection().get();
                if (!clip.empty()) {
                        recordUndo(cur);
                        if (cmd.argument() == "paragraph")
@@ -935,16 +934,16 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                        cur.posRight();
                }
                else
-                       theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
+                       lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
                break;
        }
 
        case LFUN_DATE_INSERT:
                if (cmd.argument().empty())
-                       theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT,
+                       lyx::dispatch(FuncRequest(LFUN_SELF_INSERT,
                                lyx::formatted_time(lyx::current_time())));
                else
-                       theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT,
+                       lyx::dispatch(FuncRequest(LFUN_SELF_INSERT,
                                lyx::formatted_time(lyx::current_time(), lyx::to_utf8(cmd.argument()))));
                break;
 
@@ -955,7 +954,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                        cursorEnd(cur);
                        cur.setSelection();
                        bv->cursor() = cur;
-                       theApp->selection().haveSelection(cur.selection());
+                       theSelection().haveSelection(cur.selection());
                }
                break;
 
@@ -963,7 +962,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (cmd.button() == mouse_button::button1) {
                        selectWord(cur, lyx::WHOLE_WORD_STRICT);
                        bv->cursor() = cur;
-                       theApp->selection().haveSelection(cur.selection());
+                       theSelection().haveSelection(cur.selection());
                }
                break;
 
@@ -979,7 +978,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                // we have to check this first
                bool paste_internally = false;
                if (cmd.button() == mouse_button::button2 && cur.selection()) {
-                       theApp->lyxFunc().dispatch(FuncRequest(LFUN_COPY));
+                       lyx::dispatch(FuncRequest(LFUN_COPY));
                        paste_internally = true;
                }
 
@@ -990,9 +989,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                // insert this
                if (cmd.button() == mouse_button::button2) {
                        if (paste_internally)
-                               theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
+                               lyx::dispatch(FuncRequest(LFUN_PASTE));
                        else
-                               theApp->lyxFunc().dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
+                               lyx::dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
                }
 
                break;
@@ -1045,7 +1044,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
                // finish selection
                if (cmd.button() == mouse_button::button1)
-                       theApp->selection().haveSelection(cur.selection());
+                       theSelection().haveSelection(cur.selection());
 
                bv->switchKeyMap();
                break;
@@ -1064,7 +1063,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (lyxrc.auto_region_delete) {
                        if (cur.selection())
                                cutSelection(cur, false, false);
-                       theApp->selection().haveSelection(false);
+                       theSelection().haveSelection(false);
                }
 
                cur.clearSelection();
@@ -1381,7 +1380,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_ACCENT_HUNGARIAN_UMLAUT:
        case LFUN_ACCENT_CIRCLE:
        case LFUN_ACCENT_OGONEK:
-               theApp->lyxFunc().handleKeyFunc(cmd.action);
+               theLyXFunc().handleKeyFunc(cmd.action);
                if (!cmd.argument().empty())
                        // FIXME: Are all these characters encoded in one byte in utf8?
                        bv->getIntl().getTransManager()