Clip texts on menu bar
[xboard.git] / xboard.c
index e777ea9..39bc62d 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -1686,7 +1686,7 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     int i;
     static Dimension oldWidth, oldHeight;
     static VariantClass oldVariant;
-    static int oldDual = -1;
+    static int oldDual = -1, oldMono = -1;
 
     if(!formWidget) return;
 
@@ -1765,7 +1765,7 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     // [HGM] pieces: tailor piece bitmaps to needs of specific variant
     // (only for xpm)
 
-    if(gameInfo.variant == oldVariant) return; // and only if variant changed
+  if(gameInfo.variant != oldVariant) { // and only if variant changed
 
     if(useImages) {
       for(i=0; i<4; i++) {
@@ -1833,9 +1833,12 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
        }
       }
     }
+  }
 #if HAVE_LIBXPM
+  if(appData.monoMode == oldMono)
     CreateAnimVars();
 #endif
+  oldMono = appData.monoMode;
 }
 #endif
 
@@ -3949,11 +3952,13 @@ void CreateMenuBarPopup(parent, name, mb)
 Widget CreateMenuBar(mb)
      Menu *mb;
 {
-    int j;
+    int j, nChar=0, nr=0, boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
     Widget anchor, menuBar;
     Arg args[16];
     char menuName[MSG_SIZ];
 
+    while(mb[nr].name != NULL) nChar += strlen(_(mb[nr++].name)) + 3;
+
     j = 0;
     XtSetArg(args[j], XtNorientation, XtorientHorizontal);  j++;
     XtSetArg(args[j], XtNvSpace, 0);                        j++;
@@ -3974,6 +3979,7 @@ Widget CreateMenuBar(mb)
        }
       else {
        XtSetArg(args[j], XtNlabel, XtNewString(_(mb->name))); j++;
+       XtSetArg(args[j], XtNwidth, (boardWidth-40)*(strlen(_(mb->name)) + 3)/nChar); j++;
       }
 
        XtSetArg(args[j], XtNborderWidth, 0);                   j++;
@@ -4639,6 +4645,12 @@ void DrawSquare(row, column, piece, do_flash)
        }
     }
     if(!partnerUp && marker[row][column]) {
+       if(appData.monoMode) {
+           XFillArc(xDisplay, xBoardWindow, marker[row][column] == 2 ? darkSquareGC : lightSquareGC,
+                   x + squareSize/4, y+squareSize/4, squareSize/2, squareSize/2, 0, 64*360);
+           XDrawArc(xDisplay, xBoardWindow, marker[row][column] == 2 ? lightSquareGC : darkSquareGC,
+                   x + squareSize/4, y+squareSize/4, squareSize/2, squareSize/2, 0, 64*360);
+       } else
        XFillArc(xDisplay, xBoardWindow, marker[row][column] == 2 ? prelineGC : highlineGC,
                x + squareSize/4, y+squareSize/4, squareSize/2, squareSize/2, 0, 64*360);
     }