int boardWidth, boardHeight;
static int oldWidth, oldHeight;
static VariantClass oldVariant;
- static int oldTwoBoards = 0;
+ static int oldTwoBoards = 0, oldNrOfFiles = 0;
if(!mainOptions[W_BOARD].handle) return;
+ if(boardSize == -2 && gameInfo.variant != oldVariant
+ && oldNrOfFiles && oldNrOfFiles != BOARD_WIDTH) { // called because variant switch changed board format
+ squareSize = ((squareSize + lineGap) * oldNrOfFiles + 0.5*BOARD_WIDTH) / BOARD_WIDTH - lineGap; // keep total width fixed
+ CreatePNGPieces();
+ CreateGrid();
+ }
+ oldNrOfFiles = BOARD_WIDTH;
+
if(oldTwoBoards && !twoBoards) PopDown(DummyDlg);
oldTwoBoards = twoBoards;
programName, appData.boardSize);
exit(2);
}
+ if(BOARD_WIDTH > 8)
+ squareSize = (squareSize*8 + BOARD_WIDTH/2)/BOARD_WIDTH; // scale height
if (i < 7) {
/* Find some defaults; use the nearest known size */
SizeDefaults *szd, *nearest;
} else {
SizeDefaults *szd = sizeDefaults;
if (*appData.boardSize == NULLCHAR) {
- GdkScreen *screen = gtk_window_get_screen(GTK_WINDOW(mainwindow));
+ GdkScreen *screen = gtk_window_get_screen(GTK_WINDOW(mainwindow)); // TODO: this does not work, as no mainwindow yet
guint screenwidth = gdk_screen_get_width(screen);
guint screenheight = gdk_screen_get_height(screen);
- while (screenwidth < szd->minScreenSize ||
- screenheight < szd->minScreenSize) {
+ while (screenwidth < (szd->minScreenSize*BOARD_WIDTH + 4)/8 ||
+ screenheight < (szd->minScreenSize*BOARD_HEIGHT + 4)/8) {
szd++;
}
if (szd->name == NULL) szd--;
programName, appData.boardSize);
exit(2);
}
+ if(BOARD_WIDTH > 8)
+ squareSize = (squareSize*8 + BOARD_WIDTH/2)/BOARD_WIDTH; // scale height
if (i < 7) {
/* Find some defaults; use the nearest known size */
SizeDefaults *szd, *nearest;
} else {
SizeDefaults *szd = sizeDefaults;
if (*appData.boardSize == NULLCHAR) {
- while (DisplayWidth(xDisplay, xScreen) < szd->minScreenSize ||
- DisplayHeight(xDisplay, xScreen) < szd->minScreenSize) {
+ while (DisplayWidth(xDisplay, xScreen) < (szd->minScreenSize*BOARD_WIDTH + 4)/8 ||
+ DisplayHeight(xDisplay, xScreen) < (szd->minScreenSize*BOARD_HEIGHT + 4)/8) {
szd++;
}
if (szd->name == NULL) szd--;