X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwgamelist.c;h=feda2cafed26617fdd47c365f644b2249c9d43ea;hb=6b19d6b88b12d1e1493d778d140e99c4f751faff;hp=17e78f122f1200ec53007847030e743a3e268593;hpb=699d2cc5efc5e3ef959813b16528e6b23d8de50a;p=xboard.git diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index 17e78f1..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) { @@ -437,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); }