mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
Specify relative height of scoreboard and tray in board_figureLayout,
and allow those to be 0.
This commit is contained in:
parent
f0b554213b
commit
9f1b0c5121
7 changed files with 67 additions and 45 deletions
|
@ -648,7 +648,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout
|
|||
bounds.height = getInt( env, jbounds, "bottom" ) - bounds.top;
|
||||
|
||||
BoardDims dims;
|
||||
board_figureLayout( state->game.board, gi, fontHt, fontWidth,
|
||||
board_figureLayout( state->game.board, gi, 150, 200, fontHt, fontWidth,
|
||||
squareTiles, &bounds, ((!!jdims) ? &dims : NULL) );
|
||||
|
||||
destroyGI( MPPARM(mpool) &gi );
|
||||
|
|
|
@ -392,6 +392,7 @@ board_reset( BoardCtxt* board )
|
|||
#ifdef COMMON_LAYOUT
|
||||
void
|
||||
board_figureLayout( BoardCtxt* board, const CurGameInfo* gi,
|
||||
XP_U16 scorePct, XP_U16 trayPct,
|
||||
XP_U16 fontHt, XP_U16 fontWidth, XP_Bool squareTiles,
|
||||
const XP_Rect* bounds, BoardDims* dimsp )
|
||||
{
|
||||
|
@ -426,8 +427,8 @@ board_figureLayout( BoardCtxt* board, const CurGameInfo* gi,
|
|||
// fit them and all cells no scrolling's needed. Otherwise
|
||||
// determine the minimum number that must be hidden to fit.
|
||||
// Finally grow scoreboard and tray to use whatever's left.
|
||||
trayHt = 2 * cellSize;
|
||||
scoreHt = (cellSize * 3) / 2;
|
||||
scoreHt = (scorePct * cellSize) / 100;
|
||||
trayHt = (trayPct * cellSize) / 100;
|
||||
wantHt = trayHt + scoreHt + (cellSize * nCells);
|
||||
if ( wantHt <= bounds->height ) {
|
||||
nToScroll = 0;
|
||||
|
@ -452,9 +453,13 @@ board_figureLayout( BoardCtxt* board, const CurGameInfo* gi,
|
|||
heightLeft = cellSize * 3 / 2;
|
||||
}
|
||||
heightLeft /= 3;
|
||||
if ( 0 < scorePct ) {
|
||||
scoreHt += heightLeft;
|
||||
}
|
||||
|
||||
if ( 0 < trayPct ) {
|
||||
trayHt += heightLeft * 2;
|
||||
}
|
||||
if ( squareTiles && trayHt > (bounds->width / 7) ) {
|
||||
trayHt = bounds->width / 7;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ typedef struct _BoardDims {
|
|||
} BoardDims;
|
||||
|
||||
void board_figureLayout( BoardCtxt* board, const CurGameInfo* gi,
|
||||
XP_U16 scorePct, XP_U16 trayPct,
|
||||
XP_U16 fontHt, XP_U16 fontWidth,
|
||||
XP_Bool squareTiles, const XP_Rect* bounds,
|
||||
/* out */ BoardDims* dims );
|
||||
|
|
|
@ -280,6 +280,7 @@ drawScoreBoard( BoardCtxt* board )
|
|||
totalDim += isVertical ? dp->height : dp->width;
|
||||
}
|
||||
|
||||
if ( 0 < totalDim ) {
|
||||
gotPct = (*adjustDim * 100) / totalDim;
|
||||
for ( dp = datum, ii = 0; ii < nPlayers; ++ii, ++dp ) {
|
||||
if ( isVertical ) {
|
||||
|
@ -299,7 +300,8 @@ drawScoreBoard( BoardCtxt* board )
|
|||
*adjustDim = remDim;
|
||||
centerIn( &innerRect, &scoreRect, remWidth, remHeight );
|
||||
draw_drawRemText( board->draw, &innerRect, &scoreRect,
|
||||
nTilesInPool, focusAll || remFocussed );
|
||||
nTilesInPool,
|
||||
focusAll || remFocussed );
|
||||
*adjustPt += remDim;
|
||||
#ifdef KEYBOARD_NAV
|
||||
board->remRect = scoreRect;
|
||||
|
@ -317,15 +319,17 @@ drawScoreBoard( BoardCtxt* board )
|
|||
XP_U16 dim = isVertical? dp->height:dp->width;
|
||||
*adjustDim = board->pti[ii].scoreDims = dim;
|
||||
|
||||
centerIn( &innerRect, &scoreRect, dp->width, dp->height );
|
||||
draw_score_drawPlayer( board->draw, &innerRect, &scoreRect,
|
||||
gotPct, &dp->dsi );
|
||||
centerIn( &innerRect, &scoreRect, dp->width,
|
||||
dp->height );
|
||||
draw_score_drawPlayer( board->draw, &innerRect,
|
||||
&scoreRect, gotPct, &dp->dsi );
|
||||
#ifdef KEYBOARD_NAV
|
||||
XP_MEMCPY( &board->pti[ii].scoreRects, &scoreRect,
|
||||
sizeof(scoreRect) );
|
||||
#endif
|
||||
*adjustPt += *adjustDim;
|
||||
}
|
||||
}
|
||||
|
||||
draw_objFinished( board->draw, OBJ_SCORE,
|
||||
&board->scoreBdBounds,
|
||||
|
|
|
@ -328,10 +328,12 @@ drawPendingScore( BoardCtxt* board, XP_S16 turnScore, XP_Bool hasCursor )
|
|||
XP_Rect lastTileR;
|
||||
|
||||
figureTrayTileRect( board, MAX_TRAY_TILES-1, &lastTileR );
|
||||
if ( 0 < lastTileR.width && 0 < lastTileR.height ) {
|
||||
draw_score_pendingScore( board->draw, &lastTileR, turnScore,
|
||||
selPlayer, curTurn,
|
||||
hasCursor?CELL_ISCURSOR:CELL_NONE );
|
||||
}
|
||||
}
|
||||
} /* drawPendingScore */
|
||||
|
||||
static void
|
||||
|
@ -509,7 +511,9 @@ dividerMoved( BoardCtxt* board, XP_U8 newLoc )
|
|||
void
|
||||
board_invalTrayTiles( BoardCtxt* board, TileBit what )
|
||||
{
|
||||
if ( 0 < board->trayBounds.width && 0 < board->trayBounds.height ) {
|
||||
board->trayInvalBits |= what;
|
||||
}
|
||||
} /* invalTrayTiles */
|
||||
|
||||
void
|
||||
|
|
|
@ -116,6 +116,7 @@ DEFINES += -DXWFEATURE_COMMSACK
|
|||
#DEFINES += -DXWFEATURE_ACTIVERECT
|
||||
DEFINES += -DCOMMS_XPORT_FLAGSPROC
|
||||
DEFINES += -DINITIAL_CLIENT_VERS=2
|
||||
DEFINES += -DCOMMON_LAYOUT
|
||||
|
||||
# MAX_ROWS controls STREAM_VERS_BIGBOARD and with it move hashing
|
||||
DEFINES += -DMAX_ROWS=32
|
||||
|
|
|
@ -617,7 +617,14 @@ configure_event( GtkWidget* widget, GdkEventConfigure* XP_UNUSED(event),
|
|||
.width = bdWidth, .height = bdHeight
|
||||
};
|
||||
BoardDims dims;
|
||||
board_figureLayout( board, cGlobals->gi, 16, 16, XP_FALSE, &rect, &dims );
|
||||
board_figureLayout( board, cGlobals->gi,
|
||||
#if 1
|
||||
150, 200,
|
||||
#else
|
||||
0, 0,
|
||||
#endif
|
||||
16, 16,
|
||||
XP_FALSE, &rect, &dims );
|
||||
board_applyLayout( board, &dims );
|
||||
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue