From 355cfa9fcc99263299a32ded7c7b624640e053fc Mon Sep 17 00:00:00 2001 From: ehouse Date: Tue, 11 Mar 2008 11:48:53 +0000 Subject: [PATCH] add owner param to drawTileMidDrag so can color tiles correctly --- xwords4/common/board.c | 2 +- xwords4/common/draw.h | 17 ++++++++++++----- xwords4/linux/gtkdraw.c | 11 ++++------- xwords4/palm/palmdraw.c | 8 ++++++-- xwords4/wince/cedraw.c | 3 ++- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/xwords4/common/board.c b/xwords4/common/board.c index 0c5e2bd39..60da78edc 100644 --- a/xwords4/common/board.c +++ b/xwords4/common/board.c @@ -3460,7 +3460,7 @@ drawDragTileIf( BoardCtxt* board ) flags |= CELL_ISBLANK; } draw_drawTileMidDrag( board->draw, &rect, face, bitmap, value, - flags ); + board->selPlayer, flags ); } } } /* drawDragTileIf */ diff --git a/xwords4/common/draw.h b/xwords4/common/draw.h index 104c7252c..24a636bca 100644 --- a/xwords4/common/draw.h +++ b/xwords4/common/draw.h @@ -166,13 +166,16 @@ typedef struct DrawCtxVTable { void DRAW_VTABLE_NAME(drawTile) ( DrawCtx* dctx, const XP_Rect* rect, /* 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 ); #ifdef POINTER_SUPPORT void DRAW_VTABLE_NAME(drawTileMidDrag) ( DrawCtx* dctx, const XP_Rect* rect, /* at least 1 of these two will be null*/ - const XP_UCHAR* text, const XP_Bitmap bitmap, - XP_S16 val, CellFlags flags ); + const XP_UCHAR* text, + const XP_Bitmap bitmap, + XP_S16 val, XP_U16 owner, + CellFlags flags ); #endif void DRAW_VTABLE_NAME(drawTileBack) ( DrawCtx* dctx, const XP_Rect* rect, CellFlags flags ); @@ -212,6 +215,8 @@ struct DrawCtx { linked##_draw_##name(dc,(p1),(p2),(p3),(p4)) # define CALL_DRAW_NAME5(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) \ 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) \ @@ -228,6 +233,8 @@ struct DrawCtx { ((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4)) # define CALL_DRAW_NAME5(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) \ ((dc)->vtable->m_draw_##name)(dc,(p1),(p2),(p3),(p4),(p5),(p6),(p7),\ (p8)) @@ -263,8 +270,8 @@ struct DrawCtx { #define draw_drawTile( dc, rect, text, bmp, val, hil ) \ CALL_DRAW_NAME5(drawTile,(dc),(rect),(text),(bmp),(val),(hil)) #ifdef POINTER_SUPPORT -#define draw_drawTileMidDrag( dc, rect, text, bmp, val, hil ) \ - CALL_DRAW_NAME5(drawTileMidDrag,(dc),(rect),(text),(bmp),(val),(hil)) +#define draw_drawTileMidDrag( dc, rect, text, bmp, val, ownr, hil ) \ + CALL_DRAW_NAME6(drawTileMidDrag,(dc),(rect),(text),(bmp),(val),(ownr),(hil)) #endif /* POINTER_SUPPORT */ #define draw_drawTileBack( dc, rect, f ) \ CALL_DRAW_NAME2(drawTileBack, (dc), (rect), (f) ) diff --git a/xwords4/linux/gtkdraw.c b/xwords4/linux/gtkdraw.c index 8c49a938a..12fd267c1 100644 --- a/xwords4/linux/gtkdraw.c +++ b/xwords4/linux/gtkdraw.c @@ -503,16 +503,12 @@ gtk_draw_invertCell( DrawCtx* XP_UNUSED(p_dctx), } /* gtk_draw_invertCell */ static XP_Bool -gtk_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 owner, - DrawFocusState dfs ) +gtk_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* XP_UNUSED(rect), + XP_U16 owner, DrawFocusState dfs ) { GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; - XP_Rect clip = *rect; - insetRect( &clip, -1 ); dctx->trayOwner = owner; dctx->topFocus = dfs == DFS_TOP; - -/* gdk_gc_set_clip_rectangle( dctx->drawGC, (GdkRectangle*)&clip ); */ return XP_TRUE; } /* gtk_draw_trayBegin */ @@ -600,8 +596,9 @@ gtk_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect, const XP_UCHAR* textP, static void gtk_draw_drawTileMidDrag( DrawCtx* p_dctx, const XP_Rect* rect, 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, flags | CELL_HIGHLIGHT, XP_FALSE ); diff --git a/xwords4/palm/palmdraw.c b/xwords4/palm/palmdraw.c index a2c8997cd..3fe6d3cc2 100644 --- a/xwords4/palm/palmdraw.c +++ b/xwords4/palm/palmdraw.c @@ -754,9 +754,12 @@ palm_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect, static void palm_draw_drawTileMidDrag( DrawCtx* p_dctx, const XP_Rect* rect, 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 ); + draw_objFinished( p_dctx, OBJ_TRAY, rect, DFS_NONE ); } #endif @@ -768,7 +771,8 @@ palm_draw_drawTileBack( DrawCtx* p_dctx, const XP_Rect* rect, CellFlags flags ) } /* palm_draw_drawTileBack */ 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; diff --git a/xwords4/wince/cedraw.c b/xwords4/wince/cedraw.c index c42efcc30..a51eca652 100755 --- a/xwords4/wince/cedraw.c +++ b/xwords4/wince/cedraw.c @@ -487,8 +487,9 @@ DRAW_FUNC_NAME(drawTile)( DrawCtx* p_dctx, const XP_Rect* xprect, DLSTATIC void DRAW_FUNC_NAME(drawTileMidDrag)( DrawCtx* p_dctx, const XP_Rect* xprect, 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 ); } /* ce_draw_drawTile */ #endif