X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=dialogs.c;h=e69567ee706c703eaf9924150a5fa7eef0f7a1cd;hb=6901aa93e574b65bb1d823ade42fbd23c89dd6cd;hp=cfd09b873d87e9621ea0a2a22da53dd0d56e97f5;hpb=1a2742be566196487d87af36af190feb1612a642;p=xboard.git diff --git a/dialogs.c b/dialogs.c index cfd09b8..e69567e 100644 --- a/dialogs.c +++ b/dialogs.c @@ -220,7 +220,7 @@ GenericReadout (Option *opts, int selected) } break; case EndMark: - if(opts[i].target) // callback for implementing necessary actions on OK (like redraw) + if(opts[i].target && selected != -2) // callback for implementing necessary actions on OK (like redraw) res = ((OKCallback*) opts[i].target)(i); break; default: @@ -230,7 +230,7 @@ GenericReadout (Option *opts, int selected) case SaveButton: case Label: case Break: - case -1: + case Skip: break; } if(opts[i].type == EndMark) break; @@ -247,6 +247,7 @@ static void AddToTourney P((int n, int sel)); static void CloneTourney P((void)); static void ReplaceParticipant P((void)); static void UpgradeParticipant P((void)); +static void PseudoOK P((void)); static int MatchOK (int n) @@ -306,6 +307,7 @@ static Option matchOptions[] = { { 0, 0, 0, NULL, (void*) &DoTimeControl, NULL, NULL, Button, N_("Time Control") }, { 0, SAME_ROW, 0, NULL, (void*) &DoCommonEngine, NULL, NULL, Button, N_("Common Engine") }, { 0, SAME_ROW, 0, NULL, (void*) &DoGeneral, NULL, NULL, Button, N_("General Options") }, +{ 0, SAME_ROW, 0, NULL, (void*) &PseudoOK, NULL, NULL, Button, N_("Continue Later") }, { 0, 0, 0, NULL, (void*) &ReplaceParticipant, NULL, NULL, Button, N_("Replace Engine") }, { 0, SAME_ROW, 0, NULL, (void*) &UpgradeParticipant, NULL, NULL, Button, N_("Upgrade Engine") }, { 0, SAME_ROW, 0, NULL, (void*) &CloneTourney, NULL, NULL, Button, N_("Clone Tourney") }, @@ -327,6 +329,14 @@ UpgradeParticipant () } static void +PseudoOK () +{ + GenericReadout(matchOptions, -2); // read all, but suppress calling of MatchOK + ASSIGN(appData.participants, engineName); + PopDown(MasterDlg); // early popdown to prevent FreezeUI called through MatchEvent from causing XtGrab warning +} + +static void CloneTourney () { FILE *f; @@ -399,6 +409,7 @@ static Option generalOptions[] = { /* TRANSLATORS: the drop menu is used to drop a piece, e.g. during bughouse or editing a position */ { 0, 0, 0, NULL, (void*) &appData.dropMenu, "", NULL, CheckBox, N_("Drop Menu") }, { 0, 0, 0, NULL, (void*) &appData.variations, "", NULL, CheckBox, N_("Enable Variation Trees") }, +{ 0, 0, 0, NULL, (void*) &appData.headers, "", NULL, CheckBox, N_("Headers in Engine Output Window") }, { 0, 0, 0, NULL, (void*) &appData.hideThinkingFromHuman, "", NULL, CheckBox, N_("Hide Thinking from Human") }, { 0, 0, 0, NULL, (void*) &appData.highlightLastMove, "", NULL, CheckBox, N_("Highlight Last Move") }, { 0, 0, 0, NULL, (void*) &appData.highlightMoveWithArrow, "", NULL, CheckBox, N_("Highlight with Arrow") }, @@ -483,18 +494,18 @@ static Option variantDescriptors[] = { { VariantChu, SAME_ROW, 135, NULL, (void*) &Pick, "#BFFFBF", NULL, Button, N_("chu shogi (12x12)")}, //{ -1, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_(" ")}, // dummy, to have good alignment // optional buttons for engine-defined variants -{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, -{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, -1, NULL }, +{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, +{ VariantUnknown, SAME_ROW,135, NULL, (void*) &Pick, "#FFFFFF", NULL, Skip, NULL }, { 0, NO_OK, 0, NULL, NULL, "", NULL, EndMark , "" } }; @@ -522,6 +533,7 @@ Pick (int n) shuffleOpenings = FALSE; /* [HGM] shuffle: possible shuffle reset when we switch */ startedFromPositionFile = FALSE; /* [HGM] loadPos: no longer valid in new variant */ + appData.fischerCastling = FALSE; /* [HGM] fischer: no longer valid in new variant */ appData.NrRanks = ranksTmp; appData.NrFiles = filesTmp; appData.holdingsSize = sizeTmp; @@ -542,7 +554,7 @@ NewVariantProc () ranksTmp = filesTmp = sizeTmp = -1; // prefer defaults over actual settings if(appData.noChessProgram) sprintf(warning, _("Only bughouse is not available in viewer mode.")); else sprintf(warning, _("All variants not supported by the first engine\n(currently %s) are disabled."), first.tidy); - if(!start) while(variantDescriptors[start].type != -1) start++; // locate first spare + if(!start) while(variantDescriptors[start].type != Skip) start++; // locate first spare last = -1; for(i=0; variantDescriptors[start+i].type != EndMark; i++) { // create buttons for engine-defined variants char *v = EngineDefinedVariant(&first, i); @@ -550,12 +562,12 @@ NewVariantProc () last = i; ASSIGN(variantDescriptors[start+i].name, v); variantDescriptors[start+i].type = Button; - } else variantDescriptors[start+i].type = -1; + } else variantDescriptors[start+i].type = Skip; } if(!(last&1)) { // odd number, add filler ASSIGN(variantDescriptors[start+last+1].name, " "); variantDescriptors[start+last+1].type = Button; - variantDescriptors[start+last+1].value = -1; + variantDescriptors[start+last+1].value = Skip; } safeStrCpy(buf, engineVariant, MSG_SIZ); *engineVariant = NULLCHAR; // yeghh... GenericPopUp(variantDescriptors, _("New Variant"), TransientDlg, BoardWindow, MODAL, 0); @@ -1097,12 +1109,14 @@ EditCommentProc () //------------------------------------------------------ Edit Tags ---------------------------------- static void changeTags P((int n)); -static char *tagsText; +static char *tagsText, **resPtr; static int NewTagsCallback (int n) { - if(!bookUp) ReplaceTags(tagsText, &gameInfo); + if(bookUp) SaveToBook(tagsText), DisplayBook(currentMove); else + if(resPtr) { ASSIGN(*resPtr, tagsText); } else + ReplaceTags(tagsText, &gameInfo); return 1; } @@ -1118,6 +1132,7 @@ changeTags (int n) { GenericReadout(tagsOptions, 1); if(bookUp) SaveToBook(tagsText), DisplayBook(currentMove); else + if(resPtr) { ASSIGN(*resPtr, tagsText); } else ReplaceTags(tagsText, &gameInfo); } @@ -1145,6 +1160,7 @@ TagsPopUp (char *tags, char *msg) void EditTagsPopUp (char *tags, char **dest) { // wrapper to preserve old name used in back-end + resPtr = dest; NewTagsPopup(tags, NULL); } @@ -1444,6 +1460,7 @@ ShuffleOK (int n) static Option shuffleOptions[] = { { 0, 0, 0, NULL, (void*) &shuffleOpenings, NULL, NULL, CheckBox, N_("shuffle") }, + { 0, 0, 0, NULL, (void*) &appData.fischerCastling, NULL, NULL, CheckBox, N_("Fischer castling") }, { 0,-1,2000000000, NULL, (void*) &appData.defaultFrcPosition, "", NULL, Spin, N_("Start-position number:") }, { 0, 0, 0, NULL, (void*) &SetRandom, NULL, NULL, Button, N_("randomize") }, { 0, SAME_ROW, 0, NULL, (void*) &SetRandom, NULL, NULL, Button, N_("pick fixed") }, @@ -2159,11 +2176,11 @@ Option mainOptions[] = { // description of main window in terms of generic dialo { 0, COMBO_CALLBACK, 0, NULL, (void*)&MenuCallback, NULL, NULL, DropDown, N_("Help") }, { 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, "" }, // white logo +{ 50, LL|TT, 100, NULL, (void*) &LogoW, NULL, NULL, Skip, "" }, // white logo { 12, L2L|T2T, 200, NULL, (void*) &CCB, NULL, NULL, Label, "White" }, // white clock { 13, R2R|T2T|SAME_ROW, 200, NULL, (void*) &CCB, NULL, NULL, Label, "Black" }, // black clock -{ 50, RR|TT|SAME_ROW, 100, NULL, (void*) &LogoB, NULL, NULL, -1, "" }, // black logo -{ 0, LR|T2T|BORDER, 401, NULL, NULL, "", NULL, -1, "2" }, // backup for title in window (if no room for other) +{ 50, RR|TT|SAME_ROW, 100, NULL, (void*) &LogoB, NULL, NULL, Skip, "" }, // black logo +{ 0, LR|T2T|BORDER, 401, NULL, NULL, "", NULL, Skip, "2" }, // backup for title in window (if no room for other) { 0, LR|T2T|BORDER, 270, NULL, NULL, "", NULL, Label, "message" }, // message field { 0, RR|TT|SAME_ROW, 125, NULL, NULL, "", NULL, BoxBegin, "" }, // (optional) button bar { 0, 0, 0, NULL, (void*) &ToStartEvent, NULL, NULL, Button, N_("<<") }, @@ -2200,7 +2217,7 @@ SizeKludge (int n) int w = width - 44 - mainOptions[n].min; mainOptions[W_TITLE].max = w; // width left behind menu bar if(w < 0.4*width) // if no reasonable amount of space for title, force small layout - mainOptions[W_SMALL].type = mainOptions[W_TITLE].type, mainOptions[W_TITLE].type = -1; + mainOptions[W_SMALL].type = mainOptions[W_TITLE].type, mainOptions[W_TITLE].type = Skip; } void @@ -2272,7 +2289,7 @@ BoardPopUp (int squareSize, int lineGap, void *clockFontThingy) mainOptions[W_BLACK].max = mainOptions[W_WHITE].max = size/2-3; // clock width mainOptions[W_MESSG].max = appData.showButtonBar ? size-135 : size-2; // message mainOptions[W_MENU].max = size-40; // menu bar - mainOptions[W_TITLE].type = appData.titleInWindow ? Label : -1 ; + mainOptions[W_TITLE].type = appData.titleInWindow ? Label : Skip ; if(logo && logo <= size/4) { // Activate logos mainOptions[W_WHITE-1].type = mainOptions[W_BLACK+1].type = Graph; mainOptions[W_WHITE-1].max = mainOptions[W_BLACK+1].max = logo; @@ -2281,7 +2298,7 @@ BoardPopUp (int squareSize, int lineGap, void *clockFontThingy) mainOptions[W_WHITE].max = mainOptions[W_BLACK].max -= logo + 4; mainOptions[W_WHITE].name = mainOptions[W_BLACK].name = "Double\nHeight"; } - if(!appData.showButtonBar) for(i=W_BUTTON; i