X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=b66006a9c4a85b148e98684fe5e1b3f8b412747f;hb=7ea58805958618de5217dc5d20e93e5d7bd05e96;hp=7fabbe7adf1cd475e73a7bebe88ea61ce15458e8;hpb=9b3d8984b954d596013d413253460371e5f6d8bd;p=xboard.git diff --git a/xboard.c b/xboard.c index 7fabbe7..b66006a 100644 --- a/xboard.c +++ b/xboard.c @@ -592,172 +592,171 @@ static Pixmap xpmMask[BlackKing + 1]; SizeDefaults sizeDefaults[] = SIZE_DEFAULTS; MenuItem fileMenu[] = { - {"New Game", "New Game", ResetProc}, - {"New Shuffle Game ...", "New Shuffle Game", ShuffleMenuProc}, - {"New Variant ...", "New Variant", NewVariantProc}, // [HGM] variant: not functional yet + {N_("New Game Ctrl+N"), "New Game", ResetProc}, + {N_("New Shuffle Game ..."), "New Shuffle Game", ShuffleMenuProc}, + {N_("New Variant ... Alt+Shift+V"), "New Variant", NewVariantProc}, // [HGM] variant: not functional yet {"----", NULL, NothingProc}, - {"Load Game", "Load Game", LoadGameProc}, - {"Load Position", "Load Position", LoadPositionProc}, -// {"Load Next Game", "Load Next Game", LoadNextGameProc}, -// {"Load Previous Game", "Load Previous Game", LoadPrevGameProc}, -// {"Reload Same Game", "Reload Same Game", ReloadGameProc}, + {N_("Load Game Ctrl+O"), "Load Game", LoadGameProc}, + {N_("Load Position Ctrl+Shift+O"), "Load Position", LoadPositionProc}, +// {N_("Load Next Game"), "Load Next Game", LoadNextGameProc}, +// {N_("Load Previous Game"), "Load Previous Game", LoadPrevGameProc}, +// {N_("Reload Same Game"), "Reload Same Game", ReloadGameProc}, {"----", NULL, NothingProc}, -// {"Load Next Position", "Load Next Position", LoadNextPositionProc}, -// {"Load Previous Position", "Load Previous Position", LoadPrevPositionProc}, -// {"Reload Same Position", "Reload Same Position", ReloadPositionProc}, - {"Save Game", "Save Game", SaveGameProc}, - {"Save Position", "Save Position", SavePositionProc}, +// {N_("Load Next Position"), "Load Next Position", LoadNextPositionProc}, +// {N_("Load Previous Position"), "Load Previous Position", LoadPrevPositionProc}, +// {N_("Reload Same Position"), "Reload Same Position", ReloadPositionProc}, + {N_("Save Game Ctrl+S"), "Save Game", SaveGameProc}, + {N_("Save Position Ctrl+Shift+S"), "Save Position", SavePositionProc}, {"----", NULL, NothingProc}, - {"Mail Move", "Mail Move", MailMoveProc}, - {"Reload CMail Message", "Reload CMail Message", ReloadCmailMsgProc}, + {N_("Mail Move"), "Mail Move", MailMoveProc}, + {N_("Reload CMail Message"), "Reload CMail Message", ReloadCmailMsgProc}, {"----", NULL, NothingProc}, - {"Exit", "Exit", QuitProc}, + {N_("Quit Ctr+Q"), "Exit", QuitProc}, {NULL, NULL, NULL} }; MenuItem editMenu[] = { - {"Copy Game", "Copy Game", CopyGameProc}, - {"Copy Position", "Copy Position", CopyPositionProc}, + {N_("Copy Game Ctrl+C"), "Copy Game", CopyGameProc}, + {N_("Copy Position Ctrl+Shift+C"), "Copy Position", CopyPositionProc}, {"----", NULL, NothingProc}, - {"Paste Game", "Paste Game", PasteGameProc}, - {"Paste Position", "Paste Position", PastePositionProc}, + {N_("Paste Game Ctrl+V"), "Paste Game", PasteGameProc}, + {N_("Paste Position Ctrl+Shift+V"), "Paste Position", PastePositionProc}, {"----", NULL, NothingProc}, - {"Edit Game", "Edit Game", EditGameProc}, - {"Edit Position", "Edit Position", EditPositionProc}, + {N_("Edit Game Ctrl+E"), "Edit Game", EditGameProc}, + {N_("Edit Position Ctrl+Shift+E"), "Edit Position", EditPositionProc}, + {N_("Edit Tags"), "Edit Tags", EditTagsProc}, + {N_("Edit Comment"), "Edit Comment", EditCommentProc}, {"----", NULL, NothingProc}, - {"Edit Tags", "Edit Tags", EditTagsProc}, - {"Edit Comment", "Edit Comment", EditCommentProc}, + {N_("Revert Home"), "Revert", RevertProc}, + {N_("Annotate"), "Annotate", AnnotateProc}, + {N_("Truncate Game End"), "Truncate Game", TruncateGameProc}, {"----", NULL, NothingProc}, - {"Revert", "Revert", RevertProc}, - {"Annotate", "Annotate", AnnotateProc}, - {"Truncate Game", "Truncate Game", TruncateGameProc}, - {"----", NULL, NothingProc}, - {"Backward", "Backward", BackwardProc}, - {"Forward", "Forward", ForwardProc}, - {"Back to Start", "Back to Start", ToStartProc}, - {"Forward to End", "Forward to End", ToEndProc}, + {N_("Backward Alt+Left"), "Backward", BackwardProc}, + {N_("Forward Alt+Right"), "Forward", ForwardProc}, + {N_("Back to Start Alt+Home"), "Back to Start", ToStartProc}, + {N_("Forward to End Alt+End"), "Forward to End", ToEndProc}, {NULL, NULL, NULL} }; MenuItem viewMenu[] = { - {"Flip View", "Flip View", FlipViewProc}, + {N_("Flip View F2"), "Flip View", FlipViewProc}, {"----", NULL, NothingProc}, - {"Engine Output", "Show Engine Output", EngineOutputProc}, - {"Evaluation Graph", "Show Evaluation Graph", EvalGraphProc}, - {"Game List", "Show Game List", ShowGameListProc}, - {"Move History", "Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code + {N_("Engine Output Alt+Shift+O"), "Show Engine Output", EngineOutputProc}, + {N_("Move History Alt+Shift+H"), "Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code + {N_("Evaluation Graph Alt+Shift+E"), "Show Evaluation Graph", EvalGraphProc}, + {N_("Game List Alt+Shift+G"), "Show Game List", ShowGameListProc}, {"----", NULL, NothingProc}, - {"Tags", "Show Tags", EditTagsProc}, - {"Comments", "Show Comments", EditCommentProc}, - {"ICS Input Box", "ICS Input Box", IcsInputBoxProc}, + {N_("Tags"), "Show Tags", EditTagsProc}, + {N_("Comments"), "Show Comments", EditCommentProc}, + {N_("ICS Input Box"), "ICS Input Box", IcsInputBoxProc}, {NULL, NULL, NULL} }; MenuItem modeMenu[] = { - {"Machine White", "Machine White", MachineWhiteProc}, - {"Machine Black", "Machine Black", MachineBlackProc}, - {"Two Machines", "Two Machines", TwoMachinesProc}, - {"Analysis Mode", "Analysis Mode", AnalyzeModeProc}, - {"Analyze File", "Analyze File", AnalyzeFileProc }, - {"Edit Game", "Edit Game", EditGameProc}, - {"Edit Position", "Edit Position", EditPositionProc}, - {"Training", "Training", TrainingProc}, - {"ICS Client", "ICS Client", IcsClientProc}, + {N_("Machine White Ctrl+W"), "Machine White", MachineWhiteProc}, + {N_("Machine Black Ctrl+B"), "Machine Black", MachineBlackProc}, + {N_("Two Machines Ctrl+T"), "Two Machines", TwoMachinesProc}, + {N_("Analysis Mode Ctrl+A"), "Analysis Mode", AnalyzeModeProc}, + {N_("Analyze File Ctrl+F"), "Analyze File", AnalyzeFileProc }, + {N_("Edit Game Ctrl+E"), "Edit Game", EditGameProc}, + {N_("Edit Position Ctrl+Shift+E"), "Edit Position", EditPositionProc}, + {N_("Training"), "Training", TrainingProc}, + {N_("ICS Client"), "ICS Client", IcsClientProc}, {"----", NULL, NothingProc}, - {"Pause", "Pause", PauseProc}, + {N_("Pause Pause"), "Pause", PauseProc}, {NULL, NULL, NULL} }; MenuItem actionMenu[] = { - {"Accept", "Accept", AcceptProc}, - {"Decline", "Decline", DeclineProc}, - {"Rematch", "Rematch", RematchProc}, + {N_("Accept F3"), "Accept", AcceptProc}, + {N_("Decline F4"), "Decline", DeclineProc}, + {N_("Rematch F12"), "Rematch", RematchProc}, {"----", NULL, NothingProc}, - {"Call Flag", "Call Flag", CallFlagProc}, - {"Draw", "Draw", DrawProc}, - {"Adjourn", "Adjourn", AdjournProc}, - {"Abort", "Abort", AbortProc}, - {"Resign", "Resign", ResignProc}, + {N_("Call Flag F5"), "Call Flag", CallFlagProc}, + {N_("Draw F6"), "Draw", DrawProc}, + {N_("Adjourn F7"), "Adjourn", AdjournProc}, + {N_("Abort F8"),"Abort", AbortProc}, + {N_("Resign F9"), "Resign", ResignProc}, {"----", NULL, NothingProc}, - {"Stop Observing", "Stop Observing", StopObservingProc}, - {"Stop Examining", "Stop Examining", StopExaminingProc}, - {"Upload to Examine", "Upload to Examine", UploadProc}, + {N_("Stop Observing F10"), "Stop Observing", StopObservingProc}, + {N_("Stop Examining F11"), "Stop Examining", StopExaminingProc}, + {N_("Upload to Examine"), "Upload to Examine", UploadProc}, {"----", NULL, NothingProc}, - {"Adjudicate to White", "Adjudicate to White", AdjuWhiteProc}, - {"Adjudicate to Black", "Adjudicate to Black", AdjuBlackProc}, - {"Adjudicate Draw", "Adjudicate Draw", AdjuDrawProc}, + {N_("Adjudicate to White"), "Adjudicate to White", AdjuWhiteProc}, + {N_("Adjudicate to Black"), "Adjudicate to Black", AdjuBlackProc}, + {N_("Adjudicate Draw"), "Adjudicate Draw", AdjuDrawProc}, {NULL, NULL, NULL} }; MenuItem engineMenu[] = { - {"Engine #1 Settings ...", "Engine #1 Settings", FirstSettingsProc}, - {"Engine #2 Settings ...", "Engine #2 Settings", SecondSettingsProc}, + {N_("Engine #1 Settings ..."), "Engine #1 Settings", FirstSettingsProc}, + {N_("Engine #2 Settings ..."), "Engine #2 Settings", SecondSettingsProc}, + {"----", NULL, NothingProc}, + {N_("Hint"), "Hint", HintProc}, + {N_("Book"), "Book", BookProc}, {"----", NULL, NothingProc}, - {"Move Now", "Move Now", MoveNowProc}, - {"Retract Move", "Retract Move", RetractMoveProc}, + {N_("Move Now Ctrl+M"), "Move Now", MoveNowProc}, + {N_("Retract Move Ctrl+X"), "Retract Move", RetractMoveProc}, {NULL, NULL, NULL} }; MenuItem optionsMenu[] = { - {"Time Control ...", "Time Control", TimeControlProc}, - {"Common Engine ...", "Common Engine", UciMenuProc}, - {"Adjudications ...", "Adjudications", EngineMenuProc}, - {"Game List ...", "Game List", GameListOptionsPopUp}, + {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}, + {N_("Game List ..."), "Game List", GameListOptionsPopUp}, {"----", NULL, NothingProc}, - {"Always Queen", "Always Queen", AlwaysQueenProc}, - {"Animate Dragging", "Animate Dragging", AnimateDraggingProc}, - {"Animate Moving", "Animate Moving", AnimateMovingProc}, - {"Auto Comment", "Auto Comment", AutocommProc}, - {"Auto Flag", "Auto Flag", AutoflagProc}, - {"Auto Flip View", "Auto Flip View", AutoflipProc}, - {"Auto Observe", "Auto Observe", AutobsProc}, - {"Auto Raise Board", "Auto Raise Board", AutoraiseProc}, - {"Auto Save", "Auto Save", AutosaveProc}, - {"Blindfold", "Blindfold", BlindfoldProc}, - {"Flash Moves", "Flash Moves", FlashMovesProc}, - {"Get Move List", "Get Move List", GetMoveListProc}, + {N_("Always Queen Ctrl+Shift+Q"), "Always Queen", AlwaysQueenProc}, + {N_("Animate Dragging"), "Animate Dragging", AnimateDraggingProc}, + {N_("Animate Moving Ctrl+Shift+A"), "Animate Moving", AnimateMovingProc}, + {N_("Auto Comment"), "Auto Comment", AutocommProc}, + {N_("Auto Flag Ctrl+Shift+F"), "Auto Flag", AutoflagProc}, + {N_("Auto Flip View"), "Auto Flip View", AutoflipProc}, + {N_("Auto Observe"), "Auto Observe", AutobsProc}, + {N_("Auto Raise Board"), "Auto Raise Board", AutoraiseProc}, + {N_("Auto Save"), "Auto Save", AutosaveProc}, + {N_("Blindfold"), "Blindfold", BlindfoldProc}, + {N_("Flash Moves"), "Flash Moves", FlashMovesProc}, + {N_("Get Move List"), "Get Move List", GetMoveListProc}, #if HIGHDRAG - {"Highlight Dragging", "Highlight Dragging", HighlightDraggingProc}, + {N_("Highlight Dragging"), "Highlight Dragging", HighlightDraggingProc}, #endif - {"Highlight Last Move", "Highlight Last Move", HighlightLastMoveProc}, - {"Move Sound", "Move Sound", MoveSoundProc}, - {"ICS Alarm", "ICS Alarm", IcsAlarmProc}, - {"Old Save Style", "Old Save Style", OldSaveStyleProc}, - {"Periodic Updates", "Periodic Updates", PeriodicUpdatesProc}, - {"Ponder Next Move", "Ponder Next Move", PonderNextMoveProc}, - {"Popup Exit Message", "Popup Exit Message", PopupExitMessageProc}, - {"Popup Move Errors", "Popup Move Errors", PopupMoveErrorsProc}, - {"Premove", "Premove", PremoveProc}, - {"Quiet Play", "Quiet Play", QuietPlayProc}, - {"Show Coords", "Show Coords", ShowCoordsProc}, - {"Hide Thinking", "Hide Thinking", HideThinkingProc}, - {"Test Legality", "Test Legality", TestLegalityProc}, + {N_("Highlight Last Move"), "Highlight Last Move", HighlightLastMoveProc}, + {N_("Move Sound"), "Move Sound", MoveSoundProc}, + {N_("ICS Alarm"), "ICS Alarm", IcsAlarmProc}, + {N_("Old Save Style"), "Old Save Style", OldSaveStyleProc}, + {N_("Periodic Updates"), "Periodic Updates", PeriodicUpdatesProc}, + {N_("Ponder Next Move Ctrl+Shift+P"), "Ponder Next Move", PonderNextMoveProc}, + {N_("Popup Exit Message"), "Popup Exit Message", PopupExitMessageProc}, + {N_("Popup Move Errors"), "Popup Move Errors", PopupMoveErrorsProc}, + {N_("Premove"), "Premove", PremoveProc}, + {N_("Quiet Play"), "Quiet Play", QuietPlayProc}, + {N_("Show Coords"), "Show Coords", ShowCoordsProc}, + {N_("Hide Thinking Ctrl+Shift+H"), "Hide Thinking", HideThinkingProc}, + {N_("Test Legality Ctrl+Shift+L"), "Test Legality", TestLegalityProc}, {"----", NULL, NothingProc}, - {"Save Settings Now", "Save Settings Now", SaveSettingsProc}, - {"Save Settings on Exit", "Save Settings on Exit", SaveOnExitProc}, + {N_("Save Settings Now"), "Save Settings Now", SaveSettingsProc}, + {N_("Save Settings on Exit"), "Save Settings on Exit", SaveOnExitProc}, {NULL, NULL, NULL} }; MenuItem helpMenu[] = { - {"Info XBoard", "Info XBoard", InfoProc}, - {"Man XBoard", "Man XBoard", ManProc}, - {"----", NULL, NothingProc}, - {"Hint", "Hint", HintProc}, - {"Book", "Book", BookProc}, + {N_("Info XBoard"), "Info XBoard", InfoProc}, + {N_("Man XBoard F1"), "Man XBoard", ManProc}, {"----", NULL, NothingProc}, - {"About XBoard", "About XBoard", AboutProc}, + {N_("About XBoard"), "About XBoard", AboutProc}, {NULL, NULL, NULL} }; Menu menuBar[] = { - {"File", "File", fileMenu}, - {"Edit", "Edit", editMenu}, - {"View", "View", viewMenu}, - {"Mode", "Mode", modeMenu}, - {"Action", "Action", actionMenu}, - {"Engine", "Engine", engineMenu}, - {"Options", "Options", optionsMenu}, - {"Help", "Help", helpMenu}, + {N_("File"), "File", fileMenu}, + {N_("Edit"), "Edit", editMenu}, + {N_("View"), "View", viewMenu}, + {N_("Mode"), "Mode", modeMenu}, + {N_("Action"), "Action", actionMenu}, + {N_("Engine"), "Engine", engineMenu}, + {N_("Options"), "Options", optionsMenu}, + {N_("Help"), "Help", helpMenu}, {NULL, NULL, NULL} }; @@ -1060,6 +1059,8 @@ char globalTranslations[] = :MetaRight: ForwardProc() \n \ :MetaHome: ToStartProc() \n \ :MetaLeft: BackwardProc() \n \ + :Home: RevertProc() \n \ + :End: TruncateGameProc() \n \ :Ctrlm: MoveNowProc() \n \ :Ctrlx: RetractMoveProc() \n \ :MetaJ: EngineMenuProc() \n \ @@ -2768,8 +2769,8 @@ Enables icsEnables[] = { { "menuMode.Analyze File", False }, { "menuMode.Two Machines", False }, #ifndef ZIPPY - { "menuHelp.Hint", False }, - { "menuHelp.Book", False }, + { "menuEngine.Hint", False }, + { "menuEngine.Book", False }, { "menuEngine.Move Now", False }, { "menuOptions.Periodic Updates", False }, { "menuOptions.Hide Thinking", False }, @@ -2810,8 +2811,8 @@ Enables ncpEnables[] = { { "menuOptions.Hide Thinking", False }, { "menuOptions.Periodic Updates", False }, { "menuOptions.Ponder Next Move", False }, - { "menuHelp.Hint", False }, - { "menuHelp.Book", False }, + { "menuEngine.Hint", False }, + { "menuEngine.Book", False }, { NULL, False } }; @@ -2988,50 +2989,50 @@ SetMachineThinkingEnables() } // [HGM] code borrowed from winboard.c (which should thus go to backend.c!) -#define HISTORY_SIZE 64 -static char *history[HISTORY_SIZE]; -int histIn = 0, histP = 0; - -void -SaveInHistory(char *cmd) -{ - if (history[histIn] != NULL) { - free(history[histIn]); - history[histIn] = NULL; - } - if (*cmd == NULLCHAR) return; - history[histIn] = StrSave(cmd); - histIn = (histIn + 1) % HISTORY_SIZE; - if (history[histIn] != NULL) { - free(history[histIn]); - history[histIn] = NULL; - } - histP = histIn; -} - -char * -PrevInHistory(char *cmd) -{ - int newhp; - if (histP == histIn) { - if (history[histIn] != NULL) free(history[histIn]); - history[histIn] = StrSave(cmd); - } - newhp = (histP - 1 + HISTORY_SIZE) % HISTORY_SIZE; - if (newhp == histIn || history[newhp] == NULL) return NULL; - histP = newhp; - return history[histP]; -} - -char * -NextInHistory() -{ - if (histP == histIn) return NULL; - histP = (histP + 1) % HISTORY_SIZE; - return history[histP]; -} -// end of borrowed code - +#define HISTORY_SIZE 64 +static char *history[HISTORY_SIZE]; +int histIn = 0, histP = 0; + +void +SaveInHistory(char *cmd) +{ + if (history[histIn] != NULL) { + free(history[histIn]); + history[histIn] = NULL; + } + if (*cmd == NULLCHAR) return; + history[histIn] = StrSave(cmd); + histIn = (histIn + 1) % HISTORY_SIZE; + if (history[histIn] != NULL) { + free(history[histIn]); + history[histIn] = NULL; + } + histP = histIn; +} + +char * +PrevInHistory(char *cmd) +{ + int newhp; + if (histP == histIn) { + if (history[histIn] != NULL) free(history[histIn]); + history[histIn] = StrSave(cmd); + } + newhp = (histP - 1 + HISTORY_SIZE) % HISTORY_SIZE; + if (newhp == histIn || history[newhp] == NULL) return NULL; + histP = newhp; + return history[histP]; +} + +char * +NextInHistory() +{ + if (histP == histIn) return NULL; + histP = (histP + 1) % HISTORY_SIZE; + return history[histP]; +} +// end of borrowed code + #define Abs(n) ((n)<0 ? -(n) : (n)) /* @@ -3719,7 +3720,7 @@ void CreateMenuBarPopup(parent, name, mb) entry = XtCreateManagedWidget(mi->string, smeLineObjectClass, menu, args, j); } else { - XtSetArg(args[j], XtNlabel, XtNewString(_(mi->string))); + XtSetArg(args[j], XtNlabel, XtNewString(mi->string)); entry = XtCreateManagedWidget(mi->ref, smeBSBObjectClass, menu, args, j+1); XtAddCallback(entry, XtNcallback, @@ -3752,12 +3753,12 @@ Widget CreateMenuBar(mb) XtSetArg(args[j], XtNmenuName, XtNewString(menuName)); j++; if (tinyLayout) { char shortName[2]; - shortName[0] = _(mb->name)[0]; + shortName[0] = mb->name[0]; shortName[1] = NULLCHAR; XtSetArg(args[j], XtNlabel, XtNewString(shortName)); j++; } else { - XtSetArg(args[j], XtNlabel, XtNewString(_(mb->name))); j++; + XtSetArg(args[j], XtNlabel, XtNewString(mb->name)); j++; } XtSetArg(args[j], XtNborderWidth, 0); j++; @@ -3997,7 +3998,7 @@ static void drawHighlight(file, rank, gc) { int x, y; - if (lineGap == 0 || appData.blindfold) return; + if (lineGap == 0) return; if (flipView) { x = lineGap/2 + ((BOARD_WIDTH-1)-file) * @@ -4454,7 +4455,7 @@ void EventProc(widget, unused, event) } break; case MotionNotify: - if(SeekGraphClick(Press, event->xbutton.x, event->xbutton.y, 1)) break; + if(SeekGraphClick(Press, event->xbutton.x, event->xbutton.y, 1)) break; default: return; }