Boolean pushed = FALSE;
void
-ParsePV(char *pv, Boolean storeComments)
+ParsePV(char *pv, Boolean storeComments, Boolean atEnd)
{ // Parse a string of PV moves, and append to current game, behind forwardMostMove
int fromX, fromY, toX, toY; char promoChar;
ChessMove moveType;
else
parseList[endPV-1][0] = NULLCHAR;
} while(valid);
- currentMove = endPV;
+ currentMove = (atEnd || endPV == forwardMostMove) ? endPV : forwardMostMove + 1;
if(currentMove == forwardMostMove) ClearPremoveHighlights(); else
SetPremoveHighlights(moveList[currentMove-1][0]-AAA, moveList[currentMove-1][1]-ONE,
moveList[currentMove-1][2]-AAA, moveList[currentMove-1][3]-ONE);
do{ while(buf[index] && buf[index] != '\n') index++;
} while(buf[index] == '\n' && buf[index+1] == '\\' && buf[index+2] == ' ' && index++); // join kibitzed PV continuation line
buf[index] = 0;
- ParsePV(buf+startPV, FALSE);
+ ParsePV(buf+startPV, FALSE, !shiftKey);
*start = startPV; *end = index-1;
return TRUE;
}
{ // called on right mouse click to load PV
int which = gameMode == TwoMachinesPlay && (WhiteOnMove(forwardMostMove) == (second.twoMachinesColor[0] == 'w'));
lastX = x; lastY = y;
- ParsePV(lastPV[which], FALSE); // load the PV of the thinking engine in the boards array.
+ ParsePV(lastPV[which], FALSE, TRUE); // load the PV of the thinking engine in the boards array.
return TRUE;
}
void
UnLoadPV()
{
+ int oldFMM = forwardMostMove; // N.B.: this was currentMove before PV was loaded!
if(endPV < 0) return;
endPV = -1;
+ if(shiftKey && gameMode == AnalyzeMode) {
+ if(pushed) storedGames--; // abandon shelved tail of original game
+ pushed = FALSE;
+ forwardMostMove = currentMove;
+ currentMove = oldFMM;
+ ToNrEvent(forwardMostMove);
+ }
currentMove = forwardMostMove;
if(pushed) { PopInner(0); pushed = FALSE; } // restore shelved game contnuation
ClearPremoveHighlights();
PushTail(currentMove, forwardMostMove); // shelve main variation. This truncates game
// kludge: use ParsePV() to append variation to game
move = currentMove;
- ParsePV(start, TRUE);
+ ParsePV(start, TRUE, TRUE);
forwardMostMove = endPV; endPV = -1; currentMove = move; // cleanup what ParsePV did
ClearPremoveHighlights();
CommentPopDown();
case WM_NOTIFY:\r
if( wParam == IDC_EngineMemo1 || wParam == IDC_EngineMemo2 ) {\r
MSGFILTER * lpMF = (MSGFILTER *) lParam;\r
- if( lpMF->msg == WM_RBUTTONDOWN && (lpMF->wParam & (MK_CONTROL | MK_SHIFT)) == 0 ) {\r
+ if( lpMF->msg == WM_RBUTTONDOWN && (lpMF->wParam & (MK_CONTROL)) == 0 ) {\r
+ shiftKey = (lpMF->wParam & MK_SHIFT) != 0; // [HGM] remember last shift status\r
currentPV = (wParam == IDC_EngineMemo2);\r
GetMemoLine(hDlg, LOWORD(lpMF->lParam), HIWORD(lpMF->lParam));\r
}\r
char memoTranslations[] =
":Ctrl<Key>c: CopyMemoProc() \n \
<Btn3Motion>: HandlePV() \n \
-<Btn3Down>: select-start() SelectPV() \n \
+Shift<Btn3Down>: select-start() SelectPV(1) \n \
+Any<Btn3Down>: select-start() SelectPV(0) \n \
<Btn3Up>: extend-end() StopPV() \n";
void
XawTextGetSelectionPos(w, &index, &dummy);
XtSetArg(arg, XtNstring, &val);
XtGetValues(w, &arg, 1);
+ shiftKey = strcmp(params[0], "0");
if(LoadMultiPV(x, y, val, index, &start, &end)) {
XawTextSetSelection( outputField[currentPV][nMemo], start, end );
highTextStart[currentPV] = start; highTextEnd[currentPV] = end;