Angus Leeming wrote: > Peter_Kümmel wrote: >> Peter_Kümmel wrote: >>> I will have a look an this, and will also >>> post a 'final patch' :-) > >> Here the patch for this issue. > > Looks good. One thing that strikes me though is that > you should define a local variable > Session & session = LyX::ref().session(); > rather than waste cycles by repeatedly accessing > session(). > > Angus >
Does not the compiler optimize such code, or is this too optimistic? Peter Comitted: Index: qt4/QtView.h =================================================================== --- qt4/QtView.h (revision 14094) +++ qt4/QtView.h (working copy) @@ -47,7 +47,7 @@ Q_OBJECT public: /// create a main window of the given dimensions - QtView(unsigned int w, unsigned int h, bool maximize); + QtView(unsigned int w, unsigned int h); ~QtView(); Index: qt4/QtView.C =================================================================== --- qt4/QtView.C (revision 14094) +++ qt4/QtView.C (working copy) @@ -70,14 +70,9 @@ } // namespace anon -QtView::QtView(unsigned int width, unsigned int height, bool maximize) +QtView::QtView(unsigned int width, unsigned int height) : QMainWindow(), LyXView(), commandbuffer_(0) { - resize(width, height); - - if (maximize) - this->setWindowState(Qt::WindowMaximized); - mainWidget_ = this; // setToolButtonStyle(Qt::ToolButtonIconOnly); @@ -184,13 +179,15 @@ void QtView::closeEvent(QCloseEvent *) { + QRect geometry = normalGeometry(); + Session & session = LyX::ref().session(); // save windows size and position - LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(this->normalGeometry().width())); - LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(this->normalGeometry().height())); - LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no")); + session.saveSessionInfo("WindowWidth", convert<string>(geometry.width())); + session.saveSessionInfo("WindowHeight", convert<string>(geometry.height())); + session.saveSessionInfo("WindowIsMaximized", (isMaximized() ? "yes" : "no")); if (lyxrc.geometry_xysaved) { - LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(this->normalGeometry().x())); - LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(this->normalGeometry().y())); + session.saveSessionInfo("WindowPosX", convert<string>(geometry.x())); + session.saveSessionInfo("WindowPosY", convert<string>(geometry.y())); } // trigger LFUN_LYX_QUIT instead of quit directly // since LFUN_LYX_QUIT may have more cleanup stuff