more geometry stuff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@861 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-07-05 20:16:38 +00:00
parent 666140b7f2
commit 85c4362f57
3 changed files with 35 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2000-07-05 R. Lahaye <lahaye@postech.ac.kr>
* src/lyx_gui.C src/lyx_main.C: improve the -geometry support,
handle neg values, set min width to 590, add doc about -display
2000-07-05 Juergen Vigna <jug@sad.it>
* src/insets/lyxinset.h: changed Painter & in ascent(), descent()

View File

@ -91,7 +91,7 @@ bool cursor_follows_scrollbar;
FL_resource res[] =
{
{"geometry", "geometryClass", FL_STRING, geometry, "690x510", 40}
{"geometry", "geometryClass", FL_STRING, geometry, "", 40}
};
@ -125,7 +125,12 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
fl_initialize(argc, argv, "LyX", cmdopt, num_res);
fl_get_app_resources(res, num_res);
XParseGeometry(geometry, &xpos, &ypos, (unsigned int *) &width, (unsigned int *) &height);
static const int geometryBitmask = XParseGeometry( geometry,
&xpos,
&ypos,
(unsigned int *) &width,
(unsigned int *) &height
);
Display * display = fl_get_display();
if (!display) {
@ -136,15 +141,31 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
// X Error handler install goes here
XSetErrorHandler(LyX_XErrHandler);
// Make sure default screen is not larger than monitor
if (width == 690 && height == 510) {
// A width less than 590 pops up an awkward main window
if (width < 590) width = 590;
// If width is not set by geometry, check it against monitor width
if ( !(geometryBitmask & 4) ) {
Screen * scr = DefaultScreenOfDisplay(fl_get_display());
if (HeightOfScreen(scr) - 24 < height)
height = HeightOfScreen(scr) - 24;
if (WidthOfScreen(scr) - 8 < width)
width = WidthOfScreen(scr) - 8;
}
// If height is not set by geometry, check it against monitor height
if ( !(geometryBitmask & 8) ) {
Screen * scr = DefaultScreenOfDisplay(fl_get_display());
if (HeightOfScreen(scr) - 24 < height)
height = HeightOfScreen(scr) - 24;
}
// Recalculate xpos if it's negative
if (geometryBitmask & 16)
xpos += WidthOfScreen(DefaultScreenOfDisplay(fl_get_display())) - width;
// Recalculate ypos if it's negative
if (geometryBitmask & 32)
ypos += HeightOfScreen(DefaultScreenOfDisplay(fl_get_display())) - height;
// Initialize the LyXColorHandler
lyxColorHandler = new LyXColorHandler;
}

View File

@ -594,7 +594,8 @@ void commandLineHelp()
"\t-help summarize LyX usage\n"
"\t-userdir dir try to set user directory to dir\n"
"\t-sysdir dir try to set system directory to dir\n"
"\t-geometry WxH+X+Y set the width of the main window\n"
"\t-display display use display as DISPLAY\n"
"\t-geometry WxH+X+Y set geometry of the main window\n"
"\t-dbg feature[,feature]...\n"
" select the features to debug.\n"
" Type `lyx -dbg' to see the list of features\n"