From b1a328f5c036b608c80c4a248ede08c9055f66ba Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 22 Aug 2009 17:32:14 -0700 Subject: [PATCH] make xboard usable with UCI engines I made a small patch in xoptions.c (where the corresponding Engine Settings dialog was for XBoard), to make it at least usable for UCI engines: I now divide the options over upto 4 columns, if there are too many to fit into a single column. This seems to work. Still looks very ugly, but it is functional. --- xoptions.c | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/xoptions.c b/xoptions.c index b8a8a68..da6a825 100644 --- a/xoptions.c +++ b/xoptions.c @@ -1473,17 +1473,20 @@ void CreateComboPopup(parent, name, n, mb) void SettingsPopUp(ChessProgramState *cps) { Arg args[16]; - Widget popup, layout, dialog, edit, form, oldform, last, b_ok, b_cancel; + Widget popup, layout, dialog, edit, form, oldform, last, b_ok, b_cancel, leftMargin = NULL; Window root, child; - int x, y, i, j; + int x, y, i, j, height, width, h, c; int win_x, win_y; unsigned int mask; char def[80], *p, *q; + static char pane[6] = "paneX"; // to do: start up second engine if needed if(!cps->initDone || !cps->nrOptions) return; // nothing to be done currentCps = cps; + if(cps->nrOptions > 50) width = 4; else if(cps->nrOptions>24) width = 2; else width = 1; + height = cps->nrOptions / width + 1; i = 0; XtSetArg(args[i], XtNresizable, True); i++; SettingsShell = popup = @@ -1493,12 +1496,20 @@ void SettingsPopUp(ChessProgramState *cps) layout = XtCreateManagedWidget(layoutName, formWidgetClass, popup, layoutArgs, XtNumber(layoutArgs)); - + for(c=0; cnrOptions; i++) { + for(h=0; h= cps->nrOptions) break; switch(cps->option[i].type) { case Spin: sprintf(def, "%d", cps->option[i].value); @@ -1586,7 +1597,7 @@ void SettingsPopUp(ChessProgramState *cps) break; } } - + } j=0; XtSetArg(args[j], XtNfromVert, last); j++; XtSetArg(args[j], XtNbottom, XtChainBottom); j++; -- 1.7.0.4