From: H.G. Muller Date: Fri, 10 Feb 2012 13:55:48 +0000 (+0100) Subject: Derive height of text-edits in dialogs from message widget X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=580c6c9071703cf3a3923d091c92132f9cf8980a;p=xboard.git Derive height of text-edits in dialogs from message widget With internationalization the default height of buttons has inexpliquably inreased compared to that of text-edits, messing up the layout of the GenericPopUp. The message widget is now used as a emasure of how high the widgets should be. --- diff --git a/xboard.c b/xboard.c index def15d8..311d7f1 100644 --- a/xboard.c +++ b/xboard.c @@ -540,6 +540,7 @@ int squareSize, smallLayout = 0, tinyLayout = 0, ICSInputBoxUp = False, askQuestionUp = False, filenameUp = False, promotionUp = False, pmFromX = -1, pmFromY = -1, errorUp = False, errorExitStatus = -1, lineGap, defaultLineGap; +Dimension textHeight; Pixel timerForegroundPixel, timerBackgroundPixel; Pixel buttonForegroundPixel, buttonBackgroundPixel; char *chessDir, *programName, *programVersion, @@ -2314,6 +2315,8 @@ XBoard square size (hint): %d\n\ XtSetArg(args[0], XtNtop, XtChainTop); XtSetArg(args[1], XtNbottom, XtChainTop); XtSetValues(messageWidget, args, 2); + XtSetArg(args[0], XtNheight, &textHeight); // [HGM] get height for use in generic popup + XtGetValues(messageWidget, args, 1); widgetList[j++] = boardWidget = XtCreateWidget("board", widgetClass, formWidget, boardArgs, diff --git a/xboard.h b/xboard.h index 24b72c3..48ce476 100644 --- a/xboard.h +++ b/xboard.h @@ -169,6 +169,7 @@ extern char *icsTextMenuString; extern char ICSInputTranslations[]; extern char *selected_fen_position; extern GC coordGC; +extern Dimension textHeight; // of message widget in board window #define TOPLEVEL 1 /* preference item; 1 = make popup windows toplevel */ diff --git a/xoptions.c b/xoptions.c index d3e2462..a21d487 100644 --- a/xoptions.c +++ b/xoptions.c @@ -1095,8 +1095,9 @@ GenericPopUp (Option *option, char *title, int dlgNr) XtSetArg(args[j], XtNfromHoriz, dialog); j++; XtSetArg(args[j], XtNborderWidth, 1); j++; XtSetArg(args[j], XtNwidth, w); j++; + XtSetArg(args[j], XtNheight, textHeight); j++; // [HGM] use message widget if(option[i].type == TextBox && option[i].min) { - XtSetArg(args[j], XtNheight, option[i].min); j++; + XtSetArg(args[j-1], XtNheight, option[i].min); // overwrite if(option[i].value & 1) { XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways); j++; } if(option[i].value & 2) { XtSetArg(args[j], XtNscrollHorizontal, XawtextScrollAlways); j++; } if(option[i].value & 4) { XtSetArg(args[j], XtNautoFill, True); j++; }