X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=dialogs.c;h=d19a7692caf9733f528e88028f436a798f33e5e9;hb=ebd7f78161504e46896f7d96bb41e29714b2fd53;hp=8a6a4dddf7e31c2f1ceb11a4a6251f41a3cbb10c;hpb=0278ebc80411a20fd23303156285e55ce8d2b0a5;p=xboard.git diff --git a/dialogs.c b/dialogs.c index 8a6a4dd..d19a769 100644 --- a/dialogs.c +++ b/dialogs.c @@ -93,11 +93,13 @@ int SetCurrentComboSelection (Option *opt) { int j; + if(currentCps) ; else if(!opt->textValue) opt->value = *(int*)opt->target; /* numeric */else { for(j=0; opt->choice[j]; j++) // look up actual value in list of possible values, to get selection nr if(*(char**)opt->target && !strcmp(*(char**)opt->target, ((char**)opt->textValue)[j])) break; opt->value = j + (opt->choice[j] == NULL); } + SetComboChoice(opt, opt->value); return opt->value; } @@ -331,8 +333,10 @@ UpgradeParticipant () static void PseudoOK () { + if(matchMode) return; GenericReadout(matchOptions, -2); // read all, but suppress calling of MatchOK ASSIGN(appData.participants, engineName); + ASSIGN(appData.tourneyFile, tfName); PopDown(MasterDlg); // early popdown to prevent FreezeUI called through MatchEvent from causing XtGrab warning } @@ -1458,6 +1462,22 @@ SecondSettingsProc () SettingsPopUp(&second); } +void +RefreshSettingsDialog (ChessProgramState *cps, int val) +{ + if(val == 1) { // option values changed + if(shellUp[TransientDlg] && cps == currentCps) { + GenericUpdate(cps->option, -1); // normally update values when dialog is up + } + return; // and be done + } + if(val == 2) { // option list changed + if(!shellUp[TransientDlg] || cps != currentCps) return; // our dialog is not up, so nothing to do + } + PopDown(TransientDlg); // make sure any other dialog closes first + SettingsPopUp(cps); // and popup new one +} + //----------------------------------------------- Load Engine -------------------------------------- char *engineDir, *engineLine, *nickName, *params; @@ -1669,6 +1689,10 @@ SetTcType (int n) void TimeControlProc () { + if(gameMode != BeginningOfGame) { + DisplayError(_("Changing time control during a game is not implemented"), 0); + return; + } tmpMoves = appData.movesPerSession; tmpInc = appData.timeIncrement; if(tmpInc < 0) tmpInc = 0; tmpOdds1 = tmpOdds2 = 1; tcType = 0; @@ -1771,7 +1795,7 @@ PromotionPopUp (char choice) { // choice depends on variant: prepare dialog acordingly count = 8; SetPromo(_("Cancel"), --count, -1); // Beware: GenericPopUp cannot handle user buttons named "cancel" (lowe case)! - if(choice != '+') { + if(choice != '+' && !IS_SHOGI(gameInfo.variant)) { if (!appData.testLegality || gameInfo.variant == VariantSuicide || gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove) || gameInfo.variant == VariantGiveaway) { @@ -1944,6 +1968,7 @@ OutputChatMessage (int partner, char *mess) char *p = texts[partner]; int len = strlen(mess) + 1; + if(!DialogExists(ChatDlg)) return; if(p) len += strlen(p); texts[partner] = (char*) malloc(len); snprintf(texts[partner], len, "%s%s", p ? p : "", mess); @@ -2261,8 +2286,8 @@ ErrorPopUp (char *title, char *label, int modal) { errorUp = True; errorOptions[1].name = label; - if(dialogError = shellUp[TransientDlg]) - GenericPopUp(errorOptions+1, title, FatalDlg, TransientDlg, MODAL, 0); // pop up as daughter of the transient dialog + if(dialogError = shellUp[MasterDlg]) + GenericPopUp(errorOptions+1, title, FatalDlg, MasterDlg, MODAL, 0); // pop up as daughter of the transient dialog else GenericPopUp(errorOptions+modal, title, modal ? FatalDlg: ErrorDlg, BoardWindow, modal, 0); // kludge: option start address indicates modality } @@ -2554,7 +2579,7 @@ MenuCallback (int n) static Option * Exp (int n, int x, int y) { - static int but1, but3, oldW, oldH; + static int but1, but3, oldW, oldH, oldX, oldY; int menuNr = -3, sizing, f, r; TimeMark now; extern Boolean right; @@ -2565,6 +2590,7 @@ Exp (int n, int x, int y) } if(n == 0) { // motion + oldX = x; oldY = y; if(SeekGraphClick(Press, x, y, 1)) return NULL; if((but1 || dragging == 2) && !PromoScroll(x, y)) DragPieceMove(x, y); if(but3) MovePV(x, y, lineGap + BOARD_HEIGHT * (squareSize + lineGap)); @@ -2587,8 +2613,8 @@ Exp (int n, int x, int y) case 3: menuNr = RightClick(Press, x, y, &pmFromX, &pmFromY), but3 = 1; break; case -2: shiftKey = !shiftKey; case -3: menuNr = RightClick(Release, x, y, &pmFromX, &pmFromY), but3 = 0; break; - case 4: BackwardEvent(); break; - case 5: ForwardEvent(); break; + case 4: Wheel(-1, oldX, oldY); break; + case 5: Wheel(1, oldX, oldY); break; case 10: sizing = (oldW != x || oldH != y); oldW = x; oldH = y;