changes from H.G. Muller; version 4.3.8
[xboard.git] / winboard / winboard.c
index 7369520..7302223 100644 (file)
@@ -3319,6 +3319,7 @@ DrawPieceOnDC(HDC hdc, ChessSquare piece, int color, int sqcolor, int x, int y,
 {\r
   HBITMAP oldBitmap;\r
   HBRUSH oldBrush;\r
+  int tmpSize;\r
 \r
   if (appData.blindfold) return;\r
 \r
@@ -3358,6 +3359,7 @@ DrawPieceOnDC(HDC hdc, ChessSquare piece, int color, int sqcolor, int x, int y,
     BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0,\r
           sqcolor ? SRCCOPY : NOTSRCCOPY);\r
   } else {\r
+    tmpSize = squareSize;\r
     if(minorSize &&\r
         (piece >= (int)WhiteNightrider && piece <= WhiteGrasshopper ||\r
          piece >= (int)BlackNightrider && piece <= BlackGrasshopper)  ) {\r
@@ -3365,24 +3367,31 @@ DrawPieceOnDC(HDC hdc, ChessSquare piece, int color, int sqcolor, int x, int y,
       /* Bitmaps of smaller size are substituted, but we have to align them */\r
       x += (squareSize - minorSize)>>1;\r
       y += squareSize - minorSize - 2;\r
+      tmpSize = minorSize;\r
     }\r
     if (color || appData.allWhite ) {\r
       oldBitmap = SelectObject(tmphdc, PieceBitmap(piece, WHITE_PIECE));\r
       if( color )\r
               oldBrush = SelectObject(hdc, whitePieceBrush);\r
       else    oldBrush = SelectObject(hdc, blackPieceBrush);\r
-      BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0, 0x00B8074A);\r
+      if(appData.upsideDown && !color)\r
+        StretchBlt(hdc, x, y+tmpSize, tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, 0x00B8074A);\r
+      else\r
+        BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
 #if 0\r
       /* Use black piece color for outline of white pieces */\r
       /* Not sure this looks really good (though xboard does it).\r
         Maybe better to have another selectable color, default black */\r
       SelectObject(hdc, blackPieceBrush); /* could have own brush */\r
       SelectObject(tmphdc, PieceBitmap(piece, OUTLINE_PIECE));\r
-      BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0, 0x00B8074A);\r
+      BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
 #else\r
       /* Use black for outline of white pieces */\r
       SelectObject(tmphdc, PieceBitmap(piece, OUTLINE_PIECE));\r
-      BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0, SRCAND);\r
+      if(appData.upsideDown && !color)\r
+        StretchBlt(hdc, x, y+tmpSize, tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, SRCAND);\r
+      else\r
+        BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, SRCAND);\r
 #endif\r
     } else {\r
 #if 0\r
@@ -3393,15 +3402,18 @@ DrawPieceOnDC(HDC hdc, ChessSquare piece, int color, int sqcolor, int x, int y,
         Maybe better to have another selectable color, default medium gray? */\r
       oldBitmap = SelectObject(tmphdc, PieceBitmap(piece, BLACK_PIECE));\r
       oldBrush = SelectObject(hdc, whitePieceBrush); /* could have own brush */\r
-      BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0, 0x00B8074A);\r
+      BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
       SelectObject(tmphdc, PieceBitmap(piece, SOLID_PIECE));\r
       SelectObject(hdc, blackPieceBrush);\r
-      BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0, 0x00B8074A);\r
+      BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
 #else\r
       /* Use square color for details of black pieces */\r
       oldBitmap = SelectObject(tmphdc, PieceBitmap(piece, SOLID_PIECE));\r
       oldBrush = SelectObject(hdc, blackPieceBrush);\r
-      BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0, 0x00B8074A);\r
+      if(appData.upsideDown)\r
+        StretchBlt(hdc, x, y+tmpSize, tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, 0x00B8074A);\r
+      else\r
+        BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
 #endif\r
     }\r
     SelectObject(hdc, oldBrush);\r
@@ -4706,6 +4718,12 @@ Promotion(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     ShowWindow(GetDlgItem(hDlg, PB_Bishop), \r
        gameInfo.variant != VariantShogi ?\r
               SW_SHOW : SW_HIDE);\r
+    ShowWindow(GetDlgItem(hDlg, IDC_Yes), \r
+       gameInfo.variant == VariantShogi ?\r
+              SW_SHOW : SW_HIDE);\r
+    ShowWindow(GetDlgItem(hDlg, IDC_No), \r
+       gameInfo.variant == VariantShogi ?\r
+              SW_SHOW : SW_HIDE);\r
     return TRUE;\r
 \r
   case WM_COMMAND: /* message: received a command */\r