Peter Kümmel wrote:
Enrico Forestieri wrote:
On Wed, Nov 29, 2006 at 01:17:44PM +0100, Peter Kümmel wrote:
Enrico Forestieri wrote:
On Wed, Nov 29, 2006 at 10:10:08AM -0000, [EMAIL PROTECTED] wrote:
Author: kuemmel
Date: Wed Nov 29 11:10:07 2006
New Revision: 16101

URL: http://www.lyx.org/trac/changeset/16101
Log:
Windows doesn't support the geometry option
[...]
+* The -geometry option doesn't work on Windows (it did in 1.4.x)
+  c:\> lyx-qt4.exe -geometry 800x600+100+30
+  Wrong command line option `-geometry'. Exiting.
+  REJECTED (Peter, 2006-11-29)
Too bad. Seems that I have to try to port Qt4 to Cygwin/X11. It is a
pity, as I liked the appearance of the Qt4 native GUI port, but you
know, there must be something under the dress...

It should me more easy to add the -geometry option to the Windows
version of LyX. ;)
I am not so sure, but yes, now that I know it is a Qt4 limitation I
could try to implement it. After all, I don't want that you make the
work for me ;-)

But I have done. ;-)

(The GuiView code is from the qt3 port.)

Index: src/frontends/qt4/GuiView.C
===================================================================
--- src/frontends/qt4/GuiView.C (Revision 16102)
+++ src/frontends/qt4/GuiView.C (Arbeitskopie)
@@ -244,7 +244,8 @@
                                                                  unsigned int 
height,
                                                                  int posx, int 
posy,
                                                                  bool maximize,
-                                                                 unsigned int 
iconSizeXY)
+                                                                 unsigned int 
iconSizeXY,
+                                                                 const std::string 
& geometryArg)
 {
        // use last value (not at startup)
        if (d.lastIconSize != 0)
@@ -278,6 +279,20 @@
                if (maximize)
                        setWindowState(Qt::WindowMaximized);
        }
+       else
+       {
+#ifdef Q_OS_WIN
+               int x, y;
+               int w, h;
+               QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ 
]*(?:([+-][0-9]*)([+-][0-9]*)){0,1}" );
+               re.indexIn( toqstr(geometryArg.c_str()));
+               w = re.cap( 1 ).toInt();
+               h = re.cap( 2 ).toInt();
+               x = re.cap( 3 ).toInt();
+               y = re.cap( 4 ).toInt();
+               QWidget::setGeometry( x, y, w, h );
+#endif
+       }

Couldn't you do that parsing in parse_geometry() instead and overwrite width and height?

The rest looks good to me.

Abdel.


Reply via email to