/*
* xoptions.c -- Move list window, part of X front end for XBoard
*
- * Copyright 2000, 2009, 2010 Free Software Foundation, Inc.
+ * Copyright 2000, 2009, 2010, 2011 Free Software Foundation, Inc.
* ------------------------------------------------------------------------
*
* GNU XBoard is free software: you can redistribute it and/or modify
void SetFocus(Widget w, XtPointer data, XEvent *event, Boolean *b)
{
- Arg args;
+ Arg args[2];
+ char *s;
if(previous) {
- XtSetArg(args, XtNdisplayCaret, False);
- XtSetValues(previous, &args, 1);
+ XtSetArg(args[0], XtNdisplayCaret, False);
+ XtSetValues(previous, args, 1);
}
- XtSetArg(args, XtNdisplayCaret, True);
- XtSetValues(w, &args, 1);
+ XtSetArg(args[0], XtNstring, &s);
+ XtGetValues(w, args, 1);
+ XtSetArg(args[0], XtNdisplayCaret, True);
+ XtSetArg(args[1], XtNinsertPosition, strlen(s));
+ XtSetValues(w, args, 2);
XtSetKeyboardFocus((Widget) data, w);
previous = w;
}
XtPointer client_data, call_data;
{
String name, txt;
- Widget w2;
Arg args[16];
char buf[MSG_SIZ];
int j;
return;
}
if (strcmp(name, _(" OK ")) == 0) {
- int inc, mps, tc, ok;
+ int inc, mps, ok;
XtSetArg(args[0], XtNstring, &txt);
XtGetValues(tcData, args, 1);
switch(tcInc) {
void TimeControlPopUp()
{
Arg args[16];
- Widget popup, layout, form, edit, b_ok, b_cancel, b_clas, b_inc, mess;
+ Widget popup, layout, form, b_ok, b_cancel, b_clas, b_inc, mess;
Window root, child;
int x, y, i, j;
int win_x, win_y;
XtPointer client_data, call_data;
{
String name;
- Widget s2;
Arg args[16];
- char buf[80];
int j;
XtSetArg(args[0], XtNlabel, &name);
void EnginePopUp()
{
Arg args[16];
- Widget popup, layout, form, edit, b_ok, b_cancel, b_clas, b_inc, s1;
+ Widget popup, layout, form, b_ok, b_cancel, s1;
Window root, child;
int x, y, i, j, width;
int win_x, win_y;
{N_("give-away"), "#FFFFBF", 0, VariantGiveaway},
{N_("losers"), "#FFFFBF", 0, VariantLosers},
{N_("fairy"), "#BFBFBF", 0, VariantFairy},
+ {N_("Seirawan"), "#FFBFBF", 0, VariantSChess},
{N_("Superchess"), "#FFBFBF", 0, VariantSuper},
{N_("crazyhouse"), "#FFBFBF", 0, VariantCrazyhouse},
{N_("bughouse"), "#FFBFBF", 0, VariantBughouse},
{N_("shogi (9x9)"), "#BFFFFF", 0, VariantShogi},
{N_("xiangqi (9x10)"), "#BFFFFF", 0, VariantXiangqi},
{N_("courier (12x8)"), "#BFFFBF", 0, VariantCourier},
- {N_("janus (10x8)"), "#BFBFFF", 0, VariantJanus},
{N_("Capablanca (10x8)"), "#BFBFFF", 0, VariantCapablanca},
- {N_("CRC (10x8)"), "#BFBFFF", 0, VariantCapaRandom},
#ifdef GOTHIC
{N_("Gothic (10x8)"), "#BFBFFF", 0, VariantGothic},
#endif
+ {N_("janus (10x8)"), "#BFBFFF", 0, VariantJanus},
+ {N_("CRC (10x8)"), "#BFBFFF", 0, VariantCapaRandom},
#ifdef FALCON
{N_("Falcon (10x8)"), "#BFBFFF", 0, VariantFalcon},
#endif
+ {N_("Spartan"), "#FF0000", 0, VariantSpartan},
{NULL, 0, 0, (VariantClass) 0}
};
XtPointer client_data, call_data;
{
String name;
- Widget w2;
Arg args[16];
- char buf[MSG_SIZ];
VariantClass v;
XtSetArg(args[0], XtNlabel, &name);
void NewVariantPopUp()
{
Arg args[16];
- Widget popup, layout, dialog, edit, form, last = NULL, b_ok, b_cancel;
+ Widget popup, layout, form, last = NULL, b_ok, b_cancel;
Window root, child;
int x, y, i, j;
int win_x, win_y;
unsigned int mask;
- char def[80];
XrmValue vFrom, vTo;
i = 0;
XtSetArg(args[j], XtNradioData, i+1); j++;
XtSetArg(args[j], XtNbackground, buttonColor); j++;
XtSetArg(args[j], XtNstate, gameInfo.variant == buttonDesc[i].variant); j++;
+ XtSetArg(args[j], XtNsensitive, appData.noChessProgram || strstr(first.variants, VariantName(buttonDesc[i].variant))); j++;
buttonDesc[i].handle = last =
XtCreateManagedWidget(buttonDesc[i].name, toggleWidgetClass, form, args, j);
}
{
String name;
Arg args[16];
- char buf[80];
int oldCores = appData.smpCores, ponder = 0;
XtSetArg(args[0], XtNlabel, &name);
XtGetValues(w, args, 1);
if (strcmp(name, _("OK")) == 0) {
- int nr, i, j; String name;
+ int i, j; String name;
for(i=0; i<6; i++) {
XtSetArg(args[0], XtNstring, &name);
XtGetValues(controlDesc[i].handle, args, 1);
void UciPopUp()
{
Arg args[16];
- Widget popup, layout, dialog, edit, form, b_ok, b_cancel, last = NULL, new, upperLeft;
+ Widget popup, layout, form, b_ok, b_cancel, last = NULL, new, upperLeft;
Window root, child;
int x, y, i, j;
int win_x, win_y;
XtPointer client_data, call_data;
{
String name, val;
- Widget w2;
Arg args[16];
char buf[MSG_SIZ];
- int i, j;
+ int j;
int data = (intptr_t) client_data;
XtSetArg(args[0], XtNlabel, &name);
XtPointer client_data, call_data;
{
String name, val;
- Widget w2;
Arg args[16];
char buf[MSG_SIZ];
int i, j;
return;
}
if (strcmp(name, _("OK")) == 0 || data) { // save buttons imply OK
- int nr;
-
for(i=0; i<currentCps->nrOptions; i++) { // send all options that had to be OK-ed to engine
switch(currentCps->option[i].type) {
case TextBox:
XtSetArg(args[0], XtNstring, &val);
XtGetValues(currentCps->option[i].handle, args, 1);
if(strcmp(currentCps->option[i].textValue, val)) {
- safeStrCpy(currentCps->option[i].textValue, val, sizeof(currentCps->option[i].textValue)/sizeof(currentCps->option[i].textValue[0]));
+ safeStrCpy(currentCps->option[i].textValue, val, MSG_SIZ - (currentCps->option[i].textValue - currentCps->option[i].name) );
snprintf(buf, MSG_SIZ, "option %s=%s\n", currentCps->option[i].name, val);
SendToProgram(buf, currentCps);
}
SendToProgram(buf, currentCps);
}
break;
+ default:
+ if( appData.debugMode )
+ fprintf(debugFP, "SettingsPopUp: unexpected case in switch.\n");
+ break;
}
}
if(data) { // send save-button command to engine
}
}
-void SettingsPopUp(ChessProgramState *cps)
+void
+SettingsPopUp(ChessProgramState *cps)
{
Arg args[16];
- Widget popup, layout, dialog, edit=NULL, form, oldform, last, b_ok, b_cancel, leftMargin = NULL, textField = NULL;
+ Widget popup, layout, dialog, edit=NULL, form, last, b_ok, b_cancel, leftMargin = NULL, textField = NULL;
Window root, child;
int x, y, i, j, height, width, h, c;
int win_x, win_y, maxWidth, maxTextWidth;
unsigned int mask;
- char def[MSG_SIZ], *p, *q;
+ char def[MSG_SIZ];
static char pane[6] = "paneX";
Widget texts[100], forelast = NULL, anchor, widest;
CreateComboPopup(last, cps->option[i].name, i, (char **) cps->option[i].textValue);
values[i] = cps->option[i].value;
break;
+ default:
+ if( appData.debugMode )
+ fprintf(debugFP, "SettingsPopUp: unexpected case in switch.\n");
+ break;
}
}
String *prms;
Cardinal *nprms;
{
+ if(WaitForSecond(SettingsMenuIfReady)) return;
SettingsPopUp(&second);
}