From 3b5337d7d26490a34224bc4ac6f74537fdd492dd Mon Sep 17 00:00:00 2001 From: ehouse Date: Fri, 24 Oct 2008 09:05:13 +0000 Subject: [PATCH] wince support for Rem: focus and showing remaining tiles --- xwords4/wince/cedraw.c | 11 ++++++++--- xwords4/wince/cemain.c | 13 +++++++++++++ xwords4/wince/cemain.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/xwords4/wince/cedraw.c b/xwords4/wince/cedraw.c index 9765148e2..66bde1095 100755 --- a/xwords4/wince/cedraw.c +++ b/xwords4/wince/cedraw.c @@ -1188,7 +1188,7 @@ DRAW_FUNC_NAME(measureRemText)( DrawCtx* p_dctx, const XP_Rect* xprect, DLSTATIC void DRAW_FUNC_NAME(drawRemText)( DrawCtx* p_dctx, const XP_Rect* rInner, const XP_Rect* XP_UNUSED(rOuter), - XP_S16 nTilesLeft ) + XP_S16 nTilesLeft, XP_Bool focussed ) { CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; CEAppGlobals* globals = dctx->globals; @@ -1200,11 +1200,16 @@ DRAW_FUNC_NAME(drawRemText)( DrawCtx* p_dctx, const XP_Rect* rInner, formatRemText( nTilesLeft, dctx->scoreIsVertical, buf ); + XPRtoRECT( &rt, rInner ); + if ( focussed ) { + SetBkColor( hdc, dctx->globals->appPrefs.colors[CE_FOCUS_COLOR] ); + FillRect( hdc, &rt, dctx->brushes[CE_FOCUS_COLOR] ); + } + + InsetRect( &rt, 1, 1 ); fce = ceGetSizedFont( dctx, 0, RFONTS_REM ); oldFont = SelectObject( hdc, fce->setFont ); - XPRtoRECT( &rt, rInner ); - InsetRect( &rt, 1, 1 ); ceDrawLinesClipped( hdc, fce, buf, XP_TRUE, &rt ); (void)SelectObject( hdc, oldFont ); diff --git a/xwords4/wince/cemain.c b/xwords4/wince/cemain.c index 7354b331f..e49f26ff1 100755 --- a/xwords4/wince/cemain.c +++ b/xwords4/wince/cemain.c @@ -126,6 +126,7 @@ static const XP_UCHAR* ce_util_getUserString( XW_UtilCtxt* uc, XP_U16 stringCode ); static XP_Bool ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, XP_U16 turn, XP_Bool turnLost ); +static void ce_util_remSelected( XW_UtilCtxt* uc ); #if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY static void ce_util_addrChange( XW_UtilCtxt* uc, const CommsAddrRec* oldAddr, const CommsAddrRec* newAddr ); @@ -349,6 +350,7 @@ ceInitUtilFuncs( CEAppGlobals* globals ) vtable->m_util_makeEmptyDict = ce_util_makeEmptyDict; vtable->m_util_getUserString = ce_util_getUserString; vtable->m_util_warnIllegalWord = ce_util_warnIllegalWord; + vtable->m_util_remSelected = ce_util_remSelected; #ifdef XWFEATURE_RELAY vtable->m_util_addrChange = ce_util_addrChange; vtable->m_util_makeStreamFromAddr = ce_util_makeStreamFromAddr; @@ -2501,6 +2503,10 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) draw = server_do( globals->game.server ); break; + case XWWM_REM_SEL: + ceTilesLeft( globals ); + break; + #ifndef XWFEATURE_STANDALONE_ONLY case XWWM_PACKET_ARRIVED: draw = processPacket( globals, (XWStreamCtxt*)lParam ); @@ -3311,6 +3317,13 @@ ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, return isOk; } /* ce_util_warnIllegalWord */ +static void +ce_util_remSelected( XW_UtilCtxt* uc ) +{ + CEAppGlobals* globals = (CEAppGlobals*)uc->closure; + PostMessage( globals->hWnd, XWWM_REM_SEL, 0, 0 ); +} + #if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH static void ce_util_addrChange( XW_UtilCtxt* XP_UNUSED(uc), diff --git a/xwords4/wince/cemain.h b/xwords4/wince/cemain.h index 81ede8462..ba030da1c 100755 --- a/xwords4/wince/cemain.h +++ b/xwords4/wince/cemain.h @@ -174,6 +174,7 @@ typedef struct CEAppGlobals { enum { XWWM_TIME_RQST = WM_APP + ,XWWM_REM_SEL ,XWWM_PACKET_ARRIVED };