first checked in

This commit is contained in:
ehouse 2005-01-04 14:34:36 +00:00
parent ccee0fc65f
commit c97978911b
12 changed files with 766 additions and 0 deletions

View file

@ -0,0 +1,8 @@
XWORDS.DSP
XWORDS.opt
ABLD.BAT
XWORDS.plg
XWORDS.SUP.MAKE
XWORDS.DSW
XWORDS.DSP
XWORDS.UID.CPP

View file

@ -0,0 +1,60 @@
/*
* Copyright 2002-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.
*/
/* This is the symbian version of what's always been a palm file.
* There's probably a better way of doing this, but this is it for
* now.
*/
#ifndef _LOCALIZEDSTRINCLUDES_H_
#define _LOCALIZEDSTRINCLUDES_H_
enum {
STRD_REMAINING_TILES_ADD,
STRD_UNUSED_TILES_SUB,
STR_COMMIT_CONFIRM,
STR_BONUS_ALL,
STRD_TURN_SCORE,
STR_LOCAL_NAME,
STR_NONLOCAL_NAME,
STRD_TIME_PENALTY_SUB,
STRD_CUMULATIVE_SCORE,
STRS_TRAY_AT_START,
STRS_MOVE_DOWN,
STRS_MOVE_ACROSS,
STRS_NEW_TILES,
STRSS_TRADED_FOR,
STR_PASS,
STR_PHONY_REJECTED,
STRD_ROBOT_TRADED,
STR_ROBOT_MOVED,
STR_REMOTE_MOVED,
STR_PASSED,
STRSD_SUMMARYSCORED,
STRD_TRADED,
STR_LOSTTURN,
STRS_VALUES_HEADER,
STR_NOT_USED
};
#endif

View file

@ -0,0 +1,47 @@
/* -*-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.
*/
#ifndef _XWASKDLG_H_
#define _XWASKDLG_H_
extern "C" {
#include "comtypes.h"
#include "xwstream.h"
#include "mempool.h"
}
#include <e32base.h>
#include <eikdialg.h>
class CXWAskDlg : public CEikDialog
{
public:
CXWAskDlg( MPFORMAL XWStreamCtxt* aStream, TBool aKillStream );
~CXWAskDlg();
private:
TBool OkToExitL( TInt aKeyCode );
void PreLayoutDynInitL();
XWStreamCtxt* iStream;
TBool iKillStream;
MPSLOT
};
#endif

View file

@ -0,0 +1,34 @@
/* -*-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.
*/
#ifndef _SYMDICT_H_
#define _SYMDICT_H_
#include <cknenv.h>
extern "C" {
#include "comtypes.h"
#include "mempool.h"
}
DictionaryCtxt* sym_dictionary_makeL( MPFORMAL TFileName* nameD );
#endif

View file

@ -0,0 +1,39 @@
// -*-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.
*/
#ifndef _SYMDRAW_H_
#define _SYMDRAW_H_
extern "C" {
#include "draw.h"
#include "board.h"
} /* extern "C" */
#define scaleBoardV 13
#define scaleBoardH 15
#define scaleTrayV 37
#define scaleTrayH 32
#define CUR_PREFS_VERS 0x0405
DrawCtx* sym_drawctxt_make( MPFORMAL CWindowGc* gc, CCoeEnv* aCoeEnv );
#endif

View file

