Move init() back to LyXView

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4379 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-06-12 11:34:13 +00:00
parent 021ad027a9
commit 1ff9cadb81
9 changed files with 86 additions and 75 deletions

View File

@ -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

View File

@ -1,3 +1,8 @@
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* lyxfunc.C:
* BufferView_pimpl.C: view->resize() change
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* BufferView_pimpl.C: topCursorVisible

View File

@ -1,3 +1,9 @@
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* LyXView.h: cleanup
* LyXView.C: move init() here from xforms/
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* screen.h:

View File

@ -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());
}
}

View File

@ -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;
/// start modal operation
virtual void prohibitInput() const = 0;
/// end modal operation
virtual void allowInput() const = 0;
///
//@{ generic accessor functions
/// return the current buffer view
BufferView * view() const;
/// return the LyX function handler for this view
LyXFunc * getLyXFunc() const;
/// return the buffer currently shown in this window
Buffer * buffer() const;
/// return the toolbar for this view
Toolbar * getToolbar() const;
/// sets the layout in the toolbar layout combox
void setLayout(string const & layout);
/// update the toolbar
void updateToolbar();
/// return a pointer to the lyxfunc
LyXFunc * getLyXFunc() const;
/// return a pointer to the minibuffer
MiniBuffer * getMiniBuffer() const;
///
void message(string const &);
///
void messagePush(string const & str);
///
void messagePop();
/// 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
/// update the toolbar
void updateToolbar();
/// update the menubar
void updateMenubar();
/// 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();
/// Show state (toolbar and font in minibuffer)
void showState();
/// 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> bufferview_;
@ -133,7 +136,7 @@ protected:
boost::scoped_ptr<Timeout> autosave_timeout_;
/// called on timeout
void AutoSave();
void autoSave();
/// FIXME: GUII - toolbar property
void invalidateLayoutChoice();

View File

@ -1,3 +1,8 @@
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* XFormsView.h:
* XFormsView.C: move init() back to LyXView
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* GUIRunTime.C: remove in favour of ...

View File

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

View File

@ -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.

View File

@ -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.