mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
draw_trayBegin returns bool
This commit is contained in:
parent
1550aefc06
commit
5b82486429
3 changed files with 77 additions and 70 deletions
|
@ -61,7 +61,7 @@ typedef struct DrawCtxVTable {
|
|||
XP_Bool (*m_draw_vertScrollBoard)(DrawCtx* dctx, XP_Rect* rect,
|
||||
XP_S16 dist );
|
||||
|
||||
void (*m_draw_trayBegin)( DrawCtx* dctx, XP_Rect* rect,
|
||||
XP_Bool (*m_draw_trayBegin)( DrawCtx* dctx, XP_Rect* rect,
|
||||
XP_U16 owner, XP_Bool hasfocus );
|
||||
void (*m_draw_trayFinished)( DrawCtx* dctx );
|
||||
|
||||
|
|
|
@ -100,17 +100,15 @@ figureTrayTileRect( BoardCtxt* board, XP_U16 index, XP_Rect* rect )
|
|||
void
|
||||
drawTray( BoardCtxt* board, XP_Bool focussed )
|
||||
{
|
||||
DictionaryCtxt* dictionary;
|
||||
XP_Rect tileRect;
|
||||
short i;
|
||||
|
||||
if ( (board->trayInvalBits != 0) || board->dividerInvalid ) {
|
||||
XP_S16 turn = board->selPlayer;
|
||||
|
||||
dictionary = model_getDictionary( board->model );
|
||||
|
||||
draw_trayBegin( board->draw, &board->trayBounds, turn,
|
||||
focussed );
|
||||
if ( draw_trayBegin( board->draw, &board->trayBounds, turn,
|
||||
focussed ) ) {
|
||||
DictionaryCtxt* dictionary = model_getDictionary( board->model );
|
||||
|
||||
if ( board->eraseTray ) {
|
||||
draw_clearRect( board->draw, &board->trayBounds );
|
||||
|
@ -125,7 +123,8 @@ drawTray( BoardCtxt* board, XP_Bool focussed )
|
|||
model_getNumTilesInTray( board->model, turn ):
|
||||
model_getNumTilesTotal( board->model, turn );
|
||||
|
||||
/* draw in reverse order so drawing happens after erasing */
|
||||
/* draw in reverse order so drawing happens after
|
||||
erasing */
|
||||
for ( i = MAX_TRAY_TILES - 1; i >= 0; --i ) {
|
||||
|
||||
if ( (board->trayInvalBits & (1 << i)) == 0 ) {
|
||||
|
@ -151,12 +150,13 @@ drawTray( BoardCtxt* board, XP_Bool focussed )
|
|||
XP_TRUE );
|
||||
} else {
|
||||
textP = buf;
|
||||
dict_tilesToString( dictionary, &tile, 1, textP );
|
||||
dict_tilesToString( dictionary, &tile, 1,
|
||||
textP );
|
||||
}
|
||||
value = dict_getTileValue( dictionary, tile );
|
||||
|
||||
draw_drawTile( board->draw, &tileRect, textP, bitmap,
|
||||
value, highlighted );
|
||||
draw_drawTile( board->draw, &tileRect, textP,
|
||||
bitmap, value, highlighted );
|
||||
} else {
|
||||
draw_drawTileBack( board->draw, &tileRect );
|
||||
}
|
||||
|
@ -187,6 +187,7 @@ drawTray( BoardCtxt* board, XP_Bool focussed )
|
|||
|
||||
board->trayInvalBits = 0;
|
||||
}
|
||||
}
|
||||
|
||||
drawPendingScore( board );
|
||||
} /* drawTray */
|
||||
|
|
|
@ -228,12 +228,18 @@ logClipResult( int icrResult )
|
|||
} /* logClipResult */
|
||||
#endif
|
||||
|
||||
static void
|
||||
static XP_Bool
|
||||
ce_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 owner,
|
||||
XP_Bool hasfocus )
|
||||
{
|
||||
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
|
||||
CEAppGlobals* globals = dctx->globals;
|
||||
HDC hdc = globals->hdc;
|
||||
XP_Bool canDraw = !!hdc;
|
||||
if ( canDraw ) {
|
||||
dctx->trayOwner = owner;
|
||||
}
|
||||
return canDraw;
|
||||
} /* ce_draw_trayBegin */
|
||||
|
||||
static void
|
||||
|
@ -389,7 +395,7 @@ ce_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* xprect,
|
|||
if ( cursorBonus == BONUS_NONE ) {
|
||||
bkIndex = BKG_COLOR;
|
||||
} else {
|
||||
bkIndex = cursorBonus+BONUS1_COLOR;
|
||||
bkIndex = cursorBonus - BONUS_DOUBLE_LETTER + BONUS1_COLOR;
|
||||
}
|
||||
FillRect( hdc, &rt, dctx->brushes[bkIndex] );
|
||||
SetBkColor( hdc, dctx->colors[bkIndex] );
|
||||
|
|
Loading…
Reference in a new issue