marked more strings for translation
[xboard.git] / xboard.c
index 3ad0fb1..4d10b37 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -683,7 +683,7 @@ MenuItem modeMenu[] = {
     {N_("Machine Black  Ctrl+B"), "Machine Black", MachineBlackProc},
     {N_("Two Machines   Ctrl+T"), "Two Machines", TwoMachinesProc},
     {N_("Analysis Mode  Ctrl+A"), "Analysis Mode", AnalyzeModeProc},
-    {N_("Analyze File      Ctrl+F"), "Analyze File", AnalyzeFileProc },
+    {N_("Analyze Game   Ctrl+G"), "Analyze File", AnalyzeFileProc },
     {N_("Edit Game         Ctrl+E"), "Edit Game", EditGameProc},
     {N_("Edit Position      Ctrl+Shift+E"), "Edit Position", EditPositionProc},
     {N_("Training"),      "Training", TrainingProc},
@@ -800,7 +800,7 @@ Menu menuBar[] = {
 MenuItem buttonBar[] = {
     {"<<", "<<", ToStartProc},
     {"<", "<", BackwardProc},
-    {PAUSE_BUTTON, PAUSE_BUTTON, PauseProc},
+    {N_(PAUSE_BUTTON), PAUSE_BUTTON, PauseProc},
     {">", ">", ForwardProc},
     {">>", ">>", ToEndProc},
     {NULL, NULL, NULL}
@@ -1051,6 +1051,8 @@ char globalTranslations[] =
    :Ctrl<Key>o: LoadGameProc() \n \
    :Meta<Key>Next: LoadNextGameProc() \n \
    :Meta<Key>Prior: LoadPrevGameProc() \n \
+   :Ctrl<Key>Down: LoadSelectedProc(3) \n \
+   :Ctrl<Key>Up: LoadSelectedProc(-3) \n \
    :Ctrl<Key>s: SaveGameProc() \n \
    :Ctrl<Key>c: CopyGameProc() \n \
    :Ctrl<Key>v: PasteGameProc() \n \
@@ -1065,7 +1067,7 @@ char globalTranslations[] =
    :Ctrl<Key>b: MachineBlackProc() \n \
    :Ctrl<Key>t: TwoMachinesProc() \n \
    :Ctrl<Key>a: AnalysisModeProc() \n \
-   :Ctrl<Key>f: AnalyzeFileProc() \n \
+   :Ctrl<Key>g: AnalyzeFileProc() \n \
    :Ctrl<Key>e: EditGameProc() \n \
    :Ctrl<Key>E: EditPositionProc() \n \
    :Meta<Key>O: EngineOutputProc() \n \
@@ -1087,6 +1089,8 @@ char globalTranslations[] =
    :Meta<Key>Right: ForwardProc() \n \
    :Meta<Key>Home: ToStartProc() \n \
    :Meta<Key>Left: BackwardProc() \n \
+   :<Key>Left: BackwardProc() \n \
+   :<Key>Right: ForwardProc() \n \
    :<Key>Home: RevertProc() \n \
    :<Key>End: TruncateGameProc() \n \
    :Ctrl<Key>m: MoveNowProc() \n \
@@ -1678,9 +1682,17 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     Arg args[16];
     XtGeometryResult gres;
     int i;
+    static Dimension oldWidth, oldHeight;
+    static VariantClass oldVariant;
+    static int oldDual = -1;
 
     if(!formWidget) return;
 
+    if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap;
+    boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
+    boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
+
+  if(boardWidth != oldWidth || boardHeight != oldHeight || oldDual != twoBoards) { // do resizing stuff only if size actually changed
     /*
      * Enable shell resizing.
      */
@@ -1695,9 +1707,7 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     XtSetArg(args[0], XtNdefaultDistance, &sep);
     XtGetValues(formWidget, args, 1);
 
-    if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap;
-    boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
-    boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
+    oldWidth = boardWidth; oldHeight = boardHeight; oldDual = twoBoards;
     CreateGrid();
     hOffset = boardWidth + 10;
     for(i=0; i<BOARD_WIDTH+BOARD_HEIGHT+2; i++) { // [HGM] dual: grid for second board
@@ -1748,9 +1758,13 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     shellArgs[4].value = shellArgs[2].value = w;
     shellArgs[5].value = shellArgs[3].value = h;
     XtSetValues(shellWidget, &shellArgs[0], 6);
+  }
 
     // [HGM] pieces: tailor piece bitmaps to needs of specific variant
     // (only for xpm)
+
+    if(gameInfo.variant == oldVariant) return; // and only if variant changed
+
     if(useImages) {
       for(i=0; i<4; i++) {
        int p;
@@ -3597,7 +3611,7 @@ void CreateXPMBoard(char *s, int kind)
 {
     XpmAttributes attr;
     attr.valuemask = 0;
-    if(s == NULL || *s == 0 || *s == '*') { useTexture &= ~(kind+1); return; }
+    if(!appData.useBitmaps || s == NULL || *s == 0 || *s == '*') { useTexture &= ~(kind+1); return; }
     if (XpmReadFileToPixmap(xDisplay, xBoardWindow, s, &(xpmBoardBitmap[kind]), NULL, &attr) == 0) {
        useTexture |= kind + 1; textureW[kind] = attr.width; textureH[kind] = attr.height;
     }
@@ -4999,6 +5013,14 @@ void CommentPopDown()
     PopDown(1);
 }
 
+static char *openName;
+FILE *openFP;
+
+void DelayedLoad()
+{
+  (void) (*fileProc)(openFP, 0, openName);
+}
+
 void FileNamePopUp(label, def, filter, proc, openMode)
      char *label;
      char *def;
@@ -5009,12 +5031,11 @@ void FileNamePopUp(label, def, filter, proc, openMode)
     fileProc = proc;           /* I can't see a way not */
     fileOpenMode = openMode;   /*   to use globals here */
     {   // [HGM] use file-selector dialog stolen from Ghostview
-       char *name;
        int index; // this is not supported yet
-       FILE *f;
-       if(f = XsraSelFile(shellWidget, label, NULL, NULL, "could not open: ",
-                          (def[0] ? def : NULL), filter, openMode, NULL, &name))
-         (void) (*fileProc)(f, index=0, name);
+       if(openFP = XsraSelFile(shellWidget, label, NULL, NULL, _("could not open: "),
+                          (def[0] ? def : NULL), filter, openMode, NULL, &openName))
+         // [HGM] delay to give expose event opportunity to redraw board after browser-dialog popdown before lengthy load starts
+         ScheduleDelayedEvent(&DelayedLoad, 50);
     }
 }
 
@@ -5928,13 +5949,13 @@ void AnalyzeFileProc(w, event, prms, nprms)
       DisplayError(buf, 0);
       return;
     }
-    Reset(FALSE, TRUE);
+//    Reset(FALSE, TRUE);
 #ifndef OPTIONSDIALOG
     if (!appData.showThinking)
       ShowThinkingProc(w,event,prms,nprms);
 #endif
     AnalyzeFileEvent();
-    FileNamePopUp(_("File to analyze"), "", ".pgn .game", LoadGamePopUp, "rb");
+//    FileNamePopUp(_("File to analyze"), "", ".pgn .game", LoadGamePopUp, "rb");
     AnalysisPeriodicEvent(1);
 }
 
@@ -6807,17 +6828,18 @@ void AboutProc(w, event, prms, nprms)
 {
     char buf[MSG_SIZ];
 #if ZIPPY
-    char *zippy = " (with Zippy code)";
+    char *zippy = _(" (with Zippy code)");
 #else
     char *zippy = "";
 #endif
-    snprintf(buf, sizeof(buf), "%s%s\n\n%s\n%s\n%s\n\n%s%s\n%s",
-           programVersion, zippy,
-           "Copyright 1991 Digital Equipment Corporation",
-           "Enhancements Copyright 1992-2009 Free Software Foundation",
-           "Enhancements Copyright 2005 Alessandro Scotti",
-           PACKAGE, " is free software and carries NO WARRANTY;",
-           "see the file COPYING for more information.");
+    snprintf(buf, sizeof(buf), 
+_("%s%s\n\n"
+"Copyright 1991 Digital Equipment Corporation\n"
+"Enhancements Copyright 1992-2009 Free Software Foundation\n"
+"Enhancements Copyright 2005 Alessandro Scotti\n\n"
+"%s is free software and carries NO WARRANTY;"
+"see the file COPYING for more information."),
+           programVersion, zippy, PACKAGE);
     ErrorPopUp(_("About XBoard"), buf, FALSE);
 }
 
@@ -7189,6 +7211,7 @@ PlaySound(name)
   } else {
     char buf[2048];
     char *prefix = "", *sep = "";
+    if(appData.soundProgram[0] == NULLCHAR) return;
     if(!strchr(name, '/')) { prefix = appData.soundDirectory; sep = "/"; }
     snprintf(buf, sizeof(buf), "%s '%s%s%s' &", appData.soundProgram, prefix, sep, name);
     system(buf);
@@ -7252,6 +7275,12 @@ EchoOff()
 }
 
 void
+RunCommand(char *buf)
+{
+    system(buf);
+}
+
+void
 Colorize(cc, continuation)
      ColorClass cc;
      int continuation;
@@ -8208,6 +8237,12 @@ FrameDelay (time)
 
 #endif
 
+void
+DoSleep(int n)
+{
+    FrameDelay(n);
+}
+
 /*     Convert board position to corner of screen rect and color       */
 
 static void