Fix to compile for series 60 under Linux. Completely untested!

This commit is contained in:
ehouse 2005-01-07 11:06:54 +00:00
parent a2f4eb4b31
commit 0161e02f54
8 changed files with 89 additions and 21 deletions

View file

@ -225,7 +225,9 @@ RESOURCE TBUF64 r_confirm_end_game {
RESOURCE DIALOG r_xwords_confirmation_query RESOURCE DIALOG r_xwords_confirmation_query
{ {
title = "Query"; title = "Query";
#if defined SERIES_80
buttons = R_EIK_BUTTONS_NO_YES; buttons = R_EIK_BUTTONS_NO_YES;
#endif
flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc; flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc;
items = items =
{ {
@ -241,7 +243,9 @@ RESOURCE DIALOG r_xwords_confirmation_query
RESOURCE DIALOG r_xwords_info_only RESOURCE DIALOG r_xwords_info_only
{ {
title = "Info"; title = "Info";
#if defined SERIES_80
buttons = R_EIK_BUTTONS_CONTINUE; buttons = R_EIK_BUTTONS_CONTINUE;
#endif
flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc; flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc;
items = items =
{ {
@ -308,7 +312,9 @@ RESOURCE ARRAY r_xwords_newgame_pages
RESOURCE DIALOG r_xwords_newgame_dlg RESOURCE DIALOG r_xwords_newgame_dlg
{ {
title = "Game info"; title = "Game info";
#if defined SERIES_80
buttons = R_EIK_BUTTONS_CANCEL_OK; buttons = R_EIK_BUTTONS_CANCEL_OK;
#endif
flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc; flags = EEikDialogFlagWait | EEikDialogFlagNotifyEsc;
pages = r_xwords_newgame_pages; pages = r_xwords_newgame_pages;
} }

View file

@ -20,7 +20,10 @@
#ifndef _SYMDICT_H_ #ifndef _SYMDICT_H_
#define _SYMDICT_H_ #define _SYMDICT_H_
#include <cknenv.h> #if defined SERIES_60
#elif defined SERIES_80
# include <cknenv.h>
#endif
extern "C" { extern "C" {
#include "comtypes.h" #include "comtypes.h"

View file

@ -27,6 +27,11 @@ extern "C" {
} /* extern "C" */ } /* extern "C" */
#if defined SERIES_60
# include <coemain.h>
# include <aknenv.h>
#endif
#define scaleBoardV 13 #define scaleBoardV 13
#define scaleBoardH 15 #define scaleBoardH 15
#define scaleTrayV 37 #define scaleTrayV 37
@ -34,6 +39,7 @@ extern "C" {
#define CUR_PREFS_VERS 0x0405 #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 #endif

View file

@ -20,7 +20,7 @@
#ifndef _XPTYPES_H_ #ifndef _XPTYPES_H_
#define _XPTYPES_H_ #define _XPTYPES_H_
#include <E32DEF.H> #include <e32def.h>
/* #include <coeccntx.h> */ /* #include <coeccntx.h> */

View file

@ -51,6 +51,9 @@ enum TXWordsIds {
,XW_TOGGLEVALS_COMMAND ,XW_TOGGLEVALS_COMMAND
,EAskContents /* edit control in generic ask dlg */ ,EAskContents /* edit control in generic ask dlg */
,EPage1
,EPage2
}; };
#endif // __XWORDS_HRH__ #endif // __XWORDS_HRH__

View file

@ -26,8 +26,16 @@ extern "C" {
} // extern "C" } // extern "C"
#include <cknenv.h> #if defined SERIES_60
#include <coemain.h> # include <w32std.h>
# include <eikenv.h>
#elif defined SERIES_80
# include <cknenv.h>
# include <coemain.h>
#else
# error define a series platform!!!!
#endif
#include <stdio.h> #include <stdio.h>
#include "symdraw.h" #include "symdraw.h"
@ -54,18 +62,28 @@ enum {
COLOR_NCOLORS /* 12 */ COLOR_NCOLORS /* 12 */
}; };
#ifdef SERIES_60
# define CONST_60 const
#else
# define CONST_60
#endif
typedef struct SymDrawCtxt { typedef struct SymDrawCtxt {
/* Must be first */
DrawCtxVTable* vtable; DrawCtxVTable* vtable;
CWindowGc* iGC; CWindowGc* iGC;
CEikonEnv* iiEikonEnv; /* iEikonEnv is a macro in Symbian headers!!! */
CCoeEnv* iCoeEnv; CCoeEnv* iCoeEnv;
CFbsBitmap* rightArrow; CFbsBitmap* rightArrow;
CFbsBitmap* downArrow; CFbsBitmap* downArrow;
CFont* iTileFaceFont; CONST_60 CFont* iTileFaceFont;
CFont* iTileValueFont; CONST_60 CFont* iTileValueFont;
CFont* iBoardFont; CONST_60 CFont* iBoardFont;
CFont* iScoreFont; CONST_60 CFont* iScoreFont;
XP_U16 iTrayOwner; XP_U16 iTrayOwner;
XP_Bool iTrayHasFocus; XP_Bool iTrayHasFocus;
@ -279,7 +297,7 @@ sym_draw_score_drawPlayer( DrawCtx* p_dctx,
textToDesc( &tbuf, buf ); textToDesc( &tbuf, buf );
SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx; SymDrawCtxt* sctx = (SymDrawCtxt*)p_dctx;
CFont* font = sctx->iScoreFont; CONST_60 CFont* font = sctx->iScoreFont;
sctx->iGC->UseFont( font ); sctx->iGC->UseFont( font );
TInt descent = font->DescentInPixels(); 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->SetPenStyle( CGraphicsContext::ESolidPen );
sctx->iGC->SetBrushStyle( CGraphicsContext::ENullBrush ); sctx->iGC->SetBrushStyle( CGraphicsContext::ENullBrush );
CFont* font = sctx->iBoardFont; CONST_60 CFont* font = sctx->iBoardFont;
TBuf16<64> tbuf; TBuf16<64> tbuf;
textToDesc( &tbuf, text ); textToDesc( &tbuf, text );
@ -474,7 +492,7 @@ sym_draw_drawTile( DrawCtx* p_dctx, XP_Rect* rect,
XP_UCHAR buf[4]; XP_UCHAR buf[4];
sprintf( (char*)buf, (const char*)"%d", (int)val ); sprintf( (char*)buf, (const char*)"%d", (int)val );
CFont* font = sctx->iTileValueFont; CONST_60 CFont* font = sctx->iTileValueFont;
sctx->iGC->UseFont( font ); sctx->iGC->UseFont( font );
TBuf8<5> tmpDesc((unsigned char*)buf); TBuf8<5> tmpDesc((unsigned char*)buf);
@ -608,6 +626,7 @@ sym_draw_eraseMiniWindow( DrawCtx* p_dctx, XP_Rect* rect,
static void static void
figureFonts( SymDrawCtxt* sctx ) figureFonts( SymDrawCtxt* sctx )
{ {
#if defined SERIES_80
XP_LOGF( "figureFonts" ); XP_LOGF( "figureFonts" );
TBuf<128> fontName; TBuf<128> fontName;
CWsScreenDevice* sdev = sctx->iCoeEnv->ScreenDevice(); CWsScreenDevice* sdev = sctx->iCoeEnv->ScreenDevice();
@ -672,11 +691,21 @@ figureFonts( SymDrawCtxt* sctx )
sctx->iScoreFont = sctx->iTileFaceFont; 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" ); XP_LOGF( "figureFonts done" );
} // figureFonts } // figureFonts
DrawCtx* 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" ); XP_LOGF( "in sym_drawctxt_make" );
SymDrawCtxt* sctx = (SymDrawCtxt*)XP_MALLOC( mpool, sizeof( *sctx ) ); SymDrawCtxt* sctx = (SymDrawCtxt*)XP_MALLOC( mpool, sizeof( *sctx ) );
@ -688,6 +717,7 @@ sym_drawctxt_make( MPFORMAL CWindowGc* aGC, CCoeEnv* aCoeEnv )
MPASSIGN( sctx->mpool, mpool ); MPASSIGN( sctx->mpool, mpool );
sctx->iGC = aGC; sctx->iGC = aGC;
sctx->iCoeEnv = aCoeEnv; sctx->iCoeEnv = aCoeEnv;
sctx->iiEikonEnv = aEikonEnv;
sctx->vtable = (DrawCtxVTable*)XP_MALLOC( mpool, sizeof(*sctx->vtable) ); sctx->vtable = (DrawCtxVTable*)XP_MALLOC( mpool, sizeof(*sctx->vtable) );
if ( sctx->vtable != NULL ) { if ( sctx->vtable != NULL ) {

View file

@ -20,7 +20,12 @@
*/ */
#include <eikenv.h> #include <eikenv.h>
#include <ckninfo.h> #if defined SERIES_60
# include <w32std.h>
# include <eikinfo.h>
#elif defined SERIES_80
# include <ckninfo.h>
#endif
#include "xwords.pan" #include "xwords.pan"
#include "xwappui.h" #include "xwappui.h"

View file

@ -19,14 +19,20 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include <cknenv.h> #if defined SERIES_60
#include <ckninfo.h> # include <w32std.h>
#include <StringLoader.h> # include <eikinfo.h>
#include <eikcfdlg.h> #elif defined SERIES_80
#include <eikfile.rsg> # include <cknenv.h>
# include <ckninfo.h>
# include <eikcfdlg.h>
# include <eikfile.rsg>
#endif
#include <stringloader.h>
#include <stdlib.h> // for srand #include <stdlib.h> // for srand
#include <xwords.rsg> #include "xwords.rsg"
#include "xwappview.h" #include "xwappview.h"
#include "xwappui.h" #include "xwappui.h"
@ -99,8 +105,10 @@ void CXWordsAppView::ConstructL(const TRect& aRect)
// Set the correct application view (Note: // Set the correct application view (Note:
// ESkinAppViewWithCbaNoToolband is the default) // ESkinAppViewWithCbaNoToolband is the default)
#if defined SERIES_80
//CknEnv::Skin().SetAppViewType(ESkinAppViewWithCbaNoToolband); //CknEnv::Skin().SetAppViewType(ESkinAppViewWithCbaNoToolband);
CknEnv::Skin().SetAppViewType(ESkinAppViewNoCbaNoToolband); CknEnv::Skin().SetAppViewType(ESkinAppViewNoCbaNoToolband);
#endif
// This doesn't do what I want // This doesn't do what I want
// SetExtentToWholeScreen(); // SetExtentToWholeScreen();
@ -128,7 +136,7 @@ void CXWordsAppView::ConstructL(const TRect& aRect)
User::LeaveIfNull( iUtil.vtable ); User::LeaveIfNull( iUtil.vtable );
SetUpUtil(); SetUpUtil();
iDraw = sym_drawctxt_make( MPPARM(mpool) &SystemGc(), iCoeEnv ); iDraw = sym_drawctxt_make( MPPARM(mpool) &SystemGc(), iCoeEnv, iEikonEnv );
User::LeaveIfNull( iDraw ); User::LeaveIfNull( iDraw );
InitGameL(); InitGameL();
@ -262,7 +270,11 @@ sym_util_userError( XW_UtilCtxt* uc, UtilErrID id )
_LIT(title,"Oops"); _LIT(title,"Oops");
TBuf16<128> message; TBuf16<128> message;
StringLoader::Load( message, resourceId ); StringLoader::Load( message, resourceId );
#if defined SERIES_60
CEikInfoDialog::RunDlgLD( title, message );
#elif defined SERIES_80
CCknInfoDialog::RunDlgLD( title, message ); CCknInfoDialog::RunDlgLD( title, message );
#endif
} }
} // sym_util_userError } // sym_util_userError
@ -506,6 +518,8 @@ CXWordsAppView::InitGameL()
(TransportSend)NULL, this ); (TransportSend)NULL, this );
#if defined SERIES_80
/* Seems to be no equivalent in 60 land??? */
TFileName nameD; TFileName nameD;
CEikFileOpenDialog* dictDlg = new(ELeave)CEikFileOpenDialog( &nameD ); CEikFileOpenDialog* dictDlg = new(ELeave)CEikFileOpenDialog( &nameD );
XP_LOGF( "setting required type" ); XP_LOGF( "setting required type" );
@ -522,6 +536,7 @@ CXWordsAppView::InitGameL()
dict = sym_dictionary_makeL( MPPARM(mpool) &nameD ); dict = sym_dictionary_makeL( MPPARM(mpool) &nameD );
} }
#endif
#ifdef STUBBED_DICT #ifdef STUBBED_DICT
if ( !dict ) { if ( !dict ) {