catch up with API changes. GTK to use this still needs to be fixed!

This commit is contained in:
ehouse 2008-08-30 13:54:47 +00:00
parent fe25eebdbd
commit a2dfec2714

View file

@ -43,7 +43,7 @@ getRemText( XP_UCHAR* buf, XP_U16 bufSize, XP_S16 nTilesLeft )
} /* getRemText */ } /* getRemText */
static void static void
default_draw_measureRemText( DrawCtx* dctx, XP_Rect* r, default_draw_measureRemText( DrawCtx* dctx, const XP_Rect* XP_UNUSED(r),
XP_S16 nTilesLeft, XP_S16 nTilesLeft,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
@ -62,8 +62,8 @@ default_draw_measureRemText( DrawCtx* dctx, XP_Rect* r,
} /* default_draw_measureRemText */ } /* default_draw_measureRemText */
static void static void
default_draw_drawRemText( DrawCtx* dctx, XP_Rect* rInner, default_draw_drawRemText( DrawCtx* dctx, const XP_Rect* XP_UNUSED(rInner),
XP_Rect* rOuter, XP_S16 nTilesLeft ) const XP_Rect* rOuter, XP_S16 nTilesLeft )
{ {
XP_Rect oldClip; XP_Rect oldClip;
XP_UCHAR buf[10]; XP_UCHAR buf[10];
@ -76,7 +76,7 @@ default_draw_drawRemText( DrawCtx* dctx, XP_Rect* rInner,
} /* default_draw_drawRemText */ } /* default_draw_drawRemText */
static void static void
formatScore( XP_UCHAR* buf, XP_U16 bufSize, DrawScoreInfo* dsi ) formatScore( XP_UCHAR* buf, XP_U16 bufSize, const DrawScoreInfo* dsi )
{ {
XP_UCHAR remBuf[10]; XP_UCHAR remBuf[10];
XP_UCHAR* selStr; XP_UCHAR* selStr;
@ -93,13 +93,13 @@ formatScore( XP_UCHAR* buf, XP_U16 bufSize, DrawScoreInfo* dsi )
remBuf[0] = '\0'; remBuf[0] = '\0';
} }
XP_SNPRINTF( buf, bufSize, "%s%d%s%s", selStr, dsi->score, XP_SNPRINTF( buf, bufSize, "%s%d%s%s", selStr, dsi->totalScore,
remBuf, selStr ); remBuf, selStr );
} /* formatScore */ } /* formatScore */
static void static void
default_draw_measureScoreText( DrawCtx* dctx, XP_Rect* r, default_draw_measureScoreText( DrawCtx* dctx, const XP_Rect* XP_UNUSED(r),
DrawScoreInfo* dsi, const DrawScoreInfo* dsi,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
XP_UCHAR buf[20]; XP_UCHAR buf[20];
@ -109,9 +109,8 @@ default_draw_measureScoreText( DrawCtx* dctx, XP_Rect* r,
static void static void
default_draw_score_drawPlayer( DrawCtx* dctx, default_draw_score_drawPlayer( DrawCtx* dctx,
XP_S16 playerNum, /* -1: don't use */ const XP_Rect* rInner, const XP_Rect* rOuter,
XP_Rect* rInner, XP_Rect* rOuter, const DrawScoreInfo* dsi )
DrawScoreInfo* dsi )
{ {
XP_Rect oldClip; XP_Rect oldClip;
XP_UCHAR buf[20]; XP_UCHAR buf[20];
@ -126,12 +125,12 @@ default_draw_score_drawPlayer( DrawCtx* dctx,
} /* default_draw_score_drawPlayer */ } /* default_draw_score_drawPlayer */
static XP_Bool static XP_Bool
default_draw_drawCell( DrawCtx* dctx, XP_Rect* rect, default_draw_drawCell( DrawCtx* dctx, const XP_Rect* rect,
/* at least one of these two will be null */ const XP_UCHAR* text,
XP_UCHAR* text, XP_Bitmap bitmap, const XP_Bitmap bitmap,
XP_S16 owner, /* -1 means don't use */ Tile XP_UNUSED(tile), XP_S16 XP_UNUSED(owner),
XWBonusType bonus, XP_Bool isBlank, XWBonusType bonus, HintAtts XP_UNUSED(hintAtts),
XP_Bool highlight, XP_Bool isStar) CellFlags flags )
{ {
XP_Rect oldClip; XP_Rect oldClip;
XP_Rect inset = *rect; XP_Rect inset = *rect;
@ -167,7 +166,7 @@ default_draw_drawCell( DrawCtx* dctx, XP_Rect* rect,
draw_drawString( dctx, bstr, inset.left, inset.top ); draw_drawString( dctx, bstr, inset.left, inset.top );
} }
if ( highlight ) { if ( 0 != (flags & CELL_HIGHLIGHT) ) {
draw_invertRect( dctx, &inset ); draw_invertRect( dctx, &inset );
} }
@ -178,8 +177,10 @@ default_draw_drawCell( DrawCtx* dctx, XP_Rect* rect,
} /* default_draw_drawCell */ } /* default_draw_drawCell */
static void static void
default_draw_drawBoardArrow( DrawCtx* dctx, XP_Rect* rect, default_draw_drawBoardArrow( DrawCtx* dctx, const XP_Rect* rect,
XWBonusType bonus, XP_Bool vert ) XWBonusType XP_UNUSED(bonus), XP_Bool vert,
HintAtts XP_UNUSED(hintAtts),
CellFlags XP_UNUSED(flags) )
{ {
XP_Rect oldClip; XP_Rect oldClip;
XP_UCHAR* arrow; XP_UCHAR* arrow;
@ -198,10 +199,10 @@ default_draw_drawBoardArrow( DrawCtx* dctx, XP_Rect* rect,
} /* default_draw_drawBoardArrow */ } /* default_draw_drawBoardArrow */
static void static void
default_draw_drawTile( DrawCtx* dctx, XP_Rect* rect, default_draw_drawTile( DrawCtx* dctx, const XP_Rect* rect,
/* at least 1 of these two will be null*/ const XP_UCHAR* text,
XP_UCHAR* text, XP_Bitmap bitmap, const XP_Bitmap bitmap,
XP_S16 val, XP_Bool highlighted ) XP_S16 val, CellFlags flags )
{ {
XP_Rect oldClip; XP_Rect oldClip;
XP_Rect inset = *rect; XP_Rect inset = *rect;
@ -211,7 +212,7 @@ default_draw_drawTile( DrawCtx* dctx, XP_Rect* rect,
draw_frameRect( dctx, rect ); draw_frameRect( dctx, rect );
if ( highlighted ) { if ( 0 != (flags & CELL_HIGHLIGHT) ) {
insetRect( &inset, 1 ); insetRect( &inset, 1 );
draw_frameRect( dctx, &inset ); draw_frameRect( dctx, &inset );
insetRect( &inset, 1 ); insetRect( &inset, 1 );
@ -242,14 +243,15 @@ default_draw_drawTile( DrawCtx* dctx, XP_Rect* rect,
} /* default_draw_drawTile */ } /* default_draw_drawTile */
static void static void
default_draw_drawTileBack( DrawCtx* dctx, XP_Rect* rect ) default_draw_drawTileBack( DrawCtx* dctx, const XP_Rect* rect,
CellFlags XP_UNUSED(flags) )
{ {
default_draw_drawTile( dctx, rect, "?", NULL, -1, XP_FALSE ); default_draw_drawTile( dctx, rect, "?", NULL, -1, XP_FALSE );
} /* default_draw_drawTileBack */ } /* default_draw_drawTileBack */
static void static void
default_draw_drawTrayDivider( DrawCtx* dctx, XP_Rect* rect, default_draw_drawTrayDivider( DrawCtx* dctx, const XP_Rect* rect,
XP_Bool selected) CellFlags XP_UNUSED(flags))
{ {
XP_Rect r = *rect; XP_Rect r = *rect;
draw_clearRect( dctx, rect ); draw_clearRect( dctx, rect );
@ -261,8 +263,11 @@ default_draw_drawTrayDivider( DrawCtx* dctx, XP_Rect* rect,
} /* default_draw_drawTrayDivider */ } /* default_draw_drawTrayDivider */
static void static void
default_draw_score_pendingScore( DrawCtx* dctx, XP_Rect* rect, default_draw_score_pendingScore( DrawCtx* dctx,
XP_S16 score, XP_U16 playerNum ) const XP_Rect* rect,
XP_S16 score,
XP_U16 XP_UNUSED(playerNum),
CellFlags XP_UNUSED(flags) )
{ {
XP_UCHAR buf[5]; XP_UCHAR buf[5];
XP_Rect oldClip; XP_Rect oldClip;
@ -291,10 +296,10 @@ default_draw_score_pendingScore( DrawCtx* dctx, XP_Rect* rect,
draw_setClip( dctx, &oldClip, NULL ); draw_setClip( dctx, &oldClip, NULL );
} /* default_draw_score_pendingScore */ } /* default_draw_score_pendingScore */
static XP_UCHAR* static const XP_UCHAR*
default_draw_getMiniWText( DrawCtx* dctx, XWMiniTextType textHint ) default_draw_getMiniWText( DrawCtx* XP_UNUSED(dctx), XWMiniTextType textHint )
{ {
unsigned char* str; char* str;
switch( textHint ) { switch( textHint ) {
case BONUS_DOUBLE_LETTER: case BONUS_DOUBLE_LETTER:
@ -314,7 +319,7 @@ default_draw_getMiniWText( DrawCtx* dctx, XWMiniTextType textHint )
} /* default_draw_getMiniWText */ } /* default_draw_getMiniWText */
static void static void
default_draw_measureMiniWText( DrawCtx* dctx, XP_UCHAR* textP, default_draw_measureMiniWText( DrawCtx* dctx, const XP_UCHAR* textP,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
draw_measureText( dctx, textP, widthP, heightP ); draw_measureText( dctx, textP, widthP, heightP );
@ -325,8 +330,8 @@ default_draw_measureMiniWText( DrawCtx* dctx, XP_UCHAR* textP,
} /* default_draw_measureMiniWText */ } /* default_draw_measureMiniWText */
static void static void
default_draw_drawMiniWindow( DrawCtx* dctx, XP_UCHAR* text, default_draw_drawMiniWindow( DrawCtx* dctx, const XP_UCHAR* text,
XP_Rect* rect, void** closure ) const XP_Rect* rect, void** XP_UNUSED(closure) )
{ {
XP_Rect oldClip; XP_Rect oldClip;
@ -339,14 +344,6 @@ default_draw_drawMiniWindow( DrawCtx* dctx, XP_UCHAR* text,
draw_setClip( dctx, &oldClip, NULL ); draw_setClip( dctx, &oldClip, NULL );
} /* default_draw_drawMiniWindow */ } /* default_draw_drawMiniWindow */
static void
default_draw_eraseMiniWindow( DrawCtx* dctx, XP_Rect* rect,
XP_Bool lastTime, void** closure,
XP_Bool* invalUnder )
{
*invalUnder = XP_TRUE; /* let board.c do the work */
} /* default_draw_eraseMiniWindow */
void void
InitDrawDefaults( DrawCtxVTable* vtable ) InitDrawDefaults( DrawCtxVTable* vtable )
{ {
@ -364,7 +361,6 @@ InitDrawDefaults( DrawCtxVTable* vtable )
SET_VTABLE_ENTRY( vtable, draw_getMiniWText, default ); SET_VTABLE_ENTRY( vtable, draw_getMiniWText, default );
SET_VTABLE_ENTRY( vtable, draw_measureMiniWText, default ); SET_VTABLE_ENTRY( vtable, draw_measureMiniWText, default );
SET_VTABLE_ENTRY( vtable, draw_drawMiniWindow, default ); SET_VTABLE_ENTRY( vtable, draw_drawMiniWindow, default );
SET_VTABLE_ENTRY( vtable, draw_eraseMiniWindow, default );
} /* InitDrawDefaults */ } /* InitDrawDefaults */
#endif #endif