X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xgamelist.c;h=9784bf7ae00f666db1a8bf338b31a2bcec282c8a;hb=23aef45a07bfc84a29b7cb9099508324815a458b;hp=abccb04db183a3e3f35dd0ed96d939c4a7e7af12;hpb=f95d2445401b6419ede201531c31628c81b8ffdd;p=xboard.git diff --git a/xgamelist.c b/xgamelist.c index abccb04..9784bf7 100644 --- a/xgamelist.c +++ b/xgamelist.c @@ -326,12 +326,19 @@ GameListCreate(name, callback, client_data) return shell; } +extern int soughtCounts[]; +extern Board soughtBoard; + static int GameListPrepare(int byPos) { // [HGM] filter: put in separate routine, to make callable from call-back int nstrings; ListGame *lg; char **st, *line; +struct { + long sec; /* Assuming this is >= 32 bits */ + int ms; /* Assuming this is >= 16 bits */ +} t,t2; GetTimeMark(&t); if(st = glc->strings) while(*st) free(*st++); nstrings = ((ListGame *) gameList.tailPred)->number; @@ -339,6 +346,7 @@ GameListPrepare(int byPos) st = glc->strings; lg = (ListGame *) gameList.head; listLength = wins = losses = draws = 0; + if(byPos) InitSearch(); while (nstrings--) { int pos = -1; line = GameListLine(lg->number, &lg->gameInfo); @@ -357,12 +365,14 @@ GameListPrepare(int byPos) lg->position = pos; lg = (ListGame *) lg->node.succ; } +GetTimeMark(&t2);printf("GameListPrepare %d msec\n", SubtractTimeMarks(&t2,&t)); DisplayTitle("XBoard"); *st = NULL; return listLength; } static char *list[1003]; +int listEnd; static void GameListReplace(int page) @@ -374,7 +384,8 @@ GameListReplace(int page) int i; if(page) *st++ = _("previous page"); else if(listLength > 1000) *st++ = ""; - for(i=0; i<1000; i++) if( !(*st++ = glc->strings[page+i]) ) break; + for(i=0; i<1000; i++) if( !(*st++ = glc->strings[page+i]) ) { st--; break; } + listEnd = st - list; if(page + 1000 <= listLength) *st++ = _("next page"); *st = NULL; @@ -576,8 +587,8 @@ LoadSelectedProc(w, event, prms, nprms) if(doLoad) direction /= 3; index += direction; if(direction == -2) index = 0; - if(direction == 2) index = listLength-1; - if(index < 0 || index >= listLength) return; + if(direction == 2) index = listEnd-1; + if(index < 0 || index >= listEnd) return; XawListHighlight(listwidg, index); if(!doLoad) return; } @@ -665,7 +676,7 @@ int SaveGameListAsText(FILE *f) int nItem; if( !glc || ((ListGame *) gameList.tailPred)->number <= 0 ) { - DisplayError("Game list not loaded or empty", 0); + DisplayError(_("Game list not loaded or empty"), 0); return False; } @@ -801,7 +812,7 @@ GameListOptionsCreate() XtSetArg(args[j], XtNresizable, True); j++; XtSetArg(args[j], XtNallowShellResize, True); j++; shell = gameListOptShell = - XtCreatePopupShell("Game-list options", transientShellWidgetClass, + XtCreatePopupShell(_("Game-list options"), transientShellWidgetClass, shellWidget, args, j); layout = XtCreateManagedWidget(layoutName, formWidgetClass, shell,