]> git.lyx.org Git - features.git/commitdiff
Qt3/Qt4:
authorPeter Kümmel <syntheticpp@gmx.net>
Tue, 13 Jun 2006 08:05:00 +0000 (08:05 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Tue, 13 Jun 2006 08:05:00 +0000 (08:05 +0000)
   - don't save geometry values of the maximized lyx window
   - save/restore the maximized property of the lyx window

- fix changed lyx_gui::start interface for xform and gtk

Index: frontends/gtk/lyx_gui.C
===================================================================
--- frontends/gtk/lyx_gui.C (revision 14083)
+++ frontends/gtk/lyx_gui.C (working copy)
@@ -123,7 +123,7 @@

 void lyx_gui::start(string const & batch, std::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)
 {
  boost::shared_ptr<GView> view_ptr(new GView);
  LyX::ref().addLyXView(view_ptr);
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C (revision 14083)
+++ frontends/qt3/lyx_gui.C (working copy)
@@ -222,12 +222,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: frontends/qt3/QtView.C
===================================================================
--- frontends/qt3/QtView.C (revision 14083)
+++ frontends/qt3/QtView.C (working copy)
@@ -55,10 +55,13 @@

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

  qApp->setMainWidget(this);

@@ -160,6 +163,9 @@

 void QtView::closeEvent(QCloseEvent *)
 {
+ LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
+ //don't save maximized values
+ this->showNormal();
  // save windows size and position
  LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
  LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
Index: frontends/qt3/QtView.h
===================================================================
--- frontends/qt3/QtView.h (revision 14083)
+++ frontends/qt3/QtView.h (working copy)
@@ -37,7 +37,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();

Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C (revision 14083)
+++ 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: frontends/qt4/QtView.C
===================================================================
--- frontends/qt4/QtView.C (revision 14083)
+++ 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: frontends/qt4/QtView.h
===================================================================
--- frontends/qt4/QtView.h (revision 14083)
+++ 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();

Index: frontends/xforms/lyx_gui.C
===================================================================
--- frontends/xforms/lyx_gui.C (revision 14083)
+++ frontends/xforms/lyx_gui.C (working copy)
@@ -256,7 +256,7 @@

 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)
 {
  int const geometryBitmask =
  XParseGeometry(geometry, &posx, &posy, &width, &height);
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 14083)
+++ 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: lyx_main.C
===================================================================
--- lyx_main.C (revision 14083)
+++ 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);

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14088 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gtk/lyx_gui.C
src/frontends/lyx_gui.h
src/frontends/qt3/QtView.C
src/frontends/qt3/QtView.h
src/frontends/qt3/lyx_gui.C
src/frontends/qt4/QtView.C
src/frontends/qt4/QtView.h
src/frontends/qt4/lyx_gui.C
src/frontends/xforms/lyx_gui.C
src/lyx_main.C

index c993dd4fbcc955afa768d05d26cbdd30eb820e5a..5aa788bdb0e810e37b5c59cd5f90173aa824d7a0 100644 (file)
@@ -123,7 +123,7 @@ void lyx_gui::parse_lyxrc()
 
 
 void lyx_gui::start(string const & batch, std::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)
 {
        boost::shared_ptr<GView> view_ptr(new GView);
        LyX::ref().addLyXView(view_ptr);
index e11fb99040838b9df1f192638e6a3f77c0eb0b4c..340f98d364db70e738bac560b82fd1ddb664758e 100644 (file)
@@ -57,7 +57,7 @@ void parse_lyxrc();
  * 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 e40be25734fc3d7d5047140c2906afd1942789ed..7be868cf703218b71995ae3f81d6799bcd8f501a 100644 (file)
@@ -55,10 +55,13 @@ int const statusbar_timer_value = 3000;
 
 
 
-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(WindowMaximized);
 
        qApp->setMainWidget(this);
 
@@ -160,6 +163,9 @@ bool QtView::hasFocus() const
 
 void QtView::closeEvent(QCloseEvent *)
 {
+       LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
+       //don't save maximized values
+       this->showNormal();
        // save windows size and position
        LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
        LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
index 35737fa4752ea9807272d7c05769d44d32418328..0a5f62a15dd88495460fb9c761f528497b838e4f 100644 (file)
@@ -37,7 +37,7 @@ class QtView : public QMainWindow, public LyXView {
        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();
 
index a9cd42ef72ff64e9c26f4bb54a0afc2a5dfba88e..3a56c5e46780c561667db3f9bbaf5ce137ad6047 100644 (file)
@@ -222,12 +222,12 @@ void parse_lyxrc()
 
 
 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 b6e7af0ec871441389abc577a0606187c5c89cf0..4cbf3a7a2e12d302bbde3d8181604a749a53ce4e 100644 (file)
@@ -70,11 +70,14 @@ int const statusbar_timer_value = 3000;
 } // 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 @@ bool QtView::hasFocus() const
 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 937629dd7e77122031b73dbc0ea28c81af13486a..639947dce4420fdcb1e0cee72a2c71af213ab607 100644 (file)
@@ -47,7 +47,7 @@ class QtView : public QMainWindow, public LyXView {
        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();
 
index e2ec4c306ed909185022c315289a57d2fac204ce..e5951ad3a652691556a3f127a7c27e045de507ba 100644 (file)
@@ -228,12 +228,12 @@ void parse_lyxrc()
 
 
 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 cbabd6d28d72020e503c4080d1c5e7eb5a4e808b..c6c0bfb061e988d6c7e9c089dc60cc18505b7826 100644 (file)
@@ -256,7 +256,7 @@ void parse_lyxrc()
 
 
 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)
 {
        int const geometryBitmask =
                XParseGeometry(geometry, &posx, &posy, &width, &height);
index 8df387930fff02caa33b41c5373484197b187df1..91674f147f639f54f6ae698fa014867e127aa7a0 100644 (file)
@@ -307,6 +307,7 @@ void LyX::exec2(int & argc, char * argv[])
                // 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 @@ void LyX::exec2(int & argc, char * argv[])
                        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 @@ void LyX::exec2(int & argc, char * argv[])
                        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);