Use Ctrl key in EditPosition mode to copy pieces refactor
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 2 Apr 2012 15:53:40 +0000 (17:53 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Tue, 10 Apr 2012 09:39:44 +0000 (11:39 +0200)
backend.c
dialogs.c
frontend.h

index 38c3533..6185347 100644 (file)
--- 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;
index b6abd82..a6698ca 100644 (file)
--- 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;
index 4cad55a..33496d4 100644 (file)
@@ -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();