char *p, *q, buf[MSG_SIZ];
int n, min = (-1)<<31, max = 1<<31, def;
+ opt->target = &opt->value; // OK for spin/slider and checkbox
if(p = strstr(opt->name, " -spin ")) {
if((n = sscanf(p, " -spin %d %d %d", &def, &min, &max)) < 3 ) return FALSE;
if(max < min) max = min; // enforce consistency
} else if((p = strstr(opt->name, " -string "))) {
opt->textValue = p+9;
opt->type = TextBox;
+ opt->target = &opt->textValue;
} else if((p = strstr(opt->name, " -file "))) {
// for now -file is a synonym for -string, to already provide compatibility with future polyglots
- opt->textValue = p+7;
+ opt->target = opt->textValue = p+7;
opt->type = FileName; // FileName;
+ opt->target = &opt->textValue;
} else if((p = strstr(opt->name, " -path "))) {
// for now -file is a synonym for -string, to already provide compatibility with future polyglots
- opt->textValue = p+7;
+ opt->target = opt->textValue = p+7;
opt->type = PathName; // PathName;
+ opt->target = &opt->textValue;
} else if(p = strstr(opt->name, " -check ")) {
if(sscanf(p, " -check %d", &def) < 1) return FALSE;
opt->value = (def != 0);
(cb == TwoMachinesEventIfReady)) {
CancelDelayedEvent();
ScheduleDelayedEvent(cb, val ? 1 : 3600000);
- }
+ } else if(!val && !cps->reload) ClearOptions(cps); // let 'spurious' done=0 clear engine's option list
cps->initDone = val;
- if(val) cps->reload = FALSE;
+ if(val) cps->reload = FALSE, RefreshSettingsDialog(cps, val);
}
/* Parse feature command from engine */
void CreateBookEvent P((void));
char *SupportedVariant P((char *list, VariantClass v, int w, int h, int s, int proto, char *engine));
char *CollectPieceDescriptors P((void));
+void RefreshSettingsDialog P((ChessProgramState *cps, int val));
/* A point in time */
SetCurrentComboSelection (Option *opt)
{
int j;
+ if(currentCps) ; else
if(!opt->textValue) opt->value = *(int*)opt->target; /* numeric */else {
for(j=0; opt->choice[j]; j++) // look up actual value in list of possible values, to get selection nr
if(*(char**)opt->target && !strcmp(*(char**)opt->target, ((char**)opt->textValue)[j])) break;
opt->value = j + (opt->choice[j] == NULL);
}
+ SetComboChoice(opt, opt->value);
return opt->value;
}
SettingsPopUp(&second);
}
+void
+RefreshSettingsDialog (ChessProgramState *cps, int val)
+{
+ if(val == 1) { // option values changed
+ if(shellUp[TransientDlg] && cps == currentCps) {
+ GenericUpdate(cps->option, -1); // normally update values when dialog is up
+ }
+ return; // and be done
+ }
+ if(val == 2) { // option list changed
+ if(!shellUp[TransientDlg] || cps != currentCps) return; // our dialog is not up, so nothing to do
+ }
+ PopDown(TransientDlg); // make sure any other dialog closes first
+ SettingsPopUp(cps); // and popup new one
+}
+
//----------------------------------------------- Load Engine --------------------------------------
char *engineDir, *engineLine, *nickName, *params;
void GetWidgetState P((Option *opt, int *state));
void SetWidgetState P((Option *opt, int state));
void SetWidgetLabel P((Option *opt, char *buf));
+void SetComboChoice P((Option *opt, int choice));
void SetDialogTitle P((DialogClass dlg, char *title));
void LoadListBox P((Option *opt, char *emptyText, int n1, int n2));
void HighlightListBoxItem P((Option *opt, int nr));
}
void
+SetComboChoice (Option *opt, int n)
+{
+ gtk_combo_box_set_active(opt->handle, n);
+}
+
+void
SetDialogTitle (DialogClass dlg, char *title)
{
gtk_window_set_title(GTK_WINDOW(shells[dlg]), title);
}
void
+SetComboChoice (Option *opt, char *n)
+{
+ SetWidgetText(opt, opt->choice[n]);
+}
+
+void
SetDialogTitle (DialogClass dlg, char *title)
{
Arg args[16];