From 3c99c449641fc101cf866ab2b0506ad8194cad1e Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 15 Oct 2015 23:41:09 +0200 Subject: [PATCH] Grayout Machine Match menu when aborting match Clicking the Machine Match menu item when a match or tourney is in progress will make XBoard drop out of match mode when the game finishes. The check mark will remain on the item until that moment. But now we gray out the item to show that the match is scheduled for termination. --- gtk/xboard.c | 3 ++- menus.c | 2 ++ winboard/winboard.c | 3 +++ xaw/xboard.c | 3 ++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gtk/xboard.c b/gtk/xboard.c index 5da2d3e..7922133 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -1799,8 +1799,9 @@ ModeHighlight () if (wname != NULL) { MarkMenuItem(wname, True); } - oldmode = gameMode; + if(oldMode == TwoMachinesPlay) EnableNamedMenuItem("Mode.MachineMatch", True); MarkMenuItem("Mode.MachineMatch", matchMode && matchGame < appData.matchGames); + oldmode = gameMode; /* Maybe all the enables should be handled here, not just this one */ EnableNamedMenuItem("Mode.Training", gameMode == Training || gameMode == PlayFromGameFile); diff --git a/menus.c b/menus.c index afcbab9..4dbf016 100644 --- a/menus.c +++ b/menus.c @@ -257,6 +257,8 @@ QuitProc () void MatchProc () { + static Enables matchOff[] = { { "Mode.MachineMatch", False }, { NULL, False } }; + if(matchMode) SetMenuEnables(matchOff); MatchEvent(2); } diff --git a/winboard/winboard.c b/winboard/winboard.c index 971309b..1a20060 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -5091,6 +5091,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case IDM_Match: // [HGM] match: flows into next case, after setting Match Mode and nr of Games + if(matchMode) EnableMenuItem(GetMenu(hwndMain), IDM_Match, MF_BYCOMMAND|MF_GRAYED); MatchEvent(2); // distinguish from command-line-triggered case (matchMode=1) break; @@ -8215,6 +8216,8 @@ ModeHighlight() nowChecked = 0; break; } + if(prevChecked == IDM_TwoMachine) // [HGM] 'Machine Match' might have gotten disabled when stopping match + EnableMenuItem(GetMenu(hwndMain), IDM_Match, MF_BYCOMMAND|MF_ENABLED) CheckMark(prevChecked, MF_UNCHECKED); CheckMark(nowChecked, MF_CHECKED); CheckMark(IDM_Match, matchMode && matchGame < appData.matchGames ? MF_CHECKED : MF_UNCHECKED); diff --git a/xaw/xboard.c b/xaw/xboard.c index 8792a77..d9f0953 100644 --- a/xaw/xboard.c +++ b/xaw/xboard.c @@ -1851,8 +1851,9 @@ ModeHighlight () if (wname != NULL) { MarkMenuItem(wname, True); } - oldmode = gameMode; + if(oldMode == TwoMachinesPlay) EnableNamedMenuItem("Mode.MachineMatch", True); MarkMenuItem("Mode.MachineMatch", matchMode && matchGame < appData.matchGames); + oldmode = gameMode; /* Maybe all the enables should be handled here, not just this one */ EnableNamedMenuItem("Mode.Training", gameMode == Training || gameMode == PlayFromGameFile); -- 1.7.0.4