From: H.G. Muller Date: Sat, 7 Apr 2012 13:36:02 +0000 (+0200) Subject: Implement Narrow button in WB Game List X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=276a3b175e8a81f5960ceb8c446762dafa3c5d63;p=xboard.git Implement Narrow button in WB Game List --- diff --git a/winboard/resource.h b/winboard/resource.h index 2b89b40..83d102e 100644 --- a/winboard/resource.h +++ b/winboard/resource.h @@ -197,6 +197,7 @@ #define OPT_GameListPrev 1010 #define OPT_GameListText 1011 #define OPT_GameListLoad 1012 +#define OPT_GameListNarrow 1010 #define OPT_GameListNext 1013 #define OPT_GameListClose 1014 #define DLG_EditTags 1015 diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index d0b624c..7aec90d 100644 --- a/winboard/wgamelist.c +++ b/winboard/wgamelist.c @@ -57,7 +57,7 @@ struct GameListStats }; /* [AS] Setup the game list according to the specified filter */ -static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats, BOOL byPos ) +static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats, BOOL byPos, BOOL narrow ) { ListGame * lg = (ListGame *) gameList.head; int nItem; @@ -98,6 +98,7 @@ static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct SetWindowText(hwndMain, buf); } + if(!narrow || lg->position >= 0) { if( hasFilter ) { st = GameListLine(lg->number, &lg->gameInfo); if( !SearchPattern( st, pszFilter) ) skip = TRUE; @@ -107,8 +108,6 @@ static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct if( (pos = GameContainsPosition(gameFile, lg)) < 0) skip = TRUE; } - lg->position = pos; - if( ! skip ) { if(!st) st = GameListLine(lg->number, &lg->gameInfo); SendDlgItemMessage(hDlg, OPT_GameListText, LB_ADDSTRING, 0, (LPARAM) st); @@ -123,7 +122,11 @@ static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct stats->drawn++; else stats->unfinished++; + if(!byPos) pos = 0; } + } + + lg->position = pos; if(st) free(st); lg = (ListGame *) lg->node.succ; @@ -184,7 +187,7 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* Set font */ SendDlgItemMessage( hDlg, OPT_GameListText, WM_SETFONT, (WPARAM)font[boardSize][GAMELIST_FONT]->hf, MAKELPARAM(TRUE, 0 )); - count = GameListToListBox( hDlg, gameListDialog ? TRUE : FALSE, NULL, &stats, FALSE ); + count = GameListToListBox( hDlg, gameListDialog ? TRUE : FALSE, NULL, &stats, FALSE, FALSE ); SendDlgItemMessage( hDlg, IDC_GameListFilter, WM_SETTEXT, 0, (LPARAM) "" ); SendDlgItemMessage( hDlg, IDC_GameListFilter, EM_SETLIMITTEXT, MAX_FILTER_LENGTH, 0 ); @@ -302,6 +305,7 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) break; /* load the game*/ case OPT_GameListPrev: +#if 0 nItem = SendDlgItemMessage(hDlg, OPT_GameListText, LB_GETCURSEL, 0, 0); nItem--; if (nItem < 0) { @@ -311,7 +315,7 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) } SendDlgItemMessage(hDlg, OPT_GameListText, LB_SETCURSEL, nItem, 0); break; /* load the game*/ - +#endif /* [AS] */ case OPT_GameListFind: case IDC_GameListDoFilter: @@ -320,7 +324,7 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) if( GetDlgItemText( hDlg, IDC_GameListFilter, filter, sizeof(filter) ) >= 0 ) { filter[ sizeof(filter)-1 ] = '\0'; - count = GameListToListBox( hDlg, TRUE, filter, &stats, LOWORD(wParam)!=IDC_GameListDoFilter ); + count = GameListToListBox( hDlg, TRUE, filter, &stats, LOWORD(wParam)!=IDC_GameListDoFilter, LOWORD(wParam)==OPT_GameListNarrow ); GameListUpdateTitle( hDlg, _("Game List"), count, ((ListGame *) gameList.tailPred)->number, &stats ); } } diff --git a/winboard/winboard.rc b/winboard/winboard.rc index e452d75..14496f8 100644 --- a/winboard/winboard.rc +++ b/winboard/winboard.rc @@ -259,19 +259,20 @@ BEGIN LTEXT "(unofficial version ""X"")",IDC_STATIC,68,154,71,8 END -DLG_GameList DIALOG DISCARDABLE 6, 18, 259, 153 +DLG_GameList DIALOG DISCARDABLE 6, 18, 282, 153 STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "Game List" FONT 8, "MS Sans Serif" BEGIN - LISTBOX OPT_GameListText,2,2,254,130,LBS_NOINTEGRALHEIGHT | + LISTBOX OPT_GameListText,2,2,277,130,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP PUSHBUTTON "&Thresholds",OPT_GameListLoad,2,136,40,15 PUSHBUTTON "&Find Position",OPT_GameListFind,45,136,48,15 - PUSHBUTTON "&Close",OPT_GameListClose,96,136,30,15 - PUSHBUTTON ">",OPT_GameListNext,129,136,17,15 - PUSHBUTTON "&Filter",IDC_GameListDoFilter,149,136,25,14 - EDITTEXT IDC_GameListFilter,178,136,78,14,ES_AUTOHSCROLL + PUSHBUTTON "&Narrow",OPT_GameListNarrow,96,136,30,15 + PUSHBUTTON "&Close",OPT_GameListClose,129,136,20,15 + PUSHBUTTON ">",OPT_GameListNext,152,136,17,15 + PUSHBUTTON "&Filter",IDC_GameListDoFilter,172,136,25,14 + EDITTEXT IDC_GameListFilter,201,136,78,14,ES_AUTOHSCROLL END DLG_EditTags DIALOG DISCARDABLE 6, 18, 167, 140