From 765f40ed2f93619ab51e4d3b1478dac67fb44dc1 Mon Sep 17 00:00:00 2001 From: ehouse Date: Tue, 4 Jan 2005 14:51:33 +0000 Subject: [PATCH] first checked in --- symbian/src/symdict.cpp | 339 ++++++++++++++++++ symbian/src/symdraw.cpp | 746 ++++++++++++++++++++++++++++++++++++++++ symbian/src/symutil.cpp | 154 +++++++++ symbian/src/xwapp.cpp | 42 +++ symbian/src/xwappui.cpp | 86 +++++ 5 files changed, 1367 insertions(+) create mode 100644 symbian/src/symdict.cpp create mode 100644 symbian/src/symdraw.cpp create mode 100644 symbian/src/symutil.cpp create mode 100644 symbian/src/xwapp.cpp create mode 100644 symbian/src/xwappui.cpp diff --git a/symbian/src/symdict.cpp b/symbian/src/symdict.cpp new file mode 100644 index 000000000..fcb4ac89e --- /dev/null +++ b/symbian/src/symdict.cpp @@ -0,0 +1,339 @@ +/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */ +/* + * Copyright 2005 by Eric House (fixin@peak.org). All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +extern "C" { +#include "dictnryp.h" +#include "mempool.h" +} + +#include +#include "symdict.h" + + +typedef struct SymDictCtxt { + DictionaryCtxt super; + +} SymDictCtxt; + +static void sym_dictionary_destroy( DictionaryCtxt* dict ); + + + +static XP_U8 +readXP_U8( RFile* file ) +{ + TBuf8<1> buf; + TInt err = file->Read( buf, 1 ); + XP_ASSERT( err == KErrNone ); + return *buf.Ptr(); +} // readXP_U8 + +static XP_U16 +readXP_U16( RFile* file ) +{ + XP_U16 result; + TBuf8<2> buf; + TInt err = file->Read( buf, 2 ); + XP_ASSERT( err == KErrNone ); + return XP_NTOHS( *(XP_U16*)buf.Ptr() ); +} // readXP_U16 + +static XP_U32 +readXP_U32( RFile* file ) +{ + TBuf8<4> buf; + TInt err = file->Read( buf, 4 ); + XP_ASSERT( err == KErrNone ); + return XP_NTOHL( *(XP_U32*)buf.Ptr() ); +} // readXP_U32 + +static XP_U16 +symCountSpecials( SymDictCtxt* ctxt ) +{ + XP_U16 result = 0; + XP_U16 i; + + for ( i = 0; i < ctxt->super.nFaces; ++i ) { + if ( IS_SPECIAL(ctxt->super.faces16[i] ) ) { + ++result; + } + } + + return result; +} /* symCountSpecials */ + +static XP_Bitmap* +symMakeBitmap( SymDictCtxt* ctxt, RFile* file ) +{ + XP_U8 nCols = readXP_U8( file ); +// CEBitmapInfo* bitmap = (CEBitmapInfo*)NULL; + XP_Bitmap* bitmap = NULL; + + if ( nCols > 0 ) { + XP_ASSERT( 0 ); // don't do this yet!!!! +#if 0 + XP_U8* dest; + XP_U8* savedDest; + XP_U8 nRows = *ptr++; + XP_U16 rowBytes = (nCols+7) / 8; + XP_U8 srcByte = 0; + XP_U8 destByte = 0; + XP_U8 nBits; + XP_U16 i; + + bitmap = (CEBitmapInfo*)XP_MALLOC( ctxt->super.mpool, + sizeof(bitmap) ); + bitmap->nCols = nCols; + bitmap->nRows = nRows; + dest = XP_MALLOC( ctxt->super.mpool, rowBytes * nRows ); + bitmap->bits = savedDest = dest; + + nBits = nRows * nCols; + for ( i = 0; i < nBits; ++i ) { + XP_U8 srcBitIndex = i % 8; + XP_U8 destBitIndex = (i % nCols) % 8; + XP_U8 srcMask, bit; + + if ( srcBitIndex == 0 ) { + srcByte = *ptr++; + } + + srcMask = 1 << (7 - srcBitIndex); + bit = (srcByte & srcMask) != 0; + destByte |= bit << (7 - destBitIndex); + + /* we need to put the byte if we've filled it or if we're done + with the row */ + if ( (destBitIndex==7) || ((i%nCols) == (nCols-1)) ) { + *dest++ = destByte; + destByte = 0; + } + } + + printBitmapData1( nCols, nRows, savedDest ); + printBitmapData2( nCols, nRows, savedDest ); +#endif + } + + return (XP_Bitmap*)bitmap; +} /* symMakeBitmap */ + +static void +symLoadSpecialData( SymDictCtxt* ctxt, RFile* file ) +{ + TInt i; + TInt nSpecials = symCountSpecials( ctxt ); + XP_UCHAR** texts; + SpecialBitmaps* bitmaps; + + XP_DEBUGF( "loadSpecialData: there are %d specials", nSpecials ); + + texts = (XP_UCHAR**)XP_MALLOC( ctxt->super.mpool, + nSpecials * sizeof(*texts) ); + bitmaps = (SpecialBitmaps*) + XP_MALLOC( ctxt->super.mpool, nSpecials * sizeof(*bitmaps) ); + + for ( i = 0; i < ctxt->super.nFaces; ++i ) { + + XP_CHAR16 face = ctxt->super.faces16[(short)i]; + if ( IS_SPECIAL(face) ) { + + /* get the string */ + XP_U8 txtlen = readXP_U8( file ); + XP_UCHAR* text = (XP_UCHAR*)XP_MALLOC(ctxt->super.mpool, txtlen+1); + TPtr8 desc( text, txtlen ); + file->Read( desc, txtlen ); +// XP_MEMCPY( text, ptr, txtlen ); +// ptr += txtlen; + text[txtlen] = '\0'; + XP_ASSERT( face < nSpecials ); + texts[face] = text; + + XP_DEBUGF( "making bitmaps for %s", texts[face] ); + bitmaps[face].largeBM = symMakeBitmap( ctxt, file ); + bitmaps[face].smallBM = symMakeBitmap( ctxt, file ); + } + } + + ctxt->super.chars = texts; + ctxt->super.bitmaps = bitmaps; + XP_LOGF( "returning from symLoadSpecialData" ); +} // symLoadSpecialData + +static void +readFileToBuf( XP_UCHAR* dictBuf, const RFile* file ) +{ + XP_U32 offset = 0; + for ( ; ; ) { + TBuf8<256> buf; + TInt err = file->Read( buf, buf.MaxLength() ); + TInt nRead = buf.Size(); + XP_LOGF( "read %d bytes from file", nRead ); + if ( nRead <= 0 ) { + break; + } + XP_MEMCPY( (void*)(dictBuf + offset), (void*)buf.Ptr(), nRead ); + offset += nRead; + } +} // readFileToBuf + +DictionaryCtxt* +sym_dictionary_makeL( MPFORMAL TFileName* nameD ) +{ + SymDictCtxt* ctxt = NULL; + TInt err; + + RFs fileSession; + User::LeaveIfError(fileSession.Connect()); + CleanupClosePushL(fileSession); + + RFile file; + User::LeaveIfError( file.Open( fileSession, *nameD, EFileRead ) ); + CleanupClosePushL(file); + + ctxt = (SymDictCtxt*)XP_MALLOC( mpool, sizeof(*ctxt) ); + XP_MEMSET( ctxt, 0, sizeof( *ctxt ) ); + dict_super_init( (DictionaryCtxt*)ctxt ); + ctxt->super.destructor = sym_dictionary_destroy; + MPASSIGN( ctxt->super.mpool, mpool ); + + XP_U16 flags = readXP_U16( &file ); + XP_LOGF( "read flags are: 0x%x", (TInt)flags ); + + TInt numFaces = readXP_U8( &file ); + ctxt->super.nFaces = (XP_U8)numFaces; + XP_DEBUGF( "read %d faces from dict", (TInt)numFaces ); + + ctxt->super.faces16 = (XP_U16*) + XP_MALLOC( mpool, numFaces * sizeof(ctxt->super.faces16[0]) ); +#ifdef NODE_CAN_4 + if ( flags == 0x0002 ) { + ctxt->super.nodeSize = 3; + } else if ( flags == 0x0003 ) { + ctxt->super.nodeSize = 4; + } else { + XP_DEBUGF( "flags=0x%x", flags ); + XP_ASSERT( 0 ); + } + + ctxt->super.is_4_byte = ctxt->super.nodeSize == 4; + + for ( TInt i = 0; i < numFaces; ++i ) { + ctxt->super.faces16[i] = readXP_U16( &file ); + } +#else + error will robinson....; +#endif + + ctxt->super.countsAndValues = + (XP_U8*)XP_MALLOC( mpool, numFaces*2 ); + (void)readXP_U16( &file ); // skip xloc header + + for ( i = 0; i < numFaces*2; i += 2 ) { + ctxt->super.countsAndValues[i] = readXP_U8( &file ); + ctxt->super.countsAndValues[i+1] = readXP_U8( &file ); + } + + symLoadSpecialData( ctxt, &file ); + + // Now, until we figure out how/whether Symbian does memory + // mapping of files, we need to allocate a buffer to hold the + // entire freaking DAWG... :-( + TInt dawgSize; + (void)file.Size( dawgSize ); + TInt pos = 0; + file.Seek( ESeekCurrent, pos ); + dawgSize -= pos; + XP_U32 offset; + if ( dawgSize > sizeof(XP_U32) ) { + offset = readXP_U32( &file ); + dawgSize -= sizeof(XP_U32); + + XP_ASSERT( dawgSize % ctxt->super.nodeSize == 0 ); +# ifdef DEBUG + ctxt->super.numEdges = dawgSize / ctxt->super.nodeSize; +# endif + } + + if ( dawgSize > 0 ) { + XP_DEBUGF( "setting topEdge; offset = %ld", offset ); + + XP_U8* dictBuf = (XP_U8*)XP_MALLOC( mpool, dawgSize ); + User::LeaveIfNull( dictBuf ); // will leak ctxt (PENDING...) + + readFileToBuf( dictBuf, &file ); + + ctxt->super.base = (array_edge*)dictBuf; + + ctxt->super.topEdge = ctxt->super.base + + (offset * ctxt->super.nodeSize); +#ifdef NODE_CAN_4 + ctxt->super.topEdge = ctxt->super.base + + (offset * ctxt->super.nodeSize); +#else + ctxt->super.topEdge = ctxt->super.base + (offset * 3); +#endif + } else { + ctxt->super.topEdge = (array_edge*)NULL; + ctxt->super.base = (array_edge*)NULL; + } + + CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy(); + + return &ctxt->super; +} // sym_dictionary_make + +static void +sym_dictionary_destroy( DictionaryCtxt* dict ) +{ + SymDictCtxt* sctx = (SymDictCtxt*)dict; + XP_U16 nSpecials = symCountSpecials( sctx ); + XP_U16 i; + + if ( dict->countsAndValues != NULL ) { + XP_FREE( sctx->super.mpool, dict->countsAndValues ); + } + if ( dict->faces16 != NULL ) { + XP_FREE( sctx->super.mpool, dict->faces16 ); + } + + if ( !!sctx->super.chars ) { + for ( i = 0; i < nSpecials; ++i ) { + XP_UCHAR* text = sctx->super.chars[i]; + if ( !!text ) { + XP_FREE( sctx->super.mpool, text ); + } + } + XP_FREE( dict->mpool, dict->chars ); + } + + if ( !!sctx->super.bitmaps ) { + for ( i = 0; i < nSpecials; ++i ) { + // Delete sym-specific bitmap data + } + XP_FREE( dict->mpool, dict->bitmaps ); + } + + if ( dict->base != NULL ) { + XP_FREE( dict->mpool, dict->base ); + } + + XP_FREE( dict->mpool, dict ); +} diff --git a/symbian/src/symdraw.cpp b/symbian/src/symdraw.cpp new file mode 100644 index 000000000..5b9a95ad9 --- /dev/null +++ b/symbian/src/symdraw.cpp @@ -0,0 +1,746 @@ +/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */ +/* + * Copyright 2005 by Eric House (fixin@peak.org). All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +extern "C" { +#include "comtypes.h" +#include "board.h" +#include "draw.h" +#include "mempool.h" + +} // extern "C" + +#include +#include +#include + +#include "symdraw.h" + +#define TRAY_CURSOR_HT 2 + +enum { + COLOR_BLACK, + COLOR_WHITE, + + COLOR_PLAYER1, + COLOR_PLAYER2, + COLOR_PLAYER3, + COLOR_PLAYER4, + + COLOR_DBL_LTTR, + COLOR_DBL_WORD, + COLOR_TRPL_LTTR, + COLOR_TRPL_WORD, + + COLOR_EMPTY, + COLOR_TILE, + + COLOR_NCOLORS /* 12 */ +}; + +typedef struct SymDrawCtxt { + DrawCtxVTable* vtable; + CWindowGc* iGC; + CCoeEnv* iCoeEnv; + + CFbsBitmap* rightArrow; + CFbsBitmap* downArrow; + + CFont* iTileFaceFont; + CFont* iTileValueFont; + CFont* iBoardFont; + CFont* iScoreFont; + + XP_U16 iTrayOwner; + XP_Bool iTrayHasFocus; + TRgb colors[COLOR_NCOLORS]; + + MPSLOT +} SymDrawCtxt; + +static void +textToDesc( TBuf16<64>* buf, XP_UCHAR* txt ) +{ + TBuf8<64> tmpDesc( txt ); + buf->Copy( tmpDesc ); +} // textToDesc + +static void +symLocalRect( TRect* dest, const XP_Rect* src ) +{ + dest->Move( src->left, src->top ); + dest->SetWidth( src->width + 1 ); + dest->SetHeight( src->height + 1 ); +} // symLocalRect + +static void +symClearRect( SymDrawCtxt* sctx, const TRect* rect ) +{ + sctx->iGC->SetBrushColor( sctx->colors[COLOR_WHITE] ); + sctx->iGC->SetBrushStyle( CGraphicsContext::ESolidBrush ); + sctx->iGC->SetPenStyle( CGraphicsContext::ENullPen ); + sctx->iGC->DrawRect( *rect ); +} // symClearRect + +static void +drawFocusRect( SymDrawCtxt* sctx, XP_Rect* rect, XP_Bool hasfocus ) +{ + TRect lRect; + symLocalRect( &lRect, rect ); + + lRect.Grow( 2, 2 ); // This is space board.c doesn't know about + sctx->iGC->SetClippingRect( lRect ); + + sctx->iGC->SetBrushStyle( CGraphicsContext::ENullBrush ); + sctx->iGC->SetPenStyle( CGraphicsContext::EDottedPen ); + XP_U16 index = hasfocus? COLOR_BLACK : COLOR_WHITE; + sctx->iGC->SetPenColor( sctx->colors[index] ); + sctx->iGC->DrawRect( lRect ); +} // drawFocusRect + +static void +getBonusColor( SymDrawCtxt* sctx, XWBonusType bonus, TRgb* rgb ) +{ + XP_U16 index; + if ( bonus == BONUS_NONE ) { + index = COLOR_WHITE; + } else { + index = COLOR_DBL_LTTR + bonus - 1; + } + *rgb = sctx->colors[index]; +} // getBonusColor + +static void +sym_draw_destroyCtxt( DrawCtx* p_dctx ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + XP_LOGF( "freeing draw ctxt" ); + XP_ASSERT( sctx ); + XP_ASSERT( sctx->vtable ); + XP_FREE( sctx->mpool, sctx->vtable ); + XP_FREE( sctx->mpool, sctx ); +} + +static XP_Bool +sym_draw_boardBegin( DrawCtx* p_dctx, XP_Rect* rect, + XP_Bool hasfocus ) +{ + XP_LOGF( "sym_draw_boardBegin" ); + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + drawFocusRect( sctx, rect, hasfocus ); + return XP_TRUE; +} + +static void +sym_draw_boardFinished( DrawCtx* p_dctx ) +{ +} + +static XP_Bool +sym_draw_vertScrollBoard( DrawCtx* p_dctx, XP_Rect* rect, + XP_S16 dist ) +{ + XP_ASSERT(0); + return XP_FALSE; +} + +static XP_Bool +sym_draw_trayBegin( DrawCtx* p_dctx, XP_Rect* rect, + XP_U16 owner, XP_Bool hasfocus ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + sctx->iTrayOwner = owner; + sctx->iTrayHasFocus = hasfocus; + + drawFocusRect( sctx, rect, hasfocus ); + + return XP_TRUE; +} + +static void +sym_draw_trayFinished( DrawCtx* /*dctx*/ ) +{ +} + +static void +makeRemText( XP_UCHAR* buf, XP_U16 bufLen, XP_S16 nLeft ) +{ + if ( nLeft < 0 ) { + nLeft = 0; + } + const char* fmt = "Tiles left in pool: %d"; + + sprintf( (char*)buf, fmt, nLeft ); + XP_ASSERT( XP_STRLEN(buf) < bufLen ); +} // makeRemText + +static void +sym_draw_measureRemText( DrawCtx* p_dctx, XP_Rect* r, + XP_S16 nTilesLeft, + XP_U16* widthP, XP_U16* heightP ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + XP_UCHAR buf[64]; + makeRemText( buf, sizeof(buf), nTilesLeft ); + TBuf16<64> tbuf; + textToDesc( &tbuf, buf ); + + const CFont* font = sctx->iScoreFont; + *widthP = font->TextWidthInPixels( tbuf ); + *heightP = font->HeightInPixels(); +} // sym_draw_measureRemText + +static void +sym_draw_drawRemText(DrawCtx* p_dctx, XP_Rect* rInner, + XP_Rect* rOuter, XP_S16 nTilesLeft) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + XP_UCHAR buf[64]; + makeRemText( buf, sizeof(buf), nTilesLeft ); + TBuf16<64> tbuf; + textToDesc( &tbuf, buf ); + + TRect lRect; + symLocalRect( &lRect, rInner ); + symClearRect( sctx, &lRect ); + + TPoint point( lRect.iTl.iX, lRect.iBr.iY ); + sctx->iGC->SetPenColor( sctx->colors[COLOR_BLACK] ); + + sctx->iGC->UseFont( sctx->iScoreFont ); + sctx->iGC->DrawText( tbuf, point ); + sctx->iGC->DiscardFont(); +} // sym_draw_drawRemText + +static void +sym_draw_scoreBegin( DrawCtx* p_dctx, XP_Rect* rect, + XP_U16 numPlayers, XP_Bool hasfocus ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + drawFocusRect( sctx, rect, hasfocus ); +} + +static void +figureScoreText( XP_UCHAR* buf, XP_U16 bufLen, DrawScoreInfo* dsi ) +{ + const char* fmt = "%c %s %d (%d) %c %c"; + + sprintf( (char*)buf, fmt, + (dsi->selected?'S':'s'), + dsi->name, dsi->score, dsi->nTilesLeft, + (dsi->isRemote?'R':'L'), + (dsi->isRobot?'R':'H') ); + XP_ASSERT( XP_STRLEN(buf) < bufLen ); +} // figureScoreText + +static void +sym_draw_measureScoreText( DrawCtx* p_dctx, XP_Rect* r, + DrawScoreInfo* dsi, + XP_U16* widthP, XP_U16* heightP ) +{ + XP_UCHAR buf[64]; + figureScoreText( buf, sizeof(buf), dsi ); + TBuf16<64> tbuf; + textToDesc( &tbuf, buf ); + + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + const CFont* font = sctx->iScoreFont; + TInt width = font->TextWidthInPixels( tbuf ); + TInt height = font->HeightInPixels(); + + *widthP = width; + *heightP = height; +} + +static void +sym_draw_score_drawPlayer( DrawCtx* p_dctx, + XP_S16 playerNum, /* -1: don't use */ + XP_Rect* rInner, XP_Rect* rOuter, + DrawScoreInfo* dsi ) +{ + XP_UCHAR buf[64]; + figureScoreText( buf, sizeof(buf), dsi ); + TBuf16<64> tbuf; + textToDesc( &tbuf, buf ); + + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + CFont* font = sctx->iScoreFont; + sctx->iGC->UseFont( font ); + TInt descent = font->DescentInPixels(); + + TRect lRect; + symLocalRect( &lRect, rInner ); + + TRect lRect1; + symLocalRect( &lRect1, rOuter ); + symClearRect( sctx, &lRect1 ); + if ( dsi->isTurn ) { + TPoint point( lRect1.iTl.iX, lRect.iBr.iY - descent ); + sctx->iGC->DrawText( _L("T"), point ); + } + + sctx->iGC->SetClippingRect( lRect ); + symClearRect( sctx, &lRect ); + + TPoint point( lRect.iTl.iX, lRect.iBr.iY - descent ); + if ( playerNum >= 0 ) { + sctx->iGC->SetPenColor( sctx->colors[playerNum + COLOR_PLAYER1] ); + } + sctx->iGC->DrawText( tbuf, point ); + sctx->iGC->CancelClippingRect(); + + sctx->iGC->DiscardFont(); +} + +static void +sym_draw_score_pendingScore( DrawCtx* p_dctx, XP_Rect* rect, + XP_S16 score, XP_U16 playerNum ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + TRect lRect; + symLocalRect( &lRect, rect ); + lRect.Shrink( 1, 1 ); + lRect.SetHeight( lRect.Height() - TRAY_CURSOR_HT ); + sctx->iGC->SetClippingRect( lRect ); + + sctx->iGC->UseFont( sctx->iTileValueFont ); + + XP_UCHAR buf[4]; + if ( score >= 0 ) { + XP_SNPRINTF( buf, sizeof(buf), (XP_UCHAR*)"%0d", score ); + } else { + XP_SNPRINTF( buf, sizeof(buf), (XP_UCHAR*)"%s", "???" ); + } + TBuf16<64> bottomBuf; + textToDesc( &bottomBuf, buf ); + + TPoint point( lRect.iTl.iX, lRect.iBr.iY ); + sctx->iGC->DrawText( bottomBuf, point ); + + TBuf16<64> topBuf; + textToDesc( &topBuf, (XP_UCHAR*)"Pts:" ); + point.iY = lRect.Center().iY; + sctx->iGC->DrawText( topBuf, point ); + + sctx->iGC->DiscardFont(); +} + +static void +sym_draw_scoreFinished( DrawCtx* /*dctx*/ ) +{ +} + +static void +sym_draw_drawTimer( DrawCtx* p_dctx, XP_Rect* rInner, XP_Rect* rOuter, + XP_U16 player, XP_S16 secondsLeft ) +{ +} + +static void +textInCell( SymDrawCtxt* sctx, XP_UCHAR* text, TRect* lRect ) +{ + sctx->iGC->SetPenColor( sctx->colors[COLOR_BLACK] ); + sctx->iGC->SetPenStyle( CGraphicsContext::ESolidPen ); + sctx->iGC->SetBrushStyle( CGraphicsContext::ENullBrush ); + + CFont* font = sctx->iBoardFont; + + TBuf16<64> tbuf; + textToDesc( &tbuf, text ); + TInt txtWidth = font->TextWidthInPixels( tbuf ); + + lRect->Shrink( 2, 2 ); + TInt width = lRect->Width(); + + /* Center the text horizontally */ + TPoint point( lRect->iTl.iX + ((width-txtWidth)/2), lRect->iBr.iY ); + + sctx->iGC->UseFont( font ); + sctx->iGC->DrawText( tbuf, point ); + sctx->iGC->DiscardFont(); +} + +static XP_Bool +sym_draw_drawCell( DrawCtx* p_dctx, XP_Rect* rect, + /* at least one of these two will be null */ + XP_UCHAR* text, XP_Bitmap bitmap, + XP_S16 owner, /* -1 means don't use */ + XWBonusType bonus, HintAtts hintAtts, + XP_Bool isBlank, XP_Bool highlight, + XP_Bool isStar) +{ + TRect lRect; + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + + symLocalRect( &lRect, rect ); + sctx->iGC->SetClippingRect( lRect ); + + XP_U16 index = COLOR_TILE; + TRgb rgb; + if ( highlight ) { + rgb = sctx->colors[COLOR_WHITE]; + } else if ( !!bitmap || (!!text && XP_STRLEN((const char*)text) > 0)) { + rgb = sctx->colors[COLOR_TILE]; + } else { + getBonusColor( sctx, bonus, &rgb ); + } + + sctx->iGC->SetPenColor( sctx->colors[COLOR_BLACK] ); + sctx->iGC->SetPenStyle( CGraphicsContext::ESolidPen ); + sctx->iGC->SetBrushColor( rgb ); + sctx->iGC->SetBrushStyle( CGraphicsContext::ESolidBrush ); + sctx->iGC->DrawRect( lRect ); + + if ( !!bitmap ) { + XP_ASSERT( 0 ); + } else if ( !!text ) { + TRect r2(lRect); + textInCell( sctx, text, &r2 ); + } + + return XP_TRUE; +} + +static void +sym_draw_invertCell( DrawCtx* p_dctx, XP_Rect* rect ) +{ +} + +static void +sym_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect, + /* at least 1 of these two will be null*/ + XP_UCHAR* text, XP_Bitmap bitmap, + XP_S16 val, XP_Bool highlighted ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + XP_U16 index = COLOR_PLAYER1 + sctx->iTrayOwner; + + TRect lRect; + symLocalRect( &lRect, rect ); + sctx->iGC->SetClippingRect( lRect ); + symClearRect( sctx, &lRect ); + + lRect.Shrink( 1, 1 ); + lRect.SetHeight( lRect.Height() - TRAY_CURSOR_HT ); + + sctx->iGC->SetPenColor( sctx->colors[index] ); + sctx->iGC->SetPenStyle( CGraphicsContext::ESolidPen ); + sctx->iGC->SetBrushColor( sctx->colors[COLOR_TILE] ); + sctx->iGC->SetBrushStyle( CGraphicsContext::ESolidBrush ); + sctx->iGC->DrawRect( lRect ); + + lRect.Shrink( 1, 1 ); + if ( highlighted ) { + sctx->iGC->DrawRect( lRect ); + } + + lRect.Shrink( 2, 2 ); + sctx->iGC->SetClippingRect( lRect ); + + // now put the text in the thing + if ( !!text ) { + sctx->iGC->UseFont( sctx->iTileFaceFont ); + + TBuf8<10> tmpDesc((unsigned char*)text); + TBuf16<10> txtbuf; + txtbuf.Copy( tmpDesc ); + TInt ht = sctx->iTileFaceFont->HeightInPixels(); + TPoint point( lRect.iTl.iX, lRect.iTl.iY + ht ); + sctx->iGC->DrawText( txtbuf, point ); + sctx->iGC->DiscardFont(); + } + + if ( val > 0 ) { + XP_UCHAR buf[4]; + sprintf( (char*)buf, (const char*)"%d", (int)val ); + + CFont* font = sctx->iTileValueFont; + sctx->iGC->UseFont( font ); + + TBuf8<5> tmpDesc((unsigned char*)buf); + TBuf16<5> txtbuf; + txtbuf.Copy( tmpDesc ); + + TInt width = font->TextWidthInPixels( txtbuf ); + TInt ht = font->HeightInPixels(); + TPoint point( lRect.iBr.iX - width, lRect.iBr.iY ); + sctx->iGC->DrawText( txtbuf, point ); + sctx->iGC->DiscardFont(); + } +} // sym_draw_drawTile + +static void +sym_draw_drawTileBack( DrawCtx* p_dctx, XP_Rect* rect ) +{ + sym_draw_drawTile( p_dctx, rect, (XP_UCHAR*)"?", NULL, -1, XP_FALSE ); +} + +static void +sym_draw_drawTrayDivider( DrawCtx* p_dctx, XP_Rect* rect, + XP_Bool selected ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + TRect lRect; + symLocalRect( &lRect, rect ); + sctx->iGC->SetClippingRect( lRect ); + symClearRect( sctx, &lRect ); + + lRect.Shrink( 1, 1 ); + lRect.SetHeight( lRect.Height() - TRAY_CURSOR_HT ); + + sctx->iGC->SetBrushStyle( CGraphicsContext::ESolidBrush ); + sctx->iGC->SetBrushColor( sctx->colors[COLOR_PLAYER1 + sctx->iTrayOwner] ); + + sctx->iGC->DrawRect( lRect ); +} + +static void +sym_draw_clearRect( DrawCtx* p_dctx, XP_Rect* rect ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + TRect lRect; + symLocalRect( &lRect, rect ); + sctx->iGC->SetClippingRect( lRect ); + symClearRect( sctx, &lRect ); +} + +static void +sym_draw_drawBoardArrow( DrawCtx* p_dctx, XP_Rect* rect, + XWBonusType bonus, XP_Bool vert, + HintAtts hintAtts ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + XP_UCHAR* arrow = (XP_UCHAR*)(vert? "|":"-"); + + XP_LOGF( "drawBoardArrow: %s", arrow ); + +#if 0 + gc.BitBlt( point, arrowBmp ); +#else + TRect lRect; + symLocalRect( &lRect, rect ); + sctx->iGC->SetClippingRect( lRect ); + + textInCell( sctx, arrow, &lRect ); +#endif +} + +#ifdef KEY_SUPPORT +static void +sym_draw_drawTrayCursor( DrawCtx* p_dctx, XP_Rect* rect ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + TRect lRect; + symLocalRect( &lRect, rect ); + lRect.iTl.iY += lRect.Height() - TRAY_CURSOR_HT; + symClearRect( sctx, &lRect ); + sctx->iGC->SetClippingRect( lRect ); + + sctx->iGC->SetBrushColor( sctx->colors[COLOR_PLAYER1 + sctx->iTrayOwner] ); + sctx->iGC->SetBrushStyle( CGraphicsContext::ESolidBrush ); + sctx->iGC->SetPenStyle( CGraphicsContext::ENullPen ); + sctx->iGC->DrawRect( lRect ); +} + +static void +sym_draw_drawBoardCursor( DrawCtx* p_dctx, XP_Rect* rect ) +{ + SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; + TRect lRect; + symLocalRect( &lRect, rect ); + + lRect.Shrink( 1, 1 ); + sctx->iGC->SetClippingRect( lRect ); + + sctx->iGC->SetPenColor( sctx->colors[COLOR_BLACK] ); + sctx->iGC->SetPenStyle( CGraphicsContext::ESolidPen ); + sctx->iGC->SetBrushStyle( CGraphicsContext::ENullBrush ); + sctx->iGC->DrawRect( lRect ); +} +#endif + +static XP_UCHAR* +sym_draw_getMiniWText( DrawCtx* p_dctx, + XWMiniTextType textHint ) +{ + return (XP_UCHAR*)""; +} + +static void +sym_draw_measureMiniWText( DrawCtx* p_dctx, XP_UCHAR* textP, + XP_U16* width, XP_U16* height ) +{ +} + +static void +sym_draw_drawMiniWindow( DrawCtx* p_dctx, XP_UCHAR* text, + XP_Rect* rect, void** closure ) +{ +} + +static void +sym_draw_eraseMiniWindow( DrawCtx* p_dctx, XP_Rect* rect, + XP_Bool lastTime, void** closure, + XP_Bool* invalUnder ) +{ +} + +static void +figureFonts( SymDrawCtxt* sctx ) +{ + XP_LOGF( "figureFonts" ); + TBuf<128> fontName; + CWsScreenDevice* sdev = sctx->iCoeEnv->ScreenDevice(); + TInt nTypes = sdev->NumTypefaces(); + XP_LOGF( "count = %d", nTypes ); + + TTypefaceSupport tfSupport; + TInt smallIndex = -1; + TInt smallSize = 0x7FFF; + + for ( TInt i = 0; i < nTypes; ++i ) { + sdev->TypefaceSupport( tfSupport, i ); + fontName = tfSupport.iTypeface.iName.Des(); +#if 0 + TBuf8<128> tmpb; + tmpb.Copy( fontName ); + XP_UCHAR buf[128]; + XP_MEMCPY( buf, (void*)(tmpb.Ptr()), tmpb.Length() ); + buf[tmpb.Length()] = '\0'; + XP_LOGF( "got font %s: %d - %d, scalable: %s", buf, + tfSupport.iMinHeightInTwips, tfSupport.iMaxHeightInTwips, + (tfSupport.iIsScalable?"yes":"no") ); +#endif + if ( tfSupport.iMinHeightInTwips < smallSize ) { + smallIndex = i; + smallSize = tfSupport.iMinHeightInTwips; + } + } + + // Now use the smallest guy + if ( smallIndex != -1 ) { + const TInt twipAdjust = 10; + sdev->TypefaceSupport( tfSupport, smallIndex ); + fontName = tfSupport.iTypeface.iName.Des(); + +#if 0 + TBuf8<128> tmpb; + tmpb.Copy( fontName ); + XP_UCHAR buf[128]; + XP_MEMCPY( buf, (void*)(tmpb.Ptr()), tmpb.Length() ); + buf[tmpb.Length()] = '\0'; + XP_LOGF( "using font %s: %d ", buf, + tfSupport.iMinHeightInTwips ); +#endif + TFontSpec fontSpecBoard( fontName, (scaleBoardV) * twipAdjust ); + sdev->GetNearestFontInTwips( sctx->iBoardFont, fontSpecBoard ); + + TInt tileHt = scaleTrayV - TRAY_CURSOR_HT; + TFontSpec fontSpecTray( fontName, (tileHt * 2 / 3) * twipAdjust ); + sdev->GetNearestFontInTwips( sctx->iTileFaceFont, fontSpecTray ); + + TFontSpec fontSpecVal( fontName, (tileHt / 3) * twipAdjust ); + sdev->GetNearestFontInTwips( sctx->iTileValueFont, fontSpecVal ); + + TFontSpec fontSpecScore( fontName, scaleBoardV * twipAdjust ); + sdev->GetNearestFontInTwips( sctx->iScoreFont, fontSpecScore ); + + } else { + sctx->iTileFaceFont = (CFont*)sctx->iCoeEnv->NormalFont(); + sctx->iTileValueFont = sctx->iTileFaceFont; + sctx->iBoardFont = sctx->iTileFaceFont; + sctx->iScoreFont = sctx->iTileFaceFont; + } + + XP_LOGF( "figureFonts done" ); +} // figureFonts + +DrawCtx* +sym_drawctxt_make( MPFORMAL CWindowGc* aGC, CCoeEnv* aCoeEnv ) +{ + XP_LOGF( "in sym_drawctxt_make" ); + SymDrawCtxt* sctx = (SymDrawCtxt*)XP_MALLOC( mpool, sizeof( *sctx ) ); + + XP_ASSERT( aGC != NULL ); + + if ( sctx != NULL ) { + XP_MEMSET( sctx, 0, sizeof( *sctx ) ); + MPASSIGN( sctx->mpool, mpool ); + sctx->iGC = aGC; + sctx->iCoeEnv = aCoeEnv; + + sctx->vtable = (DrawCtxVTable*)XP_MALLOC( mpool, sizeof(*sctx->vtable) ); + if ( sctx->vtable != NULL ) { + + SET_VTABLE_ENTRY( sctx->vtable, draw_destroyCtxt, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_boardBegin, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_boardFinished, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_vertScrollBoard, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_trayBegin, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_trayFinished, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_measureRemText, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawRemText, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_scoreBegin, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_measureScoreText, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_score_drawPlayer, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_score_pendingScore, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_scoreFinished, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawTimer, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawCell, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_invertCell, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawTile, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawTileBack, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawTrayDivider, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_clearRect, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawBoardArrow, sym ); +#ifdef KEY_SUPPORT + SET_VTABLE_ENTRY( sctx->vtable, draw_drawTrayCursor, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawBoardCursor, sym ); +#endif + SET_VTABLE_ENTRY( sctx->vtable, draw_getMiniWText, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_measureMiniWText, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_drawMiniWindow, sym ); + SET_VTABLE_ENTRY( sctx->vtable, draw_eraseMiniWindow, sym ); + + sctx->colors[COLOR_BLACK] = KRgbBlack; + sctx->colors[COLOR_WHITE] = KRgbWhite; + sctx->colors[COLOR_TILE] = TRgb(0x80ffff); // light yellow + //sctx->colors[COLOR_TILE] = KRgbYellow; + + sctx->colors[COLOR_PLAYER1] = KRgbBlack; + sctx->colors[COLOR_PLAYER2] = KRgbDarkRed; + sctx->colors[COLOR_PLAYER4] = KRgbDarkBlue; + sctx->colors[COLOR_PLAYER3] = KRgbDarkGreen; + + sctx->colors[COLOR_DBL_LTTR] = KRgbYellow; + sctx->colors[COLOR_DBL_WORD] = KRgbBlue; + sctx->colors[COLOR_TRPL_LTTR] = KRgbMagenta; + sctx->colors[COLOR_TRPL_WORD] = KRgbCyan; + + figureFonts( sctx ); + } else { + XP_FREE( mpool, sctx ); + sctx = NULL; + } + } + + XP_LOGF( "leaving sym_drawctxt_make" ); + + return (DrawCtx*)sctx; +} diff --git a/symbian/src/symutil.cpp b/symbian/src/symutil.cpp new file mode 100644 index 000000000..96c86fe01 --- /dev/null +++ b/symbian/src/symutil.cpp @@ -0,0 +1,154 @@ +/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */ +/* + * Copyright 2005 by Eric House (fixin@peak.org). All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include +#include +#include "comtypes.h" + +extern "C" { + +int +sym_snprintf( XP_UCHAR* aBuf, XP_U16 aLen, const XP_UCHAR* aFmt, ... ) +{ + __e32_va_list ap; + va_start( ap, aFmt ); + + int result = vsprintf( (char*)aBuf, (const char*)aFmt, ap ); + XP_ASSERT( XP_STRLEN(aBuf) < aLen ); // this may not work.... + va_end(ap); + return result; +} + +#ifdef DEBUG +_LIT( KXWLogdir, "xwords" ); +_LIT( KXWLogfile, "xwdebug.log" ); +void sym_debugf( char* aFmt, ... ) +{ + VA_LIST ap; + VA_START( ap, aFmt ); + + TBuf8<256> fmtDesc((unsigned char*)aFmt); + + RFileLogger::WriteFormat( KXWLogdir, KXWLogfile, + EFileLoggingModeAppend, + fmtDesc, ap ); + VA_END(ap); +} + +#else + +void p_ignore(...) {} + +#endif + + +void* +sym_malloc(XP_U32 nbytes ) +{ + return malloc( nbytes ); +} + +void* sym_realloc(void* p, XP_U32 nbytes) +{ + return realloc( p, nbytes ); +} + +void +sym_free( void* p ) +{ + free( p ); +} + +void +sym_assert( XP_Bool b, XP_U32 line, const char* file ) +{ + if ( !b ) { + XP_LOGF( "ASSERTION FAILED: line %d, file %s", + line, file ); + } +} + +void +sym_memcpy( void* dest, void* src, XP_U32 nbytes ) +{ + memcpy( dest, src, nbytes ); +} + +XP_U32 +sym_strlen( XP_UCHAR* str ) +{ + return strlen( (const char*)str ); +} + +XP_S16 +sym_strncmp( XP_UCHAR* str1, XP_UCHAR* str2, XP_U32 len ) +{ + return (XP_S16)strncmp( (const char*)str1, (const char*)str2, len ); +} + +void +sym_memset( void* dest, XP_UCHAR val, XP_U32 nBytes ) +{ + memset( dest, val, nBytes ); +} + +XP_S16 +sym_strcmp( XP_UCHAR* str1, XP_UCHAR* str2 ) +{ + return (XP_S16)strcmp( (const char*)str1, (const char*)str2 ); +} + +char* +sym_strcat( XP_UCHAR* dest, const XP_UCHAR* src ) +{ + return strcat( (char*)dest, (const char*) src ); +} + +XP_S16 +sym_memcmp( void* m1, void* m2, XP_U32 nbytes ) +{ + return (XP_S16)memcmp( m1, m2, nbytes ); +} + +XP_U32 +sym_flip_long( XP_U32 l ) +{ + XP_U32 result = + ((l & 0x000000FF) << 24) | + ((l & 0x0000FF00) << 8) | + ((l & 0x00FF0000) >> 8) | + ((l & 0xFF000000) >> 24); + return result; +} + +XP_U16 +sym_flip_short(XP_U16 s) +{ + XP_U16 result = + ((s & 0x00FF) << 8) | + ((s & 0xFF00) >> 8); + + return result; +} + +} // extern "C" diff --git a/symbian/src/xwapp.cpp b/symbian/src/xwapp.cpp new file mode 100644 index 000000000..fde79ae40 --- /dev/null +++ b/symbian/src/xwapp.cpp @@ -0,0 +1,42 @@ +/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */ +/* + * Copyright 2005 by Eric House (fixin@peak.org). (based on sample + * app helloworldbasic "Copyright (c) 2002, Nokia. All rights + * reserved.") + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "xwdoc.h" +#include "xwapp.h" + +// UID for the application, this should correspond to the uid defined +// in the mmp file. PENDING get an official one from Symbian. +static const TUid KUidXWordsApp = {0x1020680c}; + +CApaDocument* +CXWordsApplication::CreateDocumentL() +{ + // Create an HelloWorldBasic document, and return a pointer to it + CApaDocument* document = CXWordsDocument::NewL(*this); + return document; +} + +TUid +CXWordsApplication::AppDllUid() const +{ + + return KUidXWordsApp; +} diff --git a/symbian/src/xwappui.cpp b/symbian/src/xwappui.cpp new file mode 100644 index 000000000..dff40b091 --- /dev/null +++ b/symbian/src/xwappui.cpp @@ -0,0 +1,86 @@ +/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */ +/* + * Copyright 2005 by Eric House (fixin@peak.org). (based on sample + * app helloworldbasic "Copyright (c) 2002, Nokia. All rights + * reserved.") + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include + +#include "xwords.pan" +#include "xwappui.h" +#include "xwappview.h" +#include "xwords.hrh" + +// ConstructL is called by the application framework +void CXWordsAppUi::ConstructL() +{ + BaseConstructL(); + + iAppView = CXWordsAppView::NewL(ClientRect()); + + AddToStackL(iAppView); +} + +CXWordsAppUi::CXWordsAppUi() +{ +} + +CXWordsAppUi::~CXWordsAppUi() +{ + if ( iAppView ) { + iEikonEnv->RemoveFromStack(iAppView); + delete iAppView; + iAppView = NULL; + } +} + +// handle any menu commands +void CXWordsAppUi::HandleCommandL(TInt aCommand) +{ + switch(aCommand) { + + // built-in commands here + case EEikCmdExit: + CBaActiveScheduler::Exit(); + break; + + // added commands here + default: + if ( iAppView->HandleCommand( aCommand ) == 0 ) { + Panic(EXWordsUi); + } + break; + } +} // HandleCommandL + +TKeyResponse +CXWordsAppUi::HandleKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) +{ + if ( aType == EEventKey ) { + TChar chr(aKeyEvent.iCode); + XP_LOGF( "got iScanCode: %d (%c)", aKeyEvent.iScanCode, + aKeyEvent.iScanCode ); + if ( iAppView->HandleKeyEvent( aKeyEvent ) ) { + return EKeyWasConsumed; + } + } + + return EKeyWasNotConsumed; +} /* HandleKeyEventL */