From 47a06594c87b793b51012caf269ad1c920e34866 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 1 Apr 2011 14:54:26 +0200 Subject: [PATCH] Create General-Options dialog The generic popup is used to implement a General-Options dialog, which contains all Boolaen options that used to be set directly from the main Options menu, plus a spin option for the flash count and flash rate. The corresponing options are removed from the main Options menu, but the whole thing is made conditional on a compiler switch OPTIONSDIALOG. The dialog needs an OK callback for sending an altered ponder-state to the engine. (Why isn't this option disabled in -ncp mode, btw?) A spin control is added to adjust -animateSpeed between 5 and 100. Add dropMenu and showTargetSquares item as well. --- xboard.c | 96 +++++++++++++++++++++++++++++++++++++----------------------- xoptions.c | 46 ++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 37 deletions(-) diff --git a/xboard.c b/xboard.c index 5012bbd..d45cd74 100644 --- a/xboard.c +++ b/xboard.c @@ -450,6 +450,7 @@ void ShuffleMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)) void EngineMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void UciMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void TimeControlProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); +void OptionsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void NewVariantProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void FirstSettingsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void SecondSettingsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); @@ -702,6 +703,10 @@ MenuItem engineMenu[] = { }; MenuItem optionsMenu[] = { +#define OPTIONSDIALOG +#ifdef OPTIONSDIALOG + {N_("General ..."), "General", OptionsProc}, +#endif {N_("Time Control ... Alt+Shift+T"), "Time Control", TimeControlProc}, {N_("Common Engine ... Alt+Shift+U"), "Common Engine", UciMenuProc}, {N_("Adjudications ... Alt+Shift+J"), "Adjudications", EngineMenuProc}, @@ -712,6 +717,7 @@ MenuItem optionsMenu[] = { {N_("Game List ..."), "Game List", GameListOptionsPopUp}, {N_("Sounds ..."), "Sounds", SoundOptionsProc}, {"----", NULL, NothingProc}, +#ifndef OPTIONSDIALOG {N_("Always Queen Ctrl+Shift+Q"), "Always Queen", AlwaysQueenProc}, {N_("Animate Dragging"), "Animate Dragging", AnimateDraggingProc}, {N_("Animate Moving Ctrl+Shift+A"), "Animate Moving", AnimateMovingProc}, @@ -736,6 +742,7 @@ MenuItem optionsMenu[] = { {N_("Hide Thinking Ctrl+Shift+H"), "Hide Thinking", HideThinkingProc}, {N_("Test Legality Ctrl+Shift+L"), "Test Legality", TestLegalityProc}, {"----", NULL, NothingProc}, +#endif {N_("Save Settings Now"), "Save Settings Now", SaveSettingsProc}, {N_("Save Settings on Exit"), "Save Settings on Exit", SaveOnExitProc}, {NULL, NULL, NULL} @@ -954,6 +961,9 @@ XtActionsRec boardActions[] = { { "EngineMenuProc", (XtActionProc) EngineMenuProc }, { "UciMenuProc", (XtActionProc) UciMenuProc }, { "TimeControlProc", (XtActionProc) TimeControlProc }, + { "FlipViewProc", FlipViewProc }, + { "PonderNextMoveProc", PonderNextMoveProc }, +#ifndef OPTIONSDIALOG { "AlwaysQueenProc", AlwaysQueenProc }, { "AnimateDraggingProc", AnimateDraggingProc }, { "AnimateMovingProc", AnimateMovingProc }, @@ -961,7 +971,6 @@ XtActionsRec boardActions[] = { { "AutoflipProc", AutoflipProc }, { "BlindfoldProc", BlindfoldProc }, { "FlashMovesProc", FlashMovesProc }, - { "FlipViewProc", FlipViewProc }, #if HIGHDRAG { "HighlightDraggingProc", HighlightDraggingProc }, #endif @@ -969,7 +978,6 @@ XtActionsRec boardActions[] = { // { "IcsAlarmProc", IcsAlarmProc }, { "MoveSoundProc", MoveSoundProc }, { "PeriodicUpdatesProc", PeriodicUpdatesProc }, - { "PonderNextMoveProc", PonderNextMoveProc }, { "PopupExitMessageProc", PopupExitMessageProc }, { "PopupMoveErrorsProc", PopupMoveErrorsProc }, // { "PremoveProc", PremoveProc }, @@ -977,6 +985,7 @@ XtActionsRec boardActions[] = { { "ShowThinkingProc", ShowThinkingProc }, { "HideThinkingProc", HideThinkingProc }, { "TestLegalityProc", TestLegalityProc }, +#endif { "SaveSettingsProc", SaveSettingsProc }, { "SaveOnExitProc", SaveOnExitProc }, { "InfoProc", InfoProc }, @@ -1057,12 +1066,16 @@ char globalTranslations[] = :MetaJ: EngineMenuProc() \n \ :MetaU: UciMenuProc() \n \ :MetaT: TimeControlProc() \n \ + :CtrlP: PonderNextMoveProc() \n " +#ifndef OPTIONSDIALOG + "\ :CtrlQ: AlwaysQueenProc() \n \ :CtrlF: AutoflagProc() \n \ :CtrlA: AnimateMovingProc() \n \ - :CtrlP: PonderNextMoveProc() \n \ :CtrlL: TestLegalityProc() \n \ - :CtrlH: HideThinkingProc() \n \ + :CtrlH: HideThinkingProc() \n " +#endif + "\ :-: Iconify() \n \ :F1: ManProc() \n \ :F2: FlipViewProc() \n \ @@ -2397,6 +2410,7 @@ XBoard square size (hint): %d\n\ ReadBitmap(&xMarkPixmap, "checkmark.bm", checkmark_bits, checkmark_width, checkmark_height); XtSetArg(args[0], XtNleftBitmap, xMarkPixmap); +#ifndef OPTIONSDIALOG if (appData.alwaysPromoteToQueen) { XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Always Queen"), args, 1); @@ -2488,6 +2502,7 @@ XBoard square size (hint): %d\n\ XtSetValues(XtNameToWidget(menuBarWidget,"menuOptions.Test Legality"), args, 1); } +#endif if (saveSettingsOnExit) { XtSetValues(XtNameToWidget(menuBarWidget,"menuOptions.Save Settings on Exit"), args, 1); @@ -2751,9 +2766,11 @@ Enables icsEnables[] = { { "menuEngine.Hint", False }, { "menuEngine.Book", False }, { "menuEngine.Move Now", False }, +#ifndef OPTIONSDIALOG { "menuOptions.Periodic Updates", False }, { "menuOptions.Hide Thinking", False }, { "menuOptions.Ponder Next Move", False }, +#endif { "menuEngine.Engine #1 Settings", False }, #endif { "menuEngine.Engine #2 Settings", False }, @@ -2778,6 +2795,7 @@ Enables ncpEnables[] = { { "menuEngine.Engine #2 Settings", False }, { "menuEngine.Move Now", False }, { "menuEngine.Retract Move", False }, +#ifndef OPTIONSDIALOG { "menuOptions.Auto Flag", False }, { "menuOptions.Auto Flip View", False }, { "menuOptions.ICS", False }, @@ -2786,6 +2804,7 @@ Enables ncpEnables[] = { { "menuOptions.Hide Thinking", False }, { "menuOptions.Periodic Updates", False }, { "menuOptions.Ponder Next Move", False }, +#endif { "menuEngine.Hint", False }, { "menuEngine.Book", False }, { NULL, False } @@ -4390,9 +4409,9 @@ void DrawSquare(row, column, piece, do_flash) BlankSquare(x, y, square_color, piece, xBoardWindow, 1); } else { drawfunc = ChooseDrawFunc(); + if (do_flash && appData.flashCount > 0) { for (i=0; i