From: H.G. Muller Date: Tue, 30 Oct 2012 16:39:59 +0000 (+0100) Subject: Adapt lineGap during sizing X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=8a78eae3ff194a0d996b74e9bc8c15fdfe040ce7;p=xboard.git Adapt lineGap during sizing --- diff --git a/gtk/xboard.c b/gtk/xboard.c index 38ecb2d..a3add4a 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -1454,11 +1454,17 @@ CoDrag (GtkWidget *sh, WindowPlacement *wp) void ReSize (WindowPlacement *wp) { - int sqx, sqy, w, h; + int sqx, sqy, w, h, lg = lineGap; if(wp->width == wpMain.width && wp->height == wpMain.height) return; // not sized - sqx = (wp->width - lineGap - marginW) / BOARD_WIDTH - lineGap; - sqy = (wp->height - lineGap - marginH) / BOARD_HEIGHT - lineGap; + sqx = (wp->width - lg - marginW) / BOARD_WIDTH - lg; + sqy = (wp->height - lg - marginH) / BOARD_HEIGHT - lg; if(sqy < sqx) sqx = sqy; + if(appData.overrideLineGap < 0) { // do second iteration with adjusted lineGap + lg = lineGap = sqx < 37 ? 1 : sqx < 59 ? 2 : sqx < 116 ? 3 : 4; + sqx = (wp->width - lg - marginW) / BOARD_WIDTH - lg; + sqy = (wp->height - lg - marginH) / BOARD_HEIGHT - lg; + if(sqy < sqx) sqx = sqy; + } if(sqx != squareSize) { //printf("new sq size %d (%dx%d)\n", sqx, wp->width, wp->height); squareSize = sqx; // adopt new square size