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. */
typedef struct MiniWindowStuff {
void* closure;
unsigned char* text;
XP_UCHAR* text;
XP_Rect rect;
} MiniWindowStuff;

View file

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

View file

@ -125,13 +125,13 @@ struct DictionaryCtxt {
XP_Bool dict_tilesAreSame( DictionaryCtxt* dict1, DictionaryCtxt* dict2 );
XP_Bool dict_hasBlankTile( DictionaryCtxt* dict );
Tile dict_getBlankTile( DictionaryCtxt* dict );
XP_U16 dict_getTileValue( DictionaryCtxt* ctxt, Tile tile );
XP_U16 dict_numTiles( DictionaryCtxt* ctxt, Tile tile );
XP_U16 dict_numTileFaces( DictionaryCtxt* ctxt );
XP_Bool dict_hasBlankTile( const DictionaryCtxt* dict );
Tile dict_getBlankTile( const DictionaryCtxt* dict );
XP_U16 dict_getTileValue( const DictionaryCtxt* ctxt, Tile tile );
XP_U16 dict_numTiles( const DictionaryCtxt* ctxt, Tile tile );
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* dict_getName( DictionaryCtxt* ctxt );
@ -142,7 +142,7 @@ XP_Bitmap dict_getFaceBitmap( DictionaryCtxt* dict, Tile tile,
XP_Bool isLarge );
#ifdef TALL_FONTS
XP_LangCode dict_getLangCode( DictionaryCtxt* dict );
XP_LangCode dict_getLangCode( const DictionaryCtxt* dict );
#endif
void dict_writeToStream( DictionaryCtxt* ctxt, XWStreamCtxt* stream );

View file

@ -55,57 +55,59 @@ typedef XP_UCHAR HintAtts;
typedef struct DrawCtxVTable {
#ifdef DRAW_WITH_PRIMITIVES
void (*m_draw_setClip)( DrawCtx* dctx, XP_Rect* newClip,
XP_Rect* oldClip );
void (*m_draw_frameRect)( DrawCtx* dctx, XP_Rect* rect );
void (*m_draw_invertRect)( DrawCtx* dctx, XP_Rect* rect );
void (*m_draw_drawString)( DrawCtx* dctx, XP_UCHAR* str,
void (*m_draw_setClip)( DrawCtx* dctx, const XP_Rect* newClip,
const XP_Rect* oldClip );
void (*m_draw_frameRect)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_invertRect)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_drawString)( DrawCtx* dctx, const XP_UCHAR* str,
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 );
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 );
#endif
void (*m_draw_destroyCtxt)( DrawCtx* dctx );
XP_Bool (*m_draw_boardBegin)( DrawCtx* dctx, DictionaryCtxt* dict,
XP_Rect* rect, XP_Bool hasfocus );
XP_Bool (*m_draw_boardBegin)( DrawCtx* dctx, const DictionaryCtxt* dict,
const XP_Rect* rect, XP_Bool hasfocus );
void (*m_draw_boardFinished)( DrawCtx* dctx );
/* rect is not const: set by callee */
XP_Bool (*m_draw_vertScrollBoard)(DrawCtx* dctx, XP_Rect* rect,
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 );
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_U16* width, XP_U16* height );
void (*m_draw_drawRemText)(DrawCtx* dctx, XP_Rect* rInner,
XP_Rect* rOuter, XP_S16 nTilesLeft);
void (*m_draw_drawRemText)(DrawCtx* dctx, const XP_Rect* rInner,
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 );
void (*m_draw_measureScoreText)( DrawCtx* dctx, XP_Rect* r,
DrawScoreInfo* dsi,
void (*m_draw_measureScoreText)( DrawCtx* dctx, const XP_Rect* r,
const DrawScoreInfo* dsi,
XP_U16* width, XP_U16* height );
void (*m_draw_score_drawPlayer)( DrawCtx* dctx,
XP_Rect* rInner, XP_Rect* rOuter,
DrawScoreInfo* dsi );
const XP_Rect* rInner, const XP_Rect* rOuter,
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 );
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_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 */
XP_UCHAR* text, XP_Bitmap bitmap,
const XP_UCHAR* text, const XP_Bitmap bitmap,
#ifdef TALL_FONTS
Tile tile,
#endif
@ -114,33 +116,33 @@ typedef struct DrawCtxVTable {
XP_Bool isBlank, XP_Bool highlight,
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*/
XP_UCHAR* text, XP_Bitmap bitmap,
const XP_UCHAR* text, const XP_Bitmap bitmap,
XP_S16 val, XP_Bool highlighted );
void (*m_draw_drawTileBack)( DrawCtx* dctx, XP_Rect* rect );
void (*m_draw_drawTrayDivider)( DrawCtx* dctx, XP_Rect* rect,
void (*m_draw_drawTileBack)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_drawTrayDivider)( DrawCtx* dctx, const XP_Rect* rect,
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,
HintAtts hintAtts );
#ifdef KEY_SUPPORT
void (*m_draw_drawTrayCursor)( DrawCtx* dctx, XP_Rect* rect );
void (*m_draw_drawBoardCursor)( DrawCtx* dctx, XP_Rect* rect );
void (*m_draw_drawTrayCursor)( DrawCtx* dctx, const XP_Rect* rect );
void (*m_draw_drawBoardCursor)( DrawCtx* dctx, const XP_Rect* rect );
#endif
XP_UCHAR* (*m_draw_getMiniWText)( DrawCtx* dctx,
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 );
void (*m_draw_drawMiniWindow)( DrawCtx* dctx, XP_UCHAR* text,
XP_Rect* rect, void** closure );
void (*m_draw_eraseMiniWindow)( DrawCtx* dctx, XP_Rect* rect,
void (*m_draw_drawMiniWindow)( DrawCtx* dctx, const XP_UCHAR* text,
const XP_Rect* rect, void** closure );
void (*m_draw_eraseMiniWindow)( DrawCtx* dctx, const XP_Rect* rect,
XP_Bool lastTime, void** closure,
XP_Bool* invalUnder );

View file

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

View file

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

View file

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

View file

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