X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=dialogs.c;h=db7e249f24bba8ac082f923743523f0092545dfd;hb=21a44c336aa8cd16a38f3c682386528c8f112650;hp=721b2a291bb2b950bd08f9d8c87484933dc9475b;hpb=54fc63f1e8ea41966f47d2b60b616db0a9c5010d;p=xboard.git diff --git a/dialogs.c b/dialogs.c index 721b2a2..db7e249 100644 --- a/dialogs.c +++ b/dialogs.c @@ -48,8 +48,9 @@ extern char *getenv(); #include #include "common.h" +#include "frontend.h" #include "backend.h" -#include "xboard.h" +#include "xboard2.h" #include "menus.h" #include "dialogs.h" #include "gettext.h" @@ -439,12 +440,6 @@ static Option variantDescriptors[] = { { 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 , "" } }; @@ -484,6 +479,7 @@ Pick (int n) 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); } @@ -752,13 +748,13 @@ SoundOptionsProc () static void DefColor P((int n)); static void AdjustColor P((int i)); -static char oldPngDir[MSG_SIZ]; +static char oldPieceDir[MSG_SIZ]; static int BoardOptionsOK (int n) { if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap; else lineGap = defaultLineGap; - InitDrawingParams(strcmp(oldPngDir, appData.pngDirectory)); + InitDrawingParams(strcmp(oldPieceDir, appData.pieceDirectory)); InitDrawingSizes(-1, 0); DrawPosition(True, NULL); return 1; @@ -810,9 +806,10 @@ static Option boardOptions[] = { { 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.pngDirectory, "", NULL, PathName, N_("Directory with PNG Pieces:") }, +{ 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 , "" } }; @@ -861,7 +858,7 @@ AdjustColor (int i) void BoardOptionsProc () { - strncpy(oldPngDir, appData.pngDirectory, MSG_SIZ-1); // to see if it changed + strncpy(oldPieceDir, appData.pieceDirectory, MSG_SIZ-1); // to see if it changed GenericPopUp(boardOptions, _("Board Options"), TransientDlg, BoardWindow, MODAL, 0); } @@ -1018,6 +1015,31 @@ NewTagsPopup (char *text, char *msg) 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; @@ -1177,6 +1199,7 @@ BoxAutoPopUp (char *buf) void SettingsPopUp (ChessProgramState *cps) { + if(!cps->nrOptions) { DisplayNote(_("Engine has no options")); return; } currentCps = cps; GenericPopUp(cps->option, _("Engine Settings"), TransientDlg, BoardWindow, MODAL, 0); } @@ -1404,6 +1427,7 @@ TimeControlProc () 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 ----------------------------------------- @@ -1460,6 +1484,7 @@ static Option promoOptions[] = { { 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 , "" } }; @@ -1496,7 +1521,7 @@ SetPromo (char *name, int nr, char promoChar) 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 || @@ -1824,10 +1849,12 @@ DisplayFatalError (String message, int error, int status) 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); + } } } @@ -1931,7 +1958,7 @@ static int pmFromX = -1, pmFromY = -1; void *userLogo; void -DisplayLogos (void *w1, void *w2) +DisplayLogos (Option *w1, Option *w2) { void *whiteLogo = first.programLogo, *blackLogo = second.programLogo; if(appData.autoLogo) { @@ -2018,14 +2045,14 @@ Option mainOptions[] = { // description of main window in terms of generic dialo Option * LogoW (int n, int x, int y) { - if(n == 10) DisplayLogos(mainOptions[W_WHITE-1].handle, NULL); + if(n == 10) DisplayLogos(&mainOptions[W_WHITE-1], NULL); return NULL; } Option * LogoB (int n, int x, int y) { - if(n == 10) DisplayLogos(NULL, mainOptions[W_BLACK+1].handle); + if(n == 10) DisplayLogos(NULL, &mainOptions[W_BLACK+1]); return NULL; } @@ -2073,6 +2100,7 @@ Exp (int n, int x, int y) case 10: sizing = (oldW != x || oldH != y); oldW = x; oldH = y; + InitDrawingHandle(mainOptions + W_BOARD); if(sizing) return NULL; // don't redraw while sizing DrawPosition(True, NULL); default: