From: H.G. Muller Date: Wed, 28 Dec 2011 14:17:49 +0000 (+0100) Subject: Clip texts on menu bar X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=971e8861ca82286fa3d6e850dd80277875cee983;p=xboard.git Clip texts on menu bar The width of the items on the main menu bar is restricted so the bar will never exceed board width. --- diff --git a/xboard.c b/xboard.c index ecf421c..39bc62d 100644 --- a/xboard.c +++ b/xboard.c @@ -3952,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++; @@ -3977,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++;