{ // 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
}
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:
{
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<W_BOARD; i++) mainOptions[i].type = -1;
for(i=0; i<8; i++) mainOptions[i+1].choice = (char**) menuBar[i].mi;
GenericPopUp(mainOptions, "XBoard", BoardWindow, BoardWindow, NONMODAL, 1);
return mainOptions;
SlavePopUp ()
{
// copy params from main board
- dualOptions[0].choice = mainOptions[11].choice;
- dualOptions[1].choice = mainOptions[12].choice;
- dualOptions[3].value = mainOptions[22].value;
- dualOptions[3].max = dualOptions[2].max = mainOptions[22].max; // board size
- dualOptions[0].max = dualOptions[1].max = mainOptions[11].max; // clock width
+ dualOptions[0].choice = mainOptions[W_WHITE].choice;
+ dualOptions[1].choice = mainOptions[W_BLACK].choice;
+ dualOptions[3].value = mainOptions[W_BOARD].value;
+ dualOptions[3].max = dualOptions[2].max = mainOptions[W_BOARD].max; // board size
+ dualOptions[0].max = dualOptions[1].max = mainOptions[W_WHITE].max; // clock width
GenericPopUp(dualOptions, "XBoard", DummyDlg, BoardWindow, NONMODAL, 1);
}
DisplayTimerLabel(&dualOptions[0], _("White"), timeRemaining, highlight);
return;
}
- DisplayTimerLabel(&mainOptions[11], _("White"), timeRemaining, highlight);
+ DisplayTimerLabel(&mainOptions[W_WHITE], _("White"), timeRemaining, highlight);
if(highlight) SetClockIcon(0);
}
DisplayTimerLabel(&dualOptions[1], _("Black"), timeRemaining, highlight);
return;
}
- DisplayTimerLabel(&mainOptions[12], _("Black"), timeRemaining, highlight);
+ DisplayTimerLabel(&mainOptions[W_BLACK], _("Black"), timeRemaining, highlight);
if(highlight) SetClockIcon(1);
}
/* need to test if messageWidget already exists, since this function
can also be called during the startup, if for example a Xresource
is not set up correctly */
- if(mainOptions[14].handle)
- SetWidgetLabel(&mainOptions[14], message);
+ if(mainOptions[W_MESSG].handle)
+ SetWidgetLabel(&mainOptions[W_MESSG], message);
return;
}
#else
&clockFonStruct);
#endif
- boardWidget = optList[22].handle;
- menuBarWidget = optList[ 0].handle;
- dropMenu = optList[25].handle;
- titleWidget = optList[optList[10].type != -1 ? 10 : 13].handle;
+ boardWidget = optList[W_BOARD].handle;
+ menuBarWidget = optList[W_MENU].handle;
+ dropMenu = optList[W_DROP].handle;
+ titleWidget = optList[optList[W_TITLE].type != -1 ? W_TITLE : W_SMALL].handle;
formWidget = XtParent(boardWidget);
XtSetArg(args[0], XtNbackground, &timerBackgroundPixel);
XtSetArg(args[1], XtNforeground, &timerForegroundPixel);
- XtGetValues(optList[11].handle, args, 2);
+ XtGetValues(optList[W_WHITE].handle, args, 2);
if (appData.showButtonBar) { // can't we use timer pixels for this? (Or better yet, just black & white?)
XtSetArg(args[0], XtNbackground, &buttonBackgroundPixel);
XtSetArg(args[1], XtNforeground, &buttonForegroundPixel);
- XtGetValues(optList[18].handle, args, 2);
+ XtGetValues(optList[W_PAUSE].handle, args, 2);
}
AppendEnginesToMenu(appData.recentEngineList);
void
EnableButtonBar (int state)
{
- XtSetSensitive(optList[15].handle, state);
+ XtSetSensitive(optList[W_BUTTON].handle, state);
}
void
AppendMenuItem (char *msg, int n)
{
- CreateMenuItem((Widget) optList[6].textValue, msg, (XtCallbackProc) MenuEngineSelect, n);
+ CreateMenuItem((Widget) optList[W_ENGIN].textValue, msg, (XtCallbackProc) MenuEngineSelect, n);
}
void
{
if (frozen) return;
/* Grab by a widget that doesn't accept input */
- XtAddGrab(optList[14].handle, TRUE, FALSE);
+ XtAddGrab(optList[W_MESSG].handle, TRUE, FALSE);
frozen = 1;
}
ThawUI ()
{
if (!frozen) return;
- XtRemoveGrab(optList[14].handle);
+ XtRemoveGrab(optList[W_MESSG].handle);
frozen = 0;
}
Pixel oldbg, oldfg;
XtSetArg(args[0], XtNbackground, &oldbg);
XtSetArg(args[1], XtNforeground, &oldfg);
- XtGetValues(optList[18].handle,
+ XtGetValues(optList[W_PAUSE].handle,
args, 2);
XtSetArg(args[0], XtNbackground, oldfg);
XtSetArg(args[1], XtNforeground, oldbg);
}
- XtSetValues(optList[18].handle, args, 2);
+ XtSetValues(optList[W_PAUSE].handle, args, 2);
}
}