From: H.G. Muller <h.g.muller@hccnet.nl>
Date: Mon, 16 Apr 2012 18:27:08 +0000 (+0200)
Subject: Allow chaining of single-line text-edits to top
X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=1383f5acee09efd2d21ac20bb47fbc15b475ecd5;p=xboard.git

Allow chaining of single-line text-edits to top

For the benefit of the chat window, a text-edit plus leading description
can now also be chained to the top edge of a dialog. The chaining of the
(degenerate) multi-line ICS Input Box and Move Type-In was entirely to the
bottom, which has now been corrected.
---

diff --git a/dialogs.c b/dialogs.c
index 47efff8..89cd822 100644
--- a/dialogs.c
+++ b/dialogs.c
@@ -1066,8 +1066,8 @@ NextInHistory ()
 // end of borrowed code
 
 Option boxOptions[] = {
-{  30,  0,  400, NULL, (void*) &icsText, "", NULL, TextBox, "" },
-{  0,SAME_ROW | NO_OK, 0, NULL, NULL, "", NULL, EndMark , "" }
+{  30, T_TOP, 400, NULL, (void*) &icsText, "", NULL, TextBox, "" },
+{  0,  NO_OK,   0, NULL, NULL, "", NULL, EndMark , "" }
 };
 
 void
@@ -1134,8 +1134,8 @@ IcsInputBoxProc ()
 static int TypeInOK P((int n));
 
 Option typeOptions[] = {
-{ 30,  0,            400, NULL, (void*) &icsText, "", NULL, TextBox, "" },
-{ 0, SAME_ROW | NO_OK, 0, NULL, (void*) &TypeInOK, "", NULL, EndMark , "" }
+{ 30, T_TOP, 400, NULL, (void*) &icsText, "", NULL, TextBox, "" },
+{ 0,  NO_OK,   0, NULL, (void*) &TypeInOK, "", NULL, EndMark , "" }
 };
 
 static int
diff --git a/xoptions.c b/xoptions.c
index 55a3935..dc525dc 100644
--- a/xoptions.c
+++ b/xoptions.c
@@ -807,12 +807,16 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent
 	    if(option[i].type == FileName || option[i].type == PathName) w -= 55;
 	    j = SetPositionAndSize(args, dialog, last, 1 /* border */,
 				   w /* w */, option[i].type == TextBox ? option[i].value : 0 /* h */, 0x91 /* chain full width */);
-	    if(option[i].type == TextBox && option[i].value) { // decorations for multi-line text-edits
+	    if(option[i].type == TextBox) { // decorations for multi-line text-edits
 		if(option[i].min & T_VSCRL) { XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways);  j++; }
 		if(option[i].min & T_HSCRL) { XtSetArg(args[j], XtNscrollHorizontal, XawtextScrollAlways);  j++; }
 		if(option[i].min & T_FILL)  { XtSetArg(args[j], XtNautoFill, True);  j++; }
 		if(option[i].min & T_WRAP)  { XtSetArg(args[j], XtNwrap, XawtextWrapWord); j++; }
-		if(option[i].min & T_TOP)   { XtSetArg(args[j], XtNtop, XtChainTop); j++; }
+		if(option[i].min & T_TOP)   { XtSetArg(args[j], XtNtop, XtChainTop); j++;
+		    if(!option[i].value) {    XtSetArg(args[j], XtNbottom, XtChainTop); j++;
+					      XtSetValues(dialog, args+j-2, 2);
+		    }
+		}
 	    } else shrink = TRUE;
 	    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;
 	    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;