@ -0,0 +1,132 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 1999-2004 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.
*/
#ifndef _XPTYPES_H_
#define _XPTYPES_H_
#include <E32DEF.H>
/* #include <coeccntx.h> */
/* #include <eikenv.h> */
/* #include <eikappui.h> */
/* #include <eikapp.h> */
/* #include <eikdoc.h> */
/* #include <eikmenup.h> */
/* #include <eikon.hrh> */
#ifdef CPLUS
extern "C" {
#endif
#define XP_TRUE ((XP_Bool)(1==1))
#define XP_FALSE ((XP_Bool)(1==0))
typedef TUint16 XP_U16;
typedef TInt16 XP_S16;
typedef TUint32 XP_U32;
typedef TInt32 XP_S32;
typedef TUint8 XP_U8;
typedef TInt8 XP_S8;
typedef unsigned char XP_UCHAR;
//typedef TText XP_UCHAR; /* native two-byte char */
typedef signed short XP_FontCode; /* not sure how I'm using this yet */
typedef TBool XP_Bool;
typedef XP_U32 XP_Time;
#define XP_CR "\n"
#ifndef DEBUG
void p_ignore( ... );
#endif
void sym_debugf( char* aFmt, ...);
int sym_snprintf( XP_UCHAR* buf, XP_U16 len, const XP_UCHAR* format, ... );
XP_U32 sym_flip_long( unsigned long l );
XP_U16 sym_flip_short(unsigned short s);
void* sym_malloc(XP_U32 nbytes );
void* sym_realloc(void* p, XP_U32 nbytes);
void sym_free( void* p );
void sym_assert(XP_Bool b, XP_U32 line, const char* file );
void sym_memset( void* dest, XP_UCHAR val, XP_U32 nBytes );
XP_S16 sym_strcmp( XP_UCHAR* str1, XP_UCHAR* str2 );
XP_U32 sym_strlen( XP_UCHAR* str );
XP_S16 sym_strncmp( XP_UCHAR* str1, XP_UCHAR* str2, XP_U32 len );
void sym_memcpy( void* dest, void* src, XP_U32 nbytes );
XP_S16 sym_memcmp( void* m1, void* m2, XP_U32 nbytes );
char* sym_strcat( XP_UCHAR* dest, const XP_UCHAR* src );
#define XP_RANDOM() rand()
#ifdef MEM_DEBUG
# define XP_PLATMALLOC(nbytes) sym_malloc(nbytes)
# define XP_PLATREALLOC(p,s) sym_realloc((p), (s))
# define XP_PLATFREE(p) sym_free(p)
#else
# define XP_MALLOC(pool, nbytes) sym_malloc(nbytes)
# define XP_REALLOC(pool, p, bytes) sym_realloc((p), (bytes))
# define XP_FREE(pool, p) sym_free(p)
#endif
#define XP_MEMSET(src, val, nbytes) \
sym_memset( (src), (val), (nbytes) )
#define XP_MEMCPY(d,s,l) sym_memcpy((d),(s),(l))
#define XP_MEMCMP( a1, a2, l ) sym_memcmp( (a1),(a2),(l))
#define XP_STRLEN(s) sym_strlen((unsigned char*)(s))
#define XP_STRCMP(s1,s2) sym_strcmp((char*)(s1),(char*)(s2))
#define XP_STRNCMP(s1,s2,l) sym_strncmp((char*)(s1),(char*)(s2),(l))
#define XP_STRCAT(d,s) sym_strcat((d),(s))
#define XP_SNPRINTF sym_snprintf
#define XP_MIN(a,b) ((a)<(b)?(a):(b))
#define XP_MAX(a,b) ((a)>(b)?(a):(b))
#ifdef DEBUG
#define XP_ASSERT(b) sym_assert((XP_Bool)(b), __LINE__, __FILE__ )
#else
#define XP_ASSERT(b)
#endif
#define XP_STATUSF XP_DEBUGF
#define XP_WARNF XP_DEBUGF
#ifdef DEBUG
# define XP_LOGF sym_debugf
# define XP_DEBUGF sym_debugf
#else
# define XP_LOGF if(0)p_ignore
# define XP_DEBUGF if(0)p_ignore
#endif
#define XP_NTOHL(l) sym_flip_long(l)
#define XP_NTOHS(s) sym_flip_short(s)
#define XP_HTONL(l) sym_flip_long(l)
#define XP_HTONS(s) sym_flip_short(s)
#ifdef CPLUS
}
#endif
#endif

View file

