]> git.lyx.org Git - features.git/commitdiff
Pass LyxView & to the WorkArea.
authorAngus Leeming <leeming@lyx.org>
Wed, 28 Apr 2004 11:33:27 +0000 (11:33 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 28 Apr 2004 11:33:27 +0000 (11:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8703 a592a061-630c-0410-9148-cb99ea01b6c8

17 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/frontends/WorkAreaFactory.h
src/frontends/gtk/ChangeLog
src/frontends/gtk/GView.C
src/frontends/gtk/GView.h
src/frontends/gtk/GWorkArea.C
src/frontends/gtk/GWorkArea.h
src/frontends/gtk/WorkAreaFactory.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/QWorkArea.C
src/frontends/qt2/QWorkArea.h
src/frontends/qt2/WorkAreaFactory.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/WorkAreaFactory.C
src/frontends/xforms/XWorkArea.C
src/frontends/xforms/XWorkArea.h

index 8144d511db9e24e0b42bd82ad1f4d0b78a362095..f9adcc0cf26672bc67f1e181e3539f19d8bbaa7d 100644 (file)
@@ -121,7 +121,7 @@ BufferView::Pimpl::Pimpl(BufferView & bv, LyXView * owner,
 {
        xsel_cache_.set = false;
 
-       workarea_.reset(WorkAreaFactory::create(xpos, ypos, width, height));
+       workarea_.reset(WorkAreaFactory::create(*owner_, xpos, ypos, width, height));
        screen_.reset(LyXScreenFactory::create(workarea()));
 
        // Setup the signals
index b65a681ce6d3ec407e75129e5940d9205edb41b0..eed92477a0be036542e5198cda07371abfcf03d3 100644 (file)
@@ -1,3 +1,7 @@
+2004-04-28  Angus Leeming  <leeming@lyx.org>
+
+       * BufferView_pimpl.C (c-tor): pass LyXView & to WorkArea generator.
+
 2004-04-26  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * LaTeXFeatures.C, lyx_sty.[Ch]: add \lyxdot macro
index ea08b70839d69c6141a14483d42e8a8cb368b0ae..12d8d76ae9e7355e7045f8764dea6217e6042424 100644 (file)
 #define WORKAREAFACTORY_H
 
 class WorkArea;
+class LyXView;
 
 namespace WorkAreaFactory {
        /**
         * Make a work area. Used because we want to generate
         * a toolkit-specific instance.
         */
-       WorkArea * create(int x, int y, int w, int h);
+       WorkArea * create(LyXView & owner, int x, int y, int w, int h);
 }
 
 #endif // WORKAREA_FACTORY_H
index a57c88b2a32ca7da30c57ed904e0e1fa068306a2..69113690cba4580f3f067a47fe52438a9f8246ac 100644 (file)
@@ -1,3 +1,12 @@
+2004-04-28  Angus Leeming  <leeming@lyx.org>
+
+       * WorkAreaFactory.C (create): pass a LyXView & to GWorkArea c-tor.
+
+       * GWorkArea.[Ch] (c-tor): now receives a LyXView &. Use it instead
+       of GView::instance.
+
+       * GView.[Ch] (instance): removed.
+
 2004-04-27  Angus Leeming  <leeming@lyx.org>
 
        * GView.[Ch]: split the window into 'top', 'left', 'center',
index 5592bf94d730091497c2555a66bf972b828f4291..b9b22248a147fb20f2fd568f8b375df80869387a 100644 (file)
 using std::string;
 
 
-BufferView * current_view;
-
-GView * GView::view_ = 0;
-
-
 namespace {
 
 void add_el(Gtk::Box::BoxList & list, Gtk::Box & box, bool shrink)
@@ -49,8 +44,6 @@ void add_el(Gtk::Box::BoxList & list, Gtk::Box & box, bool shrink)
 
 GView::GView()
 {
-       view_ = this;
-
        // The physical store for the boxes making up the layout.
        box_store_.push_back(boost::shared_ptr<Gtk::Box>(new Gtk::VBox));
        box_store_.push_back(boost::shared_ptr<Gtk::Box>(new Gtk::HBox));
@@ -91,7 +84,6 @@ GView::GView()
        toolbar_.reset(new GToolbar(this, 0, 0));
        toolbar_->init();
        bufferview_.reset(new BufferView(this, 0, 0, 300, 300));
-       ::current_view = bufferview_.get();
        minibuffer_.reset(new GMiniBuffer(this, *controlcommand_));
 
        focus_command_buffer.connect(
index a5b238bf70de5b2076c445b0bbcdb8fa90692aff..d04a0ab3297ce502ecb494f80d7f4ff2326e72d6 100644 (file)
@@ -42,7 +42,6 @@ public:
        void focusWorkArea() { workArea_->grab_focus(); }
        void setGWorkArea(Gtk::Widget * w) { workArea_ = w; }
 
-       static GView * instance() { return view_; }
        /// show busy cursor
        virtual void busy(bool) const;
        /// clear any temporary message and replace with current status
@@ -51,7 +50,6 @@ private:
        void showViewState();
        bool onFocusIn(GdkEventFocus * event);
        virtual void setWindowTitle(std::string const & t, std::string const & it);
-       static GView * view_;
 
        // The top-most box containing all other boxes.
        Gtk::VBox top_box_;
index 42ba3bd2efa8e45dd2a45697a7ae293bfeb56e6c..4af3c5964657cb1b4121adcd75a5e8ae5e61f61e 100644 (file)
@@ -149,7 +149,7 @@ void inputCommitRelay(GtkIMContext */*imcontext*/, gchar * str, GWorkArea * area
 }
 
 
-GWorkArea::GWorkArea(int width, int height)
+GWorkArea::GWorkArea(LyXView & owner, int width, int height)
        : workAreaPixmap_(0), painter_(*this), draw_(0), colorHandler_(*this)
 {
        workArea_.set_size_request(width, height);
@@ -178,13 +178,14 @@ GWorkArea::GWorkArea(int width, int height)
                Gtk::Box_Helpers::Element(vscrollbar_,Gtk::PACK_SHRINK));
        hbox_.show();
 
-       GView::instance()->getBox(GView::Center).children().push_back(
+       GView & gview = static_cast<GView &>(owner);
+       gview.getBox(GView::Center).children().push_back(
                Gtk::Box_Helpers::Element(hbox_));
 
        workArea_.set_flags(workArea_.get_flags() | Gtk::CAN_DEFAULT |
                            Gtk::CAN_FOCUS);
        workArea_.grab_default();
-       GView::instance()->setGWorkArea(&workArea_);
+       gview.setGWorkArea(&workArea_);
        imContext_ = GTK_IM_CONTEXT(gtk_im_multicontext_new());
        g_signal_connect(G_OBJECT(imContext_), "commit",
                         G_CALLBACK(&inputCommitRelay),
index a2182329d000aaa3e656b39bd540a07a4d4a17f6..14fe4e8211383c7334eae6a04701dd326bbe3c77 100644 (file)
@@ -21,6 +21,7 @@
 #include <X11/Xft/Xft.h>
 
 class LColor_color;
+class LyXView;
 
 class ColorCache
 {
@@ -56,7 +57,7 @@ private:
 class GWorkArea : public WorkArea, public SigC::Object
 {
 public:
-       GWorkArea(int width, int height);
+       GWorkArea(LyXView & owner, int width, int height);
        ~GWorkArea();
 
        virtual Painter & getPainter();
index 39921c930d62cbcfb2d1d744ca82c682d55b60ce..7d8dcc18e3a1b3c7bc9b52d9f64619eaf7dcf881 100644 (file)
@@ -19,9 +19,9 @@
 namespace WorkAreaFactory {
 
 
-WorkArea * create(int /*x*/, int /*y*/, int w, int h)
+WorkArea * create(LyXView & owner, int /*x*/, int /*y*/, int w, int h)
 {
-       return new GWorkArea(w, h);
+       return new GWorkArea(owner, w, h);
 }
 
 
index 014a0556d59374a391d2c0d2defdab3d2e1833cc..0b5055eb707b66ba432d37c7d5833c51b6d0be02 100644 (file)
@@ -1,3 +1,9 @@
+2004-04-28  Angus Leeming  <leeming@lyx.org>
+
+       * WorkAreaFactory.C (create): pass a LyXView & to QWorkArea c-tor.
+
+       * QWorkArea.[Ch] (c-tor): now receives a LyXView &.
+
 2004-04-21  John Levon  <levon@movementarian.org>
 
        * QLToolbar.C: use GUI name for tooltip
index 8070c266c3395d6834f1e9e7222cdf46bc31d4a4..4426ca1f32fbb5c9ef2f4c5431aa026ef9d3de3f 100644 (file)
@@ -39,7 +39,7 @@ namespace {
 QWorkArea const * wa_ptr = 0;
 }
 
-QWorkArea::QWorkArea(int, int, int, int)
+QWorkArea::QWorkArea(LyXView &, int, int, int, int)
        : WorkArea(), QWidget(qApp->mainWidget()), painter_(*this)
 {
        scrollbar_ = new QScrollBar(QScrollBar::Vertical, this);
index b0c2c44664d468dce160e353fba754f390211d3c..3f241c20ba1bc808173b865cb8c08f962fce3ff7 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <qscrollbar.h>
 
+class LyXView;
 class QPixmap;
 class QWidget;
 
@@ -34,7 +35,7 @@ class QWorkArea : public WorkArea, public QWidget {
 public:
        friend class QContentPane;
 
-       QWorkArea(int x, int y, int w, int h);
+       QWorkArea(LyXView & owner, int x, int y, int w, int h);
 
        virtual ~QWorkArea();
        /// return this widget's painter
index cc86dc237ae1b39003551e194ee4a19ace9f29ff..477e5eae53cd1fcf79cb8aee815ccb1d5c42b454 100644 (file)
@@ -15,9 +15,9 @@
 
 namespace WorkAreaFactory {
 
-WorkArea * create(int x, int y, int w, int h)
+WorkArea * create(LyXView & owner, int x, int y, int w, int h)
 {
-       return new QWorkArea(x, y, w, h);
+       return new QWorkArea(owner, x, y, w, h);
 }
 
 } // namespace WorkAreaFactory
index 72ed677d35ce05c3c46fcb9c7f77f56c34f3f183..80771c5d13899a0bc11efff62deb2101abbd1f46 100644 (file)
@@ -1,3 +1,9 @@
+2004-04-28  Angus Leeming  <leeming@lyx.org>
+
+       * WorkAreaFactory.C (create): pass a LyXView & to QWorkArea c-tor.
+
+       * XWorkArea.[Ch] (c-tor): now receives a LyXView &.
+
 2004-04-28  Angus Leeming  <leeming@lyx.org>
 
        * combox.c (combox_handle): reset the x,y data for the sub-objects
index 4f194df64f814c19a6cafea1377834d1074a9841..49513a13ad94a7f60e05f4d7b12b033899177fc8 100644 (file)
@@ -16,9 +16,9 @@
 
 namespace WorkAreaFactory {
 
-WorkArea * create(int x, int y, int w, int h)
+WorkArea * create(LyXView & owner, int x, int y, int w, int h)
 {
-       return new XWorkArea(x, y, w, h);
+       return new XWorkArea(owner, x, y, w, h);
 }
 
 }
index 379e1d82e8fa6e202530174e69d3919193b4b71f..444e53211189a7b31d764c5ad18addd8938bdb6e 100644 (file)
@@ -96,7 +96,7 @@ int C_event_cb(FL_FORM * form, void * xev)
 } // namespace anon
 
 
-XWorkArea::XWorkArea(int x, int y, int w, int h)
+XWorkArea::XWorkArea(LyXView & owner, int x, int y, int w, int h)
        : workareapixmap(0), painter_(*this)
 {
        if (lyxerr.debugging(Debug::WORKAREA)) {
index b1337d8a09f30ca0291c18d8e35d4de76b371fc4..9afc1ba5c776c6843926de5b6e4a371e0a2a0380 100644 (file)
 
 #include "lyx_forms.h"
 
+class LyXView;
 
 ///
 class XWorkArea : public WorkArea {
 public:
        ///
-       XWorkArea(int xpos, int ypos, int width, int height);
+       XWorkArea(LyXView & owner, int xpos, int ypos, int width, int height);
        ///
        ~XWorkArea();
        ///