FreeProcInstance(lpProc);\r
}\r
\r
+int radioButton[] = {\r
+ OPT_VariantNormal,\r
+ -1, // Loadable\r
+ OPT_VariantWildcastle,\r
+ OPT_VariantNocastle,\r
+ OPT_VariantFRC,\r
+ OPT_VariantBughouse,\r
+ OPT_VariantCrazyhouse,\r
+ OPT_VariantLosers,\r
+ OPT_VariantSuicide,\r
+ OPT_VariantGiveaway,\r
+ OPT_VariantTwoKings,\r
+ -1, //Kriegspiel\r
+ OPT_VariantAtomic,\r
+ OPT_Variant3Check,\r
+ OPT_VariantShatranj,\r
+ -1,\r
+ -1,\r
+ -1,\r
+ -1,\r
+ -1,\r
+ -1,\r
+ -1,\r
+ -1,\r
+ OPT_VariantShogi,\r
+ OPT_VariantXiangqi,\r
+ OPT_VariantCourier,\r
+ OPT_VariantGothic,\r
+ OPT_VariantCapablanca,\r
+ OPT_VariantKnightmate,\r
+ OPT_VariantFairy, \r
+ OPT_VariantCylinder,\r
+ OPT_VariantFalcon,\r
+ OPT_VariantCRC,\r
+ OPT_VariantBerolina,\r
+ OPT_VariantJanus,\r
+ OPT_VariantSuper,\r
+ OPT_VariantGreat,\r
+ -1, // Twilight,\r
+ OPT_VariantMakruk,\r
+ OPT_VariantSChess,\r
+ OPT_VariantSpartan, // Spartan\r
+ -2 // sentinel\r
+};\r
+\r
VariantClass\r
VariantWhichRadio(HWND hDlg)\r
{\r
- return (IsDlgButtonChecked(hDlg, OPT_VariantFairy) ? VariantFairy :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantGothic) ? VariantGothic :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantCrazyhouse) ? VariantCrazyhouse :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantBughouse) ? VariantBughouse :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantCourier) ? VariantCourier :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantShatranj) ? VariantShatranj :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantShogi) ? VariantShogi :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantXiangqi) ? VariantXiangqi :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantCapablanca) ? VariantCapablanca :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantTwoKings) ? VariantTwoKings :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantKnightmate) ? VariantKnightmate :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantLosers) ? VariantLosers :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantSuicide) ? VariantSuicide :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantAtomic) ? VariantAtomic :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantShatranj) ? VariantShatranj :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantFRC) ? VariantFischeRandom :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantCylinder) ? VariantCylinder :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantFalcon) ? VariantFalcon :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantCRC) ? VariantCapaRandom :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantSuper) ? VariantSuper :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantBerolina) ? VariantBerolina :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantJanus) ? VariantJanus :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantWildcastle) ? VariantWildCastle :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantNocastle) ? VariantNoCastle :\r
- (IsDlgButtonChecked(hDlg, OPT_Variant3Check) ? Variant3Check :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantGreat) ? VariantGreat :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantGiveaway) ? VariantGiveaway :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantTwilight) ? VariantSpartan :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantMakruk) ? VariantMakruk :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantSChess) ? VariantSChess :\r
- VariantNormal ))))))))))))))))))))))))))))));\r
+ int i=0, j;\r
+ while((j = radioButton[i++]) != -2) {\r
+ if(j == -1) continue; // no menu button\r
+ if(IsDlgButtonChecked(hDlg, j)) return (VariantClass) i-1;\r
+ }\r
+ return gameInfo.variant; // If no button checked, keep old\r
+}\r
+\r
+void\r
+VariantShowRadio(HWND hDlg)\r
+{\r
+ int i=0, j;\r
+ CheckDlgButton(hDlg, radioButton[gameInfo.variant], TRUE);\r
+ while((j = radioButton[i++]) != -2) {\r
+ if(j == -1) continue; // no menu button\r
+ EnableWindow(GetDlgItem(hDlg, j), appData.noChessProgram || strstr(first.variants, VariantName(i-1)));\r
+ }\r
}\r
\r
LRESULT CALLBACK\r
/* Center the dialog over the application window */\r
CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
Translate(hDlg, DLG_NewVariant);\r
+\r
/* Initialize the dialog items */\r
- switch (gameInfo.variant) {\r
- case VariantNormal:\r
- CheckDlgButton(hDlg, OPT_VariantNormal, TRUE);\r
- break;\r
- case VariantCrazyhouse:\r
- CheckDlgButton(hDlg, OPT_VariantCrazyhouse, TRUE);\r
- break;\r
- case VariantBughouse:\r
- CheckDlgButton(hDlg, OPT_VariantBughouse, TRUE);\r
- break;\r
- case VariantShogi:\r
- CheckDlgButton(hDlg, OPT_VariantShogi, TRUE);\r
- break;\r
- case VariantXiangqi:\r
- CheckDlgButton(hDlg, OPT_VariantXiangqi, TRUE);\r
- break;\r
- case VariantCapablanca:\r
- CheckDlgButton(hDlg, OPT_VariantCapablanca, TRUE);\r
- break;\r
- case VariantGothic:\r
- CheckDlgButton(hDlg, OPT_VariantGothic, TRUE);\r
- break;\r
- case VariantCourier:\r
- CheckDlgButton(hDlg, OPT_VariantCourier, TRUE);\r
- break;\r
- case VariantKnightmate:\r
- CheckDlgButton(hDlg, OPT_VariantKnightmate, TRUE);\r
- break;\r
- case VariantTwoKings:\r
- CheckDlgButton(hDlg, OPT_VariantTwoKings, TRUE);\r
- break;\r
- case VariantFairy:\r
- CheckDlgButton(hDlg, OPT_VariantFairy, TRUE);\r
- break;\r
- case VariantAtomic:\r
- CheckDlgButton(hDlg, OPT_VariantAtomic, TRUE);\r
- break;\r
- case VariantSuicide:\r
- CheckDlgButton(hDlg, OPT_VariantSuicide, TRUE);\r
- break;\r
- case VariantLosers:\r
- CheckDlgButton(hDlg, OPT_VariantLosers, TRUE);\r
- break;\r
- case VariantShatranj:\r
- CheckDlgButton(hDlg, OPT_VariantShatranj, TRUE);\r
- break;\r
- case VariantFischeRandom:\r
- CheckDlgButton(hDlg, OPT_VariantFRC, TRUE);\r
- break;\r
- case VariantCapaRandom:\r
- CheckDlgButton(hDlg, OPT_VariantCRC, TRUE);\r
- break;\r
- case VariantFalcon:\r
- CheckDlgButton(hDlg, OPT_VariantFalcon, TRUE);\r
- break;\r
- case VariantCylinder:\r
- CheckDlgButton(hDlg, OPT_VariantCylinder, TRUE);\r
- break;\r
- case Variant3Check:\r
- CheckDlgButton(hDlg, OPT_Variant3Check, TRUE);\r
- break;\r
- case VariantSuper:\r
- CheckDlgButton(hDlg, OPT_VariantSuper, TRUE);\r
- break;\r
- case VariantBerolina:\r
- CheckDlgButton(hDlg, OPT_VariantBerolina, TRUE);\r
- break;\r
- case VariantJanus:\r
- CheckDlgButton(hDlg, OPT_VariantJanus, TRUE);\r
- break;\r
- case VariantWildCastle:\r
- CheckDlgButton(hDlg, OPT_VariantWildcastle, TRUE);\r
- break;\r
- case VariantNoCastle:\r
- CheckDlgButton(hDlg, OPT_VariantNocastle, TRUE);\r
- break;\r
- case VariantGreat:\r
- CheckDlgButton(hDlg, OPT_VariantGreat, TRUE);\r
- break;\r
- case VariantGiveaway:\r
- CheckDlgButton(hDlg, OPT_VariantGiveaway, TRUE);\r
- break;\r
- case VariantSpartan:\r
- CheckDlgButton(hDlg, OPT_VariantTwilight, TRUE);\r
- break;\r
- case VariantMakruk:\r
- CheckDlgButton(hDlg, OPT_VariantMakruk, TRUE);\r
- break;\r
- case VariantSChess:\r
- CheckDlgButton(hDlg, OPT_VariantSChess, TRUE);\r
- break;\r
- default: ;\r
- }\r
+ VariantShowRadio(hDlg);\r
\r
SetDlgItemInt( hDlg, IDC_Files, -1, TRUE );\r
SendDlgItemMessage( hDlg, IDC_Files, EM_SETSEL, 0, -1 );\r
{N_("shogi (9x9)"), "#BFFFFF", 0, VariantShogi},
{N_("xiangqi (9x10)"), "#BFFFFF", 0, VariantXiangqi},
{N_("courier (12x8)"), "#BFFFBF", 0, VariantCourier},
- {N_("janus (10x8)"), "#BFBFFF", 0, VariantJanus},
{N_("Capablanca (10x8)"), "#BFBFFF", 0, VariantCapablanca},
- {N_("CRC (10x8)"), "#BFBFFF", 0, VariantCapaRandom},
#ifdef GOTHIC
{N_("Gothic (10x8)"), "#BFBFFF", 0, VariantGothic},
#endif
+ {N_("janus (10x8)"), "#BFBFFF", 0, VariantJanus},
+ {N_("CRC (10x8)"), "#BFBFFF", 0, VariantCapaRandom},
#ifdef FALCON
{N_("Falcon (10x8)"), "#BFBFFF", 0, VariantFalcon},
#endif
XtSetArg(args[j], XtNradioData, i+1); j++;
XtSetArg(args[j], XtNbackground, buttonColor); j++;
XtSetArg(args[j], XtNstate, gameInfo.variant == buttonDesc[i].variant); j++;
+ XtSetArg(args[j], XtNsensitive, appData.noChessProgram || strstr(first.variants, VariantName(buttonDesc[i].variant))); j++;
buttonDesc[i].handle = last =
XtCreateManagedWidget(buttonDesc[i].name, toggleWidgetClass, form, args, j);
}