@ -0,0 +1,46 @@
/* -*-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.
*/
#ifndef __XWAPP_H__
#define __XWAPP_H__
#include <eikapp.h>
/*!
@class CXWordsApplication
*/
class CXWordsApplication : public CEikApplication
{
public: // from CEikApplication
/*!
@function AppDllUid
*/
TUid AppDllUid() const;
protected: // from CEikApplication
/*!
@function CreateDocumentL
*/
CApaDocument* CreateDocumentL();
};
#endif // __XWAPP_H__

View file

@ -0,0 +1,72 @@
/* -*-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.
*/
#ifndef _XWAPPUI_H_
#define _XWAPPUI_H_
#include <eikappui.h>
// Forward reference
class CXWordsAppView;
/*!
@class CXWordsAppUi
@discussion An instance of class CXWordsAppUi is the UserInterface
part of the Eikon application framework for XWords.
*/
class CXWordsAppUi : public CEikAppUi
{
public:
/*!
@function ConstructL
*/
void ConstructL();
/*!
@function CXWordsAppUi
*/
CXWordsAppUi();
/*!
@function ~CXWordsAppUi
@discussion Destroy the object and release all memory objects
*/
~CXWordsAppUi();
public: // from CEikAppUi
/*!
@function HandleCommandL
*/
void HandleCommandL( TInt aCommand );
TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent,
TEventCode aType );
private:
/*! @var iAppView The application view */
CXWordsAppView* iAppView;
};
#endif // _XWAPPUI_H_

View file

@ -0,0 +1,135 @@
/* -*-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.
*/
#ifndef _XWORDSAPPVIEW_H_
#define _XWORDSAPPVIEW_H_
#include <eikbctrl.h>
#include "game.h"
#include "symdraw.h"
/*!
@class CXWordsAppView
@discussion This is the main view for Crosswords. Owns all the
common-code-created objects, passes events to them, etc. Should be
the only sample code file modified to any significant degree.
*/
//class CXWordsAppView : public CEikBorderedControl // ( which : CCoeControl )
class CXWordsAppView : public CCoeControl
{
public:
/*!
@function NewL
@discussion Create a CXWordsAppView object, which will draw itself to aRect
@param aRect the rectangle this view will be drawn to
@result a pointer to the created instance of CXWordsAppView
*/
static CXWordsAppView* NewL(const TRect& aRect);
/*!
@function NewLC
@discussion Create a CXWordsAppView object, which will draw itself to aRect
@param aRect the rectangle this view will be drawn to
@result a pointer to the created instance of CXWordsAppView
*/
static CXWordsAppView* NewLC(const TRect& aRect);
/*!
@function ~CXWordsAppView
@discussion Destroy the object and release all memory objects
*/
~CXWordsAppView();
public: // from CEikBorderedControl
/*!
@function Draw
@discussion Draw this CXWordsAppView to the screen
@param aRect the rectangle of this view that needs updating
*/
void Draw(const TRect& aRect) const;
private:
/*!
@function ConstructL
@discussion Perform the second phase construction of a CXWordsAppView object
@param aRect the rectangle this view will be drawn to
*/
void ConstructL(const TRect& aRect);
/*!
@function CXWordsAppView
@discussion Perform the first phase of two phase construction
*/
CXWordsAppView();
/* Added by eeh */
public:
int HandleCommand( TInt aCommand );
TBool HandleKeyEvent( const TKeyEvent& aKeyEvent );
void RunAlert( TInt resourceID );
private:
/* open game from prefs or start a new one. */
void InitGameL();
void DeleteGame();
void SetUpUtil();
void PositionBoard();
static void sym_util_requestTime( XW_UtilCtxt* uc );
static VTableMgr* sym_util_getVTManager( XW_UtilCtxt* uc );
static XP_U32 sym_util_getCurSeconds( XW_UtilCtxt* uc );
static TInt TimerCallback( TAny* aThis );
CurGameInfo iGi;
CommonPrefs iCp;
XW_UtilCtxt iUtil;
XWGame iGame;
DrawCtx* iDraw;
XP_Bool iBoardPosInval;
VTableMgr* iVtMgr;
TTime iStartTime;
TInt iTimerRunCount;
CIdle* iRequestTimer;
MPSLOT
};
#endif // _XWORDSAPPVIEW_H_

