X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=ca4e21214321d0607617be59fc964766b8a56ec4;hb=6cd4f34939954bac0c17c4aae88c4f7287f600d8;hp=59796c7de7aa1a5fce515f327e4f25ccc2169dc1;hpb=d098a3196db8758737f6a79992b460306045d499;p=xboard.git diff --git a/xboard.c b/xboard.c index 59796c7..ca4e212 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 @@ -475,11 +469,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 +504,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,159 +590,176 @@ 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 + {"New Game", ResetProc}, + {"New Shuffle Game ...", ShuffleMenuProc}, + {"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}, + {"Load Game", LoadGameProc}, + {"Load Position", LoadPositionProc}, +// {"Load Next Game", LoadNextGameProc}, +// {"Load Previous Game", LoadPrevGameProc}, +// {"Reload Same Game", ReloadGameProc}, {"----", NothingProc}, - {N_("Copy Game"), CopyGameProc}, - {N_("Paste Game"), PasteGameProc}, +// {"Load Next Position", LoadNextPositionProc}, +// {"Load Previous Position", LoadPrevPositionProc}, +// {"Reload Same Position", ReloadPositionProc}, + {"Save Game", SaveGameProc}, + {"Save Position", SavePositionProc}, {"----", NothingProc}, - {N_("Load Position"), LoadPositionProc}, - {N_("Load Next Position"), LoadNextPositionProc}, - {N_("Load Previous Position"), LoadPrevPositionProc}, - {N_("Reload Same Position"), ReloadPositionProc}, - {N_("Save Position"), SavePositionProc}, + {"Mail Move", MailMoveProc}, + {"Reload CMail Message", ReloadCmailMsgProc}, {"----", NothingProc}, - {N_("Copy Position"), CopyPositionProc}, - {N_("Paste Position"), PastePositionProc}, + {"Exit", QuitProc}, + {NULL, NULL} +}; + +MenuItem editMenu[] = { + {"Copy Game", CopyGameProc}, + {"Copy Position", CopyPositionProc}, + {"----", NothingProc}, + {"Paste Game", PasteGameProc}, + {"Paste Position", PastePositionProc}, {"----", NothingProc}, - {N_("Mail Move"), MailMoveProc}, - {N_("Reload CMail Message"), ReloadCmailMsgProc}, + {"Edit Game", EditGameProc}, + {"Edit Position", EditPositionProc}, {"----", NothingProc}, - {N_("Exit"), QuitProc}, + {"Edit Tags", EditTagsProc}, + {"Edit Comment", EditCommentProc}, + {"----", NothingProc}, + {"Revert", RevertProc}, + {"Annotate", AnnotateProc}, + {"Truncate Game", TruncateGameProc}, + {"----", NothingProc}, + {"Backward", BackwardProc}, + {"Forward", ForwardProc}, + {"Back to Start", ToStartProc}, + {"Forward to End", ToEndProc}, {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}, +MenuItem viewMenu[] = { + {"Flip View", FlipViewProc}, {"----", 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 + {"Show Engine Output", EngineOutputProc}, + {"Show Evaluation Graph", EvalGraphProc}, + {"Show Game List", ShowGameListProc}, + {"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}, + {"Show Tags", EditTagsProc}, + {"Show Comments", EditCommentProc}, + {"ICS Input Box", IcsInputBoxProc}, + {NULL, NULL} +}; + +MenuItem modeMenu[] = { + {"Machine White", MachineWhiteProc}, + {"Machine Black", MachineBlackProc}, + {"Two Machines", TwoMachinesProc}, + {"Analysis Mode", AnalyzeModeProc}, + {"Analyze File", AnalyzeFileProc }, + {"Edit Game", EditGameProc}, + {"Edit Position", EditPositionProc}, + {"Training", TrainingProc}, + {"ICS Client", IcsClientProc}, + {"----", NothingProc}, + {"Pause", PauseProc}, {NULL, NULL} }; MenuItem actionMenu[] = { - {N_("Accept"), AcceptProc}, - {N_("Decline"), DeclineProc}, - {N_("Rematch"), RematchProc}, + {"Accept", AcceptProc}, + {"Decline", DeclineProc}, + {"Rematch", RematchProc}, {"----", NothingProc}, - {N_("Call Flag"), CallFlagProc}, - {N_("Draw"), DrawProc}, - {N_("Adjourn"), AdjournProc}, - {N_("Abort"), AbortProc}, - {N_("Resign"), ResignProc}, + {"Call Flag", CallFlagProc}, + {"Draw", DrawProc}, + {"Adjourn", AdjournProc}, + {"Abort", AbortProc}, + {"Resign", ResignProc}, {"----", NothingProc}, - {N_("Stop Observing"), StopObservingProc}, - {N_("Stop Examining"), StopExaminingProc}, - {N_("Upload to Examine"), UploadProc}, + {"Stop Observing", StopObservingProc}, + {"Stop Examining", StopExaminingProc}, + {"Upload to Examine", UploadProc}, {"----", NothingProc}, - {N_("Adjudicate to White"), AdjuWhiteProc}, - {N_("Adjudicate to Black"), AdjuBlackProc}, - {N_("Adjudicate Draw"), AdjuDrawProc}, + {"Adjudicate to White", AdjuWhiteProc}, + {"Adjudicate to Black", AdjuBlackProc}, + {"Adjudicate Draw", AdjuDrawProc}, {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}, +MenuItem engineMenu[] = { + {"Engine #1 Settings", FirstSettingsProc}, + {"Engine #2 Settings", SecondSettingsProc}, {"----", NothingProc}, - {N_("Move Now"), MoveNowProc}, - {N_("Retract Move"), RetractMoveProc}, + {"Move Now", MoveNowProc}, + {"Retract Move", RetractMoveProc}, {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}, + {"Time Control ...", TimeControlProc}, + {"Common Engine ...", UciMenuProc}, + {"Adjudications ...", EngineMenuProc}, + {"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}, + {"Always Queen", AlwaysQueenProc}, + {"Animate Dragging", AnimateDraggingProc}, + {"Animate Moving", AnimateMovingProc}, + {"Auto Comment", AutocommProc}, + {"Auto Flag", AutoflagProc}, + {"Auto Flip View", AutoflipProc}, + {"Auto Observe", AutobsProc}, + {"Auto Raise Board", AutoraiseProc}, + {"Auto Save", AutosaveProc}, + {"Blindfold", BlindfoldProc}, + {"Flash Moves", FlashMovesProc}, + {"Get Move List", GetMoveListProc}, #if HIGHDRAG - {N_("Highlight Dragging"), HighlightDraggingProc}, + {"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}, + {"Highlight Last Move", HighlightLastMoveProc}, + {"Move Sound", MoveSoundProc}, + {"ICS Alarm", IcsAlarmProc}, + {"Old Save Style", OldSaveStyleProc}, + {"Periodic Updates", PeriodicUpdatesProc}, + {"Ponder Next Move", PonderNextMoveProc}, + {"Popup Exit Message", PopupExitMessageProc}, + {"Popup Move Errors", PopupMoveErrorsProc}, + {"Premove", PremoveProc}, + {"Quiet Play", QuietPlayProc}, + {"Show Coords", ShowCoordsProc}, + {"Hide Thinking", HideThinkingProc}, + {"Test Legality", TestLegalityProc}, {"----", NothingProc}, - {N_("Save Settings Now"), SaveSettingsProc}, - {N_("Save Settings on Exit"), SaveOnExitProc}, + {"Save Settings Now", SaveSettingsProc}, + {"Save Settings on Exit", SaveOnExitProc}, {NULL, NULL} }; MenuItem helpMenu[] = { - {N_("Info XBoard"), InfoProc}, - {N_("Man XBoard"), ManProc}, + {"Info XBoard", InfoProc}, + {"Man XBoard", ManProc}, {"----", NothingProc}, - {N_("Hint"), HintProc}, - {N_("Book"), BookProc}, + {"Hint", HintProc}, + {"Book", BookProc}, {"----", NothingProc}, - {N_("About XBoard"), AboutProc}, + {"About XBoard", AboutProc}, {NULL, NULL} }; Menu menuBar[] = { - {N_("File"), fileMenu}, - {N_("Mode"), modeMenu}, - {N_("Action"), actionMenu}, - {N_("Step"), stepMenu}, - {N_("Options"), optionsMenu}, - {N_("Help"), helpMenu}, + {"File", fileMenu}, + {"Edit", editMenu}, + {"View", viewMenu}, + {"Mode", modeMenu}, + {"Action", actionMenu}, + {"Engine", engineMenu}, + {"Options", optionsMenu}, + {"Help", helpMenu}, {NULL, NULL} }; -#define PAUSE_BUTTON N_("P") +#define PAUSE_BUTTON "P" MenuItem buttonBar[] = { {"<<", ToStartProc}, {"<", BackwardProc}, @@ -1731,6 +1730,10 @@ void InitDrawingSizes(BoardSize boardSize, int flags) xpmPieceBitmap[i][(int)WhiteMarshall] = xpmPieceBitmap2[i][(int)WhiteSilver]; } #endif + if(gameInfo.variant == VariantSChess && (squareSize == 49 || squareSize == 72)) { + xpmPieceBitmap[i][(int)WhiteAngel] = xpmPieceBitmap2[i][(int)WhiteFalcon]; + xpmPieceBitmap[i][(int)WhiteMarshall] = xpmPieceBitmap2[i][(int)WhiteAlfil]; + } #if !HAVE_LIBXPM // [HGM] why are thee ximMasks used at all? the ximPieceBitmaps seem to be never used! for(p=0; p<=(int)WhiteKing; p++) @@ -1747,6 +1750,10 @@ void InitDrawingSizes(BoardSize boardSize, int flags) ximMaskPm[(int)WhiteMarshall] = ximMaskPm2[(int)WhiteSilver]; } #endif + if(gameInfo.variant == VariantSChess && (squareSize == 49 || squareSize == 72)) { + ximMaskPm[(int)WhiteAngel] = ximMaskPm2[(int)WhiteFalcon]; + ximMaskPm[(int)WhiteMarshall] = ximMaskPm2[(int)WhiteAlfil]; + } #endif } } else { @@ -1766,6 +1773,10 @@ void InitDrawingSizes(BoardSize boardSize, int flags) pieceBitmap[i][(int)WhiteMarshall] = pieceBitmap2[i][(int)WhiteSilver]; } #endif + if(gameInfo.variant == VariantSChess && (squareSize == 49 || squareSize == 72)) { + pieceBitmap[i][(int)WhiteAngel] = pieceBitmap2[i][(int)WhiteFalcon]; + pieceBitmap[i][(int)WhiteMarshall] = pieceBitmap2[i][(int)WhiteAlfil]; + } } } #if HAVE_LIBXPM @@ -1794,12 +1805,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); @@ -2626,13 +2631,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) @@ -2728,15 +2726,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); } @@ -2770,12 +2768,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 } }; @@ -2788,12 +2788,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 }, @@ -2813,7 +2815,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 }, @@ -2821,8 +2823,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 }, @@ -2855,60 +2857,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 } }; @@ -4587,7 +4589,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); } @@ -5035,7 +5037,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); } @@ -5084,7 +5088,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); } @@ -5121,7 +5127,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); } @@ -5153,7 +5159,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); } @@ -5431,7 +5437,7 @@ void PromotionCallback(w, client_data, call_data) } else if (strcmp(name, _("Knight")) == 0) { promoChar = 'n'; } else if (strcmp(name, _("Promote")) == 0) { - promoChar = '^'; + promoChar = '+'; } else if (strcmp(name, _("Defer")) == 0) { promoChar = '='; } else { @@ -5815,7 +5821,7 @@ SendPositionSelection(Widget w, Atom *selection, Atom *target, * automatically call XtFree on the value returned. So have to * make a copy of it allocated with XtMalloc */ selection_tmp= XtMalloc(strlen(selected_fen_position)+16); - safeStrCpy(selection_tmp, selected_fen_position, sizeof(selection_tmp)/sizeof(selection_tmp[0]) ); + safeStrCpy(selection_tmp, selected_fen_position, strlen(selected_fen_position)+16 ); *value_return=selection_tmp; *length_return=strlen(selection_tmp); @@ -7609,7 +7615,7 @@ ExpandPathName(path) } else { safeStrCpy(buf, s+1, sizeof(buf)/sizeof(buf[0]) ); - *strchr(buf, '/') = 0; + { char *p; if(p = strchr(buf, '/')) *p = 0; } pwd = getpwnam(buf); if (!pwd) { @@ -8155,98 +8161,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); } } @@ -8302,36 +8226,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); @@ -9048,6 +8964,17 @@ DragPieceBegin(x, y) XCopyArea(xDisplay, xBoardWindow, player.saveBuf, player.blitGC, corner.x, corner.y, squareSize, squareSize, 0, 0); // [HGM] zh: unstack in stead of grab + if(gatingPiece != EmptySquare) { + /* Kludge alert: When gating we want the introduced + piece to appear on the from square. To generate an + image of it, we draw it on the board, copy the image, + and draw the original piece again. */ + ChessSquare piece = boards[currentMove][boardY][boardX]; + DrawSquare(boardY, boardX, gatingPiece, 0); + XCopyArea(xDisplay, xBoardWindow, player.saveBuf, player.blitGC, + corner.x, corner.y, squareSize, squareSize, 0, 0); + DrawSquare(boardY, boardX, piece, 0); + } damage[0][boardY][boardX] = True; } else { player.dragActive = False; @@ -9163,18 +9090,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