add const decls to draw.h and dictnry.h functions where appropriate,

and modify "subclass" methods to match.  Should be no code change, but
this makes the intent of the APIs clearer.
This commit is contained in:
ehouse 2006-02-18 06:39:40 +00:00
parent dde823a5ca
commit fb0d471dae
8 changed files with 238 additions and 221 deletions

View file

@ -63,7 +63,7 @@ typedef struct BdCursorLoc {
as there are (local) players, but they can all use the same window. */ as there are (local) players, but they can all use the same window. */
typedef struct MiniWindowStuff { typedef struct MiniWindowStuff {
void* closure; void* closure;
unsigned char* text; XP_UCHAR* text;
XP_Rect rect; XP_Rect rect;
} MiniWindowStuff; } MiniWindowStuff;

View file

@ -52,21 +52,21 @@ setBlankTile( DictionaryCtxt* dctx )
#if defined BLANKS_FIRST || defined DEBUG #if defined BLANKS_FIRST || defined DEBUG
XP_Bool XP_Bool
dict_hasBlankTile( DictionaryCtxt* dict ) dict_hasBlankTile( const DictionaryCtxt* dict )
{ {
return dict->blankTile >= 0; return dict->blankTile >= 0;
} /* dict_hasBlankTile */ } /* dict_hasBlankTile */
#endif #endif
Tile Tile
dict_getBlankTile( DictionaryCtxt* dict ) dict_getBlankTile( const DictionaryCtxt* dict )
{ {
XP_ASSERT( dict_hasBlankTile(dict) ); XP_ASSERT( dict_hasBlankTile(dict) );
return (Tile)dict->blankTile; return (Tile)dict->blankTile;
} /* dict_getBlankTile */ } /* dict_getBlankTile */
XP_U16 XP_U16
dict_getTileValue( DictionaryCtxt* dict, Tile tile ) dict_getTileValue( const DictionaryCtxt* dict, Tile tile )
{ {
if ( (tile & TILE_VALUE_MASK) != tile ) { if ( (tile & TILE_VALUE_MASK) != tile ) {
XP_ASSERT( tile == 32 && XP_ASSERT( tile == 32 &&
@ -78,7 +78,7 @@ dict_getTileValue( DictionaryCtxt* dict, Tile tile )
} /* dict_getTileValue */ } /* dict_getTileValue */
static XP_UCHAR static XP_UCHAR
dict_getTileChar( DictionaryCtxt* dict, Tile tile ) dict_getTileChar( const DictionaryCtxt* dict, Tile tile )
{ {
XP_ASSERT( tile < dict->nFaces ); XP_ASSERT( tile < dict->nFaces );
XP_ASSERT( (dict->faces16[tile] & 0xFF00) == 0 ); /* no unicode yet */ XP_ASSERT( (dict->faces16[tile] & 0xFF00) == 0 ); /* no unicode yet */
@ -86,20 +86,20 @@ dict_getTileChar( DictionaryCtxt* dict, Tile tile )
} /* dict_getTileValue */ } /* dict_getTileValue */
XP_U16 XP_U16
dict_numTiles( DictionaryCtxt* dict, Tile tile ) dict_numTiles( const DictionaryCtxt* dict, Tile tile )
{ {
tile *= 2; tile *= 2;
return dict->countsAndValues[tile]; return dict->countsAndValues[tile];
} /* dict_numTiles */ } /* dict_numTiles */
XP_U16 XP_U16
dict_numTileFaces( DictionaryCtxt* dict ) dict_numTileFaces( const DictionaryCtxt* dict )
{ {
return dict->nFaces; return dict->nFaces;
} /* dict_numTileFaces */ } /* dict_numTileFaces */
XP_U16 XP_U16
dict_tilesToString( DictionaryCtxt* ctxt, Tile* tiles, XP_U16 nTiles, dict_tilesToString( const DictionaryCtxt* ctxt, Tile* tiles, XP_U16 nTiles,
XP_UCHAR* buf, XP_U16 bufSize ) XP_UCHAR* buf, XP_U16 bufSize )
{ {
XP_UCHAR* bufp = buf; XP_UCHAR* bufp = buf;
@ -383,7 +383,7 @@ dict_getFaceBitmap( DictionaryCtxt* dict, Tile tile, XP_Bool isLarge )
#ifdef TALL_FONTS #ifdef TALL_FONTS
XP_LangCode XP_LangCode
dict_getLangCode( DictionaryCtxt* dict ) dict_getLangCode( const DictionaryCtxt* dict )
{ {
return dict->langCode; return dict->langCode;
} }

View file

@ -125,13 +125,13 @@ struct DictionaryCtxt {
XP_Bool dict_tilesAreSame( DictionaryCtxt* dict1, DictionaryCtxt* dict2 ); XP_Bool dict_tilesAreSame( DictionaryCtxt* dict1, DictionaryCtxt* dict2 );
XP_Bool dict_hasBlankTile( DictionaryCtxt* dict ); XP_Bool dict_hasBlankTile( const DictionaryCtxt* dict );
Tile dict_getBlankTile( DictionaryCtxt* dict ); Tile dict_getBlankTile( const DictionaryCtxt* dict );
XP_U16 dict_getTileValue( DictionaryCtxt* ctxt, Tile tile ); XP_U16 dict_getTileValue( const DictionaryCtxt* ctxt, Tile tile );
XP_U16 dict_numTiles( DictionaryCtxt* ctxt, Tile tile ); XP_U16 dict_numTiles( const DictionaryCtxt* ctxt, Tile tile );
XP_U16 dict_numTileFaces( DictionaryCtxt* ctxt ); XP_U16 dict_numTileFaces( const DictionaryCtxt* ctxt );
XP_U16 dict_tilesToString( DictionaryCtxt* ctxt, Tile* tiles, XP_U16 nTiles, XP_U16 dict_tilesToString( const DictionaryCtxt* ctxt, Tile* tiles, XP_U16 nTiles,
XP_UCHAR* buf, XP_U16 bufSize ); XP_UCHAR* buf, XP_U16 bufSize );
XP_UCHAR* dict_getName( DictionaryCtxt* ctxt ); XP_UCHAR* dict_getName( DictionaryCtxt* ctxt );
@ -142,7 +142,7 @@ XP_Bitmap dict_getFaceBitmap( DictionaryCtxt* dict, Tile tile,
XP_Bool isLarge ); XP_Bool isLarge );
#ifdef TALL_FONTS #ifdef TALL_FONTS
XP_LangCode dict_getLangCode( DictionaryCtxt* dict ); XP_LangCode dict_getLangCode( const DictionaryCtxt* dict );
#endif #endif
void dict_writeToStream( DictionaryCtxt* ctxt, XWStreamCtxt* stream ); void dict_writeToStream( DictionaryCtxt* ctxt, XWStreamCtxt* stream );

View file

@ -55,57 +55,59 @@ typedef XP_UCHAR HintAtts;
typedef struct DrawCtxVTable { typedef struct DrawCtxVTable {
#ifdef DRAW_WITH_PRIMITIVES #ifdef DRAW_WITH_PRIMITIVES
void (*m_draw_setClip)( DrawCtx* dctx, XP_Rect* newClip, void (*m_draw_setClip)( DrawCtx* dctx, const XP_Rect* newClip,
XP_Rect* oldClip ); const XP_Rect* oldClip );
void (*m_draw_frameRect)( DrawCtx* dctx, XP_Rect* rect ); void (*m_draw_frameRect)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_invertRect)( DrawCtx* dctx, XP_Rect* rect ); void (*m_draw_invertRect)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_drawString)( DrawCtx* dctx, XP_UCHAR* str, void (*m_draw_drawString)( DrawCtx* dctx, const XP_UCHAR* str,
XP_U16 x, XP_U16 y ); XP_U16 x, XP_U16 y );
void (*m_draw_drawBitmap)( DrawCtx* dctx, XP_Bitmap bm, void (*m_draw_drawBitmap)( DrawCtx* dctx, const XP_Bitmap bm,
XP_U16 x, XP_U16 y ); XP_U16 x, XP_U16 y );
void (*m_draw_measureText)( DrawCtx* dctx, XP_UCHAR* buf, void (*m_draw_measureText)( DrawCtx* dctx, const XP_UCHAR* buf,
XP_U16* widthP, XP_U16* heightP ); XP_U16* widthP, XP_U16* heightP );
#endif #endif
void (*m_draw_destroyCtxt)( DrawCtx* dctx ); void (*m_draw_destroyCtxt)( DrawCtx* dctx );
XP_Bool (*m_draw_boardBegin)( DrawCtx* dctx, DictionaryCtxt* dict, XP_Bool (*m_draw_boardBegin)( DrawCtx* dctx, const DictionaryCtxt* dict,
XP_Rect* rect, XP_Bool hasfocus ); const XP_Rect* rect, XP_Bool hasfocus );
void (*m_draw_boardFinished)( DrawCtx* dctx ); void (*m_draw_boardFinished)( DrawCtx* dctx );
/* rect is not const: set by callee */
XP_Bool (*m_draw_vertScrollBoard)(DrawCtx* dctx, XP_Rect* rect, XP_Bool (*m_draw_vertScrollBoard)(DrawCtx* dctx, XP_Rect* rect,
XP_S16 dist ); XP_S16 dist );
XP_Bool (*m_draw_trayBegin)( DrawCtx* dctx, XP_Rect* rect, XP_Bool (*m_draw_trayBegin)( DrawCtx* dctx, const XP_Rect* rect,
XP_U16 owner, XP_Bool hasfocus ); XP_U16 owner, XP_Bool hasfocus );
void (*m_draw_trayFinished)( DrawCtx* dctx ); void (*m_draw_trayFinished)( DrawCtx* dctx );
void (*m_draw_measureRemText)( DrawCtx* dctx, XP_Rect* r, void (*m_draw_measureRemText)( DrawCtx* dctx, const XP_Rect* r,
XP_S16 nTilesLeft, XP_S16 nTilesLeft,
XP_U16* width, XP_U16* height ); XP_U16* width, XP_U16* height );
void (*m_draw_drawRemText)(DrawCtx* dctx, XP_Rect* rInner, void (*m_draw_drawRemText)(DrawCtx* dctx, const XP_Rect* rInner,
XP_Rect* rOuter, XP_S16 nTilesLeft); const XP_Rect* rOuter, XP_S16 nTilesLeft);
void (*m_draw_scoreBegin)( DrawCtx* dctx, XP_Rect* rect, void (*m_draw_scoreBegin)( DrawCtx* dctx, const XP_Rect* rect,
XP_U16 numPlayers, XP_Bool hasfocus ); XP_U16 numPlayers, XP_Bool hasfocus );
void (*m_draw_measureScoreText)( DrawCtx* dctx, XP_Rect* r, void (*m_draw_measureScoreText)( DrawCtx* dctx, const XP_Rect* r,
DrawScoreInfo* dsi, const DrawScoreInfo* dsi,
XP_U16* width, XP_U16* height ); XP_U16* width, XP_U16* height );
void (*m_draw_score_drawPlayer)( DrawCtx* dctx, void (*m_draw_score_drawPlayer)( DrawCtx* dctx,
XP_Rect* rInner, XP_Rect* rOuter, const XP_Rect* rInner, const XP_Rect* rOuter,
DrawScoreInfo* dsi ); const DrawScoreInfo* dsi );
void (*m_draw_score_pendingScore)( DrawCtx* dctx, XP_Rect* rect, void (*m_draw_score_pendingScore)( DrawCtx* dctx, const XP_Rect* rect,
XP_S16 score, XP_U16 playerNum ); XP_S16 score, XP_U16 playerNum );
void (*m_draw_scoreFinished)( DrawCtx* dctx ); void (*m_draw_scoreFinished)( DrawCtx* dctx );
void (*m_draw_drawTimer)( DrawCtx* dctx, XP_Rect* rInner, XP_Rect* rOuter, void (*m_draw_drawTimer)( DrawCtx* dctx, const XP_Rect* rInner,
const XP_Rect* rOuter,
XP_U16 player, XP_S16 secondsLeft ); XP_U16 player, XP_S16 secondsLeft );
XP_Bool (*m_draw_drawCell)( DrawCtx* dctx, XP_Rect* rect, XP_Bool (*m_draw_drawCell)( DrawCtx* dctx, const XP_Rect* rect,
/* at least one of these two will be null */ /* at least one of these two will be null */
XP_UCHAR* text, XP_Bitmap bitmap, const XP_UCHAR* text, const XP_Bitmap bitmap,
#ifdef TALL_FONTS #ifdef TALL_FONTS
Tile tile, Tile tile,
#endif #endif
@ -114,33 +116,33 @@ typedef struct DrawCtxVTable {
XP_Bool isBlank, XP_Bool highlight, XP_Bool isBlank, XP_Bool highlight,
XP_Bool isStar); XP_Bool isStar);
void (*m_draw_invertCell)( DrawCtx* dctx, XP_Rect* rect ); void (*m_draw_invertCell)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_drawTile)( DrawCtx* dctx, XP_Rect* rect, void (*m_draw_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*/
XP_UCHAR* text, XP_Bitmap bitmap, const XP_UCHAR* text, const XP_Bitmap bitmap,
XP_S16 val, XP_Bool highlighted ); XP_S16 val, XP_Bool highlighted );
void (*m_draw_drawTileBack)( DrawCtx* dctx, XP_Rect* rect ); void (*m_draw_drawTileBack)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_drawTrayDivider)( DrawCtx* dctx, XP_Rect* rect, void (*m_draw_drawTrayDivider)( DrawCtx* dctx, const XP_Rect* rect,
XP_Bool selected ); XP_Bool selected );
void (*m_draw_clearRect)( DrawCtx* dctx, XP_Rect* rect ); void (*m_draw_clearRect)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_drawBoardArrow)( DrawCtx* dctx, XP_Rect* rect, void (*m_draw_drawBoardArrow)( DrawCtx* dctx, const XP_Rect* rect,
XWBonusType bonus, XP_Bool vert, XWBonusType bonus, XP_Bool vert,
HintAtts hintAtts ); HintAtts hintAtts );
#ifdef KEY_SUPPORT #ifdef KEY_SUPPORT
void (*m_draw_drawTrayCursor)( DrawCtx* dctx, XP_Rect* rect ); void (*m_draw_drawTrayCursor)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_drawBoardCursor)( DrawCtx* dctx, XP_Rect* rect ); void (*m_draw_drawBoardCursor)( DrawCtx* dctx, const XP_Rect* rect );
#endif #endif
XP_UCHAR* (*m_draw_getMiniWText)( DrawCtx* dctx, XP_UCHAR* (*m_draw_getMiniWText)( DrawCtx* dctx,
XWMiniTextType textHint ); XWMiniTextType textHint );
void (*m_draw_measureMiniWText)( DrawCtx* dctx, XP_UCHAR* textP, void (*m_draw_measureMiniWText)( DrawCtx* dctx, const XP_UCHAR* textP,
XP_U16* width, XP_U16* height ); XP_U16* width, XP_U16* height );
void (*m_draw_drawMiniWindow)( DrawCtx* dctx, XP_UCHAR* text, void (*m_draw_drawMiniWindow)( DrawCtx* dctx, const XP_UCHAR* text,
XP_Rect* rect, void** closure ); const XP_Rect* rect, void** closure );
void (*m_draw_eraseMiniWindow)( DrawCtx* dctx, XP_Rect* rect, void (*m_draw_eraseMiniWindow)( DrawCtx* dctx, const XP_Rect* rect,
XP_Bool lastTime, void** closure, XP_Bool lastTime, void** closure,
XP_Bool* invalUnder ); XP_Bool* invalUnder );

View file

@ -28,7 +28,7 @@
#include "board.h" #include "board.h"
static void static void
drawRect( WINDOW* win, XP_Rect* rect, char vert, char hor ) drawRect( WINDOW* win, const XP_Rect* rect, char vert, char hor )
{ {
wmove( win, rect->top-1, rect->left ); wmove( win, rect->top-1, rect->left );
whline( win, hor, rect->width ); whline( win, hor, rect->width );
@ -42,7 +42,7 @@ drawRect( WINDOW* win, XP_Rect* rect, char vert, char hor )
} /* drawRect */ } /* drawRect */
static void static void
eraseRect( CursesDrawCtx* dctx, XP_Rect* rect ) eraseRect( CursesDrawCtx* dctx, const XP_Rect* rect )
{ {
int y, bottom = rect->top + rect->height; int y, bottom = rect->top + rect->height;
for ( y = rect->top; y < bottom; ++y ) { for ( y = rect->top; y < bottom; ++y ) {
@ -57,8 +57,8 @@ curses_draw_destroyCtxt( DrawCtx* p_dctx )
} /* draw_setup */ } /* draw_setup */
static XP_Bool static XP_Bool
curses_draw_boardBegin( DrawCtx* p_dctx, DictionaryCtxt* dict, XP_Rect* rect, curses_draw_boardBegin( DrawCtx* p_dctx, const DictionaryCtxt* dict,
XP_Bool hasfocus ) const XP_Rect* rect, XP_Bool hasfocus )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
if ( hasfocus ) { if ( hasfocus ) {
@ -70,8 +70,8 @@ curses_draw_boardBegin( DrawCtx* p_dctx, DictionaryCtxt* dict, XP_Rect* rect,
} /* draw_finish */ } /* draw_finish */
static XP_Bool static XP_Bool
curses_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 owner, curses_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool hasfocus ) XP_U16 owner, XP_Bool hasfocus )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
if ( hasfocus ) { if ( hasfocus ) {
@ -83,7 +83,7 @@ curses_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 owner,
} /* draw_finish */ } /* draw_finish */
static void static void
curses_draw_scoreBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 numPlayers, curses_draw_scoreBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 numPlayers,
XP_Bool hasfocus ) XP_Bool hasfocus )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
@ -108,7 +108,7 @@ formatRemText( char* buf, XP_S16 nTilesLeft )
} /* formatRemText */ } /* formatRemText */
static void static void
curses_draw_measureRemText( DrawCtx* dctx, XP_Rect* r, curses_draw_measureRemText( DrawCtx* dctx, const XP_Rect* r,
XP_S16 nTilesLeft, XP_S16 nTilesLeft,
XP_U16* width, XP_U16* height ) XP_U16* width, XP_U16* height )
{ {
@ -121,8 +121,8 @@ curses_draw_measureRemText( DrawCtx* dctx, XP_Rect* r,
} /* curses_draw_measureRemText */ } /* curses_draw_measureRemText */
static void static void
curses_draw_drawRemText( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, curses_draw_drawRemText( DrawCtx* p_dctx, const XP_Rect* rInner,
XP_S16 nTilesLeft ) const XP_Rect* rOuter, XP_S16 nTilesLeft )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
char buf[32]; char buf[32];
@ -135,7 +135,7 @@ curses_draw_drawRemText( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter,
#define RECENT_COL 31 #define RECENT_COL 31
static void static void
formatScoreText( char* buf, DrawScoreInfo* dsi ) formatScoreText( XP_UCHAR* buf, const DrawScoreInfo* dsi )
{ {
XP_S16 nTilesLeft = dsi->nTilesLeft; XP_S16 nTilesLeft = dsi->nTilesLeft;
XP_Bool isRobot = dsi->isRobot; XP_Bool isRobot = dsi->isRobot;
@ -170,11 +170,11 @@ formatScoreText( char* buf, DrawScoreInfo* dsi )
} /* formatScoreText */ } /* formatScoreText */
static void static void
curses_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* r, curses_draw_measureScoreText( DrawCtx* p_dctx, const XP_Rect* r,
DrawScoreInfo* dsi, const DrawScoreInfo* dsi,
XP_U16* width, XP_U16* height ) XP_U16* width, XP_U16* height )
{ {
char buf[100]; XP_UCHAR buf[100];
formatScoreText( buf, dsi ); formatScoreText( buf, dsi );
*width = strlen( buf ); *width = strlen( buf );
@ -182,7 +182,7 @@ curses_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* r,
} /* curses_draw_measureScoreText */ } /* curses_draw_measureScoreText */
static void static void
curses_draw_score_pendingScore( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 score, curses_draw_score_pendingScore( DrawCtx* p_dctx, const XP_Rect* rect, XP_S16 score,
XP_U16 playerNum ) XP_U16 playerNum )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
@ -223,8 +223,8 @@ curses_draw_scoreFinished( DrawCtx* p_dctx )
#define MY_PAIR 1 #define MY_PAIR 1
static void static void
curses_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, curses_draw_score_drawPlayer( DrawCtx* p_dctx, const XP_Rect* rInner,
DrawScoreInfo* dsi ) const XP_Rect* rOuter, const DrawScoreInfo* dsi )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
char buf[100]; char buf[100];
@ -247,25 +247,28 @@ curses_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter,
} /* curses_draw_score_drawPlayer */ } /* curses_draw_score_drawPlayer */
static XP_Bool static XP_Bool
curses_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect, curses_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* rect,
XP_UCHAR* letter, XP_Bitmap bitmap, const XP_UCHAR* letter, XP_Bitmap bitmap,
XP_S16 owner, XWBonusType bonus, HintAtts hintAtts, XP_S16 owner, XWBonusType bonus, HintAtts hintAtts,
XP_Bool isBlank, XP_Bool highlight, XP_Bool isStar ) XP_Bool isBlank, XP_Bool highlight, XP_Bool isStar )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
XP_UCHAR loc[4];
XP_ASSERT( XP_STRLEN(letter) < sizeof(loc) );
XP_STRNCPY( loc, letter, sizeof(loc) );
if ( *letter == LETTER_NONE ) { if ( loc[0] == LETTER_NONE ) {
switch ( bonus ) { switch ( bonus ) {
case BONUS_DOUBLE_LETTER: case BONUS_DOUBLE_LETTER:
letter[0] = '+'; break; loc[0] = '+'; break;
case BONUS_DOUBLE_WORD: case BONUS_DOUBLE_WORD:
letter[0] = '*'; break; loc[0] = '*'; break;
case BONUS_TRIPLE_LETTER: case BONUS_TRIPLE_LETTER:
letter[0] = '^'; break; loc[0] = '^'; break;
case BONUS_TRIPLE_WORD: case BONUS_TRIPLE_WORD:
letter[0] = '#'; break; loc[0] = '#'; break;
default: default:
letter[0] = ' '; loc[0] = ' ';
} /* switch */ } /* switch */
} }
@ -273,8 +276,8 @@ curses_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect,
wstandout( dctx->boardWin ); wstandout( dctx->boardWin );
} }
mvwaddnstr( dctx->boardWin, rect->top, rect->left, letter, mvwaddnstr( dctx->boardWin, rect->top, rect->left, loc,
strlen(letter) ); strlen(loc) );
if ( highlight ) { if ( highlight ) {
wstandend( dctx->boardWin ); wstandend( dctx->boardWin );
@ -284,7 +287,7 @@ curses_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect,
} /* curses_draw_drawCell */ } /* curses_draw_drawCell */
static void static void
curses_stringInTile( CursesDrawCtx* dctx, XP_Rect* rect, curses_stringInTile( CursesDrawCtx* dctx, const XP_Rect* rect,
XP_UCHAR* letter, XP_UCHAR* val ) XP_UCHAR* letter, XP_UCHAR* val )
{ {
eraseRect( dctx, rect ); eraseRect( dctx, rect );
@ -300,8 +303,8 @@ curses_stringInTile( CursesDrawCtx* dctx, XP_Rect* rect,
} /* curses_stringInTile */ } /* curses_stringInTile */
static void static void
curses_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect, curses_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect,
XP_UCHAR* textP, XP_Bitmap bitmap, const XP_UCHAR* textP, XP_Bitmap bitmap,
XP_S16 val, XP_Bool highlighted ) XP_S16 val, XP_Bool highlighted )
{ {
char numbuf[5]; char numbuf[5];
@ -328,14 +331,14 @@ curses_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect,
} /* curses_draw_drawTile */ } /* curses_draw_drawTile */
static void static void
curses_draw_drawTileBack( DrawCtx* p_dctx, XP_Rect* rect ) curses_draw_drawTileBack( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
curses_stringInTile( dctx, rect, "?", "?" ); curses_stringInTile( dctx, rect, "?", "?" );
} /* curses_draw_drawTileBack */ } /* curses_draw_drawTileBack */
static void static void
curses_draw_drawTrayDivider( DrawCtx* p_dctx, XP_Rect* rect, curses_draw_drawTrayDivider( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool selected ) XP_Bool selected )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
@ -345,7 +348,7 @@ curses_draw_drawTrayDivider( DrawCtx* p_dctx, XP_Rect* rect,
} /* curses_draw_drawTrayDivider */ } /* curses_draw_drawTrayDivider */
static void static void
curses_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rect, curses_draw_drawBoardArrow( DrawCtx* p_dctx, const XP_Rect* rect,
XWBonusType cursorBonus, XP_Bool vertical, XWBonusType cursorBonus, XP_Bool vertical,
HintAtts hintAtts ) HintAtts hintAtts )
{ {
@ -362,7 +365,7 @@ curses_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rect,
} /* curses_draw_drawBoardArrow */ } /* curses_draw_drawBoardArrow */
static void static void
curses_draw_drawBoardCursor( DrawCtx* p_dctx, XP_Rect* rect ) curses_draw_drawBoardCursor( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
chtype curChar = mvwinch(dctx->boardWin, rect->top, rect->left ); chtype curChar = mvwinch(dctx->boardWin, rect->top, rect->left );
@ -372,7 +375,7 @@ curses_draw_drawBoardCursor( DrawCtx* p_dctx, XP_Rect* rect )
} /* curses_draw_drawBoardCursor */ } /* curses_draw_drawBoardCursor */
static void static void
curses_draw_drawTrayCursor( DrawCtx* p_dctx, XP_Rect* rect ) curses_draw_drawTrayCursor( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
wmove( dctx->boardWin, rect->top, rect->left ); wmove( dctx->boardWin, rect->top, rect->left );
@ -380,7 +383,7 @@ curses_draw_drawTrayCursor( DrawCtx* p_dctx, XP_Rect* rect )
} /* curses_draw_drawTrayCursor */ } /* curses_draw_drawTrayCursor */
static void static void
curses_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rectP ) curses_draw_clearRect( DrawCtx* p_dctx, const XP_Rect* rectP )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
XP_Rect rect = *rectP; XP_Rect rect = *rectP;
@ -395,7 +398,7 @@ curses_draw_getMiniWText( DrawCtx* p_dctx, XWMiniTextType textHint )
} /* curses_draw_getMiniWText */ } /* curses_draw_getMiniWText */
static void static void
curses_draw_measureMiniWText( DrawCtx* p_dctx, unsigned char* str, curses_draw_measureMiniWText( DrawCtx* p_dctx, const XP_UCHAR* str,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
*widthP = strlen(str) + 4; *widthP = strlen(str) + 4;
@ -403,8 +406,8 @@ curses_draw_measureMiniWText( DrawCtx* p_dctx, unsigned char* str,
} /* curses_draw_measureMiniWText */ } /* curses_draw_measureMiniWText */
static void static void
curses_draw_drawMiniWindow( DrawCtx* p_dctx, XP_UCHAR* text, curses_draw_drawMiniWindow( DrawCtx* p_dctx, const XP_UCHAR* text,
XP_Rect* rect, void** closure ) const XP_Rect* rect, void** closure )
{ {
CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx; CursesDrawCtx* dctx = (CursesDrawCtx*)p_dctx;
XP_Rect smallerR; XP_Rect smallerR;
@ -422,7 +425,7 @@ curses_draw_drawMiniWindow( DrawCtx* p_dctx, XP_UCHAR* text,
} /* curses_draw_drawMiniWindow */ } /* curses_draw_drawMiniWindow */
static void static void
curses_draw_eraseMiniWindow( DrawCtx* p_dctx, XP_Rect* rect, curses_draw_eraseMiniWindow( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool lastTime, void** closure, XP_Bool lastTime, void** closure,
XP_Bool* invalUnder ) XP_Bool* invalUnder )
{ {

View file

@ -55,7 +55,7 @@ insetRect( XP_Rect* r, short i )
static void static void
eraseRect(GtkDrawCtx* dctx, XP_Rect* rect ) eraseRect( GtkDrawCtx* dctx, const XP_Rect* rect )
{ {
gdk_draw_rectangle( DRAW_WHAT(dctx), gdk_draw_rectangle( DRAW_WHAT(dctx),
dctx->drawing_area->style->white_gc, dctx->drawing_area->style->white_gc,
@ -166,7 +166,7 @@ draw_string_at( GtkDrawCtx* dctx, PangoLayout* layout, const char* str,
} /* draw_string_at */ } /* draw_string_at */
static void static void
drawBitmapFromLBS( GtkDrawCtx* dctx, XP_Bitmap bm, XP_Rect* rect ) drawBitmapFromLBS( GtkDrawCtx* dctx, XP_Bitmap bm, const XP_Rect* rect )
{ {
GdkPixmap* pm; GdkPixmap* pm;
LinuxBMStruct* lbs = (LinuxBMStruct*)bm; LinuxBMStruct* lbs = (LinuxBMStruct*)bm;
@ -241,8 +241,8 @@ gtk_draw_destroyCtxt( DrawCtx* p_dctx )
static XP_Bool static XP_Bool
gtk_draw_boardBegin( DrawCtx* p_dctx, DictionaryCtxt* dict, gtk_draw_boardBegin( DrawCtx* p_dctx, const DictionaryCtxt* dict,
XP_Rect* rect, XP_Bool hasfocus ) const XP_Rect* rect, XP_Bool hasfocus )
{ {
GdkRectangle gdkrect; GdkRectangle gdkrect;
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
@ -264,7 +264,7 @@ gtk_draw_boardFinished( DrawCtx* p_dctx )
} /* draw_finished */ } /* draw_finished */
static void static void
drawHintBorders( GtkDrawCtx* dctx, XP_Rect* rect, HintAtts hintAtts) drawHintBorders( GtkDrawCtx* dctx, const XP_Rect* rect, HintAtts hintAtts)
{ {
if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) { if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) {
XP_Rect lrect = *rect; XP_Rect lrect = *rect;
@ -302,7 +302,7 @@ drawHintBorders( GtkDrawCtx* dctx, XP_Rect* rect, HintAtts hintAtts)
} }
static XP_Bool static XP_Bool
gtk_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect, XP_UCHAR* letter, gtk_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* rect, const XP_UCHAR* letter,
XP_Bitmap bitmap, XP_S16 owner, XWBonusType bonus, XP_Bitmap bitmap, XP_S16 owner, XWBonusType bonus,
HintAtts hintAtts, HintAtts hintAtts,
XP_Bool isBlank, XP_Bool highlight, XP_Bool isStar ) XP_Bool isBlank, XP_Bool highlight, XP_Bool isStar )
@ -382,7 +382,7 @@ gtk_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect, XP_UCHAR* letter,
} /* gtk_draw_drawCell */ } /* gtk_draw_drawCell */
static void static void
gtk_draw_invertCell( DrawCtx* p_dctx, XP_Rect* rect ) gtk_draw_invertCell( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
/* GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; */ /* GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; */
/* (void)gtk_draw_drawMiniWindow( p_dctx, "f", rect); */ /* (void)gtk_draw_drawMiniWindow( p_dctx, "f", rect); */
@ -402,7 +402,7 @@ gtk_draw_invertCell( DrawCtx* p_dctx, XP_Rect* rect )
} /* gtk_draw_invertCell */ } /* gtk_draw_invertCell */
static XP_Bool static XP_Bool
gtk_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 owner, gtk_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 owner,
XP_Bool hasfocus ) XP_Bool hasfocus )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
@ -414,10 +414,10 @@ gtk_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 owner,
} /* gtk_draw_trayBegin */ } /* gtk_draw_trayBegin */
static void static void
gtk_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect, XP_UCHAR* textP, gtk_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect, const XP_UCHAR* textP,
XP_Bitmap bitmap, XP_S16 val, XP_Bool highlighted ) XP_Bitmap bitmap, XP_S16 val, XP_Bool highlighted )
{ {
unsigned char numbuf[3]; XP_UCHAR numbuf[3];
gint len; gint len;
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
XP_Rect insetR = *rect; XP_Rect insetR = *rect;
@ -478,7 +478,7 @@ gtk_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect, XP_UCHAR* textP,
} /* gtk_draw_drawTile */ } /* gtk_draw_drawTile */
static void static void
gtk_draw_drawTileBack( DrawCtx* p_dctx, XP_Rect* rect ) gtk_draw_drawTileBack( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
XP_Rect r = *rect; XP_Rect r = *rect;
@ -503,7 +503,8 @@ gtk_draw_drawTileBack( DrawCtx* p_dctx, XP_Rect* rect )
} /* gtk_draw_drawTileBack */ } /* gtk_draw_drawTileBack */
static void static void
gtk_draw_drawTrayDivider( DrawCtx* p_dctx, XP_Rect* rect, XP_Bool selected ) gtk_draw_drawTrayDivider( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool selected )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
XP_Rect r = *rect; XP_Rect r = *rect;
@ -538,14 +539,14 @@ gtk_draw_frameBoard( DrawCtx* p_dctx, XP_Rect* rect )
} /* gtk_draw_frameBoard */ } /* gtk_draw_frameBoard */
static void static void
gtk_draw_frameTray( DrawCtx* p_dctx, XP_Rect* rect ) gtk_draw_frameTray( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
// GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; // GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
} /* gtk_draw_frameBoard */ } /* gtk_draw_frameBoard */
#endif #endif
static void static void
gtk_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rectP ) gtk_draw_clearRect( DrawCtx* p_dctx, const XP_Rect* rectP )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
XP_Rect rect = *rectP; XP_Rect rect = *rectP;
@ -558,7 +559,7 @@ gtk_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rectP )
} /* gtk_draw_clearRect */ } /* gtk_draw_clearRect */
static void static void
gtk_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP, gtk_draw_drawBoardArrow( DrawCtx* p_dctx, const XP_Rect* rectP,
XWBonusType cursorBonus, XP_Bool vertical, XWBonusType cursorBonus, XP_Bool vertical,
HintAtts hintAtts ) HintAtts hintAtts )
{ {
@ -572,7 +573,7 @@ gtk_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP,
} /* gtk_draw_drawBoardCursor */ } /* gtk_draw_drawBoardCursor */
static void static void
gtk_draw_scoreBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 numPlayers, gtk_draw_scoreBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 numPlayers,
XP_Bool hasfocus ) XP_Bool hasfocus )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
@ -582,7 +583,7 @@ gtk_draw_scoreBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 numPlayers,
} /* gtk_draw_scoreBegin */ } /* gtk_draw_scoreBegin */
static void static void
gtkDrawDrawRemText( DrawCtx* p_dctx, XP_Rect* r, XP_U16 nTilesLeft, gtkDrawDrawRemText( DrawCtx* p_dctx, const XP_Rect* r, XP_U16 nTilesLeft,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
@ -614,22 +615,22 @@ gtkDrawDrawRemText( DrawCtx* p_dctx, XP_Rect* r, XP_U16 nTilesLeft,
} /* gtkDrawDrawRemText */ } /* gtkDrawDrawRemText */
static void static void
gtk_draw_measureRemText( DrawCtx* p_dctx, XP_Rect* r, XP_S16 nTilesLeft, gtk_draw_measureRemText( DrawCtx* p_dctx, const XP_Rect* r, XP_S16 nTilesLeft,
XP_U16* width, XP_U16* height ) XP_U16* width, XP_U16* height )
{ {
gtkDrawDrawRemText( p_dctx, r, nTilesLeft, width, height ); gtkDrawDrawRemText( p_dctx, r, nTilesLeft, width, height );
} /* gtk_draw_measureRemText */ } /* gtk_draw_measureRemText */
static void static void
gtk_draw_drawRemText( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, gtk_draw_drawRemText( DrawCtx* p_dctx, const XP_Rect* rInner,
XP_S16 nTilesLeft ) const XP_Rect* rOuter, XP_S16 nTilesLeft )
{ {
gtkDrawDrawRemText( p_dctx, rInner, nTilesLeft, NULL, NULL ); gtkDrawDrawRemText( p_dctx, rInner, nTilesLeft, NULL, NULL );
} /* gtk_draw_drawRemText */ } /* gtk_draw_drawRemText */
static void static void
scoreWidthAndText( GtkDrawCtx* dctx, PangoLayout* layout, char* buf, scoreWidthAndText( GtkDrawCtx* dctx, PangoLayout* layout, char* buf,
DrawScoreInfo* dsi, XP_U16* widthP, XP_U16* heightP ) const DrawScoreInfo* dsi, XP_U16* widthP, XP_U16* heightP )
{ {
XP_S16 score = dsi->score; XP_S16 score = dsi->score;
XP_U16 nTilesLeft = dsi->nTilesLeft; XP_U16 nTilesLeft = dsi->nTilesLeft;
@ -664,8 +665,8 @@ scoreWidthAndText( GtkDrawCtx* dctx, PangoLayout* layout, char* buf,
} /* scoreWidthAndText */ } /* scoreWidthAndText */
static void static void
gtk_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* r, gtk_draw_measureScoreText( DrawCtx* p_dctx, const XP_Rect* r,
DrawScoreInfo* dsi, const DrawScoreInfo* dsi,
XP_U16* width, XP_U16* height ) XP_U16* width, XP_U16* height )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
@ -675,8 +676,8 @@ gtk_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* r,
} /* gtk_draw_measureScoreText */ } /* gtk_draw_measureScoreText */
static void static void
gtk_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, gtk_draw_score_drawPlayer( DrawCtx* p_dctx, const XP_Rect* rInner,
DrawScoreInfo* dsi ) const XP_Rect* rOuter, const DrawScoreInfo* dsi )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
char scoreBuf[20]; char scoreBuf[20];
@ -702,7 +703,7 @@ gtk_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter,
} /* gtk_draw_score_drawPlayer */ } /* gtk_draw_score_drawPlayer */
static void static void
gtk_draw_score_pendingScore( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 score, gtk_draw_score_pendingScore( DrawCtx* p_dctx, const XP_Rect* rect, XP_S16 score,
XP_U16 playerNum ) XP_U16 playerNum )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
@ -719,16 +720,15 @@ gtk_draw_score_pendingScore( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 score,
/* gdk_gc_set_clip_rectangle( dctx->drawGC, (GdkRectangle*)rect ); */ /* gdk_gc_set_clip_rectangle( dctx->drawGC, (GdkRectangle*)rect ); */
localR = *rect; localR = *rect;
rect = &localR; insetRect( &localR, 1 );
insetRect( rect, 1 ); eraseRect( dctx, &localR );
eraseRect( dctx, rect );
left = rect->left + 1; left = localR.left + 1;
draw_string_at( dctx, dctx->layout[LAYOUT_SMALL], "Pts:", draw_string_at( dctx, dctx->layout[LAYOUT_SMALL], "Pts:",
rect, XP_GTK_JUST_TOPLEFT, &localR, XP_GTK_JUST_TOPLEFT,
&dctx->black, NULL ); &dctx->black, NULL );
draw_string_at( dctx, dctx->layout[LAYOUT_SMALL], buf, draw_string_at( dctx, dctx->layout[LAYOUT_SMALL], buf,
rect, XP_GTK_JUST_BOTTOMRIGHT, &localR, XP_GTK_JUST_BOTTOMRIGHT,
&dctx->black, NULL ); &dctx->black, NULL );
} /* gtk_draw_score_pendingScore */ } /* gtk_draw_score_pendingScore */
@ -755,7 +755,8 @@ gtkFormatTimerText( XP_UCHAR* buf, XP_S16 secondsLeft )
} /* gtkFormatTimerText */ } /* gtkFormatTimerText */
static void static void
gtk_draw_drawTimer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, gtk_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rInner,
const XP_Rect* rOuter,
XP_U16 player, XP_S16 secondsLeft ) XP_U16 player, XP_S16 secondsLeft )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
@ -774,11 +775,11 @@ gtk_draw_drawTimer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter,
#define MINI_V_PADDING 6 #define MINI_V_PADDING 6
#define MINI_H_PADDING 8 #define MINI_H_PADDING 8
static unsigned char* static XP_UCHAR*
gtk_draw_getMiniWText( DrawCtx* p_dctx, XWMiniTextType textHint ) gtk_draw_getMiniWText( DrawCtx* p_dctx, XWMiniTextType textHint )
{ {
/* GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; */ /* GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; */
unsigned char* str; XP_UCHAR* str;
switch( textHint ) { switch( textHint ) {
case BONUS_DOUBLE_LETTER: case BONUS_DOUBLE_LETTER:
@ -798,7 +799,7 @@ gtk_draw_getMiniWText( DrawCtx* p_dctx, XWMiniTextType textHint )
} /* gtk_draw_getMiniWText */ } /* gtk_draw_getMiniWText */
static void static void
gtk_draw_measureMiniWText( DrawCtx* p_dctx, unsigned char* str, gtk_draw_measureMiniWText( DrawCtx* p_dctx, const XP_UCHAR* str,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
@ -811,8 +812,8 @@ gtk_draw_measureMiniWText( DrawCtx* p_dctx, unsigned char* str,
} /* gtk_draw_measureMiniWText */ } /* gtk_draw_measureMiniWText */
static void static void
gtk_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text, XP_Rect* rect, gtk_draw_drawMiniWindow( DrawCtx* p_dctx, const XP_UCHAR* text,
void** closureP ) const XP_Rect* rect, void** closureP )
{ {
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
XP_Rect localR = *rect; XP_Rect localR = *rect;
@ -840,7 +841,8 @@ gtk_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text, XP_Rect* rect,
} /* gtk_draw_drawMiniWindow */ } /* gtk_draw_drawMiniWindow */
static void static void
gtk_draw_eraseMiniWindow( DrawCtx* p_dctx, XP_Rect* rect, XP_Bool lastTime, gtk_draw_eraseMiniWindow( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool lastTime,
void** closure, XP_Bool* invalUnder ) void** closure, XP_Bool* invalUnder )
{ {
/* GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; */ /* GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; */

View file

@ -37,22 +37,24 @@
#define TILE_SUBSCRIPT 1 /* draw tile with numbers below letters? */ #define TILE_SUBSCRIPT 1 /* draw tile with numbers below letters? */
static XP_Bool palm_common_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect, static XP_Bool palm_common_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* rect,
XP_UCHAR* letters, XP_Bitmap bitmap, const XP_UCHAR* letters, XP_Bitmap bitmap,
#ifdef TALL_FONTS #ifdef TALL_FONTS
Tile tile, Tile tile,
#endif #endif
XP_S16 owner, XWBonusType bonus, XP_S16 owner, XWBonusType bonus,
HintAtts hintAtts, XP_Bool isBlank, HintAtts hintAtts, XP_Bool isBlank,
XP_Bool isPending, XP_Bool isStar ); XP_Bool isPending, XP_Bool isStar );
static void palm_bnw_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner, static void palm_bnw_draw_score_drawPlayer( DrawCtx* p_dctx,
XP_Rect* rOuter, DrawScoreInfo* dsi ); const XP_Rect* rInner,
static XP_Bool palm_bnw_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, const XP_Rect* rOuter,
const DrawScoreInfo* dsi );
static XP_Bool palm_bnw_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect,
XP_U16 owner, XP_Bool hasfocus ); XP_U16 owner, XP_Bool hasfocus );
static void palm_bnw_draw_trayFinished( DrawCtx* p_dctx ); static void palm_bnw_draw_trayFinished( DrawCtx* p_dctx );
static void palm_clr_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rectP ); static void palm_clr_draw_clearRect( DrawCtx* p_dctx, const XP_Rect* rectP );
static void palm_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text, static void palm_draw_drawMiniWindow( DrawCtx* p_dctx, const XP_UCHAR* text,
XP_Rect* rect, void** closureP ); const XP_Rect* rect, void** closureP );
#ifdef FEATURE_HIGHRES #ifdef FEATURE_HIGHRES
#define HIGHRES_PUSH_LOC( dctx ) \ #define HIGHRES_PUSH_LOC( dctx ) \
@ -90,7 +92,7 @@ static void palm_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text,
#endif #endif
static void static void
eraseRect( /* PalmDrawCtx* dctx, */XP_Rect* rect ) eraseRect( /* PalmDrawCtx* dctx, */const XP_Rect* rect )
{ {
WinEraseRectangle( (const RectangleType*)rect, 0 ); WinEraseRectangle( (const RectangleType*)rect, 0 );
} /* eraseRect */ } /* eraseRect */
@ -121,7 +123,7 @@ drawBitmapAt( DrawCtx* p_dctx, Int16 resID, Int16 x, Int16 y )
} /* drawBitmapAt */ } /* drawBitmapAt */
static void static void
bitmapInRect( PalmDrawCtx* dctx, Int16 resID, XP_Rect* rectP ) bitmapInRect( PalmDrawCtx* dctx, Int16 resID, const XP_Rect* rectP )
{ {
XP_U16 left = rectP->left; XP_U16 left = rectP->left;
XP_U16 top = rectP->top; XP_U16 top = rectP->top;
@ -209,7 +211,7 @@ measureFace( PalmDrawCtx* dctx, XP_UCHAR face, PalmFontHtInfo* fhi )
} /* measureFace */ } /* measureFace */
static void static void
checkFontOffsets( PalmDrawCtx* dctx, DictionaryCtxt* dict ) checkFontOffsets( PalmDrawCtx* dctx, const DictionaryCtxt* dict )
{ {
XP_LangCode code; XP_LangCode code;
XP_U16 nFaces; XP_U16 nFaces;
@ -242,8 +244,8 @@ checkFontOffsets( PalmDrawCtx* dctx, DictionaryCtxt* dict )
#endif #endif
static XP_Bool static XP_Bool
palm_common_draw_boardBegin( DrawCtx* p_dctx, DictionaryCtxt* dict, palm_common_draw_boardBegin( DrawCtx* p_dctx, const DictionaryCtxt* dict,
XP_Rect* rect, XP_Bool hasfocus ) const XP_Rect* rect, XP_Bool hasfocus )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
PalmAppGlobals* globals = dctx->globals; PalmAppGlobals* globals = dctx->globals;
@ -258,8 +260,8 @@ palm_common_draw_boardBegin( DrawCtx* p_dctx, DictionaryCtxt* dict,
#ifdef COLOR_SUPPORT #ifdef COLOR_SUPPORT
static XP_Bool static XP_Bool
palm_clr_draw_boardBegin( DrawCtx* p_dctx, DictionaryCtxt* dict, palm_clr_draw_boardBegin( DrawCtx* p_dctx, const DictionaryCtxt* dict,
XP_Rect* rect, XP_Bool hasfocus ) const XP_Rect* rect, XP_Bool hasfocus )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
@ -283,8 +285,8 @@ palm_clr_draw_boardFinished( DrawCtx* p_dctx )
} /* palm_clr_draw_boardFinished */ } /* palm_clr_draw_boardFinished */
static XP_Bool static XP_Bool
palm_clr_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect, palm_clr_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* rect,
XP_UCHAR* letters, XP_Bitmap bitmap, const XP_UCHAR* letters, XP_Bitmap bitmap,
#ifdef TALL_FONTS #ifdef TALL_FONTS
Tile tile, Tile tile,
#endif #endif
@ -329,8 +331,9 @@ palm_clr_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect,
} /* palm_clr_draw_drawCell */ } /* palm_clr_draw_drawCell */
static void static void
palm_clr_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner, palm_clr_draw_score_drawPlayer( DrawCtx* p_dctx, const XP_Rect* rInner,
XP_Rect* rOuter, DrawScoreInfo* dsi ) const XP_Rect* rOuter,
const DrawScoreInfo* dsi )
{ {
XP_U16 playerNum = dsi->playerNum; XP_U16 playerNum = dsi->playerNum;
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
@ -350,7 +353,7 @@ palm_clr_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner,
#endif #endif
static void static void
palmDrawHintBorders( XP_Rect* rect, HintAtts hintAtts ) palmDrawHintBorders( const XP_Rect* rect, HintAtts hintAtts )
{ {
if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) { if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) {
XP_Rect frame = *rect; XP_Rect frame = *rect;
@ -379,8 +382,8 @@ palmDrawHintBorders( XP_Rect* rect, HintAtts hintAtts )
} /* palmDrawHintBorders */ } /* palmDrawHintBorders */
static XP_Bool static XP_Bool
palm_common_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect, palm_common_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* rect,
XP_UCHAR* letters, XP_Bitmap bitmap, const XP_UCHAR* letters, XP_Bitmap bitmap,
#ifdef TALL_FONTS #ifdef TALL_FONTS
Tile tile, Tile tile,
#endif #endif
@ -521,7 +524,7 @@ palm_common_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect,
} /* palm_common_draw_drawCell */ } /* palm_common_draw_drawCell */
static void static void
palm_draw_invertCell( DrawCtx* p_dctx, XP_Rect* rect ) palm_draw_invertCell( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
XP_Rect localR = *rect; XP_Rect localR = *rect;
/* insetRect( &localR, 3 ); */ /* insetRect( &localR, 3 ); */
@ -536,7 +539,7 @@ palm_draw_invertCell( DrawCtx* p_dctx, XP_Rect* rect )
} /* palm_draw_invertCell */ } /* palm_draw_invertCell */
static XP_Bool static XP_Bool
palm_clr_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, palm_clr_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect,
XP_U16 owner, XP_Bool hasfocus ) XP_U16 owner, XP_Bool hasfocus )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
@ -555,7 +558,7 @@ palm_clr_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect,
} /* palm_clr_draw_trayBegin */ } /* palm_clr_draw_trayBegin */
static XP_Bool static XP_Bool
palm_bnw_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 owner, palm_bnw_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 owner,
XP_Bool hasfocus ) XP_Bool hasfocus )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
@ -600,8 +603,8 @@ smallBoldStringAt( const char* str, XP_U16 len, XP_S16 x, XP_U16 y )
#endif #endif
static void static void
palm_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect, palm_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect,
XP_UCHAR* letters, XP_Bitmap bitmap, const XP_UCHAR* letters, XP_Bitmap bitmap,
XP_S16 val, XP_Bool highlighted ) XP_S16 val, XP_Bool highlighted )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
@ -674,14 +677,14 @@ palm_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect,
} /* palm_draw_drawTile */ } /* palm_draw_drawTile */
static void static void
palm_draw_drawTileBack( DrawCtx* p_dctx, XP_Rect* rect ) palm_draw_drawTileBack( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
palm_draw_drawTile( p_dctx, rect, (unsigned char*)"?", (XP_Bitmap)NULL, palm_draw_drawTile( p_dctx, rect, (unsigned char*)"?", (XP_Bitmap)NULL,
-1, XP_FALSE ); -1, XP_FALSE );
} /* palm_draw_drawTileBack */ } /* palm_draw_drawTileBack */
static void static void
palm_draw_drawTrayDivider( DrawCtx* p_dctx, 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;
@ -702,13 +705,13 @@ palm_draw_drawTrayDivider( DrawCtx* p_dctx, XP_Rect* rect, XP_Bool selected )
} /* palm_draw_drawTrayDivider */ } /* palm_draw_drawTrayDivider */
static void static void
palm_bnw_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rectP ) palm_bnw_draw_clearRect( DrawCtx* p_dctx, const XP_Rect* rectP )
{ {
eraseRect( rectP ); eraseRect( rectP );
} /* palm_draw_clearRect */ } /* palm_draw_clearRect */
static void static void
palm_clr_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rectP ) palm_clr_draw_clearRect( DrawCtx* p_dctx, const XP_Rect* rectP )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
IndexedColorType oldColor; IndexedColorType oldColor;
@ -719,8 +722,8 @@ palm_clr_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rectP )
} /* palm_clr_draw_clearRect */ } /* palm_clr_draw_clearRect */
static void static void
palm_clr_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text, palm_clr_draw_drawMiniWindow( DrawCtx* p_dctx, const XP_UCHAR* text,
XP_Rect* rect, void** closureP ) const XP_Rect* rect, void** closureP )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
WinSetBackColor( dctx->drawingPrefs->drawColors[COLOR_WHITE] ); WinSetBackColor( dctx->drawingPrefs->drawColors[COLOR_WHITE] );
@ -730,7 +733,7 @@ palm_clr_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text,
} /* palm_clr_draw_drawMiniWindow */ } /* palm_clr_draw_drawMiniWindow */
static void static void
palm_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP, palm_draw_drawBoardArrow( DrawCtx* p_dctx, const XP_Rect* rectP,
XWBonusType cursorBonus, XP_Bool vertical, XWBonusType cursorBonus, XP_Bool vertical,
HintAtts hintAtts ) HintAtts hintAtts )
{ {
@ -750,7 +753,7 @@ palm_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP,
#ifdef COLOR_SUPPORT #ifdef COLOR_SUPPORT
static void static void
palm_clr_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP, palm_clr_draw_drawBoardArrow( DrawCtx* p_dctx, const XP_Rect* rectP,
XWBonusType cursorBonus, XP_Bool vertical, XWBonusType cursorBonus, XP_Bool vertical,
HintAtts hintAtts ) HintAtts hintAtts )
{ {
@ -769,7 +772,7 @@ palm_clr_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP,
#endif #endif
static void static void
palm_draw_scoreBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 numPlayers, palm_draw_scoreBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 numPlayers,
XP_Bool hasfocus ) XP_Bool hasfocus )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
@ -786,7 +789,7 @@ palm_draw_scoreBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 numPlayers,
* willing to link from here out. * willing to link from here out.
*/ */
static XP_Bool static XP_Bool
rectContainsRect( XP_Rect* rect1, XP_Rect* rect2 ) rectContainsRect( const XP_Rect* rect1, const XP_Rect* rect2 )
{ {
return ( rect1->top <= rect2->top return ( rect1->top <= rect2->top
&& rect1->left <= rect2->left && rect1->left <= rect2->left
@ -926,7 +929,7 @@ palmFormatRemText( PalmDrawCtx* dctx, XP_UCHAR* buf, XP_S16 nTilesLeft )
} /* palmFormatRemText */ } /* palmFormatRemText */
static void static void
palm_draw_measureRemText( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 nTilesLeft, palm_draw_measureRemText( DrawCtx* p_dctx, const XP_Rect* rect, XP_S16 nTilesLeft,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
@ -946,8 +949,8 @@ palm_draw_measureRemText( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 nTilesLeft,
} /* palm_draw_measureRemText */ } /* palm_draw_measureRemText */
static void static void
palm_draw_drawRemText( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, palm_draw_drawRemText( DrawCtx* p_dctx, const XP_Rect* rInner,
XP_S16 nTilesLeft ) const XP_Rect* rOuter, XP_S16 nTilesLeft )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
PalmAppGlobals* globals = dctx->globals; PalmAppGlobals* globals = dctx->globals;
@ -957,7 +960,7 @@ palm_draw_drawRemText( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter,
palmFormatRemText( dctx, buf, nTilesLeft ); palmFormatRemText( dctx, buf, nTilesLeft );
palmMeasureDrawText( dctx, rInner, buf, isVertical, XP_FALSE, palmMeasureDrawText( dctx, (XP_Rect*)rInner, buf, isVertical, XP_FALSE,
':', XP_TRUE ); ':', XP_TRUE );
} /* palm_draw_drawRemText */ } /* palm_draw_drawRemText */
@ -965,7 +968,7 @@ palm_draw_drawRemText( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter,
* split into two lines, esp after the number of remaining tiles appears. * split into two lines, esp after the number of remaining tiles appears.
*/ */
static void static void
palmFormatScore( char* buf, DrawScoreInfo* dsi, XP_Bool vertical ) palmFormatScore( char* buf, const DrawScoreInfo* dsi, XP_Bool vertical )
{ {
char borders[] = {'', '\0'}; char borders[] = {'', '\0'};
char remBuf[10]; char remBuf[10];
@ -985,7 +988,8 @@ palmFormatScore( char* buf, DrawScoreInfo* dsi, XP_Bool vertical )
} /* palmFormatScore */ } /* palmFormatScore */
static void static void
palm_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* rect, DrawScoreInfo* dsi, palm_draw_measureScoreText( DrawCtx* p_dctx, const XP_Rect* rect,
const DrawScoreInfo* dsi,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
@ -1016,8 +1020,8 @@ palm_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* rect, DrawScoreInfo* dsi,
} /* palm_draw_measureScoreText */ } /* palm_draw_measureScoreText */
static void static void
palm_bnw_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner, palm_bnw_draw_score_drawPlayer( DrawCtx* p_dctx, const XP_Rect* rInner,
XP_Rect* rOuter, DrawScoreInfo* dsi ) const XP_Rect* rOuter, const DrawScoreInfo* dsi )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
PalmAppGlobals* globals = dctx->globals; PalmAppGlobals* globals = dctx->globals;
@ -1025,7 +1029,7 @@ palm_bnw_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner,
XP_Bool vertical = !globals->gState.showGrid; XP_Bool vertical = !globals->gState.showGrid;
palmFormatScore( (char*)scoreBuf, dsi, vertical ); palmFormatScore( (char*)scoreBuf, dsi, vertical );
palmMeasureDrawText( dctx, rInner, (XP_UCHAR*)scoreBuf, vertical, palmMeasureDrawText( dctx, (XP_Rect*)rInner, (XP_UCHAR*)scoreBuf, vertical,
dsi->isTurn, SCORE_SEP, XP_TRUE ); dsi->isTurn, SCORE_SEP, XP_TRUE );
if ( vertical && dsi->isTurn ) { if ( vertical && dsi->isTurn ) {
@ -1050,8 +1054,8 @@ palm_bnw_draw_score_drawPlayer( DrawCtx* p_dctx, XP_Rect* rInner,
#define PENDING_DIGITS 3 #define PENDING_DIGITS 3
static void static void
palm_draw_score_pendingScore( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 score, palm_draw_score_pendingScore( DrawCtx* p_dctx, const XP_Rect* rect,
XP_U16 playerNum ) XP_S16 score, XP_U16 playerNum )
{ {
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx; PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
char buf[PENDING_DIGITS+1] = "000"; char buf[PENDING_DIGITS+1] = "000";
@ -1138,7 +1142,8 @@ palmFormatTimerText( XP_UCHAR* buf, XP_S16 secondsLeft )
} /* palmFormatTimerText */ } /* palmFormatTimerText */
static void static void
palm_draw_drawTimer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, palm_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rInner,
const XP_Rect* rOuter,
XP_U16 player, XP_S16 secondsLeft ) XP_U16 player, XP_S16 secondsLeft )
{ {
/* This is called both from within drawScoreboard and not, meaning that /* This is called both from within drawScoreboard and not, meaning that
@ -1215,7 +1220,7 @@ palm_draw_getMiniWText( DrawCtx* p_dctx, XWMiniTextType textHint )
} /* palm_draw_getMiniWText */ } /* palm_draw_getMiniWText */
static void static void
splitString( XP_UCHAR* str, XP_U16* nBufsP, XP_UCHAR** bufs ) splitString( const XP_UCHAR* str, XP_U16* nBufsP, XP_UCHAR** bufs )
{ {
XP_U16 nBufs = 0; XP_U16 nBufs = 0;
@ -1253,7 +1258,7 @@ getMiniLineHt( PalmDrawCtx* dctx )
} /* getMiniLineHt */ } /* getMiniLineHt */
static void static void
palm_draw_measureMiniWText( DrawCtx* p_dctx, unsigned char* str, palm_draw_measureMiniWText( DrawCtx* p_dctx, const XP_UCHAR* str,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
XP_U16 maxWidth, height; XP_U16 maxWidth, height;
@ -1288,8 +1293,8 @@ typedef struct PalmMiniWinData {
} PalmMiniWinData; } PalmMiniWinData;
static void static void
palm_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text, palm_draw_drawMiniWindow( DrawCtx* p_dctx, const XP_UCHAR* text,
XP_Rect* rect, void** closureP ) const XP_Rect* rect, void** closureP )
{ {
RectangleType localR = *(RectangleType*)rect; RectangleType localR = *(RectangleType*)rect;
XP_UCHAR buf1[48]; XP_UCHAR buf1[48];
@ -1345,7 +1350,8 @@ palm_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text,
} /* palm_draw_drawMiniWindow */ } /* palm_draw_drawMiniWindow */
static void static void
palm_draw_eraseMiniWindow( DrawCtx* p_dctx, XP_Rect* rect, XP_Bool lastTime, palm_draw_eraseMiniWindow( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool lastTime,
void** closure, XP_Bool* invalUnder ) void** closure, XP_Bool* invalUnder )
{ {
PalmMiniWinData* data = (PalmMiniWinData*)*closure; PalmMiniWinData* data = (PalmMiniWinData*)*closure;

View file

@ -33,12 +33,12 @@
#include "cedefines.h" #include "cedefines.h"
#include "debhacks.h" #include "debhacks.h"
static void ceClearToBkground( CEDrawCtx* dctx, XP_Rect* rect ); static void ceClearToBkground( CEDrawCtx* dctx, const XP_Rect* rect );
static void ceDrawBitmapInRect( HDC hdc, const RECT* r, HBITMAP bitmap ); static void ceDrawBitmapInRect( HDC hdc, const RECT* r, HBITMAP bitmap );
static void static void
XPRtoRECT( RECT* rt, XP_Rect* xprect ) XPRtoRECT( RECT* rt, const XP_Rect* xprect )
{ {
rt->left = xprect->left; rt->left = xprect->left;
rt->top = xprect->top; rt->top = xprect->top;
@ -95,8 +95,8 @@ makeAndDrawBitmap( CEDrawCtx* dctx, HDC hdc, XP_U32 x, XP_U32 y,
} /* makeAndDrawBitmap */ } /* makeAndDrawBitmap */
static XP_Bool static XP_Bool
ce_draw_boardBegin( DrawCtx* p_dctx, DictionaryCtxt* dict, XP_Rect* rect, ce_draw_boardBegin( DrawCtx* p_dctx, const DictionaryCtxt* dict,
XP_Bool hasfocus ) const XP_Rect* rect, XP_Bool hasfocus )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
CEAppGlobals* globals = dctx->globals; CEAppGlobals* globals = dctx->globals;
@ -141,7 +141,7 @@ ceDrawLine( HDC hdc, XP_S32 x1, XP_S32 y1, XP_S32 x2, XP_S32 y2 )
} /* ceDrawLine */ } /* ceDrawLine */
static void static void
ceDrawHintBorders( HDC hdc, XP_Rect* xprect, HintAtts hintAtts ) ceDrawHintBorders( HDC hdc, const XP_Rect* xprect, HintAtts hintAtts )
{ {
if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) { if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) {
RECT rt; RECT rt;
@ -164,8 +164,8 @@ ceDrawHintBorders( HDC hdc, XP_Rect* xprect, HintAtts hintAtts )
} /* ceDrawHintBorders */ } /* ceDrawHintBorders */
static XP_Bool static XP_Bool
ce_draw_drawCell( DrawCtx* p_dctx, XP_Rect* xprect, ce_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* xprect,
XP_UCHAR* letters, XP_Bitmap bitmap, const XP_UCHAR* letters, XP_Bitmap bitmap,
XP_S16 owner, XWBonusType bonus, HintAtts hintAtts, XP_S16 owner, XWBonusType bonus, HintAtts hintAtts,
XP_Bool isBlank, XP_Bool isPending, XP_Bool isStar ) XP_Bool isBlank, XP_Bool isPending, XP_Bool isStar )
{ {
@ -175,7 +175,7 @@ ce_draw_drawCell( DrawCtx* p_dctx, XP_Rect* xprect,
RECT rt; RECT rt;
RECT textRect; RECT textRect;
XP_U16 bkIndex; XP_U16 bkIndex;
XP_UCHAR* cp = NULL; const XP_UCHAR* cp = NULL;
COLORREF foreColorRef; COLORREF foreColorRef;
XP_ASSERT( !!hdc ); XP_ASSERT( !!hdc );
@ -259,7 +259,7 @@ ce_draw_drawCell( DrawCtx* p_dctx, XP_Rect* xprect,
} /* ce_draw_drawCell */ } /* ce_draw_drawCell */
static void static void
ce_draw_invertCell( DrawCtx* p_dctx, XP_Rect* rect ) ce_draw_invertCell( DrawCtx* p_dctx, const XP_Rect* rect )
{ {
} /* ce_draw_invertCell */ } /* ce_draw_invertCell */
@ -280,7 +280,7 @@ logClipResult( int icrResult )
#endif #endif
static XP_Bool static XP_Bool
ce_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 owner, ce_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 owner,
XP_Bool hasfocus ) XP_Bool hasfocus )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
@ -300,7 +300,8 @@ ce_draw_trayFinished( DrawCtx* p_dctx )
} /* ce_draw_trayFinished */ } /* ce_draw_trayFinished */
static void static void
drawDrawTileGuts( DrawCtx* p_dctx, XP_Rect* xprect, XP_UCHAR* letters, drawDrawTileGuts( DrawCtx* p_dctx, const XP_Rect* xprect,
const XP_UCHAR* letters,
XP_Bitmap bitmap, XP_S16 val, XP_Bool highlighted ) XP_Bitmap bitmap, XP_S16 val, XP_Bool highlighted )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
@ -351,20 +352,22 @@ drawDrawTileGuts( DrawCtx* p_dctx, XP_Rect* xprect, XP_UCHAR* letters,
} /* drawDrawTileGuts */ } /* drawDrawTileGuts */
static void static void
ce_draw_drawTile( DrawCtx* p_dctx, XP_Rect* xprect, XP_UCHAR* letters, ce_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* xprect,
XP_Bitmap bitmap, XP_S16 val, XP_Bool highlighted ) const XP_UCHAR* letters, XP_Bitmap bitmap,
XP_S16 val, XP_Bool highlighted )
{ {
drawDrawTileGuts( p_dctx, xprect, letters, bitmap, val, highlighted ); drawDrawTileGuts( p_dctx, xprect, letters, bitmap, val, highlighted );
} /* ce_draw_drawTile */ } /* ce_draw_drawTile */
static void static void
ce_draw_drawTileBack( DrawCtx* p_dctx, XP_Rect* xprect ) ce_draw_drawTileBack( DrawCtx* p_dctx, const XP_Rect* xprect )
{ {
drawDrawTileGuts( p_dctx, xprect, "?", NULL, -1, XP_FALSE ); drawDrawTileGuts( p_dctx, xprect, "?", NULL, -1, XP_FALSE );
} /* ce_draw_drawTileBack */ } /* ce_draw_drawTileBack */
static void static void
ce_draw_drawTrayDivider( DrawCtx* p_dctx, XP_Rect* rect, XP_Bool selected ) ce_draw_drawTrayDivider( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool selected )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
CEAppGlobals* globals = dctx->globals; CEAppGlobals* globals = dctx->globals;
@ -380,7 +383,7 @@ ce_draw_drawTrayDivider( DrawCtx* p_dctx, XP_Rect* rect, XP_Bool selected )
} /* ce_draw_drawTrayDivider */ } /* ce_draw_drawTrayDivider */
static void static void
ceClearToBkground( CEDrawCtx* dctx, XP_Rect* rect ) ceClearToBkground( CEDrawCtx* dctx, const XP_Rect* rect )
{ {
CEAppGlobals* globals = dctx->globals; CEAppGlobals* globals = dctx->globals;
HDC hdc = globals->hdc; HDC hdc = globals->hdc;
@ -392,7 +395,7 @@ ceClearToBkground( CEDrawCtx* dctx, XP_Rect* rect )
} /* ceClearToBkground */ } /* ceClearToBkground */
static void static void
ce_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rectP ) ce_draw_clearRect( DrawCtx* p_dctx, const XP_Rect* rectP )
{ {
ceClearToBkground( (CEDrawCtx*)p_dctx, rectP ); ceClearToBkground( (CEDrawCtx*)p_dctx, rectP );
} /* ce_draw_clearRect */ } /* ce_draw_clearRect */
@ -427,7 +430,7 @@ ceDrawBitmapInRect( HDC hdc, const RECT* rect, HBITMAP bitmap )
} /* ceDrawBitmapInRect */ } /* ceDrawBitmapInRect */
static void static void
ce_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* xprect, ce_draw_drawBoardArrow( DrawCtx* p_dctx, const XP_Rect* xprect,
XWBonusType cursorBonus, XP_Bool vertical, XWBonusType cursorBonus, XP_Bool vertical,
HintAtts hintAtts ) HintAtts hintAtts )
{ {
@ -466,7 +469,7 @@ ce_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* xprect,
} /* ce_draw_drawBoardArrow */ } /* ce_draw_drawBoardArrow */
static void static void
ce_draw_scoreBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_U16 numPlayers, ce_draw_scoreBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 numPlayers,
XP_Bool hasfocus ) XP_Bool hasfocus )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
@ -492,7 +495,7 @@ formatRemText( HDC hdc, wchar_t* buf, XP_S16 nTilesLeft, SIZE* size )
} /* formatRemText */ } /* formatRemText */
static void static void
ce_draw_measureRemText( DrawCtx* p_dctx, XP_Rect* r, ce_draw_measureRemText( DrawCtx* p_dctx, const XP_Rect* r,
XP_S16 nTilesLeft, XP_S16 nTilesLeft,
XP_U16* width, XP_U16* height ) XP_U16* width, XP_U16* height )
{ {
@ -509,8 +512,8 @@ ce_draw_measureRemText( DrawCtx* p_dctx, XP_Rect* r,
} /* ce_draw_measureRemText */ } /* ce_draw_measureRemText */
static void static void
ce_draw_drawRemText( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, ce_draw_drawRemText( DrawCtx* p_dctx, const XP_Rect* rInner,
XP_S16 nTilesLeft ) const XP_Rect* rOuter, XP_S16 nTilesLeft )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
CEAppGlobals* globals = dctx->globals; CEAppGlobals* globals = dctx->globals;
@ -527,7 +530,7 @@ ce_draw_drawRemText( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter,
} /* ce_draw_drawRemText */ } /* ce_draw_drawRemText */
static void static void
ceWidthAndText( HDC hdc, wchar_t* buf, DrawScoreInfo* dsi, ceWidthAndText( HDC hdc, wchar_t* buf, const DrawScoreInfo* dsi,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
XP_UCHAR borders[] = {'', '\0'}; XP_UCHAR borders[] = {'', '\0'};
@ -556,8 +559,8 @@ ceWidthAndText( HDC hdc, wchar_t* buf, DrawScoreInfo* dsi,
} /* ceWidthAndText */ } /* ceWidthAndText */
static void static void
ce_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* r, ce_draw_measureScoreText( DrawCtx* p_dctx, const XP_Rect* r,
DrawScoreInfo* dsi, const DrawScoreInfo* dsi,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
@ -581,8 +584,8 @@ ce_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* r,
static void static void
ce_draw_score_drawPlayer( DrawCtx* p_dctx, ce_draw_score_drawPlayer( DrawCtx* p_dctx,
XP_Rect* rInner, XP_Rect* rOuter, const XP_Rect* rInner, const XP_Rect* rOuter,
DrawScoreInfo* dsi ) const DrawScoreInfo* dsi )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
CEAppGlobals* globals = dctx->globals; CEAppGlobals* globals = dctx->globals;
@ -612,8 +615,8 @@ ce_draw_score_drawPlayer( DrawCtx* p_dctx,
} /* ce_draw_score_drawPlayer */ } /* ce_draw_score_drawPlayer */
static void static void
ce_draw_score_pendingScore( DrawCtx* p_dctx, XP_Rect* rect, XP_S16 score, ce_draw_score_pendingScore( DrawCtx* p_dctx, const XP_Rect* rect,
XP_U16 playerNum ) XP_S16 score, XP_U16 playerNum )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
CEAppGlobals* globals = dctx->globals; CEAppGlobals* globals = dctx->globals;
@ -651,7 +654,8 @@ ce_draw_scoreFinished( DrawCtx* p_dctx )
} /* ce_draw_scoreFinished */ } /* ce_draw_scoreFinished */
static void static void
ce_draw_drawTimer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, ce_draw_drawTimer( DrawCtx* p_dctx,
const XP_Rect* rInner, const XP_Rect* rOuter,
XP_U16 player, XP_S16 secondsLeft ) XP_U16 player, XP_S16 secondsLeft )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
@ -716,7 +720,7 @@ ce_draw_getMiniWText( DrawCtx* p_dctx, XWMiniTextType whichText )
#define CE_INTERLINE_SPACE 0 #define CE_INTERLINE_SPACE 0
static void static void
ce_draw_measureMiniWText( DrawCtx* p_dctx, XP_UCHAR* str, ce_draw_measureMiniWText( DrawCtx* p_dctx, const XP_UCHAR* str,
XP_U16* widthP, XP_U16* heightP ) XP_U16* widthP, XP_U16* heightP )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
@ -753,8 +757,8 @@ ce_draw_measureMiniWText( DrawCtx* p_dctx, XP_UCHAR* str,
} /* ce_draw_measureMiniWText */ } /* ce_draw_measureMiniWText */
static void static void
ce_draw_drawMiniWindow( DrawCtx* p_dctx, XP_UCHAR* text, XP_Rect* rect, ce_draw_drawMiniWindow( DrawCtx* p_dctx, const XP_UCHAR* text,
void** closureP ) const XP_Rect* rect, void** closureP )
{ {
CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEDrawCtx* dctx = (CEDrawCtx*)p_dctx;
CEAppGlobals* globals = dctx->globals; CEAppGlobals* globals = dctx->globals;
@ -816,7 +820,7 @@ ce_draw_drawMiniWindow( DrawCtx* p_dctx, XP_UCHAR* text, XP_Rect* rect,
} /* ce_draw_drawMiniWindow */ } /* ce_draw_drawMiniWindow */
static void static void
ce_draw_eraseMiniWindow( DrawCtx* p_dctx, XP_Rect* rect, XP_Bool lastTime, ce_draw_eraseMiniWindow( DrawCtx* p_dctx, const XP_Rect* rect, XP_Bool lastTime,
void** closure, XP_Bool* invalUnder ) void** closure, XP_Bool* invalUnder )
{ {
*invalUnder = XP_TRUE; *invalUnder = XP_TRUE;