X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=840ac50e592a516af54eeff8292e3aea784e4358;hb=ac647cc1aa823dd59b600245e5cc014ae85e1ce9;hp=0dd023db4d4f62cf67d6fb77c7b2a1e6a988a057;hpb=3994c15346431e4174170507360a676052456d80;p=xboard.git diff --git a/xboard.c b/xboard.c index 0dd023d..840ac50 100644 --- a/xboard.c +++ b/xboard.c @@ -256,6 +256,8 @@ void HandleUserMove P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void AnimateUserMove P((Widget w, XEvent * event, String * params, Cardinal * nParams)); +void HandlePV P((Widget w, XEvent * event, + String * params, Cardinal * nParams)); void WhiteClock P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void BlackClock P((Widget w, XEvent *event, @@ -832,6 +834,8 @@ XtActionsRec boardActions[] = { { "DrawPosition", DrawPositionProc }, { "HandleUserMove", HandleUserMove }, { "AnimateUserMove", AnimateUserMove }, + { "HandlePV", HandlePV }, + { "UnLoadPV", UnLoadPV }, { "FileNameAction", FileNameAction }, { "AskQuestionProc", AskQuestionProc }, { "AskQuestionReplyAction", AskQuestionReplyAction }, @@ -988,6 +992,8 @@ char boardTranslations[] = ": HandleUserMove() \n \ : HandleUserMove() \n \ : AnimateUserMove() \n \ + : HandlePV() \n \ + : UnLoadPV() \n \ Shift: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD)\ PieceMenuPopup(menuB) \n \ Any: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD) \ @@ -3672,6 +3678,8 @@ void PieceMenuPopup(w, event, params, num_params) Cardinal *num_params; { String whichMenu; + + if (event->type != ButtonRelease) UnLoadPV(); // [HGM] pv if (event->type != ButtonPress) return; if (errorUp) ErrorPopDown(); switch (gameMode) { @@ -3679,12 +3687,25 @@ void PieceMenuPopup(w, event, params, num_params) case IcsExamining: whichMenu = params[0]; break; + case IcsObserving: + if(!appData.icsEngineAnalyze) return; case IcsPlayingWhite: case IcsPlayingBlack: - case EditGame: + if(!appData.zippyPlay) goto noZip; + case AnalyzeMode: + case AnalyzeFile: case MachinePlaysWhite: case MachinePlaysBlack: - if (appData.testLegality && + case TwoMachinesPlay: // [HGM] pv: use for showing PV + if (!appData.dropMenu) { + LoadPV(event->xbutton.x, event->xbutton.y); + return; + } + if(gameMode == TwoMachinesPlay || gameMode == AnalyzeMode || + gameMode == AnalyzeFile || gameMode == IcsObserving) return; + case EditGame: + noZip: + if (!appData.dropMenu || appData.testLegality && gameInfo.variant != VariantBughouse && gameInfo.variant != VariantCrazyhouse) return; SetupDropMenu(); @@ -4429,6 +4450,12 @@ void AnimateUserMove (Widget w, XEvent * event, DragPieceMove(event->xmotion.x, event->xmotion.y); } +void HandlePV (Widget w, XEvent * event, + String * params, Cardinal * nParams) +{ // [HGM] pv: walk PV + MovePV(event->xmotion.x, event->xmotion.y, lineGap + BOARD_HEIGHT * (squareSize + lineGap)); +} + Widget CommentCreate(name, text, mutable, callback, lines) char *name, *text; int /*Boolean*/ mutable;