X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=history.c;h=a1f82fd947896de1bb2ceafbbb4e11ab6146b11f;hb=d628e1610653266459dfec9aad86aa6615ea886a;hp=503f6a0c69126f3a3d5b97dc877b5c43e6899a56;hpb=2c2c75c017b5d8c3ce7f6b06e4b5fc3a5dc92fde;p=xboard.git diff --git a/history.c b/history.c index 503f6a0..a1f82fd 100644 --- a/history.c +++ b/history.c @@ -6,6 +6,8 @@ * * Copyright 2005 Alessandro Scotti * + * Enhancements Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + * * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -50,6 +52,7 @@ typedef char MoveHistoryString[ MOVE_LEN*2 ]; static int lastFirst = 0; static int lastLast = 0; static int lastCurrent = -1; +static int lastGames; static char lastLastMove[ MOVE_LEN ]; @@ -69,7 +72,8 @@ static HistoryMove histMoves[ MAX_MOVES ]; /* Note: in the following code a "Memo" is a Rich Edit control (it's Delphi lingo) */ // back-end after replacing Windows data-types by equivalents -static Boolean OnlyCurrentPositionChanged() +static Boolean +OnlyCurrentPositionChanged () { Boolean result = FALSE; @@ -79,7 +83,7 @@ static Boolean OnlyCurrentPositionChanged() currFirst == lastFirst && currLast == lastLast && currCurrent >= 0 && - TRUE ) + lastGames == storedGames ) { result = TRUE; @@ -95,7 +99,8 @@ static Boolean OnlyCurrentPositionChanged() } // back-end, after replacing Windows data types -static Boolean OneMoveAppended() +static Boolean +OneMoveAppended () { Boolean result = FALSE; @@ -105,7 +110,7 @@ static Boolean OneMoveAppended() lastLast == (currLast-1) && lastCurrent == (currCurrent-1) && currCurrent == (currLast-1) && - TRUE ) + lastGames == storedGames ) { result = TRUE; } @@ -114,7 +119,8 @@ static Boolean OneMoveAppended() } // back-end, now that color and font-style are passed as numbers -static void AppendMoveToMemo( int index ) +static void +AppendMoveToMemo (int index) { char buf[64]; @@ -149,7 +155,8 @@ static void AppendMoveToMemo( int index ) } // back-end -void RefreshMemoContent() +void +RefreshMemoContent () { int i; @@ -161,7 +168,8 @@ void RefreshMemoContent() } // back-end part taken out of HighlightMove to determine character positions -static void DoHighlight(int index, int onoff) +static void +DoHighlight (int index, int onoff) { if( index >= 0 && index < MAX_MOVES ) { HighlightMove( histMoves[index].memoOffset, @@ -170,16 +178,17 @@ static void DoHighlight(int index, int onoff) } // back-end, now that a wrapper is provided for the front-end code to do the actual scrolling -void MemoContentUpdated() +void +MemoContentUpdated () { int caretPos; if(lastCurrent <= currLast) DoHighlight( lastCurrent, FALSE ); - DoHighlight( currCurrent, TRUE ); lastFirst = currFirst; lastLast = currLast; lastCurrent = currCurrent; + lastGames = storedGames; lastLastMove[0] = '\0'; if( lastLast > 0 ) { @@ -195,10 +204,12 @@ void MemoContentUpdated() } ScrollToCurrent(caretPos); + DoHighlight( currCurrent, TRUE ); // [HGM] moved last, because in X some scrolling methods spoil highlighting } // back-end. Must be called as double-click call-back on move-history text edit -void FindMoveByCharIndex( int char_index ) +void +FindMoveByCharIndex (int char_index) { int index; @@ -212,7 +223,8 @@ void FindMoveByCharIndex( int char_index ) } // back-end. In WinBoard called by call-back, but could be called directly by SetIfExists? -void UpdateMoveHistory() +void +UpdateMoveHistory () { /* Update the GUI */ if( OnlyCurrentPositionChanged() ) { @@ -229,7 +241,8 @@ void UpdateMoveHistory() } // back-end -void MoveHistorySet( char movelist[][2*MOVE_LEN], int first, int last, int current, ChessProgramStats_Move * pvInfo ) +void +MoveHistorySet (char movelist[][2*MOVE_LEN], int first, int last, int current, ChessProgramStats_Move * pvInfo) { /* [AS] Danger! For now we rely on the movelist parameter being a static variable! */