From: H.G.Muller Date: Thu, 16 Oct 2014 15:41:01 +0000 (+0200) Subject: Update Game List after tag selection changed X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=14005df069bf869fc3185ebb19b3460aa041f1bc Update Game List after tag selection changed When the Game List Options dialog changes the tags to be displayed in the Game List lines, we now automatically redo the entire Game List. --- diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index feda2ca..e31f184 100644 --- a/winboard/wgamelist.c +++ b/winboard/wgamelist.c @@ -48,16 +48,8 @@ static BOOLEAN gameListUp = FALSE; static FILE* gameFile; static char* gameFileName = NULL; -struct GameListStats -{ - int white_wins; - int black_wins; - int drawn; - int unfinished; -}; - /* [AS] Setup the game list according to the specified filter */ -static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats, BOOL byPos, BOOL narrow ) +int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats, BOOL byPos, BOOL narrow ) { ListGame * lg = (ListGame *) gameList.head; int nItem; @@ -66,6 +58,9 @@ static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct int count = 0; struct GameListStats dummy; + if(!hDlg) hDlg = gameListDialog; // [HGM] to allow calling from Game List Options dialog + if(!hDlg) return 0; + /* Initialize stats (use a dummy variable if caller not interested in them) */ if( stats == NULL ) { stats = &dummy; diff --git a/winboard/winboard.c b/winboard/winboard.c index d0eb772..794ae49 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -8712,8 +8712,11 @@ int GameListOptions() result = DialogBoxParam( hInst, MAKEINTRESOURCE(DLG_GameListOptions), hwndMain, (DLGPROC)lpProc, (LPARAM)lpUserGLT ); if( result == 0 ) { + char *oldTags = appData.gameListTags; /* [AS] Memory leak here! */ appData.gameListTags = strdup( lpUserGLT ); + if(strcmp(oldTags, appData.gameListTags)) // [HGM] redo Game List when we changed something + GameListToListBox(NULL, TRUE, ".", NULL, FALSE, FALSE); // "." as filter is kludge to select all } return result; @@ -9776,6 +9779,7 @@ OutputToProcess(ProcRef pr, char *message, int count, int *outError) int outCount = SOCKET_ERROR; ChildProc *cp = (ChildProc *) pr; static OVERLAPPED ovl; + static int line = 0; if (pr == NoProc) diff --git a/winboard/winboard.h b/winboard/winboard.h index 0998c97..00caa95 100644 --- a/winboard/winboard.h +++ b/winboard/winboard.h @@ -211,6 +211,15 @@ extern HWND evalGraphDialog; extern HWND engineOutputDialog; +struct GameListStats +{ + int white_wins; + int black_wins; + int drawn; + int unfinished; +}; + +int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats, BOOL byPos, BOOL narrow ); VOID ShowGameListProc(void); extern HWND gameListDialog;