From 0161e02f546cee5a91df4c9ce7f059831e796de7 Mon Sep 17 00:00:00 2001 From: ehouse Date: Fri, 7 Jan 2005 11:06:54 +0000 Subject: [PATCH] Fix to compile for series 60 under Linux. Completely untested! --- symbian/group/xwords.rss | 6 +++++ symbian/inc/symdict.h | 5 +++- symbian/inc/symdraw.h | 8 ++++++- symbian/inc/xptypes.h | 2 +- symbian/inc/xwords.hrh | 3 +++ symbian/src/symdraw.cpp | 50 +++++++++++++++++++++++++++++++-------- symbian/src/xwappui.cpp | 7 +++++- symbian/src/xwappview.cpp | 29 +++++++++++++++++------ 8 files changed, 89 insertions(+), 21 deletions(-) diff --git a/symbian/group/xwords.rss b/symbian/group/xwords.rss index 001e76498..76ebc4b6b 100644 --- a/symbian/group/xwords.rss +++ b/symbian/group/xwords.rss @@ -225,7 +225,9 @@ RESOURCE TBUF64 r_confirm_end_game { RESOURCE DIALOG r_xwords_confirmation_query { title = "Query"; +#if defined SERIES_80 buttons = R_EIK_BUTTONS_NO_YES; +#endif flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc; items = { @@ -241,7 +243,9 @@ RESOURCE DIALOG r_xwords_confirmation_query RESOURCE DIALOG r_xwords_info_only { title = "Info"; +#if defined SERIES_80 buttons = R_EIK_BUTTONS_CONTINUE; +#endif flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc; items = { @@ -308,7 +312,9 @@ RESOURCE ARRAY r_xwords_newgame_pages RESOURCE DIALOG r_xwords_newgame_dlg { title = "Game info"; +#if defined SERIES_80 buttons = R_EIK_BUTTONS_CANCEL_OK; +#endif flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc; pages = r_xwords_newgame_pages; } diff --git a/symbian/inc/symdict.h b/symbian/inc/symdict.h index 625425373..7e355d195 100644 --- a/symbian/inc/symdict.h +++ b/symbian/inc/symdict.h @@ -20,7 +20,10 @@ #ifndef _SYMDICT_H_ #define _SYMDICT_H_ -#include +#if defined SERIES_60 +#elif defined SERIES_80 +# include +#endif extern "C" { #include "comtypes.h" diff --git a/symbian/inc/symdraw.h b/symbian/inc/symdraw.h index 35f214f07..b997cd05b 100644 --- a/symbian/inc/symdraw.h +++ b/symbian/inc/symdraw.h @@ -27,6 +27,11 @@ extern "C" { } /* extern "C" */ +#if defined SERIES_60 +# include +# include +#endif + #define scaleBoardV 13 #define scaleBoardH 15 #define scaleTrayV 37 @@ -34,6 +39,7 @@ extern "C" { #define CUR_PREFS_VERS 0x0405 -DrawCtx* sym_drawctxt_make( MPFORMAL CWindowGc* gc, CCoeEnv* aCoeEnv ); +DrawCtx* sym_drawctxt_make( MPFORMAL CWindowGc* gc, CCoeEnv* aCoeEnv, + CEikonEnv* aEikonEnv ); #endif diff --git a/symbian/inc/xptypes.h b/symbian/inc/xptypes.h index ffbd66cab..343c6a299 100644 --- a/symbian/inc/xptypes.h +++ b/symbian/inc/xptypes.h @@ -20,7 +20,7 @@ #ifndef _XPTYPES_H_ #define _XPTYPES_H_ -#include +#include /* #include */ diff --git a/symbian/inc/xwords.hrh b/symbian/inc/xwords.hrh index 057de5015..03c618626 100644 --- a/symbian/inc/xwords.hrh +++ b/symbian/inc/xwords.hrh @@ -51,6 +51,9 @@ enum TXWordsIds { ,XW_TOGGLEVALS_COMMAND ,EAskContents /* edit control in generic ask dlg */ + + ,EPage1 + ,EPage2 }; #endif // __XWORDS_HRH__ diff --git a/symbian/src/symdraw.cpp b/symbian/src/symdraw.cpp index 66ee0ef33..e8f8e354f 100644 --- a/symbian/src/symdraw.cpp +++ b/symbian/src/symdraw.cpp @@ -26,8 +26,16 @@ extern "C" { } // extern "C" -#include -#include +#if defined SERIES_60 +# include +# include +#elif defined SERIES_80 +# include +# include +#else +# error define a series platform!!!! +#endif + #include #include "symdraw.h" @@ -54,18 +62,28 @@ enum { COLOR_NCOLORS /* 12 */ }; +#ifdef SERIES_60 +# define CONST_60 const +#else +# define CONST_60 +#endif + typedef struct SymDrawCtxt { + /* Must be first */ DrawCtxVTable* vtable; + CWindowGc* iGC; + + CEikonEnv* iiEikonEnv; /* iEikonEnv is a macro in Symbian headers!!! */ CCoeEnv* iCoeEnv; CFbsBitmap* rightArrow; CFbsBitmap* downArrow; - CFont* iTileFaceFont; - CFont* iTileValueFont; - CFont* iBoardFont; - CFont* iScoreFont; + CONST_60 CFont* iTileFaceFont; + CONST_60 CFont* iTileValueFont; + CONST_60 CFont* iBoardFont; + CONST_60 CFont* iScoreFont; XP_U16 iTrayOwner; XP_Bool iTrayHasFocus; @@ -279,7 +297,7 @@ sym_draw_score_drawPlayer( DrawCtx* p_dctx, textToDesc( &tbuf, buf ); SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; - CFont* font = sctx->iScoreFont; + CONST_60 CFont* font = sctx->iScoreFont; sctx->iGC->UseFont( font ); TInt descent = font->DescentInPixels(); @@ -363,7 +381,7 @@ textInCell( SymDrawCtxt* sctx, XP_UCHAR* text, TRect* lRect, TBool highlight ) } sctx->iGC->SetPenStyle( CGraphicsContext::ESolidPen ); sctx->iGC->SetBrushStyle( CGraphicsContext::ENullBrush ); - CFont* font = sctx->iBoardFont; + CONST_60 CFont* font = sctx->iBoardFont; TBuf16<64> tbuf; textToDesc( &tbuf, text ); @@ -474,7 +492,7 @@ sym_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect, XP_UCHAR buf[4]; sprintf( (char*)buf, (const char*)"%d", (int)val ); - CFont* font = sctx->iTileValueFont; + CONST_60 CFont* font = sctx->iTileValueFont; sctx->iGC->UseFont( font ); TBuf8<5> tmpDesc((unsigned char*)buf); @@ -608,6 +626,7 @@ sym_draw_eraseMiniWindow( DrawCtx* p_dctx, XP_Rect* rect, static void figureFonts( SymDrawCtxt* sctx ) { +#if defined SERIES_80 XP_LOGF( "figureFonts" ); TBuf<128> fontName; CWsScreenDevice* sdev = sctx->iCoeEnv->ScreenDevice(); @@ -672,11 +691,21 @@ figureFonts( SymDrawCtxt* sctx ) sctx->iScoreFont = sctx->iTileFaceFont; } +#elif defined SERIES_60 + CCoeEnv* ce = sctx->iCoeEnv; + sctx->iTileFaceFont = ce->NormalFont(); + sctx->iTileValueFont = sctx->iiEikonEnv->DenseFont(); + sctx->iBoardFont = sctx->iiEikonEnv->LegendFont(); + sctx->iScoreFont = sctx->iiEikonEnv->TitleFont(); +#endif + XP_LOGF( "figureFonts done" ); } // figureFonts + DrawCtx* -sym_drawctxt_make( MPFORMAL CWindowGc* aGC, CCoeEnv* aCoeEnv ) +sym_drawctxt_make( MPFORMAL CWindowGc* aGC, CCoeEnv* aCoeEnv, + CEikonEnv* aEikonEnv ) { XP_LOGF( "in sym_drawctxt_make" ); SymDrawCtxt* sctx = (SymDrawCtxt*)XP_MALLOC( mpool, sizeof( *sctx ) ); @@ -688,6 +717,7 @@ sym_drawctxt_make( MPFORMAL CWindowGc* aGC, CCoeEnv* aCoeEnv ) MPASSIGN( sctx->mpool, mpool ); sctx->iGC = aGC; sctx->iCoeEnv = aCoeEnv; + sctx->iiEikonEnv = aEikonEnv; sctx->vtable = (DrawCtxVTable*)XP_MALLOC( mpool, sizeof(*sctx->vtable) ); if ( sctx->vtable != NULL ) { diff --git a/symbian/src/xwappui.cpp b/symbian/src/xwappui.cpp index dff40b091..ea7d4eff0 100644 --- a/symbian/src/xwappui.cpp +++ b/symbian/src/xwappui.cpp @@ -20,7 +20,12 @@ */ #include -#include +#if defined SERIES_60 +# include +# include +#elif defined SERIES_80 +# include +#endif #include "xwords.pan" #include "xwappui.h" diff --git a/symbian/src/xwappview.cpp b/symbian/src/xwappview.cpp index 1230b111c..baacda16f 100644 --- a/symbian/src/xwappview.cpp +++ b/symbian/src/xwappview.cpp @@ -19,14 +19,20 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include -#include +#if defined SERIES_60 +# include +# include +#elif defined SERIES_80 +# include +# include +# include +# include +#endif + +#include #include // for srand -#include +#include "xwords.rsg" #include "xwappview.h" #include "xwappui.h" @@ -99,8 +105,10 @@ void CXWordsAppView::ConstructL(const TRect& aRect) // Set the correct application view (Note: // ESkinAppViewWithCbaNoToolband is the default) +#if defined SERIES_80 //CknEnv::Skin().SetAppViewType(ESkinAppViewWithCbaNoToolband); CknEnv::Skin().SetAppViewType(ESkinAppViewNoCbaNoToolband); +#endif // This doesn't do what I want // SetExtentToWholeScreen(); @@ -128,7 +136,7 @@ void CXWordsAppView::ConstructL(const TRect& aRect) User::LeaveIfNull( iUtil.vtable ); SetUpUtil(); - iDraw = sym_drawctxt_make( MPPARM(mpool) &SystemGc(), iCoeEnv ); + iDraw = sym_drawctxt_make( MPPARM(mpool) &SystemGc(), iCoeEnv, iEikonEnv ); User::LeaveIfNull( iDraw ); InitGameL(); @@ -262,7 +270,11 @@ sym_util_userError( XW_UtilCtxt* uc, UtilErrID id ) _LIT(title,"Oops"); TBuf16<128> message; StringLoader::Load( message, resourceId ); +#if defined SERIES_60 + CEikInfoDialog::RunDlgLD( title, message ); +#elif defined SERIES_80 CCknInfoDialog::RunDlgLD( title, message ); +#endif } } // sym_util_userError @@ -506,6 +518,8 @@ CXWordsAppView::InitGameL() (TransportSend)NULL, this ); +#if defined SERIES_80 + /* Seems to be no equivalent in 60 land??? */ TFileName nameD; CEikFileOpenDialog* dictDlg = new(ELeave)CEikFileOpenDialog( &nameD ); XP_LOGF( "setting required type" ); @@ -522,6 +536,7 @@ CXWordsAppView::InitGameL() dict = sym_dictionary_makeL( MPPARM(mpool) &nameD ); } +#endif #ifdef STUBBED_DICT if ( !dict ) {