diff --git a/xwords4/common/draw.h b/xwords4/common/draw.h index 6338dbea5..af0a412ae 100644 --- a/xwords4/common/draw.h +++ b/xwords4/common/draw.h @@ -151,8 +151,7 @@ typedef struct DrawCtxVTable { XP_U16 playerNum, CellFlags flags ); - void DRAW_VTABLE_NAME(drawTimer) ( DrawCtx* dctx, const XP_Rect* rInner, - const XP_Rect* rOuter, + void DRAW_VTABLE_NAME(drawTimer) ( DrawCtx* dctx, const XP_Rect* rect, XP_U16 player, XP_S16 secondsLeft ); XP_Bool DRAW_VTABLE_NAME(drawCell) ( DrawCtx* dctx, const XP_Rect* rect, @@ -265,8 +264,8 @@ struct DrawCtx { CALL_DRAW_NAME3(score_drawPlayer,(dc),(ri),(ro),(dsi)) #define draw_score_pendingScore(dc, r, s, p, f ) \ CALL_DRAW_NAME4(score_pendingScore,(dc), (r), (s), (p), (f)) -#define draw_drawTimer( dc, ri, ro, plyr, sec ) \ - CALL_DRAW_NAME4(drawTimer,(dc),(ri),(ro),(plyr),(sec)) +#define draw_drawTimer( dc, r, plyr, sec ) \ + CALL_DRAW_NAME3(drawTimer,(dc),(r),(plyr),(sec)) #define draw_drawCell( dc, rect, txt, bmap, t, o, bon, hi, f ) \ CALL_DRAW_NAME8(drawCell,(dc),(rect),(txt),(bmap),(t),(o),(bon),(hi),\ (f)) diff --git a/xwords4/common/scorebdp.c b/xwords4/common/scorebdp.c index d43ef91cd..7b8b4e36e 100644 --- a/xwords4/common/scorebdp.c +++ b/xwords4/common/scorebdp.c @@ -249,7 +249,7 @@ drawTimer( BoardCtxt* board ) if ( board->gi->timerEnabled ) { XP_S16 secondsLeft = figureSecondsLeft( board ); - draw_drawTimer( board->draw, &board->timerBounds, &board->timerBounds, + draw_drawTimer( board->draw, &board->timerBounds, board->selPlayer, secondsLeft ); } } /* drawTimer */ diff --git a/xwords4/linux/gtkdraw.c b/xwords4/linux/gtkdraw.c index 4206f893a..fbef68d01 100644 --- a/xwords4/linux/gtkdraw.c +++ b/xwords4/linux/gtkdraw.c @@ -1004,7 +1004,6 @@ gtkFormatTimerText( XP_UCHAR* buf, XP_U16 bufLen, XP_S16 secondsLeft ) static void gtk_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rInner, - const XP_Rect* XP_UNUSED(rOuter), XP_U16 XP_UNUSED(player), XP_S16 secondsLeft ) { GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; diff --git a/xwords4/palm/palmdraw.c b/xwords4/palm/palmdraw.c index 1b2205dc8..89987dd02 100644 --- a/xwords4/palm/palmdraw.c +++ b/xwords4/palm/palmdraw.c @@ -1283,8 +1283,7 @@ palmFormatTimerText( XP_UCHAR* buf, XP_S16 secondsLeft ) } /* palmFormatTimerText */ static void -palm_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rInner, - const XP_Rect* XP_UNUSED(rOuter), +palm_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 XP_UNUSED(player), XP_S16 secondsLeft ) { /* This is called both from within drawScoreboard and not, meaning that @@ -1293,7 +1292,7 @@ palm_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rInner, */ PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; XP_UCHAR buf[10]; - XP_Rect localR = *rInner; + XP_Rect localR = *rect; RectangleType saveClip; XP_U16 len, width, y; diff --git a/xwords4/wince/cedraw.c b/xwords4/wince/cedraw.c index b2c125a4b..ab999a72d 100755 --- a/xwords4/wince/cedraw.c +++ b/xwords4/wince/cedraw.c @@ -1479,13 +1479,14 @@ ceFormatScoreText( CEDrawCtx* dctx, const DrawScoreInfo* dsi, XP_U16 nameLen ) { XP_UCHAR optPart[16]; XP_UCHAR name[nameLen+1+1]; + const XP_UCHAR* div = dctx->scoreIsVertical? XP_CR : ":"; - /* For a horizontal scoreboard, we want [name ]300:6 + /* For a horizontal scoreboard, we want [name:]300[:6] * For a vertical, it's * * [name] * 300 - * 6 + * [6] */ while ( nameLen >= 1 ) { @@ -1493,7 +1494,7 @@ ceFormatScoreText( CEDrawCtx* dctx, const DrawScoreInfo* dsi, XP_U16 nameLen ) if ( name[nameLen-1] == ' ' ) { /* don't end with space */ --nameLen; } else { - XP_STRCAT( name, dctx->scoreIsVertical? XP_CR : " " ); + XP_STRCAT( name, div ); break; } } @@ -1502,8 +1503,7 @@ ceFormatScoreText( CEDrawCtx* dctx, const DrawScoreInfo* dsi, XP_U16 nameLen ) } if ( dsi->nTilesLeft >= 0 ) { - sprintf( optPart, "%s%d", dctx->scoreIsVertical? XP_CR : ":", - dsi->nTilesLeft ); + sprintf( optPart, "%s%d", div, dsi->nTilesLeft ); } else { optPart[0] = '\0'; } @@ -1659,8 +1659,7 @@ DRAW_FUNC_NAME(score_pendingScore)( DrawCtx* p_dctx, const XP_Rect* xprect, } /* ce_draw_score_pendingScore */ DLSTATIC void -DRAW_FUNC_NAME(drawTimer)( DrawCtx* p_dctx, const XP_Rect* rInner, - const XP_Rect* XP_UNUSED(rOuter), +DRAW_FUNC_NAME(drawTimer)( DrawCtx* p_dctx, const XP_Rect* xprect, XP_U16 player, XP_S16 secondsLeft ) { CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; @@ -1676,7 +1675,7 @@ DRAW_FUNC_NAME(drawTimer)( DrawCtx* p_dctx, const XP_Rect* rInner, fce = ceGetSizedFont( dctx, 0, 0, RFONTS_SCORE ); - XPRtoRECT( &rt, rInner ); + XPRtoRECT( &rt, xprect ); isNegative = secondsLeft < 0; if ( isNegative ) { @@ -1699,10 +1698,16 @@ DRAW_FUNC_NAME(drawTimer)( DrawCtx* p_dctx, const XP_Rect* rInner, ceSetTextColor( hdc, dctx, getPlayerColor(player) ); ceSetBkColor( hdc, dctx, CE_BKG_COLOR ); - ceClearToBkground( dctx, rInner ); + ceClearToBkground( dctx, xprect ); + + /* distribute any extra space */ + XP_U16 width, height; + ceMeasureText( dctx, hdc, fce, buf, 0, &width, &height ); + XP_S16 diff = (xprect->height - height) / 2; + rt.top += diff; + rt.bottom -= diff; oldFont = SelectObject( hdc, fce->setFont ); - ++rt.top; ceDrawLinesClipped( hdc, fce, buf, CP_ACP, XP_TRUE, &rt ); SelectObject( hdc, oldFont );