static void DefColor P((int n));
static void AdjustColor P((int i));
+static char oldPngDir[MSG_SIZ];
+
static int
BoardOptionsOK (int n)
{
if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap; else lineGap = defaultLineGap;
- InitDrawingParams();
+ InitDrawingParams(strcmp(oldPngDir, appData.pngDirectory));
InitDrawingSizes(-1, 0);
DrawPosition(True, NULL);
return 1;
void
BoardOptionsProc ()
{
+ strncpy(oldPngDir, appData.pngDirectory, MSG_SIZ-1); // to see if it changed
GenericPopUp(boardOptions, _("Board Options"), TransientDlg, BoardWindow, MODAL, 0);
}
static Option *
Exp (int n, int x, int y)
{
- static int but1, but3, oldSquareSize;
- int menuNr = -3;
+ static int but1, but3, oldW, oldH;
+ int menuNr = -3, sizing;
if(n == 0) { // motion
if(SeekGraphClick(Press, x, y, 1)) return NULL;
case -2: shiftKey = !shiftKey;
case -3: menuNr = RightClick(Release, x, y, &pmFromX, &pmFromY), but3 = 0; break;
case 10:
- if(squareSize != oldSquareSize) return NULL; // don't redraw while sizing
+ sizing = (oldW != x || oldH != y);
+ oldW = x; oldH = y;
+ if(sizing) return NULL; // don't redraw while sizing
DrawPosition(True, NULL);
- oldSquareSize = squareSize;
default:
return NULL;
}
void Browse P((DialogClass dlg, char *label, char *proposed, char *ext,
Boolean pathFlag, char *mode, char **name, FILE **fp));
-void InitDrawingParams P(()); // in xboard.c
+void InitDrawingParams P((int reload)); // in draw.c
void DrawLogo P((void *handle, void *logo));
void ErrorPopUp P((char *title, char *text, int modal));
int ShiftKeys P((void));
#define OUTLINE 1
Boolean cairoAnimate;
static cairo_surface_t *csBoardWindow, *csBoardBackup, *csDualBoard;
+static cairo_surface_t *pngPieceImages[2][(int)BlackPawn+4]; // png 256 x 256 images
static cairo_surface_t *pngPieceBitmaps[2][(int)BlackPawn]; // scaled pieces as used
static cairo_surface_t *pngPieceBitmaps2[2][(int)BlackPawn+4]; // scaled pieces in store
static cairo_surface_t *pngBoardBitmap[2];
char buf[MSG_SIZ];
cairo_surface_t *img, *cs;
cairo_t *cr;
- static cairo_surface_t *pngPieceImages[2][(int)BlackPawn+4]; // png 256 x 256 images
if((img = pngPieceImages[color][piece]) == NULL) { // if PNG file for this piece was not yet read, read it now and store it
if(!*appData.pngDirectory) img = ConvertPixmap(color, piece); else {
}
void
-InitDrawingParams ()
+InitDrawingParams (int reloadPieces)
{
+ int i, p;
MakeColors();
+ if(reloadPieces)
+ for(i=0; i<2; i++) for(p=0; p<BlackPawn+4; p++) {
+ if(pngPieceImages[i][p]) cairo_surface_destroy(pngPieceImages[i][p]);
+ pngPieceImages[i][p] = NULL;
+ }
CreateAnyPieces();
}