From: John Levon Date: Wed, 12 Jun 2002 11:34:13 +0000 (+0000) Subject: Move init() back to LyXView X-Git-Tag: 1.6.10~19099 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1ff9cadb81d675f3192315600fd949e7927a64d6;hp=021ad027a9d378b5d6e2e78ed768428867e1f7a8;p=lyx.git Move init() back to LyXView git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4379 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 771836d9e6..d533d1f7cf 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -1032,7 +1032,7 @@ void BufferView::Pimpl::workAreaExpose() if (buffer_ != 0) { if (widthChange) { // The visible LyXView need a resize - owner_->resize(); + owner_->view()->resize(); // Remove all texts from the textcache // This is not _really_ what we want to do. What diff --git a/src/ChangeLog b/src/ChangeLog index fd8b28ed9f..da46358d14 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-06-12 John Levon + + * lyxfunc.C: + * BufferView_pimpl.C: view->resize() change + 2002-06-12 John Levon * BufferView_pimpl.C: topCursorVisible diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index b0bede0952..48999a7289 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,9 @@ +2002-06-12 John Levon + + * LyXView.h: cleanup + + * LyXView.C: move init() here from xforms/ + 2002-06-12 John Levon * screen.h: diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index 3db1cfa3a8..d8c4ee1539 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -42,9 +42,6 @@ using std::endl; -extern void AutoSave(BufferView *); -extern void QuitLyX(); - string current_layout; @@ -59,7 +56,6 @@ LyXView::LyXView() autosave_timeout_.reset(new Timeout(5000)); dialogs_.reset(new Dialogs(this)); - Dialogs::redrawGUI.connect(boost::bind(&LyXView::redraw, this)); } @@ -68,9 +64,20 @@ LyXView::~LyXView() } -void LyXView::resize() +void LyXView::init() { - view()->resize(); + // Set the textclass choice + invalidateLayoutChoice(); + updateLayoutChoice(); + updateMenubar(); + + // Start autosave timer + if (lyxrc.autosave) { + autosave_timeout_->setTimeout(lyxrc.autosave * 1000); + autosave_timeout_->start(); + } + + intl_->InitKeyMapper(lyxrc.use_kbmap); } @@ -158,11 +165,13 @@ Intl * LyXView::getIntl() const } -void LyXView::AutoSave() +void LyXView::autoSave() { - lyxerr[Debug::INFO] << "Running AutoSave()" << endl; - if (view()->available()) + lyxerr[Debug::INFO] << "Running autoSave()" << endl; + + if (view()->available()) { ::AutoSave(view()); + } } diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index de5305c610..bf8388a3a4 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -50,71 +50,74 @@ class Timeout; */ class LyXView : public boost::signals::trackable, boost::noncopyable { public: - /// + LyXView(); - /// + virtual ~LyXView(); - /// Redraw the main form. - virtual void redraw() = 0; - /// Resize all BufferViews in this LyXView (because the width changed) - void resize(); + /// FIXME: what is the requirement for this be to separate from the ctor ? + void init(); - /// returns the buffer currently shown in the main form. - Buffer * buffer() const; - - /// - BufferView * view() const; + /// start modal operation + virtual void prohibitInput() const = 0; + /// end modal operation + virtual void allowInput() const = 0; - /// return the toolbar for this view - Toolbar * getToolbar() const; + //@{ generic accessor functions - /// sets the layout in the toolbar layout combox - void setLayout(string const & layout); - /// update the toolbar - void updateToolbar(); + /// return the current buffer view + BufferView * view() const; - /// return a pointer to the lyxfunc + /// return the LyX function handler for this view LyXFunc * getLyXFunc() const; - /// return a pointer to the minibuffer - MiniBuffer * getMiniBuffer() const; + /// return the buffer currently shown in this window + Buffer * buffer() const; - /// - void message(string const &); - /// - void messagePush(string const & str); - /// - void messagePop(); + /// return the toolbar for this view + Toolbar * getToolbar() const; /// return the menubar for this view Menubar * getMenubar() const; - /// - void updateMenubar(); - - /// - Intl * getIntl() const; + /// return the minibuffer for this view + /// FIXME: I'm not at all sure that LyXFunc should be + /// aware of a mini buffer as such + MiniBuffer * getMiniBuffer() const; /// get access to the dialogs Dialogs * getDialogs() { return dialogs_.get(); } - /// + /// get this view's keyboard map handler + Intl * getIntl() const; + + //@} + + /// sets the layout in the toolbar layout selection + void setLayout(string const & layout); + /// updates the possible layouts selectable void updateLayoutChoice(); - /// Updates the title of the window - void updateWindowTitle(); + /// update the toolbar + void updateToolbar(); + /// update the menubar + void updateMenubar(); - /// Show state (toolbar and font in minibuffer) + /// display a message in the view + void message(string const &); + /// push a message onto the history, and show it + void messagePush(string const & str); + /// pop the last message pushed + void messagePop(); + /// show state (font etc.) in minibuffer void showState(); + + /// updates the title of the window + void updateWindowTitle(); - /// Reset autosave timer + /// reset autosave timer void resetAutosaveTimer(); - /// - virtual void prohibitInput() const = 0; - /// - virtual void allowInput() const = 0; - + protected: /// view of a buffer. Eventually there will be several. boost::scoped_ptr bufferview_; @@ -133,7 +136,7 @@ protected: boost::scoped_ptr autosave_timeout_; /// called on timeout - void AutoSave(); + void autoSave(); /// FIXME: GUII - toolbar property void invalidateLayoutChoice(); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index c4ee4fa018..9d20badd5a 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2002-06-12 John Levon + + * XFormsView.h: + * XFormsView.C: move init() back to LyXView + 2002-06-12 John Levon * GUIRunTime.C: remove in favour of ... diff --git a/src/frontends/xforms/XFormsView.C b/src/frontends/xforms/XFormsView.C index a3f341aebc..057e2626ee 100644 --- a/src/frontends/xforms/XFormsView.C +++ b/src/frontends/xforms/XFormsView.C @@ -26,6 +26,7 @@ #include "frontends/Toolbar.h" #include "frontends/Menubar.h" #include "frontends/Timeout.h" +#include "frontends/Dialogs.h" #include "MenuBackend.h" #include "ToolbarDefaults.h" #include "lyxfunc.h" @@ -65,6 +66,7 @@ XFormsView::XFormsView(int width, int height) // Make sure the buttons are disabled if needed. updateToolbar(); + Dialogs::redrawGUI.connect(boost::bind(&XFormsView::redraw, this)); } @@ -151,7 +153,7 @@ void XFormsView::create_form_form_main(int width, int height) width - (2 * air), 25)); // FIXME: why do this in xforms/ ? - autosave_timeout_->timeout.connect(boost::bind(&XFormsView::AutoSave, this)); + autosave_timeout_->timeout.connect(boost::bind(&XFormsView::autoSave, this)); // assign an icon to main form string iconname = LibFileSearch("images", "lyx", "xpm"); @@ -178,23 +180,6 @@ void XFormsView::create_form_form_main(int width, int height) } -void XFormsView::init() -{ - // Set the textclass choice - invalidateLayoutChoice(); - updateLayoutChoice(); - updateMenubar(); - - // Start autosave timer - if (lyxrc.autosave) { - autosave_timeout_->setTimeout(lyxrc.autosave * 1000); - autosave_timeout_->start(); - } - - intl_->InitKeyMapper(lyxrc.use_kbmap); -} - - void XFormsView::setWindowTitle(string const & title, string const & icon_title) { fl_set_form_title(getForm(), title.c_str()); diff --git a/src/frontends/xforms/XFormsView.h b/src/frontends/xforms/XFormsView.h index cfa8db5ca1..cd2d8877ea 100644 --- a/src/frontends/xforms/XFormsView.h +++ b/src/frontends/xforms/XFormsView.h @@ -40,8 +40,6 @@ public: */ void show(int xpos, int ypos, string const & t = string("LyX")); - /// init (should probably be removed later) (Lgb) - virtual void init(); /// get the xforms main form FL_FORM * getForm() const; /// redraw the main form. diff --git a/src/lyxfunc.C b/src/lyxfunc.C index a5092c2643..26a1b6aae3 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1614,7 +1614,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) // Of course we should only do the resize and the textcache.clear // if values really changed...but not very important right now. (Lgb) // All visible buffers will need resize - owner->resize(); + owner->view()->resize(); // We also need to empty the textcache so that // the buffer will be formatted correctly after // a zoom change.