mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-06 05:24:46 +01:00
add HintAtts param to draw_drawBoardArrow; in tiles, draw letter after
number so on those OS versions where winOverlay flag is ignored what's erased will be part of the value rather than of the letter; use nativeFormat in offscreenWindow so highres will work.
This commit is contained in:
parent
e363cddf6a
commit
4d1473d2fc
1 changed files with 68 additions and 74 deletions
142
palm/palmdraw.c
142
palm/palmdraw.c
|
@ -26,8 +26,8 @@
|
||||||
#include "xwords4defines.h"
|
#include "xwords4defines.h"
|
||||||
#include "LocalizedStrIncludes.h"
|
#include "LocalizedStrIncludes.h"
|
||||||
|
|
||||||
#define NUMRECT_WIDTH 10
|
#define CHARRECT_WIDTH 12
|
||||||
#define NUMRECT_HEIGHT 10
|
#define CHARRECT_HEIGHT 14
|
||||||
|
|
||||||
#define FONT_HEIGHT 8
|
#define FONT_HEIGHT 8
|
||||||
#define LINE_SPACING 1
|
#define LINE_SPACING 1
|
||||||
|
@ -229,28 +229,29 @@ palm_clr_draw_score_drawPlayer( DrawCtx* p_dctx, XP_S16 playerNum,
|
||||||
static void
|
static void
|
||||||
palmDrawHintBorders( XP_Rect* rect, HintAtts hintAtts )
|
palmDrawHintBorders( XP_Rect* rect, HintAtts hintAtts )
|
||||||
{
|
{
|
||||||
XP_Rect frame = *rect;
|
if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) {
|
||||||
--frame.width;
|
XP_Rect frame = *rect;
|
||||||
--frame.height;
|
insetRect( &frame, 1 );
|
||||||
|
|
||||||
if ( (hintAtts & HINT_BORDER_LEFT) != 0 ) {
|
if ( (hintAtts & HINT_BORDER_LEFT) != 0 ) {
|
||||||
WinDrawLine( frame.left, frame.top,
|
WinDrawLine( frame.left, frame.top,
|
||||||
frame.left, frame.top + frame.height );
|
frame.left, frame.top + frame.height );
|
||||||
}
|
}
|
||||||
if ( (hintAtts & HINT_BORDER_TOP) != 0 ) {
|
if ( (hintAtts & HINT_BORDER_TOP) != 0 ) {
|
||||||
WinDrawLine( frame.left, frame.top,
|
WinDrawLine( frame.left, frame.top,
|
||||||
frame.left + frame.width, frame.top );
|
frame.left + frame.width, frame.top );
|
||||||
}
|
}
|
||||||
if ( (hintAtts & HINT_BORDER_RIGHT) != 0 ) {
|
if ( (hintAtts & HINT_BORDER_RIGHT) != 0 ) {
|
||||||
WinDrawLine( frame.left + frame.width, frame.top,
|
WinDrawLine( frame.left + frame.width, frame.top,
|
||||||
frame.left + frame.width,
|
frame.left + frame.width,
|
||||||
frame.top + frame.height );
|
frame.top + frame.height );
|
||||||
|
|
||||||
}
|
}
|
||||||
if ( (hintAtts & HINT_BORDER_BOTTOM) != 0 ) {
|
if ( (hintAtts & HINT_BORDER_BOTTOM) != 0 ) {
|
||||||
WinDrawLine( frame.left, frame.top + frame.height,
|
WinDrawLine( frame.left, frame.top + frame.height,
|
||||||
frame.left + frame.width,
|
frame.left + frame.width,
|
||||||
frame.top + frame.height );
|
frame.top + frame.height );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} /* palmDrawHintBorders */
|
} /* palmDrawHintBorders */
|
||||||
|
|
||||||
|
@ -383,9 +384,7 @@ palm_common_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect,
|
||||||
WinEraseRectangleFrame( roundFrame, (RectangleType*)&localR );
|
WinEraseRectangleFrame( roundFrame, (RectangleType*)&localR );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) {
|
palmDrawHintBorders( rect, hintAtts );
|
||||||
palmDrawHintBorders( &localR, hintAtts );
|
|
||||||
}
|
|
||||||
|
|
||||||
WinSetClip( &saveClip );
|
WinSetClip( &saveClip );
|
||||||
return complete;
|
return complete;
|
||||||
|
@ -497,24 +496,9 @@ palm_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect,
|
||||||
/* this will fill it with the tile background color */
|
/* this will fill it with the tile background color */
|
||||||
WinEraseRectangle( (const RectangleType*)&localR, 0 );
|
WinEraseRectangle( (const RectangleType*)&localR, 0 );
|
||||||
|
|
||||||
if ( !!letters ) {
|
/* Draw the number before the letter. Some PalmOS version don't honor
|
||||||
if ( *letters != LETTER_NONE ) { /* blank */
|
the winOverlay flag and erase. Better to erase the value than the
|
||||||
FontID curFont = FntGetFont();
|
letter. */
|
||||||
FntSetFont( largeFont );
|
|
||||||
#ifdef TILE_SUBSCRIPT
|
|
||||||
WinDrawChars( (const char*)letters, 1,
|
|
||||||
localR.left+(2*doubler),
|
|
||||||
rect->top+(2*doubler) );
|
|
||||||
#else
|
|
||||||
WinDrawChars( letters, 1, localR.left+2, rect->top+7 );
|
|
||||||
#endif
|
|
||||||
FntSetFont( curFont );
|
|
||||||
}
|
|
||||||
} else if ( !!bitmap ) {
|
|
||||||
WinDrawBitmap( (BitmapPtr)bitmap, localR.left+(2*doubler),
|
|
||||||
localR.top+(2*doubler) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( val >= 0 ) {
|
if ( val >= 0 ) {
|
||||||
(void)StrPrintF( valBuf, "%d", val );
|
(void)StrPrintF( valBuf, "%d", val );
|
||||||
len = XP_STRLEN((const char*)valBuf);
|
len = XP_STRLEN((const char*)valBuf);
|
||||||
|
@ -527,39 +511,46 @@ palm_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect,
|
||||||
localR.top + localR.height - dctx->fntHeight - 1 );
|
localR.top + localR.height - dctx->fntHeight - 1 );
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
width = FntCharsWidth( valBuf, len );
|
||||||
|
WinDrawChars( valBuf, len, localR.left + localR.width - width,
|
||||||
|
localR.top + localR.height - dctx->fntHeight - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RectangleType numRect = {{0,0},
|
if ( !!letters ) {
|
||||||
{NUMRECT_WIDTH*2, NUMRECT_HEIGHT*2}};
|
if ( *letters != LETTER_NONE ) { /* blank */
|
||||||
|
RectangleType charRect = {{0,0},
|
||||||
|
{CHARRECT_WIDTH*2, CHARRECT_HEIGHT*2}};
|
||||||
|
FontID curFont = FntGetFont();
|
||||||
WinHandle curWind;
|
WinHandle curWind;
|
||||||
WinHandle numberWin = dctx->numberWin;
|
WinHandle offScreenCharWin = dctx->offScreenCharWin;
|
||||||
|
FntSetFont( largeFont );
|
||||||
|
|
||||||
XP_ASSERT( !!numberWin );
|
XP_ASSERT( !!offScreenCharWin );
|
||||||
curWind = WinSetDrawWindow( numberWin );
|
curWind = WinSetDrawWindow( offScreenCharWin );
|
||||||
HIGHRES_PUSH_LOC( dctx );
|
HIGHRES_PUSH_LOC( dctx );
|
||||||
|
|
||||||
WinEraseRectangle( &numRect, 0 );
|
WinEraseRectangle( &charRect, 0 );
|
||||||
|
|
||||||
WinDrawChars( valBuf, len, 0, 0 );
|
WinDrawChars( (char*)letters, 1, 0, 0 );
|
||||||
width = FntCharsWidth( valBuf, len );
|
width = FntCharsWidth( letters, 1 );
|
||||||
|
|
||||||
(void)WinSetDrawWindow( curWind );
|
(void)WinSetDrawWindow( curWind );
|
||||||
|
|
||||||
HIGHRES_POP_LOC(dctx);
|
HIGHRES_POP_LOC(dctx);
|
||||||
|
|
||||||
numRect.extent.x = width;
|
charRect.extent.x = width;
|
||||||
|
|
||||||
#ifdef TILE_SUBSCRIPT
|
WinCopyRectangle( offScreenCharWin, 0, &charRect,
|
||||||
WinCopyRectangle( numberWin, 0, &numRect,
|
localR.left + (1*doubler),
|
||||||
localR.left + localR.width - (width*doubler),
|
localR.top + (0*doubler),
|
||||||
localR.top + localR.height - (10*doubler),
|
|
||||||
winOverlay );
|
winOverlay );
|
||||||
#else
|
|
||||||
WinCopyRectangle( numberWin, 0, &numRect,
|
FntSetFont( curFont );
|
||||||
localR.left + localR.width - width,
|
|
||||||
localR.top,
|
|
||||||
winOverlay );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
} else if ( !!bitmap ) {
|
||||||
|
WinDrawBitmap( (BitmapPtr)bitmap, localR.left+(2*doubler),
|
||||||
|
localR.top+(2*doubler) );
|
||||||
}
|
}
|
||||||
|
|
||||||
WinDrawRectangleFrame( rectangleFrame, (RectangleType*)&localR );
|
WinDrawRectangleFrame( rectangleFrame, (RectangleType*)&localR );
|
||||||
|
@ -627,7 +618,8 @@ palm_clr_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
palm_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP,
|
palm_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP,
|
||||||
XWBonusType cursorBonus, XP_Bool vertical )
|
XWBonusType cursorBonus, XP_Bool vertical,
|
||||||
|
HintAtts hintAtts )
|
||||||
{
|
{
|
||||||
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
|
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
|
||||||
RectangleType oldClip;
|
RectangleType oldClip;
|
||||||
|
@ -638,6 +630,7 @@ palm_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP,
|
||||||
WinSetClip( (RectangleType*)rectP );
|
WinSetClip( (RectangleType*)rectP );
|
||||||
|
|
||||||
bitmapInRect( dctx, resID, rectP );
|
bitmapInRect( dctx, resID, rectP );
|
||||||
|
palmDrawHintBorders( rectP, hintAtts );
|
||||||
|
|
||||||
WinSetClip( &oldClip );
|
WinSetClip( &oldClip );
|
||||||
} /* palm_draw_drawBoardArrow */
|
} /* palm_draw_drawBoardArrow */
|
||||||
|
@ -645,7 +638,8 @@ 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, XP_Rect* rectP,
|
||||||
XWBonusType cursorBonus, XP_Bool vertical )
|
XWBonusType cursorBonus, XP_Bool vertical,
|
||||||
|
HintAtts hintAtts )
|
||||||
{
|
{
|
||||||
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
|
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
|
||||||
XP_U16 index;
|
XP_U16 index;
|
||||||
|
@ -657,7 +651,7 @@ palm_clr_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rectP,
|
||||||
}
|
}
|
||||||
|
|
||||||
WinSetBackColor( dctx->drawingPrefs->drawColors[index] );
|
WinSetBackColor( dctx->drawingPrefs->drawColors[index] );
|
||||||
palm_draw_drawBoardArrow( p_dctx, rectP, cursorBonus, vertical );
|
palm_draw_drawBoardArrow( p_dctx, rectP, cursorBonus, vertical, hintAtts );
|
||||||
} /* palm_clr_draw_drawBoardArrow */
|
} /* palm_clr_draw_drawBoardArrow */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1244,7 +1238,7 @@ palm_drawctxt_make( MPFORMAL GraphicsAbility able,
|
||||||
{
|
{
|
||||||
PalmDrawCtx* dctx;
|
PalmDrawCtx* dctx;
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
XP_U16 nWinWidth, nWinHeight;
|
XP_U16 cWinWidth, cWinHeight;
|
||||||
Err ignore;
|
Err ignore;
|
||||||
|
|
||||||
dctx = XP_MALLOC( mpool, sizeof(PalmDrawCtx) );
|
dctx = XP_MALLOC( mpool, sizeof(PalmDrawCtx) );
|
||||||
|
@ -1319,16 +1313,16 @@ palm_drawctxt_make( MPFORMAL GraphicsAbility able,
|
||||||
SET_VTABLE_ENTRY( dctx->vtable, draw_clearRect, palm_bnw );
|
SET_VTABLE_ENTRY( dctx->vtable, draw_clearRect, palm_bnw );
|
||||||
}
|
}
|
||||||
|
|
||||||
nWinWidth = NUMRECT_WIDTH;
|
cWinWidth = CHARRECT_WIDTH;
|
||||||
nWinHeight = NUMRECT_HEIGHT;
|
cWinHeight = CHARRECT_HEIGHT;
|
||||||
#ifdef FEATURE_HIGHRES
|
#ifdef FEATURE_HIGHRES
|
||||||
if ( dctx->doHiRes ) {
|
if ( dctx->doHiRes ) {
|
||||||
nWinWidth *= 2;
|
cWinWidth *= 2;
|
||||||
nWinHeight *= 2;
|
cWinHeight *= 2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
dctx->numberWin = WinCreateOffscreenWindow( nWinWidth, nWinHeight,
|
dctx->offScreenCharWin = WinCreateOffscreenWindow( cWinWidth, cWinHeight,
|
||||||
screenFormat, &ignore );
|
nativeFormat, &ignore );
|
||||||
|
|
||||||
if ( able == COLOR ) {
|
if ( able == COLOR ) {
|
||||||
} else {
|
} else {
|
||||||
|
@ -1350,8 +1344,8 @@ palm_drawctxt_destroy( DrawCtx* p_dctx )
|
||||||
{
|
{
|
||||||
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
|
PalmDrawCtx* dctx = (PalmDrawCtx*)p_dctx;
|
||||||
|
|
||||||
XP_ASSERT( !!dctx->numberWin );
|
XP_ASSERT( !!dctx->offScreenCharWin );
|
||||||
WinDeleteWindow( dctx->numberWin, false );
|
WinDeleteWindow( dctx->offScreenCharWin, false );
|
||||||
|
|
||||||
XP_FREE( dctx->mpool, p_dctx->vtable );
|
XP_FREE( dctx->mpool, p_dctx->vtable );
|
||||||
XP_FREE( dctx->mpool, dctx );
|
XP_FREE( dctx->mpool, dctx );
|
||||||
|
|
Loading…
Reference in a new issue