From: H.G. Muller Date: Fri, 15 Apr 2011 20:04:03 +0000 (+0200) Subject: Fix chaining of bottom-row dialog buttons X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=eae2802c1cb4daea3526092e9f7eb61ff03ee324;p=xboard.git Fix chaining of bottom-row dialog buttons The OK & cancel buttons are chained to the bottom. This patch makes sure that other buttons appearing in the same row (as in the tags and comment dialogs) will be chained that way too, so that they will behave the same on vertical sizing. The bottom of a full-width text-edit above it will be chained to bottom too. To make this work in the tags dialog, the (optional) cmail-message field had to be put above the tags memo. --- diff --git a/xoptions.c b/xoptions.c index ab6efac..2b29bbe 100644 --- a/xoptions.c +++ b/xoptions.c @@ -1585,7 +1585,19 @@ GenericPopUp(Option *option, char *title, int dlgNr) if(!(option[i].min & 2)) { j=0; - if(option[i].min & 1) { XtSetArg(args[j], XtNfromHoriz, last); last = forelast; } else + if(option[i].min & 1) { + for(j=i-1; option[j+1].min&1 && option[j].type == Button; j--) { + XtSetArg(args[0], XtNtop, XtChainBottom); + XtSetArg(args[1], XtNbottom, XtChainBottom); + XtSetValues(option[j].handle, args, 2); + } + if(option[j].type == TextBox && option[j].name[0] == NULLCHAR) { + XtSetArg(args[0], XtNbottom, XtChainBottom); + XtSetValues(option[j].handle, args, 1); + } + j = 0; + XtSetArg(args[j], XtNfromHoriz, last); last = forelast; + } else XtSetArg(args[j], XtNfromHoriz, widest ? widest : dialog); j++; XtSetArg(args[j], XtNfromVert, anchor ? anchor : last); j++; XtSetArg(args[j], XtNbottom, XtChainBottom); j++; @@ -1862,13 +1874,13 @@ void changeTags(int n) { Arg args[16]; XtSetArg(args[0], XtNstring, &tagsText); - XtGetValues(currentOption[0].handle, args, 1); + XtGetValues(currentOption[1].handle, args, 1); ReplaceTags(tagsText, &gameInfo); } Option tagsOptions[] = { -{ 0xD, 200, 250, NULL, (void*) &tagsText, "", NULL, TextBox, "" }, { 0, 0, 0, NULL, NULL, NULL, NULL, Label, "" }, +{ 0xD, 200, 250, NULL, (void*) &tagsText, "", NULL, TextBox, "" }, { 0, 0, 0, NULL, (void*) &changeTags, NULL, NULL, Button, "save changes" }, { 0, 1, 0, NULL, (void*) &NewTagsCallback, "", NULL, EndMark , "" } }; @@ -1880,10 +1892,10 @@ void NewTagsPopup(char *text, char *msg) if(shells[2]) { // if already exists, alter title and content XtSetArg(args[0], XtNstring, text); - XtSetValues(tagsOptions[0].handle, args, 1); + XtSetValues(tagsOptions[1].handle, args, 1); } tagsText = text; - tagsOptions[1].textValue = msg; + tagsOptions[0].textValue = msg; MarkMenu("menuView.Show Tags", 2); GenericPopUp(tagsOptions, _("Tags"), 2); }