diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 5b96f93a46..ca9428fc26 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -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; } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 958160350d..cd2c26570e 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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 " diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 626a763db4..819d2c82b6 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -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();