From: H.G.Muller Date: Fri, 10 Oct 2014 16:14:09 +0000 (+0200) Subject: Show current variant on New Variant buttons GTK in bold X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=7e5ca3010c25dc5974622b2f7773855c824916d4;p=xboard.git Show current variant on New Variant buttons GTK in bold If an engine-defined variant is selected, we compare its name to the inscription on the button, otherwise we compare the variant numbers. (Test to trigger this is a bit awkward, to not inadvertantly apply it to the ICS Text Menu, which also has colored buttoms.) --- diff --git a/dialogs.c b/dialogs.c index 8e3936f..17657e1 100644 --- a/dialogs.c +++ b/dialogs.c @@ -562,7 +562,6 @@ NewVariantProc () { static int start; int i, last; - char buf[MSG_SIZ]; ranksTmp = filesTmp = sizeTmp = -1; // prefer defaults over actual settings if(appData.noChessProgram) sprintf(warning, _("Only bughouse is not available in viewer mode.")); else sprintf(warning, _("All variants not supported by the first engine\n(currently %s) are disabled."), first.tidy); @@ -586,9 +585,9 @@ NewVariantProc () } variantDescriptors[start-2].type = (last < 0 ? EndMark : Skip); variantDescriptors[start-1].type = (last < 6 ? Skip : Break); - safeStrCpy(buf, engineVariant, MSG_SIZ); *engineVariant = NULLCHAR; // yeghh... + safeStrCpy(engineVariant+100, engineVariant, 100); *engineVariant = NULLCHAR; // yeghh... GenericPopUp(variantDescriptors, _("New Variant"), TransientDlg, BoardWindow, MODAL, 0); - safeStrCpy(engineVariant, buf, MSG_SIZ); // must temporarily clear to avoid enabling all variant buttons + safeStrCpy(engineVariant, engineVariant+100, MSG_SIZ); // must temporarily clear to avoid enabling all variant buttons } //------------------------------------------- Common Engine Options ------------------------------------- diff --git a/gtk/xoptions.c b/gtk/xoptions.c index cd78c9f..5c35c8e 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -1445,10 +1445,14 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width); /* set button color on new variant dialog */ if(option[i].textValue) { + static char *b = "Bold"; gdk_color_parse( option[i].textValue, &color ); gtk_widget_modify_bg ( GTK_WIDGET(button), GTK_STATE_NORMAL, &color ); gtk_widget_set_sensitive(button, option[i].value >= 0 && (appData.noChessProgram || strstr(first.variants, VariantName(option[i].value)))); + if(engineVariant[100] ? !strcmp(engineVariant+100, option[i].name) : + gameInfo.variant ? option[i].value == gameInfo.variant : !strcmp(option[i].name, "Normal")) + SetWidgetFont(gtk_bin_get_child(GTK_BIN(button)), &b); } Pack(hbox, table, button, left, left+1, top, 0);