X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=dialogs.c;h=cf7b85a46d79812338f85dbfd801d0d0a24dc7fc;hb=d0bbaf344e8986b5232a287160e8cd31c109afa0;hp=d6cf37884f93875c407e987a8ce46bd6b2acc7c1;hpb=30ded7c1180da9dc3dc703d92f4c0617ea092647;p=xboard.git diff --git a/dialogs.c b/dialogs.c index d6cf378..cf7b85a 100644 --- a/dialogs.c +++ b/dialogs.c @@ -228,6 +228,7 @@ GenericReadout (Option *opts, int selected) case SaveButton: case Label: case Break: + case -1: break; } if(opts[i].type == EndMark) break; @@ -447,6 +448,19 @@ static Option variantDescriptors[] = { { VariantFairy, 0, 135, NULL, (void*) &Pick, "#BFBFBF", NULL, Button, N_("fairy")}, //{ VariantNormal, 0, 135, NULL, (void*) &Pick, "#FFFFFF", NULL, Button, N_(" ")}, // dummy, to have good alignment { VariantCourier, SAME_ROW,135, NULL, (void*) &Pick, "#BFFFBF", NULL, Button, N_("courier (12x8)")}, +// 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 }, { 0, NO_OK, 0, NULL, NULL, "", NULL, EndMark , "" } }; @@ -454,6 +468,7 @@ static void Pick (int n) { VariantClass v = variantDescriptors[n].value; + if(v == VariantUnknown) safeStrCpy(engineVariant, variantDescriptors[n].name, MSG_SIZ); else *engineVariant = NULLCHAR; if(!appData.noChessProgram) { char *name = VariantName(v), buf[MSG_SIZ]; if (first.protocolVersion > 1 && StrStr(first.variants, name) == NULL) { @@ -486,8 +501,24 @@ Pick (int n) void NewVariantProc () { + static int start; + int i, last; 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); + if(!start) while(variantDescriptors[start].type != -1) 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); + if(v) { + last = i; + ASSIGN(variantDescriptors[start+i].name, v); + variantDescriptors[start+i].type = Button; + } else variantDescriptors[start+i].type = -1; + } + if(!(last&1)) { // odd number, add filler + ASSIGN(variantDescriptors[start+last+1].name, " "); + variantDescriptors[start+last+1].type = Button; + } GenericPopUp(variantDescriptors, _("New Variant"), TransientDlg, BoardWindow, MODAL, 0); } @@ -579,6 +610,7 @@ Option icsOptions[] = { { 0, 0, 0, NULL, (void*) &appData.seekGraph, "", NULL, CheckBox, N_("Seek Graph") }, { 0, 0, 0, NULL, (void*) &appData.autoRefresh, "", NULL, CheckBox, N_("Auto-Refresh Seek Graph") }, { 0, 0, 0, NULL, (void*) &appData.autoBox, "", NULL, CheckBox, N_("Auto-InputBox PopUp") }, +{ 0, 0, 0, NULL, (void*) &appData.quitNext, "", NULL, CheckBox, N_("Quit after game") }, { 0, 0, 0, NULL, (void*) &appData.premove, "", NULL, CheckBox, N_("Premove") }, { 0, 0, 0, NULL, (void*) &appData.premoveWhite, "", NULL, CheckBox, N_("Premove for White") }, { 0, 0, 0, NULL, (void*) &appData.premoveWhiteText, "", NULL, TextBox, N_("First White Move:") }, @@ -1027,7 +1059,7 @@ static char *tagsText; static int NewTagsCallback (int n) { - ReplaceTags(tagsText, &gameInfo); + if(!bookUp) ReplaceTags(tagsText, &gameInfo); return 1; } @@ -1042,7 +1074,7 @@ static void changeTags (int n) { GenericReadout(tagsOptions, 1); - if(bookUp) SaveToBook(tagsText); else + if(bookUp) SaveToBook(tagsText), DisplayBook(currentMove); else ReplaceTags(tagsText, &gameInfo); } @@ -2143,6 +2175,11 @@ Exp (int n, int x, int y) if(SeekGraphClick(Press, x, y, 1)) return NULL; if(but1 && !PromoScroll(x, y)) DragPieceMove(x, y); if(but3) MovePV(x, y, lineGap + BOARD_HEIGHT * (squareSize + lineGap)); + if(appData.highlightDragging) { + x = EventToSquare(x, BOARD_WIDTH); if ( flipView && x >= 0) x = BOARD_WIDTH - 1 - x; + y = EventToSquare(y, BOARD_HEIGHT); if (!flipView && y >= 0) y = BOARD_HEIGHT - 1 - y; + HoverEvent(hi2X, hi2Y, x, y); + } return NULL; } if(n != 10 && PopDown(PromoDlg)) fromX = fromY = -1; // user starts fiddling with board when promotion dialog is up