100
xwords4/symbian/inc/xwdoc.h Normal file
View file

@ -0,0 +1,100 @@
/* -*-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.
*/
#ifndef __XWDOC_H__
#define __XWDOC_H__
#include <eikdoc.h>
// Forward references
class CXWordsAppUi;
class CEikApplication;
/*!
@class CXWordsDocument
@discussion An instance of class CXWordsDocument is the Document part of the
Eikon application framework for the XWords example application
*/
class CXWordsDocument : public CEikDocument
{
public:
/*!
@function NewL
@discussion Construct a CXWordsDocument for the Eikon
application aApp using two phase construction, and return a
pointer to the created object @param aApp application creating
this document @result a pointer to the created instance of
CXWordsDocument
*/
static CXWordsDocument* NewL(CEikApplication& aApp);
/*!
@function NewLC
@discussion Construct a CXWordsDocument for the Eikon
application aApp using two phase construction, and return a
pointer to the created object @param aApp application creating
this document @result a pointer to the created instance of
CXWordsDocument
*/
static CXWordsDocument* NewLC(CEikApplication& aApp);
/*!
@function ~CXWordsDocument
@discussion Destroy the object and release all memory objects
*/
~CXWordsDocument();
public: // from CEikDocument
/*!
@function CreateAppUiL
@discussion Create a CXWordsAppUi object and return a
pointer to it @result a pointer to the created instance of the
AppUi created
*/
CEikAppUi* CreateAppUiL();
private:
/*!
@function ConstructL
@discussion Perform the second phase construction of a
CXWordsDocument object
*/
void ConstructL();
/*!
@function CXWordsDocument
@discussion Perform the first phase of two phase construction
@param aApp application creating this document
*/
CXWordsDocument(CEikApplication& aApp);
};
#endif //__XWDOC_H__

View file

@ -0,0 +1,56 @@
/* -*-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.
*/
#ifndef __XWORDS_HRH__
#define __XWORDS_HRH__
// HelloWorldBasic enumerate command codes
enum TXWordsIds {
XW_TIMEREQ_COMMAND = 0x6000 // convention is for >= 0x6000 -- they say
,XW_NEWGAME_COMMAND
,XW_SAVEDGAMES_COMMAND
,XW_PREFS_COMMAND
,XW_ABOUT_COMMAND
,XW_VALUES_COMMAND
,XW_REMAIN_COMMAND
,XW_CURINFO_COMMAND
,XW_HISTORY_COMMAND
,XW_FINALSCORES_COMMAND
,XW_HINT_COMMAND
/* #ifdef XWFEATURE_SEARCHLIMIT */
/* ,XW_LIMHINT_COMMAND */
/* #endif */
,XW_NEXTHINT_COMMAND
,XW_UNDOCUR_COMMAND
,XW_UNDOLAST_COMMAND
,XW_DONE_COMMAND
,XW_JUGGLE_COMMAND
,XW_TRADE_COMMAND
,XW_HIDETRAY_COMMAND
,XW_FLIP_COMMAND
,XW_TOGGLEVALS_COMMAND
,EAskContents /* edit control in generic ask dlg */
};
#endif // __XWORDS_HRH__

View file

@ -0,0 +1,37 @@
/* -*-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.
*/
#ifndef __XWORDS_PAN__
#define __XWORDS_PAN__
/** XWords application panic codes */
enum TXwordsPanics {
EXWordsUi = 1
// add further panics here
};
inline void Panic(TXwordsPanics aReason)
{
_LIT(applicationName,"Crosswords");
User::Panic(applicationName, aReason);
}
#endif // __XWORDS_PAN__