Pass LyxView & to the WorkArea.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8703 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2004-04-28 11:33:27 +00:00
parent d68ec28906
commit dd01380a27
17 changed files with 46 additions and 26 deletions

View 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

View 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

View File

@ -13,13 +13,14 @@
#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

View 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',

View File

@ -30,11 +30,6 @@
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(

View 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_;

View 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),

View 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();

View 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);
}

View 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

View 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);

View 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

View 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

View 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

View 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);
}
}

View 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)) {

View File

@ -18,12 +18,13 @@
#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();
///