Draw focus differently in tray if whole thing has it, to include borders

between the tiles.
This commit is contained in:
ehouse 2006-11-17 13:46:06 +00:00
parent 74ccc0ed34
commit b23d51fba4
3 changed files with 24 additions and 10 deletions

View file

@ -615,6 +615,7 @@ palm_bnw_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect,
WinGetClip( &dctx->oldTrayClip );
WinSetClip( (RectangleType*)rect );
dctx->topFocus = dfs == DFS_TOP;
return XP_TRUE;
} /* palm_bnw_draw_trayBegin */
@ -647,27 +648,33 @@ palm_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect,
XP_U16 len, width;
XP_U16 doubler = 1;
const XP_Bool cursor = (flags & CELL_ISCURSOR) != 0;
IndexedColorType oclr = 0;
XP_Bool empty = (flags & CELL_ISEMPTY) != 0;
WinPushDrawState();
if ( dctx->doHiRes ) {
doubler = 2;
}
draw_clearRect( p_dctx, &localR );
if ( dctx->topFocus || cursor ) {
(void)WinSetBackColor( dctx->drawingPrefs->drawColors[COLOR_CURSOR] );
if ( dctx->topFocus ) {
WinEraseRectangle( (const RectangleType*)&localR, 0 );
}
}
localR.height -= 3 * doubler;
localR.top += 2 * doubler;
localR.width -= 3 * doubler;
localR.left += 2 * doubler;
if ( cursor ) {
oclr = WinSetBackColor( dctx->drawingPrefs->drawColors[COLOR_CURSOR] );
if ( cursor && !dctx->topFocus ) {
/* this will fill it with the tile background color */
WinEraseRectangle( (const RectangleType*)&localR, 0 );
}
localR.width -= 3 * doubler;
localR.left += 2 * doubler;
/* this will fill it with the tile background color */
if ( !empty && !cursor ) {
WinEraseRectangle( (const RectangleType*)&localR, 0 );
@ -723,10 +730,7 @@ palm_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* rect,
}
}
}
if ( cursor ) {
WinSetBackColor( oclr );
}
WinPopDrawState();
} /* palm_draw_drawTile */
static void

View file

@ -2570,6 +2570,15 @@ mainViewHandleEvent( EventPtr event )
}
if ( xpkey != XP_KEY_NONE ) {
draw = board_handleKey( globals->game.board, xpkey, &handled );
/* If handled comes back false yet something changed (draw),
we'll be getting another event shortly. Put the draw off
until then so we don't flash the tray focussed then not. This
is a hack, but I can't think of a way to integrate it into
board.c logic without making too many palm-centric assumptions
there. */
if ( draw && !handled ) {
draw = XP_FALSE;
}
} else {
/* remove this and break focus drilldown. Why? */
handled = draw;

View file

@ -85,6 +85,7 @@ typedef struct PalmDrawCtx {
UInt16 oldCoord;
XP_Bool doHiRes;
XP_Bool oneDotFiveAvail;
XP_Bool topFocus;
XP_LangCode fontLangCode;
PalmFontHtInfo* fontHtInfo;