]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/lyx_gui.C
fix crash with "save as"
[lyx.git] / src / frontends / xforms / lyx_gui.C
index 3b99c54c69e18819085ed5fde29c9a31cf7ff83f..7713c528225e2613f92bb6836ebecece61a31729 100644 (file)
@@ -1,9 +1,10 @@
 /**
- * \file lyx_gui.C
- * Read the file COPYING
+ * \file xforms/lyx_gui.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author unknown
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -72,10 +73,10 @@ float getDPI()
 {
        Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
        return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
-               (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2; 
+               (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
 }
 
+
 /// set default GUI configuration
 void setDefaults()
 {
@@ -178,7 +179,7 @@ void lyx_gui::parse_init(int & argc, char * argv[])
        Image::loadableFormats = boost::bind(&ImageXPM::loadableFormats);
 #endif
 
-       // must do this /before/ lyxrc gets read 
+       // must do this /before/ lyxrc gets read
        lyxrc.dpi = getDPI();
 }
 
@@ -238,7 +239,7 @@ void lyx_gui::parse_lyxrc()
 }
 
 
-void lyx_gui::start(string const & batch, vector<string> files)
+void lyx_gui::start(string const & batch, vector<string> const & files)
 {
        // initial geometry
        int xpos = -1;
@@ -246,19 +247,19 @@ void lyx_gui::start(string const & batch, vector<string> files)
        unsigned int width = 690;
        unsigned int height = 510;
 
-       static const int geometryBitmask =
+       int const geometryBitmask =
                XParseGeometry(geometry,
-                               &xpos, &ypos, &width, &height);
+                              &xpos, &ypos, &width, &height);
 
        // if width is not set by geometry, check it against monitor width
-       if (!(geometryBitmask & 4)) {
+       if (!(geometryBitmask & WidthValue)) {
                Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
                if (WidthOfScreen(scr) - 8 < int(width))
                        width = WidthOfScreen(scr) - 8;
        }
 
        // if height is not set by geometry, check it against monitor height
-       if (!(geometryBitmask & 8)) {
+       if (!(geometryBitmask & HeightValue)) {
                Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
                if (HeightOfScreen(scr) - 24 < int(height))
                        height = HeightOfScreen(scr) - 24;
@@ -312,8 +313,9 @@ void lyx_gui::start(string const & batch, vector<string> files)
                        XEvent ev;
                        fl_XNextEvent(&ev);
                        lyxerr << "Received unhandled X11 event" << endl;
-                       lyxerr << "Type: 0x" << hex << ev.xany.type <<
-                               " Target: 0x" << hex << ev.xany.window << dec << endl;
+                       lyxerr << "Type: " << ev.xany.type
+                              << " Target: 0x" << hex << ev.xany.window
+                              << dec << endl;
                }
        }
 
@@ -351,7 +353,7 @@ string const lyx_gui::hexname(LColor::color col)
           << setw(2) << (xcol.green / 256)
           << setw(2) << (xcol.blue  / 256);
 
-       return os.str().c_str();
+       return STRCONV(os.str());
 }