#include <stdint.h>
#include "common.h"
+#include "frontend.h"
#include "backend.h"
-#include "xboard.h"
+#include "xboard2.h"
#include "menus.h"
#include "dialogs.h"
#include "gettext.h"
}
nr = NamesToList(firstChessProgramNames, engineList, engineMnemonic, buf); // replace list by only the group contents
ASSIGN(engineMnemonic[0], buf);
- LoadListBox(&matchOptions[8], _("# no engines are installed"));
+ LoadListBox(&matchOptions[8], _("# no engines are installed"), -1, -1);
HighlightWithScroll(&matchOptions[8], 0, nr);
}
{ 0, -1, BOARD_RANKS-1, NULL, (void*) &appData.NrRanks, "", NULL, Spin, N_("Number of Board Ranks:") },
{ 0, -1, BOARD_FILES, NULL, (void*) &appData.NrFiles, "", NULL, Spin, N_("Number of Board Files:") },
{ 0, -1, BOARD_RANKS-1, NULL, (void*) &appData.holdingsSize, "", NULL, Spin, N_("Holdings Size:") },
-{ 0, 0, 0, NULL, NULL, NULL, NULL, Label,
- N_("WARNING: variants with un-orthodox\n"
- "pieces only have built-in bitmaps\n"
- "for -boardSize middling, bulky and\n"
- "petite, and substitute king or amazon\n"
- "for missing bitmaps. (See manual.)")},
{ 0, NO_OK, 0, NULL, NULL, "", NULL, EndMark , "" }
};
void
NewVariantProc ()
{
+ if(appData.noChessProgram) sprintf(warning, _("Only bughouse is not available in viewer mode")); else
sprintf(warning, _("All variants not supported by first engine\n(currently %s) are disabled"), first.tidy);
GenericPopUp(variantDescriptors, _("New Variant"), TransientDlg, BoardWindow, MODAL, 0);
}
{ 0, 0, 0, NULL, (void*) &appData.monoMode, "", NULL, CheckBox, N_("Mono Mode") },
{ 0,-1, 5, NULL, (void*) &appData.overrideLineGap, "", NULL, Spin, N_("Line Gap ( -1 = default for board size):") },
{ 0, 0, 0, NULL, (void*) &appData.useBitmaps, "", NULL, CheckBox, N_("Use Board Textures") },
-{ 0, 0, 0, NULL, (void*) &appData.liteBackTextureFile, ".xpm", NULL, FileName, N_("Light-Squares Texture File:") },
-{ 0, 0, 0, NULL, (void*) &appData.darkBackTextureFile, ".xpm", NULL, FileName, N_("Dark-Squares Texture File:") },
+{ 0, 0, 0, NULL, (void*) &appData.liteBackTextureFile, ".png", NULL, FileName, N_("Light-Squares Texture File:") },
+{ 0, 0, 0, NULL, (void*) &appData.darkBackTextureFile, ".png", NULL, FileName, N_("Dark-Squares Texture File:") },
{ 0, 0, 0, NULL, (void*) &appData.trueColors, "", NULL, CheckBox, N_("Use external piece bitmaps with their own colors") },
{ 0, 0, 0, NULL, (void*) &appData.pieceDirectory, "", NULL, PathName, N_("Directory with Pieces Images:") },
{ 0, 0, 0, NULL, (void*) &BoardOptionsOK, "", NULL, EndMark , "" }
GenericPopUp(tagsOptions, title, TagsDlg, BoardWindow, NONMODAL, 1);
}
+void
+TagsPopUp (char *tags, char *msg)
+{
+ NewTagsPopup(tags, cmailMsgLoaded ? msg : NULL);
+}
+
+void
+EditTagsPopUp (char *tags, char **dest)
+{ // wrapper to preserve old name used in back-end
+ NewTagsPopup(tags, NULL);
+}
+
+void
+TagsPopDown()
+{
+ PopDown(TagsDlg);
+ bookUp = False;
+}
+
+void
+EditTagsProc ()
+{
+ if (bookUp || !PopDown(TagsDlg)) EditTagsEvent();
+}
+
//---------------------------------------------- ICS Input Box ----------------------------------
char *icsText;
void
SettingsPopUp (ChessProgramState *cps)
{
+ if(!cps->nrOptions) { DisplayNote(_("Engine has no options")); return; }
currentCps = cps;
GenericPopUp(cps->option, _("Engine Settings"), TransientDlg, BoardWindow, MODAL, 0);
}
}
nr = NamesToList(firstChessProgramNames, engineList, engineMnemonic, buf); // replace list by only the group contents
ASSIGN(engineMnemonic[0], buf);
- LoadListBox(&installOptions[1], _("# no engines are installed"));
+ LoadListBox(&installOptions[1], _("# no engines are installed"), -1, -1);
HighlightWithScroll(&installOptions[1], 0, nr);
}
tmpOdds1 = tmpOdds2 = 1; tcType = 0;
tmpTc = atoi(appData.timeControl);
GenericPopUp(tcOptions, _("Time Control"), TransientDlg, BoardWindow, MODAL, 0);
+ SetTcType(searchTime ? 2 : appData.timeIncrement < 0 ? 0 : 1);
}
//------------------------------- Ask Question -----------------------------------------
{ 0, SAME_ROW, 0, NULL, (void*) &PromoPick, NULL, NULL, Button, NULL },
{ 0, SAME_ROW, 0, NULL, (void*) &PromoPick, NULL, NULL, Button, NULL },
{ 0, SAME_ROW, 0, NULL, (void*) &PromoPick, NULL, NULL, Button, NULL },
+{ 0, SAME_ROW, 0, NULL, (void*) &PromoPick, NULL, NULL, Button, NULL },
{ 0, SAME_ROW | NO_OK, 0, NULL, NULL, "", NULL, EndMark , "" }
};
void
PromotionPopUp ()
{ // choice depends on variant: prepare dialog acordingly
- count = 7;
+ count = 8;
SetPromo(_("Cancel"), --count, 0); // Beware: GenericPopUp cannot handle user buttons named "cancel" (lowe case)!
if(gameInfo.variant != VariantShogi) {
if (!appData.testLegality || gameInfo.variant == VariantSuicide ||
if(index >= strlen(GLT_ALL_TAGS)) return;
strings[index] = strings[index+1];
strings[++index] = p;
+ LoadListBox(&listOptions[0], "?", index, index-1); // only change the two specified entries
} else
if (n == 2) {
if(index == 0) return;
strings[index] = strings[index-1];
strings[--index] = p;
+ LoadListBox(&listOptions[0], "?", index, index+1);
} else
if (n == 1) {
safeStrCpy(lpUserGLT, GLT_DEFAULT_TAGS, LPUSERGLT_SIZE);
GLT_TagsToList(lpUserGLT);
index = 0;
- LoadListBox(&listOptions[0], "?"); // Note: the others don't need this, as the highlight switching redraws the change items
+ LoadListBox(&listOptions[0], "?", -1, -1);
}
HighlightListBoxItem(&listOptions[0], index);
}
snprintf(buf, sizeof(buf), "%s: %s", message, strerror(error));
message = buf;
}
- if (appData.popupExitMessage && boardWidget && XtIsRealized(boardWidget)) {
- ErrorPopUp(status ? _("Fatal Error") : _("Exiting"), message, TRUE);
- } else {
- ExitEvent(status);
+ if(mainOptions[W_BOARD].handle) {
+ if (appData.popupExitMessage) {
+ ErrorPopUp(status ? _("Fatal Error") : _("Exiting"), message, TRUE);
+ } else {
+ ExitEvent(status);
+ }
}
}
}
Option mainOptions[] = { // description of main window in terms of generic dialog creator
-{ 0, 0xCA, 0, NULL, NULL, "", NULL, BoxBegin, "" }, // menu bar
+{ 0, 0xCA, 0, NULL, NULL, "", NULL, BarBegin, "" }, // menu bar
{ 0, COMBO_CALLBACK, 0, NULL, (void*)&MenuCallback, NULL, NULL, DropDown, N_("File") },
{ 0, COMBO_CALLBACK, 0, NULL, (void*)&MenuCallback, NULL, NULL, DropDown, N_("Edit") },
{ 0, COMBO_CALLBACK, 0, NULL, (void*)&MenuCallback, NULL, NULL, DropDown, N_("View") },
{ 0, COMBO_CALLBACK, 0, NULL, (void*)&MenuCallback, NULL, NULL, DropDown, N_("Engine") },
{ 0, COMBO_CALLBACK, 0, NULL, (void*)&MenuCallback, NULL, NULL, DropDown, N_("Options") },
{ 0, COMBO_CALLBACK, 0, NULL, (void*)&MenuCallback, NULL, NULL, DropDown, N_("Help") },
-{ 0, 0, 0, NULL, (void*)&SizeKludge, "", NULL, BoxEnd, "" },
+{ 0, 0, 0, NULL, (void*)&SizeKludge, "", NULL, BarEnd, "" },
{ 0, LR|T2T|BORDER|SAME_ROW, 0, NULL, NULL, "", NULL, Label, "1" }, // optional title in window
{ 50, LL|TT, 100, NULL, (void*) &LogoW, NULL, NULL, -1, "LogoW" }, // white logo
{ 0, L2L|T2T, 200, NULL, (void*) &CCB, NULL, NULL, Label, "White" }, // white clock
{
MenuProc *proc = (MenuProc *) (((MenuItem*)(mainOptions[n].choice))[values[n]].proc);
- (proc)();
+ if(!proc) RecentEngineEvent(values[n] - firstEngineItem); else (proc)();
}
static Option *
}
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;
+ AppendEnginesToMenu(appData.recentEngineList);
GenericPopUp(mainOptions, "XBoard", BoardWindow, BoardWindow, NONMODAL, 1);
return mainOptions;
}
Refresh (int pathFlag)
{
ListDir(pathFlag); // and make new one
- LoadListBox(&browseOptions[5], "");
- LoadListBox(&browseOptions[6], "");
+ LoadListBox(&browseOptions[5], "", -1, -1);
+ LoadListBox(&browseOptions[6], "", -1, -1);
SetWidgetLabel(&browseOptions[0], title);
}
if(byExtension == (n == 4)) return;
extFlag = byExtension = (n == 4);
qsort((void*)fileList, filePtr, sizeof(char*), &Comp);
- LoadListBox(&browseOptions[6], "");
+ LoadListBox(&browseOptions[6], "", -1, -1);
}
void