Fix long standing initialisation FIXME.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21669 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-18 22:51:58 +00:00
parent 9f26cdda31
commit 7d209e5c32
3 changed files with 33 additions and 46 deletions

View File

@ -609,7 +609,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
}
case LFUN_DIALOG_TOGGLE:
flag.setOnOff(lyx_view_->isDialogVisible(cmd.getArg(0)));
flag.setOnOff(lyx_view_?
lyx_view_->isDialogVisible(cmd.getArg(0)) : false);
// fall through to set "enable"
case LFUN_DIALOG_SHOW: {
string const name = cmd.getArg(0);
@ -695,7 +696,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
break;
case LFUN_TOOLBAR_TOGGLE: {
bool const current = lyx_view_->isToolbarVisible(cmd.getArg(0));
bool const current = lyx_view_?
lyx_view_->isToolbarVisible(cmd.getArg(0)) : false;
flag.setOnOff(current);
break;
}

View File

@ -324,7 +324,35 @@ GuiView::GuiView(int id)
// For Drag&Drop.
setAcceptDrops(true);
init();
setMinimumSize(300, 200);
// GuiToolbars *must* be initialised before GuiMenubar.
d.toolbars_ = new GuiToolbars(*this);
d.toolbars_->init();
d.menubar_ = new GuiMenubar(this, menubackend);
statusBar()->setSizeGripEnabled(true);
QObject::connect(&statusbar_timer_, SIGNAL(timeout()),
this, SLOT(clearMessage()));
d.setBackground();
if (!lyxrc.allow_geometry_session)
setGeometry(50, 50, 690, 510);
// Now take care of session management.
QSettings settings;
QString const key = "view-" + QString::number(id);
#ifdef Q_WS_X11
QPoint pos = settings.value(key + "/pos", QPoint(50, 50)).toPoint();
QSize size = settings.value(key + "/size", QSize(690, 510)).toSize();
resize(size);
move(pos);
#else
if (!restoreGeometry(settings.value(key + "/geometry").toByteArray()))
setGeometry(50, 50, 690, 510);
#endif
setIconSize(settings.value(key + "/icon_size").toSize());
}
@ -364,43 +392,6 @@ QMenu* GuiView::createPopupMenu()
}
void GuiView::init()
{
setMinimumSize(300, 200);
// GuiToolbars *must* be initialised before GuiMenubar.
d.toolbars_ = new GuiToolbars(*this);
// FIXME: GuiToolbars::init() cannot be integrated in the ctor
// because LyXFunc::getStatus() needs a properly initialized
// GuiToolbars object (for LFUN_TOOLBAR_TOGGLE).
d.toolbars_->init();
d.menubar_ = new GuiMenubar(this, menubackend);
statusBar()->setSizeGripEnabled(true);
QObject::connect(&statusbar_timer_, SIGNAL(timeout()),
this, SLOT(clearMessage()));
d.setBackground();
if (!lyxrc.allow_geometry_session)
setGeometry(50, 50, 690, 510);
// Now take care of session management.
QSettings settings;
QString const key = "view-" + QString::number(id());
#ifdef Q_WS_X11
QPoint pos = settings.value(key + "/pos", QPoint(50, 50)).toPoint();
QSize size = settings.value(key + "/size", QSize(690, 510)).toSize();
resize(size);
move(pos);
#else
if (!restoreGeometry(settings.value(key + "/geometry").toByteArray()))
setGeometry(50, 50, 690, 510);
#endif
setIconSize(settings.value(key + "/icon_size").toSize());
}
void GuiView::showEvent(QShowEvent * e)
{
LYXERR(Debug::GUI, "Passed Geometry "

View File

@ -61,12 +61,6 @@ public:
~GuiView();
/**
* This is called after the concrete view has been created.
* We have to have the toolbar and the other stuff created
* before we can populate it with this call.
*/
virtual void init();
///
virtual void close();
virtual void setFocus();