X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwhistory.c;h=60af89848a57307744a706a23f96d12e7c8b7ab1;hb=056614196635a4730170261fe0e638191f14c620;hp=ba69a63c7873a5f1937b41f81f637ad8ce8cf1b4;hpb=2380bd9a886c088ba6040d99932c20cdf080fbbb;p=xboard.git diff --git a/winboard/whistory.c b/winboard/whistory.c index ba69a63..60af898 100644 --- a/winboard/whistory.c +++ b/winboard/whistory.c @@ -1,7 +1,7 @@ /* * Move history for WinBoard * - * Author: Alessandro Scotti + * Author: Alessandro Scotti (Dec 2005) * * ------------------------------------------------------------------------ * This program is free software; you can redistribute it and/or modify @@ -53,6 +53,8 @@ extern HWND hwndMain; extern WindowPlacement wpMoveHistory; +extern BoardSize boardSize; + /* Module globals */ typedef char MoveHistoryString[ MOVE_LEN*2 ]; @@ -60,6 +62,8 @@ static int lastFirst = 0; static int lastLast = 0; static int lastCurrent = -1; +static char lastLastMove[ MOVE_LEN ]; + static MoveHistoryString * currMovelist; static ChessProgramStats_Move * currPvInfo; static int currFirst = 0; @@ -125,6 +129,13 @@ static BOOL OnlyCurrentPositionChanged() TRUE ) { result = TRUE; + + /* Special case: last move changed */ + if( currCurrent == currLast-1 ) { + if( strcmp( currMovelist[currCurrent], lastLastMove ) != 0 ) { + result = FALSE; + } + } } return result; @@ -214,7 +225,7 @@ static VOID AppendMoveToMemo( int index ) /* PV info (if any) */ if( appData.showEvalInMoveHistory && currPvInfo[index].depth > 0 ) { - sprintf( buf, "%{%s%.2f/%d} ", + sprintf( buf, "{%s%.2f/%d} ", currPvInfo[index].score >= 0 ? "+" : "", currPvInfo[index].score / 100.0, currPvInfo[index].depth ); @@ -245,6 +256,11 @@ static void MemoContentUpdated() lastFirst = currFirst; lastLast = currLast; lastCurrent = currCurrent; + lastLastMove[0] = '\0'; + + if( lastLast > 0 ) { + strcpy( lastLastMove, SavePart( currMovelist[lastLast-1] ) ); + } /* Deselect any text, move caret to end of memo */ if( currCurrent >= 0 ) { @@ -288,6 +304,9 @@ LRESULT CALLBACK HistoryDialogProc( HWND hDlg, UINT message, WPARAM wParam, LPAR SendDlgItemMessage( moveHistoryDialog, IDC_MoveHistory, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS ); + /* Set font */ + SendDlgItemMessage( moveHistoryDialog, IDC_MoveHistory, WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, MAKELPARAM(TRUE, 0 )); + /* Restore window placement */ RestoreWindowPlacement( hDlg, &wpMoveHistory ); }