Peter Kümmel wrote: >> 1. save/restore isMaximized Qt4 done. >> 2. save/restore normalGeometry width/height instead of the exitings ones Qt4 done. >> 3. do this for qt3 as well (if apply)
Is this (see patch) the way to go, also for the other frontends?
Index: src/frontends/qt4/lyx_gui.C =================================================================== --- src/frontends/qt4/lyx_gui.C (revision 14083) +++ src/frontends/qt4/lyx_gui.C (working copy) @@ -228,12 +228,12 @@ void start(string const & batch, vector<string> const & files, - unsigned int width, unsigned int height, int posx, int posy) + unsigned int width, unsigned int height, int posx, int posy, bool isMax) { // this can't be done before because it needs the Languages object initEncodings(); - boost::shared_ptr<QtView> view_ptr(new QtView(width, height)); + boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax)); LyX::ref().addLyXView(view_ptr); QtView & view = *view_ptr.get(); Index: src/frontends/qt4/QtView.C =================================================================== --- src/frontends/qt4/QtView.C (revision 14083) +++ src/frontends/qt4/QtView.C (working copy) @@ -70,11 +70,14 @@ } // namespace anon -QtView::QtView(unsigned int width, unsigned int height) +QtView::QtView(unsigned int width, unsigned int height, bool isMax) : QMainWindow(), LyXView(), commandbuffer_(0) { resize(width, height); + if(isMax) + this->setWindowState(Qt::WindowMaximized); + mainWidget_ = this; // setToolButtonStyle(Qt::ToolButtonIconOnly); @@ -182,11 +185,12 @@ void QtView::closeEvent(QCloseEvent *) { // save windows size and position - LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width())); - LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height())); + 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")); if (lyxrc.geometry_xysaved) { - LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(x())); - LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(y())); + LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(this->normalGeometry().x())); + LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(this->normalGeometry().y())); } // trigger LFUN_LYX_QUIT instead of quit directly // since LFUN_LYX_QUIT may have more cleanup stuff Index: src/frontends/qt4/QtView.h =================================================================== --- src/frontends/qt4/QtView.h (revision 14083) +++ src/frontends/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); + QtView(unsigned int w, unsigned int h, bool isMAx); ~QtView(); void QWorkArea::update(int x, int y, int w, int h) Index: src/frontends/lyx_gui.h =================================================================== --- src/frontends/lyx_gui.h (revision 14083) +++ src/frontends/lyx_gui.h (working copy) @@ -57,7 +57,7 @@ * batch commands, and loading the given documents */ void start(std::string const & batch, std::vector<std::string> const & files, - unsigned int width, unsigned int height, int posx, int posy); + unsigned int width, unsigned int height, int posx, int posy, bool isMax); /** * Enter the main event loop (\sa LyX::exec2) Index: src/lyx_main.C =================================================================== --- src/lyx_main.C (revision 14083) +++ src/lyx_main.C (working copy) @@ -307,6 +307,7 @@ // initial geometry unsigned int width = 690; unsigned int height = 510; + bool isMax = false; // first try lyxrc if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) { width = lyxrc.geometry_width; @@ -320,6 +321,8 @@ val = session().loadSessionInfo("WindowHeight"); if (!val.empty()) height = convert<unsigned int>(val); + if (session().loadSessionInfo("WindowIsMaximized") == "yes") + isMax = true; } // if user wants to restore window position int posx = -1; @@ -332,7 +335,7 @@ if (!val.empty()) posy = convert<int>(val); } - lyx_gui::start(batch_command, files, width, height, posx, posy); + lyx_gui::start(batch_command, files, width, height, posx, posy, isMax); } else { // Something went wrong above quitLyX(false);