marked more strings for translation
[xboard.git] / xgamelist.c
index 2d3ce02..9784bf7 100644 (file)
@@ -101,6 +101,8 @@ char gameListTranslations[] =
   "<Btn1Up>(2): LoadSelectedProc(0) \n \
    <Key>Home: LoadSelectedProc(-2) \n \
    <Key>End: LoadSelectedProc(2) \n \
+   Ctrl<Key>Up: LoadSelectedProc(-3) \n \
+   Ctrl<Key>Down: LoadSelectedProc(3) \n \
    <Key>Up: LoadSelectedProc(-1) \n \
    <Key>Down: LoadSelectedProc(1) \n \
    <Key>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);
     }
 }
 
@@ -659,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;
     }
 
@@ -795,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,