]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/lyx_gui.C
rename LFUN enum values according to their command (as used in th minibuffer/bind...
[lyx.git] / src / frontends / qt4 / lyx_gui.C
index 60084c5ffc0a9a617a4580366b3f81148c878321..eceb39eec088a37a4c0773f1a960aa84576709a3 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file qt2/lyx_gui.C
+ * \file qt4/lyx_gui.C
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
 #include "lyxrc.h"
 #include "lyxserver.h"
 #include "lyxsocket.h"
+#include "session.h"
 
 #include "graphics/LoaderQueue.h"
 
 #include "support/lstrings.h"
+#include "support/convert.h"
 #include "support/os.h"
 #include "support/package.h"
 #include "debug.h"
@@ -218,11 +220,37 @@ void start(string const & batch, vector<string> const & files)
        // initial geometry
        unsigned int width = 690;
        unsigned int height = 510;
+       // first try lyxrc
+       if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
+               width = lyxrc.geometry_width;
+               height = lyxrc.geometry_height;
+       }
+       // if lyxrc returns (0,0), then use session info
+       else {
+               string val = LyX::ref().session().loadSessionInfo("WindowWidth");
+               if (val != "")
+                       width = convert<unsigned int>(val);
+               val = LyX::ref().session().loadSessionInfo("WindowHeight");
+               if (val != "")
+                       height = convert<unsigned int>(val);
+       }
 
        boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
        LyX::ref().addLyXView(view_ptr);
 
        QtView & view = *view_ptr.get();
+
+       // if user wants to restore window position
+       if (lyxrc.geometry_xysaved) {
+               QPoint p = view.pos();
+               string val = LyX::ref().session().loadSessionInfo("WindowPosX");
+               if (val != "")
+                       p.setX(convert<unsigned int>(val));
+               val = LyX::ref().session().loadSessionInfo("WindowPosY");
+               if (val != "")
+                       p.setY(convert<unsigned int>(val));
+               view.move(p);
+       }
        view.show();
        view.init();
 
@@ -284,7 +312,7 @@ FuncStatus getStatus(FuncRequest const & ev)
                if (ev.argument == "preamble")
                        flag.unknown(true);
                break;
-       case LFUN_TOOLTIPS_TOGGLE:
+       case LFUN_TOGGLE_TOOLTIPS:
                flag.unknown(true);
                break;
        default: