X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xgamelist.c;h=15165f164ff5f58b401d6d4dd02afd36239908f2;hb=ca6061cbffe88ff5eb2332e733e0a534b89cc5e7;hp=2d3ce029da675d11af076479ddf54206b4d1d1f9;hpb=744e2a204303df22753aa3b1d84a7a9ac5290213;p=xboard.git diff --git a/xgamelist.c b/xgamelist.c index 2d3ce02..15165f1 100644 --- a/xgamelist.c +++ b/xgamelist.c @@ -101,6 +101,8 @@ char gameListTranslations[] = "(2): LoadSelectedProc(0) \n \ Home: LoadSelectedProc(-2) \n \ End: LoadSelectedProc(2) \n \ + CtrlUp: LoadSelectedProc(-3) \n \ + CtrlDown: LoadSelectedProc(3) \n \ Up: LoadSelectedProc(-1) \n \ Down: LoadSelectedProc(1) \n \ Left: LoadSelectedProc(-1) \n \ @@ -324,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; @@ -337,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); @@ -355,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) @@ -372,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; @@ -570,18 +583,22 @@ LoadSelectedProc(w, event, prms, nprms) } if(direction != 0) { + int doLoad = abs(direction) > 2; + 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); - return; + if(!doLoad) return; } index = atoi(list[index])-1; // [HGM] filter: read true index from sequence nr of line if (cmailMsgLoaded) { CmailLoadGame(glc->fp, index + 1, glc->filename, True); } else { LoadGame(glc->fp, index + 1, glc->filename, True); + XSync(xDisplay, False); + XSetInputFocus(xDisplay, XtWindow(boardWidget), RevertToPointerRoot, CurrentTime); } }