From 91d449673b904139f4bbce9e9206c161a6a9b488 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 26 Jan 2010 18:35:31 +0100 Subject: [PATCH] Repair in WinBoard what the XBoard PromoDialog broke Because the back-end dummy PromoDialog was removed, and its function taken over by a front-end working version in XBoard, WinBoard needed to supply its own front-end. So the old back-end dummy was moved to winboard.c. The code to suppress some upclicks, which is now only needed in WinBoard because it still uses pseudo-popups, was put in the mouse handler. --- backend.c | 13 ------------- winboard/winboard.c | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/backend.c b/backend.c index bb7510f..8feb74a 100644 --- a/backend.c +++ b/backend.c @@ -6096,19 +6096,6 @@ UserMoveEvent(fromX, fromY, toX, toY, promoChar) FinishMove(moveType, fromX, fromY, toX, toY, promoChar); } -#if 0 -void -PromoDialog(int h, int w, Board board, Boolean clearBoard, char *title, int x, int y) -{ // dummy routine to mimic with pseudo-popup what front-end should do: - // display a popup with h x w mini-board, and divert any mouse clicks - // on it to the back-end routines RightClick and LeftClick, just - // like the mouse event hadler of the board widget does now. - // (Note it would have to off-set x if holdings are displayed!) - DisplayMessage("Click on your piece of choice", ""); - DrawPosition(TRUE, board); -} -#endif - int hTab[(int)EmptySquare/2+1] = { 1,1,1,1,1,1,2,1,2,3,2,3,3,3,2,3,4,3,3,4,4,3,4 }; int wTab[(int)EmptySquare/2+1] = { 1,1,2,3,4,5,3,7,4,3,5,4,4,5,7,5,4,6,6,5,5,7,6 }; Board promoBoard; diff --git a/winboard/winboard.c b/winboard/winboard.c index fae7a9d..458aaf6 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -3821,9 +3821,13 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MBUTTONUP: case WM_RBUTTONUP: ReleaseCapture(); + { extern int promotionChoice; extern Board promoBoard; + if(promotionChoice == 3 && (promoBoard[y][x] == EmptySquare || x == fromX && y == fromY)) + break; // [HGM] promopopup: suppression of up-click selection as long as pseudo-popup is used + } RightClick(Release, pt.x - boardRect.left, pt.y - boardRect.top, &fromX, &fromY); break; - + case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: ErrorPopDown(); @@ -4036,6 +4040,17 @@ PromotionPopUp() PromotionPopup(hwndMain); } +void +PromoDialog(int h, int w, Board board, Boolean clearBoard, char *title, int x, int y) +{ // dummy routine to mimic with pseudo-popup what front-end should do: + // display a popup with h x w mini-board, and divert any mouse clicks + // on it to the back-end routines RightClick and LeftClick, just + // like the mouse event hadler of the board widget does now. + // (Note it would have to off-set x if holdings are displayed!) + DisplayMessage("Click on your piece of choice", ""); + DrawPosition(TRUE, board); +} + /* Toggle ShowThinking */ VOID ToggleShowThinking() -- 1.7.0.4