Also render coordinates to backup board
[xboard.git] / xboard.c
index 6d8f18c..5dc557c 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -1055,7 +1055,6 @@ InitDrawingSizes (BoardSize boardSize, int flags)
     }
     for(i=0; i<2; i++) {
        int p;
-printf("Copy pieces\n");
        for(p=0; p<=(int)WhiteKing; p++)
           pngPieceBitmaps[i][p] = pngPieceBitmaps2[i][p]; // defaults
     }
@@ -2602,6 +2601,24 @@ BlankSquare (int x, int y, int color, ChessSquare piece, Drawable dest, int fac)
        XCopyArea(xDisplay, xpmBoardBitmap[color], dest, wlPieceGC, x0, y0,
                  squareSize, squareSize, x*fac, y*fac);
     } else
+    if(csBoardWindow) {
+       cairo_t *cr = cairo_create (csBoardWindow);
+       char *col;
+       switch (color) {
+         case 0: col = appData.darkSquareColor; break;
+         case 1: col = appData.lightSquareColor; break;
+         case 2: col = "#000000"; break;
+       }
+       SetPen(cr, 2.0, col, 0);
+       cairo_rectangle (cr, x, y, squareSize, squareSize);
+       cairo_fill (cr);
+       cairo_destroy (cr);
+       cr = cairo_create (csBoardBackup);
+       SetPen(cr, 2.0, col, 0);
+       cairo_rectangle (cr, x, y, squareSize, squareSize);
+       cairo_fill (cr);
+       cairo_destroy (cr);
+    } else
     if (useImages && useImageSqs) {
        Pixmap pm;
        switch (color) {
@@ -2858,6 +2875,32 @@ DrawOneSquare (int x, int y, ChessSquare piece, int square_color, int marker, ch
        if (appData.monoMode) {
            XDrawImageString(xDisplay, xBoardWindow, hGC, xx, yy, string, 1);
        } else {
+           if(*appData.pngDirectory) {
+               cairo_t *cr = cairo_create (csBoardWindow);
+               cairo_select_font_face (cr, "Sans",
+                           CAIRO_FONT_SLANT_NORMAL,
+                           CAIRO_FONT_WEIGHT_BOLD);
+
+               cairo_set_font_size (cr, squareSize/4);
+
+               cairo_move_to (cr, xx-1, yy);
+               if(align < 3) cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+               else          cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+               cairo_show_text (cr, string);
+               cairo_destroy (cr);
+               cr = cairo_create (csBoardBackup);
+               cairo_select_font_face (cr, "Sans",
+                           CAIRO_FONT_SLANT_NORMAL,
+                           CAIRO_FONT_WEIGHT_BOLD);
+
+               cairo_set_font_size (cr, squareSize/4);
+
+               cairo_move_to (cr, xx-1, yy);
+               if(align < 3) cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+               else          cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+               cairo_show_text (cr, string);
+               cairo_destroy (cr);
+           } else
            XDrawString(xDisplay, xBoardWindow, hGC, xx, yy, string, 1);
        }
     }
@@ -3038,10 +3081,8 @@ void DrawSeekText(char *buf, int x, int y)
     cairo_set_font_size (cr, 12.0);
 
     cairo_move_to (cr, x, y+4);
-    cairo_show_text( cr, buf);
-
     cairo_set_source_rgba(cr, 0, 0, 0,1.0);
-    cairo_stroke(cr);
+    cairo_show_text( cr, buf);
 
     /* free memory */
     cairo_destroy (cr);
@@ -4090,13 +4131,15 @@ CairoOverlayPiece (ChessSquare piece, cairo_surface_t *dest)
   static ChessSquare oldPiece = -1;
   static int oldSize;
   static cairo_t *pieceSource;
+  extern int doubleClick; // in backend.c
   if(piece != oldPiece || squareSize != oldSize) { // try make it faster by only changing cr if we need other piece
     if(pieceSource) cairo_destroy (pieceSource);
     pieceSource = cairo_create (dest);
     cairo_set_source_surface (pieceSource, pngPieceBitmaps[!White(piece)][piece % BlackPawn], 0, 0);
     oldPiece = piece; oldSize = squareSize;
   }
-  cairo_paint(pieceSource);
+  if(doubleClick) cairo_paint_with_alpha (pieceSource, 0.6);
+  else cairo_paint(pieceSource);
 }
 
 void