/* For the coordFont, use the 0th font of the fontset. */
XFontSet coordFontSet = CreateFontSet(appData.coordFont);
XFontStruct **font_struct_list;
+ XFontSetExtents *fontSize;
char **font_name_list;
XFontsOfFontSet(coordFontSet, &font_struct_list, &font_name_list);
coordFontID = XLoadFont(xDisplay, font_name_list[0]);
coordFontStruct = XQueryFont(xDisplay, coordFontID);
+ fontSize = XExtentsOfFontSet(fontSet); // [HGM] figure out how much vertical space font takes
+ textHeight = fontSize->max_logical_extent.height + 5; // add borderWidth
}
#else
appData.font = FindFont(appData.font, fontPxlSize);
fprintf(stderr, _("%s: messageWidget geometry error %d %d %d %d %d\n"),
programName, gres, w, h, wr, hr);
}
- textHeight = hr; // [HGM] save height for use in generic popup
/* !! end hack */
+ if(!textHeight) textHeight = hr; // [HGM] if !NLS textHeight is still undefined, and we grab it from here
XtSetArg(args[0], XtNleft, XtChainLeft); // [HGM] glue ends for good run-time sizing
XtSetArg(args[1], XtNright, XtChainRight);
XtSetValues(messageWidget, args, 2);
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-1], XtNheight, option[i].min); // overwrite
+ XtSetArg(args[j], XtNheight, option[i].min); j++;
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++; }
msg = _("browse"); w = 0;
/* automatically scale to width of text */
XtSetArg(args[j], XtNwidth, (XtArgVal) NULL ); j++;
+ if(textHeight) XtSetArg(args[j], XtNheight, textHeight), j++;
} else {
w = 20; msg = "+";
- XtSetArg(args[j], XtNheight, 10); j++;
+ XtSetArg(args[j], XtNheight, textHeight/2); j++;
XtSetArg(args[j], XtNwidth, w); j++;
}
edit = XtCreateManagedWidget(msg, commandWidgetClass, form, args, j);
j=0;
XtSetArg(args[j], XtNfromVert, edit); j++;
XtSetArg(args[j], XtNfromHoriz, last); j++;
- XtSetArg(args[j], XtNheight, 10); j++;
+ XtSetArg(args[j], XtNvertDistance, -1); j++;
+ XtSetArg(args[j], XtNheight, textHeight/2); j++;
XtSetArg(args[j], XtNwidth, 20); j++;
XtSetArg(args[j], XtNleft, XtChainRight); j++;
XtSetArg(args[j], XtNright, XtChainRight); j++;
break;
case CheckBox:
if(!currentCps) option[i].value = *(Boolean*)option[i].target;
+#if 0
j=0; // space holder
XtSetArg(args[j], XtNfromVert, last); j++;
XtSetArg(args[j], XtNwidth, 10); j++;
XtSetArg(args[j], XtNborderWidth, 0); j++;
if(textHeight < 24) dialog = last; else
dialog = XtCreateManagedWidget(" ", labelWidgetClass, form, args, j);
+#endif
j=0;
- XtSetArg(args[j], XtNfromVert, dialog); j++;
- XtSetArg(args[j], XtNwidth, 10); j++;
- XtSetArg(args[j], XtNheight, 10); j++;
+ XtSetArg(args[j], XtNfromVert, last); j++;
+ XtSetArg(args[j], XtNvertDistance, (textHeight+2)/4 + 3); j++;
+ XtSetArg(args[j], XtNwidth, textHeight/2); j++;
+ XtSetArg(args[j], XtNheight, textHeight/2); j++;
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
XtSetArg(args[j], XtNright, XtChainLeft); j++;
XtSetArg(args[j], XtNstate, option[i].value); j++;
j=0;
XtSetArg(args[j], XtNfromVert, last); j++;
XtSetArg(args[j], XtNfromHoriz, option[i].type != Label ? dialog : NULL); j++;
+ XtSetArg(args[j], XtNheight, textHeight); j++;
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
XtSetArg(args[j], XtNborderWidth, 0); j++;
XtSetArg(args[j], XtNjustify, XtJustifyLeft); j++;
XtSetArg(args[j], XtNfromHoriz, NULL); j++; lastrow = forelast;
}
XtSetArg(args[j], XtNlabel, _(option[i].name)); j++;
+ if(textHeight) XtSetArg(args[j], XtNheight, textHeight), j++;
if(option[i].max) { XtSetArg(args[j], XtNwidth, option[i].max); j++; }
if(option[i].textValue) { // special for buttons of New Variant dialog
XtSetArg(args[j], XtNsensitive, appData.noChessProgram || option[i].value < 0
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
XtSetArg(args[j], XtNmenuName, XtNewString(option[i].name)); j++;
XtSetArg(args[j], XtNlabel, _(((char**)option[i].textValue)[option[i].value])); j++;
+ if(textHeight) XtSetArg(args[j], XtNheight, textHeight), j++;
option[i].handle = (void*)
(last = XtCreateManagedWidget(" ", menuButtonWidgetClass, form, args, j));
CreateComboPopup(last, option + i, i);
XtSetArg(args[j], XtNtop, XtChainBottom); j++;
XtSetArg(args[j], XtNleft, XtChainRight); j++;
XtSetArg(args[j], XtNright, XtChainRight); j++;
+ if(textHeight) XtSetArg(args[j], XtNheight, textHeight), j++;
b_ok = XtCreateManagedWidget(_("OK"), commandWidgetClass, form, args, j);
XtAddCallback(b_ok, XtNcallback, GenericCallback, (XtPointer)(intptr_t) dlgNr + (dlgNr<<16));