]> git.lyx.org Git - features.git/commitdiff
This commit replaces BufferView->LyXView->Gui->[selection,clipboard] with theApp...
authorAbdelrazak Younes <younes@lyx.org>
Fri, 22 Sep 2006 15:02:41 +0000 (15:02 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 22 Sep 2006 15:02:41 +0000 (15:02 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15125 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
src/BufferView.C
src/CutAndPaste.C
src/frontends/Application.h
src/frontends/Gui.h
src/frontends/LyXView.C
src/frontends/LyXView.h
src/frontends/qt4/GuiApplication.C
src/frontends/qt4/GuiApplication.h
src/frontends/qt4/GuiImplementation.C
src/frontends/qt4/GuiImplementation.h
src/frontends/qt4/GuiView.C
src/frontends/qt4/GuiView.h
src/insets/insettabular.C
src/mathed/InsetMathNest.C
src/text3.C

index 6b03a41239dbb131c927a9830283f0e0373aace0..95d093b777032d8ebd431a539511291251d406fe 100644 (file)
@@ -64,7 +64,6 @@
 #include "frontends/Dialogs.h"
 #include "frontends/FileDialog.h"
 #include "frontends/font_metrics.h"
-#include "frontends/Gui.h"
 #include "frontends/LyXView.h"
 #include "frontends/Selection.h"
 
@@ -84,7 +83,6 @@
 
 
 using lyx::frontend::Clipboard;
-using lyx::frontend::Gui;
 
 using lyx::docstring;
 using lyx::pos_type;
index 27fa600a164677fba89676db70197dd57d05596e..cb7c556bfc1c8138870dbbcfc17fded53dd9ec8f 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "support/lstrings.h"
 
-#include "frontends/Gui.h"
 #include "frontends/LyXView.h"
 #include "frontends/Clipboard.h"
 
@@ -57,7 +56,6 @@ using lyx::textclass_type;
 
 using lyx::support::bformat;
 
-using lyx::frontend::Gui;
 using lyx::frontend::Clipboard;
 
 using std::endl;
@@ -513,8 +511,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 cur.bv().owner()->gui().selection().put. (Lgb)
-//             cur.bv().owner()->gui().selection().put(cur.selectionAsString(true));
+               // calls to theApp->selection().put. (Lgb)
+//             theApp->selection().put(cur.selectionAsString(true));
 
 
                // make sure that the depth behind the selection are restored, too
@@ -578,7 +576,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
-       cur.bv().owner()->gui().clipboard().put(cur.selectionAsString(true));
+       theApp->clipboard().put(cur.selectionAsString(true));
 
        // this doesn't make sense, if there is no selection
        if (!cur.selection())
index a7efd7834299c523a00f7a06c38e8f1ac91eaf1c..3b2fefe0bc96c021d3477bc9d812fa95defc11bc 100644 (file)
@@ -25,8 +25,9 @@ class LyXView;
 namespace lyx {\r
 namespace frontend {\r
 \r
-//class GuiWorkArea;\r
+class Clipboard;\r
 class Gui;\r
+class Selection;\r
 \r
 \r
 /// The main application class\r
@@ -50,6 +51,11 @@ public:
        ///\r
        virtual void exit(int status) = 0;\r
 \r
+       ///\r
+       virtual Clipboard & clipboard() = 0;\r
+       ///\r
+       virtual Selection & selection() = 0;\r
+\r
        ///\r
        LyXFunc & lyxFunc();\r
        LyXFunc const & lyxFunc() const;\r
index 0260b1a366a9ac5dd92de0278422eb7f7fa978a0..9b5e7a99493c2a47b6b5c155821d189649119811 100644 (file)
@@ -24,8 +24,6 @@ class BufferView;
 namespace lyx {
 namespace frontend {
 
-class Clipboard;
-class Selection;
 class WorkArea;
 
 
@@ -37,11 +35,6 @@ class Gui
 public:
        virtual ~Gui() {}
 
-       ///
-       virtual Clipboard & clipboard() = 0;
-       ///
-       virtual Selection & selection() = 0;
-
        ///
        virtual int newView(unsigned int width, unsigned int height) = 0;
        ///
index 6e08fc4d0c1576b0b336d4ed10700665069eb423..8a8274e966e0d998b92618004f6d4dbd96b5ca5c 100644 (file)
@@ -12,7 +12,6 @@
 #include <config.h>
 
 #include "LyXView.h"
-#include "Gui.h"
 #include "Dialogs.h"
 #include "Timeout.h"
 #include "Toolbars.h"
@@ -50,7 +49,6 @@
 # include <unistd.h>
 #endif
 
-using lyx::frontend::Gui;
 using lyx::frontend::WorkArea;
 
 using lyx::docstring;
@@ -65,15 +63,9 @@ using lyx::frontend::ControlCommandBuffer;
 
 string current_layout;
 
-Gui & LyXView::gui()
-{
-       return owner_;
-}
-
 
-LyXView::LyXView(Gui & owner)
+LyXView::LyXView()
        : work_area_(0),
-         owner_(owner),
          toolbars_(new Toolbars(*this)),
          autosave_timeout_(new Timeout(5000)),
          lyxfunc_(new LyXFunc(this)),
index d083869887e39945036f24bd8e3fcd14fa3d565e..bda7da3f43f804b7154340237161922f95039cbf 100644 (file)
@@ -58,7 +58,7 @@ class ControlCommandBuffer;
 class LyXView : public boost::signals::trackable, boost::noncopyable {
 public:
 
-       LyXView(lyx::frontend::Gui & owner);
+       LyXView();
 
        virtual ~LyXView();
 
@@ -162,9 +162,6 @@ public:
        /// returns true if this view has the focus.
        virtual bool hasFocus() const = 0;
 
-       ///
-       virtual lyx::frontend::Gui & gui();
-
        /// Temporary method used by the kernel to redraw the work area.
        virtual void redrawWorkArea();
 
@@ -191,7 +188,6 @@ protected:
        boost::scoped_ptr<Menubar> menubar_;
 
 private:
-       lyx::frontend::Gui & owner_;
        /**
         * setWindowTitle - set title of window
         * @param t main window title
index 764251bede20abf2711a8bb38c9019fd99b974b8..eff55cccec626630de015ecd6524ba009223c2b2 100644 (file)
@@ -137,6 +137,18 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
 }
 
 
+Clipboard& GuiApplication::clipboard()
+{
+       return clipboard_;
+}
+
+
+Selection& GuiApplication::selection()
+{
+       return selection_;
+}
+
+
 int const GuiApplication::exec()
 {
        return QApplication::exec();
index efd54a45f08429a601b77c03725b555a6ab3bea1..8e11369c9e90d2b0176ec545765767982cc50012 100644 (file)
 #ifndef QT4_APPLICATION_H
 #define QT4_APPLICATION_H
 
-#include "GuiImplementation.h"
 #include "FontLoader.h"
+#include "GuiClipboard.h"
+#include "GuiImplementation.h"
+#include "GuiSelection.h"
 
 #include "frontends/Application.h"
 
@@ -50,6 +52,8 @@ public:
 
        /// Method inherited from \c Application class
        //@{
+       virtual Clipboard& clipboard();
+       virtual Selection& selection();
        virtual int const exec();
        virtual Gui & gui() { return gui_; }
        virtual void exit(int status);
@@ -65,7 +69,10 @@ public:
 private:
        ///
        GuiImplementation gui_;
-
+       ///
+       GuiClipboard clipboard_;
+       ///
+       GuiSelection selection_;
        ///
        FontLoader font_loader_;
 
index 3ec3c0195220fe1ac4bc217f8517c031399e3274..5ead31e72678eabecf408b2708e94766444acedf 100644 (file)
@@ -31,24 +31,12 @@ GuiImplementation::GuiImplementation(): max_view_id_(0), max_wa_id_(0)
 }
 
 
-Clipboard& GuiImplementation::clipboard()
-{
-       return clipboard_;
-}
-
-
-Selection& GuiImplementation::selection()
-{
-       return selection_;
-}
-
-
 int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
 {
        size_t const id = max_view_id_;
        ++max_view_id_;
 
-       views_[id].reset(new GuiView(*this));
+       views_[id].reset(new GuiView());
 
        return id;
 }
index d31437cfa59617dbafd4b00133a06d56540b7511..312227dc0c0a8f71f0faf828812288b24dcb790f 100644 (file)
@@ -14,8 +14,6 @@
 #define GUI_H
 
 #include "frontends/Gui.h"
-#include "GuiClipboard.h"
-#include "GuiSelection.h"
 
 #include <boost/shared_ptr.hpp>
 
@@ -38,9 +36,6 @@ public:
        GuiImplementation();
        virtual ~GuiImplementation() {}
 
-       Clipboard& clipboard();
-       Selection& selection();
-
        int newView(unsigned int width, unsigned int height);
        LyXView& view(int id);
        void destroyView(int id);
@@ -51,10 +46,6 @@ public:
 
 
 private:
-       ///
-       GuiClipboard clipboard_;
-       ///
-       GuiSelection selection_;
        ///
        std::map<int, boost::shared_ptr<GuiView> > views_;
        ///
index b54e9a5334d04aeb60ef66e8dabf9002be6f326a..59bc76c6a2bcd72cfe953e8e3cd9a91ab9e9f443 100644 (file)
@@ -68,8 +68,8 @@ int const statusbar_timer_value = 3000;
 } // namespace anon
 
 
-GuiView::GuiView(Gui & owner)
-       : QMainWindow(), LyXView(owner), commandbuffer_(0)
+GuiView::GuiView()
+       : QMainWindow(), LyXView(), commandbuffer_(0)
 {
 //     setToolButtonStyle(Qt::ToolButtonIconOnly);
 //     setIconSize(QSize(12,12));
index 43535538ff5deb17f593b84d0e80e211abd188ec..d4858a6acd0800ad21ee851419ae2a6e01691042 100644 (file)
@@ -47,7 +47,7 @@ class GuiView : public QMainWindow, public LyXView {
        Q_OBJECT
 public:
        /// create a main window of the given dimensions
-       GuiView(Gui & owner);
+       GuiView();
 
        ~GuiView();
 
index b5af539eb96d2ea80c3df8f6900c304b2066c233..5e9e4da802a522491f8b78fa81ed4e902155461b 100644 (file)
@@ -38,7 +38,6 @@
 
 #include "frontends/Alert.h"
 #include "frontends/font_metrics.h"
-#include "frontends/Gui.h"
 #include "frontends/LyXView.h"
 #include "frontends/Clipboard.h"
 #include "frontends/Painter.h"
@@ -59,7 +58,6 @@ using lyx::graphics::PreviewLoader;
 using lyx::support::ltrim;
 
 using lyx::frontend::Painter;
-using lyx::frontend::Gui;
 using lyx::frontend::Clipboard;
 
 using boost::shared_ptr;
@@ -700,8 +698,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) ?
-                       cur.bv().owner()->gui().clipboard().get() :
-                       cur.bv().owner()->gui().selection().get();
+                       theApp->clipboard().get() :
+                       theApp->selection().get();
                if (clip.empty())
                        break;
                // pass to InsertAsciiString, but
@@ -1780,7 +1778,7 @@ bool InsetTabular::copySelection(LCursor & cur)
        ostringstream os;
        OutputParams const runparams;
        paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
-       cur.bv().owner()->gui().clipboard().put(lyx::from_utf8(os.str()));
+       theApp->clipboard().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 775543a63cfcad743c5d303958cb30b62121a62b..bf374d358138ba7a65633c56a6a89a1f26620055 100644 (file)
@@ -50,7 +50,6 @@
 #include "support/lstrings.h"
 
 #include "frontends/Dialogs.h"
-#include "frontends/Gui.h"
 #include "frontends/LyXView.h"
 #include "frontends/Painter.h"
 #include "frontends/Selection.h"
@@ -64,7 +63,6 @@ using lyx::cap::cutSelection;
 using lyx::cap::replaceSelection;
 using lyx::cap::selClearOrDel;
 
-using lyx::frontend::Gui;
 using lyx::frontend::Clipboard;
 
 using std::endl;
@@ -1089,7 +1087,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(bv.owner()->gui().selection().get()), ar);
+                       asArray(lyx::to_utf8(theApp->selection().get()), ar);
 
                cur.insert(ar);
                bv.mouseSetCursor(cur);
@@ -1120,7 +1118,7 @@ void InsetMathNest::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
        //lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
 
        if (cmd.button() == mouse_button::button1) {
-               //cur.bv().owner()->gui().selection().put(cur.grabSelection());
+               //theApp->selection().put(cur.grabSelection());
                return;
        }
 
index b6d0634a3254e1f2ebfc2df5325d16111abd1ca1..823eb16eb4c92f1e1ce36bde8f711ee7d6941851 100644 (file)
@@ -48,7 +48,6 @@
 #include "pariterator.h"
 
 #include "frontends/Dialogs.h"
-#include "frontends/Gui.h"
 #include "frontends/LyXView.h"
 #include "frontends/Clipboard.h"
 #include "frontends/Selection.h"
@@ -125,7 +124,7 @@ namespace {
                if (selecting || cur.mark())
                        cur.setSelection();
                if (!cur.selection())
-                       cur.bv().owner()->gui().selection().haveSelection(false);
+                       theApp->selection().haveSelection(false);
                cur.bv().switchKeyMap();
        }
 
@@ -883,7 +882,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_CLIPBOARD_PASTE: {
                cur.clearSelection();
-               docstring const clip = bv->owner()->gui().clipboard().get();
+               docstring const clip = theApp->clipboard().get();
                if (!clip.empty()) {
                        recordUndo(cur);
                        if (cmd.argument() == "paragraph")
@@ -896,7 +895,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_PRIMARY_SELECTION_PASTE: {
                cur.clearSelection();
-               docstring const clip = bv->owner()->gui().selection().get();
+               docstring const clip = theApp->selection().get();
                if (!clip.empty()) {
                        recordUndo(cur);
                        if (cmd.argument() == "paragraph")
@@ -956,7 +955,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                        cursorEnd(cur);
                        cur.setSelection();
                        bv->cursor() = cur;
-                       bv->owner()->gui().selection().haveSelection(cur.selection());
+                       theApp->selection().haveSelection(cur.selection());
                }
                break;
 
@@ -964,7 +963,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (cmd.button() == mouse_button::button1) {
                        selectWord(cur, lyx::WHOLE_WORD_STRICT);
                        bv->cursor() = cur;
-                       bv->owner()->gui().selection().haveSelection(cur.selection());
+                       theApp->selection().haveSelection(cur.selection());
                }
                break;
 
@@ -1046,7 +1045,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
                // finish selection
                if (cmd.button() == mouse_button::button1)
-                       bv->owner()->gui().selection().haveSelection(cur.selection());
+                       theApp->selection().haveSelection(cur.selection());
 
                bv->switchKeyMap();
                bv->owner()->updateMenubar();
@@ -1067,7 +1066,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (lyxrc.auto_region_delete) {
                        if (cur.selection())
                                cutSelection(cur, false, false);
-                       bv->owner()->gui().selection().haveSelection(false);
+                       theApp->selection().haveSelection(false);
                }
 
                cur.clearSelection();