#include "frontend.h"
#include "backend.h"
-#include "backendz.h"
-#include "moves.h"
#include "xhistory.h"
-#include "xedittags.h"
#include "menus.h"
#include "gettext.h"
}
void
-AnalyzeModeProc ()
-{
- char buf[MSG_SIZ];
-
- if (!first.analysisSupport) {
- snprintf(buf, sizeof(buf), _("%s does not support analysis"), first.tidy);
- DisplayError(buf, 0);
- return;
- }
- /* [DM] icsEngineAnalyze [HGM] This is horrible code; reverse the gameMode and isEngineAnalyze tests! */
- if (appData.icsActive) {
- if (gameMode != IcsObserving) {
- snprintf(buf, MSG_SIZ, _("You are not observing a game"));
- DisplayError(buf, 0);
- /* secure check */
- if (appData.icsEngineAnalyze) {
- if (appData.debugMode)
- fprintf(debugFP, _("Found unexpected active ICS engine analyze \n"));
- ExitAnalyzeMode();
- ModeHighlight();
- }
- return;
- }
- /* if enable, use want disable icsEngineAnalyze */
- if (appData.icsEngineAnalyze) {
- ExitAnalyzeMode();
- ModeHighlight();
- return;
- }
- appData.icsEngineAnalyze = TRUE;
- if (appData.debugMode)
- fprintf(debugFP, _("ICS engine analyze starting... \n"));
- }
-#ifndef OPTIONSDIALOG
- if (!appData.showThinking)
- ShowThinkingProc();
-#endif
-
- AnalyzeModeEvent();
-}
-
-void
-AnalyzeFileProc ()
-{
- if (!first.analysisSupport) {
- char buf[MSG_SIZ];
- snprintf(buf, sizeof(buf), _("%s does not support analysis"), first.tidy);
- DisplayError(buf, 0);
- return;
- }
-// Reset(FALSE, TRUE);
-#ifndef OPTIONSDIALOG
- if (!appData.showThinking)
- ShowThinkingProc();
-#endif
- AnalyzeFileEvent();
-// FileNamePopUp(_("File to analyze"), "", ".pgn .game", LoadGamePopUp, "rb");
- AnalysisPeriodicEvent(1);
-}
-
-void
MatchProc ()
{
MatchEvent(2);
{N_("New Shuffle Game ..."), "NewShuffleGame", ShuffleMenuProc},
{N_("New Variant ... Alt+Shift+V"), "NewVariant", NewVariantProc}, // [HGM] variant: not functional yet
{"----", NULL, NothingProc},
- {N_("Load Game Ctrl+O"), "LoadGame", LoadGameProc},
+ {N_("Load Game Ctrl+O"), "LoadGame", LoadGameProc, CHECK},
{N_("Load Position Ctrl+Shift+O"), "LoadPosition", LoadPositionProc},
// {N_("Load Next Game"), "LoadNextGame", LoadNextGameProc},
// {N_("Load Previous Game"), "LoadPreviousGame", LoadPrevGameProc},
};
MenuItem viewMenu[] = {
- {N_("Flip View F2"), "FlipView", FlipViewProc},
+ {N_("Flip View F2"), "FlipView", FlipViewProc, CHECK},
{"----", NULL, NothingProc},
- {N_("Engine Output Alt+Shift+O"), "EngineOutput", EngineOutputProc},
- {N_("Move History Alt+Shift+H"), "MoveHistory", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
- {N_("Evaluation Graph Alt+Shift+E"), "EvaluationGraph", EvalGraphProc},
- {N_("Game List Alt+Shift+G"), "GameList", ShowGameListProc},
- {N_("ICS text menu"), "ICStextmenu", IcsTextProc},
+ {N_("Engine Output Alt+Shift+O"), "EngineOutput", EngineOutputProc, CHECK},
+ {N_("Move History Alt+Shift+H"), "MoveHistory", HistoryShowProc, CHECK}, // [HGM] hist: activate 4.2.7 code
+ {N_("Evaluation Graph Alt+Shift+E"), "EvaluationGraph", EvalGraphProc, CHECK},
+ {N_("Game List Alt+Shift+G"), "GameList", ShowGameListProc, CHECK},
+ {N_("ICS text menu"), "ICStextmenu", IcsTextProc, CHECK},
{"----", NULL, NothingProc},
- {N_("Tags"), "Tags", EditTagsProc},
- {N_("Comments"), "Comments", EditCommentProc},
- {N_("ICS Input Box"), "ICSInputBox", IcsInputBoxProc},
- {N_("Open Chat Window"), "OpenChatWindow", ChatProc},
+ {N_("Tags"), "Tags", EditTagsProc, CHECK},
+ {N_("Comments"), "Comments", EditCommentProc, CHECK},
+ {N_("ICS Input Box"), "ICSInputBox", IcsInputBoxProc, CHECK},
+ {N_("Open Chat Window"), "OpenChatWindow", ChatProc, CHECK},
{"----", NULL, NothingProc},
{N_("Board..."), "Board", BoardOptionsProc},
{N_("Game List Tags..."), "GameListTags", GameListOptionsProc},
};
MenuItem modeMenu[] = {
- {N_("Machine White Ctrl+W"), "MachineWhite", MachineWhiteEvent},
- {N_("Machine Black Ctrl+B"), "MachineBlack", MachineBlackEvent},
- {N_("Two Machines Ctrl+T"), "TwoMachines", TwoMachinesEvent},
- {N_("Analysis Mode Ctrl+A"), "AnalysisMode", AnalyzeModeProc},
- {N_("Analyze Game Ctrl+G"), "AnalyzeFile", AnalyzeFileProc },
- {N_("Edit Game Ctrl+E"), "EditGame", EditGameEvent},
- {N_("Edit Position Ctrl+Shift+E"), "EditPosition", EditPositionEvent},
- {N_("Training"), "Training", TrainingEvent},
- {N_("ICS Client"), "ICSClient", IcsClientEvent},
+ {N_("Machine White Ctrl+W"), "MachineWhite", MachineWhiteEvent, RADIO },
+ {N_("Machine Black Ctrl+B"), "MachineBlack", MachineBlackEvent, RADIO },
+ {N_("Two Machines Ctrl+T"), "TwoMachines", TwoMachinesEvent, RADIO },
+ {N_("Analysis Mode Ctrl+A"), "AnalysisMode", (MenuProc*) AnalyzeModeEvent, RADIO},
+ {N_("Analyze Game Ctrl+G"), "AnalyzeFile", AnalyzeFileEvent, RADIO },
+ {N_("Edit Game Ctrl+E"), "EditGame", EditGameEvent, RADIO },
+ {N_("Edit Position Ctrl+Shift+E"), "EditPosition", EditPositionEvent, RADIO },
+ {N_("Training"), "Training", TrainingEvent, RADIO },
+ {N_("ICS Client"), "ICSClient", IcsClientEvent, RADIO },
{"----", NULL, NothingProc},
- {N_("Machine Match"), "MachineMatch", MatchProc},
- {N_("Pause Pause"), "Pause", PauseEvent},
+ {N_("Machine Match"), "MachineMatch", MatchProc, CHECK },
+ {N_("Pause Pause"), "Pause", PauseEvent, CHECK },
{NULL, NULL, NULL}
};
{NULL, NULL, NULL}
};
-MenuItem engineMenu[] = {
+MenuItem engineMenu[100] = {
{N_("Load New 1st Engine ..."), "LoadNew1stEngine", LoadEngine1Proc},
{N_("Load New 2nd Engine ..."), "LoadNew2ndEngine", LoadEngine2Proc},
{"----", NULL, NothingProc},
{"----", NULL, NothingProc},
#endif
{N_("Save Settings Now"), "SaveSettingsNow", SaveSettingsProc},
- {N_("Save Settings on Exit"), "SaveSettingsonExit", SaveOnExitProc},
+ {N_("Save Settings on Exit"), "SaveSettingsonExit", SaveOnExitProc, CHECK },
{NULL, NULL, NULL}
};
{ "", "TestLegality", TestLegalityProc },
#endif
{ "", "AboutGame", AboutGameEvent },
- { "", "Debug", DebugProc },
+ { "", "DebugProc", DebugProc },
{ "", "Nothing", NothingProc },
{NULL, NULL, NULL}
};
return NULL; // item not found
}
+int firstEngineItem;
+
void
AppendEnginesToMenu (char *list)
{
int i=0;
char *p;
if(appData.icsActive || appData.recentEngines <= 0) return;
+ for(firstEngineItem=0; engineMenu[firstEngineItem].string; firstEngineItem++);
recentEngines = strdup(list);
while (*list) {
p = strchr(list, '\n'); if(p == NULL) break;
- if(i == 0) AppendMenuItem("----", 0); // at least one valid item to add
+ if(i == 0) engineMenu[firstEngineItem++].string = "----"; // at least one valid item to add
*p = 0;
- AppendMenuItem(list, i);
+ if(firstEngineItem + i < 99)
+ engineMenu[firstEngineItem+i].string = strdup(list); // just set name; MenuProc stays NULL
i++; *p = '\n'; list = p + 1;
}
}