2003-11-20 17:26:35 +01:00
|
|
|
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
|
|
|
|
/*
|
2009-01-05 15:13:40 +01:00
|
|
|
* Copyright 2000-2009 by Eric House (xwords@eehouse.org). All rights reserved.
|
2003-11-20 17:26:35 +01:00
|
|
|
*
|
|
|
|
* 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 _CEMAIN_H_
|
|
|
|
#define _CEMAIN_H_
|
|
|
|
|
2006-02-17 08:30:54 +01:00
|
|
|
#ifdef _WIN32_WCE
|
2005-11-27 21:17:09 +01:00
|
|
|
# include <aygshell.h>
|
|
|
|
#endif
|
2003-11-20 17:26:35 +01:00
|
|
|
#include "draw.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "mempool.h"
|
2004-03-28 03:14:34 +02:00
|
|
|
|
2008-10-29 09:46:02 +01:00
|
|
|
#define LCROSSWORDS_DIR_NODBG L"Crosswords"
|
2008-11-08 17:25:49 +01:00
|
|
|
#define CE_GAMEFILE_VERSION1 0x01 /* means draw gets to save/restore */
|
|
|
|
#define CE_GAMEFILE_VERSION2 0x02 /* save/restore includes width */
|
|
|
|
#define CE_GAMEFILE_VERSION CE_GAMEFILE_VERSION2
|
2008-10-24 10:36:44 +02:00
|
|
|
#ifdef DEBUG
|
|
|
|
# define CROSSWORDS_DIR "Cross_dbg"
|
|
|
|
# define LCROSSWORDS_DIR L"Cross_dbg"
|
|
|
|
#else
|
|
|
|
# define CROSSWORDS_DIR "Crosswords"
|
2008-10-29 09:46:02 +01:00
|
|
|
# define LCROSSWORDS_DIR LCROSSWORDS_DIR_NODBG
|
2008-10-24 10:36:44 +02:00
|
|
|
#endif
|
2008-09-10 14:18:30 +02:00
|
|
|
|
2008-02-16 18:36:46 +01:00
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
typedef enum {
|
|
|
|
WINCE_UNKNOWN
|
2008-03-15 16:39:58 +01:00
|
|
|
, WINCE_PPC_V1
|
2008-02-16 18:36:46 +01:00
|
|
|
, WINCE_PPC_2003
|
|
|
|
, WINCE_PPC_2005
|
2008-03-15 16:39:58 +01:00
|
|
|
, _LAST_PPC /* so can test for PPC */
|
|
|
|
, WINCE_SMARTPHONE_V1
|
|
|
|
, WINCE_SMARTPHONE_2003
|
|
|
|
, WINCE_SMARTPHONE_2005
|
2008-02-16 18:36:46 +01:00
|
|
|
} XW_WinceVersion;
|
2008-03-15 19:32:22 +01:00
|
|
|
|
|
|
|
# define IS_SMARTPHONE(g) ((g)->winceVersion > _LAST_PPC)
|
2008-03-15 22:56:37 +01:00
|
|
|
#else
|
2008-08-27 14:16:33 +02:00
|
|
|
# define IS_SMARTPHONE(g) ((g) != (g)) /* make compiler warnings go away */
|
2008-02-16 18:36:46 +01:00
|
|
|
#endif
|
|
|
|
|
2008-12-02 14:47:18 +01:00
|
|
|
enum { CE_BONUS0_COLOR,
|
|
|
|
CE_BONUS1_COLOR,
|
2007-01-19 07:43:52 +01:00
|
|
|
CE_BONUS2_COLOR,
|
|
|
|
CE_BONUS3_COLOR,
|
2004-03-28 03:14:34 +02:00
|
|
|
|
2007-01-19 07:43:52 +01:00
|
|
|
CE_BKG_COLOR,
|
|
|
|
CE_TILEBACK_COLOR,
|
2004-03-28 03:14:34 +02:00
|
|
|
|
2007-01-19 09:24:02 +01:00
|
|
|
CE_FOCUS_COLOR,
|
|
|
|
|
2008-12-02 14:47:18 +01:00
|
|
|
CE_PLAYER0_COLOR,
|
|
|
|
CE_PLAYER1_COLOR,
|
|
|
|
CE_PLAYER2_COLOR,
|
|
|
|
CE_PLAYER3_COLOR,
|
2004-03-28 03:14:34 +02:00
|
|
|
|
2007-01-19 07:43:52 +01:00
|
|
|
CE_BLACK_COLOR, /* not editable by users */
|
|
|
|
CE_WHITE_COLOR,
|
2004-03-28 03:14:34 +02:00
|
|
|
|
2007-01-19 07:43:52 +01:00
|
|
|
CE_NUM_COLORS /* last */
|
2004-03-28 03:14:34 +02:00
|
|
|
};
|
|
|
|
|
2008-02-17 22:48:48 +01:00
|
|
|
#define CUR_CE_PREFS_FLAGS 0x0003 /* adds CE_FOCUS_COLOR */
|
|
|
|
|
2008-02-23 23:06:05 +01:00
|
|
|
/* This is what CEAppPrefs looked like for CUR_CE_PREFS_FLAGS == 0x0002 */
|
|
|
|
typedef struct CEAppPrefs0002 {
|
|
|
|
XP_U16 versionFlags;
|
|
|
|
CommonPrefs cp;
|
|
|
|
COLORREF colors[12]; /* CE_FOCUS_COLOR wasn't there */
|
|
|
|
XP_Bool showColors;
|
|
|
|
} CEAppPrefs0002;
|
|
|
|
|
2003-11-20 17:26:35 +01:00
|
|
|
typedef struct CEAppPrefs {
|
|
|
|
XP_U16 versionFlags;
|
|
|
|
CommonPrefs cp;
|
2007-01-19 07:43:52 +01:00
|
|
|
COLORREF colors[CE_NUM_COLORS];
|
2003-11-20 17:26:35 +01:00
|
|
|
XP_Bool showColors;
|
2008-02-16 18:36:46 +01:00
|
|
|
XP_Bool fullScreen;
|
2003-11-20 17:26:35 +01:00
|
|
|
} CEAppPrefs;
|
|
|
|
|
2008-09-09 14:31:02 +02:00
|
|
|
enum { OWNED_RECT_LEFT
|
|
|
|
,OWNED_RECT_RIGHT
|
2008-10-08 06:42:16 +02:00
|
|
|
,OWNED_RECT_TOP
|
|
|
|
,OWNED_RECT_BOTTOM
|
2008-09-09 14:31:02 +02:00
|
|
|
,N_OWNED_RECTS
|
|
|
|
};
|
2003-11-20 17:26:35 +01:00
|
|
|
|
2008-10-29 09:46:02 +01:00
|
|
|
enum {
|
|
|
|
MY_DOCS_CACHE,
|
|
|
|
PROGFILES_CACHE,
|
|
|
|
N_CACHED_PATHS
|
|
|
|
};
|
|
|
|
|
2009-01-31 19:06:09 +01:00
|
|
|
typedef struct _CEAppGlobals {
|
2003-11-20 17:26:35 +01:00
|
|
|
HINSTANCE hInst;
|
|
|
|
HDC hdc; /* to pass drawing ctxt to draw code */
|
|
|
|
HWND hWnd;
|
2006-02-17 08:30:54 +01:00
|
|
|
#ifdef _WIN32_WCE
|
2008-11-22 17:43:55 +01:00
|
|
|
HWND hwndCB;
|
2004-12-17 08:24:52 +01:00
|
|
|
SHACTIVATEINFO sai;
|
2008-02-16 18:36:46 +01:00
|
|
|
XW_WinceVersion winceVersion;
|
2008-03-10 02:47:46 +01:00
|
|
|
#else
|
|
|
|
/* Store location of dummy button */
|
|
|
|
HMENU dummyMenu;
|
|
|
|
XP_U16 dummyPos;
|
|
|
|
#endif
|
2008-02-26 14:49:41 +01:00
|
|
|
|
2008-08-27 14:38:01 +02:00
|
|
|
XP_U16 softKeyId; /* id of item now on left button */
|
2008-11-10 19:49:26 +01:00
|
|
|
#ifndef _WIN32_WCE
|
|
|
|
HMENU softKeyMenu; /* so can check/uncheck duplicated items */
|
|
|
|
#endif
|
2004-12-17 08:24:52 +01:00
|
|
|
|
2008-09-01 17:10:28 +02:00
|
|
|
struct CEDrawCtx* draw;
|
2003-11-20 17:26:35 +01:00
|
|
|
XWGame game;
|
|
|
|
CurGameInfo gameInfo;
|
|
|
|
XP_UCHAR* curGameName; /* path to storage for current game */
|
|
|
|
XW_UtilCtxt util;
|
|
|
|
VTableMgr* vtMgr;
|
2004-01-29 05:45:53 +01:00
|
|
|
XP_U16* bonusInfo;
|
2003-11-20 17:26:35 +01:00
|
|
|
|
2005-08-21 16:05:29 +02:00
|
|
|
XP_U32 timerIDs[NUM_TIMERS_PLUS_ONE];
|
2007-05-26 16:14:01 +02:00
|
|
|
XWTimerProc timerProcs[NUM_TIMERS_PLUS_ONE];
|
2005-08-21 16:05:29 +02:00
|
|
|
void* timerClosures[NUM_TIMERS_PLUS_ONE];
|
2008-02-16 18:36:46 +01:00
|
|
|
XP_U32 timerWhens[NUM_TIMERS_PLUS_ONE];
|
2004-06-16 06:16:22 +02:00
|
|
|
|
2008-09-09 14:31:02 +02:00
|
|
|
RECT ownedRects[N_OWNED_RECTS];
|
|
|
|
|
2006-05-05 14:51:08 +02:00
|
|
|
XP_U16 flags; /* bits defined below */
|
2008-09-28 19:50:04 +02:00
|
|
|
XP_U16 cellHt; /* how tall is a cell given current layout */
|
2006-05-05 14:51:08 +02:00
|
|
|
|
2005-02-05 22:38:04 +01:00
|
|
|
#ifdef CEFEATURE_CANSCROLL
|
|
|
|
HWND scrollHandle;
|
2008-09-28 19:50:04 +02:00
|
|
|
WNDPROC oldScrollProc;
|
2008-10-07 06:00:37 +02:00
|
|
|
#ifdef _WIN32_WCE
|
2008-10-01 10:31:43 +02:00
|
|
|
RECT scrollRects[2]; /* above and below the scroller */
|
2008-10-07 06:00:37 +02:00
|
|
|
#endif
|
2008-10-01 10:31:43 +02:00
|
|
|
XP_Bool scrollerHasFocus;
|
2005-02-05 22:38:04 +01:00
|
|
|
#endif
|
2008-10-31 05:36:44 +01:00
|
|
|
#ifdef KEYBOARD_NAV
|
|
|
|
XP_Bool keyDown;
|
|
|
|
#endif
|
2009-01-31 19:06:09 +01:00
|
|
|
struct CeSocketWrapper* socketWrap;
|
2005-07-30 04:02:49 +02:00
|
|
|
|
2003-11-20 17:26:35 +01:00
|
|
|
CEAppPrefs appPrefs;
|
|
|
|
|
|
|
|
XP_Bool isNewGame;
|
|
|
|
XP_Bool penDown;
|
|
|
|
XP_Bool hintPending;
|
|
|
|
XP_Bool doGlobalPrefs;
|
2006-05-27 19:18:42 +02:00
|
|
|
|
2008-11-10 19:49:26 +01:00
|
|
|
#ifndef _WIN32_WCE
|
|
|
|
XP_U16 dbWidth, dbHeight;
|
2006-05-27 19:18:42 +02:00
|
|
|
#endif
|
2003-11-20 17:26:35 +01:00
|
|
|
|
2008-10-29 09:46:02 +01:00
|
|
|
wchar_t* specialDirs[N_CACHED_PATHS]; /* reserved for ceGetPath() */
|
2008-10-25 20:08:36 +02:00
|
|
|
|
2004-07-10 19:43:15 +02:00
|
|
|
#ifdef XWFEATURE_SEARCHLIMIT
|
|
|
|
XP_Bool askTrayLimits;
|
|
|
|
#endif
|
2003-11-20 17:26:35 +01:00
|
|
|
MPSLOT
|
|
|
|
|
|
|
|
} CEAppGlobals;
|
|
|
|
|
2008-06-13 07:25:20 +02:00
|
|
|
/* No longer used, but may need to keep set for backwards compatibility */
|
2006-05-05 14:51:08 +02:00
|
|
|
# define FLAGS_BIT_SHOWN_NEWDICTLOC 0x0001
|
|
|
|
|
2003-11-20 17:26:35 +01:00
|
|
|
#define GAME_IN_PROGRESS(g) ((g)->gameInfo.dictName != 0)
|
|
|
|
|
|
|
|
enum {
|
2005-07-30 04:02:49 +02:00
|
|
|
XWWM_TIME_RQST = WM_APP
|
2008-10-24 11:05:13 +02:00
|
|
|
,XWWM_REM_SEL
|
2009-01-31 19:06:09 +01:00
|
|
|
,XWWM_HOSTNAME_ARRIVED
|
|
|
|
,XWWM_SOCKET_EVT
|
2003-11-20 17:26:35 +01:00
|
|
|
};
|
|
|
|
|
2007-01-19 07:43:52 +01:00
|
|
|
#define CE_NUM_EDITABLE_COLORS CE_BLACK_COLOR
|
2003-11-20 17:26:35 +01:00
|
|
|
|
2008-08-30 20:55:20 +02:00
|
|
|
|
2008-12-07 06:21:13 +01:00
|
|
|
XP_Bool queryBoxChar( HWND hWnd, const XP_UCHAR* msg );
|
2003-11-20 17:26:35 +01:00
|
|
|
|
2008-03-15 16:39:58 +01:00
|
|
|
/* These allow LISTBOX and COMBOBOX to be used by the same code */
|
2008-08-27 14:16:33 +02:00
|
|
|
|
|
|
|
#define INSERTSTRING(g) (IS_SMARTPHONE(g)?LB_INSERTSTRING:CB_INSERTSTRING)
|
|
|
|
#define SETCURSEL(g) (IS_SMARTPHONE(g)?LB_SETCURSEL:CB_SETCURSEL)
|
|
|
|
#define GETCURSEL(g) (IS_SMARTPHONE(g)?LB_GETCURSEL:CB_GETCURSEL)
|
|
|
|
#define ADDSTRING(g) (IS_SMARTPHONE(g)?LB_ADDSTRING:CB_ADDSTRING)
|
|
|
|
#define GETLBTEXT(g) (IS_SMARTPHONE(g)?LB_GETTEXT:CB_GETLBTEXT)
|
|
|
|
#define GETLBTEXTLEN(g) (IS_SMARTPHONE(g)?LB_GETTEXTLEN:CB_GETLBTEXTLEN)
|
2008-09-17 06:19:20 +02:00
|
|
|
#define FINDSTRINGEXACT(g) \
|
|
|
|
(IS_SMARTPHONE(g)?LB_FINDSTRINGEXACT:CB_FINDSTRINGEXACT)
|
2008-08-27 14:16:33 +02:00
|
|
|
#define LB_IF_PPC(g,id) (IS_SMARTPHONE(g)?id:(id+2))
|
2004-01-30 06:48:24 +01:00
|
|
|
|
2008-10-18 21:38:31 +02:00
|
|
|
|
|
|
|
#define BACK_KEY_UP_MAYBE 0x1000
|
2008-10-25 20:08:36 +02:00
|
|
|
#define CE_MAX_PATH_LEN 256
|
2009-01-05 15:13:40 +01:00
|
|
|
|
|
|
|
#ifndef DM_RESETSCROLL
|
|
|
|
//http://www.nah6.com/~itsme/cvs-xdadevtools/itsutils/src/its_windows_message_list.txt
|
|
|
|
# define DM_RESETSCROLL 0x0402
|
|
|
|
#endif
|
|
|
|
|
2003-11-20 17:26:35 +01:00
|
|
|
#endif /* _CEMAIN_H_ */
|