Fix multi-leg promotions
[xboard.git] / xaw / xboard.c
index 4bca0c1..1c3ffc7 100644 (file)
@@ -149,6 +149,7 @@ extern char *getenv();
 #include <locale.h>
 #endif
 
+#include <X11/keysym.h>
 #include <X11/Intrinsic.h>
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
@@ -1233,7 +1234,7 @@ main (int argc, char **argv)
     boardWidget      = optList[W_BOARD].handle;
     menuBarWidget    = optList[W_MENU].handle;
     dropMenu         = optList[W_DROP].handle;
-    titleWidget = optList[optList[W_TITLE].type != -1 ? W_TITLE : W_SMALL].handle;
+    titleWidget = optList[optList[W_TITLE].type != Skip ? W_TITLE : W_SMALL].handle;
     formWidget  = XtParent(boardWidget);
     XtSetArg(args[0], XtNbackground, &timerBackgroundPixel);
     XtSetArg(args[1], XtNforeground, &timerForegroundPixel);
@@ -1708,7 +1709,7 @@ ReSize (WindowPlacement *wp)
        if(sqy < sqx) sqx = sqy;
        if(sqx != squareSize) {
            squareSize = sqx; // adopt new square size
-           CreatePNGPieces(); // make newly scaled pieces
+           CreatePNGPieces(appData.pieceDirectory); // make newly scaled pieces
            InitDrawingSizes(0, 0); // creates grid etc.
        } else ResizeBoardWindow(BOARD_WIDTH * (squareSize + lineGap) + lineGap, BOARD_HEIGHT * (squareSize + lineGap) + lineGap, 0);
        w = BOARD_WIDTH * (squareSize + lineGap) + lineGap;
@@ -1818,7 +1819,7 @@ ModeHighlight ()
 {
     Arg args[16];
     static int oldPausing = FALSE;
-    static GameMode oldmode = (GameMode) -1;
+    static GameMode oldMode = (GameMode) -1;
     char *wname;
 
     if (!boardWidget || !XtIsRealized(boardWidget)) return;
@@ -1844,7 +1845,7 @@ ModeHighlight ()
        }
     }
 
-    wname = ModeToWidgetName(oldmode);
+    wname = ModeToWidgetName(oldMode);
     if (wname != NULL) {
        MarkMenuItem(wname, False);
     }
@@ -1852,8 +1853,9 @@ ModeHighlight ()
     if (wname != NULL) {
        MarkMenuItem(wname, True);
     }
-    oldmode = gameMode;
+    if(oldMode == TwoMachinesPlay) EnableNamedMenuItem("Mode.MachineMatch", True);
     MarkMenuItem("Mode.MachineMatch", matchMode && matchGame < appData.matchGames);
+    oldMode = gameMode;
 
     /* Maybe all the enables should be handled here, not just this one */
     EnableNamedMenuItem("Mode.Training", gameMode == Training || gameMode == PlayFromGameFile);
@@ -1996,6 +1998,7 @@ PasteGameCB (Widget w, XtPointer client_data, Atom *selection,
             Atom *type, XtPointer value, unsigned long *len, int *format)
 {
   FILE* f;
+  int flip = appData.flipView;
   if (value == NULL || *len == 0) {
     return; /* nothing had been selected to copy */
   }
@@ -2007,7 +2010,9 @@ PasteGameCB (Widget w, XtPointer client_data, Atom *selection,
   fwrite(value, 1, *len, f);
   fclose(f);
   XtFree(value);
+  if(!appData.autoFlipView) appData.flipView = flipView;
   LoadGameFromFile(gamePasteFilename, 0, gamePasteFilename, TRUE);
+  appData.flipView = flip;
 }
 
 /* called when Paste Game button is pressed,