Make filler buttons in New Variant insensitive
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 22 Dec 2013 20:01:36 +0000 (21:01 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sat, 4 Jan 2014 11:49:08 +0000 (12:49 +0100)
dialogs.c
gtk/xoptions.c
xaw/xoptions.c

index 1bc08a7..5aec3fd 100644 (file)
--- a/dialogs.c
+++ b/dialogs.c
@@ -423,7 +423,7 @@ static Option variantDescriptors[] = {
 { VariantBerolina,SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_("berolina *")},
 { VariantAtomic,        0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_("atomic")},
 { VariantTwoKings,SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_("two kings")},
-{ VariantNormal,        0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_(" ")}, // dummy, to have good alignment
+{ -1,                   0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_(" ")}, // dummy, to have good alignment
 { VariantSpartan,SAME_ROW, 135, NULL, (void*) &Pick, "#FF0000", NULL, Button, N_("Spartan")},
 { 0, 0, 0, NULL, NULL, NULL, NULL, Label, N_("Board size ( -1 = default for selected variant):")},
 { 0, -1, BOARD_RANKS-1, NULL, (void*) &ranksTmp, "", NULL, Spin, N_("Number of Board Ranks:") },
@@ -454,7 +454,7 @@ static Option variantDescriptors[] = {
 { VariantCourier, SAME_ROW,135, NULL, (void*) &Pick, "#BFFFBF", NULL, Button, N_("courier (12x8)")},
 { VariantChuChess,      0, 135, NULL, (void*) &Pick, "#BFBFBF", NULL, Button, N_("chu chess (10x10)")},
 { VariantChu,    SAME_ROW, 135, NULL, (void*) &Pick, "#BFFFBF", NULL, Button, N_("chu shogi (12x12)")},
-//{ VariantNormal,        0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_(" ")}, // dummy, to have good alignment
+//{ -1,                   0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_(" ")}, // dummy, to have good alignment
 // optional buttons for engine-defined variants
 { VariantUnknown,       0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL },
 { VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL },
@@ -528,6 +528,7 @@ NewVariantProc ()
    if(!(last&1)) { // odd number, add filler
        ASSIGN(variantDescriptors[start+last+1].name, " ");
        variantDescriptors[start+last+1].type = Button;
+       variantDescriptors[start+last+1].value = -1;
    }
    safeStrCpy(buf, engineVariant, MSG_SIZ); *engineVariant = NULLCHAR; // yeghh...
    GenericPopUp(variantDescriptors, _("New Variant"), TransientDlg, BoardWindow, MODAL, 0);
index 7a03ffb..90a45ea 100644 (file)
@@ -1341,8 +1341,8 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width);
             if(option[i].textValue) {
                 gdk_color_parse( option[i].textValue, &color );
                 gtk_widget_modify_bg ( GTK_WIDGET(button), GTK_STATE_NORMAL, &color );
-                gtk_widget_set_sensitive(button, appData.noChessProgram || option[i].value < 0
-                                        || strstr(first.variants, VariantName(option[i].value)));
+                gtk_widget_set_sensitive(button, option[i].value >= 0 && (appData.noChessProgram
+                                        || strstr(first.variants, VariantName(option[i].value))));
             }
 
             Pack(hbox, table, button, left, left+1, top, 0);
index cee1ec3..496cad1 100644 (file)
@@ -1079,8 +1079,8 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent
                                   option[i].max /* w */, shrink ? textHeight : 0 /* h */, option[i].min & 0xE | chain /* chain */);
            XtSetArg(args[j], XtNlabel, _(option[i].name));  j++;
            if(option[i].textValue) { // special for buttons of New Variant dialog
-               XtSetArg(args[j], XtNsensitive, appData.noChessProgram || option[i].value < 0
-                                        || strstr(first.variants, VariantName(option[i].value))); j++;
+               XtSetArg(args[j], XtNsensitive, option[i].value >= 0 && (appData.noChessProgram
+                                        || strstr(first.variants, VariantName(option[i].value)))); j++;
                XtSetArg(args[j], XtNborderWidth, (gameInfo.variant == option[i].value)+1); j++;
            }
            option[i].handle = (void*)