X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=495e35bf4e6aaa77e4d2f99fc1e3088e58a59169;hb=7c2013f04ebad72d894faf7b4768071925412f0b;hp=305010520d1c24062b7827e4495b0c8d8a340a88;hpb=357e76cac0dedc4522e0018b0fb49abbe879c4da;p=xboard.git diff --git a/xboard.c b/xboard.c index 3050105..495e35b 100644 --- a/xboard.c +++ b/xboard.c @@ -141,12 +141,6 @@ extern char *getenv(); # endif #endif - -# if HAVE_LIBREADLINE /* add gnu-readline support */ -#include -#include -# endif - #include #include #include @@ -231,11 +225,13 @@ void EvalGraphProc P((Widget w, XEvent *event, typedef struct { String string; + String ref; XtActionProc proc; } MenuItem; typedef struct { String name; + String ref; MenuItem *mi; } Menu; @@ -475,11 +471,6 @@ void SettingsPopDown P(()); void update_ics_width P(()); int get_term_width P(()); int CopyMemoProc P(()); - -# if HAVE_LIBREADLINE /* add gnu-readline support */ -static void ReadlineCompleteHandler P((char *)); -# endif - /* * XBoard depends on Xt R4 or higher */ @@ -515,13 +506,6 @@ FileProc fileProc; char *fileOpenMode; char installDir[] = "."; // [HGM] UCI: needed for UCI; probably needs run-time initializtion -# if HAVE_LIBREADLINE /* gnu readline support */ -static char* readline_buffer; -static int readline_complete=0; -extern int sending_ICS_login; -extern int sending_ICS_password; -#endif - Position commentX = -1, commentY = -1; Dimension commentW, commentH; typedef unsigned int BoardSize; @@ -608,166 +592,183 @@ static Pixmap xpmMask[BlackKing + 1]; SizeDefaults sizeDefaults[] = SIZE_DEFAULTS; MenuItem fileMenu[] = { - {N_("New Game"), ResetProc}, - {N_("New Shuffle Game ..."), ShuffleMenuProc}, - {N_("New Variant ..."), NewVariantProc}, // [HGM] variant: not functional yet - {"----", NothingProc}, - {N_("Load Game"), LoadGameProc}, - {N_("Load Next Game"), LoadNextGameProc}, - {N_("Load Previous Game"), LoadPrevGameProc}, - {N_("Reload Same Game"), ReloadGameProc}, - {N_("Save Game"), SaveGameProc}, - {"----", NothingProc}, - {N_("Copy Game"), CopyGameProc}, - {N_("Paste Game"), PasteGameProc}, - {"----", NothingProc}, - {N_("Load Position"), LoadPositionProc}, - {N_("Load Next Position"), LoadNextPositionProc}, - {N_("Load Previous Position"), LoadPrevPositionProc}, - {N_("Reload Same Position"), ReloadPositionProc}, - {N_("Save Position"), SavePositionProc}, - {"----", NothingProc}, - {N_("Copy Position"), CopyPositionProc}, - {N_("Paste Position"), PastePositionProc}, - {"----", NothingProc}, - {N_("Mail Move"), MailMoveProc}, - {N_("Reload CMail Message"), ReloadCmailMsgProc}, - {"----", NothingProc}, - {N_("Exit"), QuitProc}, - {NULL, NULL} + {"New Game", "New Game", ResetProc}, + {"New Shuffle Game ...", "New Shuffle Game", ShuffleMenuProc}, + {"New Variant ...", "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}, + {"----", 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}, + {"----", NULL, NothingProc}, + {"Mail Move", "Mail Move", MailMoveProc}, + {"Reload CMail Message", "Reload CMail Message", ReloadCmailMsgProc}, + {"----", NULL, NothingProc}, + {"Exit", "Exit", QuitProc}, + {NULL, NULL, NULL} +}; + +MenuItem editMenu[] = { + {"Copy Game", "Copy Game", CopyGameProc}, + {"Copy Position", "Copy Position", CopyPositionProc}, + {"----", NULL, NothingProc}, + {"Paste Game", "Paste Game", PasteGameProc}, + {"Paste Position", "Paste Position", PastePositionProc}, + {"----", NULL, NothingProc}, + {"Edit Game", "Edit Game", EditGameProc}, + {"Edit Position", "Edit Position", EditPositionProc}, + {"----", NULL, NothingProc}, + {"Edit Tags", "Edit Tags", EditTagsProc}, + {"Edit Comment", "Edit Comment", EditCommentProc}, + {"----", 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}, + {NULL, NULL, NULL} +}; + +MenuItem viewMenu[] = { + {"Flip View", "Flip View", FlipViewProc}, + {"----", NULL, NothingProc}, + {"Show Engine Output", "Show Engine Output", EngineOutputProc}, + {"Show Evaluation Graph", "Show Evaluation Graph", EvalGraphProc}, + {"Show Game List", "Show Game List", ShowGameListProc}, + {"Show Move History", "Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code + {"----", NULL, NothingProc}, + {"Show Tags", "Show Tags", EditTagsProc}, + {"Show Comments", "Show Comments", EditCommentProc}, + {"ICS Input Box", "ICS Input Box", IcsInputBoxProc}, + {NULL, NULL, NULL} }; MenuItem modeMenu[] = { - {N_("Machine White"), MachineWhiteProc}, - {N_("Machine Black"), MachineBlackProc}, - {N_("Two Machines"), TwoMachinesProc}, - {N_("Analysis Mode"), AnalyzeModeProc}, - {N_("Analyze File"), AnalyzeFileProc }, - {N_("ICS Client"), IcsClientProc}, - {N_("Edit Game"), EditGameProc}, - {N_("Edit Position"), EditPositionProc}, - {N_("Training"), TrainingProc}, - {"----", NothingProc}, - {N_("Show Engine Output"), EngineOutputProc}, - {N_("Show Evaluation Graph"), EvalGraphProc}, - {N_("Show Game List"), ShowGameListProc}, - {N_("Show Move History"), HistoryShowProc}, // [HGM] hist: activate 4.2.7 code - {"----", NothingProc}, - {N_("Edit Tags"), EditTagsProc}, - {N_("Edit Comment"), EditCommentProc}, - {N_("ICS Input Box"), IcsInputBoxProc}, - {N_("Pause"), PauseProc}, - {NULL, NULL} + {"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}, + {"----", NULL, NothingProc}, + {"Pause", "Pause", PauseProc}, + {NULL, NULL, NULL} }; MenuItem actionMenu[] = { - {N_("Accept"), AcceptProc}, - {N_("Decline"), DeclineProc}, - {N_("Rematch"), RematchProc}, - {"----", NothingProc}, - {N_("Call Flag"), CallFlagProc}, - {N_("Draw"), DrawProc}, - {N_("Adjourn"), AdjournProc}, - {N_("Abort"), AbortProc}, - {N_("Resign"), ResignProc}, - {"----", NothingProc}, - {N_("Stop Observing"), StopObservingProc}, - {N_("Stop Examining"), StopExaminingProc}, - {N_("Upload to Examine"), UploadProc}, - {"----", NothingProc}, - {N_("Adjudicate to White"), AdjuWhiteProc}, - {N_("Adjudicate to Black"), AdjuBlackProc}, - {N_("Adjudicate Draw"), AdjuDrawProc}, - {NULL, NULL} + {"Accept", "Accept", AcceptProc}, + {"Decline", "Decline", DeclineProc}, + {"Rematch", "Rematch", RematchProc}, + {"----", NULL, NothingProc}, + {"Call Flag", "Call Flag", CallFlagProc}, + {"Draw", "Draw", DrawProc}, + {"Adjourn", "Adjourn", AdjournProc}, + {"Abort", "Abort", AbortProc}, + {"Resign", "Resign", ResignProc}, + {"----", NULL, NothingProc}, + {"Stop Observing", "Stop Observing", StopObservingProc}, + {"Stop Examining", "Stop Examining", StopExaminingProc}, + {"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}, + {NULL, NULL, NULL} }; -MenuItem stepMenu[] = { - {N_("Backward"), BackwardProc}, - {N_("Forward"), ForwardProc}, - {N_("Back to Start"), ToStartProc}, - {N_("Forward to End"), ToEndProc}, - {N_("Revert"), RevertProc}, - {N_("Annotate"), AnnotateProc}, - {N_("Truncate Game"), TruncateGameProc}, - {"----", NothingProc}, - {N_("Move Now"), MoveNowProc}, - {N_("Retract Move"), RetractMoveProc}, - {NULL, NULL} +MenuItem engineMenu[] = { + {"Engine #1 Settings", "Engine #1 Settings", FirstSettingsProc}, + {"Engine #2 Settings", "Engine #2 Settings", SecondSettingsProc}, + {"----", NULL, NothingProc}, + {"Move Now", "Move Now", MoveNowProc}, + {"Retract Move", "Retract Move", RetractMoveProc}, + {NULL, NULL, NULL} }; MenuItem optionsMenu[] = { - {N_("Flip View"), FlipViewProc}, - {"----", NothingProc}, - {N_("Adjudications ..."), EngineMenuProc}, - {N_("General Settings ..."), UciMenuProc}, - {N_("Engine #1 Settings ..."), FirstSettingsProc}, - {N_("Engine #2 Settings ..."), SecondSettingsProc}, - {N_("Time Control ..."), TimeControlProc}, - {N_("Game List ..."), GameListOptionsPopUp}, - {"----", NothingProc}, - {N_("Always Queen"), AlwaysQueenProc}, - {N_("Animate Dragging"), AnimateDraggingProc}, - {N_("Animate Moving"), AnimateMovingProc}, - {N_("Auto Comment"), AutocommProc}, - {N_("Auto Flag"), AutoflagProc}, - {N_("Auto Flip View"), AutoflipProc}, - {N_("Auto Observe"), AutobsProc}, - {N_("Auto Raise Board"), AutoraiseProc}, - {N_("Auto Save"), AutosaveProc}, - {N_("Blindfold"), BlindfoldProc}, - {N_("Flash Moves"), FlashMovesProc}, - {N_("Get Move List"), GetMoveListProc}, + {"Time Control ...", "Time Control ...", TimeControlProc}, + {"Common Engine ...", "Common Engine ...", UciMenuProc}, + {"Adjudications ...", "Adjudications ...", EngineMenuProc}, + {"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}, #if HIGHDRAG - {N_("Highlight Dragging"), HighlightDraggingProc}, + {"Highlight Dragging", "Highlight Dragging", HighlightDraggingProc}, #endif - {N_("Highlight Last Move"), HighlightLastMoveProc}, - {N_("Move Sound"), MoveSoundProc}, - {N_("ICS Alarm"), IcsAlarmProc}, - {N_("Old Save Style"), OldSaveStyleProc}, - {N_("Periodic Updates"), PeriodicUpdatesProc}, - {N_("Ponder Next Move"), PonderNextMoveProc}, - {N_("Popup Exit Message"), PopupExitMessageProc}, - {N_("Popup Move Errors"), PopupMoveErrorsProc}, - {N_("Premove"), PremoveProc}, - {N_("Quiet Play"), QuietPlayProc}, - {N_("Show Coords"), ShowCoordsProc}, - {N_("Hide Thinking"), HideThinkingProc}, - {N_("Test Legality"), TestLegalityProc}, - {"----", NothingProc}, - {N_("Save Settings Now"), SaveSettingsProc}, - {N_("Save Settings on Exit"), SaveOnExitProc}, - {NULL, NULL} + {"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}, + {"----", NULL, NothingProc}, + {"Save Settings Now", "Save Settings Now", SaveSettingsProc}, + {"Save Settings on Exit", "Save Settings on Exit", SaveOnExitProc}, + {NULL, NULL, NULL} }; MenuItem helpMenu[] = { - {N_("Info XBoard"), InfoProc}, - {N_("Man XBoard"), ManProc}, - {"----", NothingProc}, - {N_("Hint"), HintProc}, - {N_("Book"), BookProc}, - {"----", NothingProc}, - {N_("About XBoard"), AboutProc}, - {NULL, NULL} + {"Info XBoard", "Info XBoard", InfoProc}, + {"Man XBoard", "Man XBoard", ManProc}, + {"----", NULL, NothingProc}, + {"Hint", "Hint", HintProc}, + {"Book", "Book", BookProc}, + {"----", NULL, NothingProc}, + {"About XBoard", "About XBoard", AboutProc}, + {NULL, NULL, NULL} }; Menu menuBar[] = { - {N_("File"), fileMenu}, - {N_("Mode"), modeMenu}, - {N_("Action"), actionMenu}, - {N_("Step"), stepMenu}, - {N_("Options"), optionsMenu}, - {N_("Help"), helpMenu}, - {NULL, NULL} + {"File", "File", fileMenu}, + {"Edit", "Edit", editMenu}, + {"View", "View", viewMenu}, + {"Mode", "Mode", modeMenu}, + {"Action", "Action", actionMenu}, + {"Engine", "Engine", engineMenu}, + {"Options", "Options", optionsMenu}, + {"Help", "Help", helpMenu}, + {NULL, NULL, NULL} }; -#define PAUSE_BUTTON N_("P") +#define PAUSE_BUTTON "P" MenuItem buttonBar[] = { - {"<<", ToStartProc}, - {"<", BackwardProc}, - {PAUSE_BUTTON, PauseProc}, - {">", ForwardProc}, - {">>", ToEndProc}, - {NULL, NULL} + {"<<", "<<", ToStartProc}, + {"<", "<", BackwardProc}, + {PAUSE_BUTTON, PAUSE_BUTTON, PauseProc}, + {">", ">", ForwardProc}, + {">>", ">>", ToEndProc}, + {NULL, NULL, NULL} }; #define PIECE_MENU_SIZE 18 @@ -1806,12 +1807,6 @@ main(argc, argv) setbuf(stdout, NULL); setbuf(stderr, NULL); debugFP = stderr; - -# if HAVE_LIBREADLINE - /* install gnu-readline handler */ - rl_callback_handler_install("> ", ReadlineCompleteHandler); - rl_readline_name="XBoard"; -# endif if(argc > 1 && (!strcmp(argv[1], "-v" ) || !strcmp(argv[1], "--version" ))) { printf("%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); @@ -2638,13 +2633,6 @@ ShutDownFrontEnd() if (saveSettingsOnExit) SaveSettings(settingsFileName); unlink(gameCopyFilename); unlink(gamePasteFilename); - -# if HAVE_LIBREADLINE - /* remove gnu-readline handler. */ - rl_callback_handler_remove(); -#endif - - return; } RETSIGTYPE TermSizeSigHandler(int sig) @@ -2740,15 +2728,15 @@ GreyRevert(grey) { Widget w; if (!menuBarWidget) return; - w = XtNameToWidget(menuBarWidget, "menuStep.Revert"); + w = XtNameToWidget(menuBarWidget, "menuEdit.Revert"); if (w == NULL) { - DisplayError("menuStep.Revert", 0); + DisplayError("menuEdit.Revert", 0); } else { XtSetSensitive(w, !grey); } - w = XtNameToWidget(menuBarWidget, "menuStep.Annotate"); + w = XtNameToWidget(menuBarWidget, "menuEdit.Annotate"); if (w == NULL) { - DisplayError("menuStep.Annotate", 0); + DisplayError("menuEdit.Annotate", 0); } else { XtSetSensitive(w, !grey); } @@ -2782,12 +2770,14 @@ Enables icsEnables[] = { #ifndef ZIPPY { "menuHelp.Hint", False }, { "menuHelp.Book", False }, - { "menuStep.Move Now", False }, + { "menuEngine.Move Now", False }, { "menuOptions.Periodic Updates", False }, { "menuOptions.Hide Thinking", False }, { "menuOptions.Ponder Next Move", False }, + { "menuEngine.Engine #1 Settings", False }, #endif - { "menuStep.Annotate", False }, + { "menuEngine.Engine #2 Settings", False }, + { "menuEdit.Annotate", False }, { NULL, False } }; @@ -2800,12 +2790,14 @@ Enables ncpEnables[] = { { "menuMode.Analyze File", False }, { "menuMode.Two Machines", False }, { "menuMode.ICS Client", False }, - { "menuMode.ICS Input Box", False }, + { "menuView.ICS Input Box", False }, { "Action", False }, - { "menuStep.Revert", False }, - { "menuStep.Annotate", False }, - { "menuStep.Move Now", False }, - { "menuStep.Retract Move", False }, + { "menuEdit.Revert", False }, + { "menuEdit.Annotate", False }, + { "menuEngine.Engine #1 Settings", False }, + { "menuEngine.Engine #2 Settings", False }, + { "menuEngine.Move Now", False }, + { "menuEngine.Retract Move", False }, { "menuOptions.Auto Comment", False }, { "menuOptions.Auto Flag", False }, { "menuOptions.Auto Flip View", False }, @@ -2825,7 +2817,7 @@ Enables ncpEnables[] = { Enables gnuEnables[] = { { "menuMode.ICS Client", False }, - { "menuMode.ICS Input Box", False }, + { "menuView.ICS Input Box", False }, { "menuAction.Accept", False }, { "menuAction.Decline", False }, { "menuAction.Rematch", False }, @@ -2833,8 +2825,8 @@ Enables gnuEnables[] = { { "menuAction.Stop Examining", False }, { "menuAction.Stop Observing", False }, { "menuAction.Upload to Examine", False }, - { "menuStep.Revert", False }, - { "menuStep.Annotate", False }, + { "menuEdit.Revert", False }, + { "menuEdit.Annotate", False }, { "menuOptions.Auto Comment", False }, { "menuOptions.Auto Observe", False }, { "menuOptions.Auto Raise Board", False }, @@ -2867,60 +2859,60 @@ Enables cmailEnables[] = { Enables trainingOnEnables[] = { { "menuMode.Edit Comment", False }, { "menuMode.Pause", False }, - { "menuStep.Forward", False }, - { "menuStep.Backward", False }, - { "menuStep.Forward to End", False }, - { "menuStep.Back to Start", False }, - { "menuStep.Move Now", False }, - { "menuStep.Truncate Game", False }, + { "menuEdit.Forward", False }, + { "menuEdit.Backward", False }, + { "menuEdit.Forward to End", False }, + { "menuEdit.Back to Start", False }, + { "menuEngine.Move Now", False }, + { "menuEdit.Truncate Game", False }, { NULL, False } }; Enables trainingOffEnables[] = { { "menuMode.Edit Comment", True }, { "menuMode.Pause", True }, - { "menuStep.Forward", True }, - { "menuStep.Backward", True }, - { "menuStep.Forward to End", True }, - { "menuStep.Back to Start", True }, - { "menuStep.Move Now", True }, - { "menuStep.Truncate Game", True }, + { "menuEdit.Forward", True }, + { "menuEdit.Backward", True }, + { "menuEdit.Forward to End", True }, + { "menuEdit.Back to Start", True }, + { "menuEngine.Move Now", True }, + { "menuEdit.Truncate Game", True }, { NULL, False } }; Enables machineThinkingEnables[] = { { "menuFile.Load Game", False }, - { "menuFile.Load Next Game", False }, - { "menuFile.Load Previous Game", False }, - { "menuFile.Reload Same Game", False }, - { "menuFile.Paste Game", False }, +// { "menuFile.Load Next Game", False }, +// { "menuFile.Load Previous Game", False }, +// { "menuFile.Reload Same Game", False }, + { "menuEdit.Paste Game", False }, { "menuFile.Load Position", False }, - { "menuFile.Load Next Position", False }, - { "menuFile.Load Previous Position", False }, - { "menuFile.Reload Same Position", False }, - { "menuFile.Paste Position", False }, +// { "menuFile.Load Next Position", False }, +// { "menuFile.Load Previous Position", False }, +// { "menuFile.Reload Same Position", False }, + { "menuEdit.Paste Position", False }, { "menuMode.Machine White", False }, { "menuMode.Machine Black", False }, { "menuMode.Two Machines", False }, - { "menuStep.Retract Move", False }, + { "menuEngine.Retract Move", False }, { NULL, False } }; Enables userThinkingEnables[] = { { "menuFile.Load Game", True }, - { "menuFile.Load Next Game", True }, - { "menuFile.Load Previous Game", True }, - { "menuFile.Reload Same Game", True }, - { "menuFile.Paste Game", True }, +// { "menuFile.Load Next Game", True }, +// { "menuFile.Load Previous Game", True }, +// { "menuFile.Reload Same Game", True }, + { "menuEdit.Paste Game", True }, { "menuFile.Load Position", True }, - { "menuFile.Load Next Position", True }, - { "menuFile.Load Previous Position", True }, - { "menuFile.Reload Same Position", True }, - { "menuFile.Paste Position", True }, +// { "menuFile.Load Next Position", True }, +// { "menuFile.Load Previous Position", True }, +// { "menuFile.Reload Same Position", True }, + { "menuEdit.Paste Position", True }, { "menuMode.Machine White", True }, { "menuMode.Machine Black", True }, { "menuMode.Two Machines", True }, - { "menuStep.Retract Move", True }, + { "menuEngine.Retract Move", True }, { NULL, False } }; @@ -3728,7 +3720,7 @@ void CreateMenuBarPopup(parent, name, mb) menu, args, j); } else { XtSetArg(args[j], XtNlabel, XtNewString(_(mi->string))); - entry = XtCreateManagedWidget(mi->string, smeBSBObjectClass, + entry = XtCreateManagedWidget(mi->ref, smeBSBObjectClass, menu, args, j+1); XtAddCallback(entry, XtNcallback, (XtCallbackProc) MenuBarSelect, @@ -3755,7 +3747,7 @@ Widget CreateMenuBar(mb) while (mb->name != NULL) { safeStrCpy(menuName, "menu", sizeof(menuName)/sizeof(menuName[0]) ); - strncat(menuName, mb->name, MSG_SIZ - strlen(menuName) - 1); + strncat(menuName, mb->ref, MSG_SIZ - strlen(menuName) - 1); j = 0; XtSetArg(args[j], XtNmenuName, XtNewString(menuName)); j++; if (tinyLayout) { @@ -4599,7 +4591,7 @@ void XDrawPosition(w, repaint, board) } if (!lastBoardValid[nr] || (nr == 0 && lastFlipView != flipView)) { XtSetArg(args[0], XtNleftBitmap, (flipView ? xMarkPixmap : None)); - XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Flip View"), + XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Flip View"), args, 1); } @@ -5047,7 +5039,9 @@ void EditCommentPopUp(index, title, text) editUp = True; j = 0; XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++; - XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Edit Comment"), + XtSetValues(XtNameToWidget(menuBarWidget, "menuEdit.Edit Comment"), + args, j); + XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Comments"), args, j); } @@ -5096,7 +5090,9 @@ void EditCommentPopDown() editUp = False; j = 0; XtSetArg(args[j], XtNleftBitmap, None); j++; - XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Edit Comment"), + XtSetValues(XtNameToWidget(menuBarWidget, "menuEdit.Edit Comment"), + args, j); + XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Comments"), args, j); } @@ -5133,7 +5129,7 @@ void ICSInputBoxPopUp() ICSInputBoxUp = True; j = 0; XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++; - XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.ICS Input Box"), + XtSetValues(XtNameToWidget(menuBarWidget, "menuView.ICS Input Box"), args, j); } @@ -5165,7 +5161,7 @@ void ICSInputBoxPopDown() ICSInputBoxUp = False; j = 0; XtSetArg(args[j], XtNleftBitmap, None); j++; - XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.ICS Input Box"), + XtSetValues(XtNameToWidget(menuBarWidget, "menuView.ICS Input Box"), args, j); } @@ -8167,98 +8163,16 @@ DoInputCallback(closure, source, xid) } q = is->buf; while (p < is->unused) { - *q++ = *p++; + *q++ = *p++; } is->unused = q; } else { -# if HAVE_LIBREADLINE - /* check if input is from stdin, if yes, use gnu-readline */ - if( is->fd==fileno(stdin) ) - { - /* to clear the line */ - printf("\r \r"); - - /* read from stdin */ - rl_callback_read_char(); - - /* redisplay the current line, check special case for login and password */ - if(sending_ICS_password) - { - int i; char buf[MSG_SIZ]; - - bzero(buf,MSG_SIZ); - - /* blank the password */ - count = strlen(rl_line_buffer); - if(count>MSG_SIZ-1) - { - printf("PROBLEM with readline\n"); - count=MSG_SIZ; - } - for(i=0;iINPUT_SOURCE_BUF_SIZE-1) - { - printf("PROBLEM with readline\n"); - count = INPUT_SOURCE_BUF_SIZE; - }; - strncpy(is->buf,readline_buffer,count); - is->buf[count]='\n';count++; - - /* reset gnu-readline state */ - free(readline_buffer); - readline_buffer=NULL; - readline_complete=0; - - if (count == -1) - error = errno; - else - error = 0; - (is->func)(is, is->closure, is->buf, count, error); - - /* are we done with the password? */ - if(sending_ICS_password) - sending_ICS_password=0; - if(sending_ICS_login) - sending_ICS_login=0; - } - } - else - { - /* input not from stdin, use default method */ - count = read(is->fd, is->buf, INPUT_SOURCE_BUF_SIZE); - if (count == -1) - error = errno; - else - error = 0; - (is->func)(is, is->closure, is->buf, count, error); - }; -#else /* no readline support */ - count = read(is->fd, is->buf, INPUT_SOURCE_BUF_SIZE); - if (count == -1) - error = errno; - else - error = 0; - (is->func)(is, is->closure, is->buf, count, error); -#endif - + count = read(is->fd, is->buf, INPUT_SOURCE_BUF_SIZE); + if (count == -1) + error = errno; + else + error = 0; + (is->func)(is, is->closure, is->buf, count, error); } } @@ -8314,36 +8228,28 @@ int OutputToProcess(pr, message, count, outError) ChildProc *cp = (ChildProc *) pr; int outCount; - if (pr == NoProc) { - if (appData.noJoin || !appData.useInternalWrap) - outCount = fwrite(message, 1, count, stdout); - else + if (appData.noJoin || !appData.useInternalWrap) + outCount = fwrite(message, 1, count, stdout); + else { - int width = get_term_width(); - int len = wrap(NULL, message, count, width, &line); - char *msg = malloc(len); - int dbgchk; - - if (!msg) - outCount = fwrite(message, 1, count, stdout); - else + int width = get_term_width(); + int len = wrap(NULL, message, count, width, &line); + char *msg = malloc(len); + int dbgchk; + + if (!msg) + outCount = fwrite(message, 1, count, stdout); + else { - dbgchk = wrap(msg, message, count, width, &line); - if (dbgchk != len && appData.debugMode) - fprintf(debugFP, "wrap(): dbgchk(%d) != len(%d)\n", dbgchk, len); - outCount = fwrite(msg, 1, dbgchk, stdout); - free(msg); + dbgchk = wrap(msg, message, count, width, &line); + if (dbgchk != len && appData.debugMode) + fprintf(debugFP, "wrap(): dbgchk(%d) != len(%d)\n", dbgchk, len); + outCount = fwrite(msg, 1, dbgchk, stdout); + free(msg); } } - -# if HAVE_LIBREADLINE - /* readline support */ - if(strlen(rl_line_buffer)) - printf("\n> %s",rl_line_buffer); -#endif - } else outCount = write(cp->fdTo, message, count); @@ -9186,18 +9092,3 @@ void NotifyFrontendLogin() { update_ics_width(); } - -# if HAVE_LIBREADLINE -static void -ReadlineCompleteHandler(char* ptr) -{ - /* make gnu-readline keep the history */ - readline_buffer = ptr; - readline_complete = 1; - - if (ptr && *ptr && !sending_ICS_password && !sending_ICS_login) - add_history(ptr); - - return; -} -#endif