From a77d71269906ce8480c66635f4ce12e48f1fc51e Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 2 Apr 2012 17:53:40 +0200 Subject: [PATCH] Use Ctrl key in EditPosition mode to copy pieces --- backend.c | 5 +++-- dialogs.c | 4 +++- frontend.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend.c b/backend.c index 38c3533..6185347 100644 --- a/backend.c +++ b/backend.c @@ -450,7 +450,7 @@ int adjudicateLossPlies = 6; char white_holding[64], black_holding[64]; TimeMark lastNodeCountTime; long lastNodeCount=0; -int shiftKey; // [HGM] set by mouse handler +int shiftKey, controlKey; // [HGM] set by mouse handler int have_sent_ICS_logon = 0; int movesPerSession; @@ -6664,7 +6664,7 @@ UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar) if(boards[0][fromY][BOARD_WIDTH-2] == 0) boards[0][fromY][BOARD_WIDTH-1] = EmptySquare; } } else - boards[0][fromY][fromX] = EmptySquare; + boards[0][fromY][fromX] = gatingPiece; DrawPosition(FALSE, boards[currentMove]); return; } @@ -7060,6 +7060,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) if (OKToStartUserMove(fromX, fromY)) { second = 0; MarkTargetSquares(0); + if(gameMode == EditPosition && controlKey) gatingPiece = boards[currentMove][fromY][fromX]; DragPieceBegin(xPix, yPix, FALSE); dragging = 1; if(appData.sweepSelect && CanPromote(piece = boards[currentMove][fromY][fromX], fromY)) { promoSweep = defaultPromoChoice; diff --git a/dialogs.c b/dialogs.c index b6abd82..a6698ca 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1909,7 +1909,9 @@ Exp (int n, int x, int y) if(but3) MovePV(x, y, lineGap + BOARD_HEIGHT * (squareSize + lineGap)); return NULL; } - shiftKey = (ShiftKeys() & 3) != 0; + shiftKey = ShiftKeys(); + controlKey = (shiftKey & 0xC) != 0; + shiftKey = (shiftKey & 3) != 0; switch(n) { case 1: LeftClick(Press, x, y), but1 = 1; break; case -1: LeftClick(Release, x, y), but1 = 0; break; diff --git a/frontend.h b/frontend.h index 4cad55a..33496d4 100644 --- a/frontend.h +++ b/frontend.h @@ -170,7 +170,7 @@ void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure, char *buf, int count, int error)); extern ProcRef cmailPR; -extern int shiftKey; +extern int shiftKey, controlKey; /* in xgamelist.c or winboard.c */ void GLT_ClearList(); -- 1.7.0.4