X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=menus.c;h=1af89f3dfcfa23436c5980e9fe8f0db629011cb3;hb=003ab519c36430f6df51e0e6e2aa528476894161;hp=f802215bef52f76ec7b4244184d23158d4b7ca4c;hpb=86932d68dc115d304fddb290947fd04323d62cbd;p=xboard.git diff --git a/menus.c b/menus.c index f802215..1af89f3 100644 --- a/menus.c +++ b/menus.c @@ -110,6 +110,25 @@ char *gameCopyFilename, *gamePasteFilename; Boolean saveSettingsOnExit; char *settingsFileName; +static int +LoadGamePopUp (FILE *f, int gameNumber, char *title) +{ + cmailMsgLoaded = FALSE; + if (gameNumber == 0) { + int error = GameListBuild(f); + if (error) { + DisplayError(_("Cannot build game list"), error); + } else if (!ListEmpty(&gameList) && + ((ListGame *) gameList.tailPred)->number > 1) { + GameListPopUp(f, title); + return TRUE; + } + GameListDestroy(); + gameNumber = 1; + } + return LoadGame(f, gameNumber, title, FALSE); +} + void LoadGameProc () { @@ -336,6 +355,7 @@ AnnotateProc () void FlipViewProc () { + if(twoBoards) { partnerUp = 1; DrawPosition(True, NULL); partnerUp = 0; } flipView = !flipView; DrawPosition(True, NULL); } @@ -343,17 +363,15 @@ FlipViewProc () void SaveOnExitProc () { - Arg args[16]; - - saveSettingsOnExit = !saveSettingsOnExit; + saveSettingsOnExit = !saveSettingsOnExit; - MarkMenuItem("Options.SaveSettingsonExit", saveSettingsOnExit); + MarkMenuItem("Options.SaveSettingsonExit", saveSettingsOnExit); } void SaveSettingsProc () { - SaveSettings(settingsFileName); + SaveSettings(settingsFileName); } void @@ -366,12 +384,6 @@ InfoProc () } void -ManProc () -{ // called from menu - ManInner(NULL, NULL, NULL, NULL); -} - -void BugReportProc () { char buf[MSG_SIZ]; @@ -431,6 +443,13 @@ void DebugProc () { appData.debugMode = !appData.debugMode; + if(!strcmp(appData.nameOfDebugFile, "stderr")) return; // stderr is already open, and should never be closed + if(!appData.debugMode) fclose(debugFP); + else { + debugFP = fopen(appData.nameOfDebugFile, "w"); + if(debugFP == NULL) debugFP = stderr; + else setbuf(debugFP, NULL); + } } void @@ -448,10 +467,8 @@ NothingProc () void PonderNextMoveProc () { - Arg args[16]; - - PonderNextMoveEvent(!appData.ponderNextMove); - MARK_MENU_ITEM("Options.PonderNextMove", appData.ponderNextMove); + PonderNextMoveEvent(!appData.ponderNextMove); + MARK_MENU_ITEM("Options.PonderNextMove", appData.ponderNextMove); } void @@ -609,12 +626,10 @@ ShowThinkingProc () void HideThinkingProc () { - Arg args[16]; - - appData.hideThinkingFromHuman = !appData.hideThinkingFromHuman; // [HGM] thinking: taken out of ShowThinkingEvent - ShowThinkingEvent(); + appData.hideThinkingFromHuman = !appData.hideThinkingFromHuman; // [HGM] thinking: taken out of ShowThinkingEvent + ShowThinkingEvent(); - MARK_MENU_ITEM("Options.HideThinking", appData.hideThinkingFromHuman); + MARK_MENU_ITEM("Options.HideThinking", appData.hideThinkingFromHuman); } /* @@ -682,6 +697,7 @@ MenuItem viewMenu[] = { {N_("Tags"), "Tags", EditTagsProc}, {N_("Comments"), "Comments", EditCommentProc}, {N_("ICS Input Box"), "ICSInputBox", IcsInputBoxProc}, + {N_("Open Chat Window"), "OpenChatWindow", ChatProc}, {"----", NULL, NothingProc}, {N_("Board..."), "Board", BoardOptionsProc}, {N_("Game List Tags..."), "GameListTags", GameListOptionsProc}, @@ -726,7 +742,8 @@ MenuItem actionMenu[] = { }; MenuItem engineMenu[] = { - {N_("Load New Engine ..."), "LoadEngine", LoadEngineProc}, + {N_("Load New 1st Engine ..."), "LoadNew1stEngine", LoadEngine1Proc}, + {N_("Load New 2nd Engine ..."), "LoadNew2ndEngine", LoadEngine2Proc}, {"----", NULL, NothingProc}, {N_("Engine #1 Settings ..."), "Engine#1Settings", FirstSettingsProc}, {N_("Engine #2 Settings ..."), "Engine#2Settings", SecondSettingsProc}, @@ -827,7 +844,7 @@ MenuItem noMenu[] = { { "", "TestLegality", TestLegalityProc }, #endif { "", "AboutGame", AboutGameEvent }, - { "", "Debug", DebugProc }, + { "", "DebugProc", DebugProc }, { "", "Nothing", NothingProc }, {NULL, NULL, NULL} }; @@ -847,14 +864,14 @@ Menu menuBar[] = { MenuItem * MenuNameToItem (char *menuName) { - int i; + int i=0; char buf[MSG_SIZ], *p; MenuItem *menuTab; static MenuItem a = { NULL, NULL, NothingProc }; extern Option mainOptions[]; safeStrCpy(buf, menuName, MSG_SIZ); p = strchr(buf, '.'); - if(!p) menuTab = noMenu; else { + if(!p) menuTab = noMenu, p = menuName; else { *p++ = NULLCHAR; for(i=0; menuBar[i].name; i++) if(!strcmp(buf, menuBar[i].name)) break; @@ -872,17 +889,15 @@ AppendEnginesToMenu (char *list) { int i=0; char *p; -#if 0 if(appData.icsActive || appData.recentEngines <= 0) return; recentEngines = strdup(list); while (*list) { p = strchr(list, '\n'); if(p == NULL) break; - if(i == 0) AppendMenuItem("----", "----", NULL); // at least one valid item to add + if(i == 0) AppendMenuItem("----", 0); // at least one valid item to add *p = 0; - AppendMenuItem(list, "recent", (MenuProc *) i); + AppendMenuItem(list, i); i++; *p = '\n'; list = p + 1; } -#endif } Enables icsEnables[] = { @@ -906,7 +921,8 @@ Enables icsEnables[] = { #endif { "Engine.Engine#1Settings", False }, { "Engine.Engine#2Settings", False }, - { "Engine.LoadEngine", False }, + { "Engine.Load1stEngine", False }, + { "Engine.Load2ndEngine", False }, { "Edit.Annotate", False }, { "Options.Match", False }, { NULL, False } @@ -924,6 +940,7 @@ Enables ncpEnables[] = { { "Mode.ICSClient", False }, { "View.ICStextmenu", False }, { "View.ICSInputBox", False }, + { "View.OpenChatWindow", False }, { "Action.", False }, { "Edit.Revert", False }, { "Edit.Annotate", False }, @@ -950,6 +967,7 @@ Enables gnuEnables[] = { { "Mode.ICSClient", False }, { "View.ICStextmenu", False }, { "View.ICSInputBox", False }, + { "View.OpenChatWindow", False }, { "Action.Accept", False }, { "Action.Decline", False }, { "Action.Rematch", False }, @@ -1066,8 +1084,8 @@ SetICSMode () #if ZIPPY if (appData.zippyPlay && !appData.noChessProgram) { /* [DM] icsEngineAnalyze */ - EnableMenuItem("Analysis Mode", True); - EnableMenuItem("Engine #1 Settings", True); + EnableNamedMenuItem("Mode.AnalysisMode", True); + EnableNamedMenuItem("Engine.Engine#1Settings", True); } #endif } @@ -1125,7 +1143,7 @@ SetMachineThinkingEnables () case MachinePlaysBlack: case MachinePlaysWhite: case TwoMachinesPlay: - EnableMenuItem(ModeToWidgetName(gameMode), True); + EnableNamedMenuItem(ModeToWidgetName(gameMode), True); break; default: break;