X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwgamelist.c;h=feda2cafed26617fdd47c365f644b2249c9d43ea;hb=7a9e8a6260d9b6be62e80f2250d211f30a1e50fb;hp=4fa60251a32223551c3630b93a069d24fe7b7045;hpb=c37d45adc7d98a702a7459ccdc0ac23df01a476e;p=xboard.git diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index 4fa6025..feda2ca 100644 --- a/winboard/wgamelist.c +++ b/winboard/wgamelist.c @@ -95,7 +95,7 @@ static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct if(nItem % 2000 == 0) { snprintf(buf, MSG_SIZ, _("Scanning through games (%d)"), nItem); - SetWindowText(hwndMain, buf); + SetWindowText(hwndMain, buf); DoEvents(); } if(!narrow || lg->position >= 0) { @@ -164,7 +164,7 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) int nItem; RECT rect; static int sizeX, sizeY; - int newSizeX, newSizeY, flags; + int newSizeX, newSizeY; MINMAXINFO *mmi; static BOOL filterHasFocus = FALSE; int count; @@ -197,7 +197,6 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* Size and position the dialog */ if (!gameListDialog) { gameListDialog = hDlg; - flags = SWP_NOZORDER; GetClientRect(hDlg, &rect); sizeX = rect.right; sizeY = rect.bottom; @@ -407,6 +406,7 @@ VOID GameListPopUp(FILE *fp, char *filename) gameFileName = StrSave(filename); } CheckMenuItem(GetMenu(hwndMain), IDM_ShowGameList, MF_CHECKED); + EnableMenuItem(GetMenu(hwndMain), IDM_SaveSelected, MF_ENABLED); if (gameListDialog) { SendMessage(gameListDialog, WM_INITDIALOG, 0, 0); if (!gameListUp) ShowWindow(gameListDialog, SW_SHOW); @@ -428,6 +428,7 @@ FILE *GameFile() VOID GameListPopDown(void) { CheckMenuItem(GetMenu(hwndMain), IDM_ShowGameList, MF_UNCHECKED); + EnableMenuItem(GetMenu(hwndMain), IDM_SaveSelected, MF_GRAYED); if (gameListDialog) ShowWindow(gameListDialog, SW_HIDE); gameListUp = FALSE; } @@ -436,14 +437,22 @@ VOID GameListPopDown(void) VOID GameListHighlight(int index) { char buf[MSG_SIZ]; - int i, res = 0; + int i, j, k, n, res = 0; if (gameListDialog == NULL) return; - for(i=0; res != LB_ERR; i++) { + for(i=64; ; i+=i) { res = SendDlgItemMessage( gameListDialog, OPT_GameListText, LB_GETTEXT, i, (LPARAM)buf ); - if(index <= atoi( buf )) break; + if(res == LB_ERR || index < atoi( buf )) break; } - SendDlgItemMessage(gameListDialog, OPT_GameListText, - LB_SETCURSEL, i, 0); + j = i/2; + while(i-j > 1) { + n = (i + j) >> 1; + res = SendDlgItemMessage( gameListDialog, OPT_GameListText, LB_GETTEXT, n, (LPARAM)buf ); + if(res == LB_ERR || index < (k = atoi( buf ))) i = n; else { + j = n; + if(index == k) break; + } + } + SendDlgItemMessage(gameListDialog, OPT_GameListText, LB_SETCURSEL, j, 0); }