parent, NULL, 0);
j = 0;
XtSetArg(args[j], XtNwidth, 100); j++;
- XtSetArg(args[j], XtNlabel, _(mb[i])); j++;
// XtSetArg(args[j], XtNright, XtChainRight); j++;
while (mb[i] != NULL) {
+ XtSetArg(args[j], XtNlabel, _(mb[i]));
entry = XtCreateManagedWidget(mb[i], smeBSBObjectClass,
- menu, args, j);
+ menu, args, j+1);
XtAddCallback(entry, XtNcallback,
(XtCallbackProc) ComboSelect,
(caddr_t)(intptr_t) (256*n+i));
PopDown(prms[0][0] - '0');
}
-char *engineName, *engineDir, *engineChoice, *engineLine;
+char *engineName, *engineDir, *engineChoice, *engineLine, *nickName, *params;
Boolean isUCI, hasBook, storeVariant, v1, addToList;
extern Option installOptions[], matchOptions[];
char *engineNr[] = { N_("First Engine"), N_("Second Engine"), NULL };
if(currentCps) {
snprintf(buf, MSG_SIZ, "option %s=%s\n", currentOption[i].name, val);
SendToProgram(buf, currentCps);
- } else *dest = currentOption[i].name + 100; // option gets to point to private storage;
+ } else {
+ if(*dest) free(*dest);
+ *dest = malloc(strlen(val)+1);
+ }
safeStrCpy(*dest, val, MSG_SIZ - (*dest - currentOption[i].name)); // copy text there
}
break;
}
Option commentOptions[] = {
-{ 0xD, 200, 300, NULL, (void*) &commentText, "", NULL, TextBox, "" },
-{ 0, 0, 0, NULL, (void*) &ClearComment, NULL, NULL, Button, "clear" },
-{ 0, 1, 0, NULL, (void*) &SaveChanges, NULL, NULL, Button, "save changes" },
+{ 0xD, 200, 250, NULL, (void*) &commentText, "", NULL, TextBox, "" },
+{ 0, 0, 50, NULL, (void*) &ClearComment, NULL, NULL, Button, "clear" },
+{ 0, 1, 100, NULL, (void*) &SaveChanges, NULL, NULL, Button, "save changes" },
{ 0, 1, 0, NULL, (void*) &NewComCallback, "", NULL, EndMark , "" }
};
XtSetArg(args[0], XtNstring, text);
XtSetValues(commentOptions[0].handle, args, 1);
}
- commentText = text;
+ if(commentText) free(commentText); commentText = strdup(text);
commentIndex = index;
MarkMenu("menuView.Show Comments", 1);
if(GenericPopUp(commentOptions, title, 1))
Option tagsOptions[] = {
{ 0, 0, 0, NULL, NULL, NULL, NULL, Label, "" },
-{ 0xD, 200, 250, NULL, (void*) &tagsText, "", NULL, TextBox, "" },
-{ 0, 0, 0, NULL, (void*) &changeTags, NULL, NULL, Button, "save changes" },
+{ 0xD, 200, 200, NULL, (void*) &tagsText, "", NULL, TextBox, "" },
+{ 0, 0, 100, NULL, (void*) &changeTags, NULL, NULL, Button, "save changes" },
{ 0, 1, 0, NULL, (void*) &NewTagsCallback, "", NULL, EndMark , "" }
};
XtSetArg(args[0], XtNstring, text);
XtSetValues(tagsOptions[1].handle, args, 1);
}
- tagsText = text;
+ if(tagsText) free(tagsText); tagsText = strdup(text);
tagsOptions[0].textValue = msg;
MarkMenu("menuView.Show Tags", 2);
GenericPopUp(tagsOptions, _("Tags"), 2);
Cardinal *nprms;
{
isUCI = addToList = storeVariant = v1 = False; hasBook = True; // defaults
- engineDir = nickName = "";
if(engineChoice) free(engineChoice); engineChoice = strdup(engineNr[0]);
if(engineLine) free(engineLine); engineLine = strdup("");
+ if(engineDir) free(engineDir); engineDir = strdup("");
+ if(nickName) free(nickName); nickName = strdup("");
+ if(params) free(params); params = strdup("");
NamesToList(firstChessProgramNames, engineList, engineMnemonic);
GenericPopUp(installOptions, _("Load engine"), 0);
}