2 * menus.c -- platform-indendent menu handling code for XBoard
4 * Copyright 1991 by Digital Equipment Corporation, Maynard,
7 * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
8 * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
10 * The following terms apply to Digital Equipment Corporation's copyright
12 * ------------------------------------------------------------------------
15 * Permission to use, copy, modify, and distribute this software and its
16 * documentation for any purpose and without fee is hereby granted,
17 * provided that the above copyright notice appear in all copies and that
18 * both that copyright notice and this permission notice appear in
19 * supporting documentation, and that the name of Digital not be
20 * used in advertising or publicity pertaining to distribution of the
21 * software without specific, written prior permission.
23 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
24 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
25 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
26 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
27 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
28 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
30 * ------------------------------------------------------------------------
32 * The following terms apply to the enhanced version of XBoard
33 * distributed by the Free Software Foundation:
34 * ------------------------------------------------------------------------
36 * GNU XBoard is free software: you can redistribute it and/or modify
37 * it under the terms of the GNU General Public License as published by
38 * the Free Software Foundation, either version 3 of the License, or (at
39 * your option) any later version.
41 * GNU XBoard is distributed in the hope that it will be useful, but
42 * WITHOUT ANY WARRANTY; without even the implied warranty of
43 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44 * General Public License for more details.
46 * You should have received a copy of the GNU General Public License
47 * along with this program. If not, see http://www.gnu.org/licenses/. *
49 *------------------------------------------------------------------------
50 ** See the file ChangeLog for a revision history. */
60 #include <sys/types.h>
68 #else /* not STDC_HEADERS */
69 extern char *getenv();
72 # else /* not HAVE_STRING_H */
74 # endif /* not HAVE_STRING_H */
75 #endif /* not STDC_HEADERS */
85 // [HGM] bitmaps: put before incuding the bitmaps / pixmaps, to know how many piece types there are.
92 #include "xgamelist.h"
94 #include "xedittags.h"
99 # define _(s) gettext (s)
100 # define N_(s) gettext_noop (s)
107 * Button/menu procedures
110 char *gameCopyFilename, *gamePasteFilename;
111 Boolean saveSettingsOnExit;
112 char *settingsFileName;
117 if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {
120 FileNamePopUp(_("Load game file name?"), "", ".pgn .game", LoadGamePopUp, "rb");
142 LoadNextPositionProc ()
148 LoadPrevPositionProc ()
154 ReloadPositionProc ()
162 if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {
165 FileNamePopUp(_("Load position file name?"), "", ".fen .epd .pos", LoadPosition, "rb");
171 FileNamePopUp(_("Save game file name?"),
172 DefaultFileName(appData.oldSaveStyle ? "game" : "pgn"),
173 appData.oldSaveStyle ? ".game" : ".pgn",
180 FileNamePopUp(_("Save position file name?"),
181 DefaultFileName(appData.oldSaveStyle ? "pos" : "fen"),
182 appData.oldSaveStyle ? ".pos" : ".fen",
187 ReloadCmailMsgProc ()
189 ReloadCmailMsgEvent(FALSE);
193 CopyFENToClipboard ()
194 { // wrapper to make call from back-end possible
203 ret = SaveGameToFile(gameCopyFilename, FALSE);
212 if(!SaveGameListAsText(fopen(gameCopyFilename, "w"))) return;
234 if (!first.analysisSupport) {
235 snprintf(buf, sizeof(buf), _("%s does not support analysis"), first.tidy);
236 DisplayError(buf, 0);
239 /* [DM] icsEngineAnalyze [HGM] This is horrible code; reverse the gameMode and isEngineAnalyze tests! */
240 if (appData.icsActive) {
241 if (gameMode != IcsObserving) {
242 snprintf(buf, MSG_SIZ, _("You are not observing a game"));
243 DisplayError(buf, 0);
245 if (appData.icsEngineAnalyze) {
246 if (appData.debugMode)
247 fprintf(debugFP, _("Found unexpected active ICS engine analyze \n"));
253 /* if enable, use want disable icsEngineAnalyze */
254 if (appData.icsEngineAnalyze) {
259 appData.icsEngineAnalyze = TRUE;
260 if (appData.debugMode)
261 fprintf(debugFP, _("ICS engine analyze starting... \n"));
263 #ifndef OPTIONSDIALOG
264 if (!appData.showThinking)
274 if (!first.analysisSupport) {
276 snprintf(buf, sizeof(buf), _("%s does not support analysis"), first.tidy);
277 DisplayError(buf, 0);
280 // Reset(FALSE, TRUE);
281 #ifndef OPTIONSDIALOG
282 if (!appData.showThinking)
286 // FileNamePopUp(_("File to analyze"), "", ".pgn .game", LoadGamePopUp, "rb");
287 AnalysisPeriodicEvent(1);
299 UserAdjudicationEvent(+1);
305 UserAdjudicationEvent(-1);
311 UserAdjudicationEvent(0);
329 flipView = !flipView;
330 DrawPosition(True, NULL);
338 saveSettingsOnExit = !saveSettingsOnExit;
340 MarkMenuItem("Save Settings on Exit", saveSettingsOnExit);
346 SaveSettings(settingsFileName);
353 snprintf(buf, sizeof(buf), "xterm -e info --directory %s --directory . -f %s &",
360 { // called from menu
361 ManInner(NULL, NULL, NULL, NULL);
368 snprintf(buf, MSG_SIZ, "%s mailto:bug-xboard@gnu.org", appData.sysOpen);
376 snprintf(buf, MSG_SIZ, "%s http://www.gnu.org/software/xboard/user_guide/UserGuide.html", appData.sysOpen);
384 snprintf(buf, MSG_SIZ, "%s http://www.gnu.org/software/xboard/", appData.sysOpen);
392 snprintf(buf, MSG_SIZ, "%s http://www.gnu.org/software/xboard/whats_new/portal.html", appData.sysOpen);
399 char buf[2 * MSG_SIZ];
401 char *zippy = _(" (with Zippy code)");
405 snprintf(buf, sizeof(buf),
407 "Copyright 1991 Digital Equipment Corporation\n"
408 "Enhancements Copyright 1992-2012 Free Software Foundation\n"
409 "Enhancements Copyright 2005 Alessandro Scotti\n\n"
410 "%s is free software and carries NO WARRANTY;"
411 "see the file COPYING for more information.\n\n"
412 "Visit XBoard on the web at: http://www.gnu.org/software/xboard/\n"
413 "Check out the newest features at: http://www.gnu.org/software/xboard/whats_new.html\n\n"
414 "Report bugs via email at: <bug-xboard@gnu.org>\n\n"
416 programVersion, zippy, PACKAGE);
417 ErrorPopUp(_("About XBoard"), buf, FALSE);
423 appData.debugMode = !appData.debugMode;
433 # define MARK_MENU_ITEM(X,Y)
435 # define MARK_MENU_ITEM(X,Y) MarkMenuItem(X, Y)
439 PonderNextMoveProc ()
443 PonderNextMoveEvent(!appData.ponderNextMove);
444 MARK_MENU_ITEM("Ponder Next Move", appData.ponderNextMove);
450 appData.alwaysPromoteToQueen = !appData.alwaysPromoteToQueen;
451 MARK_MENU_ITEM("Always Queen", appData.alwaysPromoteToQueen);
455 AnimateDraggingProc ()
457 appData.animateDragging = !appData.animateDragging;
459 if (appData.animateDragging) CreateAnimVars();
460 MARK_MENU_ITEM("Animate Dragging", appData.animateDragging);
466 appData.animate = !appData.animate;
467 if (appData.animate) CreateAnimVars();
468 MARK_MENU_ITEM("Animate Moving", appData.animate);
474 appData.autoCallFlag = !appData.autoCallFlag;
475 MARK_MENU_ITEM("Auto Flag", appData.autoCallFlag);
481 appData.autoFlipView = !appData.autoFlipView;
482 MARK_MENU_ITEM("Auto Flip View", appData.autoFlipView);
488 appData.blindfold = !appData.blindfold;
489 MARK_MENU_ITEM("Blindfold", appData.blindfold);
490 DrawPosition(True, NULL);
496 appData.testLegality = !appData.testLegality;
497 MARK_MENU_ITEM("Test Legality", appData.testLegality);
504 if (appData.flashCount == 0) {
505 appData.flashCount = 3;
507 appData.flashCount = -appData.flashCount;
509 MARK_MENU_ITEM("Flash Moves", appData.flashCount > 0);
514 HighlightDraggingProc ()
516 appData.highlightDragging = !appData.highlightDragging;
517 MARK_MENU_ITEM("Highlight Dragging", appData.highlightDragging);
522 HighlightLastMoveProc ()
524 appData.highlightLastMove = !appData.highlightLastMove;
525 MARK_MENU_ITEM("Highlight Last Move", appData.highlightLastMove);
529 HighlightArrowProc ()
531 appData.highlightMoveWithArrow = !appData.highlightMoveWithArrow;
532 MARK_MENU_ITEM("Arrow", appData.highlightMoveWithArrow);
538 appData.icsAlarm = !appData.icsAlarm;
539 // MARK_MENU_ITEM("ICS Alarm", appData.icsAlarm);
545 appData.ringBellAfterMoves = !appData.ringBellAfterMoves;
546 MARK_MENU_ITEM("Move Sound", appData.ringBellAfterMoves);
552 appData.oneClick = !appData.oneClick;
553 MARK_MENU_ITEM("OneClick", appData.oneClick);
557 PeriodicUpdatesProc ()
559 PeriodicUpdatesEvent(!appData.periodicUpdates);
560 MARK_MENU_ITEM("Periodic Updates", appData.periodicUpdates);
564 PopupExitMessageProc ()
566 appData.popupExitMessage = !appData.popupExitMessage;
567 MARK_MENU_ITEM("Popup Exit Message", appData.popupExitMessage);
571 PopupMoveErrorsProc ()
573 appData.popupMoveErrors = !appData.popupMoveErrors;
574 MARK_MENU_ITEM("Popup Move Errors", appData.popupMoveErrors);
580 appData.premove = !appData.premove;
581 // MARK_MENU_ITEM("Premove", appData.premove);
587 appData.showCoords = !appData.showCoords;
588 MARK_MENU_ITEM("Show Coords", appData.showCoords);
589 DrawPosition(True, NULL);
595 appData.showThinking = !appData.showThinking; // [HGM] thinking: taken out of ShowThinkingEvent
604 appData.hideThinkingFromHuman = !appData.hideThinkingFromHuman; // [HGM] thinking: taken out of ShowThinkingEvent
607 MARK_MENU_ITEM("Hide Thinking", appData.hideThinkingFromHuman);
611 * Menu definition tables
614 MenuItem fileMenu[] = {
615 {N_("New Game Ctrl+N"), "New Game", ResetGameEvent},
616 {N_("New Shuffle Game ..."), "New Shuffle Game", ShuffleMenuProc},
617 {N_("New Variant ... Alt+Shift+V"), "New Variant", NewVariantProc}, // [HGM] variant: not functional yet
618 {"----", NULL, NothingProc},
619 {N_("Load Game Ctrl+O"), "Load Game", LoadGameProc},
620 {N_("Load Position Ctrl+Shift+O"), "Load Position", LoadPositionProc},
621 // {N_("Load Next Game"), "Load Next Game", LoadNextGameProc},
622 // {N_("Load Previous Game"), "Load Previous Game", LoadPrevGameProc},
623 // {N_("Reload Same Game"), "Reload Same Game", ReloadGameProc},
624 {N_("Next Position Shift+PgDn"), "Load Next Position", LoadNextPositionProc},
625 {N_("Prev Position Shift+PgUp"), "Load Previous Position", LoadPrevPositionProc},
626 {"----", NULL, NothingProc},
627 // {N_("Reload Same Position"), "Reload Same Position", ReloadPositionProc},
628 {N_("Save Game Ctrl+S"), "Save Game", SaveGameProc},
629 {N_("Save Position Ctrl+Shift+S"), "Save Position", SavePositionProc},
630 {"----", NULL, NothingProc},
631 {N_("Mail Move"), "Mail Move", MailMoveEvent},
632 {N_("Reload CMail Message"), "Reload CMail Message", ReloadCmailMsgProc},
633 {"----", NULL, NothingProc},
634 {N_("Quit Ctr+Q"), "Exit", QuitProc},
638 MenuItem editMenu[] = {
639 {N_("Copy Game Ctrl+C"), "Copy Game", CopyGameProc},
640 {N_("Copy Position Ctrl+Shift+C"), "Copy Position", CopyPositionProc},
641 {N_("Copy Game List"), "Copy Game List", CopyGameListProc},
642 {"----", NULL, NothingProc},
643 {N_("Paste Game Ctrl+V"), "Paste Game", PasteGameProc},
644 {N_("Paste Position Ctrl+Shift+V"), "Paste Position", PastePositionProc},
645 {"----", NULL, NothingProc},
646 {N_("Edit Game Ctrl+E"), "Edit Game 2", EditGameEvent},
647 {N_("Edit Position Ctrl+Shift+E"), "Edit Position 2", EditPositionEvent},
648 {N_("Edit Tags"), "Edit Tags", EditTagsProc},
649 {N_("Edit Comment"), "Edit Comment", EditCommentProc},
650 {N_("Edit Book"), "Edit Book", EditBookEvent},
651 {"----", NULL, NothingProc},
652 {N_("Revert Home"), "Revert", RevertProc},
653 {N_("Annotate"), "Annotate", AnnotateProc},
654 {N_("Truncate Game End"), "Truncate Game", TruncateGameEvent},
655 {"----", NULL, NothingProc},
656 {N_("Backward Alt+Left"), "Backward", BackwardEvent},
657 {N_("Forward Alt+Right"), "Forward", ForwardEvent},
658 {N_("Back to Start Alt+Home"), "Back to Start", ToStartEvent},
659 {N_("Forward to End Alt+End"), "Forward to End", ToEndEvent},
663 MenuItem viewMenu[] = {
664 {N_("Flip View F2"), "Flip View", FlipViewProc},
665 {"----", NULL, NothingProc},
666 {N_("Engine Output Alt+Shift+O"), "Show Engine Output", EngineOutputProc},
667 {N_("Move History Alt+Shift+H"), "Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
668 {N_("Evaluation Graph Alt+Shift+E"), "Show Evaluation Graph", EvalGraphProc},
669 {N_("Game List Alt+Shift+G"), "Show Game List", ShowGameListProc},
670 {N_("ICS text menu"), "ICStex", IcsTextProc},
671 {"----", NULL, NothingProc},
672 {N_("Tags"), "Show Tags", EditTagsProc},
673 {N_("Comments"), "Show Comments", EditCommentProc},
674 {N_("ICS Input Box"), "ICS Input Box", IcsInputBoxProc},
675 {"----", NULL, NothingProc},
676 {N_("Board..."), "Board Options", BoardOptionsProc},
677 {N_("Game List Tags..."), "Game List", GameListOptionsPopUp},
681 MenuItem modeMenu[] = {
682 {N_("Machine White Ctrl+W"), "Machine White", MachineWhiteEvent},
683 {N_("Machine Black Ctrl+B"), "Machine Black", MachineBlackEvent},
684 {N_("Two Machines Ctrl+T"), "Two Machines", TwoMachinesEvent},
685 {N_("Analysis Mode Ctrl+A"), "Analysis Mode", AnalyzeModeProc},
686 {N_("Analyze Game Ctrl+G"), "Analyze File", AnalyzeFileProc },
687 {N_("Edit Game Ctrl+E"), "Edit Game", EditGameEvent},
688 {N_("Edit Position Ctrl+Shift+E"), "Edit Position", EditPositionEvent},
689 {N_("Training"), "Training", TrainingEvent},
690 {N_("ICS Client"), "ICS Client", IcsClientEvent},
691 {"----", NULL, NothingProc},
692 {N_("Machine Match"), "Machine Match", MatchProc},
693 {N_("Pause Pause"), "Pause", PauseEvent},
697 MenuItem actionMenu[] = {
698 {N_("Accept F3"), "Accept", AcceptEvent},
699 {N_("Decline F4"), "Decline", DeclineEvent},
700 {N_("Rematch F12"), "Rematch", RematchEvent},
701 {"----", NULL, NothingProc},
702 {N_("Call Flag F5"), "Call Flag", CallFlagEvent},
703 {N_("Draw F6"), "Draw", DrawEvent},
704 {N_("Adjourn F7"), "Adjourn", AdjournEvent},
705 {N_("Abort F8"),"Abort", AbortEvent},
706 {N_("Resign F9"), "Resign", ResignEvent},
707 {"----", NULL, NothingProc},
708 {N_("Stop Observing F10"), "Stop Observing", StopObservingEvent},
709 {N_("Stop Examining F11"), "Stop Examining", StopExaminingEvent},
710 {N_("Upload to Examine"), "Upload to Examine", UploadGameEvent},
711 {"----", NULL, NothingProc},
712 {N_("Adjudicate to White"), "Adjudicate to White", AdjuWhiteProc},
713 {N_("Adjudicate to Black"), "Adjudicate to Black", AdjuBlackProc},
714 {N_("Adjudicate Draw"), "Adjudicate Draw", AdjuDrawProc},
718 MenuItem engineMenu[] = {
719 {N_("Load New Engine ..."), "Load Engine", LoadEngineProc},
720 {"----", NULL, NothingProc},
721 {N_("Engine #1 Settings ..."), "Engine #1 Settings", FirstSettingsProc},
722 {N_("Engine #2 Settings ..."), "Engine #2 Settings", SecondSettingsProc},
723 {"----", NULL, NothingProc},
724 {N_("Hint"), "Hint", HintEvent},
725 {N_("Book"), "Book", BookEvent},
726 {"----", NULL, NothingProc},
727 {N_("Move Now Ctrl+M"), "Move Now", MoveNowEvent},
728 {N_("Retract Move Ctrl+X"), "Retract Move", RetractMoveEvent},
732 MenuItem optionsMenu[] = {
734 {N_("General ..."), "General", OptionsProc},
736 {N_("Time Control ... Alt+Shift+T"), "Time Control", TimeControlProc},
737 {N_("Common Engine ... Alt+Shift+U"), "Common Engine", UciMenuProc},
738 {N_("Adjudications ... Alt+Shift+J"), "Adjudications", EngineMenuProc},
739 {N_("ICS ..."), "ICS", IcsOptionsProc},
740 {N_("Match ..."), "Match", MatchOptionsProc},
741 {N_("Load Game ..."), "Load Game", LoadOptionsProc},
742 {N_("Save Game ..."), "Save Game", SaveOptionsProc},
743 // {N_(" ..."), "", OptionsProc},
744 {N_("Game List ..."), "Game List", GameListOptionsPopUp},
745 {N_("Sounds ..."), "Sounds", SoundOptionsProc},
746 {"----", NULL, NothingProc},
747 #ifndef OPTIONSDIALOG
748 {N_("Always Queen Ctrl+Shift+Q"), "Always Queen", AlwaysQueenProc},
749 {N_("Animate Dragging"), "Animate Dragging", AnimateDraggingProc},
750 {N_("Animate Moving Ctrl+Shift+A"), "Animate Moving", AnimateMovingProc},
751 {N_("Auto Flag Ctrl+Shift+F"), "Auto Flag", AutoflagProc},
752 {N_("Auto Flip View"), "Auto Flip View", AutoflipProc},
753 {N_("Blindfold"), "Blindfold", BlindfoldProc},
754 {N_("Flash Moves"), "Flash Moves", FlashMovesProc},
756 {N_("Highlight Dragging"), "Highlight Dragging", HighlightDraggingProc},
758 {N_("Highlight Last Move"), "Highlight Last Move", HighlightLastMoveProc},
759 {N_("Highlight With Arrow"), "Arrow", HighlightArrowProc},
760 {N_("Move Sound"), "Move Sound", MoveSoundProc},
761 // {N_("ICS Alarm"), "ICS Alarm", IcsAlarmProc},
762 {N_("One-Click Moving"), "OneClick", OneClickProc},
763 {N_("Periodic Updates"), "Periodic Updates", PeriodicUpdatesProc},
764 {N_("Ponder Next Move Ctrl+Shift+P"), "Ponder Next Move", PonderNextMoveProc},
765 {N_("Popup Exit Message"), "Popup Exit Message", PopupExitMessageProc},
766 {N_("Popup Move Errors"), "Popup Move Errors", PopupMoveErrorsProc},
767 // {N_("Premove"), "Premove", PremoveProc},
768 {N_("Show Coords"), "Show Coords", ShowCoordsProc},
769 {N_("Hide Thinking Ctrl+Shift+H"), "Hide Thinking", HideThinkingProc},
770 {N_("Test Legality Ctrl+Shift+L"), "Test Legality", TestLegalityProc},
771 {"----", NULL, NothingProc},
773 {N_("Save Settings Now"), "Save Settings Now", SaveSettingsProc},
774 {N_("Save Settings on Exit"), "Save Settings on Exit", SaveOnExitProc},
778 MenuItem helpMenu[] = {
779 {N_("Info XBoard"), "Info XBoard", InfoProc},
780 {N_("Man XBoard F1"), "Man XBoard", ManProc},
781 {"----", NULL, NothingProc},
782 {N_("XBoard Home Page"), "Home Page", HomePageProc},
783 {N_("On-line User Guide"), "User Guide", GuideProc},
784 {N_("Development News"), "News Page", NewsPageProc},
785 {N_("e-Mail Bug Report"), "Bug Report", BugReportProc},
786 {"----", NULL, NothingProc},
787 {N_("About XBoard"), "About XBoard", AboutProc},
792 {N_("File"), "File", fileMenu},
793 {N_("Edit"), "Edit", editMenu},
794 {N_("View"), "View", viewMenu},
795 {N_("Mode"), "Mode", modeMenu},
796 {N_("Action"), "Action", actionMenu},
797 {N_("Engine"), "Engine", engineMenu},
798 {N_("Options"), "Options", optionsMenu},
799 {N_("Help"), "Help", helpMenu},
804 MenuToNumber(char *menuName)
807 for(i=0; i<nrOfMenuItems; i++)
808 if(!strcmp(menuName, menuItemList[i].name)) return i;
813 AppendEnginesToMenu (char *list)
818 if(appData.icsActive || appData.recentEngines <= 0) return;
819 recentEngines = strdup(list);
821 p = strchr(list, '\n'); if(p == NULL) break;
822 if(i == 0) AppendMenuItem("----", "----", NULL); // at least one valid item to add
824 AppendMenuItem(list, "recent", (MenuProc *) i);
825 i++; *p = '\n'; list = p + 1;
830 AddPullDownMenu (char *name, Menu *mb)
834 CreateMenuButton(name, mb);
837 while (mi->string != NULL) {
838 AppendMenuItem(mi->string, mi->ref, mi->proc);
839 menuItemList[nrOfMenuItems].name = mi->ref;
840 menuItemList[nrOfMenuItems].proc = mi->proc;
841 if(strcmp(mi->string, "----")) nrOfMenuItems++;
845 if(!strcmp(mb->name, "Engine")) AppendEnginesToMenu(appData.recentEngineList);
849 CreateMainMenus (Menu *mb)
851 char menuName[MSG_SIZ];
853 while(menuItemList[nrOfMenuItems].name) nrOfMenuItems++; // skip any predefined items
855 while (mb->name != NULL) {
856 safeStrCpy(menuName, "menu", sizeof(menuName)/sizeof(menuName[0]) );
857 strncat(menuName, mb->ref, MSG_SIZ - strlen(menuName) - 1);
858 AddPullDownMenu(menuName, mb++);
862 Enables icsEnables[] = {
863 { "Mail Move", False },
864 { "Reload CMail Message", False },
865 { "Machine Black", False },
866 { "Machine White", False },
867 { "Analysis Mode", False },
868 { "Analyze File", False },
869 { "Two Machines", False },
870 { "Machine Match", False },
874 { "Move Now", False },
875 #ifndef OPTIONSDIALOG
876 { "Periodic Updates", False },
877 { "Hide Thinking", False },
878 { "Ponder Next Move", False },
881 { "Engine #1 Settings", False },
882 { "Engine #2 Settings", False },
883 { "Load Engine", False },
884 { "Annotate", False },
889 Enables ncpEnables[] = {
890 { "Mail Move", False },
891 { "Reload CMail Message", False },
892 { "Machine White", False },
893 { "Machine Black", False },
894 { "Analysis Mode", False },
895 { "Analyze File", False },
896 { "Two Machines", False },
897 { "Machine Match", False },
898 { "ICS Client", False },
900 { "ICS Input Box", False },
903 { "Annotate", False },
904 { "Engine #1 Settings", False },
905 { "Engine #2 Settings", False },
906 { "Move Now", False },
907 { "Retract Move", False },
909 #ifndef OPTIONSDIALOG
910 { "Auto Flag", False },
911 { "Auto Flip View", False },
912 // { "ICS Alarm", False },
913 { "Move Sound", False },
914 { "Hide Thinking", False },
915 { "Periodic Updates", False },
916 { "Ponder Next Move", False },
923 Enables gnuEnables[] = {
924 { "ICS Client", False },
926 { "ICS Input Box", False },
928 { "Decline", False },
929 { "Rematch", False },
930 { "Adjourn", False },
931 { "Stop Examining", False },
932 { "Stop Observing", False },
933 { "Upload to Examine", False },
935 { "Annotate", False },
938 /* The next two options rely on SetCmailMode being called *after* */
939 /* SetGNUMode so that when GNU is being used to give hints these */
940 /* menu options are still available */
942 { "Mail Move", False },
943 { "Reload CMail Message", False },
944 // [HGM] The following have been added to make a switch from ncp to GNU mode possible
945 { "Machine White", True },
946 { "Machine Black", True },
947 { "Analysis Mode", True },
948 { "Analyze File", True },
949 { "Two Machines", True },
950 { "Machine Match", True },
951 { "Engine #1 Settings", True },
952 { "Engine #2 Settings", True },
955 { "Move Now", True },
956 { "Retract Move", True },
961 Enables cmailEnables[] = {
963 { "Call Flag", False },
965 { "Adjourn", False },
967 { "Stop Observing", False },
968 { "Stop Examining", False },
969 { "Mail Move", True },
970 { "Reload CMail Message", True },
974 Enables trainingOnEnables[] = {
975 { "Edit Comment", False },
977 { "Forward", False },
978 { "Backward", False },
979 { "Forward to End", False },
980 { "Back to Start", False },
981 { "Move Now", False },
982 { "Truncate Game", False },
986 Enables trainingOffEnables[] = {
987 { "Edit Comment", True },
990 { "Backward", True },
991 { "Forward to End", True },
992 { "Back to Start", True },
993 { "Move Now", True },
994 { "Truncate Game", True },
998 Enables machineThinkingEnables[] = {
999 { "Load Game", False },
1000 // { "Load Next Game", False },
1001 // { "Load Previous Game", False },
1002 // { "Reload Same Game", False },
1003 { "Paste Game", False },
1004 { "Load Position", False },
1005 // { "Load Next Position", False },
1006 // { "Load Previous Position", False },
1007 // { "Reload Same Position", False },
1008 { "Paste Position", False },
1009 { "Machine White", False },
1010 { "Machine Black", False },
1011 { "Two Machines", False },
1012 // { "Machine Match", False },
1013 { "Retract Move", False },
1017 Enables userThinkingEnables[] = {
1018 { "Load Game", True },
1019 // { "Load Next Game", True },
1020 // { "Load Previous Game", True },
1021 // { "Reload Same Game", True },
1022 { "Paste Game", True },
1023 { "Load Position", True },
1024 // { "Load Next Position", True },
1025 // { "Load Previous Position", True },
1026 // { "Reload Same Position", True },
1027 { "Paste Position", True },
1028 { "Machine White", True },
1029 { "Machine Black", True },
1030 { "Two Machines", True },
1031 // { "Machine Match", True },
1032 { "Retract Move", True },
1039 SetMenuEnables(icsEnables);
1042 if (appData.zippyPlay && !appData.noChessProgram) { /* [DM] icsEngineAnalyze */
1043 EnableMenuItem("Analysis Mode", True);
1044 EnableMenuItem("Engine #1 Settings", True);
1052 SetMenuEnables(ncpEnables);
1058 SetMenuEnables(gnuEnables);
1064 SetMenuEnables(cmailEnables);
1068 SetTrainingModeOn ()
1070 SetMenuEnables(trainingOnEnables);
1071 if (appData.showButtonBar) {
1072 EnableButtonBar(False);
1078 SetTrainingModeOff ()
1080 SetMenuEnables(trainingOffEnables);
1081 if (appData.showButtonBar) {
1082 EnableButtonBar(True);
1087 SetUserThinkingEnables ()
1089 if (appData.noChessProgram) return;
1090 SetMenuEnables(userThinkingEnables);
1094 SetMachineThinkingEnables ()
1096 if (appData.noChessProgram) return;
1097 SetMenuEnables(machineThinkingEnables);
1099 case MachinePlaysBlack:
1100 case MachinePlaysWhite:
1101 case TwoMachinesPlay:
1102 EnableMenuItem(ModeToWidgetName(gameMode), True);
1110 GreyRevert (Boolean grey)
1112 MarkMenuItem("Revert", !grey);
1113 MarkMenuItem("Annotate", !grey);
1117 ModeToWidgetName (GameMode mode)
1120 case BeginningOfGame:
1121 if (appData.icsActive)
1122 return "ICS Client";
1123 else if (appData.noChessProgram ||
1124 *appData.cmailGameName != NULLCHAR)
1127 return "Machine Black";
1128 case MachinePlaysBlack:
1129 return "Machine Black";
1130 case MachinePlaysWhite:
1131 return "Machine White";
1133 return "Analysis Mode";
1135 return "Analyze File";
1136 case TwoMachinesPlay:
1137 return "Two Machines";
1140 case PlayFromGameFile:
1143 return "Edit Position";
1146 case IcsPlayingWhite:
1147 case IcsPlayingBlack:
1151 return "ICS Client";
1161 #ifndef OPTIONSDIALOG
1162 if (appData.alwaysPromoteToQueen) {
1163 MarkMenuItem("Always Queen", True);
1165 if (appData.animateDragging) {
1166 MarkMenuItem("Animate Dragging", True);
1168 if (appData.animate) {
1169 MarkMenuItem("Animate Moving", True);
1171 if (appData.autoCallFlag) {
1172 MarkMenuItem("Auto Flag", True);
1174 if (appData.autoFlipView) {
1175 XtSetValues(XtNameToWidget(menuBarWidget,"Auto Flip View", True);
1177 if (appData.blindfold) {
1178 MarkMenuItem("Blindfold", True);
1180 if (appData.flashCount > 0) {
1181 MarkMenuItem("Flash Moves", True);
1184 if (appData.highlightDragging) {
1185 MarkMenuItem("Highlight Dragging", True);
1188 if (appData.highlightLastMove) {
1189 MarkMenuItem("Highlight Last Move", True);
1191 if (appData.highlightMoveWithArrow) {
1192 MarkMenuItem("Arrow", True);
1194 // if (appData.icsAlarm) {
1195 // MarkMenuItem("ICS Alarm", True);
1197 if (appData.ringBellAfterMoves) {
1198 MarkMenuItem("Move Sound", True);
1200 if (appData.oneClick) {
1201 MarkMenuItem("OneClick", True);
1203 if (appData.periodicUpdates) {
1204 MarkMenuItem("Periodic Updates", True);
1206 if (appData.ponderNextMove) {
1207 MarkMenuItem("Ponder Next Move", True);
1209 if (appData.popupExitMessage) {
1210 MarkMenuItem("Popup Exit Message", True);
1212 if (appData.popupMoveErrors) {
1213 MarkMenuItem("Popup Move Errors", True);
1215 // if (appData.premove) {
1216 // MarkMenuItem("Premove", True);
1218 if (appData.showCoords) {
1219 MarkMenuItem("Show Coords", True);
1221 if (appData.hideThinkingFromHuman) {
1222 MarkMenuItem("Hide Thinking", True);
1224 if (appData.testLegality) {
1225 MarkMenuItem("Test Legality", True);
1228 if (saveSettingsOnExit) {
1229 MarkMenuItem("Save Settings on Exit", True);