mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
distribute extra pixels evenly, with extras one each at the beginning
of the arrays.
This commit is contained in:
parent
d01a30d1be
commit
41b29c9ba3
1 changed files with 15 additions and 14 deletions
|
@ -563,7 +563,6 @@ board_zoom( BoardCtxt* board, XP_S16 zoomBy )
|
||||||
board->yOffset = adjustOffset( board->yOffset, zoomBy );
|
board->yOffset = adjustOffset( board->yOffset, zoomBy );
|
||||||
|
|
||||||
board->zoomCount = zoomCount;
|
board->zoomCount = zoomCount;
|
||||||
XP_LOGF( "set zoomCount: %d", zoomCount );
|
|
||||||
figureBoardRect( board );
|
figureBoardRect( board );
|
||||||
board_invalAll( board );
|
board_invalAll( board );
|
||||||
}
|
}
|
||||||
|
@ -1616,12 +1615,15 @@ figureDims( XP_U16* edges, XP_U16 len, XP_U16 nVisible,
|
||||||
XP_U16 increment, XP_U16 extra )
|
XP_U16 increment, XP_U16 extra )
|
||||||
{
|
{
|
||||||
XP_U16 ii;
|
XP_U16 ii;
|
||||||
|
XP_U16 nAtStart = extra % nVisible;
|
||||||
|
|
||||||
|
increment += extra / nVisible;
|
||||||
|
|
||||||
for ( ii = 0; ii < len; ++ii ) {
|
for ( ii = 0; ii < len; ++ii ) {
|
||||||
XP_U16 dim = increment;
|
edges[ii] = increment;
|
||||||
if ( ii % nVisible == 0 ) {
|
if ( ii % nVisible < nAtStart ) {
|
||||||
dim += extra;
|
++edges[ii];
|
||||||
}
|
}
|
||||||
edges[ii] = dim;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1653,21 +1655,19 @@ figureBoardRect( BoardCtxt* board )
|
||||||
XP_Rect boardBounds = board->boardBounds;
|
XP_Rect boardBounds = board->boardBounds;
|
||||||
XP_U16 nVisible;
|
XP_U16 nVisible;
|
||||||
XP_U16 nRows = model_numRows( board->model );
|
XP_U16 nRows = model_numRows( board->model );
|
||||||
XP_U16 boardHScale = figureHScale( board );
|
XP_U16 boardScale = figureHScale( board );
|
||||||
|
|
||||||
if ( boardHScale != board->boardHScale ) {
|
if ( boardScale != board->boardHScale ) {
|
||||||
board_invalAll( board );
|
board_invalAll( board );
|
||||||
board->boardHScale = boardHScale;
|
board->boardHScale = boardScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
board->boardVScale = boardHScale;
|
|
||||||
|
|
||||||
/* Figure height of board. Max height is with all rows visible and
|
/* Figure height of board. Max height is with all rows visible and
|
||||||
each row as tall as boardScale. But that may make it overlap tray,
|
each row as tall as boardScale. But that may make it overlap tray,
|
||||||
if it's visible, or the bottom of the board as set in board_setPos.
|
if it's visible, or the bottom of the board as set in board_setPos.
|
||||||
So we check those two possibilities. */
|
So we check those two possibilities. */
|
||||||
|
|
||||||
XP_U16 maxHeight, wantHeight = nRows * boardHScale;
|
XP_U16 maxHeight, wantHeight = nRows * boardScale;
|
||||||
XP_Bool trayHidden = board->trayVisState == TRAY_HIDDEN;
|
XP_Bool trayHidden = board->trayVisState == TRAY_HIDDEN;
|
||||||
if ( trayHidden ) {
|
if ( trayHidden ) {
|
||||||
maxHeight = board->heightAsSet;
|
maxHeight = board->heightAsSet;
|
||||||
|
@ -1688,9 +1688,11 @@ figureBoardRect( BoardCtxt* board )
|
||||||
XP_Bool yChanged = XP_TRUE;
|
XP_Bool yChanged = XP_TRUE;
|
||||||
/* Need to hide rows etc. */
|
/* Need to hide rows etc. */
|
||||||
boardBounds.height = maxHeight;
|
boardBounds.height = maxHeight;
|
||||||
board->boardVScale = boardHScale;
|
board->boardVScale = boardScale;
|
||||||
|
|
||||||
|
nVisible = maxHeight / boardScale;
|
||||||
|
extra = maxHeight % boardScale;
|
||||||
|
|
||||||
nVisible = maxHeight / boardHScale;
|
|
||||||
maxYOffset = nRows - nVisible;
|
maxYOffset = nRows - nVisible;
|
||||||
if ( board->yOffset > maxYOffset ) {
|
if ( board->yOffset > maxYOffset ) {
|
||||||
board->yOffset = maxYOffset;
|
board->yOffset = maxYOffset;
|
||||||
|
@ -1708,7 +1710,6 @@ figureBoardRect( BoardCtxt* board )
|
||||||
/* board->maxYOffset, board->yOffset ); */
|
/* board->maxYOffset, board->yOffset ); */
|
||||||
|
|
||||||
board->boardObscuresTray = !trayHidden;
|
board->boardObscuresTray = !trayHidden;
|
||||||
extra = maxHeight % boardHScale;
|
|
||||||
}
|
}
|
||||||
board->lastVisibleRow = nVisible + board->yOffset - 1;
|
board->lastVisibleRow = nVisible + board->yOffset - 1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue