typedef unsigned int BoardSize;
BoardSize boardSize;
Boolean chessProgram;
+static int initialSquareSize;
int minX, minY; // [HGM] placement: volatile limits on upper-left corner
int smallLayout = 0, tinyLayout = 0,
return;
}
for(i=0; i<NUM_SIZES; i++) // [HGM] font: current font becomes standard for current size
- if(sizeDefaults[i].squareSize == squareSize) { // only for standard sizes!
- fontTable[n][squareSize] = strdup(name);
- fontValid[n][squareSize] = True;
+ if(sizeDefaults[i].squareSize == initialSquareSize) { // only for standard sizes!
+ fontTable[n][initialSquareSize] = strdup(name);
+ fontValid[n][initialSquareSize] = True;
break;
}
for(i=0; i<MAX_SIZE; i++) if(fontValid[n][i]) // [HGM] font: store all standard fonts
tinyLayout = szd->tinyLayout;
// [HGM] font: use defaults from settings file if available and not overruled
}
+ initialSquareSize = squareSize; // [HGM] remember for saving font info
if(BOARD_WIDTH != 8) {
squareSize = (squareSize*8 + BOARD_WIDTH/2)/BOARD_WIDTH; // keep width the same
lineGap = (squareSize < 37 ? 1 : squareSize < 59 ? 2 : squareSize < 116 ? 3 : 4);
#endif
}
+void
+LockBoardSize (int after)
+{
+ static char *oldClockFont, *oldMessgFont;
+ int w, h;
+ if(oldMessgFont && !strcmp(oldMessgFont, appData.font) &&
+ oldClockFont && !strcmp(oldClockFont, appData.clockFont) ) return; // only do something when font changed
+ w = BOARD_WIDTH*(squareSize + lineGap) + lineGap;
+ h = BOARD_HEIGHT*(squareSize + lineGap) + lineGap;
+ if(after) {
+ ASSIGN(oldClockFont, appData.clockFont);
+ ASSIGN(oldMessgFont, appData.font);
+ gtk_window_resize(GTK_WINDOW(shellWidget), w, h);
+ DoEvents();
+ gtk_widget_set_size_request(optList[W_BOARD].handle, -1, -1); // liberate board
+ } else { // before
+ gtk_widget_set_size_request(optList[W_BOARD].handle, w, h); // protect board widget
+ }
+}
void
DisplayTimerLabel (Option *opt, char *color, long timer, int highlight)
return;
}
-void FileNamePopUpWrapper(label, def, filter, proc, pathFlag, openMode, name, fp)
- char *label;
- char *def;
- char *filter;
- FileProc proc;
- char *openMode;
- Boolean pathFlag;
- char **name;
- FILE **fp;
+void FileNamePopUpWrapper(
+ char *label,
+ char *def,
+ char *filter,
+ FileProc proc,
+ Boolean pathFlag,
+ char *openMode,
+ char **name,
+ FILE **fp)
{
GtkWidget *dialog;
GtkFileFilter *gtkfilter;