X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=73bd41cfcbff2a5177e57edbeddf68ded0036609;hb=a2f26aa3631ae35cb507615e547eccb9ac521083;hp=1ab5f59949c19904ba1c2144b33f30cde3aaec0d;hpb=582aeb45129ac85b911614bee1b9cdf8ff0636b5;p=xboard.git diff --git a/xboard.c b/xboard.c index 1ab5f59..73bd41c 100644 --- a/xboard.c +++ b/xboard.c @@ -5,7 +5,7 @@ * Massachusetts. * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, - * 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + * 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. * * The following terms apply to Digital Equipment Corporation's copyright * interest in XBoard: @@ -606,9 +606,9 @@ MenuItem fileMenu[] = { // {N_("Load Next Game"), "Load Next Game", LoadNextGameProc}, // {N_("Load Previous Game"), "Load Previous Game", LoadPrevGameProc}, // {N_("Reload Same Game"), "Reload Same Game", ReloadGameProc}, + {N_("Next Position Shift+PgDn"), "Load Next Position", LoadNextPositionProc}, + {N_("Prev Position Shift+PgUp"), "Load Previous Position", LoadPrevPositionProc}, {"----", NULL, NothingProc}, -// {N_("Load Next Position"), "Load Next Position", LoadNextPositionProc}, -// {N_("Load Previous Position"), "Load Previous Position", LoadPrevPositionProc}, // {N_("Reload Same Position"), "Reload Same Position", ReloadPositionProc}, {N_("Save Game Ctrl+S"), "Save Game", SaveGameProc}, {N_("Save Position Ctrl+Shift+S"), "Save Position", SavePositionProc}, @@ -1032,8 +1032,8 @@ char globalTranslations[] = :Ctrlc: CopyGameProc() \n \ :Ctrlv: PasteGameProc() \n \ :CtrlO: LoadPositionProc() \n \ - :Shift MetaNext: LoadNextPositionProc() \n \ - :Shift MetaPrior: LoadPrevPositionProc() \n \ + :ShiftNext: LoadNextPositionProc() \n \ + :ShiftPrior: LoadPrevPositionProc() \n \ :CtrlS: SavePositionProc() \n \ :CtrlC: CopyPositionProc() \n \ :CtrlV: PastePositionProc() \n \ @@ -3299,6 +3299,8 @@ void loadXIM(xim, xmask, filename, dest, mask) } } + fclose(fp); + /* create Pixmap of piece */ *dest = XCreatePixmap(xDisplay, DefaultRootWindow(xDisplay), w, h, xim->depth); @@ -3955,11 +3957,7 @@ void WhiteClock(w, event, prms, nprms) String *prms; Cardinal *nprms; { - if (gameMode == EditPosition || gameMode == IcsExamining) { - SetWhiteToPlayEvent(); - } else if (gameMode == IcsPlayingBlack || gameMode == MachinePlaysWhite) { - CallFlagEvent(); - } + ClockClick(0); } void BlackClock(w, event, prms, nprms) @@ -3968,11 +3966,7 @@ void BlackClock(w, event, prms, nprms) String *prms; Cardinal *nprms; { - if (gameMode == EditPosition || gameMode == IcsExamining) { - SetBlackToPlayEvent(); - } else if (gameMode == IcsPlayingWhite || gameMode == MachinePlaysBlack) { - CallFlagEvent(); - } + ClockClick(1); } @@ -4269,7 +4263,7 @@ static void colorDrawPieceImage(piece, square_color, x, y, dest) } break; } - if(appData.upsideDown && flipView) kind ^= 2; // swap white and black pieces + if(appData.upsideDown && flipView) { kind ^= 2; p += p < BlackPawn ? BlackPawn : -BlackPawn; }// swap white and black pieces if(useTexture & square_color+1) { BlankSquare(x, y, square_color, piece, dest, 1); // erase previous contents with background XSetClipMask(xDisplay, wlPieceGC, xpmMask[p]); @@ -4611,9 +4605,12 @@ void XDrawPosition(w, repaint, board) * but this causes a very distracting flicker. */ - if ( lineGap && IsDrawArrowEnabled()) repaint = True; if (!repaint && lastBoardValid[nr] && (nr == 1 || lastFlipView == flipView)) { + if ( lineGap && IsDrawArrowEnabled()) + XDrawSegments(xDisplay, xBoardWindow, lineGC, + gridSegments, BOARD_HEIGHT + BOARD_WIDTH + 2); + /* If too much changes (begin observing new game, etc.), don't do flashing */ do_flash = too_many_diffs(board, lastBoard[nr]) ? 0 : 1; @@ -4988,9 +4985,9 @@ Widget MiscCreate(name, text, mutable, callback, lines) XTranslateCoordinates(xDisplay, XtWindow(shellWidget), RootWindowOfScreen(XtScreen(shellWidget)), (bw_width - w) / 2, 0 - h / 2, &xx, &yy, &junk); -#endif /*!NOTDEF*/ x = xx; y = yy; +#endif /*!NOTDEF*/ if (y < 0) y = 0; /*avoid positioning top offscreen*/ j = 0; @@ -5369,6 +5366,16 @@ void PromotionPopUp() layout, args, j); if(gameInfo.variant != VariantShogi) { + if(gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove)) { + XawDialogAddButton(dialog, _("Warlord"), PromotionCallback, + (XtPointer) dialog); + XawDialogAddButton(dialog, _("General"), PromotionCallback, + (XtPointer) dialog); + XawDialogAddButton(dialog, _("Lieutenant"), PromotionCallback, + (XtPointer) dialog); + XawDialogAddButton(dialog, _("Captain"), PromotionCallback, + (XtPointer) dialog); + } else { XawDialogAddButton(dialog, _("Queen"), PromotionCallback, (XtPointer) dialog); XawDialogAddButton(dialog, _("Rook"), PromotionCallback, @@ -5377,7 +5384,9 @@ void PromotionPopUp() (XtPointer) dialog); XawDialogAddButton(dialog, _("Knight"), PromotionCallback, (XtPointer) dialog); + } if (!appData.testLegality || gameInfo.variant == VariantSuicide || + gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove) || gameInfo.variant == VariantGiveaway) { XawDialogAddButton(dialog, _("King"), PromotionCallback, (XtPointer) dialog); @@ -5941,6 +5950,7 @@ SendGameSelection(Widget w, Atom *selection, Atom *target, rewind(f); selection_tmp = XtMalloc(len + 1); count = fread(selection_tmp, 1, len, f); + fclose(f); if (len != count) { XtFree(selection_tmp); return False; @@ -8759,6 +8769,7 @@ BeginAnimation(anim, piece, startColor, start) { Pixmap mask; + if(appData.upsideDown && flipView) piece += piece < BlackPawn ? BlackPawn : -BlackPawn; /* The old buffer is initialised with the start square (empty) */ BlankSquare(start->x, start->y, startColor, EmptySquare, anim->saveBuf, 0); anim->prevFrame = *start; @@ -9296,16 +9307,13 @@ void DrawArrowBetweenSquares( int s_col, int s_row, int d_col, int d_row ) DrawArrowBetweenPoints( s_x, s_y, d_x, d_y ); - if(lineGap == 0) { - // this is a good idea, but it only works when lineGap == 0, because 'damage' on grid lines is not repaired - hor = 64*s_col + 32; vert = 64*s_row + 32; - for(i=0; i<= 64; i++) { + hor = 64*s_col + 32; vert = 64*s_row + 32; + for(i=0; i<= 64; i++) { damage[0][vert+6>>6][hor+6>>6] = True; damage[0][vert-6>>6][hor+6>>6] = True; damage[0][vert+6>>6][hor-6>>6] = True; damage[0][vert-6>>6][hor-6>>6] = True; hor += d_col - s_col; vert += d_row - s_row; - } } }