add owner param to drawTileMidDrag so can color tiles correctly

This commit is contained in:
ehouse 2008-03-11 11:48:53 +00:00
parent e5b8de54aa
commit 0988159795
5 changed files with 25 additions and 16 deletions

View file

@ -3460,7 +3460,7 @@ drawDragTileIf( BoardCtxt* board )
flags |= CELL_ISBLANK; flags |= CELL_ISBLANK;
} }
draw_drawTileMidDrag( board->draw, &rect, face, bitmap, value, draw_drawTileMidDrag( board->draw, &rect, face, bitmap, value,
flags ); board->selPlayer, flags );
} }
} }
} /* drawDragTileIf */ } /* drawDragTileIf */

View file

@ -166,13 +166,16 @@ typedef struct DrawCtxVTable {
void DRAW_VTABLE_NAME(drawTile) ( DrawCtx* dctx, const XP_Rect* rect, void DRAW_VTABLE_NAME(drawTile) ( DrawCtx* dctx, const XP_Rect* rect,
/* at least 1 of these two will be null*/ /* at least 1 of these two will be null*/
const XP_UCHAR* text, const XP_Bitmap bitmap, const XP_UCHAR* text,
const XP_Bitmap bitmap,
XP_S16 val, CellFlags flags ); XP_S16 val, CellFlags flags );
#ifdef POINTER_SUPPORT #ifdef POINTER_SUPPORT
void DRAW_VTABLE_NAME(drawTileMidDrag) ( DrawCtx* dctx, const XP_Rect* rect, void DRAW_VTABLE_NAME(drawTileMidDrag) ( DrawCtx* dctx, const XP_Rect* rect,
/* at least 1 of these two will be null*/ /* at least 1 of these two will be null*/
const XP_UCHAR* text, const XP_Bitmap bitmap, const XP_UCHAR* text,
XP_S16 val, CellFlags flags ); const XP_Bitmap bitmap,
XP_S16 val, XP_U16 owner,
CellFlags flags );
#endif #endif
void DRAW_VTABLE_NAME(drawTileBack) ( DrawCtx* dctx, const XP_Rect* rect, void DRAW_VTABLE_NAME(drawTileBack) ( DrawCtx* dctx, const XP_Rect* rect,
CellFlags flags ); CellFlags flags );
@ -212,6 +215,8 @@ struct DrawCtx {
linked##_draw_##name(dc,(p1),(p2),(p3),(p4)) linked##_draw_##name(dc,(p1),(p2),(p3),(p4))
# define CALL_DRAW_NAME5(name,dc,p1,p2,p3,p4,p5) \ # define CALL_DRAW_NAME5(name,dc,p1,p2,p3,p4,p5) \
linked##_draw_##name(dc,(p1),(p2),(p3),(p4),(p5)) linked##_draw_##name(dc,(p1),(p2),(p3),(p4),(p5))
# define CALL_DRAW_NAME6(name,dc,p1,p2,p3,p4,p5,p6) \
linked##_draw_##name(dc,(p1),(p2),(p3),(p4),(p5),(p6))
# define CALL_DRAW_NAME8(name,dc,p1,p2,p3,p4,p5,p6,p7,p8) \ # define CALL_DRAW_NAME8(name,dc,p1,p2,p3,p4,p5,p6,p7,p8) \
linked##_draw_##name(dc,(p1),(p2),(p3),(p4),(p5),(p6),(p7),(p8)) linked##_draw_##name(dc,(p1),(p2),(p3),(p4),(p5),(p6),(p7),(p8))
# define CALL_DRAW_NAME10(name,dc,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \ # define CALL_DRAW_NAME10(name,dc,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \
@ -228,6 +233,8 @@ struct DrawCtx {
((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4)) ((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4))
# define CALL_DRAW_NAME5(name,dc,p1,p2,p3,p4,p5) \ # define CALL_DRAW_NAME5(name,dc,p1,p2,p3,p4,p5) \
((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4),(p5)) ((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4),(p5))
# define CALL_DRAW_NAME6(name,dc,p1,p2,p3,p4,p5,p6) \
((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4),(p5),(p6))
# define CALL_DRAW_NAME8(name,dc,p1,p2,p3,p4,p5,p6,p7,p8) \ # define CALL_DRAW_NAME8(name,dc,p1,p2,p3,p4,p5,p6,p7,p8) \
((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4),(p5),(p6),(p7),\ ((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4),(p5),(p6),(p7),\
(p8)) (p8))
@ -263,8 +270,8 @@ struct DrawCtx {
#define draw_drawTile( dc, rect, text, bmp, val, hil ) \ #define draw_drawTile( dc, rect, text, bmp, val, hil ) \
CALL_DRAW_NAME5(drawTile,(dc),(rect),(text),(bmp),(val),(hil)) CALL_DRAW_NAME5(drawTile,(dc),(rect),(text),(bmp),(val),(hil))
#ifdef POINTER_SUPPORT #ifdef POINTER_SUPPORT
#define draw_drawTileMidDrag( dc, rect, text, bmp, val, hil ) \ #define draw_drawTileMidDrag( dc, rect, text, bmp, val, ownr, hil ) \
CALL_DRAW_NAME5(drawTileMidDrag,(dc),(rect),(text),(bmp),(val),(hil)) CALL_DRAW_NAME6(drawTileMidDrag,(dc),(rect),(text),(bmp),(val),(ownr),(hil))
#endif /* POINTER_SUPPORT */ #endif /* POINTER_SUPPORT */
#define draw_drawTileBack( dc, rect, f ) \ #define draw_drawTileBack( dc, rect, f ) \
CALL_DRAW_NAME2(drawTileBack, (dc), (rect), (f) ) CALL_DRAW_NAME2(drawTileBack, (dc), (rect), (f) )

View file

@ -503,16 +503,12 @@ gtk_draw_invertCell( DrawCtx* XP_UNUSED(p_dctx),
} /* gtk_draw_invertCell */ } /* gtk_draw_invertCell */
static XP_Bool static XP_Bool
gtk_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 owner, gtk_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* XP_UNUSED(rect),
DrawFocusState dfs ) XP_U16 owner, DrawFocusState dfs )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
XP_Rect clip = *rect;
insetRect( &clip, -1 );
dctx->trayOwner = owner; dctx->trayOwner = owner;
dctx->topFocus = dfs == DFS_TOP; dctx->topFocus = dfs == DFS_TOP;
/* gdk_gc_set_clip_rectangle( dctx->drawGC, (GdkRectangle*)&clip ); */
return XP_TRUE; return XP_TRUE;
} /* gtk_draw_trayBegin */ } /* gtk_draw_trayBegin */
@ -600,8 +596,9 @@ gtk_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect, const XP_UCHAR* textP,
static void static void
gtk_draw_drawTileMidDrag( DrawCtx* p_dctx, const XP_Rect* rect, gtk_draw_drawTileMidDrag( DrawCtx* p_dctx, const XP_Rect* rect,
const XP_UCHAR* textP, XP_Bitmap bitmap, const XP_UCHAR* textP, XP_Bitmap bitmap,
XP_S16 val, CellFlags flags ) XP_S16 val, XP_U16 owner, CellFlags flags )
{ {
gtk_draw_trayBegin( p_dctx, rect, owner, DFS_NONE );
gtkDrawTileImpl( p_dctx, rect, textP, bitmap, val, gtkDrawTileImpl( p_dctx, rect, textP, bitmap, val,
flags | CELL_HIGHLIGHT, flags | CELL_HIGHLIGHT,
XP_FALSE ); XP_FALSE );

View file

@ -754,9 +754,12 @@ palm_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect,
static void static void
palm_draw_drawTileMidDrag( DrawCtx* p_dctx, const XP_Rect* rect, palm_draw_drawTileMidDrag( DrawCtx* p_dctx, const XP_Rect* rect,
const XP_UCHAR* letters, XP_Bitmap bitmap, const XP_UCHAR* letters, XP_Bitmap bitmap,
XP_S16 val, CellFlags flags ) XP_S16 val, XP_U16 owner, CellFlags flags )
{ {
/* let trayBegin code take care of pushing color env changes. */
draw_trayBegin( p_dctx, rect, owner, DFS_NONE );
palm_draw_drawTile( p_dctx, rect, letters, bitmap, val, flags ); palm_draw_drawTile( p_dctx, rect, letters, bitmap, val, flags );
draw_objFinished( p_dctx, OBJ_TRAY, rect, DFS_NONE );
} }
#endif #endif
@ -768,7 +771,8 @@ palm_draw_drawTileBack( DrawCtx* p_dctx, const XP_Rect* rect, CellFlags flags )
} /* palm_draw_drawTileBack */ } /* palm_draw_drawTileBack */
static void static void
palm_draw_drawTrayDivider( DrawCtx* p_dctx, const XP_Rect* rect, XP_Bool selected ) palm_draw_drawTrayDivider( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool selected )
{ {
XP_Rect lRect = *rect; XP_Rect lRect = *rect;

View file

@ -487,8 +487,9 @@ DRAW_FUNC_NAME(drawTile)( DrawCtx* p_dctx, const XP_Rect* xprect,
DLSTATIC void DLSTATIC void
DRAW_FUNC_NAME(drawTileMidDrag)( DrawCtx* p_dctx, const XP_Rect* xprect, DRAW_FUNC_NAME(drawTileMidDrag)( DrawCtx* p_dctx, const XP_Rect* xprect,
const XP_UCHAR* letters, XP_Bitmap bitmap, const XP_UCHAR* letters, XP_Bitmap bitmap,
XP_S16 val, CellFlags flags ) XP_S16 val, XP_U16 owner, CellFlags flags )
{ {
draw_trayBegin( p_dctx, xprect, owner, DFS_NONE );
drawDrawTileGuts( p_dctx, xprect, letters, bitmap, val, flags ); drawDrawTileGuts( p_dctx, xprect, letters, bitmap, val, flags );
} /* ce_draw_drawTile */ } /* ce_draw_drawTile */
#endif #endif