From 971e8861ca82286fa3d6e850dd80277875cee983 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 28 Dec 2011 15:17:49 +0100 Subject: [PATCH] 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. --- xboard.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) 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++; -- 1.7.0.4