From 9d455a7f4ce66cc25d540d4dc5a65fdb1895cc2e Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 10 Apr 2012 20:03:46 +0200 Subject: [PATCH] Make reference to board widgets symbolic --- dialogs.c | 46 +++++++++++++++++++++++----------------------- dialogs.h | 18 ++++++++++++++++++ xboard.c | 24 ++++++++++++------------ 3 files changed, 53 insertions(+), 35 deletions(-) diff --git a/dialogs.c b/dialogs.c index 12b668a..df8750a 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1884,9 +1884,9 @@ SizeKludge (int n) { // callback called by GenericPopUp immediately after sizing the menu bar int width = BOARD_WIDTH*(squareSize + lineGap) + lineGap; int w = width - 44 - mainOptions[n].min; - mainOptions[10].max = w; // width left behind menu bar + mainOptions[W_TITLE].max = w; // width left behind menu bar if(w < 0.4*width) // if no reasonable amount of space for title, force small layout - mainOptions[13].type = mainOptions[10].type, mainOptions[10].type = -1; + mainOptions[W_SMALL].type = mainOptions[W_TITLE].type, mainOptions[W_TITLE].type = -1; } void @@ -1926,8 +1926,8 @@ Exp (int n, int x, int y) } switch(menuNr) { - case 0: return &mainOptions[shiftKey ? 23: 24]; - case 1: SetupDropMenu(); return &mainOptions[25]; + case 0: return &mainOptions[shiftKey ? W_MENUW: W_MENUB]; + case 1: SetupDropMenu(); return &mainOptions[W_DROP]; case 2: case -1: ErrorPopDown(); case -2: @@ -1941,16 +1941,16 @@ BoardPopUp (int squareSize, int lineGap, void *clockFontThingy) { extern Option *dialogOptions[]; int i, size = BOARD_WIDTH*(squareSize + lineGap) + lineGap; - mainOptions[11].choice = (char**) clockFontThingy; - mainOptions[12].choice = (char**) clockFontThingy; - mainOptions[22].value = BOARD_HEIGHT*(squareSize + lineGap) + lineGap; - mainOptions[22].max = mainOptions[13].max = size; // board size - mainOptions[13].max = size - 2; // board title (subtract border!) - mainOptions[12].max = mainOptions[11].max = size/2-3; // clock width - mainOptions[14].max = appData.showButtonBar ? size-130 : size-2; // message - mainOptions[0].max = size-40; // menu bar - mainOptions[10].type = appData.titleInWindow ? Label : -1 ; - if(!appData.showButtonBar) for(i=15; i<22; i++) mainOptions[i].type = -1; + mainOptions[W_WHITE].choice = (char**) clockFontThingy; + mainOptions[W_BLACK].choice = (char**) clockFontThingy; + mainOptions[W_BOARD].value = BOARD_HEIGHT*(squareSize + lineGap) + lineGap; + mainOptions[W_BOARD].max = mainOptions[W_SMALL].max = size; // board size + mainOptions[W_SMALL].max = size - 2; // board title (subtract border!) + mainOptions[W_BLACK].max = mainOptions[W_WHITE].max = size/2-3; // clock width + mainOptions[W_MESSG].max = appData.showButtonBar ? size-130 : size-2; // message + mainOptions[W_MENU].max = size-40; // menu bar + mainOptions[W_TITLE].type = appData.titleInWindow ? Label : -1 ; + if(!appData.showButtonBar) for(i=W_BUTTON; i