remove wince files
4
xwords4/wince/.gitignore
vendored
|
@ -1,4 +0,0 @@
|
|||
obj*/
|
||||
Cross_dbg/
|
||||
xwDbgLog.txt
|
||||
*.xwd
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright 2002 by Eric House (xwords@eehouse.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 linux 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,
|
||||
STRS_REMOTE_MOVED,
|
||||
|
||||
STR_PASSED,
|
||||
STRSD_SUMMARYSCORED,
|
||||
STRD_TRADED,
|
||||
STR_LOSTTURN,
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
STR_LOCALPLAYERS,
|
||||
#endif
|
||||
STR_TOTALPLAYERS,
|
||||
|
||||
STRS_VALUES_HEADER,
|
||||
|
||||
STR_NOT_USED
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,305 +0,0 @@
|
|||
# -*- compile-command: "make -j3 DEBUG=TRUE"; -*-
|
||||
# Copyright 2002 - 2011 by Eric House (xwords@eehouse.org). All
|
||||
# rights reserved.
|
||||
#
|
||||
# This Makefile is meant to allow building Crosswords for PocketPC and
|
||||
# Windows using Linux. As of March 2006, it compiles and runs on
|
||||
# PocketPC as well as when built with eVC. Better, since bugs have
|
||||
# been fixed since then. It also runs on Windows natively and under
|
||||
# WINE.
|
||||
#
|
||||
# I'm bulding on Debian's "testing" distribution, current as of the
|
||||
# above date. Here are some of the packages I had to install to build
|
||||
# for win32. I make no guarantees this list is complete. Patches are
|
||||
# required to the pocketpc-sdk and mingw32 packages to build. They've
|
||||
# been submitted to the maintainers and should be included soon.
|
||||
# Contact me if you need them in the interim.
|
||||
#
|
||||
# mingw32 mingw32-binutils mingw32-runtime pocketpc-sdk
|
||||
|
||||
SVNREV = $(shell ../scripts/gitversion.sh)
|
||||
|
||||
PLATFORM = wince
|
||||
|
||||
TARGET_OS ?= win32
|
||||
RELAY_NAME_DEFAULT ?= eehouse.org
|
||||
RELAY_PORT_DEFAULT ?= 10999
|
||||
|
||||
#TARGET_OS = wince
|
||||
#NO_DRAW = -DNO_DRAW
|
||||
|
||||
# The preferred build environment for wince is now cegcc. Debian's
|
||||
# pocketpc-sdk works in combination with the mingw projects headers,
|
||||
# but not without effort. cegcc has its own version of those headers
|
||||
# that it refers to without need for a -I flag. They work well. But
|
||||
# I'd like to retain the ability to build using pocketpc-sdk if
|
||||
# possible.
|
||||
|
||||
# USE_RAW_MINGW = -DUSE_RAW_MINGW
|
||||
# arm-wince-mingw32ce for cegcc
|
||||
ifdef USE_RAW_MINGW
|
||||
MINGW_INC_PATH ?= -I/usr/i586-mingw32msvc/include
|
||||
CE_ARCH = arm-wince-pe
|
||||
else
|
||||
MINGW_INC_PATH = #in case it's in env
|
||||
#CE_ARCH = arm-wince-mingw32ce
|
||||
CE_ARCH = arm-mingw32ce
|
||||
endif
|
||||
CEOPT_ROOT ?= /opt
|
||||
|
||||
# This requires custom Debian pocketpc-sdk package at the moment
|
||||
HAVE_COMMCTRL = 1
|
||||
# Dialog to browse fonts on device. I doubt I want to ship with this.
|
||||
# CHOOSE_FONTS = -DALLOW_CHOOSE_FONTS
|
||||
|
||||
ifeq ($(TARGET_OS),wince)
|
||||
#SMS = -DXWFEATURE_SMS
|
||||
RELAY = -DXWFEATURE_RELAY
|
||||
#RELAY = -DXWFEATURE_RELAY -DCOMMS_HEARTBEAT
|
||||
# IPDIRECT = -DXWFEATURE_IP_DIRECT
|
||||
# BLUETOOTH = -DXWFEATURE_BLUETOOTH
|
||||
CC = ${CE_ARCH}-gcc
|
||||
WINDRES = ${CE_ARCH}-windres
|
||||
STRIP = ${CE_ARCH}-strip
|
||||
ifdef USE_RAW_MINGW
|
||||
CELIBS = -L/usr/arm-wince-pe/lib
|
||||
else
|
||||
CELIBS = -L${CEOPT_ROOT}/${CE_ARCH}/lib/ -lws2
|
||||
endif
|
||||
#STANDALONE = -DXWFEATURE_STANDALONE_ONLY
|
||||
STANDALONE = -DPREV_WAS_STANDALONE_ONLY
|
||||
COLOR_SEL = -DMY_COLOR_SEL
|
||||
CFLAGS += -D_WIN32_WCE=0x0400 -D_WIN32_IE=0x0400 -DUNDER_CE \
|
||||
-D__USE_W32_SOCKETS \
|
||||
$(STANDALONE) $(USE_RAW_MINGW) -DDRAW_LINK_DIRECT \
|
||||
-DXWFEATURE_TURNCHANGENOTIFY \
|
||||
-fdollars-in-identifiers -D__W32API_USE_DLLIMPORT__
|
||||
# back key should raise focus on main board and backspace in edit controls
|
||||
CFLAGS += -DOVERRIDE_BACKKEY
|
||||
RESFLAGS += -D_WIN32_WCE=0x0400
|
||||
LFLAGS += -Wl,--major-subsystem-version,4,--minor-subsystem-version,20
|
||||
ifdef HAVE_COMMCTRL
|
||||
CELIBS += -lcommctrl -laygshell
|
||||
else
|
||||
CFLAGS += -DCANT_DO_CMDBAR
|
||||
endif
|
||||
CELIBS += -static
|
||||
else # ifeq ($(TARGET_OS),wince)
|
||||
ifeq ($(TARGET_OS),win32)
|
||||
#STANDALONE = -DXWFEATURE_STANDALONE_ONLY
|
||||
STANDALONE = -DPREV_WAS_STANDALONE_ONLY
|
||||
#BLUETOOTH = -DXWFEATURE_BLUETOOTH
|
||||
#SMS = -DXWFEATURE_SMS
|
||||
RELAY = -DXWFEATURE_RELAY
|
||||
# IPDIRECT = -DXWFEATURE_IP_DIRECT
|
||||
CC = i586-mingw32msvc-gcc
|
||||
WINDRES = i586-mingw32msvc-windres
|
||||
STRIP = i586-mingw32msvc-strip
|
||||
CELIBS += -lws2_32
|
||||
|
||||
CFLAGS += -DCANT_DO_CMDBAR -DDRAW_LINK_DIRECT -DXWFEATURE_TURNCHANGENOTIFY -DXWFEATURE_MINIWIN
|
||||
# CFLAGS += -DFORCE_FONT="L\"Segoe Condensed\""
|
||||
#CFLAGS += -DFORCE_HEIGHT=240 -DFORCE_WIDTH=320
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifdef RELAY
|
||||
ifneq ($(DEBUG),TRUE)
|
||||
RELAY += -DRELAY_NOEDIT_ADDR
|
||||
endif
|
||||
endif
|
||||
|
||||
# CFLAGS += -DFORCE_SCROLL=3
|
||||
CFLAGS += -DARM -I./ -I../common -I../relay
|
||||
|
||||
CFLAGS += -Wall -Wunused-parameter
|
||||
|
||||
CFLAGS += $(BLUETOOTH) $(RELAY) $(SMS) $(IPDIRECT) $(STANDALONE) $(COLOR_SEL) \
|
||||
$(CHOOSE_FONTS) $(NO_DRAW) -DUSE_BUFQUEUE
|
||||
|
||||
SVNDEF = -DSVN_REV='\"$(SVNREV)\"'
|
||||
CFLAGS += $(SVNDEF)
|
||||
RESFLAGS += $(SVNDEF)
|
||||
|
||||
# warn upgrading users of new dict location
|
||||
CFLAGS += -DKEYBOARD_NAV
|
||||
CFLAGS += -DPERIMETER_FOCUS
|
||||
|
||||
# Hack until figure out how to turn off IME (12-key-to-text) on CE.
|
||||
CFLAGS += -DNUMBER_KEY_AS_INDEX
|
||||
ifdef RELAY_NAME_DEFAULT
|
||||
CFLAGS += -DRELAY_NAME_DEFAULT=\"$(RELAY_NAME_DEFAULT)\"
|
||||
endif
|
||||
ifdef RELAY_PORT_DEFAULT
|
||||
CFLAGS += -DRELAY_PORT_DEFAULT=$(RELAY_PORT_DEFAULT)
|
||||
endif
|
||||
# This is normally part of MEM_DEBUG, but sometimes we want logging in
|
||||
# a release build, e.g. to figure out why opening a saved game isn't
|
||||
# working. So normally it's commented out here.
|
||||
# LOGGING_FLAG = -DENABLE_LOGGING
|
||||
|
||||
ifeq ($(DEBUG),TRUE)
|
||||
MEM_DEBUG_FLAG=-DMEM_DEBUG
|
||||
LOGGING_FLAG = -DENABLE_LOGGING
|
||||
DEBUG_FLAG=-DDEBUG
|
||||
CFLAGS += -g -DDEBUG_TS
|
||||
OBJDIR = obj_$(TARGET_OS)_dbg
|
||||
else
|
||||
CFLAGS += -Os
|
||||
OBJDIR = obj_$(TARGET_OS)_rel
|
||||
endif
|
||||
|
||||
BUILTDIR=$(OBJDIR)/built
|
||||
TARGET = $(BUILTDIR)/xwords4_$(SVNREV).exe
|
||||
DLL_SRCS = \
|
||||
./l10n/xwords4_catalan.rc \
|
||||
./l10n/xwords4_french.rc \
|
||||
./l10n/xwords4_polish.rc \
|
||||
./l10n/xwords4_czech.rc \
|
||||
./l10n/xwords4_english.rc \
|
||||
|
||||
BASE_LANG_SRC = l10n/xwords4_english.rc
|
||||
BASE_LANG_OBJ = $(OBJDIR$)/$(patsubst %.rc,%.rc.o,$(notdir $(BASE_LANG_SRC)))
|
||||
|
||||
# filter out the one we're building in. Can always build it as .dll
|
||||
# manually...
|
||||
DLLS = $(patsubst %.rc,$(BUILTDIR)/%.dll,\
|
||||
$(notdir $(patsubst ./$(BASE_LANG_SRC),,$(DLL_SRCS))))
|
||||
|
||||
WINCESRC = \
|
||||
ceaskpwd.c \
|
||||
ceclrsel.c\
|
||||
cedict.c \
|
||||
ceginfo.c \
|
||||
cemain.c \
|
||||
cesockwr.c \
|
||||
ceutil.c \
|
||||
ceblank.c \
|
||||
cecondlg.c \
|
||||
cesvdgms.c \
|
||||
cehntlim.c \
|
||||
ceprefs.c \
|
||||
cestrbx.c \
|
||||
cedraw.c \
|
||||
cefonts.c \
|
||||
ceresstr.c \
|
||||
cesms.c \
|
||||
debhacks.c \
|
||||
cedebug.c \
|
||||
|
||||
WINCEOBJS = $(patsubst %.c,%.o,$(addprefix $(OBJDIR)/,$(WINCESRC)))
|
||||
|
||||
WINCEICONS = bmps/xwords4_ico_16x16.png \
|
||||
bmps/xwords4_ico_22x22.png \
|
||||
bmps/xwords4_ico_32x32.png \
|
||||
|
||||
BMPS = bmps/rightarrow.bmp \
|
||||
bmps/downarro.bmp \
|
||||
bmps/origin.bmp \
|
||||
bmps/netarrow.bmp
|
||||
|
||||
include ../common/config.mk
|
||||
|
||||
COMMONOBJ = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(notdir $(COMMONSRC))))
|
||||
|
||||
OBJS = $(WINCEOBJS) $(COMMONOBJ)
|
||||
|
||||
WINCE_INCLUDES = $(shell ls *.h)
|
||||
COMMON_INCLUDES = $(shell ls ../common/*.h)
|
||||
|
||||
INCLUDES = $(WINCE_INCLUDES) $(COMMON_INCLUDES)
|
||||
|
||||
XW_BOTH_DEFINES = \
|
||||
$(TARGET_OS_DEF) \
|
||||
-DNODE_CAN_4 \
|
||||
-DCOLOR_SUPPORT -DFEATURE_TRAY_EDIT -DXWFEATURE_SEARCHLIMIT \
|
||||
-DXWFEATURE_HINT_CONFIG \
|
||||
-DPOINTER_SUPPORT -DKEY_SUPPORT -D__LITTLE_ENDIAN \
|
||||
-DCEFEATURE_CANSCROLL -DUNICODE \
|
||||
-DLOADSTRING_BROKEN \
|
||||
$(DEBUG_FLAG) $(MEM_DEBUG_FLAG) $(LOGGING_FLAG) \
|
||||
|
||||
CFLAGS += $(XW_BOTH_DEFINES) -DARM
|
||||
RESFLAGS += $(XW_BOTH_DEFINES) $(STANDALONE) $(BLUETOOTH) $(RELAY) $(SMS) \
|
||||
$(IPDIRECT) -D_WIN32 -D_WIN32_IE=0x0400 $(COLOR_SEL) $(CHOOSE_FONTS) \
|
||||
-I ../common
|
||||
|
||||
####################################################################
|
||||
# Rules start here
|
||||
####################################################################
|
||||
|
||||
all : $(TARGET) $(DLLS)
|
||||
|
||||
memdebug:
|
||||
$(MAKE) DEBUG=TRUE all
|
||||
|
||||
$(TARGET) : $(OBJS) $(BASE_LANG_OBJ)
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -mwindows $^ $(CELIBS) -o $@
|
||||
$(STRIP) $@
|
||||
|
||||
$(OBJDIR)/%.o : %.c $(INCLUDES)
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o : ../common/%.c $(INCLUDES)
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BASE_LANG_OBJ) : $(BASE_LANG_SRC) $(INCLUDES) xwords4.ico common_rsrc.rc $(BMPS)
|
||||
scripts/test_windres.sh ${WINDRES}
|
||||
$(WINDRES) -v $(MINGW_INC_PATH) $(RESFLAGS) -DAM_BASE_LANGUAGE -o $@ $<
|
||||
|
||||
$(OBJDIR)/l10n/%.rc.o : l10n/%.rc $(WINCE_INCLUDES)
|
||||
scripts/test_windres.sh ${WINDRES}
|
||||
mkdir -p $(dir $@)
|
||||
UTF8=x$(shell file -b -n -i $< | grep 'utf-8'); \
|
||||
if [ x != $$UTF8 ]; then ENC="-c 65001"; fi; \
|
||||
$(WINDRES) $$ENC -v $(MINGW_INC_PATH) $(RESFLAGS) $< -o $@
|
||||
|
||||
$(BUILTDIR)/%.dll: $(OBJDIR)/l10n/%.rc.o
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) -shared -o $@ $<
|
||||
$(STRIP) $@
|
||||
|
||||
bmps/%.bmp: bmps/%.pgm
|
||||
ppmtobmp $< > $@
|
||||
|
||||
# Checking in xwords4.ico for now. Hand-built using GIMP and layers
|
||||
# it's 1/4 the size (because it has only two colors). Should figure
|
||||
# out how to script GIMP and replace the below.
|
||||
# xwords4.ico:
|
||||
# $(WINCEICONS) icotool -c -o $@ $^
|
||||
|
||||
CAB: $(TARGET) $(DLLS)
|
||||
$(STRIP) $<
|
||||
(cd $(BUILTDIR); \
|
||||
PATH=../../scripts:$$PATH exe2cab.pl $(notdir $<); \
|
||||
[ -n "$$XW_WWW_PATH" ] && cp $(subst exe,cab,$(notdir $<)) \
|
||||
$$XW_WWW_PATH \
|
||||
)
|
||||
for DLL in $(notdir $(DLLS)); do \
|
||||
(cd $(BUILTDIR); PATH=../../scripts:$$PATH dll2cab.pl $$DLL; \
|
||||
[ -n "$$XW_WWW_PATH" ] && cp $$DLL $$XW_WWW_PATH; \
|
||||
); \
|
||||
done
|
||||
|
||||
SHIP: $(TARGET)
|
||||
$(STRIP) $<
|
||||
ifdef WINCE_UPLOAD_LOC
|
||||
zip $<.zip $<
|
||||
scp $<.zip $(WINCE_UPLOAD_LOC)
|
||||
scp $< $(WINCE_UPLOAD_LOC)
|
||||
endif
|
||||
|
||||
test:
|
||||
echo $(COMMONOBJ)
|
||||
|
||||
clean :
|
||||
rm -rf $(OBJDIR) $(TARGET) $(BMPS)
|
||||
|
||||
help:
|
||||
@echo "try 'make TARGET_OS=wince [DEBUG=TRUE] [RELAY_NAME_DEFAULT=localhost]'"
|
||||
@echo "or 'make TARGET_OS=win32 [DEBUG=TRUE] [RELAY_NAME_DEFAULT=localhost]'"
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
This document describes how to build Crosswords for PocketPC (and for
|
||||
desktop Windows). You can build using Debian Linux, or using
|
||||
Microsoft's embedded visual tools (which are free provided you have a
|
||||
copy of Visual Studio.)
|
||||
|
||||
(Caveat: I've had to make modifications to the MinGW and pocketpc-sdk
|
||||
packages to support Crosswords. I have submitted the changes back to
|
||||
the tool maintainers, but it may take some time before they appear in
|
||||
Debian. Please contact me if you need them in the meantime, at
|
||||
ehouse@users.sf.net.)
|
||||
|
||||
To build for PocketPC with Debian, you need to install the MinGW and
|
||||
pocketpc packages:
|
||||
|
||||
sudo apt-get install pocketpc-binutils pocketpc-gas pocketpc-gcc \
|
||||
pocketpc-sdk mingw32-runtime
|
||||
|
||||
If you're building for Windows, you also need the mingw tools:
|
||||
|
||||
sudo apt-get install mingw32-binutils mingw32
|
||||
|
||||
Once those are installed, it's just a matter of typing
|
||||
|
||||
make TARGET_OS=wince
|
||||
|
||||
or
|
||||
|
||||
make TARGET_OS=win32
|
||||
|
||||
at the commandline in this directory.
|
||||
|
||||
******************************************************************************
|
||||
The rest of this file is older, and talks about building with
|
||||
Microsoft's tools.
|
||||
|
||||
First, you need to install Microsoft's SDK for Wince/PocketPC. It's
|
||||
available for about $8 shipping and handling from Microsoft, and is
|
||||
included with many books on PocketPC/Wince programming. Here's a link
|
||||
where I was able to get it:
|
||||
|
||||
https://microsoft.order-5.com/trialstore/product.asp?catalog%5Fname=MSTrialandEval&category%5Fname=Developer+Tools&product%5Fid=X09%2D17298
|
||||
|
||||
1. Launch eMbedded Visual C++ (EVC++).
|
||||
|
||||
2. Choose "Open" from the "File" menu, and open xwords.vcp in this
|
||||
directory.
|
||||
|
||||
*** To build for the emulator (best for development work): ***
|
||||
|
||||
3. On the "Build" menu, choose "Set active conguration". Select
|
||||
"xwords - Win32 (WCE x86) Debug" and click on the "OK" button.
|
||||
|
||||
4. Choose "Build xwords.exe" from the "Build" menu. You will see the
|
||||
names of files appear in the Build window, and a few warnings that
|
||||
you can safely ignore (though fixes are welcomed!) After the link
|
||||
finishes, you'll see a dialog announcing that the emulator is
|
||||
being started. The emulator will appear, and once the dialog
|
||||
disappears, if you go to the Start menu in the emulator you'll see
|
||||
a listing for "xwords".
|
||||
|
||||
5. Before you can run Crosswords/xwords, you need to install a
|
||||
dictionary on the emulator. To do this, go back to EVC++ and
|
||||
choose "Remote file viewer" from the "Tools" menu.
|
||||
|
||||
6. From the "Connection" menu of the file browser that appears, choose
|
||||
"Add connection", select "Pocket PC 2002 Emulation" and click "Ok".
|
||||
|
||||
7. Now navigate to a directory. (I usually use "\My
|
||||
Documents\Personal", but it shouldn't matter.) From the "File"
|
||||
menu, choose "Export file". Then select the file
|
||||
"BasEnglish2to8.xwd" from the directory dawg/English. (The
|
||||
directory dawg lives in the same directory as the wince directory
|
||||
this document is in.)
|
||||
|
||||
8. Now when you launch xwords on the emulator it will not complain
|
||||
that there's no dictionary, and you'll be able to navigate to
|
||||
BasEnglish2to8.xwd when starting your first game.
|
||||
|
||||
|
||||
*** To build for a device ***
|
||||
|
||||
9. On the "Build" menu, choose "Set active conguration". Select
|
||||
"xwords - Win32 (WCE ARM) Release" or "xwords - Win32 (WCE x86)
|
||||
Debug" and click on the "OK" button. The "Debug" version has a
|
||||
number of asserts and other debugging aids compiled in, and logs
|
||||
to the file "/My Documents/Personal/xwDbgLog.txt" on the device.
|
||||
The "Release" version does no logging, and is smaller and faster
|
||||
and in general better suited for non-developers.
|
||||
|
||||
10. Choose "Build xwords.exe" from the Build menu. Once the link is
|
||||
finished, EVC++ will try to upload the executable to your device.
|
||||
If that works, fine. Otherwise, you'll need to get the file
|
||||
wince/ARMRel/xwords.exe (or wince/ARMDbg/xwords.exe) to your
|
||||
device on your own. I use either an SD card or IR beaming for
|
||||
this. You'll also need a dictionary such as BasEnglish2to8.xwd
|
||||
from dawg/English.
|
||||
|
||||
11. Once xwords.exe and a dictionary are on your device, just use the
|
||||
File Explorer to lauch xwords.exe.
|
||||
|
||||
12. Enjoy! And please report bugs and/or submit fixes.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// xwords4.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
|
@ -1,73 +0,0 @@
|
|||
# -*- mode: Makefile; compile-command: "make -f armrel.mk"; -*-
|
||||
|
||||
# This is the makefile for non-debug (release) ARM builds. It was
|
||||
# built by hand-cribbing commands from the build-time log file EVC
|
||||
# creates (by default) in a .vcl file in the build directory.
|
||||
|
||||
PLATFORM = ARMV4Rel
|
||||
TARGET = $(PLATFORM)/xwords4.exe
|
||||
|
||||
LIBS = commctrl.lib coredll.lib winsock.lib aygshell.lib
|
||||
RSRC = $(PLATFORM)/xwords4.res
|
||||
|
||||
MAKE = make -f armrel.mk
|
||||
|
||||
CC = $(WCE420)/bin/clarm.exe
|
||||
LINK = $(WCE420)/bin/link.exe
|
||||
RC = $(VSDIR)/Common/MSDev98/Bin/rc.exe
|
||||
|
||||
# CC_OPT += /Os
|
||||
# CC_OPT += /O1
|
||||
# CC_OPT += /Og
|
||||
|
||||
include ../common/config.mk
|
||||
|
||||
include ./shared.mk
|
||||
|
||||
|
||||
# Since three rules use exactly the same command, I'm writing it out
|
||||
# only once
|
||||
C_CMD = \
|
||||
$(CC) /nologo $(CC_OPT) /W3 /I "$(WINCE_PATH)\Include\Armv4" \
|
||||
/I"..\common" /I"..\relay" /I"." /D _WIN32_WCE=420 /D "WIN32_PLATFORM_PSPC=400" \
|
||||
/D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=420 /D "UNICODE" \
|
||||
/D "_UNICODE" /D "NDEBUG" $(XW_C_DEFINES) \
|
||||
/Fo$@ /MC /c $<
|
||||
|
||||
$(PLATFORM)/StdAfx.o: StdAfx.cpp
|
||||
mkdir -p $(dir $@)
|
||||
$(C_CMD)
|
||||
|
||||
$(PLATFORM)/%.o: %.c
|
||||
mkdir -p $(dir $@)
|
||||
$(C_CMD)
|
||||
|
||||
../common/$(PLATFORM)/%.o: ../common/%.c
|
||||
mkdir -p $(dir $@)
|
||||
$(C_CMD)
|
||||
|
||||
$(RSRC): xwords4.rc
|
||||
mkdir -p $(PLATFORM)
|
||||
$(RC) /l 0x409 /fo$@ \
|
||||
/i "$(WINCE_PATH)\Include\Armv4" \
|
||||
/d UNDER_CE=420 /d _WIN32_WCE=420 /d "NDEBUG" /d "UNICODE" \
|
||||
/d "_UNICODE" /d "WIN32_PLATFORM_PSPC=400" /d "ARM" /d "_ARM_" \
|
||||
/d "ARMV4" $(XW_RES_DEFINES) \
|
||||
/r $<
|
||||
|
||||
$(TARGET): $(COMMONOBJ) $(PLATOBJ) $(RSRC)
|
||||
$(LINK) $(LIBS) /nologo /base:"0x00010000" \
|
||||
/stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /incremental:no \
|
||||
/pdb:$(basename $(TARGET)).pdb /nodefaultlib:"libc.lib" \
|
||||
/nodefaultlib:libcd.lib /nodefaultlib:libcmt.lib \
|
||||
/nodefaultlib:libcmtd.lib /nodefaultlib:msvcrt.lib \
|
||||
/nodefaultlib:msvcrtd.lib /out:$@ \
|
||||
/libpath:"$(PPC_SDK_PPC)\Lib\Armv4" \
|
||||
/subsystem:windowsce,4.20 /align:"4096" /MACHINE:ARM \
|
||||
$^
|
||||
|
||||
clean:
|
||||
rm -f $(COMMONOBJ) $(PLATOBJ) $(TARGET) $(RSRC) $(PLATFORM)/*.pdb
|
||||
|
||||
test:
|
||||
echo $(FIXED_OPT_COMMON)
|
1
xwords4/wince/bmps/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
*.bmp
|
|
@ -1,15 +0,0 @@
|
|||
P2
|
||||
# CREATOR: GIMP PNM Filter Version 1.1
|
||||
11 11
|
||||
1
|
||||
1 1 1 1 0 0 0 1 1 1 1
|
||||
1 1 1 1 0 0 0 1 1 1 1
|
||||
1 1 1 1 0 0 0 1 1 1 1
|
||||
1 1 1 1 0 0 0 1 1 1 1
|
||||
1 1 1 1 0 0 0 1 1 1 1
|
||||
0 0 0 0 0 0 0 0 0 0 0
|
||||
1 0 0 0 0 0 0 0 0 0 1
|
||||
1 1 0 0 0 0 0 0 0 1 1
|
||||
1 1 1 0 0 0 0 0 1 1 1
|
||||
1 1 1 1 0 0 0 1 1 1 1
|
||||
1 1 1 1 1 0 1 1 1 1 1
|
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 126 B |
|
@ -1,19 +0,0 @@
|
|||
P2
|
||||
16 16
|
||||
1
|
||||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1
|
||||
1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1
|
||||
1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
|
||||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
|
||||
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
|
||||
1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1
|
||||
1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1
|
||||
1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1
|
||||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
|
@ -1,15 +0,0 @@
|
|||
P2
|
||||
# CREATOR: GIMP PNM Filter Version 1.1
|
||||
11 11
|
||||
1
|
||||
0 0 1 1 1 1 1 1 1 0 0
|
||||
0 0 0 1 1 1 1 1 0 0 0
|
||||
1 0 0 0 1 1 1 0 0 0 1
|
||||
1 1 0 0 0 1 0 0 0 1 1
|
||||
1 1 1 0 0 0 0 0 1 1 1
|
||||
1 1 1 1 0 0 0 1 1 1 1
|
||||
1 1 1 0 0 0 0 0 1 1 1
|
||||
1 1 0 0 0 1 0 0 0 1 1
|
||||
1 0 0 0 1 1 1 0 0 0 1
|
||||
0 0 0 1 1 1 1 1 0 0 0
|
||||
0 0 1 1 1 1 1 1 1 0 0
|
|
@ -1,15 +0,0 @@
|
|||
P2
|
||||
# CREATOR: GIMP PNM Filter Version 1.1
|
||||
11 11
|
||||
1
|
||||
1 1 1 1 1 0 1 1 1 1 1
|
||||
1 1 1 1 1 0 0 1 1 1 1
|
||||
1 1 1 1 1 0 0 0 1 1 1
|
||||
1 1 1 1 1 0 0 0 0 1 1
|
||||
0 0 0 0 0 0 0 0 0 0 1
|
||||
0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 1
|
||||
1 1 1 1 1 0 0 0 0 1 1
|
||||
1 1 1 1 1 0 0 0 1 1 1
|
||||
1 1 1 1 1 0 0 1 1 1 1
|
||||
1 1 1 1 1 0 1 1 1 1 1
|
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 352 B |
|
@ -1,84 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002 by Eric House (xwords@eehouse.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 "ceaskpwd.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
#include "debhacks.h"
|
||||
#include "ceresstr.h"
|
||||
#include <wchar.h>
|
||||
|
||||
static void
|
||||
nameToLabel( PasswdDialogState* pState, const XP_UCHAR* name, XP_U16 labelID )
|
||||
{
|
||||
wchar_t wideName[64];
|
||||
wchar_t wBuf[128];
|
||||
const wchar_t* fmt;
|
||||
|
||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, name, -1, wideName,
|
||||
VSIZE(wideName) );
|
||||
|
||||
fmt = ceGetResStringL( pState->dlgHdr.globals, IDS_PASSWDFMT_L );
|
||||
swprintf( wBuf, fmt, wideName );
|
||||
|
||||
SendDlgItemMessage( pState->dlgHdr.hDlg, labelID, WM_SETTEXT,
|
||||
0, (long)wBuf );
|
||||
} /* nameToLabel */
|
||||
|
||||
LRESULT CALLBACK
|
||||
PasswdDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PasswdDialogState* pState;
|
||||
XP_U16 id;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
pState = (PasswdDialogState*)lParam;
|
||||
|
||||
ceDlgSetup( &pState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||
|
||||
nameToLabel( pState, pState->name, IDC_PWDLABEL );
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
pState = (PasswdDialogState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!pState ) {
|
||||
|
||||
if ( ceDoDlgHandle( &pState->dlgHdr, message, wParam, lParam ) ) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch ( message ) {
|
||||
case WM_COMMAND:
|
||||
id = LOWORD(wParam);
|
||||
switch( id ) {
|
||||
case IDOK:
|
||||
ceGetDlgItemText( hDlg, PASS_EDIT, pState->buf,
|
||||
pState->lenp );
|
||||
case IDCANCEL:
|
||||
pState->userCancelled = id == IDCANCEL;
|
||||
EndDialog( hDlg, id );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
} /* PasswdDlg */
|
|
@ -1,37 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002 by Eric House (xwords@eehouse.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 _CEASKPWD_H_
|
||||
#define _CEASKPWD_H_
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
|
||||
typedef struct PasswdDialogState {
|
||||
CeDlgHdr dlgHdr;
|
||||
const XP_UCHAR* name;
|
||||
XP_UCHAR* buf;
|
||||
XP_U16* lenp;
|
||||
XP_Bool userCancelled; /* needed? */
|
||||
} PasswdDialogState;
|
||||
|
||||
LRESULT CALLBACK PasswdDlg(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
#endif
|
|
@ -1,183 +0,0 @@
|
|||
/* -*- fill-column: 77; compile-command: "make -j2 TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2002-2009 by Eric House (xwords@eehouse.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 "ceblank.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
#include "debhacks.h"
|
||||
#include "cedebug.h"
|
||||
|
||||
typedef struct BlankDialogState {
|
||||
CeDlgHdr dlgHdr;
|
||||
const PickInfo* pi;
|
||||
XP_U16 playerNum;
|
||||
const XP_UCHAR** texts;
|
||||
XP_U16 nTiles;
|
||||
XP_S16 result;
|
||||
XP_Bool canBackup;
|
||||
} BlankDialogState;
|
||||
|
||||
static void
|
||||
loadLettersList( BlankDialogState* bState )
|
||||
{
|
||||
XP_U16 ii;
|
||||
XP_U16 nTiles = bState->nTiles;
|
||||
HWND hDlg = bState->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = bState->dlgHdr.globals;
|
||||
const XP_UCHAR** texts = bState->texts;
|
||||
|
||||
for ( ii = 0; ii < nTiles; ++ii ) {
|
||||
XP_U16 len;
|
||||
wchar_t widebuf[4];
|
||||
|
||||
len = MultiByteToWideChar( CP_UTF8, 0, texts[ii], strlen(texts[ii]),
|
||||
widebuf, VSIZE(widebuf) );
|
||||
widebuf[len] = 0;
|
||||
|
||||
SendDlgItemMessage( hDlg, LB_IF_PPC(globals,BLANKFACE_LIST),
|
||||
ADDSTRING(globals), 0, (long)widebuf );
|
||||
}
|
||||
|
||||
SendDlgItemMessage( hDlg, LB_IF_PPC(globals,BLANKFACE_LIST),
|
||||
SETCURSEL(globals), 0, 0 );
|
||||
#ifdef _WIN32_WCE
|
||||
SendDlgItemMessage( hDlg, BLANKFACE_LIST_PPC, LB_SETANCHORINDEX, 0, 0 );
|
||||
#endif
|
||||
} /* loadLettersList */
|
||||
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
static void
|
||||
showCurTray( HWND hDlg, BlankDialogState* bState )
|
||||
{
|
||||
if ( NULL != bState->pi ) {
|
||||
const PickInfo* pi = bState->pi;
|
||||
XP_U16 lenSoFar = 0;
|
||||
XP_U16 ii;
|
||||
XP_UCHAR labelBuf[48];
|
||||
wchar_t widebuf[48];
|
||||
XP_UCHAR* name;
|
||||
CEAppGlobals* globals = bState->dlgHdr.globals;
|
||||
|
||||
name = globals->gameInfo.players[bState->playerNum].name;
|
||||
|
||||
lenSoFar += XP_SNPRINTF( labelBuf + lenSoFar,
|
||||
sizeof(labelBuf) - lenSoFar,
|
||||
"%d of %d for %s" XP_CR "Cur",
|
||||
pi->thisPick + 1, pi->nTotal, name );
|
||||
|
||||
for ( ii = 0; ii < pi->nCurTiles; ++ii ) {
|
||||
lenSoFar += XP_SNPRINTF( labelBuf+lenSoFar,
|
||||
sizeof(labelBuf)-lenSoFar, "%s%s",
|
||||
ii==0?": ":", ", pi->curTiles[ii] );
|
||||
}
|
||||
|
||||
(void)MultiByteToWideChar( CP_UTF8, 0, labelBuf, lenSoFar + 1, widebuf,
|
||||
VSIZE(widebuf) + sizeof(widebuf[0]) );
|
||||
|
||||
SetDlgItemText( hDlg,IDC_PICKMSG, widebuf );
|
||||
}
|
||||
} /* showCurTray */
|
||||
#endif
|
||||
|
||||
static LRESULT CALLBACK
|
||||
BlankDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
BlankDialogState* bState;
|
||||
XP_U16 id;
|
||||
LRESULT result = FALSE; /* default */
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
bState = (BlankDialogState*)lParam;
|
||||
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
if ( NULL != bState->pi ) {
|
||||
showCurTray( hDlg, bState );
|
||||
ceShowOrHide( hDlg, IDC_BPICK, XP_FALSE );
|
||||
} else {
|
||||
ceShowOrHide( hDlg, IDC_CPICK, XP_FALSE );
|
||||
ceShowOrHide( hDlg, IDC_PICKMSG, XP_FALSE );
|
||||
}
|
||||
bState->canBackup = (NULL != bState->pi)
|
||||
&& (bState->pi->thisPick > 0);
|
||||
ceShowOrHide( hDlg, IDC_BACKUP, bState->canBackup );
|
||||
#endif
|
||||
|
||||
ceDlgSetup( &bState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||
ceDlgComboShowHide( &bState->dlgHdr, BLANKFACE_LIST );
|
||||
|
||||
loadLettersList( bState );
|
||||
result = TRUE;
|
||||
} else {
|
||||
bState = (BlankDialogState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!bState ) {
|
||||
|
||||
if ( ceDoDlgHandle( &bState->dlgHdr, message, wParam, lParam) ) {
|
||||
result = TRUE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
switch ( message ) {
|
||||
case WM_COMMAND:
|
||||
id = LOWORD(wParam);
|
||||
if ( 0 ) {
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
} else if ( id == IDCANCEL ) {
|
||||
bState->result = PICKER_PICKALL;
|
||||
} else if ( id == IDC_BACKUP ) {
|
||||
bState->result = PICKER_BACKUP;
|
||||
#endif
|
||||
} else if ( id == IDOK ) {
|
||||
CEAppGlobals* globals = bState->dlgHdr.globals;
|
||||
bState->result = (XP_S16)
|
||||
SendDlgItemMessage( hDlg,
|
||||
LB_IF_PPC(globals,BLANKFACE_LIST),
|
||||
GETCURSEL(globals), 0, 0 );
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
EndDialog( hDlg, id );
|
||||
result = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return result;
|
||||
} /* BlankDlg */
|
||||
|
||||
XP_Bool
|
||||
WrapBlankDlg( CEAppGlobals* globals, const PickInfo* pi,
|
||||
XP_U16 playerNum, const XP_UCHAR** texts, XP_U16 nTiles )
|
||||
{
|
||||
BlankDialogState state;
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
|
||||
state.dlgHdr.globals = globals;
|
||||
state.texts = texts;
|
||||
state.nTiles = nTiles;
|
||||
state.playerNum = playerNum;
|
||||
state.pi = pi;
|
||||
|
||||
assertOnTop( globals->hWnd );
|
||||
DialogBoxParam( globals->locInst, (LPCTSTR)IDD_ASKBLANK, globals->hWnd,
|
||||
(DLGPROC)BlankDlg, (long)&state );
|
||||
return state.result;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002, 2008 by Eric House (xwords@eehouse.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 _CEBLANK_H_
|
||||
#define _CEBLANK_H_
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
|
||||
XP_Bool WrapBlankDlg( CEAppGlobals* globals, const PickInfo* pi,
|
||||
XP_U16 playerNum, const XP_UCHAR** texts, XP_U16 nTiles );
|
||||
#endif
|
|
@ -1,473 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2004-2008 by Eric House (xwords@eehouse.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 <windowsx.h>
|
||||
#include "stdafx.h"
|
||||
#include <commdlg.h>
|
||||
|
||||
#include "ceclrsel.h"
|
||||
#include "ceutil.h"
|
||||
#include "cedebug.h"
|
||||
#include "debhacks.h"
|
||||
#include "ceresstr.h"
|
||||
|
||||
static void colorButton( DRAWITEMSTRUCT* dis, HBRUSH brush );
|
||||
|
||||
#ifdef MY_COLOR_SEL
|
||||
|
||||
typedef struct ClrEditDlgState {
|
||||
CeDlgHdr dlgHdr;
|
||||
HWND parent;
|
||||
HWND sampleButton;
|
||||
XP_U16 labelID;
|
||||
|
||||
XP_U8 red;
|
||||
XP_U8 green;
|
||||
XP_U8 blue;
|
||||
|
||||
XP_Bool inited;
|
||||
XP_Bool cancelled;
|
||||
} ClrEditDlgState;
|
||||
|
||||
static void
|
||||
initEditAndSlider( HWND hDlg, XP_U16 sliderID, XP_U8 val )
|
||||
{
|
||||
SendDlgItemMessage( hDlg, sliderID, TBM_SETRANGE, TRUE,
|
||||
MAKELONG(0,255) );
|
||||
SendDlgItemMessage( hDlg, sliderID, TBM_SETPOS, TRUE,
|
||||
(long)val );
|
||||
ceSetDlgItemNum( hDlg, sliderID+1, val );
|
||||
} /* initEditAndSlider */
|
||||
|
||||
static void
|
||||
initChooseColor( ClrEditDlgState* eState, HWND hDlg )
|
||||
{
|
||||
initEditAndSlider( hDlg, CLREDT_SLIDER1, eState->red );
|
||||
initEditAndSlider( hDlg, CLREDT_SLIDER2, eState->green );
|
||||
initEditAndSlider( hDlg, CLREDT_SLIDER3, eState->blue );
|
||||
} /* initChooseColor */
|
||||
|
||||
static XP_U8*
|
||||
colorForSlider( ClrEditDlgState* eState, XP_U16 sliderID )
|
||||
{
|
||||
switch( sliderID ) {
|
||||
case CLREDT_SLIDER1:
|
||||
return &eState->red;
|
||||
case CLREDT_SLIDER2:
|
||||
return &eState->green;
|
||||
case CLREDT_SLIDER3:
|
||||
return &eState->blue;
|
||||
default:
|
||||
XP_LOGF( "huh???" );
|
||||
return NULL;
|
||||
}
|
||||
} /* colorForSlider */
|
||||
|
||||
static void
|
||||
updateForSlider( HWND hDlg, ClrEditDlgState* eState, XP_U16 sliderID )
|
||||
{
|
||||
XP_U8 newColor = (XP_U8)SendDlgItemMessage( hDlg, sliderID, TBM_GETPOS,
|
||||
0, 0L );
|
||||
XP_U8* colorPtr = colorForSlider( eState, sliderID );
|
||||
if ( newColor != *colorPtr ) {
|
||||
*colorPtr = newColor;
|
||||
|
||||
ceSetDlgItemNum( hDlg, sliderID+1, (XP_S32)newColor );
|
||||
|
||||
InvalidateRect( eState->sampleButton, NULL, TRUE /* erase */ );
|
||||
}
|
||||
} /* updateForSlider */
|
||||
|
||||
static void
|
||||
updateForField( HWND hDlg, ClrEditDlgState* eState, XP_U16 fieldID )
|
||||
{
|
||||
XP_S32 newColor = ceGetDlgItemNum( hDlg, fieldID );
|
||||
XP_U8* colorPtr = colorForSlider( eState, fieldID - 1 );
|
||||
XP_Bool modified = XP_FALSE;;
|
||||
|
||||
if ( newColor > 255 ) {
|
||||
newColor = 255;
|
||||
modified = XP_TRUE;
|
||||
} else if ( newColor < 0 ) {
|
||||
newColor = 0;
|
||||
modified = XP_TRUE;
|
||||
}
|
||||
if ( modified ) {
|
||||
ceSetDlgItemNum( hDlg, fieldID, newColor );
|
||||
}
|
||||
|
||||
if ( newColor != *colorPtr ) {
|
||||
*colorPtr = (XP_U8)newColor;
|
||||
|
||||
SendDlgItemMessage( hDlg, fieldID-1, TBM_SETPOS, TRUE,
|
||||
(long)newColor );
|
||||
InvalidateRect( eState->sampleButton, NULL, FALSE );
|
||||
}
|
||||
} /* updateForField */
|
||||
|
||||
static void
|
||||
colorButtonFromState( ClrEditDlgState* eState, DRAWITEMSTRUCT* dis )
|
||||
{
|
||||
COLORREF ref = RGB( eState->red, eState->green, eState->blue );
|
||||
HBRUSH brush = CreateSolidBrush( ref );
|
||||
colorButton( dis, brush );
|
||||
DeleteObject( brush );
|
||||
}
|
||||
|
||||
LRESULT CALLBACK
|
||||
EditColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
ClrEditDlgState* eState;
|
||||
XP_U16 wid;
|
||||
XP_U16 notifyCode;
|
||||
NMTOOLBAR* nmToolP;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
|
||||
eState = (ClrEditDlgState*)lParam;
|
||||
eState->cancelled = XP_TRUE;
|
||||
eState->inited = XP_FALSE;
|
||||
|
||||
ceDlgSetup( &eState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||
|
||||
wchar_t label[32];
|
||||
XP_U16 len = SendDlgItemMessage( eState->parent, eState->labelID,
|
||||
WM_GETTEXT, VSIZE(label),
|
||||
(long)label );
|
||||
if ( len > 0 ) {
|
||||
label[len-1] = 0; /* hack: overwrite ':' */
|
||||
}
|
||||
wchar_t buf[64];
|
||||
swprintf( buf, ceGetResStringL( eState->dlgHdr.globals,
|
||||
IDS_EDITCOLOR_FORMAT ), label );
|
||||
|
||||
SendMessage( hDlg, WM_SETTEXT, 0, (LPARAM)buf );
|
||||
|
||||
eState->sampleButton = GetDlgItem( hDlg, CLSAMPLE_BUTTON_ID );
|
||||
EnableWindow( eState->sampleButton, FALSE );
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
eState = (ClrEditDlgState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !eState ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !eState->inited ) {
|
||||
/* set to true first! Messages will be generated by
|
||||
initChooseColor call below */
|
||||
eState->inited = XP_TRUE;
|
||||
initChooseColor( eState, hDlg );
|
||||
}
|
||||
|
||||
if ( ceDoDlgHandle( &eState->dlgHdr, message, wParam, lParam) ) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (message) {
|
||||
|
||||
case WM_DRAWITEM:
|
||||
colorButtonFromState( eState, (DRAWITEMSTRUCT*)lParam );
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
nmToolP = (NMTOOLBAR*)lParam;
|
||||
wid = nmToolP->hdr.idFrom;
|
||||
switch ( wid ) {
|
||||
case CLREDT_SLIDER1:
|
||||
case CLREDT_SLIDER2:
|
||||
case CLREDT_SLIDER3:
|
||||
updateForSlider( hDlg, eState, wid );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
wid = LOWORD(wParam);
|
||||
switch( wid ) {
|
||||
case RED_EDIT:
|
||||
case GREEN_EDIT:
|
||||
case BLUE_EDIT:
|
||||
notifyCode = HIWORD(wParam);
|
||||
if ( notifyCode == EN_CHANGE ) {
|
||||
updateForField( hDlg, eState, wid );
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
eState->cancelled = XP_FALSE;
|
||||
/* fallthrough */
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, wid);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} /* EditColorsDlg */
|
||||
|
||||
static XP_Bool
|
||||
myChooseColor( CeDlgHdr* dlgHdr, XP_U16 labelID, COLORREF* cref )
|
||||
{
|
||||
ClrEditDlgState state;
|
||||
int result;
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
state.dlgHdr.globals = dlgHdr->globals;
|
||||
state.red = GetRValue(*cref);
|
||||
state.green = GetGValue(*cref);
|
||||
state.blue = GetBValue(*cref);
|
||||
state.labelID = labelID;
|
||||
state.parent = dlgHdr->hDlg;
|
||||
|
||||
XP_LOGF( "setting up IDD_COLOREDITDLG" );
|
||||
|
||||
result = DialogBoxParam( dlgHdr->globals->locInst,
|
||||
(LPCTSTR)IDD_COLOREDITDLG,
|
||||
dlgHdr->hDlg, (DLGPROC)EditColorsDlg,
|
||||
(long)&state );
|
||||
|
||||
XP_LOGF( "DialogBoxParam=>%d", result );
|
||||
|
||||
if ( !state.cancelled ) {
|
||||
*cref = RGB( state.red, state.green, state.blue );
|
||||
}
|
||||
|
||||
return !state.cancelled;
|
||||
} /* myChooseColor */
|
||||
|
||||
#endif /* MY_COLOR_SEL */
|
||||
|
||||
static void
|
||||
colorButton( DRAWITEMSTRUCT* dis, HBRUSH brush )
|
||||
{
|
||||
RECT rect = dis->rcItem;
|
||||
|
||||
Rectangle( dis->hDC, rect.left, rect.top, rect.right, rect.bottom );
|
||||
InsetRect( &rect, 1, 1 );
|
||||
FillRect( dis->hDC, &rect, brush );
|
||||
}
|
||||
|
||||
typedef struct ColorsDlgState {
|
||||
CeDlgHdr dlgHdr;
|
||||
COLORREF* inColors;
|
||||
|
||||
COLORREF colors[CE_NUM_EDITABLE_COLORS];
|
||||
HBRUSH brushes[CE_NUM_EDITABLE_COLORS];
|
||||
HWND buttons[CE_NUM_EDITABLE_COLORS];
|
||||
|
||||
XP_Bool cancelled;
|
||||
XP_Bool inited;
|
||||
} ColorsDlgState;
|
||||
|
||||
#define FIRST_BUTTON DLBLTR_SAMPLE
|
||||
#define LAST_BUTTON PLAYER4_SAMPLE
|
||||
|
||||
static void
|
||||
initColorData( ColorsDlgState* cState )
|
||||
{
|
||||
XP_U16 i;
|
||||
|
||||
XP_ASSERT( (LAST_BUTTON - FIRST_BUTTON + 1) == CE_NUM_EDITABLE_COLORS );
|
||||
|
||||
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
||||
COLORREF ref = cState->inColors[i];
|
||||
HWND button = GetDlgItem( cState->dlgHdr.hDlg, FIRST_BUTTON + i );
|
||||
cState->colors[i] = ref;
|
||||
cState->brushes[i] = CreateSolidBrush( ref );
|
||||
cState->buttons[i] = button;
|
||||
EnableWindow( button, FALSE );
|
||||
}
|
||||
} /* initColorData */
|
||||
|
||||
static HBRUSH
|
||||
brushForButton( ColorsDlgState* cState, HWND hwndButton )
|
||||
{
|
||||
XP_U16 i;
|
||||
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
||||
if ( cState->buttons[i] == hwndButton ) {
|
||||
return cState->brushes[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
} /* brushForButton */
|
||||
|
||||
static void
|
||||
deleteButtonBrushes( ColorsDlgState* cState )
|
||||
{
|
||||
XP_U16 i;
|
||||
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
||||
DeleteObject( cState->brushes[i] );
|
||||
}
|
||||
} /* deleteButtonBrushes */
|
||||
|
||||
static XP_Bool
|
||||
wrapChooseColor( ColorsDlgState* cState, XP_U16 button )
|
||||
{
|
||||
XP_Bool handled = XP_FALSE;
|
||||
if ( button >= DLBLTR_BUTTON && button <= PLAYER4_BUTTON ) {
|
||||
XP_U16 index = button - DLBLTR_BUTTON;
|
||||
|
||||
#ifdef MY_COLOR_SEL
|
||||
XP_U16 labelID = button + CLRSEL_LABEL_OFFSET;
|
||||
COLORREF clrref = cState->colors[index];
|
||||
|
||||
if ( myChooseColor( &cState->dlgHdr, labelID, &clrref ) ) {
|
||||
cState->colors[index] = clrref;
|
||||
DeleteObject( cState->brushes[index] );
|
||||
cState->brushes[index] = CreateSolidBrush( clrref );
|
||||
XP_LOGF( "%s: may need to invalidate the button since "
|
||||
"color's changed", __func__ );
|
||||
}
|
||||
#else
|
||||
CHOOSECOLOR ccs;
|
||||
BOOL hitOk;
|
||||
COLORREF arr[16];
|
||||
XP_U16 i;
|
||||
|
||||
XP_MEMSET( &ccs, 0, sizeof(ccs) );
|
||||
XP_MEMSET( &arr, 0, sizeof(arr) );
|
||||
|
||||
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
||||
arr[i] = cState->colors[i];
|
||||
}
|
||||
|
||||
ccs.lStructSize = sizeof(ccs);
|
||||
ccs.hwndOwner = cState->dlgHdr.hDlg;
|
||||
ccs.rgbResult = cState->colors[index];
|
||||
ccs.lpCustColors = arr;
|
||||
|
||||
ccs.Flags = CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN;
|
||||
|
||||
hitOk = ChooseColor( &ccs );
|
||||
|
||||
if ( hitOk ) {
|
||||
cState->colors[index] = ccs.rgbResult;
|
||||
DeleteObject( cState->brushes[index] );
|
||||
cState->brushes[index] = CreateSolidBrush( ccs.rgbResult );
|
||||
}
|
||||
#endif
|
||||
handled = XP_TRUE;
|
||||
}
|
||||
return handled;
|
||||
} /* wrapChooseColor */
|
||||
|
||||
static void
|
||||
ceDrawColorButton( ColorsDlgState* cState, DRAWITEMSTRUCT* dis )
|
||||
{
|
||||
HBRUSH brush = brushForButton( cState, dis->hwndItem );
|
||||
XP_ASSERT( !!brush );
|
||||
|
||||
colorButton( dis, brush );
|
||||
} /* ceDrawColorButton */
|
||||
|
||||
LRESULT CALLBACK
|
||||
ColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
ColorsDlgState* state;
|
||||
BOOL result = FALSE;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
|
||||
state = (ColorsDlgState*)lParam;
|
||||
state->cancelled = XP_TRUE;
|
||||
state->inited = XP_FALSE;
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||
|
||||
result = TRUE;
|
||||
} else {
|
||||
state = (ColorsDlgState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!state ) {
|
||||
XP_U16 wid;
|
||||
|
||||
if ( !state->inited ) {
|
||||
initColorData( state );
|
||||
state->inited = XP_TRUE;
|
||||
}
|
||||
|
||||
/* XP_LOGF( "%s: event=%s (%d); wParam=0x%x; lParam=0x%lx", */
|
||||
/* __func__, messageToStr(message), message, */
|
||||
/* wParam, lParam ); */
|
||||
|
||||
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
switch (message) {
|
||||
|
||||
case WM_DRAWITEM:
|
||||
ceDrawColorButton( state, (DRAWITEMSTRUCT*)lParam );
|
||||
result = TRUE;
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
if ( BN_CLICKED == HIWORD(wParam) ) {
|
||||
wid = LOWORD(wParam);
|
||||
switch( wid ) {
|
||||
case IDOK:
|
||||
state->cancelled = XP_FALSE;
|
||||
/* fallthrough */
|
||||
|
||||
case IDCANCEL:
|
||||
deleteButtonBrushes( state );
|
||||
EndDialog(hDlg, wid);
|
||||
result = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* it's one of the color buttons. Set up with the
|
||||
appropriate color and launch ChooseColor */
|
||||
result = wrapChooseColor( state, wid );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* ColorsDlg */
|
||||
|
||||
XP_Bool
|
||||
ceDoColorsEdit( HWND hwnd, CEAppGlobals* globals, COLORREF* colors )
|
||||
{
|
||||
ColorsDlgState state;
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
state.dlgHdr.globals = globals;
|
||||
state.inColors = colors;
|
||||
|
||||
(void)DialogBoxParam( globals->locInst, (LPCTSTR)IDD_COLORSDLG, hwnd,
|
||||
(DLGPROC)ColorsDlg, (long)&state );
|
||||
|
||||
if ( !state.cancelled ) {
|
||||
XP_U16 i;
|
||||
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
||||
colors[i] = state.colors[i];
|
||||
}
|
||||
}
|
||||
|
||||
return !state.cancelled;
|
||||
} /* ceDoColorsEdit */
|
|
@ -1,28 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2004 by Eric House (xwords@eehouse.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 _CECLRSEL_H_
|
||||
#define _CECLRSEL_H_
|
||||
|
||||
#include "xptypes.h"
|
||||
#include "cemain.h"
|
||||
|
||||
XP_Bool ceDoColorsEdit( HWND hwnd, CEAppGlobals* globals, COLORREF* colors );
|
||||
|
||||
#endif
|
|
@ -1,374 +0,0 @@
|
|||
/* -*- fill-column: 77; compile-command: "make -j2 TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2005-2009 by Eric House (xwords@eehouse.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 XWFEATURE_STANDALONE_ONLY
|
||||
|
||||
#include "cecondlg.h"
|
||||
#include "ceutil.h"
|
||||
#include "debhacks.h"
|
||||
#include "ceresstr.h"
|
||||
#include "contypct.h"
|
||||
|
||||
typedef struct _ConnDlgPair {
|
||||
CommsConnType conType;
|
||||
XP_U16 resId;
|
||||
} ConnDlgPair;
|
||||
|
||||
typedef struct _CeConnDlgState {
|
||||
CeDlgHdr dlgHdr;
|
||||
CommsAddrRec addrRec;
|
||||
DeviceRole role;
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
XP_U16 connComboId;
|
||||
#endif
|
||||
ConnDlgPair* types;
|
||||
XP_Bool userCancelled;
|
||||
XP_Bool forShowOnly;
|
||||
} CeConnDlgState;
|
||||
|
||||
static void
|
||||
ceControlsToAddrRec( HWND hDlg, CeConnDlgState* state )
|
||||
{
|
||||
XP_U16 len;
|
||||
|
||||
if ( state->addrRec.conType == COMMS_CONN_RELAY ) {
|
||||
#ifdef XWFEATURE_RELAY
|
||||
# ifndef RELAY_NOEDIT_ADDR
|
||||
len = sizeof(state->addrRec.u.ip_relay.hostName);
|
||||
ceGetDlgItemText( hDlg, RELAYNAME_EDIT,
|
||||
state->addrRec.u.ip_relay.hostName, &len );
|
||||
state->addrRec.u.ip_relay.port =
|
||||
(XP_U16)ceGetDlgItemNum( hDlg, RELAYPORT_EDIT );
|
||||
#endif
|
||||
len = sizeof(state->addrRec.u.ip_relay.invite);
|
||||
ceGetDlgItemText( hDlg, INVITE_EDIT, state->addrRec.u.ip_relay.invite,
|
||||
&len );
|
||||
#endif
|
||||
} else if ( state->addrRec.conType == COMMS_CONN_IP_DIRECT ) {
|
||||
#ifdef XWFEATURE_IP_DIRECT
|
||||
len = sizeof(state->addrRec.u.ip.hostName_ip);
|
||||
ceGetDlgItemText( hDlg, IPNAME_EDIT, state->addrRec.u.ip.hostName_ip,
|
||||
&len );
|
||||
#endif
|
||||
} else if ( state->addrRec.conType == COMMS_CONN_BT ) {
|
||||
#ifdef XWFEATURE_BLUETOOTH
|
||||
if ( state->role == SERVER_ISCLIENT ) {
|
||||
len = sizeof(state->addrRec.u.bt.hostName);
|
||||
ceGetDlgItemText( hDlg, IDC_BLUET_ADDR_EDIT,
|
||||
state->addrRec.u.bt.hostName, &len );
|
||||
}
|
||||
#endif
|
||||
} else if ( state->addrRec.conType == COMMS_CONN_SMS ) {
|
||||
#ifdef XWFEATURE_SMS
|
||||
len = sizeof(state->addrRec.u.sms.phone);
|
||||
ceGetDlgItemText( hDlg, IDC_SMS_PHONE_EDIT, state->addrRec.u.sms.phone,
|
||||
&len );
|
||||
state->addrRec.u.sms.port = (XP_U16)ceGetDlgItemNum( hDlg,
|
||||
IDC_SMS_PORT_EDIT );
|
||||
#endif
|
||||
} else {
|
||||
XP_ASSERT(0);
|
||||
}
|
||||
} /* ceControlsToAddrRec */
|
||||
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
static CommsConnType
|
||||
indexToConType( const CeConnDlgState* state, XP_U16 index )
|
||||
{
|
||||
CommsConnType conType = state->types[index].conType;
|
||||
XP_ASSERT( conTypeToIndex( state, conType ) == index );
|
||||
return conType;
|
||||
} /* indexToConType */
|
||||
|
||||
static XP_U16
|
||||
conTypeToIndex( const CeConnDlgState* state, CommsConnType conType )
|
||||
{
|
||||
XP_U16 ii;
|
||||
for ( ii = 0; state->types[ii].conType != COMMS_CONN_NONE; ++ii ) {
|
||||
if ( conType == state->types[ii].conType ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
XP_ASSERT( state->types[ii].conType != COMMS_CONN_NONE );
|
||||
return ii;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
static void
|
||||
adjustForConnType( HWND hDlg, CeConnDlgState* state, XP_Bool useFromState )
|
||||
{
|
||||
XP_U16 relayIds[] = {
|
||||
IDC_INVITE_LAB,
|
||||
#ifdef XWFEATURE_RELAY
|
||||
INVITE_EDIT,
|
||||
# ifndef RELAY_NOEDIT_ADDR
|
||||
IDC_CRELAYNAME_LAB,RELAYNAME_EDIT, IDC_CRELAYPORT_LAB, RELAYPORT_EDIT,
|
||||
# endif
|
||||
#endif
|
||||
0 };
|
||||
XP_U16 directIds[] = {
|
||||
IDC_IPNAME_LAB,
|
||||
IPNAME_EDIT,
|
||||
0
|
||||
};
|
||||
XP_U16 smsIds[] = {
|
||||
IDC_SMS_PHONE_LAB,
|
||||
IDC_SMS_PHONE_EDIT,
|
||||
IDC_SMS_PORT_LAB,
|
||||
IDC_SMS_PORT_EDIT,
|
||||
0
|
||||
};
|
||||
XP_U16* allIDs[] = { relayIds, directIds, smsIds };
|
||||
XP_U16* on = NULL;
|
||||
XP_U16 ii;
|
||||
CommsConnType conType;
|
||||
|
||||
if ( !useFromState ) {
|
||||
XP_S16 sel;
|
||||
sel = SendDlgItemMessage( hDlg, state->connComboId,
|
||||
GETCURSEL(state->dlgHdr.globals), 0, 0L );
|
||||
state->addrRec.conType = indexToConType( state, sel );
|
||||
}
|
||||
|
||||
conType = state->addrRec.conType;
|
||||
|
||||
if ( 0 ) {
|
||||
#ifdef XWFEATURE_RELAY
|
||||
} else if ( conType == COMMS_CONN_RELAY ) {
|
||||
on = relayIds;
|
||||
#endif
|
||||
#ifdef XWFEATURE_IP_DIRECT
|
||||
} else if ( COMMS_CONN_IP_DIRECT == conType ) {
|
||||
on = directIds;
|
||||
#endif
|
||||
#ifdef XWFEATURE_SMS
|
||||
} else if ( COMMS_CONN_SMS == conType ) {
|
||||
on = smsIds;
|
||||
#endif
|
||||
#ifdef XWFEATURE_BLUETOOTH
|
||||
} else if ( COMMS_CONN_BT == conType ) {
|
||||
on = btIds;
|
||||
#endif
|
||||
}
|
||||
|
||||
for ( ii = 0; ii < VSIZE(allIDs); ++ii ) {
|
||||
XP_U16* ids = allIDs[ii];
|
||||
XP_Bool enable = ids == on;
|
||||
while ( *ids != 0 ) {
|
||||
ceShowOrHide( hDlg, *(ids++), enable );
|
||||
}
|
||||
}
|
||||
#ifdef _WIN32_WCE
|
||||
if ( IS_SMARTPHONE(state->dlgHdr.globals) ) {
|
||||
SendMessage( hDlg, DM_RESETSCROLL, (WPARAM)TRUE, (LPARAM)TRUE );
|
||||
}
|
||||
#endif
|
||||
} /* adjustForConnType */
|
||||
#endif
|
||||
|
||||
static void
|
||||
ceControlsFromAddrRec( HWND hDlg, const CeConnDlgState* state )
|
||||
{
|
||||
CommsConnType conType;
|
||||
XP_U16 ids[32];
|
||||
XP_S16 nIds = 0;
|
||||
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
XP_U16 ii;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
for ( ii = 0; ; ++ii ) {
|
||||
ConnDlgPair* type = &state->types[ii];
|
||||
if ( type->conType == COMMS_CONN_NONE ) {
|
||||
break;
|
||||
}
|
||||
/* make sure tables are in sync */
|
||||
XP_ASSERT( ii == conTypeToIndex( state, type->conType ) );
|
||||
const wchar_t* str = ceGetResStringL( globals, type->resId );
|
||||
SendDlgItemMessage( hDlg, state->connComboId, ADDSTRING(globals),
|
||||
0, (LPARAM)str );
|
||||
}
|
||||
|
||||
SendDlgItemMessage( hDlg, state->connComboId, SETCURSEL(globals),
|
||||
conTypeToIndex(state, state->addrRec.conType), 0L );
|
||||
ids[nIds++] = state->connComboId;
|
||||
#endif
|
||||
|
||||
conType = state->addrRec.conType;
|
||||
if ( state->addrRec.conType == COMMS_CONN_RELAY ) {
|
||||
#ifdef XWFEATURE_RELAY
|
||||
ceSetDlgItemText( hDlg, INVITE_EDIT,
|
||||
state->addrRec.u.ip_relay.invite );
|
||||
ids[nIds++] = INVITE_EDIT;
|
||||
|
||||
XP_U16 hideMe = SERVER_ISSERVER == state->role ?
|
||||
IDC_INVITE_HELP_GUEST : IDC_INVITE_HELP_HOST;
|
||||
ceShowOrHide( hDlg, hideMe, XP_FALSE );
|
||||
|
||||
# ifndef RELAY_NOEDIT_ADDR
|
||||
ceSetDlgItemText( hDlg, RELAYNAME_EDIT,
|
||||
state->addrRec.u.ip_relay.hostName );
|
||||
ids[nIds++] = RELAYNAME_EDIT;
|
||||
ceSetDlgItemNum( hDlg, RELAYPORT_EDIT,
|
||||
state->addrRec.u.ip_relay.port );
|
||||
ids[nIds++] = RELAYPORT_EDIT;
|
||||
#endif
|
||||
#endif
|
||||
} else if ( state->addrRec.conType == COMMS_CONN_IP_DIRECT ) {
|
||||
#ifdef XWFEATURE_IP_DIRECT
|
||||
ceSetDlgItemText( hDlg, IPNAME_EDIT, state->addrRec.u.ip.hostName_ip );
|
||||
ids[nIds++] = IPNAME_EDIT;
|
||||
#endif
|
||||
} else if ( state->addrRec.conType == COMMS_CONN_BT ) {
|
||||
#ifdef XWFEATURE_BLUETOOTH
|
||||
if ( state->role == SERVER_ISCLIENT ) {
|
||||
ceSetDlgItemText( hDlg, IDC_BLUET_ADDR_EDIT,
|
||||
state->addrRec.u.bt.hostName );
|
||||
ids[nIds++] = IDC_BLUET_ADDR_EDIT;
|
||||
}
|
||||
#endif
|
||||
} else if ( state->addrRec.conType == COMMS_CONN_SMS ) {
|
||||
#ifdef XWFEATURE_SMS
|
||||
ceSetDlgItemText( hDlg, IDC_SMS_PHONE_EDIT, state->addrRec.u.sms.phone );
|
||||
ids[nIds++] = IDC_SMS_PHONE_EDIT;
|
||||
ceSetDlgItemNum( hDlg, IDC_SMS_PORT_EDIT, state->addrRec.u.sms.port );
|
||||
ids[nIds++] = IDC_SMS_PORT_EDIT;
|
||||
#endif
|
||||
} else {
|
||||
XP_ASSERT(0);
|
||||
}
|
||||
|
||||
XP_ASSERT( nIds < VSIZE(ids) );
|
||||
if ( state->forShowOnly ) {
|
||||
while ( nIds-- > 0 ) {
|
||||
ceEnOrDisable( hDlg, ids[nIds], XP_FALSE );
|
||||
}
|
||||
}
|
||||
} /* ceControlsFromAddrRec */
|
||||
|
||||
static LRESULT CALLBACK
|
||||
ConnsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
LRESULT result = FALSE;
|
||||
|
||||
CeConnDlgState* state;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
state = (CeConnDlgState*)lParam;
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
state->connComboId = LB_IF_PPC(state->dlgHdr.globals,IDC_CONNECT_COMBO);
|
||||
adjustForConnType( hDlg, state, XP_TRUE );
|
||||
#endif
|
||||
ceControlsFromAddrRec( hDlg, state );
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
ceDlgComboShowHide( &state->dlgHdr, IDC_CONNECT_COMBO );
|
||||
#endif
|
||||
|
||||
result = TRUE;
|
||||
} else {
|
||||
state = (CeConnDlgState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!state ) {
|
||||
XP_U16 id = LOWORD(wParam);
|
||||
|
||||
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||
result = TRUE;
|
||||
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
} else if ( WM_NOTIFY == message ) {
|
||||
if ( (id-1) == state->connComboId ) {
|
||||
adjustForConnType( hDlg, state, XP_FALSE );
|
||||
}
|
||||
#endif
|
||||
} else if ( WM_COMMAND == message ) {
|
||||
if ( 0 ) {
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
} else if ( id == state->connComboId ) {
|
||||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||
adjustForConnType( hDlg, state, XP_FALSE );
|
||||
result = TRUE;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
switch ( id ) {
|
||||
case IDOK:
|
||||
ceControlsToAddrRec( hDlg, state );
|
||||
if ( !comms_checkComplete( &state->addrRec ) ) {
|
||||
break;
|
||||
}
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, id);
|
||||
state->userCancelled = id == IDCANCEL;
|
||||
result = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* ConnsDlg */
|
||||
|
||||
XP_Bool
|
||||
WrapConnsDlg( HWND hDlg, CEAppGlobals* globals, const CommsAddrRec* addrRecIn,
|
||||
CommsAddrRec* addrRecOut, DeviceRole role, XP_Bool isNewGame,
|
||||
XP_Bool* connsComplete )
|
||||
{
|
||||
XP_Bool result;
|
||||
CeConnDlgState state;
|
||||
ConnDlgPair types[] = {
|
||||
#ifdef XWFEATURE_RELAY
|
||||
{ COMMS_CONN_RELAY, IDS_CONN_RELAY_L },
|
||||
#endif
|
||||
#ifdef XWFEATURE_IP_DIRECT
|
||||
{ COMMS_CONN_IP_DIRECT, IDS_CONN_DIRECT_L },
|
||||
#endif
|
||||
#ifdef XWFEATURE_SMS
|
||||
{ COMMS_CONN_SMS, IDS_CONN_SMS_L },
|
||||
#endif
|
||||
{ COMMS_CONN_NONE, 0 }
|
||||
};
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof( state ) );
|
||||
|
||||
state.dlgHdr.globals = globals;
|
||||
state.types = types;
|
||||
state.role = role;
|
||||
state.forShowOnly = !isNewGame;
|
||||
XP_MEMCPY( &state.addrRec, addrRecIn, sizeof(state.addrRec) );
|
||||
|
||||
DialogBoxParam( globals->locInst, (LPCTSTR)IDD_CONNSSDLG, hDlg,
|
||||
(DLGPROC)ConnsDlg, (long)&state );
|
||||
|
||||
result = isNewGame && !state.userCancelled;
|
||||
|
||||
if ( result ) {
|
||||
XP_MEMCPY( addrRecOut, &state.addrRec, sizeof(*addrRecOut) );
|
||||
}
|
||||
|
||||
*connsComplete = result && comms_checkComplete( addrRecOut );
|
||||
|
||||
return result;
|
||||
} /* WrapConnsDlg */
|
||||
|
||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2005-2009 by Eric House (xwords@eehouse.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 _CECONDLG_H_
|
||||
#define _CECONDLG_H_
|
||||
|
||||
#include "comms.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
|
||||
XP_Bool WrapConnsDlg( HWND hDlg, CEAppGlobals* globals,
|
||||
const CommsAddrRec* addrRecIn, CommsAddrRec* addrRecOut,
|
||||
DeviceRole role, XP_Bool isNewGame,
|
||||
XP_Bool* connsComplete );
|
||||
|
||||
#endif
|
|
@ -1,44 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2005-2009 by Eric House (xwords@eehouse.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 should eventually be contributed to cegcc. Everything it in comes
|
||||
* from MSDN
|
||||
*/
|
||||
#ifndef _CECONNMG_H_
|
||||
#define _CECONNMG_H_
|
||||
|
||||
#include <connmgr.h>
|
||||
|
||||
|
||||
typedef HRESULT (*ConnMgrRegisterForStatusChangeNotificationProc)( BOOL, HWND );
|
||||
typedef HRESULT (*ConnMgrEstablishConnectionProc)( CONNMGR_CONNECTIONINFO*,
|
||||
HANDLE* );
|
||||
typedef HRESULT (*ConnMgrConnectionStatusProc)( HANDLE, DWORD* );
|
||||
typedef HRESULT (*ConnMgrMapURLProc)( LPTSTR, GUID*, DWORD* );
|
||||
typedef HRESULT (*ConnMgrReleaseConnectionProc)( HANDLE, LONG );
|
||||
|
||||
typedef struct _CMProcs {
|
||||
ConnMgrEstablishConnectionProc ConnMgrEstablishConnection;
|
||||
ConnMgrConnectionStatusProc ConnMgrConnectionStatus;
|
||||
ConnMgrMapURLProc ConnMgrMapURL;
|
||||
ConnMgrReleaseConnectionProc ConnMgrReleaseConnection;
|
||||
} CMProcs;
|
||||
|
||||
#endif
|
|
@ -1,153 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2008 by Eric House (xwords@eehouse.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 <stdio.h>
|
||||
#include "cedebug.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define CASE_STR(c) case c: str = #c; break
|
||||
|
||||
const char*
|
||||
messageToStr( UINT message )
|
||||
{
|
||||
const char* str;
|
||||
switch( message ) {
|
||||
CASE_STR( WM_NCACTIVATE );
|
||||
CASE_STR( WM_QUERYNEWPALETTE );
|
||||
#ifdef _WIN32_WCE
|
||||
CASE_STR( WM_IME_NOTIFY );
|
||||
CASE_STR( WM_IME_SETCONTEXT );
|
||||
#endif
|
||||
CASE_STR( WM_WINDOWPOSCHANGED );
|
||||
CASE_STR( WM_MOVE );
|
||||
CASE_STR( WM_SIZE );
|
||||
CASE_STR( WM_ACTIVATE );
|
||||
CASE_STR( WM_SETTINGCHANGE );
|
||||
CASE_STR( WM_VSCROLL );
|
||||
CASE_STR( WM_COMMAND );
|
||||
CASE_STR( WM_PAINT );
|
||||
CASE_STR( WM_LBUTTONDOWN );
|
||||
CASE_STR( WM_MOUSEMOVE );
|
||||
CASE_STR( WM_LBUTTONUP );
|
||||
CASE_STR( WM_KEYDOWN );
|
||||
CASE_STR( WM_KEYUP );
|
||||
CASE_STR( WM_CHAR );
|
||||
CASE_STR( WM_TIMER );
|
||||
CASE_STR( WM_DESTROY );
|
||||
CASE_STR( XWWM_TIME_RQST );
|
||||
CASE_STR( XWWM_HOSTNAME_ARRIVED );
|
||||
CASE_STR( XWWM_SOCKET_EVT );
|
||||
CASE_STR( WM_DRAWITEM );
|
||||
CASE_STR( WM_NEXTDLGCTL );
|
||||
CASE_STR( WM_CTLCOLORSTATIC );
|
||||
CASE_STR( WM_CTLCOLORBTN );
|
||||
CASE_STR( WM_SETFONT );
|
||||
CASE_STR( WM_INITDIALOG );
|
||||
CASE_STR( WM_SHOWWINDOW );
|
||||
CASE_STR( WM_WINDOWPOSCHANGING );
|
||||
CASE_STR( WM_SETFOCUS );
|
||||
CASE_STR( WM_NCPAINT );
|
||||
CASE_STR( WM_ERASEBKGND );
|
||||
CASE_STR( WM_NCCALCSIZE );
|
||||
CASE_STR( WM_SETTEXT );
|
||||
CASE_STR( WM_CTLCOLORDLG );
|
||||
CASE_STR( WM_MOUSEACTIVATE );
|
||||
CASE_STR( WM_SETCURSOR );
|
||||
CASE_STR( WM_CTLCOLORLISTBOX );
|
||||
CASE_STR( WM_CTLCOLOREDIT );
|
||||
CASE_STR( WM_NCDESTROY );
|
||||
CASE_STR( WM_NOTIFY );
|
||||
CASE_STR( WM_NCHITTEST );
|
||||
CASE_STR( WM_HSCROLL );
|
||||
CASE_STR( WM_STYLECHANGED );
|
||||
CASE_STR( WM_NOTIFYFORMAT );
|
||||
CASE_STR( WM_KILLFOCUS );
|
||||
CASE_STR( WM_CTLCOLORSCROLLBAR );
|
||||
CASE_STR( WM_NCMOUSEMOVE );
|
||||
CASE_STR( SBM_SETSCROLLINFO );
|
||||
CASE_STR( WM_HOTKEY );
|
||||
CASE_STR( WM_CLOSE );
|
||||
CASE_STR( WM_ACTIVATEAPP );
|
||||
CASE_STR( WM_ENTERMENULOOP );
|
||||
CASE_STR( WM_EXITMENULOOP );
|
||||
CASE_STR( WM_INITMENUPOPUP );
|
||||
CASE_STR( WM_CANCELMODE );
|
||||
CASE_STR( WM_ENTERIDLE );
|
||||
CASE_STR( WM_GETDLGCODE );
|
||||
default:
|
||||
str = "<unknown>";
|
||||
}
|
||||
return str;
|
||||
} /* messageToStr */
|
||||
|
||||
void
|
||||
XP_LOGW( const XP_UCHAR* prefix, const wchar_t* arg )
|
||||
{
|
||||
XP_UCHAR buf[512];
|
||||
(void)WideCharToMultiByte( CP_UTF8, 0, arg, -1,
|
||||
buf, sizeof(buf), NULL, NULL );
|
||||
XP_LOGF( "%s: %s", prefix, buf );
|
||||
}
|
||||
|
||||
void
|
||||
logRect( const char* comment, const RECT* rect )
|
||||
{
|
||||
XP_LOGF( "%s: %s: left=%ld,top=%ld,right=%ld,bottom=%ld", __func__,
|
||||
comment, rect->left, rect->top, rect->right, rect->bottom );
|
||||
}
|
||||
|
||||
#undef CASE_STR
|
||||
|
||||
void
|
||||
logLastError( const char* comment )
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
DWORD lastErr = GetLastError();
|
||||
XP_UCHAR msg[256];
|
||||
XP_U16 len;
|
||||
XP_U16 lenSoFar;
|
||||
|
||||
snprintf( msg, sizeof(msg), "%s (err: %ld): ", comment, lastErr );
|
||||
lenSoFar = strlen( msg );
|
||||
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
lastErr,
|
||||
0, // Default language
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
len = wcslen( lpMsgBuf );
|
||||
if ( len >= sizeof(msg)-lenSoFar ) {
|
||||
len = sizeof(msg) - lenSoFar - 1;
|
||||
}
|
||||
WideCharToMultiByte( CP_ACP, 0, lpMsgBuf, len + 1,
|
||||
msg + lenSoFar, len + 1, NULL, NULL );
|
||||
LocalFree( lpMsgBuf );
|
||||
|
||||
XP_LOGF( "system error: %s", msg );
|
||||
} /* logLastError */
|
||||
|
||||
#endif /* DEBUG */
|
|
@ -1,45 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
|
||||
/* Copyright 2008 by Eric House (xwords@eehouse.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 _CEDEBUG_H_
|
||||
#define _CEDEBUG_H_
|
||||
|
||||
#include "cemain.h"
|
||||
|
||||
const char* messageToStr( UINT message );
|
||||
void logRect( const char* comment, const RECT* rect );
|
||||
|
||||
#ifdef DEBUG
|
||||
void XP_LOGW( const XP_UCHAR* prefix, const wchar_t* arg );
|
||||
void logLastError( const char* comment );
|
||||
void messageToBuf( UINT message, char* buf, int bufSize );
|
||||
#else
|
||||
# define XP_LOGW( prefix, arg )
|
||||
# define logLastError(c)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
# define assertOnTop( hWnd ) { \
|
||||
XP_ASSERT( (hWnd) == GetForegroundWindow() ); \
|
||||
}
|
||||
#else
|
||||
# define assertOnTop( w )
|
||||
#endif
|
||||
|
||||
#endif /* _CEDEBUG_H_ */
|
|
@ -1,37 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002 by Eric House (xwords@eehouse.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 _CEDEFINES_H_
|
||||
#define _CEDEFINES_H_
|
||||
|
||||
#define CE_MAX_ROWS 15
|
||||
|
||||
#define TRAY_BORDER 6
|
||||
#define CELL_BORDER 3
|
||||
|
||||
#define MIN_CELL_WIDTH 10
|
||||
#define MIN_CELL_HEIGHT 13
|
||||
/* 1 below for what's subtracted from bparms->trayHeight */
|
||||
#define MIN_TRAY_HEIGHT (((MIN_CELL_HEIGHT) + (TRAY_BORDER - CELL_BORDER)) + 1)
|
||||
|
||||
/* Favor the tray over the scoreboard. */
|
||||
#define SCORE_TWEAK 2
|
||||
|
||||
|
||||
#endif
|
|
@ -1,863 +0,0 @@
|
|||
/* -*- fill-column: 77; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 1997-2008 by Eric House (xwords@eehouse.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 STUBBED_DICT
|
||||
|
||||
#include <stdio.h> /* _snwprintf */
|
||||
#include <string.h> /* _snwprintf */
|
||||
|
||||
#include "stdafx.h"
|
||||
/* #include <accctrl.h> */
|
||||
#include <commdlg.h>
|
||||
#include "dictnryp.h"
|
||||
#include "strutils.h"
|
||||
#include "cedict.h"
|
||||
#include "debhacks.h"
|
||||
#include "cedebug.h"
|
||||
#include "ceutil.h"
|
||||
|
||||
typedef struct CEDictionaryCtxt {
|
||||
DictionaryCtxt super;
|
||||
HANDLE mappedFile;
|
||||
void* mappedBase;
|
||||
} CEDictionaryCtxt;
|
||||
|
||||
static void ce_dict_destroy( DictionaryCtxt* dict );
|
||||
static const XP_UCHAR* ce_dict_getShortName( const DictionaryCtxt* dict );
|
||||
static void ceLoadSpecialData( CEDictionaryCtxt* ctxt, XP_U8** ptrp );
|
||||
static XP_U16 ceCountSpecials( CEDictionaryCtxt* ctxt );
|
||||
static XP_Bitmap ceMakeBitmap( CEDictionaryCtxt* ctxt, XP_U8** ptrp );
|
||||
|
||||
static XP_U32 n_ptr_tohl( XP_U8** in );
|
||||
static XP_U16 n_ptr_tohs( XP_U8** in );
|
||||
static XP_U8* openMappedFile( MPFORMAL const wchar_t* name,
|
||||
HANDLE* mappedFileP, HANDLE* hFileP,
|
||||
XP_U32* sizep );
|
||||
static void closeMappedFile( MPFORMAL XP_U8* base, HANDLE mappedFile );
|
||||
static XP_Bool checkIfDictAndLegal( MPFORMAL wchar_t* path, XP_U16 pathLen,
|
||||
wchar_t* name );
|
||||
static XP_Bool findAlternateDict( CEAppGlobals* globals, wchar_t* dictName );
|
||||
|
||||
#define ALIGN_COUNT 2
|
||||
|
||||
DictionaryCtxt*
|
||||
ce_dictionary_make( CEAppGlobals* globals, const char* dictName )
|
||||
{
|
||||
CEDictionaryCtxt* ctxt = (CEDictionaryCtxt*)NULL;
|
||||
HANDLE mappedFile = NULL;
|
||||
|
||||
wchar_t nameBuf[MAX_PATH+1];
|
||||
HANDLE hFile;
|
||||
XP_U8* ptr = NULL;
|
||||
XP_U32 dictLength;
|
||||
XP_UCHAR buf[CE_MAX_PATH_LEN+1]; /* in case we have to look */
|
||||
UINT codePages[] = { CP_ACP, CP_UTF8 };
|
||||
XP_U16 ii;
|
||||
|
||||
XP_ASSERT( !!dictName );
|
||||
|
||||
/* Try both old-iso and UTF-8 to convert file name */
|
||||
for ( ii = 0; ii < VSIZE(codePages); ++ii ) {
|
||||
if ( 0 != MultiByteToWideChar( codePages[ii], 0, dictName, -1,
|
||||
nameBuf, VSIZE(nameBuf) ) ) {
|
||||
ptr = openMappedFile( MPPARM(globals->mpool) nameBuf, &mappedFile,
|
||||
&hFile, &dictLength );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !ptr ) {
|
||||
if ( findAlternateDict( globals, nameBuf ) ) {
|
||||
(void)WideCharToMultiByte( CP_ACP, 0, nameBuf, -1,
|
||||
buf, sizeof(buf), NULL, NULL );
|
||||
ptr = openMappedFile( MPPARM(globals->mpool) nameBuf, &mappedFile,
|
||||
&hFile, &dictLength );
|
||||
if ( !!ptr ) {
|
||||
dictName = buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while( !!ptr ) { /* lets us break.... */
|
||||
XP_U32 offset;
|
||||
XP_U16 numFaces, numFaceBytes = 0;
|
||||
XP_U16 i;
|
||||
XP_U16 flags;
|
||||
void* mappedBase = (void*)ptr;
|
||||
XP_U8 nodeSize;
|
||||
XP_Bool isUTF8 = XP_FALSE;
|
||||
XP_Bool hasHeader;
|
||||
|
||||
flags = n_ptr_tohs( &ptr );
|
||||
hasHeader = 0 != (DICT_HEADER_MASK & flags);
|
||||
if ( hasHeader ) {
|
||||
flags &= ~DICT_HEADER_MASK;
|
||||
}
|
||||
|
||||
#ifdef NODE_CAN_4
|
||||
if ( flags == 0x0002 ) {
|
||||
nodeSize = 3;
|
||||
} else if ( flags == 0x0003 ) {
|
||||
nodeSize = 4;
|
||||
} else if ( flags == 0x0004 ) {
|
||||
isUTF8 = XP_TRUE;
|
||||
nodeSize = 3;
|
||||
} else if ( flags == 0x0005 ) {
|
||||
isUTF8 = XP_TRUE;
|
||||
nodeSize = 4;
|
||||
} else {
|
||||
break; /* we want to return NULL */
|
||||
}
|
||||
#else
|
||||
if( flags != 0x0001 ) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
XP_U32 wordCount = 0;
|
||||
if ( hasHeader ) {
|
||||
XP_U16 headerLen;
|
||||
|
||||
XP_MEMCPY( &headerLen, ptr, sizeof(headerLen) );
|
||||
ptr += sizeof(headerLen);
|
||||
headerLen = XP_NTOHS( headerLen );
|
||||
if ( headerLen != sizeof(wordCount) ) { /* the only case we know right now */
|
||||
XP_LOGF( "%s: bad header size %d", __func__, headerLen );
|
||||
break;
|
||||
}
|
||||
XP_MEMCPY( &wordCount, ptr, sizeof(wordCount) );
|
||||
ptr += sizeof(wordCount);
|
||||
wordCount = XP_NTOHL( wordCount );
|
||||
}
|
||||
|
||||
if ( isUTF8 ) {
|
||||
numFaceBytes = (XP_U16)(*ptr++);
|
||||
}
|
||||
numFaces = (XP_U16)(*ptr++);
|
||||
if ( numFaces > 64 ) {
|
||||
break;
|
||||
}
|
||||
|
||||
ctxt = (CEDictionaryCtxt*)ce_dictionary_make_empty( globals );
|
||||
|
||||
ctxt->mappedFile = mappedFile;
|
||||
ctxt->mappedBase = mappedBase;
|
||||
ctxt->super.nodeSize = nodeSize;
|
||||
ctxt->super.nWords = wordCount;
|
||||
ctxt->super.destructor = ce_dict_destroy;
|
||||
ctxt->super.func_dict_getShortName = ce_dict_getShortName;
|
||||
|
||||
if ( !isUTF8 ) {
|
||||
numFaceBytes = numFaces * 2;
|
||||
}
|
||||
|
||||
ctxt->super.nFaces = (XP_U8)numFaces;
|
||||
ctxt->super.isUTF8 = isUTF8;
|
||||
|
||||
if ( isUTF8 ) {
|
||||
dict_splitFaces( &ctxt->super, ptr, numFaceBytes, numFaces );
|
||||
ptr += numFaceBytes;
|
||||
} else {
|
||||
XP_U8 tmp[numFaces*4]; /* should be enough... */
|
||||
XP_U16 nBytes = 0;
|
||||
XP_U16 ii;
|
||||
/* Need to translate from iso-8859-n to utf8 */
|
||||
for ( ii = 0; ii < numFaces; ++ii ) {
|
||||
XP_UCHAR ch = ptr[1];
|
||||
wchar_t wch;
|
||||
|
||||
ptr += 2;
|
||||
MultiByteToWideChar( CP_ACP, 0, &ch, 1, &wch, 1 );
|
||||
XP_UCHAR utfs[8];
|
||||
int len = WideCharToMultiByte( CP_UTF8, 0, &wch, 1,
|
||||
utfs, VSIZE(utfs), NULL, NULL );
|
||||
XP_MEMCPY( &tmp[nBytes], utfs, len );
|
||||
nBytes += len;
|
||||
}
|
||||
dict_splitFaces( &ctxt->super, tmp, nBytes, numFaces );
|
||||
}
|
||||
|
||||
ctxt->super.is_4_byte = (ctxt->super.nodeSize == 4);
|
||||
|
||||
ctxt->super.countsAndValues =
|
||||
(XP_U8*)XP_MALLOC(globals->mpool, numFaces*2);
|
||||
|
||||
ptr += 2; /* skip xloc header */
|
||||
for ( i = 0; i < numFaces*2; i += 2 ) {
|
||||
ctxt->super.countsAndValues[i] = *ptr++;
|
||||
ctxt->super.countsAndValues[i+1] = *ptr++;
|
||||
}
|
||||
|
||||
ceLoadSpecialData( ctxt, &ptr );
|
||||
|
||||
dictLength -= ptr - (XP_U8*)ctxt->mappedBase;
|
||||
if ( dictLength > sizeof(XP_U32) ) {
|
||||
offset = n_ptr_tohl( &ptr );
|
||||
dictLength -= sizeof(offset);
|
||||
#ifdef NODE_CAN_4
|
||||
XP_ASSERT( dictLength % ctxt->super.nodeSize == 0 );
|
||||
# ifdef DEBUG
|
||||
ctxt->super.numEdges = dictLength / ctxt->super.nodeSize;
|
||||
# endif
|
||||
#else
|
||||
XP_ASSERT( dictLength % 3 == 0 );
|
||||
# ifdef DEBUG
|
||||
ctxt->super.numEdges = dictLength / 3;
|
||||
# endif
|
||||
#endif
|
||||
} else {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
if ( dictLength > 0 ) {
|
||||
ctxt->super.base = (array_edge*)ptr;
|
||||
#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;
|
||||
}
|
||||
|
||||
setBlankTile( &ctxt->super );
|
||||
|
||||
ctxt->super.name = copyString(globals->mpool, dictName);
|
||||
break; /* exit phony while loop */
|
||||
}
|
||||
return (DictionaryCtxt*)ctxt;
|
||||
} /* ce_dictionary_make */
|
||||
|
||||
DictionaryCtxt*
|
||||
ce_dictionary_make_empty( CEAppGlobals* XP_UNUSED_DBG(globals) )
|
||||
{
|
||||
CEDictionaryCtxt* ctxt = (CEDictionaryCtxt*)XP_MALLOC(globals->mpool,
|
||||
sizeof(*ctxt));
|
||||
XP_MEMSET( ctxt, 0, sizeof(*ctxt) );
|
||||
|
||||
dict_super_init( (DictionaryCtxt*)ctxt );
|
||||
MPASSIGN( ctxt->super.mpool, globals->mpool );
|
||||
return (DictionaryCtxt*)ctxt;
|
||||
} /* ce_dictionary_make_empty */
|
||||
|
||||
void
|
||||
dict_splitFaces( DictionaryCtxt* dict, const XP_U8* utf8,
|
||||
XP_U16 nBytes, XP_U16 nFaces )
|
||||
{
|
||||
XP_UCHAR* faces = XP_MALLOC( dict->mpool, nBytes + nFaces );
|
||||
const XP_UCHAR** ptrs = XP_MALLOC( dict->mpool, nFaces * sizeof(ptrs[0]));
|
||||
XP_U16 ii;
|
||||
XP_UCHAR* next = faces;
|
||||
|
||||
wchar_t widebuf[nFaces];
|
||||
int nRead = MultiByteToWideChar( CP_UTF8, 0, (char*)utf8, nBytes,
|
||||
widebuf, VSIZE(widebuf) );
|
||||
if ( 0 == nRead ) {
|
||||
logLastError( "MultiByteToWideChar" );
|
||||
}
|
||||
XP_ASSERT( nRead == nFaces );
|
||||
|
||||
/* now split */
|
||||
for ( ii = 0; ii < nFaces; ++ii ) {
|
||||
ptrs[ii] = next;
|
||||
int nWritten = WideCharToMultiByte( CP_UTF8, 0, &widebuf[ii], 1,
|
||||
next, 100, NULL, NULL );
|
||||
next += nWritten;
|
||||
*next++ = 0;
|
||||
}
|
||||
|
||||
XP_ASSERT( next == faces + nFaces + nBytes );
|
||||
XP_ASSERT( !dict->faces );
|
||||
dict->faces = faces;
|
||||
XP_ASSERT( !dict->facePtrs );
|
||||
dict->facePtrs = ptrs;
|
||||
} /* dict_splitFaces */
|
||||
|
||||
static void
|
||||
ceLoadSpecialData( CEDictionaryCtxt* ctxt, XP_U8** ptrp )
|
||||
{
|
||||
XP_U16 nSpecials = ceCountSpecials( ctxt );
|
||||
XP_U8* ptr = *ptrp;
|
||||
Tile ii;
|
||||
XP_UCHAR** texts;
|
||||
SpecialBitmaps* bitmaps;
|
||||
|
||||
texts = (XP_UCHAR**)XP_MALLOC( ctxt->super.mpool,
|
||||
nSpecials * sizeof(*texts) );
|
||||
bitmaps = (SpecialBitmaps*)
|
||||
XP_MALLOC( ctxt->super.mpool, nSpecials * sizeof(*bitmaps) );
|
||||
|
||||
for ( ii = 0; ii < ctxt->super.nFaces; ++ii ) {
|
||||
|
||||
const XP_UCHAR* facep = ctxt->super.facePtrs[(short)ii];
|
||||
if ( IS_SPECIAL(*facep) ) {
|
||||
/* get the string */
|
||||
XP_U8 txtlen = *ptr++;
|
||||
XP_UCHAR* text = (XP_UCHAR*)XP_MALLOC(ctxt->super.mpool, txtlen+1);
|
||||
XP_MEMCPY( text, ptr, txtlen );
|
||||
ptr += txtlen;
|
||||
text[txtlen] = '\0';
|
||||
XP_ASSERT( *facep < nSpecials );
|
||||
texts[(int)*facep] = text;
|
||||
|
||||
bitmaps[(int)*facep].largeBM = ceMakeBitmap( ctxt, &ptr );
|
||||
bitmaps[(int)*facep].smallBM = ceMakeBitmap( ctxt, &ptr );
|
||||
}
|
||||
}
|
||||
|
||||
ctxt->super.chars = texts;
|
||||
ctxt->super.bitmaps = bitmaps;
|
||||
|
||||
*ptrp = ptr;
|
||||
} /* ceLoadSpecialData */
|
||||
|
||||
static XP_U16
|
||||
ceCountSpecials( CEDictionaryCtxt* ctxt )
|
||||
{
|
||||
XP_U16 result = 0;
|
||||
XP_U16 ii;
|
||||
|
||||
for ( ii = 0; ii < ctxt->super.nFaces; ++ii ) {
|
||||
if ( IS_SPECIAL( ctxt->super.facePtrs[ii][0] ) ) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* ceCountSpecials */
|
||||
|
||||
#if 0
|
||||
static void
|
||||
printBitmapData1( XP_U16 nCols, XP_U16 nRows, XP_U8* data )
|
||||
{
|
||||
char strs[20];
|
||||
XP_U16 rowBytes;
|
||||
XP_U16 row, col;
|
||||
|
||||
rowBytes = (nCols + 7) / 8;
|
||||
while ( (rowBytes % 2) != 0 ) {
|
||||
++rowBytes;
|
||||
}
|
||||
|
||||
for ( row = 0; row < nRows; ++row ) {
|
||||
for ( col = 0; col < nCols; ++col ) {
|
||||
XP_UCHAR byt = data[col / 8];
|
||||
XP_Bool set = (byt & (0x80 >> (col % 8))) != 0;
|
||||
|
||||
strs[col] = set? '#': '.';
|
||||
}
|
||||
data += rowBytes;
|
||||
|
||||
strs[nCols] = '\0';
|
||||
XP_DEBUGF( strs );
|
||||
}
|
||||
} /* printBitmapData1 */
|
||||
|
||||
static void
|
||||
printBitmapData2( XP_U16 nCols, XP_U16 nRows, XP_U8* data )
|
||||
{
|
||||
while ( nRows-- ) {
|
||||
XP_UCHAR buf[100];
|
||||
XP_UCHAR* ptr = buf;
|
||||
XP_U16 rowBytes = (nCols + 7) / 8;
|
||||
while ( (rowBytes % ALIGN_COUNT) != 0 ) {
|
||||
++rowBytes;
|
||||
}
|
||||
|
||||
while ( rowBytes-- ) {
|
||||
ptr += XP_SNPRINTF( ptr, sizeof(buf), "0x%.2x ", *data++ );
|
||||
}
|
||||
XP_DEBUGF( buf );
|
||||
}
|
||||
} /* printBitmapData2 */
|
||||
|
||||
static void
|
||||
longSwapData( XP_U8* destBase, XP_U16 nRows, XP_U16 rowBytes )
|
||||
{
|
||||
XP_U32* longBase = (XP_U32*)destBase;
|
||||
rowBytes /= 4;
|
||||
|
||||
while ( nRows-- ) {
|
||||
XP_U16 i;
|
||||
for ( i = 0; i < rowBytes; ++i ) {
|
||||
XP_U32 n = *longBase;
|
||||
XP_U32 tmp = 0;
|
||||
tmp |= (n >> 24) & 0x000000FF;
|
||||
tmp |= (n >> 16) & 0x0000FF00;
|
||||
tmp |= (n >> 8 ) & 0x00FF0000;
|
||||
tmp |= (n >> 0 ) & 0xFF000000;
|
||||
*longBase = tmp;
|
||||
|
||||
++longBase;
|
||||
}
|
||||
}
|
||||
} /* longSwapData */
|
||||
#endif
|
||||
|
||||
static XP_Bitmap
|
||||
ceMakeBitmap( CEDictionaryCtxt* XP_UNUSED_DBG(ctxt), XP_U8** ptrp )
|
||||
{
|
||||
XP_U8* ptr = *ptrp;
|
||||
XP_U8 nCols = *ptr++;
|
||||
CEBitmapInfo* bitmap = (CEBitmapInfo*)NULL;
|
||||
|
||||
if ( nCols > 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 ); */
|
||||
}
|
||||
|
||||
*ptrp = ptr;
|
||||
return (XP_Bitmap)bitmap;
|
||||
} /* ceMakeBitmap */
|
||||
|
||||
static void
|
||||
ceDeleteBitmap( const CEDictionaryCtxt* XP_UNUSED_DBG(ctxt),
|
||||
XP_Bitmap* bitmap )
|
||||
{
|
||||
if ( !!bitmap ) {
|
||||
CEBitmapInfo* bmi = (CEBitmapInfo*)bitmap;
|
||||
XP_FREE( ctxt->super.mpool, bmi->bits );
|
||||
XP_FREE( ctxt->super.mpool, bmi );
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ce_dict_destroy( DictionaryCtxt* dict )
|
||||
{
|
||||
CEDictionaryCtxt* ctxt = (CEDictionaryCtxt*)dict;
|
||||
XP_U16 nSpecials = ceCountSpecials( ctxt );
|
||||
XP_U16 i;
|
||||
|
||||
if ( !!ctxt->super.chars ) {
|
||||
for ( i = 0; i < nSpecials; ++i ) {
|
||||
XP_UCHAR* text = ctxt->super.chars[i];
|
||||
if ( !!text ) {
|
||||
XP_FREE( ctxt->super.mpool, text );
|
||||
}
|
||||
}
|
||||
XP_FREE( ctxt->super.mpool, ctxt->super.chars );
|
||||
}
|
||||
if ( !!ctxt->super.bitmaps ) {
|
||||
for ( i = 0; i < nSpecials; ++i ) {
|
||||
ceDeleteBitmap( ctxt, ctxt->super.bitmaps[i].largeBM );
|
||||
ceDeleteBitmap( ctxt, ctxt->super.bitmaps[i].smallBM );
|
||||
}
|
||||
XP_FREE( ctxt->super.mpool, ctxt->super.bitmaps );
|
||||
}
|
||||
|
||||
XP_FREE( ctxt->super.mpool, ctxt->super.faces );
|
||||
XP_FREE( ctxt->super.mpool, ctxt->super.facePtrs );
|
||||
XP_FREE( ctxt->super.mpool, ctxt->super.countsAndValues );
|
||||
XP_FREE( ctxt->super.mpool, ctxt->super.name );
|
||||
|
||||
closeMappedFile( MPPARM(ctxt->super.mpool) ctxt->mappedBase,
|
||||
ctxt->mappedFile );
|
||||
XP_FREE( ctxt->super.mpool, ctxt );
|
||||
} // ce_dict_destroy
|
||||
|
||||
static const XP_UCHAR*
|
||||
ce_dict_getShortName( const DictionaryCtxt* dict )
|
||||
{
|
||||
const XP_UCHAR* name = dict_getName( dict );
|
||||
return bname( name );
|
||||
} /* ce_dict_getShortName */
|
||||
|
||||
static XP_U8*
|
||||
openMappedFile( MPFORMAL const wchar_t* name, HANDLE* mappedFileP,
|
||||
HANDLE* hFileP, XP_U32* sizep )
|
||||
{
|
||||
XP_U8* ptr = NULL;
|
||||
HANDLE hFile;
|
||||
|
||||
#if defined _WIN32_WCE
|
||||
hFile = CreateFileForMapping( name,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ, /* (was 0: no sharing) */
|
||||
NULL, /* security */
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_RANDOM_ACCESS,
|
||||
NULL );
|
||||
|
||||
if ( hFile == INVALID_HANDLE_VALUE ) {
|
||||
logLastError( "CreateFileForMapping" );
|
||||
} else {
|
||||
HANDLE mappedFile;
|
||||
|
||||
mappedFile = CreateFileMapping( hFile,
|
||||
NULL,
|
||||
PAGE_READONLY,
|
||||
0,
|
||||
0,
|
||||
NULL );
|
||||
|
||||
|
||||
if ( mappedFile != INVALID_HANDLE_VALUE ) {
|
||||
void* mappedBase = MapViewOfFile( mappedFile,
|
||||
FILE_MAP_READ,
|
||||
0, 0, 0 );
|
||||
ptr = (XP_U8*)mappedBase;
|
||||
*mappedFileP = mappedFile;
|
||||
*hFileP = hFile;
|
||||
if ( sizep != NULL ) {
|
||||
*sizep = GetFileSize( hFile, NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
hFile = CreateFile( name,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
NULL, /* security */
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_RANDOM_ACCESS,
|
||||
NULL );
|
||||
if ( hFile != INVALID_HANDLE_VALUE ) {
|
||||
|
||||
DWORD size = GetFileSize( hFile, NULL );
|
||||
|
||||
ptr = XP_MALLOC( mpool, size );
|
||||
if ( ptr != NULL ) {
|
||||
DWORD nRead;
|
||||
if ( ReadFile( hFile, ptr, size, &nRead, NULL ) ) {
|
||||
XP_ASSERT( nRead == size );
|
||||
} else {
|
||||
XP_FREE( mpool, ptr );
|
||||
ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle( hFile );
|
||||
|
||||
*hFileP = NULL; /* nothing to close later */
|
||||
if ( sizep != NULL ) {
|
||||
*sizep = size;
|
||||
}
|
||||
*mappedFileP = (HANDLE)ptr;
|
||||
}
|
||||
#endif
|
||||
return ptr;
|
||||
} /* openMappedFile */
|
||||
|
||||
static void
|
||||
closeMappedFile( MPFORMAL XP_U8* base,
|
||||
HANDLE XP_UNUSED_32(mappedFile) )
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
UnmapViewOfFile( base );
|
||||
CloseHandle( mappedFile );
|
||||
#else
|
||||
XP_FREE( mpool, base );
|
||||
#endif
|
||||
}
|
||||
|
||||
static XP_Bool
|
||||
checkIfDictAndLegal( MPFORMAL wchar_t* path, XP_U16 pathLen,
|
||||
wchar_t* name )
|
||||
{
|
||||
XP_Bool result = XP_FALSE;
|
||||
XP_U16 len;
|
||||
|
||||
len = wcslen(name);
|
||||
|
||||
/* are the last four bytes ".xwd"? */
|
||||
if ( 0 == lstrcmp( name + len - 4, L".xwd" ) ) {
|
||||
XP_U16 flags;
|
||||
HANDLE mappedFile, hFile;
|
||||
XP_U8* base;
|
||||
wchar_t pathBuf[CE_MAX_PATH_LEN+1];
|
||||
|
||||
wcscpy( pathBuf, path );
|
||||
pathBuf[pathLen] = 0;
|
||||
wcscat( pathBuf, name );
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
char narrowName[CE_MAX_PATH_LEN+1];
|
||||
int len = wcslen( pathBuf );
|
||||
len = WideCharToMultiByte( CP_UTF8, 0, pathBuf, len + 1,
|
||||
narrowName, len + 1, NULL, NULL );
|
||||
}
|
||||
#endif
|
||||
|
||||
base = openMappedFile( MPPARM(mpool) pathBuf, &mappedFile,
|
||||
&hFile, NULL );
|
||||
if ( !!base ) {
|
||||
XP_U8* ptr = base;
|
||||
|
||||
flags = n_ptr_tohs( &ptr );
|
||||
flags &= ~DICT_HEADER_MASK;
|
||||
closeMappedFile( MPPARM(mpool) base, mappedFile );
|
||||
#ifdef NODE_CAN_4
|
||||
/* are the flags what we expect */
|
||||
result = flags >= 0x0002 && flags <= 0x0005;
|
||||
#else
|
||||
result = flags == 0x0001;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* checkIfDictAndLegal */
|
||||
|
||||
static XP_Bool
|
||||
locateOneDir( MPFORMAL wchar_t* path, OnePathCB cb, void* ctxt, XP_U16 nSought,
|
||||
XP_U16* nFoundP )
|
||||
{
|
||||
WIN32_FIND_DATA data;
|
||||
HANDLE fileH;
|
||||
XP_Bool done = XP_FALSE;
|
||||
XP_U16 startLen;
|
||||
|
||||
lstrcat( path, L"\\" );
|
||||
startLen = wcslen(path); /* record where we were so can back up */
|
||||
lstrcat( path, L"*" );
|
||||
|
||||
XP_MEMSET( &data, 0, sizeof(data) );
|
||||
|
||||
/* Looks like I need to look at every file. If it's a directory I search
|
||||
it recursively. If it's an .xwd file I check whether it's got the
|
||||
right flags and if so I return its name. */
|
||||
|
||||
fileH = FindFirstFile( path, &data );
|
||||
|
||||
if ( fileH != INVALID_HANDLE_VALUE ) {
|
||||
for ( ; ; ) {
|
||||
|
||||
if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0){
|
||||
|
||||
if ( ( data.cFileName[0] == '.' )
|
||||
&& ( (data.cFileName[1] == '.')
|
||||
|| (data.cFileName[1] == '\0' ) ) ) {
|
||||
/* skip . and .. */
|
||||
} else {
|
||||
lstrcpy( path+startLen, data.cFileName );
|
||||
done = locateOneDir( MPPARM(mpool) path, cb, ctxt,
|
||||
nSought, nFoundP );
|
||||
XP_ASSERT( done || *nFoundP < nSought );
|
||||
if ( done ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ( checkIfDictAndLegal( MPPARM(mpool) path, startLen,
|
||||
data.cFileName ) ) {
|
||||
XP_ASSERT( *nFoundP < nSought );
|
||||
|
||||
lstrcpy( path+startLen, data.cFileName );
|
||||
done = (*cb)( path, (*nFoundP)++, ctxt )
|
||||
|| *nFoundP == nSought;
|
||||
if ( done ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !FindNextFile( fileH, &data ) ) {
|
||||
XP_ASSERT( GetLastError() == ERROR_NO_MORE_FILES );
|
||||
break;
|
||||
}
|
||||
path[startLen] = 0;
|
||||
}
|
||||
|
||||
(void)FindClose( fileH );
|
||||
}
|
||||
return done;
|
||||
} /* locateOneDir */
|
||||
|
||||
XP_U16
|
||||
ceLocateNDicts( CEAppGlobals* globals, XP_U16 nSought, OnePathCB cb,
|
||||
void* ctxt )
|
||||
{
|
||||
XP_U16 nFound = 0;
|
||||
wchar_t path[CE_MAX_PATH_LEN+1];
|
||||
|
||||
if ( ceGetExeDir( path, VSIZE(path) ) ) {
|
||||
locateOneDir( MPPARM(globals->mpool) path, cb, ctxt, nSought, &nFound );
|
||||
}
|
||||
|
||||
if ( nFound < nSought ) {
|
||||
ceGetPath( globals, PROGFILES_PATH, path, VSIZE(path) );
|
||||
locateOneDir( MPPARM(globals->mpool) path, cb, ctxt, nSought, &nFound );
|
||||
}
|
||||
|
||||
if ( nFound < nSought ) {
|
||||
WIN32_FIND_DATA data;
|
||||
HANDLE fileH;
|
||||
|
||||
XP_MEMSET( &data, 0, sizeof(data) );
|
||||
|
||||
fileH = FindFirstFile( L"\\*", &data );
|
||||
while ( fileH != INVALID_HANDLE_VALUE ) {
|
||||
if ( ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
|
||||
&& (((data.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) ) ) {
|
||||
wsprintf( path, L"\\%s\\Crosswords", data.cFileName );
|
||||
|
||||
XP_LOGW( "looking in:", path );
|
||||
locateOneDir( MPPARM(globals->mpool) path, cb, ctxt,
|
||||
nSought, &nFound );
|
||||
}
|
||||
if ( nFound >= nSought ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !FindNextFile( fileH, &data ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nFound;
|
||||
} /* ceLocateNDicts */
|
||||
|
||||
typedef struct FindOneData {
|
||||
wchar_t* result;
|
||||
const wchar_t* sought;
|
||||
XP_Bool found;
|
||||
} FindOneData;
|
||||
|
||||
static XP_Bool
|
||||
matchShortName( const wchar_t* wPath, XP_U16 XP_UNUSED(index), void* ctxt )
|
||||
{
|
||||
FindOneData* datap = (FindOneData*)ctxt;
|
||||
wchar_t buf[CE_MAX_PATH_LEN+1];
|
||||
wchar_t* name;
|
||||
|
||||
XP_ASSERT( !datap->found );
|
||||
|
||||
name = wbname( buf, VSIZE(buf), wPath );
|
||||
if ( 0 == wcscmp( name, datap->sought ) ) {
|
||||
wcscpy( datap->result, wPath );
|
||||
datap->found = XP_TRUE;
|
||||
}
|
||||
return datap->found;
|
||||
} /* matchShortName */
|
||||
|
||||
/* Users sometimes move dicts. Given a path to a dict that doesn't exist, See
|
||||
* if another with the same short name exists somewhere else we're willing to
|
||||
* look.
|
||||
*/
|
||||
static XP_Bool
|
||||
findAlternateDict( CEAppGlobals* globals, wchar_t* path )
|
||||
{
|
||||
wchar_t shortPath[CE_MAX_PATH_LEN+1];
|
||||
FindOneData data;
|
||||
|
||||
XP_MEMSET( &data, 0, sizeof(data) );
|
||||
data.sought = wbname( shortPath, VSIZE(shortPath), path );
|
||||
data.result = path;
|
||||
|
||||
(void)ceLocateNDicts( globals, CE_MAXDICTS, matchShortName,
|
||||
&data );
|
||||
return data.found;
|
||||
} /* findAlternateDict */
|
||||
|
||||
static XP_U32
|
||||
n_ptr_tohl( XP_U8** inp )
|
||||
{
|
||||
XP_U32 t;
|
||||
XP_MEMCPY( &t, *inp, sizeof(t) );
|
||||
|
||||
*inp += sizeof(t);
|
||||
|
||||
return XP_NTOHL(t);
|
||||
} /* n_ptr_tohl */
|
||||
|
||||
static XP_U16
|
||||
n_ptr_tohs( XP_U8** inp )
|
||||
{
|
||||
XP_U16 t;
|
||||
XP_MEMCPY( &t, *inp, sizeof(t) );
|
||||
|
||||
*inp += sizeof(t);
|
||||
|
||||
return XP_NTOHS(t);
|
||||
} /* n_ptr_tohs */
|
||||
|
||||
const XP_UCHAR*
|
||||
bname( const XP_UCHAR* in )
|
||||
{
|
||||
XP_U16 len = (XP_U16)XP_STRLEN(in);
|
||||
const XP_UCHAR* out = in + len - 1;
|
||||
|
||||
while ( *out != '\\' && out >= in ) {
|
||||
--out;
|
||||
}
|
||||
return out + 1;
|
||||
} /* bname */
|
||||
|
||||
wchar_t*
|
||||
wbname( wchar_t* buf, XP_U16 buflen, const wchar_t* in )
|
||||
{
|
||||
const wchar_t* slash = wcsrchr( in, L'\\' );
|
||||
if ( !!slash ) {
|
||||
++slash;
|
||||
} else {
|
||||
slash = in;
|
||||
}
|
||||
|
||||
const wchar_t* dot = wcsrchr( slash, L'.' );
|
||||
if ( !dot ) {
|
||||
dot = slash + wcslen( slash );
|
||||
}
|
||||
|
||||
_snwprintf( buf, buflen, L"%s", slash );
|
||||
XP_ASSERT( dot >= slash );
|
||||
buf[dot-slash] = 0;
|
||||
return buf;
|
||||
} /* wbname */
|
||||
|
||||
#endif /* ifndef STUBBED_DICT */
|
|
@ -1,51 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
|
||||
|
||||
/* Copyright 1999-2006 by Eric House (xwords@eehouse.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 _CEDICT_H_
|
||||
#define _CEDICT_H_
|
||||
|
||||
#include "cemain.h"
|
||||
|
||||
#define CE_MAXDICTS 0x7FFF
|
||||
|
||||
typedef struct CEBitmapInfo {
|
||||
XP_U8* bits;
|
||||
XP_U16 nCols;
|
||||
XP_U16 nRows;
|
||||
} CEBitmapInfo;
|
||||
|
||||
DictionaryCtxt* ce_dictionary_make(CEAppGlobals* globals, const char* name);
|
||||
DictionaryCtxt* ce_dictionary_make_empty( CEAppGlobals* globals );
|
||||
|
||||
/* Callback: return true if done; false to continue */
|
||||
typedef XP_Bool (*OnePathCB)( const wchar_t* wPath, XP_U16 index, void* ctxt );
|
||||
|
||||
/* ceLocateNDicts: Allocate and store in bufs ptrs to up to nSought paths to
|
||||
* dict files. Return the number actually found. Caller is responsible for
|
||||
* making sure bufs contains nSought slots.
|
||||
*/
|
||||
XP_U16 ceLocateNDicts( CEAppGlobals* globals, XP_U16 nSought,
|
||||
OnePathCB cb, void* ctxt );
|
||||
|
||||
/* return just the name, no extension, of dict, written to buf, pointed to by
|
||||
return value (which is into buf, but not necessarily the first char.) */
|
||||
wchar_t* wbname( wchar_t* buf, XP_U16 buflen, const wchar_t* in );
|
||||
|
||||
const XP_UCHAR* bname( const XP_UCHAR* in );
|
||||
#endif
|
|
@ -1,52 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
|
||||
/*
|
||||
* Copyright 2000-2008 by Eric House (xwords@eehouse.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 _CEDRAW_H_
|
||||
#define _CEDRAW_H_
|
||||
|
||||
#include "cemain.h"
|
||||
|
||||
typedef struct CEDrawCtx CEDrawCtx;
|
||||
|
||||
/* Should match number of icons */
|
||||
typedef enum {
|
||||
CENSTATE_NONE
|
||||
,CENSTATE_TRYING_RELAY
|
||||
,CENSTATE_HAVE_RELAY
|
||||
,CENSTATE_ALL_HERE
|
||||
|
||||
,CENSTATE_NSTATES
|
||||
} CeNetState;
|
||||
|
||||
CEDrawCtx* ce_drawctxt_make( MPFORMAL HWND mainWin, CEAppGlobals* globals );
|
||||
void ce_draw_update( CEDrawCtx* dctx );
|
||||
void ce_draw_erase( CEDrawCtx* dctx, const RECT* invalR );
|
||||
void ce_draw_focus( CEDrawCtx* dctx, const RECT* invalR );
|
||||
#ifdef XWFEATURE_RELAY
|
||||
void ce_draw_status( CEDrawCtx* dctx, const RECT* invalR, CeNetState state );
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
HBRUSH ce_draw_getFocusBrush( const CEDrawCtx* dctx );
|
||||
#endif
|
||||
|
||||
void ce_draw_toStream( const CEDrawCtx* dctx, XWStreamCtxt* stream );
|
||||
void ce_draw_fromStream( CEDrawCtx* dctx, XWStreamCtxt* stream, XP_U8 flags );
|
||||
#endif
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2004-2008 by Eric House (xwords@eehouse.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.
|
||||
*/
|
||||
|
||||
#ifdef ALLOW_CHOOSE_FONTS
|
||||
|
||||
#include <windowsx.h>
|
||||
#include "stdafx.h"
|
||||
#include <commdlg.h>
|
||||
|
||||
#include "ceclrsel.h"
|
||||
#include "ceutil.h"
|
||||
#include "cedebug.h"
|
||||
#include "debhacks.h"
|
||||
#include "cefonts.h"
|
||||
|
||||
#define MIN_FONT_SHOWN 6
|
||||
#define MAX_FONT_SHOWN 36
|
||||
|
||||
typedef struct _FontsDlgState {
|
||||
CeDlgHdr dlgHdr;
|
||||
HDC tmpDC;
|
||||
RECT textRect;
|
||||
XP_U16 fontsComboId;
|
||||
XP_U16 fontSizeId;
|
||||
XP_Bool inited;
|
||||
} FontsDlgState;
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
# define HAS_ENUMFONTFAMILIESEX
|
||||
#endif
|
||||
|
||||
#ifdef HAS_ENUMFONTFAMILIESEX
|
||||
# define ENUMFONTFAMILIES(a,b,c,d,e) EnumFontFamiliesEx((a),(b),(d),(e),0)
|
||||
#else
|
||||
# define ENUMFONTFAMILIES(a,b,c,d,e) EnumFontFamilies((a),(c),(d),(e))
|
||||
#endif
|
||||
|
||||
|
||||
/* int CALLBACK EnumFontFamProc( */
|
||||
/* ENUMLOGFONT *lpelf, // logical-font data */
|
||||
/* NEWTEXTMETRIC *lpntm, // physical-font data */
|
||||
/* DWORD FontType, // type of font */
|
||||
/* LPARAM lParam // application-defined data */
|
||||
/* ); */
|
||||
|
||||
static int
|
||||
fontProc2( ENUMLOGFONTEX* lpelfe,
|
||||
NEWTEXTMETRIC/*EX*/* XP_UNUSED(lpntme),
|
||||
DWORD FontType, LPARAM lParam)
|
||||
{
|
||||
/* if ( !lstrcmp( L"Western", lpelfe->elfScript ) */
|
||||
/* && ((FontType & TRUETYPE_FONTTYPE) != 0 ) ) { */
|
||||
|
||||
FontsDlgState* state = (FontsDlgState*)lParam;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
|
||||
if ( 0 > SendDlgItemMessage( state->dlgHdr.hDlg,
|
||||
state->fontsComboId,
|
||||
FINDSTRINGEXACT(globals), -1,
|
||||
(LPARAM)lpelfe->elfLogFont.lfFaceName ) ) {
|
||||
SendDlgItemMessage( state->dlgHdr.hDlg, state->fontsComboId,
|
||||
ADDSTRING(globals), 0,
|
||||
(LPARAM)lpelfe->elfLogFont.lfFaceName );
|
||||
}
|
||||
/* } */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
fontProc( ENUMLOGFONTEX* lpelfe, // logical-font data
|
||||
NEWTEXTMETRICEX* XP_UNUSED(lpntme), // physical-font data
|
||||
DWORD XP_UNUSED(FontType), // type of font
|
||||
LPARAM lParam) // application-defined data
|
||||
{
|
||||
FontsDlgState* state = (FontsDlgState*)lParam;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
#ifdef HAS_ENUMFONTFAMILIESEX
|
||||
LOGFONT fontInfo;
|
||||
|
||||
XP_MEMSET( &fontInfo, 0, sizeof(fontInfo) );
|
||||
fontInfo.lfCharSet = DEFAULT_CHARSET;
|
||||
wcscpy( fontInfo.lfFaceName, lpelfe->elfLogFont.lfFaceName );
|
||||
#endif
|
||||
|
||||
ENUMFONTFAMILIES( state->tmpDC,
|
||||
&fontInfo,
|
||||
lpelfe->elfLogFont.lfFaceName,
|
||||
fontProc2, (LPARAM)state );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
ceLoadFontsInfo( FontsDlgState* state )
|
||||
{
|
||||
LOGFONT fontInfo;
|
||||
XP_U16 ii;
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
|
||||
XP_MEMSET( &fontInfo, 0, sizeof(fontInfo) );
|
||||
fontInfo.lfCharSet = DEFAULT_CHARSET;
|
||||
|
||||
state->tmpDC = CreateCompatibleDC( NULL );
|
||||
|
||||
XP_LOGF( "%s: calling EnumFontFamilies", __func__ );
|
||||
ENUMFONTFAMILIES( state->tmpDC,
|
||||
&fontInfo,
|
||||
NULL,
|
||||
fontProc,
|
||||
(LPARAM)state );
|
||||
|
||||
DeleteDC( state->tmpDC );
|
||||
state->tmpDC = NULL;
|
||||
SendDlgItemMessage( hDlg, state->fontsComboId, SETCURSEL(globals), 0, 0L );
|
||||
|
||||
/* Stuff the size list */
|
||||
for ( ii = MIN_FONT_SHOWN; ii <= MAX_FONT_SHOWN; ++ii ) {
|
||||
wchar_t widebuf[4];
|
||||
swprintf( widebuf, L"%d", ii );
|
||||
SendDlgItemMessage( hDlg, state->fontSizeId,
|
||||
ADDSTRING(globals), 0, (LPARAM)widebuf );
|
||||
}
|
||||
SendDlgItemMessage( hDlg, state->fontSizeId, SETCURSEL(globals), 0, 0L );
|
||||
}
|
||||
|
||||
static void
|
||||
ceDrawWithFont( FontsDlgState* state, HDC hdc )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
XP_S16 selFont = SendDlgItemMessage( hDlg, state->fontsComboId,
|
||||
GETCURSEL(globals), 0, 0L);
|
||||
XP_S16 selSize = SendDlgItemMessage( hDlg, state->fontSizeId,
|
||||
GETCURSEL(globals), 0, 0L);
|
||||
if ( selFont >= 0 && selSize >= 0 ) {
|
||||
LOGFONT fontInfo;
|
||||
wchar_t fontName[33];
|
||||
HFONT oldFont, newFont;
|
||||
RECT rect;
|
||||
wchar_t buf[16];
|
||||
wchar_t* lines[] = {
|
||||
buf
|
||||
,L"ABCDEFGHIJKL"
|
||||
,L"MNOPQRSTUV"
|
||||
,L"WXYZ0123456789"
|
||||
};
|
||||
XP_U16 ii;
|
||||
|
||||
(void)SendDlgItemMessage( hDlg, state->fontsComboId,
|
||||
GETLBTEXT(globals), selFont,
|
||||
(LPARAM)fontName );
|
||||
|
||||
XP_MEMSET( &fontInfo, 0, sizeof(fontInfo) );
|
||||
wcscpy( fontInfo.lfFaceName, fontName );
|
||||
fontInfo.lfHeight = selSize + MIN_FONT_SHOWN;
|
||||
swprintf( buf, L"Size: %d", fontInfo.lfHeight );
|
||||
|
||||
newFont = CreateFontIndirect( &fontInfo );
|
||||
oldFont = SelectObject( hdc, newFont );
|
||||
|
||||
rect = state->textRect;
|
||||
for ( ii = 0; ii < sizeof(lines)/sizeof(lines[0]); ++ii ) {
|
||||
DrawText( hdc, lines[ii], -1, &rect,
|
||||
DT_SINGLELINE | DT_TOP | DT_LEFT );
|
||||
rect.top += MAX_FONT_SHOWN - 4;
|
||||
}
|
||||
|
||||
SelectObject( hdc, oldFont );
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK
|
||||
FontsDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
FontsDlgState* state;
|
||||
BOOL result = FALSE;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
|
||||
state = (FontsDlgState*)lParam;
|
||||
state->inited = XP_FALSE;
|
||||
|
||||
state->fontsComboId = LB_IF_PPC(state->dlgHdr.globals,FONTS_COMBO);
|
||||
state->fontSizeId = LB_IF_PPC(state->dlgHdr.globals,FONTSIZE_COMBO);
|
||||
|
||||
XP_LOGF( "calling ceDlgSetup" );
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||
XP_LOGF( "ceDlgSetup done" );
|
||||
|
||||
result = TRUE;
|
||||
} else {
|
||||
state = (FontsDlgState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!state ) {
|
||||
if ( !state->inited ) {
|
||||
state->inited = XP_TRUE;
|
||||
ceLoadFontsInfo( state );
|
||||
}
|
||||
|
||||
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||
result = TRUE;
|
||||
} else if ( WM_NOTIFY == message ) {
|
||||
InvalidateRect( hDlg, &state->textRect, TRUE );
|
||||
} else if ( message == WM_COMMAND ) {
|
||||
XP_U16 wid = LOWORD(wParam);
|
||||
if ( CBN_SELCHANGE == HIWORD(wParam) ) {
|
||||
if ( state->fontsComboId == wid ) {
|
||||
InvalidateRect( hDlg, &state->textRect, TRUE );
|
||||
} else if ( state->fontSizeId == wid ) {
|
||||
InvalidateRect( hDlg, &state->textRect, TRUE );
|
||||
}
|
||||
} else if ( BN_CLICKED == HIWORD(wParam) ) {
|
||||
switch( wid ) {
|
||||
case IDOK:
|
||||
case IDCANCEL:
|
||||
EndDialog( hDlg, LOWORD(wParam) );
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ( message == WM_PAINT ) {
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = BeginPaint( hDlg, &ps);
|
||||
ceDrawWithFont( state, hdc );
|
||||
EndPaint( hDlg, &ps );
|
||||
result = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
ceShowFonts( HWND hDlg, CEAppGlobals* globals )
|
||||
{
|
||||
FontsDlgState state;
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
state.dlgHdr.globals = globals;
|
||||
|
||||
state.textRect.left = 5;
|
||||
state.textRect.top = 60;
|
||||
state.textRect.right = 300;
|
||||
state.textRect.bottom = state.textRect.top + (4*MAX_FONT_SHOWN);
|
||||
|
||||
(void)DialogBoxParam( globals->locInst, (LPCTSTR)IDD_FONTSSDLG, hDlg,
|
||||
(DLGPROC)FontsDlgProc, (long)&state );
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,29 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2004 by Eric House (xwords@eehouse.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 _CEFONTS_H_
|
||||
#define _CEFONTS_H_
|
||||
|
||||
#include "xptypes.h"
|
||||
#include "cemain.h"
|
||||
|
||||
void ceShowFonts( HWND hDlg, CEAppGlobals* globals );
|
||||
|
||||
|
||||
#endif
|
|
@ -1,832 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE"; -*- */
|
||||
/*
|
||||
* Copyright 2002-2009 by Eric House (xwords@eehouse.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 <stdio.h> /* swprintf */
|
||||
#include "ceginfo.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
#include "cedict.h"
|
||||
#include "cecondlg.h"
|
||||
#include "strutils.h"
|
||||
#include "cedebug.h"
|
||||
#include "strutils.h"
|
||||
#include "ceresstr.h"
|
||||
|
||||
#define NUM_COLS 4
|
||||
#define MENUDICTS_INCR 16
|
||||
|
||||
typedef struct _GameInfoState {
|
||||
CeDlgHdr dlgHdr;
|
||||
NewGameCtx* newGameCtx;
|
||||
XP_UCHAR* newDictName;
|
||||
XP_U16 dictNameLen;
|
||||
|
||||
XP_U16 capMenuDicts;
|
||||
XP_U16 nMenuDicts;
|
||||
wchar_t** menuDicts;
|
||||
XP_U16 nPlayersId;
|
||||
XP_U16 dictListId;
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
XP_U16 roleComboId;
|
||||
DeviceRole curRole;
|
||||
#endif
|
||||
|
||||
XP_Bool isNewGame; /* newGame or GameInfo */
|
||||
XP_Bool popConnsDlg;
|
||||
XP_Bool userCancelled; /* OUT param */
|
||||
|
||||
/* For tracking when to move stuff up/down */
|
||||
XP_Bool juggleHidden;
|
||||
XP_Bool roleConfigHidden;
|
||||
XP_U16 juggleSpacing;
|
||||
XP_U16 configSpacing;
|
||||
|
||||
GInfoResults results;
|
||||
CePrefsPrefs* prefsPrefs;
|
||||
|
||||
/* Support for repositioning lower items based on num players */
|
||||
XP_U16* moveIds;
|
||||
XP_U16 nMoveIds;
|
||||
XP_U16 prevNPlayers;
|
||||
XP_U16 playersSpacing;
|
||||
|
||||
} GameInfoState;
|
||||
|
||||
static XP_S16
|
||||
findInsertPoint( const wchar_t* wPath, wchar_t** menuDicts,
|
||||
XP_U16 nMenuDicts )
|
||||
{
|
||||
XP_S16 loc = 0; /* simple case: nothing here */
|
||||
|
||||
if ( nMenuDicts > 0 ) {
|
||||
wchar_t thisShortBuf[CE_MAX_PATH_LEN+1];
|
||||
wchar_t* thisShortName = wbname( thisShortBuf, sizeof(thisShortBuf),
|
||||
wPath );
|
||||
|
||||
/* If the short path doesn't already exist, find where it belongs. This
|
||||
is wasteful if we're doing this a lot since the short path isn't
|
||||
cached. */
|
||||
for ( /* loc = 0*/; loc < nMenuDicts; ++loc ) {
|
||||
wchar_t oneShortBuf[CE_MAX_PATH_LEN+1];
|
||||
wchar_t* oneShortName = wbname( oneShortBuf, sizeof(oneShortBuf),
|
||||
menuDicts[loc] );
|
||||
int diff = _wcsicmp( thisShortName, oneShortName );
|
||||
if ( diff > 0 ) {
|
||||
continue;
|
||||
} else if ( diff == 0 ) {
|
||||
loc = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return loc;
|
||||
} /* findInsertPoint */
|
||||
|
||||
static XP_Bool
|
||||
addDictToState( const wchar_t* wPath, XP_U16 XP_UNUSED(index), void* ctxt )
|
||||
{
|
||||
GameInfoState* state = (GameInfoState*)ctxt;
|
||||
/* Let's display only the short form, but save the whole path */
|
||||
wchar_t* wstr;
|
||||
XP_U16 len;
|
||||
XP_S16 loc; /* < 0 means skip it */
|
||||
|
||||
loc = findInsertPoint( wPath, state->menuDicts,
|
||||
state->nMenuDicts );
|
||||
|
||||
if ( loc >= 0 ) {
|
||||
/* make a copy of the long name */
|
||||
len = wcslen( wPath ) + 1;
|
||||
wstr = (wchar_t*)XP_MALLOC( state->dlgHdr.globals->mpool,
|
||||
len * sizeof(wstr[0]) );
|
||||
|
||||
XP_MEMCPY( wstr, wPath, len*sizeof(wstr[0]) );
|
||||
if ( !state->menuDicts ) {
|
||||
XP_ASSERT( state->nMenuDicts == 0 );
|
||||
XP_ASSERT( state->capMenuDicts == 0 );
|
||||
state->capMenuDicts = MENUDICTS_INCR;
|
||||
state->menuDicts
|
||||
= (wchar_t**)XP_MALLOC( state->dlgHdr.globals->mpool,
|
||||
state->capMenuDicts
|
||||
* sizeof(state->menuDicts[0]) );
|
||||
} else if ( state->nMenuDicts == state->capMenuDicts ) {
|
||||
state->capMenuDicts += MENUDICTS_INCR;
|
||||
state->menuDicts
|
||||
= (wchar_t**)XP_REALLOC( state->dlgHdr.globals->mpool,
|
||||
state->menuDicts,
|
||||
state->capMenuDicts
|
||||
* sizeof(state->menuDicts[0]) );
|
||||
}
|
||||
|
||||
if ( loc < state->nMenuDicts ) {
|
||||
XP_MEMMOVE( &state->menuDicts[loc+1], &state->menuDicts[loc],
|
||||
(state->nMenuDicts - loc)
|
||||
* sizeof(state->menuDicts[0]) );
|
||||
}
|
||||
state->menuDicts[loc] = wstr;
|
||||
++state->nMenuDicts;
|
||||
}
|
||||
|
||||
return XP_FALSE;
|
||||
} /* addDictToState */
|
||||
|
||||
static void
|
||||
addDictsToMenu( GameInfoState* state )
|
||||
{
|
||||
wchar_t* shortname;
|
||||
wchar_t shortPath[CE_MAX_PATH_LEN+1];
|
||||
XP_U16 i, nMenuDicts = state->nMenuDicts;
|
||||
XP_S16 sel = 0;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
|
||||
/* insert the short names in the menu */
|
||||
for ( i = 0; i < nMenuDicts; ++i ) {
|
||||
wchar_t* wPath = state->menuDicts[i];
|
||||
shortname = wbname( shortPath, sizeof(shortPath), wPath );
|
||||
SendDlgItemMessage( state->dlgHdr.hDlg, state->dictListId,
|
||||
ADDSTRING(globals), 0, (long)shortname );
|
||||
|
||||
if ( state->newDictName[0] != 0 && sel == 0 ) {
|
||||
XP_UCHAR buf[CE_MAX_PATH_LEN+1];
|
||||
WideCharToMultiByte( CP_ACP, 0, wPath, -1, buf, sizeof(buf),
|
||||
NULL, NULL );
|
||||
if ( 0 == XP_STRCMP( buf, state->newDictName ) ) {
|
||||
sel = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SendDlgItemMessage( state->dlgHdr.hDlg, state->dictListId,
|
||||
SETCURSEL(globals), sel, 0L );
|
||||
} /* addDictsToMenu */
|
||||
|
||||
static void
|
||||
cleanupGameInfoState( GameInfoState* state )
|
||||
{
|
||||
if ( !!state->menuDicts ) {
|
||||
XP_U16 nMenuDicts = state->nMenuDicts;
|
||||
XP_U16 i;
|
||||
for ( i = 0; i < nMenuDicts; ++i ) {
|
||||
XP_FREE( state->dlgHdr.globals->mpool, state->menuDicts[i] );
|
||||
}
|
||||
XP_FREE( state->dlgHdr.globals->mpool, state->menuDicts );
|
||||
state->menuDicts = NULL;
|
||||
}
|
||||
|
||||
if ( !!state->moveIds ) {
|
||||
XP_FREE( state->dlgHdr.globals->mpool, state->moveIds );
|
||||
state->moveIds = NULL;
|
||||
}
|
||||
} /* cleanupGameInfoState */
|
||||
|
||||
static void
|
||||
loadFromGameInfo( GameInfoState* state )
|
||||
{
|
||||
XP_U16 ii;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
CurGameInfo* gi = &globals->gameInfo;
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
XP_U16 role_ids[] = { IDS_ROLE_STANDALONE, IDS_ROLE_HOST, IDS_ROLE_GUEST };
|
||||
for ( ii = 0; ii < VSIZE(role_ids); ++ii ) {
|
||||
const wchar_t* wstr = ceGetResStringL( globals, role_ids[ii] );
|
||||
SendDlgItemMessage( state->dlgHdr.hDlg, state->roleComboId,
|
||||
ADDSTRING(globals), 0, (long)wstr );
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( ii = 0; ii < MAX_NUM_PLAYERS; ++ii ) {
|
||||
wchar_t widebuf[8];
|
||||
/* put a string in the moronic combobox */
|
||||
swprintf( widebuf, L"%d", ii + 1 );
|
||||
SendDlgItemMessage( state->dlgHdr.hDlg, state->nPlayersId,
|
||||
ADDSTRING(globals), 0, (long)widebuf );
|
||||
}
|
||||
|
||||
newg_load( state->newGameCtx, gi );
|
||||
|
||||
#ifndef STUBBED_DICT
|
||||
if ( !!gi->dictName ) {
|
||||
XP_SNPRINTF( state->newDictName, state->dictNameLen, "%s",
|
||||
gi->dictName );
|
||||
}
|
||||
if ( state->isNewGame ) {
|
||||
(void)ceLocateNDicts( globals, CE_MAXDICTS, addDictToState, state );
|
||||
} else {
|
||||
wchar_t wPath[CE_MAX_PATH_LEN+1];
|
||||
XP_ASSERT( gi->dictName[0] != '\0' );
|
||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, gi->dictName, -1,
|
||||
wPath, VSIZE(wPath) );
|
||||
(void)addDictToState( wPath, 0, state );
|
||||
}
|
||||
addDictsToMenu( state );
|
||||
#endif
|
||||
|
||||
if ( !state->isNewGame ) {
|
||||
ceEnOrDisable( state->dlgHdr.hDlg, state->dictListId, XP_FALSE );
|
||||
}
|
||||
} /* loadFromGameInfo */
|
||||
|
||||
static XP_Bool
|
||||
stateToGameInfo( GameInfoState* state )
|
||||
{
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
CurGameInfo* gi = &globals->gameInfo;
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
XP_Bool timerOn;
|
||||
XP_Bool success = newg_store( state->newGameCtx, gi, XP_TRUE );
|
||||
|
||||
if ( success ) {
|
||||
|
||||
/* dictionary */ {
|
||||
int sel;
|
||||
sel = SendDlgItemMessage( hDlg, state->dictListId,
|
||||
GETCURSEL(globals), 0, 0L );
|
||||
if ( sel >= 0 ) {
|
||||
WideCharToMultiByte( CP_ACP, 0, state->menuDicts[sel], -1,
|
||||
state->newDictName, state->dictNameLen,
|
||||
NULL, NULL );
|
||||
}
|
||||
replaceStringIfDifferent( globals->mpool, &gi->dictName,
|
||||
state->newDictName );
|
||||
}
|
||||
|
||||
/* timer */
|
||||
timerOn = ceGetChecked( hDlg, TIMER_CHECK );
|
||||
gi->timerEnabled = timerOn;
|
||||
if ( timerOn ) {
|
||||
XP_UCHAR numBuf[10];
|
||||
XP_U16 len = sizeof(numBuf);
|
||||
ceGetDlgItemText( hDlg, TIMER_EDIT, numBuf, &len );
|
||||
if ( len > 0 ) {
|
||||
XP_U16 num = atoi( numBuf );
|
||||
gi->gameSeconds = num * 60;
|
||||
}
|
||||
}
|
||||
|
||||
/* preferences */
|
||||
if ( state->results.prefsChanged ) {
|
||||
loadCurPrefsFromState( globals, &globals->appPrefs, gi,
|
||||
state->prefsPrefs );
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
} /* stateToGameInfo */
|
||||
|
||||
static void
|
||||
raiseForJuggle( GameInfoState* state, XP_Bool nowHidden )
|
||||
{
|
||||
if ( nowHidden != state->juggleHidden ) {
|
||||
ceDlgMoveBelow( &state->dlgHdr, GIJUGGLE_BUTTON,
|
||||
state->juggleSpacing * (nowHidden? -1 : 1) );
|
||||
state->juggleHidden = nowHidden;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
static void
|
||||
raiseForRoleChange( GameInfoState* state, DeviceRole role )
|
||||
{
|
||||
XP_Bool configHidden = role == SERVER_STANDALONE;
|
||||
if ( configHidden != state->roleConfigHidden ) {
|
||||
ceDlgMoveBelow( &state->dlgHdr, state->roleComboId,
|
||||
state->configSpacing * (configHidden? -1 : 1) );
|
||||
state->roleConfigHidden = configHidden;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
raiseForHiddenPlayers( GameInfoState* state, XP_U16 nPlayers )
|
||||
{
|
||||
if ( nPlayers != state->prevNPlayers ) {
|
||||
ceDlgMoveBelow( &state->dlgHdr, NAME_EDIT4,
|
||||
state->playersSpacing
|
||||
* (nPlayers - state->prevNPlayers) );
|
||||
state->prevNPlayers = nPlayers;
|
||||
}
|
||||
} /* raiseForHiddenPlayers */
|
||||
|
||||
static void
|
||||
handlePrefsButton( HWND hDlg, CEAppGlobals* globals, GameInfoState* state )
|
||||
{
|
||||
XP_Bool colorsChanged, langChanged;
|
||||
if ( WrapPrefsDialog( hDlg, globals, state->prefsPrefs,
|
||||
state->isNewGame, &colorsChanged, &langChanged ) ) {
|
||||
state->results.prefsChanged = XP_TRUE;
|
||||
state->results.colorsChanged = colorsChanged;
|
||||
state->results.langChanged = langChanged;
|
||||
/* nothing to do until user finally does confirm the parent dialog */
|
||||
}
|
||||
} /* handlePrefsButton */
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
static XP_Bool
|
||||
callConnsDlg( GameInfoState* state )
|
||||
{
|
||||
XP_Bool connsComplete = XP_FALSE;
|
||||
/* maybe flag when this isn't changed? No. Check on "Ok" as tagged elsewhere. */
|
||||
if ( WrapConnsDlg( state->dlgHdr.hDlg, state->dlgHdr.globals,
|
||||
&state->prefsPrefs->addrRec,
|
||||
&state->prefsPrefs->addrRec, state->curRole,
|
||||
state->isNewGame,
|
||||
&connsComplete ) ) {
|
||||
state->results.addrChanged = XP_TRUE;
|
||||
}
|
||||
return connsComplete;
|
||||
}
|
||||
|
||||
static void
|
||||
handleConnOptionsButton( GameInfoState* state )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
DeviceRole role;
|
||||
NGValue value;
|
||||
|
||||
role = (DeviceRole)SendDlgItemMessage( hDlg, state->roleComboId,
|
||||
GETCURSEL(globals), 0, 0L);
|
||||
value.ng_role = state->curRole = role;
|
||||
if ( value.ng_role != globals->gameInfo.serverRole ) {
|
||||
state->results.addrChanged = XP_TRUE;
|
||||
}
|
||||
|
||||
newg_attrChanged( state->newGameCtx, NG_ATTR_ROLE, value );
|
||||
raiseForRoleChange( state, role );
|
||||
} /* handleConnOptionsButton */
|
||||
#endif
|
||||
|
||||
static XP_U16
|
||||
resIDForCol( XP_U16 player, NewGameColumn col )
|
||||
{
|
||||
XP_U16 resID = 0;
|
||||
switch ( col ) {
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
case NG_COL_REMOTE:
|
||||
resID = REMOTE_CHECK1;
|
||||
break;
|
||||
#endif
|
||||
case NG_COL_ROBOT:
|
||||
resID = ROBOT_CHECK1;
|
||||
break;
|
||||
case NG_COL_NAME:
|
||||
resID = NAME_EDIT1;
|
||||
break;
|
||||
case NG_COL_PASSWD:
|
||||
resID = PASS_EDIT1;
|
||||
break;
|
||||
}
|
||||
XP_ASSERT( resID != 0 );
|
||||
return resID + ( player * NUM_COLS );
|
||||
} /* resIDForCol */
|
||||
|
||||
static XP_U16
|
||||
resIDForAttr( GameInfoState* state, NewGameAttr attr )
|
||||
{
|
||||
XP_U16 resID = 0;
|
||||
switch( attr ) {
|
||||
case NG_ATTR_NPLAYERS:
|
||||
resID = state->nPlayersId;
|
||||
break;
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
case NG_ATTR_ROLE:
|
||||
resID = state->roleComboId;
|
||||
break;
|
||||
case NG_ATTR_CANCONFIG:
|
||||
resID = GIROLECONF_BUTTON;
|
||||
break;
|
||||
case NG_ATTR_REMHEADER:
|
||||
resID = IDC_REMOTE_LABEL;
|
||||
break;
|
||||
#endif
|
||||
case NG_ATTR_NPLAYHEADER:
|
||||
resID = IDC_TOTAL_LABEL;
|
||||
break;
|
||||
case NG_ATTR_CANJUGGLE:
|
||||
resID = GIJUGGLE_BUTTON;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
XP_ASSERT( resID != 0 );
|
||||
return resID;
|
||||
} /* resIDForAttr */
|
||||
|
||||
static void
|
||||
doForNWEnable( HWND hDlg, XP_U16 resID, XP_TriEnable enable )
|
||||
{
|
||||
XP_Bool makeVisible = enable != TRI_ENAB_HIDDEN;
|
||||
ceShowOrHide( hDlg, resID, makeVisible );
|
||||
if ( makeVisible ) {
|
||||
ceEnOrDisable( hDlg, resID, enable == TRI_ENAB_ENABLED );
|
||||
}
|
||||
} /* doForNWEnable */
|
||||
|
||||
static void
|
||||
ceEnableColProc( void* closure, XP_U16 player, NewGameColumn col,
|
||||
XP_TriEnable enable )
|
||||
{
|
||||
GameInfoState* state = (GameInfoState*)closure;
|
||||
XP_U16 resID = resIDForCol( player, col );
|
||||
doForNWEnable( state->dlgHdr.hDlg, resID, enable );
|
||||
}
|
||||
|
||||
static void
|
||||
ceEnableAttrProc( void* closure, NewGameAttr attr, XP_TriEnable enable )
|
||||
{
|
||||
GameInfoState* state = (GameInfoState*)closure;
|
||||
XP_U16 resID = resIDForAttr( state, attr );
|
||||
doForNWEnable( state->dlgHdr.hDlg, resID, enable );
|
||||
if ( resID == GIJUGGLE_BUTTON ) {
|
||||
raiseForJuggle( state, enable == TRI_ENAB_HIDDEN );
|
||||
}
|
||||
} /* ceEnableAttrProc */
|
||||
|
||||
static void
|
||||
ceGetColProc( void* closure, XP_U16 player, NewGameColumn col,
|
||||
NgCpCallbk cpcb, const void* cpClosure )
|
||||
{
|
||||
NGValue value;
|
||||
GameInfoState* state = (GameInfoState*)closure;
|
||||
XP_U16 resID = resIDForCol( player, col );
|
||||
XP_UCHAR txt[128];
|
||||
XP_U16 len;
|
||||
|
||||
switch ( col ) {
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
case NG_COL_REMOTE:
|
||||
#endif
|
||||
case NG_COL_ROBOT:
|
||||
value.ng_bool = ceGetChecked( state->dlgHdr.hDlg, resID );
|
||||
break;
|
||||
case NG_COL_NAME:
|
||||
case NG_COL_PASSWD:
|
||||
len = sizeof(txt);
|
||||
ceGetDlgItemText( state->dlgHdr.hDlg, resID, txt, &len );
|
||||
value.ng_cp = &txt[0];
|
||||
break;
|
||||
default:
|
||||
XP_ASSERT(0);
|
||||
}
|
||||
|
||||
(*cpcb)( value, cpClosure );
|
||||
} /* ceGetColProc */
|
||||
|
||||
static void
|
||||
ceSetColProc( void* closure, XP_U16 player, NewGameColumn col,
|
||||
const NGValue value )
|
||||
{
|
||||
GameInfoState* state = (GameInfoState*)closure;
|
||||
XP_U16 resID = resIDForCol( player, col );
|
||||
const XP_UCHAR* cp;
|
||||
XP_UCHAR buf[32];
|
||||
|
||||
switch( col ) {
|
||||
case NG_COL_PASSWD:
|
||||
case NG_COL_NAME:
|
||||
if ( NULL != value.ng_cp ) {
|
||||
cp = value.ng_cp;
|
||||
} else if ( col == NG_COL_NAME ) {
|
||||
const XP_UCHAR* str = ceGetResString( state->dlgHdr.globals,
|
||||
IDS_PLAYER_FORMAT );
|
||||
snprintf( buf, sizeof(buf), str, player + 1 );
|
||||
cp = buf;
|
||||
} else {
|
||||
cp = "";
|
||||
}
|
||||
ceSetDlgItemText( state->dlgHdr.hDlg, resID, cp );
|
||||
break;
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
case NG_COL_REMOTE:
|
||||
#endif
|
||||
case NG_COL_ROBOT:
|
||||
ceSetChecked( state->dlgHdr.hDlg, resID, value.ng_bool );
|
||||
break;
|
||||
default:
|
||||
XP_ASSERT(0);
|
||||
}
|
||||
} /* ceSetColProc */
|
||||
|
||||
static void
|
||||
ceSetAttrProc(void* closure, NewGameAttr attr, const NGValue value )
|
||||
{
|
||||
GameInfoState* state = (GameInfoState*)closure;
|
||||
XP_U16 resID = resIDForAttr( state, attr );
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
|
||||
switch ( attr ) {
|
||||
case NG_ATTR_NPLAYERS:
|
||||
SendDlgItemMessage( state->dlgHdr.hDlg, resID,
|
||||
SETCURSEL(globals),
|
||||
value.ng_u16 - 1, 0L );
|
||||
raiseForHiddenPlayers( state, value.ng_u16 );
|
||||
break;
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
case NG_ATTR_ROLE:
|
||||
SendDlgItemMessage( state->dlgHdr.hDlg, resID, SETCURSEL(globals),
|
||||
value.ng_role, 0L );
|
||||
state->curRole = value.ng_role;
|
||||
raiseForRoleChange( state, value.ng_role );
|
||||
break;
|
||||
#endif
|
||||
case NG_ATTR_NPLAYHEADER:
|
||||
ceSetDlgItemText( state->dlgHdr.hDlg, resID, value.ng_cp );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} /* ceSetAttrProc */
|
||||
|
||||
static XP_U16
|
||||
playerFromID( XP_U16 id, XP_U16 base )
|
||||
{
|
||||
XP_U16 player;
|
||||
player = (id - base) / NUM_COLS;
|
||||
return player;
|
||||
}
|
||||
|
||||
static void
|
||||
handleColChecked( GameInfoState* state, XP_U16 id, XP_U16 base )
|
||||
{
|
||||
NGValue value;
|
||||
XP_U16 player = playerFromID( id, base );
|
||||
|
||||
value.ng_bool = ceGetChecked( state->dlgHdr.hDlg, id );
|
||||
|
||||
newg_colChanged( state->newGameCtx, player );
|
||||
}
|
||||
|
||||
/* It's too much work at this point to get the icon button looking good,
|
||||
* e.g. properly greyed-out when disabled. So I'm sticking with the "J".
|
||||
* Here's the code to start with if I get more ambitious. Remember: the
|
||||
* GIJUGGLE_BUTTON needs to have the BS_OWNERDRAW attribute for this to work.
|
||||
*/
|
||||
#ifdef OWNERDRAW_JUGGLE
|
||||
static void
|
||||
ceDrawIconButton( CEAppGlobals* globals, DRAWITEMSTRUCT* dis )
|
||||
{
|
||||
HBITMAP bmp = LoadBitmap( globals->hInst,
|
||||
MAKEINTRESOURCE(IDB_JUGGLEBUTTON) );
|
||||
if ( !!bmp ) {
|
||||
ceDrawBitmapInRect( dis->hDC, &dis->rcItem, bmp );
|
||||
DeleteObject( bmp );
|
||||
}
|
||||
} /* ceDrawColorButton */
|
||||
#endif
|
||||
|
||||
static void
|
||||
checkUpdateCombo( GameInfoState* state, XP_U16 id )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
|
||||
if ( id == state->nPlayersId ) {
|
||||
if ( state->isNewGame ) { /* ignore if in info mode */
|
||||
XP_S16 sel;
|
||||
XP_U16 nPlayers;
|
||||
NGValue value;
|
||||
|
||||
sel = SendDlgItemMessage( hDlg, id,
|
||||
GETCURSEL(state->dlgHdr.globals), 0, 0L);
|
||||
nPlayers = 1 + sel;
|
||||
value.ng_u16 = nPlayers;
|
||||
XP_ASSERT( !!state->newGameCtx );
|
||||
newg_attrChanged( state->newGameCtx,
|
||||
NG_ATTR_NPLAYERS, value );
|
||||
|
||||
raiseForHiddenPlayers( state, nPlayers );
|
||||
}
|
||||
} else if ( id == state->roleComboId ) {
|
||||
XP_ASSERT( SERVER_STANDALONE == 0 );
|
||||
handleConnOptionsButton( state );
|
||||
}
|
||||
} /* checkUpdateCombo */
|
||||
|
||||
static LRESULT CALLBACK
|
||||
GameInfo( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
CEAppGlobals* globals;
|
||||
XP_U16 id;
|
||||
GameInfoState* state;
|
||||
LRESULT result = FALSE;
|
||||
|
||||
/* XP_LOGF( "%s: %s(%d)", __func__, messageToStr( message ), message ); */
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
state = (GameInfoState*)lParam;
|
||||
globals = state->dlgHdr.globals;
|
||||
|
||||
state->nPlayersId = LB_IF_PPC(globals,IDC_NPLAYERSCOMBO);
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
state->roleComboId = LB_IF_PPC(globals, IDC_ROLECOMBO);
|
||||
#endif
|
||||
state->dictListId = LB_IF_PPC(globals,IDC_DICTLIST);
|
||||
state->prevNPlayers = MAX_NUM_PLAYERS;
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||
state->playersSpacing = ceDistanceBetween( hDlg, NAME_EDIT3, NAME_EDIT4 );
|
||||
state->juggleSpacing = ceDistanceBetween( state->dlgHdr.hDlg,
|
||||
GIJUGGLE_BUTTON,
|
||||
IDC_DICTLABEL );
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
state->configSpacing = ceDistanceBetween( state->dlgHdr.hDlg,
|
||||
GIROLECONF_BUTTON,
|
||||
IDC_TOTAL_LABEL );
|
||||
|
||||
ceDlgComboShowHide( &state->dlgHdr, IDC_ROLECOMBO );
|
||||
#endif
|
||||
ceDlgComboShowHide( &state->dlgHdr, IDC_NPLAYERSCOMBO );
|
||||
ceDlgComboShowHide( &state->dlgHdr, IDC_DICTLIST );
|
||||
|
||||
state->newGameCtx = newg_make( MPPARM(globals->mpool)
|
||||
state->isNewGame,
|
||||
&globals->util,
|
||||
ceEnableColProc,
|
||||
ceEnableAttrProc,
|
||||
ceGetColProc,
|
||||
ceSetColProc,
|
||||
ceSetAttrProc,
|
||||
state );
|
||||
|
||||
loadFromGameInfo( state );
|
||||
loadStateFromCurPrefs( globals, &globals->appPrefs, &globals->gameInfo,
|
||||
state->prefsPrefs );
|
||||
|
||||
if ( state->isNewGame ) {
|
||||
(void)SetWindowText( hDlg, ceGetResStringL( globals,
|
||||
IDS_NEW_GAME ) );
|
||||
}
|
||||
|
||||
result = TRUE;
|
||||
|
||||
} else {
|
||||
state = (GameInfoState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!state ) {
|
||||
globals = state->dlgHdr.globals;
|
||||
|
||||
XP_ASSERT( hDlg == state->dlgHdr.hDlg );
|
||||
result = ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam );
|
||||
if ( !result ) {
|
||||
switch (message) {
|
||||
|
||||
#ifdef OWNERDRAW_JUGGLE
|
||||
case WM_DRAWITEM: /* for BS_OWNERDRAW style */
|
||||
ceDrawIconButton( globals, (DRAWITEMSTRUCT*)lParam );
|
||||
result = TRUE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case WM_PAINT:
|
||||
if ( state->popConnsDlg ) {
|
||||
state->popConnsDlg = XP_FALSE;
|
||||
callConnsDlg( state );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
if ( !!state->newGameCtx ) {
|
||||
checkUpdateCombo( state, LOWORD(wParam)-1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
result = TRUE;
|
||||
id = LOWORD(wParam);
|
||||
if ( id == state->nPlayersId
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
|| id == state->roleComboId
|
||||
#endif
|
||||
) {
|
||||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||
checkUpdateCombo( state, id );
|
||||
}
|
||||
} else {
|
||||
switch( id ) {
|
||||
case ROBOT_CHECK1:
|
||||
case ROBOT_CHECK2:
|
||||
case ROBOT_CHECK3:
|
||||
case ROBOT_CHECK4:
|
||||
handleColChecked( state, id, ROBOT_CHECK1 );
|
||||
break;
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
case REMOTE_CHECK1:
|
||||
case REMOTE_CHECK2:
|
||||
case REMOTE_CHECK3:
|
||||
case REMOTE_CHECK4:
|
||||
handleColChecked( state, id, REMOTE_CHECK1 );
|
||||
break;
|
||||
|
||||
case IDC_ROLECOMBO:
|
||||
case IDC_ROLECOMBO_PPC:
|
||||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||
/* If we've switched to a state where we'll be
|
||||
connecting */
|
||||
handleConnOptionsButton( state );
|
||||
}
|
||||
break;
|
||||
case GIROLECONF_BUTTON:
|
||||
(void)callConnsDlg( state );
|
||||
break;
|
||||
#endif
|
||||
case GIJUGGLE_BUTTON:
|
||||
XP_ASSERT( state->isNewGame );
|
||||
/* Juggle vs switch. On Win32, updates are
|
||||
coalesced so you don't see anything on screen
|
||||
if you change a field then change it back. In
|
||||
terms of messages, all we see here is a
|
||||
WM_CTLCOLOREDIT for each field being changed.
|
||||
If I post a custom event here, it comes in
|
||||
*before* the WM_CTLCOLOREDIT events. Short of
|
||||
a timer, which starts a race with the user, I
|
||||
see no way to get notified after the drawing's
|
||||
done. So for now, we switch rather than
|
||||
juggle: call juggle until something actually
|
||||
happens. */
|
||||
while ( !newg_juggle( state->newGameCtx ) ) {
|
||||
}
|
||||
break;
|
||||
|
||||
case OPTIONS_BUTTON:
|
||||
handlePrefsButton( hDlg, globals, state );
|
||||
break;
|
||||
|
||||
case IDOK: {
|
||||
if ( state->curRole != SERVER_STANDALONE
|
||||
&& !comms_checkComplete(
|
||||
&state->prefsPrefs->addrRec )
|
||||
&& !callConnsDlg( state ) ) {
|
||||
break;
|
||||
} else if ( !stateToGameInfo( state ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, id);
|
||||
state->userCancelled = id == IDCANCEL;
|
||||
cleanupGameInfoState( state );
|
||||
newg_destroy( state->newGameCtx );
|
||||
state->newGameCtx = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* GameInfo */
|
||||
|
||||
XP_Bool
|
||||
WrapGameInfoDialog( CEAppGlobals* globals, GIShow showWhat,
|
||||
CePrefsPrefs* prefsPrefs,
|
||||
XP_UCHAR* dictName, XP_U16 dictNameLen,
|
||||
GInfoResults* results )
|
||||
{
|
||||
GameInfoState state;
|
||||
XP_U16 resIDs[48];
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
state.dlgHdr.globals = globals;
|
||||
state.dlgHdr.resIDs = resIDs;
|
||||
state.dlgHdr.nResIDs = VSIZE(resIDs);
|
||||
state.isNewGame = showWhat != GI_INFO_ONLY;
|
||||
state.popConnsDlg = showWhat == GI_GOTO_CONNS;
|
||||
state.prefsPrefs = prefsPrefs;
|
||||
state.newDictName = dictName;
|
||||
state.dictNameLen = dictNameLen;
|
||||
|
||||
assertOnTop( globals->hWnd );
|
||||
DialogBoxParam( globals->locInst, (LPCTSTR)IDD_GAMEINFO, globals->hWnd,
|
||||
(DLGPROC)GameInfo, (long)&state );
|
||||
|
||||
if ( !state.userCancelled ) {
|
||||
XP_MEMCPY( results, &state.results, sizeof(*results) );
|
||||
}
|
||||
|
||||
return !state.userCancelled;
|
||||
} /* WrapGameInfoDialog */
|
|
@ -1,49 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002-2009 by Eric House (xwords@eehouse.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 _CEGINFO_H_
|
||||
#define _CEGINFO_H_
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cemain.h"
|
||||
#include "ceprefs.h"
|
||||
#include "cedict.h"
|
||||
#include "ceutil.h"
|
||||
#include "nwgamest.h"
|
||||
|
||||
|
||||
typedef struct _GInfoResults {
|
||||
XP_Bool prefsChanged;
|
||||
XP_Bool colorsChanged;
|
||||
XP_Bool langChanged;
|
||||
XP_Bool addrChanged;
|
||||
} GInfoResults;
|
||||
|
||||
typedef enum {
|
||||
GI_INFO_ONLY
|
||||
,GI_NEW_GAME
|
||||
,GI_GOTO_CONNS
|
||||
} GIShow;
|
||||
|
||||
XP_Bool WrapGameInfoDialog( CEAppGlobals* globals, GIShow showWhat,
|
||||
CePrefsPrefs* prefsPrefs,
|
||||
XP_UCHAR* dictName, XP_U16 dictNameLen,
|
||||
GInfoResults* results );
|
||||
|
||||
#endif
|
|
@ -1,108 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2004 by Eric House (xwords@eehouse.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.
|
||||
*/
|
||||
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cehntlim.h"
|
||||
|
||||
static void
|
||||
initComboBox( HintLimitsState* state, XP_U16 id, XP_U16 startVal )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
XP_U16 ii;
|
||||
for ( ii = 0; ii < MAX_TRAY_TILES; ++ii ) {
|
||||
wchar_t str[4];
|
||||
swprintf( str, L"%d", ii+1 );
|
||||
|
||||
SendDlgItemMessage( hDlg, id, INSERTSTRING(state->dlgHdr.globals), ii, (long)str );
|
||||
|
||||
if ( (ii+1) == startVal ) {
|
||||
SendDlgItemMessage( hDlg, id, SETCURSEL(state->dlgHdr.globals), ii, 0L );
|
||||
}
|
||||
}
|
||||
|
||||
} /* initComboBox */
|
||||
|
||||
static XP_U16
|
||||
getComboValue( HintLimitsState* state, XP_U16 id )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
LONG result;
|
||||
result = SendDlgItemMessage( hDlg, id, GETCURSEL(state->dlgHdr.globals), 0, 0L );
|
||||
if ( result == CB_ERR ) {
|
||||
result = 1;
|
||||
}
|
||||
return (XP_U16)result + 1; /* number is 1-based but index 0-based */
|
||||
} /* getComboValue */
|
||||
|
||||
LRESULT CALLBACK
|
||||
HintLimitsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
HintLimitsState* hState;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
hState = (HintLimitsState*)lParam;
|
||||
|
||||
ceDlgSetup( &hState->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||
ceDlgComboShowHide( &hState->dlgHdr, HC_MIN_COMBO );
|
||||
ceDlgComboShowHide( &hState->dlgHdr, HC_MAX_COMBO );
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
hState = (HintLimitsState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!hState ) {
|
||||
|
||||
if ( !hState->inited ) {
|
||||
initComboBox( hState,
|
||||
LB_IF_PPC(hState->dlgHdr.globals, HC_MIN_COMBO),
|
||||
hState->min );
|
||||
initComboBox( hState,
|
||||
LB_IF_PPC(hState->dlgHdr.globals,HC_MAX_COMBO),
|
||||
hState->max );
|
||||
hState->inited = XP_TRUE;
|
||||
}
|
||||
|
||||
if ( ceDoDlgHandle( &hState->dlgHdr, message, wParam, lParam) ) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( (message == WM_COMMAND) && (BN_CLICKED == HIWORD(wParam) ) ) {
|
||||
XP_U16 id = LOWORD(wParam);
|
||||
switch( id ) {
|
||||
case IDOK:
|
||||
hState->min = getComboValue( hState,
|
||||
LB_IF_PPC(hState->dlgHdr.globals,HC_MIN_COMBO) );
|
||||
hState->max = getComboValue( hState,
|
||||
LB_IF_PPC(hState->dlgHdr.globals,HC_MAX_COMBO) );
|
||||
case IDCANCEL:
|
||||
hState->cancelled = id == IDCANCEL;
|
||||
|
||||
EndDialog( hDlg, id );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} /* HintLimitsDlg */
|
||||
|
||||
#endif /* XWFEATURE_SEARCHLIMIT */
|
|
@ -1,39 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2004 by Eric House (xwords@eehouse.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 _CEHNTLIM_H_
|
||||
#define _CEHNTLIM_H_
|
||||
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
|
||||
typedef struct HintLimitsState {
|
||||
CeDlgHdr dlgHdr;
|
||||
XP_U16 min, max;
|
||||
XP_Bool inited;
|
||||
XP_Bool cancelled;
|
||||
} HintLimitsState;
|
||||
|
||||
LRESULT CALLBACK HintLimitsDlg(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
#endif /* XWFEATURE_SEARCHLIMIT */
|
||||
|
||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002 by Eric House (xwords@eehouse.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 _CEIR_H_
|
||||
#define _CEIR_H_
|
||||
|
||||
|
||||
|
||||
#ifdef XWFEATURE_STANDALONE_ONLY
|
||||
# define ce_ir_send (TransportSend)NULL
|
||||
#else
|
||||
XP_S16 ce_ir_send( XP_U8* buf, XP_U16 len, CommsAddrRec* addr, void* closure );
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -1,281 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
|
||||
/*
|
||||
* Copyright 2000-2009 by Eric House (xwords@eehouse.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 _CEMAIN_H_
|
||||
#define _CEMAIN_H_
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# include <aygshell.h>
|
||||
#endif
|
||||
#include "draw.h"
|
||||
#include "game.h"
|
||||
#include "util.h"
|
||||
#include "mempool.h"
|
||||
#include "cesockwr.h"
|
||||
#include "ceconnmg.h"
|
||||
|
||||
#define LCROSSWORDS_DIR_NODBG L"Crosswords"
|
||||
#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
|
||||
#ifdef DEBUG
|
||||
# define CROSSWORDS_DIR "Cross_dbg"
|
||||
# define LCROSSWORDS_DIR L"Cross_dbg"
|
||||
#else
|
||||
# define CROSSWORDS_DIR "Crosswords"
|
||||
# define LCROSSWORDS_DIR LCROSSWORDS_DIR_NODBG
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
typedef enum {
|
||||
WINCE_UNKNOWN
|
||||
, WINCE_PPC_V1
|
||||
, WINCE_PPC_2003
|
||||
, WINCE_PPC_2005
|
||||
, _LAST_PPC /* so can test for PPC */
|
||||
, WINCE_SMARTPHONE_V1
|
||||
, WINCE_SMARTPHONE_2003
|
||||
, WINCE_SMARTPHONE_2005
|
||||
} XW_WinceVersion;
|
||||
|
||||
# define IS_SMARTPHONE(g) ((g)->winceVersion > _LAST_PPC)
|
||||
#else
|
||||
# define IS_SMARTPHONE(g) ((g) != (g)) /* make compiler warnings go away */
|
||||
#endif
|
||||
|
||||
enum { CE_BONUS0_COLOR,
|
||||
CE_BONUS1_COLOR,
|
||||
CE_BONUS2_COLOR,
|
||||
CE_BONUS3_COLOR,
|
||||
|
||||
CE_BKG_COLOR,
|
||||
CE_TILEBACK_COLOR,
|
||||
|
||||
CE_FOCUS_COLOR,
|
||||
|
||||
CE_PLAYER0_COLOR,
|
||||
CE_PLAYER1_COLOR,
|
||||
CE_PLAYER2_COLOR,
|
||||
CE_PLAYER3_COLOR,
|
||||
|
||||
CE_BLACK_COLOR, /* not editable by users */
|
||||
CE_WHITE_COLOR,
|
||||
|
||||
CE_NUM_COLORS /* last */
|
||||
};
|
||||
|
||||
// #define CUR_CE_PREFS_FLAGS 0x0003 /* adds CE_FOCUS_COLOR */
|
||||
#define CUR_CE_PREFS_FLAGS 0x0004 /* moves showColors into CommonPrefs */
|
||||
|
||||
/* 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;
|
||||
|
||||
/* This is what CEAppPrefs looked like for CUR_CE_PREFS_FLAGS == 0x0003 */
|
||||
typedef struct _CEAppPrefs0003 {
|
||||
XP_U16 versionFlags;
|
||||
struct {
|
||||
XP_Bool showBoardArrow; /* applies to all games */
|
||||
XP_Bool showRobotScores; /* applies to all games */
|
||||
XP_Bool hideTileValues;
|
||||
XP_Bool skipCommitConfirm; /* applies to all games */
|
||||
#ifdef XWFEATURE_SLOW_ROBOT
|
||||
XP_U16 robotThinkMin, robotThinkMax;
|
||||
#endif
|
||||
} cp;
|
||||
COLORREF colors[13];
|
||||
XP_Bool showColors;
|
||||
XP_Bool fullScreen;
|
||||
} CEAppPrefs0003;
|
||||
|
||||
typedef enum {
|
||||
SAB_NONE = 0
|
||||
,SAB_PHONEOFF = 1 << 0
|
||||
,SAB_NETFAILED = 1 << 1
|
||||
,SAB_HOST_CONND = 1 << 2
|
||||
,SAB_CLIENT_CONND = 1 << 3
|
||||
,SAB_ALL_HERE = 1 << 4
|
||||
,SAB_HEART_YOU = 1 << 5
|
||||
,SAB_HEART_OTHER = 1 << 6
|
||||
} SkipAlertBits;
|
||||
|
||||
typedef struct CEAppPrefs {
|
||||
XP_U16 versionFlags;
|
||||
CommonPrefs cp;
|
||||
COLORREF colors[CE_NUM_COLORS];
|
||||
XP_Bool fullScreen;
|
||||
} CEAppPrefs;
|
||||
|
||||
enum { OWNED_RECT_LEFT
|
||||
,OWNED_RECT_RIGHT
|
||||
,OWNED_RECT_TOP
|
||||
,OWNED_RECT_BOTTOM
|
||||
,N_OWNED_RECTS
|
||||
};
|
||||
|
||||
enum {
|
||||
MY_DOCS_CACHE,
|
||||
PROGFILES_CACHE,
|
||||
N_CACHED_PATHS
|
||||
};
|
||||
|
||||
typedef struct _TimerData {
|
||||
XP_U32 id;
|
||||
XWTimerProc proc;
|
||||
void* closure;
|
||||
XP_U32 when;
|
||||
} TimerData;
|
||||
|
||||
typedef struct _CEAppGlobals {
|
||||
HINSTANCE hInst;
|
||||
HINSTANCE locInst; /* same as hInst if no l10n DLL in use */
|
||||
HDC hdc; /* to pass drawing ctxt to draw code */
|
||||
HWND hWnd;
|
||||
#ifdef _WIN32_WCE
|
||||
HWND hwndCB;
|
||||
SHACTIVATEINFO sai;
|
||||
XW_WinceVersion winceVersion;
|
||||
#else
|
||||
/* Store location of dummy button */
|
||||
HMENU dummyMenu;
|
||||
XP_U16 dummyPos;
|
||||
#endif
|
||||
|
||||
XP_U16 softKeyId; /* id of item now on left button */
|
||||
#ifndef _WIN32_WCE
|
||||
HMENU softKeyMenu; /* so can check/uncheck duplicated items */
|
||||
#endif
|
||||
|
||||
#if defined _WIN32_WCE && ! defined CEGCC_DOES_CONNMGR
|
||||
HINSTANCE hcellDll;
|
||||
/* UINT connmgrMsg; */
|
||||
CMProcs cmProcs;
|
||||
#endif
|
||||
|
||||
struct CEDrawCtx* draw;
|
||||
XWGame game;
|
||||
CurGameInfo gameInfo;
|
||||
XP_UCHAR* curGameName; /* path to storage for current game */
|
||||
XP_UCHAR* langFileName; /* language file currently loaded or chosen */
|
||||
XW_UtilCtxt util;
|
||||
VTableMgr* vtMgr;
|
||||
XP_U16* bonusInfo;
|
||||
|
||||
TimerData timerData[NUM_TIMERS_PLUS_ONE];
|
||||
|
||||
RECT ownedRects[N_OWNED_RECTS];
|
||||
|
||||
XP_U16 flags; /* bits defined below */
|
||||
XP_U16 cellHt; /* how tall is a cell given current layout */
|
||||
|
||||
#ifdef CEFEATURE_CANSCROLL
|
||||
HWND scrollHandle;
|
||||
WNDPROC oldScrollProc;
|
||||
#ifdef _WIN32_WCE
|
||||
RECT scrollRects[2]; /* above and below the scroller */
|
||||
#endif
|
||||
XP_Bool scrollerHasFocus;
|
||||
#endif
|
||||
#ifdef KEYBOARD_NAV
|
||||
XP_Bool keyDown;
|
||||
#endif
|
||||
struct CeSocketWrapper* socketWrap;
|
||||
|
||||
CEAppPrefs appPrefs;
|
||||
|
||||
SkipAlertBits skipAlrtBits; /* bit vector */
|
||||
|
||||
XP_Bool isNewGame;
|
||||
XP_Bool penDown;
|
||||
XP_Bool hintPending;
|
||||
XP_Bool doGlobalPrefs;
|
||||
XP_Bool exiting; /* are we in the process of shutting down? */
|
||||
|
||||
#ifdef XWFEATURE_RELAY
|
||||
CommsRelayState relayState;
|
||||
CeConnState socketState;
|
||||
RECT relayStatusR;
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
XP_U16 dbWidth, dbHeight;
|
||||
#endif
|
||||
|
||||
#ifdef LOADSTRING_BROKEN
|
||||
void* resStrStorage; /* used in ceresstr.c */
|
||||
#endif
|
||||
|
||||
wchar_t* specialDirs[N_CACHED_PATHS]; /* reserved for ceGetPath() */
|
||||
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
XP_Bool askTrayLimits;
|
||||
#endif
|
||||
MPSLOT
|
||||
|
||||
} CEAppGlobals;
|
||||
|
||||
/* No longer used, but may need to keep set for backwards compatibility */
|
||||
# define FLAGS_BIT_SHOWN_NEWDICTLOC 0x0001
|
||||
|
||||
#define GAME_IN_PROGRESS(g) ((g)->gameInfo.dictName != 0)
|
||||
|
||||
enum {
|
||||
XWWM_TIME_RQST = WM_APP
|
||||
,XWWM_REM_SEL
|
||||
,XWWM_HOSTNAME_ARRIVED
|
||||
,XWWM_RELAY_REQ_NEW
|
||||
,XWWM_RELAY_REQ_CONN
|
||||
,XWWM_SOCKET_EVT
|
||||
#ifdef _WIN32_WCE
|
||||
,XWWM_CONNMGR_EVT
|
||||
#endif
|
||||
};
|
||||
|
||||
#define CE_NUM_EDITABLE_COLORS CE_BLACK_COLOR
|
||||
|
||||
|
||||
XP_Bool queryBoxChar( CEAppGlobals* globals, HWND hWnd,
|
||||
const XP_UCHAR* msg );
|
||||
|
||||
/* These allow LISTBOX and COMBOBOX to be used by the same code */
|
||||
|
||||
#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)
|
||||
#define FINDSTRINGEXACT(g) \
|
||||
(IS_SMARTPHONE(g)?LB_FINDSTRINGEXACT:CB_FINDSTRINGEXACT)
|
||||
#define LB_IF_PPC(g,id) (IS_SMARTPHONE(g)?id:(id+2))
|
||||
|
||||
|
||||
#define BACK_KEY_UP_MAYBE 0x1000
|
||||
#define CE_MAX_PATH_LEN 256
|
||||
|
||||
#ifndef DM_RESETSCROLL
|
||||
//http://www.nah6.com/~itsme/cvs-xdadevtools/itsutils/src/its_windows_message_list.txt
|
||||
# define DM_RESETSCROLL 0x0402
|
||||
#endif
|
||||
|
||||
#endif /* _CEMAIN_H_ */
|
|
@ -1,431 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2002-2009 by Eric House (xwords@eehouse.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 <stdio.h>
|
||||
|
||||
#include "ceprefs.h"
|
||||
#include "cemain.h"
|
||||
#include "ceclrsel.h"
|
||||
#include "ceutil.h"
|
||||
#include "debhacks.h"
|
||||
#include "cedebug.h"
|
||||
#include "cefonts.h"
|
||||
#include "ceresstr.h"
|
||||
#include "strutils.h"
|
||||
|
||||
typedef struct _CePrefsDlgState {
|
||||
CeDlgHdr dlgHdr;
|
||||
CePrefsPrefs prefsPrefs;
|
||||
|
||||
XP_UCHAR langFileName[MAX_PATH];
|
||||
|
||||
XP_U16 phonComboId;
|
||||
|
||||
XP_Bool userCancelled;
|
||||
//XP_Bool doGlobalPrefs; /* state of the radio */
|
||||
XP_Bool isNewGame;
|
||||
XP_Bool colorsChanged;
|
||||
XP_Bool langChanged;
|
||||
} CePrefsDlgState;
|
||||
|
||||
/* Stuff the strings for phonies. Why can't I put this in the resource?
|
||||
*/
|
||||
static void
|
||||
stuffPhoniesList( CePrefsDlgState* state )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
XP_U16 ii;
|
||||
XP_U16 resIDs[] = { IDS_IGNORE_L,IDS_WARN_L, IDS_DISALLOW_L };
|
||||
|
||||
for ( ii = 0; ii < VSIZE(resIDs); ++ii ) {
|
||||
const wchar_t* str = ceGetResStringL( globals, resIDs[ii] );
|
||||
SendDlgItemMessage( hDlg, state->phonComboId,
|
||||
ADDSTRING(globals), ii, (long)str );
|
||||
}
|
||||
} /* stuffPhoniesList */
|
||||
|
||||
static void
|
||||
turnOnOff( HWND hDlg, XP_U16* idList, XP_U16 idCount,
|
||||
XP_Bool turnOn )
|
||||
{
|
||||
XP_U16 i;
|
||||
for ( i = 0; i < idCount; ++i ) {
|
||||
ceShowOrHide( hDlg, *idList++, turnOn );
|
||||
}
|
||||
} /* turnOff */
|
||||
|
||||
static void
|
||||
setTimerCtls( HWND hDlg, XP_Bool checked )
|
||||
{
|
||||
ceShowOrHide( hDlg, TIMER_EDIT, checked );
|
||||
|
||||
SendDlgItemMessage( hDlg, TIMER_CHECK, BM_SETCHECK,
|
||||
checked? BST_CHECKED:BST_UNCHECKED, 0 );
|
||||
} /* setTimerCtls */
|
||||
|
||||
static void
|
||||
adjustForChoice( CePrefsDlgState* state )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
XP_U16 goesWithGlobal[] = {IDC_CHECKCOLORPLAYED, IDC_LEFTYCHECK,
|
||||
IDC_CHECKSHOWCURSOR, IDC_CHECKROBOTSCORES,
|
||||
IDC_SKIPCONFIRM, IDC_HIDETILEVALUES,
|
||||
IDC_PREFCOLORS, IDC_PREFLOCALE
|
||||
#ifdef ALLOW_CHOOSE_FONTS
|
||||
,IDC_PREFFONTS
|
||||
#endif
|
||||
|
||||
};
|
||||
XP_U16 goesWithLocal[] = {IDC_CHECKSMARTROBOT, IDC_CHECKHINTSOK,
|
||||
TIMER_CHECK, TIMER_EDIT, PHONIES_LABEL,
|
||||
PHONIES_COMBO, IDC_PHONIESUPDOWN,
|
||||
PHONIES_COMBO_PPC,
|
||||
IDC_PICKTILES
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
,IDC_CHECKHINTSLIMITS
|
||||
#endif
|
||||
};
|
||||
XP_U16 resID;
|
||||
XP_Bool doGlobalPrefs = state->dlgHdr.globals->doGlobalPrefs;
|
||||
|
||||
resID = doGlobalPrefs? IDC_RADIOGLOBAL:IDC_RADIOLOCAL;
|
||||
SendDlgItemMessage( hDlg, resID, BM_SETCHECK, BST_CHECKED, 0L );
|
||||
resID = doGlobalPrefs? IDC_RADIOLOCAL:IDC_RADIOGLOBAL;
|
||||
SendDlgItemMessage( hDlg, resID, BM_SETCHECK, BST_UNCHECKED, 0L );
|
||||
|
||||
if ( doGlobalPrefs ) {
|
||||
turnOnOff( hDlg, goesWithLocal, VSIZE(goesWithLocal), XP_FALSE );
|
||||
turnOnOff( hDlg, goesWithGlobal, VSIZE(goesWithGlobal), XP_TRUE);
|
||||
} else {
|
||||
turnOnOff( hDlg, goesWithGlobal, VSIZE(goesWithGlobal), XP_FALSE );
|
||||
turnOnOff( hDlg, goesWithLocal, VSIZE(goesWithLocal), XP_TRUE);
|
||||
}
|
||||
|
||||
if ( !doGlobalPrefs ) {
|
||||
setTimerCtls( hDlg, ceGetChecked( hDlg, TIMER_CHECK ) );
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
ceShowOrHide( hDlg, IDC_CHECKHINTSLIMITS,
|
||||
ceGetChecked( hDlg, IDC_CHECKHINTSOK) );
|
||||
#endif
|
||||
ceDlgComboShowHide( &state->dlgHdr, PHONIES_COMBO );
|
||||
}
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
if ( IS_SMARTPHONE(state->dlgHdr.globals) ) {
|
||||
SendMessage( hDlg, DM_RESETSCROLL, (WPARAM)FALSE, (LPARAM)TRUE );
|
||||
}
|
||||
#endif
|
||||
} /* adjustForChoice */
|
||||
|
||||
/* Copy global state into a local copy that can be changed without
|
||||
* committing should user cancel.
|
||||
*/
|
||||
void
|
||||
loadStateFromCurPrefs( CEAppGlobals* XP_UNUSED_STANDALONE(globals),
|
||||
const CEAppPrefs* appPrefs,
|
||||
const CurGameInfo* gi, CePrefsPrefs* prefsPrefs )
|
||||
{
|
||||
prefsPrefs->gp.hintsNotAllowed = gi->hintsNotAllowed;
|
||||
prefsPrefs->gp.timerEnabled = gi->timerEnabled;
|
||||
prefsPrefs->gp.gameSeconds = gi->gameSeconds;
|
||||
prefsPrefs->gp.phoniesAction = gi->phoniesAction;
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
prefsPrefs->gp.allowPickTiles = gi->allowPickTiles;
|
||||
#endif
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
prefsPrefs->gp.allowHintRect = gi->allowHintRect;
|
||||
#endif
|
||||
|
||||
XP_MEMCPY( &prefsPrefs->cp, &appPrefs->cp, sizeof(prefsPrefs->cp) );
|
||||
XP_MEMCPY( &prefsPrefs->colors, &appPrefs->colors,
|
||||
sizeof(prefsPrefs->colors) );
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
if ( globals->game.comms != NULL ) {
|
||||
comms_getAddr( globals->game.comms, &prefsPrefs->addrRec );
|
||||
} else {
|
||||
comms_getInitialAddr( &prefsPrefs->addrRec
|
||||
#ifdef XWFEATURE_RELAY
|
||||
,RELAY_NAME_DEFAULT, RELAY_PORT_DEFAULT
|
||||
#endif
|
||||
);
|
||||
}
|
||||
#endif
|
||||
} /* loadStateFromCurPrefs */
|
||||
|
||||
void
|
||||
loadCurPrefsFromState( CEAppGlobals* XP_UNUSED_STANDALONE(globals),
|
||||
CEAppPrefs* appPrefs,
|
||||
CurGameInfo* gi, const CePrefsPrefs* prefsPrefs )
|
||||
{
|
||||
gi->hintsNotAllowed = prefsPrefs->gp.hintsNotAllowed;
|
||||
gi->timerEnabled = prefsPrefs->gp.timerEnabled;
|
||||
gi->gameSeconds = prefsPrefs->gp.gameSeconds;
|
||||
gi->phoniesAction = prefsPrefs->gp.phoniesAction;
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
gi->allowPickTiles = prefsPrefs->gp.allowPickTiles;
|
||||
#endif
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
gi->allowHintRect = prefsPrefs->gp.allowHintRect;
|
||||
#endif
|
||||
|
||||
XP_MEMCPY( &appPrefs->cp, &prefsPrefs->cp, sizeof(appPrefs->cp) );
|
||||
XP_MEMCPY( &appPrefs->colors, &prefsPrefs->colors,
|
||||
sizeof(prefsPrefs->colors) );
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
/* I don't think this'll work... */
|
||||
if ( globals->game.comms != NULL ) {
|
||||
comms_setAddr( globals->game.comms, &prefsPrefs->addrRec );
|
||||
} else {
|
||||
XP_LOGF( "no comms to set addr on!!!" );
|
||||
}
|
||||
#endif
|
||||
} /* loadCurPrefsFromState */
|
||||
|
||||
/* Reflect local state into the controls user will see.
|
||||
*/
|
||||
static void
|
||||
loadControlsFromState( CePrefsDlgState* pState )
|
||||
{
|
||||
HWND hDlg = pState->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = pState->dlgHdr.globals;
|
||||
CePrefsPrefs* prefsPrefs = &pState->prefsPrefs;
|
||||
|
||||
ceSetChecked( hDlg, IDC_CHECKCOLORPLAYED, prefsPrefs->showColors );
|
||||
ceSetChecked( hDlg, IDC_CHECKSMARTROBOT,
|
||||
prefsPrefs->gp.robotSmartness > 0 );
|
||||
ceSetChecked( hDlg, IDC_CHECKHINTSOK, !prefsPrefs->gp.hintsNotAllowed );
|
||||
|
||||
ceSetChecked( hDlg, IDC_CHECKSHOWCURSOR, prefsPrefs->cp.showBoardArrow );
|
||||
ceSetChecked( hDlg, IDC_CHECKROBOTSCORES, prefsPrefs->cp.showRobotScores );
|
||||
ceSetChecked( hDlg, IDC_SKIPCONFIRM, prefsPrefs->cp.skipCommitConfirm );
|
||||
ceSetChecked( hDlg, IDC_HIDETILEVALUES, prefsPrefs->cp.hideTileValues );
|
||||
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
ceSetChecked( hDlg, IDC_PICKTILES, prefsPrefs->gp.allowPickTiles );
|
||||
#endif
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
if ( !IS_SMARTPHONE(globals) ) {
|
||||
ceSetChecked( hDlg, IDC_CHECKHINTSLIMITS, prefsPrefs->gp.allowHintRect );
|
||||
}
|
||||
#endif
|
||||
/* timer */
|
||||
ceSetDlgItemNum( hDlg, TIMER_EDIT, prefsPrefs->gp.gameSeconds / 60 );
|
||||
|
||||
SendDlgItemMessage( hDlg, pState->phonComboId, SETCURSEL(globals),
|
||||
prefsPrefs->gp.phoniesAction, 0L );
|
||||
|
||||
if ( !pState->isNewGame ) {
|
||||
XP_U16 unavail[] = { TIMER_CHECK, TIMER_EDIT, IDC_CHECKHINTSOK
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
,IDC_PICKTILES
|
||||
#endif
|
||||
};
|
||||
XP_U16 i;
|
||||
for ( i = 0; i < VSIZE(unavail); ++i ) {
|
||||
ceEnOrDisable( hDlg, unavail[i], XP_FALSE );
|
||||
}
|
||||
}
|
||||
} /* loadControlsFromState */
|
||||
|
||||
/* Save the new choices into state so caller can do what it wants with
|
||||
* the values.
|
||||
*/
|
||||
static void
|
||||
ceControlsToPrefs( CePrefsDlgState* state )
|
||||
{
|
||||
XP_S16 selIndex;
|
||||
CePrefsPrefs* prefsPrefs = &state->prefsPrefs;
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
|
||||
prefsPrefs->showColors = ceGetChecked( hDlg, IDC_CHECKCOLORPLAYED );
|
||||
prefsPrefs->gp.robotSmartness
|
||||
= ceGetChecked( hDlg, IDC_CHECKSMARTROBOT ) ? 1 : 0;
|
||||
prefsPrefs->gp.hintsNotAllowed = !ceGetChecked( hDlg, IDC_CHECKHINTSOK );
|
||||
|
||||
selIndex = (XP_U16)SendDlgItemMessage( hDlg, state->phonComboId,
|
||||
GETCURSEL(globals),
|
||||
0, 0 );
|
||||
if ( selIndex != LB_ERR ) {
|
||||
prefsPrefs->gp.phoniesAction = (XWPhoniesChoice)selIndex;
|
||||
}
|
||||
|
||||
prefsPrefs->cp.showBoardArrow = ceGetChecked( hDlg, IDC_CHECKSHOWCURSOR );
|
||||
prefsPrefs->cp.showRobotScores = ceGetChecked( hDlg, IDC_CHECKROBOTSCORES );
|
||||
prefsPrefs->cp.skipCommitConfirm = ceGetChecked( hDlg, IDC_SKIPCONFIRM );
|
||||
prefsPrefs->cp.hideTileValues = ceGetChecked( hDlg, IDC_HIDETILEVALUES );
|
||||
prefsPrefs->gp.timerEnabled = ceGetChecked( hDlg, TIMER_CHECK );
|
||||
|
||||
if ( prefsPrefs->gp.timerEnabled ) {
|
||||
XP_U16 minutes;
|
||||
|
||||
minutes = ceGetDlgItemNum( hDlg, TIMER_EDIT );
|
||||
|
||||
prefsPrefs->gp.gameSeconds = minutes * 60;
|
||||
}
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
prefsPrefs->gp.allowPickTiles = ceGetChecked( hDlg, IDC_PICKTILES );
|
||||
#endif
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
if ( !IS_SMARTPHONE(globals) ) {
|
||||
prefsPrefs->gp.allowHintRect = ceGetChecked( hDlg, IDC_CHECKHINTSLIMITS );
|
||||
}
|
||||
#endif
|
||||
} /* ceControlsToPrefs */
|
||||
|
||||
LRESULT CALLBACK
|
||||
PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
XP_U16 id;
|
||||
CePrefsDlgState* pState;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
pState = (CePrefsDlgState*)lParam;
|
||||
|
||||
pState->phonComboId = LB_IF_PPC(pState->dlgHdr.globals,PHONIES_COMBO);
|
||||
|
||||
ceDlgSetup( &pState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||
ceDlgComboShowHide( &pState->dlgHdr, PHONIES_COMBO );
|
||||
|
||||
stuffPhoniesList( pState );
|
||||
|
||||
loadControlsFromState( pState );
|
||||
|
||||
adjustForChoice( pState );
|
||||
return TRUE;
|
||||
|
||||
} else {
|
||||
pState = (CePrefsDlgState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!pState ) {
|
||||
if ( !ceDoDlgHandle( &pState->dlgHdr, message, wParam, lParam ) ) {
|
||||
CEAppGlobals* globals = pState->dlgHdr.globals;
|
||||
XP_Bool timerOn;
|
||||
|
||||
switch (message) {
|
||||
case WM_COMMAND:
|
||||
id = LOWORD(wParam);
|
||||
switch( id ) {
|
||||
|
||||
case IDC_RADIOGLOBAL:
|
||||
case IDC_RADIOLOCAL:
|
||||
globals->doGlobalPrefs = id == IDC_RADIOGLOBAL;
|
||||
adjustForChoice( pState );
|
||||
break;
|
||||
|
||||
case TIMER_CHECK:
|
||||
timerOn = SendDlgItemMessage( hDlg, TIMER_CHECK,
|
||||
BM_GETCHECK, 0, 0 );
|
||||
setTimerCtls( hDlg, timerOn );
|
||||
break;
|
||||
case IDC_PREFCOLORS:
|
||||
pState->colorsChanged =
|
||||
ceDoColorsEdit( hDlg, globals,
|
||||
pState->prefsPrefs.colors );
|
||||
break;
|
||||
case IDC_PREFLOCALE: {
|
||||
XP_UCHAR newFile[MAX_PATH];
|
||||
if ( ceChooseResFile( hDlg, globals,
|
||||
pState->langFileName,
|
||||
newFile, VSIZE(newFile)) ) {
|
||||
pState->langChanged = XP_TRUE;
|
||||
XP_STRNCPY( pState->langFileName, newFile,
|
||||
VSIZE(pState->langFileName) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef ALLOW_CHOOSE_FONTS
|
||||
case IDC_PREFFONTS:
|
||||
ceShowFonts( hDlg, globals );
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
case IDC_CHECKHINTSOK:
|
||||
timerOn = SendDlgItemMessage( hDlg, IDC_CHECKHINTSOK,
|
||||
BM_GETCHECK, 0, 0 );
|
||||
ceShowOrHide( hDlg, IDC_CHECKHINTSLIMITS, timerOn );
|
||||
break;
|
||||
case IDC_CHECKHINTSLIMITS:
|
||||
if ( IS_SMARTPHONE(globals) ) {
|
||||
ceMessageBoxChar( globals,
|
||||
ceGetResString( globals,
|
||||
IDS_NEED_TOUCH ),
|
||||
ceGetResStringL( globals,
|
||||
IDS_FYI_L ),
|
||||
MB_OK | MB_ICONHAND, SAB_NONE );
|
||||
ceSetChecked( hDlg, IDC_CHECKHINTSLIMITS, XP_FALSE );
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IDOK:
|
||||
ceControlsToPrefs( pState );
|
||||
case IDCANCEL:
|
||||
EndDialog( hDlg, id );
|
||||
pState->userCancelled = id == IDCANCEL;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} /* PrefsDlg */
|
||||
|
||||
/* Using state in prefsPrefs, and initing and then storing dialog state in
|
||||
state, put up the dialog and return whether it was cancelled.
|
||||
*/
|
||||
XP_Bool
|
||||
WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals, CePrefsPrefs* prefsPrefs,
|
||||
XP_Bool isNewGame, XP_Bool* colorsChanged, XP_Bool* langChanged )
|
||||
{
|
||||
CePrefsDlgState state;
|
||||
XP_Bool result;
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
|
||||
state.dlgHdr.globals = globals;
|
||||
state.isNewGame = isNewGame;
|
||||
if ( !!globals->langFileName ) {
|
||||
XP_STRNCPY( state.langFileName, globals->langFileName,
|
||||
VSIZE(state.langFileName) );
|
||||
}
|
||||
XP_MEMCPY( &state.prefsPrefs, prefsPrefs, sizeof( state.prefsPrefs ) );
|
||||
|
||||
DialogBoxParam( globals->locInst, (LPCTSTR)IDD_OPTIONSDLG, hDlg,
|
||||
(DLGPROC)PrefsDlg, (long)&state );
|
||||
|
||||
result = !state.userCancelled;
|
||||
|
||||
if ( result ) {
|
||||
XP_MEMCPY( prefsPrefs, &state.prefsPrefs, sizeof( *prefsPrefs ) );
|
||||
*colorsChanged = state.colorsChanged;
|
||||
*langChanged = state.langChanged;
|
||||
|
||||
replaceStringIfDifferent( globals->mpool, &globals->langFileName,
|
||||
state.langFileName );
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* WrapPrefsDialog */
|
|
@ -1,68 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002-2007 by Eric House (xwords@eehouse.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 _CEPREFS_H_
|
||||
#define _CEPREFS_H_
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
|
||||
typedef struct CeGamePrefs {
|
||||
XP_U16 gameSeconds;
|
||||
XP_Bool hintsNotAllowed;
|
||||
XP_U8 robotSmartness;
|
||||
XP_Bool timerEnabled;
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
XP_Bool allowPickTiles;
|
||||
#endif
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
XP_Bool allowHintRect;
|
||||
#endif
|
||||
|
||||
XWPhoniesChoice phoniesAction;
|
||||
/* phonies something */
|
||||
} CeGamePrefs;
|
||||
|
||||
typedef struct CePrefsPrefs {
|
||||
/* per-game */
|
||||
CeGamePrefs gp;
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
CommsAddrRec addrRec;
|
||||
#endif
|
||||
|
||||
/* global */
|
||||
CommonPrefs cp;
|
||||
XP_Bool showColors;
|
||||
|
||||
COLORREF colors[CE_NUM_EDITABLE_COLORS];
|
||||
} CePrefsPrefs;
|
||||
|
||||
XP_Bool WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals,
|
||||
CePrefsPrefs* prefsPrefs, XP_Bool isNewGame,
|
||||
XP_Bool* colorsChanged, XP_Bool* langChanged );
|
||||
void loadStateFromCurPrefs( CEAppGlobals* globals, const CEAppPrefs* appPrefs,
|
||||
const CurGameInfo* gi, CePrefsPrefs* prefsPrefs );
|
||||
void loadCurPrefsFromState( CEAppGlobals* globals, CEAppPrefs* appPrefs,
|
||||
CurGameInfo* gi, const CePrefsPrefs* prefsPrefs );
|
||||
|
||||
LRESULT CALLBACK PrefsDlg(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
#endif
|
|
@ -1,407 +0,0 @@
|
|||
/* -*- compile-command: "make -j3 TARGET_OS=wince DEBUG=TRUE"; -*- */
|
||||
/*
|
||||
* Copyright 2009 by Eric House (xwords@eehouse.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 "ceresstr.h"
|
||||
#include "ceutil.h"
|
||||
#include "cedebug.h"
|
||||
#include "strutils.h"
|
||||
|
||||
static XP_U16 getDLLVersion( HINSTANCE hinst );
|
||||
|
||||
|
||||
HINSTANCE
|
||||
ceLoadResFile( const XP_UCHAR* file )
|
||||
{
|
||||
HINSTANCE hinst = NULL;
|
||||
wchar_t widebuf[256];
|
||||
(void)MultiByteToWideChar( CP_ACP, 0, file, -1, widebuf, VSIZE(widebuf) );
|
||||
hinst = LoadLibrary( widebuf );
|
||||
|
||||
if ( CUR_DLL_VERSION != getDLLVersion( hinst ) ) {
|
||||
FreeLibrary( hinst );
|
||||
hinst = NULL;
|
||||
}
|
||||
|
||||
return hinst;
|
||||
} /* ceLoadResFile */
|
||||
|
||||
void
|
||||
ceCloseResFile( HINSTANCE inst )
|
||||
{
|
||||
XP_ASSERT( !!inst );
|
||||
FreeLibrary( inst );
|
||||
}
|
||||
|
||||
#ifdef LOADSTRING_BROKEN
|
||||
typedef struct _ResStrEntry {
|
||||
union {
|
||||
XP_UCHAR nstr[1];
|
||||
wchar_t wstr[1];
|
||||
} u;
|
||||
} ResStrEntry;
|
||||
|
||||
typedef struct _ResStrStorage {
|
||||
ResStrEntry* entries[CE_LAST_RES_ID - CE_FIRST_RES_ID + 1];
|
||||
#ifdef DEBUG
|
||||
XP_U16 nUsed;
|
||||
#endif
|
||||
} ResStrStorage;
|
||||
|
||||
static const ResStrEntry*
|
||||
getEntry( CEAppGlobals* globals, XP_U16 resID, XP_Bool isWide )
|
||||
{
|
||||
ResStrStorage* storage = (ResStrStorage*)globals->resStrStorage;
|
||||
ResStrEntry* entry;
|
||||
XP_U16 index;
|
||||
|
||||
XP_ASSERT( resID >= CE_FIRST_RES_ID && resID <= CE_LAST_RES_ID );
|
||||
index = CE_LAST_RES_ID - resID;
|
||||
XP_ASSERT( index < VSIZE(storage->entries) );
|
||||
|
||||
if ( !storage ) {
|
||||
XP_ASSERT( !globals->exiting );
|
||||
storage = XP_MALLOC( globals->mpool, sizeof( *storage ) );
|
||||
XP_MEMSET( storage, 0, sizeof(*storage) );
|
||||
globals->resStrStorage = storage;
|
||||
}
|
||||
|
||||
entry = storage->entries[index];
|
||||
if ( !entry ) {
|
||||
wchar_t wbuf[265];
|
||||
XP_U16 len;
|
||||
LoadString( globals->locInst, resID, wbuf, VSIZE(wbuf) );
|
||||
if ( isWide ) {
|
||||
len = wcslen( wbuf );
|
||||
entry = (ResStrEntry*)XP_MALLOC( globals->mpool,
|
||||
(len*sizeof(wchar_t))
|
||||
+ sizeof(*entry) );
|
||||
wcscpy( entry->u.wstr, wbuf );
|
||||
} else {
|
||||
XP_UCHAR nbuf[265];
|
||||
(void)WideCharToMultiByte( CP_UTF8, 0, wbuf, -1,
|
||||
nbuf, VSIZE(nbuf), NULL, NULL );
|
||||
len = XP_STRLEN( nbuf );
|
||||
entry = (ResStrEntry*)XP_MALLOC( globals->mpool,
|
||||
len + 1 + sizeof(*entry) );
|
||||
XP_STRNCPY( entry->u.nstr, nbuf, len + 1 );
|
||||
}
|
||||
|
||||
storage->entries[index] = entry;
|
||||
#ifdef DEBUG
|
||||
++storage->nUsed;
|
||||
#endif
|
||||
}
|
||||
|
||||
return entry;
|
||||
} /* getEntry */
|
||||
#endif
|
||||
|
||||
const XP_UCHAR*
|
||||
ceGetResString( CEAppGlobals* globals, XP_U16 resID )
|
||||
{
|
||||
#ifdef LOADSTRING_BROKEN
|
||||
const ResStrEntry* entry = getEntry( globals, resID, XP_FALSE );
|
||||
return entry->u.nstr;
|
||||
#else
|
||||
/* Docs say that you can call LoadString with 0 as the length and it'll
|
||||
return a read-only ptr to the text within the resource, but I'm getting
|
||||
a ptr to wide chars back the resource text being multibyte. I swear
|
||||
I've seen it work, though, so might be a res file formatting thing or a
|
||||
param to the res compiler. Need to investigate. Until I do, the above
|
||||
caches local multibyte copies of the resources so the API can stay the
|
||||
same. */
|
||||
const XP_UCHAR* str = NULL;
|
||||
LoadString( globals->locInst, resID, (LPSTR)&str, 0 );
|
||||
return str;
|
||||
#endif
|
||||
}
|
||||
|
||||
const wchar_t*
|
||||
ceGetResStringL( CEAppGlobals* globals, XP_U16 resID )
|
||||
{
|
||||
#ifdef LOADSTRING_BROKEN
|
||||
const ResStrEntry* entry = getEntry( globals, resID, XP_TRUE );
|
||||
return entry->u.wstr;
|
||||
#else
|
||||
/* Docs say that you can call LoadString with 0 as the length and it'll
|
||||
return a read-only ptr to the text within the resource, but I'm getting
|
||||
a ptr to wide chars back the resource text being multibyte. I swear
|
||||
I've seen it work, though, so might be a res file formatting thing or a
|
||||
param to the res compiler. Need to investigate. Until I do, the above
|
||||
caches local multibyte copies of the resources so the API can stay the
|
||||
same. */
|
||||
const XP_UCHAR* str = NULL;
|
||||
LoadString( globals->locInst, resID, (LPSTR)&str, 0 );
|
||||
return str;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LOADSTRING_BROKEN
|
||||
void
|
||||
ceFreeResStrings( CEAppGlobals* globals )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
XP_U16 nUsed = 0;
|
||||
#endif
|
||||
ResStrStorage* storage = (ResStrStorage*)globals->resStrStorage;
|
||||
if ( !!storage ) {
|
||||
XP_U16 ii;
|
||||
for ( ii = 0; ii < VSIZE(storage->entries); ++ii ) {
|
||||
ResStrEntry* entry = storage->entries[ii];
|
||||
if ( !!entry ) {
|
||||
XP_FREE( globals->mpool, entry );
|
||||
#ifdef DEBUG
|
||||
++nUsed;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
XP_ASSERT( nUsed == storage->nUsed );
|
||||
XP_FREE( globals->mpool, storage );
|
||||
globals->resStrStorage = NULL;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
XP_LOGF( "%s: %d of %d strings loaded and used", __func__, nUsed,
|
||||
VSIZE(storage->entries) );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct _DllSelState {
|
||||
CeDlgHdr dlgHdr;
|
||||
wchar_t wbuf[MAX_PATH];
|
||||
const wchar_t* curFile;
|
||||
|
||||
wchar_t* names[8];
|
||||
wchar_t* files[8];
|
||||
XP_U16 nItems;
|
||||
XP_U16 initialSel;
|
||||
|
||||
XP_U16 dllListID;
|
||||
XP_Bool inited;
|
||||
XP_Bool cancelled;
|
||||
} DllSelState;
|
||||
|
||||
static void
|
||||
copyWideStr( CEAppGlobals* XP_UNUSED_DBG(globals), const wchar_t* str,
|
||||
wchar_t** loc )
|
||||
{
|
||||
XP_U16 len = 1 + wcslen( str );
|
||||
*loc = XP_MALLOC( globals->mpool, len * sizeof(**loc) );
|
||||
wcscpy( *loc, str );
|
||||
}
|
||||
|
||||
static XP_U16
|
||||
getDLLVersion( HINSTANCE hinst )
|
||||
{
|
||||
XP_U16 version = 0; /* illegal value */
|
||||
HRSRC rsrcH = FindResource( hinst, MAKEINTRESOURCE(ID_DLLVERS_RES),
|
||||
TEXT("DLLV") );
|
||||
if ( !!rsrcH ) {
|
||||
HGLOBAL globH = LoadResource( hinst, rsrcH );
|
||||
version = *(XP_U16*)globH;
|
||||
DeleteObject( globH );
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/* Iterate through .dll files listing the name of any that has one. Pair with
|
||||
* file from which it came since that's what we'll return.
|
||||
*/
|
||||
static void
|
||||
listDlls( DllSelState* state )
|
||||
{
|
||||
HANDLE fileH;
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
WIN32_FIND_DATA data;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
XP_U16 nItems = 0;
|
||||
XP_S16 selIndex = 0; /* default to built-in */
|
||||
wchar_t name[64];
|
||||
|
||||
LoadString( globals->hInst, IDS_LANGUAGE_NAME, name, VSIZE(name) );
|
||||
copyWideStr( globals, name, &state->names[nItems++] );
|
||||
(void)SendDlgItemMessage( hDlg, state->dllListID, ADDSTRING(globals),
|
||||
0, (LPARAM)name );
|
||||
|
||||
wchar_t path[MAX_PATH];
|
||||
ceGetExeDir( path, VSIZE(path) );
|
||||
wcscat( path, L"\\xwords4*.dll" );
|
||||
|
||||
XP_MEMSET( &data, 0, sizeof(data) );
|
||||
fileH = FindFirstFile( path, &data );
|
||||
while ( fileH != INVALID_HANDLE_VALUE ) {
|
||||
|
||||
HINSTANCE hinst = LoadLibrary( data.cFileName );
|
||||
if ( !!hinst ) {
|
||||
if ( CUR_DLL_VERSION != getDLLVersion( hinst ) ) {
|
||||
/* do nothing; wrong version (or just not our .dll) */
|
||||
} else if ( LoadString( hinst, IDS_LANGUAGE_NAME,
|
||||
name, VSIZE(name) ) ) {
|
||||
(void)SendDlgItemMessage( hDlg, state->dllListID,
|
||||
ADDSTRING(globals),
|
||||
0, (LPARAM)name );
|
||||
copyWideStr( globals, name, &state->names[nItems] );
|
||||
copyWideStr( globals, data.cFileName, &state->files[nItems] );
|
||||
|
||||
if ( !!state->curFile ) {
|
||||
if ( !wcscmp( data.cFileName, state->curFile ) ) {
|
||||
selIndex = nItems;
|
||||
}
|
||||
}
|
||||
|
||||
++nItems;
|
||||
} else {
|
||||
XP_LOGF( "IDS_LANGUAGE_NAME not found in %ls",
|
||||
data.cFileName );
|
||||
}
|
||||
FreeLibrary( hinst );
|
||||
} else {
|
||||
logLastError("LoadLibrary");
|
||||
XP_LOGF( "Unable to open" );
|
||||
}
|
||||
|
||||
if ( nItems >= VSIZE(state->names) ) {
|
||||
break;
|
||||
} else if ( !FindNextFile( fileH, &data ) ) {
|
||||
XP_ASSERT( GetLastError() == ERROR_NO_MORE_FILES );
|
||||
break;
|
||||
}
|
||||
}
|
||||
SendDlgItemMessage( hDlg, state->dllListID, SETCURSEL(globals),
|
||||
selIndex, 0L );
|
||||
|
||||
state->nItems = nItems;
|
||||
state->initialSel = selIndex;
|
||||
} /* listDlls */
|
||||
|
||||
static void
|
||||
unlistDlls( DllSelState* state )
|
||||
{
|
||||
XP_U16 ii;
|
||||
#ifdef DEBUG
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
#endif
|
||||
for ( ii = 0; ii < state->nItems; ++ii ) {
|
||||
XP_ASSERT( ii == 0 || !!state->files[ii] );
|
||||
if ( ii > 0 ) {
|
||||
XP_FREE( globals->mpool, state->files[ii] );
|
||||
}
|
||||
XP_FREE( globals->mpool, state->names[ii] );
|
||||
}
|
||||
}
|
||||
|
||||
static XP_Bool
|
||||
getSelText( DllSelState* state )
|
||||
{
|
||||
XP_Bool gotIt = XP_FALSE;
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
|
||||
XP_S16 sel = SendDlgItemMessage( hDlg, state->dllListID,
|
||||
GETCURSEL(globals), 0, 0 );
|
||||
|
||||
if ( sel >= 0 && sel != state->initialSel ) {
|
||||
gotIt = XP_TRUE;
|
||||
if ( sel > 0 ) {
|
||||
wcscpy( state->wbuf, state->files[sel] );
|
||||
}
|
||||
}
|
||||
return gotIt;
|
||||
} /* getSelText */
|
||||
|
||||
LRESULT CALLBACK
|
||||
DllSelDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
DllSelState* state;
|
||||
BOOL result = FALSE;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
|
||||
state = (DllSelState*)lParam;
|
||||
state->cancelled = XP_TRUE;
|
||||
|
||||
state->dllListID = LB_IF_PPC( state->dlgHdr.globals, LOCALES_COMBO );
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||
|
||||
ceDlgComboShowHide( &state->dlgHdr, LOCALES_COMBO );
|
||||
|
||||
result = TRUE;
|
||||
} else {
|
||||
state = (DllSelState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!state ) {
|
||||
if ( !state->inited ) {
|
||||
state->inited = XP_TRUE;
|
||||
listDlls( state );
|
||||
}
|
||||
|
||||
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||
result = TRUE;
|
||||
} else if ( (WM_COMMAND == message)
|
||||
&& (BN_CLICKED == HIWORD(wParam)) ) {
|
||||
switch( LOWORD(wParam) ) {
|
||||
case IDOK:
|
||||
state->cancelled = !getSelText( state );
|
||||
/* fallthrough */
|
||||
case IDCANCEL:
|
||||
unlistDlls( state );
|
||||
EndDialog( hDlg, LOWORD(wParam) );
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* DllSelDlg */
|
||||
|
||||
/* ceChooseResFile: List all the available .rc files and return if user
|
||||
* chooses one different from the one passed in.
|
||||
*/
|
||||
XP_Bool
|
||||
ceChooseResFile( HWND hwnd, CEAppGlobals* globals, const XP_UCHAR* curFileName,
|
||||
XP_UCHAR* buf, XP_U16 bufLen )
|
||||
{
|
||||
DllSelState state;
|
||||
wchar_t wCurFile[MAX_PATH];
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
|
||||
state.dlgHdr.globals = globals;
|
||||
|
||||
if ( !!curFileName ) {
|
||||
(void)MultiByteToWideChar( CP_ACP, 0, curFileName, -1,
|
||||
wCurFile, VSIZE(wCurFile) );
|
||||
state.curFile = wCurFile;
|
||||
}
|
||||
|
||||
(void)DialogBoxParam( globals->locInst, (LPCTSTR)IDD_LOCALESDLG,
|
||||
hwnd, (DLGPROC)DllSelDlg, (long)&state );
|
||||
|
||||
if ( !state.cancelled ) {
|
||||
(void)WideCharToMultiByte( CP_ACP, 0, state.wbuf, -1,
|
||||
buf, bufLen, NULL, NULL );
|
||||
}
|
||||
|
||||
LOG_RETURNF( "%s", buf );
|
||||
return !state.cancelled;
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/* -*- compile-command: ""; -*- */
|
||||
/*
|
||||
* Copyright 2009 by Eric House (xwords@eehouse.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 _CERESSTR_H_
|
||||
#define _CERESSTR_H_
|
||||
|
||||
#include "cemain.h"
|
||||
|
||||
HINSTANCE ceLoadResFile( const XP_UCHAR* file );
|
||||
void ceCloseResFile( HINSTANCE inst );
|
||||
XP_Bool ceChooseResFile( HWND hwnd, CEAppGlobals* globals,
|
||||
const XP_UCHAR* curFileName,
|
||||
XP_UCHAR* buf, XP_U16 bufLen );
|
||||
|
||||
const XP_UCHAR* ceGetResString( CEAppGlobals* globals, XP_U16 resID );
|
||||
const wchar_t* ceGetResStringL( CEAppGlobals* globals, XP_U16 resID );
|
||||
|
||||
# ifdef LOADSTRING_BROKEN
|
||||
void ceFreeResStrings( CEAppGlobals* globals );
|
||||
# else
|
||||
# define ceFreeResStrings(g)
|
||||
# endif
|
||||
|
||||
#endif
|
|
@ -1,41 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2009 by Eric House (xwords@eehouse.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.
|
||||
*/
|
||||
|
||||
#ifdef XWFEATURE_SMS
|
||||
|
||||
#include "cesms.h"
|
||||
|
||||
XP_S16
|
||||
ce_sms_send( CEAppGlobals* XP_UNUSED(globals), const XP_U8* XP_UNUSED(buf),
|
||||
XP_U16 len, const CommsAddrRec* addrp )
|
||||
{
|
||||
XP_LOGF( "%s: got %d bytes to send to port %d at %s but don't know how.",
|
||||
__func__, len, addrp->u.sms.port, addrp->u.sms.phone );
|
||||
|
||||
/* Will use SmsOpen, SmsSend, etc, and WaitForSingleObject. But it
|
||||
appears that SMS APIs are only usable by signed apps and that users
|
||||
can't override that restriction in some cases, so SMS is not a
|
||||
priority until I can confirm otherwise or find a way for open-source
|
||||
apps to be signed.
|
||||
*/
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,28 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2009 by Eric House (xwords@eehouse.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 _CESMS_H_
|
||||
#define _CESMS_H_
|
||||
|
||||
#include "cemain.h"
|
||||
|
||||
XP_S16 ce_sms_send( CEAppGlobals* globals, const XP_U8* buf, XP_U16 len,
|
||||
const CommsAddrRec* addrp );
|
||||
|
||||
#endif
|
|
@ -1,684 +0,0 @@
|
|||
/* -*- compile-command: "make -j2 TARGET_OS=win32 DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2005-2009 by Eric House (xwords@eehouse.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 XWFEATURE_STANDALONE_ONLY
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bufqueue.h"
|
||||
|
||||
#include "cesockwr.h"
|
||||
#include "cemain.h"
|
||||
#include "cedebug.h"
|
||||
#include "debhacks.h"
|
||||
#include "ceconnmg.h"
|
||||
|
||||
|
||||
/* This object owns all network activity: sending and receiving packets. It
|
||||
maintains two threads, one to send and the other to listen. Incoming
|
||||
packets are passed out via a proc passed into the "constructor". Outgoing
|
||||
packets are passed in directly. Uses TCP, and the relay framing protocol
|
||||
wherein each packet is proceeded by its length in two bytes, network byte
|
||||
order.
|
||||
*/
|
||||
|
||||
#define MAX_QUEUE_SIZE 6
|
||||
|
||||
struct CeSocketWrapper {
|
||||
HWND hWnd;
|
||||
DataRecvProc dataProc;
|
||||
StateChangeProc stateProc;
|
||||
#if defined _WIN32_WCE
|
||||
# if ! defined CEGCC_DOES_CONNMGR
|
||||
const CMProcs* cmProcs;
|
||||
# endif
|
||||
HANDLE connMgrHandle;
|
||||
#endif
|
||||
void* closure;
|
||||
|
||||
union {
|
||||
HOSTENT hent;
|
||||
XP_U8 hostNameBuf[MAXGETHOSTSTRUCT];
|
||||
} hostNameUnion;
|
||||
HANDLE getHostTask;
|
||||
|
||||
/* PENDING rewrite this as one sliding buffer */
|
||||
/* Outgoing queue */
|
||||
XP_U8 bufOut[512];
|
||||
BufQueue queueOut;
|
||||
|
||||
/* Incoming */
|
||||
char in_buf[512]; /* char is what WSARecv wants */
|
||||
XP_U16 in_offset;
|
||||
|
||||
CommsAddrRec addrRec;
|
||||
|
||||
SOCKET socket;
|
||||
CeConnState connState;
|
||||
|
||||
#ifdef DEBUG
|
||||
XP_U16 nSent;
|
||||
#endif
|
||||
|
||||
MPSLOT
|
||||
};
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# ifdef CEGCC_DOES_CONNMGR
|
||||
# define CMCALL(proc) proc
|
||||
# else
|
||||
# define CMCALL(proc) (*self->cmProcs->proc)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char*
|
||||
ConnState2Str( CeConnState connState )
|
||||
{
|
||||
#define CASESTR(s) case (s): return #s
|
||||
switch( connState ) {
|
||||
CASESTR( CE_IPST_START );
|
||||
#ifdef _WIN32_WCE
|
||||
CASESTR( CE_IPST_OPENING_NETWORK );
|
||||
CASESTR( CE_IPST_NETWORK_OPENED );
|
||||
#endif
|
||||
CASESTR( CE_IPST_RESOLVINGHOST );
|
||||
CASESTR( CE_IPST_HOSTRESOLVED );
|
||||
CASESTR( CE_IPST_CONNECTING );
|
||||
CASESTR( CE_IPST_CONNECTED );
|
||||
}
|
||||
#undef CASESTR
|
||||
return "<unknown>";
|
||||
}
|
||||
#else
|
||||
# define ConnState2Str(s)
|
||||
#endif
|
||||
|
||||
/* Forward decls */
|
||||
static void getHostAddr( CeSocketWrapper* self );
|
||||
static XP_Bool connectIfNot( CeSocketWrapper* self );
|
||||
|
||||
static XP_Bool
|
||||
sendAll( CeSocketWrapper* self, const XP_U8* buf, XP_U16 len )
|
||||
{
|
||||
for ( ; ; ) {
|
||||
int nSent = send( self->socket, (char*)buf, len, 0 ); /* flags? */
|
||||
if ( nSent == SOCKET_ERROR ) {
|
||||
return XP_FALSE;
|
||||
} else if ( nSent == len ) {
|
||||
XP_LOGF( "sent %d bytes", nSent );
|
||||
return XP_TRUE;
|
||||
} else {
|
||||
XP_LOGF( "sent %d bytes", nSent );
|
||||
XP_ASSERT( nSent < len );
|
||||
len -= nSent;
|
||||
buf += nSent;
|
||||
}
|
||||
}
|
||||
} /* sendAll */
|
||||
|
||||
static XP_Bool
|
||||
sendLenAndData( CeSocketWrapper* self, const XP_U8* packet, XP_U16 len )
|
||||
{
|
||||
XP_LOGF( "%s(len=%d)", __func__, len );
|
||||
XP_Bool success;
|
||||
XP_U16 lenData;
|
||||
XP_ASSERT( self->socket != -1 );
|
||||
|
||||
lenData = XP_HTONS( len );
|
||||
success = sendAll( self, (XP_U8*)&lenData, sizeof(lenData) )
|
||||
&& sendAll( self, packet, len );
|
||||
LOG_RETURNF( "%s", success?"success":"failed" );
|
||||
return success;
|
||||
} /* sendLenAndData */
|
||||
|
||||
static void
|
||||
send_packet_if( CeSocketWrapper* self )
|
||||
{
|
||||
const XP_U8* packet;
|
||||
XP_U16 len;
|
||||
if ( self->socket == -1 ) {
|
||||
XP_LOGF( "%s: have no socket", __func__ );
|
||||
} else if ( bqGet( &self->queueOut, &packet, &len ) ) {
|
||||
if ( sendLenAndData( self, packet, len ) ) {
|
||||
/* successful send. Remove our copy */
|
||||
bqRemoveOne( &self->queueOut );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
stateChanged( CeSocketWrapper* self, CeConnState newState )
|
||||
{
|
||||
CeConnState curState = self->connState;
|
||||
self->connState = newState;
|
||||
|
||||
XP_LOGF( "%s: %s -> %s", __func__, ConnState2Str( curState ),
|
||||
ConnState2Str( newState ) );
|
||||
|
||||
(*self->stateProc)( self->closure, curState, newState );
|
||||
|
||||
switch( newState ) {
|
||||
case CE_IPST_START:
|
||||
break;
|
||||
#ifdef _WIN32_WCE
|
||||
case CE_IPST_OPENING_NETWORK:
|
||||
break;
|
||||
case CE_IPST_NETWORK_OPENED:
|
||||
getHostAddr( self );
|
||||
break;
|
||||
#endif
|
||||
case CE_IPST_RESOLVINGHOST:
|
||||
break;
|
||||
case CE_IPST_HOSTRESOLVED:
|
||||
connectIfNot( self );
|
||||
break;
|
||||
case CE_IPST_CONNECTING:
|
||||
break;
|
||||
case CE_IPST_CONNECTED:
|
||||
send_packet_if( self );
|
||||
break;
|
||||
}
|
||||
} /* stateChanged */
|
||||
|
||||
static XP_Bool
|
||||
connectSocket( CeSocketWrapper* self )
|
||||
{
|
||||
SOCKET sock;
|
||||
|
||||
if ( self->addrRec.u.ip_relay.ipAddr != 0 ) {
|
||||
sock = WSASocket( AF_INET, SOCK_STREAM, IPPROTO_IP,
|
||||
NULL, 0, WSA_FLAG_OVERLAPPED );
|
||||
XP_LOGF( "got socket %d", sock );
|
||||
|
||||
if ( sock != INVALID_SOCKET ) {
|
||||
struct sockaddr_in name = {0};
|
||||
|
||||
/* Put socket in non-blocking mode */
|
||||
if ( 0 != WSAAsyncSelect( sock, self->hWnd,
|
||||
XWWM_SOCKET_EVT,
|
||||
FD_READ | FD_WRITE | FD_CONNECT
|
||||
| FD_CLOSE ) ) {
|
||||
XP_WARNF( "WSAAsyncSelect failed" );
|
||||
}
|
||||
|
||||
name.sin_family = AF_INET;
|
||||
name.sin_port = XP_HTONS( self->addrRec.u.ip_relay.port );
|
||||
name.sin_addr.S_un.S_addr = XP_HTONL(self->addrRec.u.ip_relay.ipAddr);
|
||||
|
||||
XP_LOGF( "%s: calling WSAConnect: port=%d; host=%lx", __func__,
|
||||
self->addrRec.u.ip_relay.port,
|
||||
self->addrRec.u.ip_relay.ipAddr );
|
||||
|
||||
if ( SOCKET_ERROR != WSAConnect( sock, (struct sockaddr *)&name,
|
||||
sizeof(name), NULL, NULL,
|
||||
NULL, NULL ) ) {
|
||||
self->socket = sock;
|
||||
stateChanged( self, CE_IPST_CONNECTING );
|
||||
} else if ( WSAEWOULDBLOCK == WSAGetLastError() ) {
|
||||
stateChanged( self, CE_IPST_CONNECTING );
|
||||
} else {
|
||||
XP_LOGF( "%s:%d: WSAGetLastError=>%d", __func__, __LINE__,
|
||||
WSAGetLastError() );
|
||||
}
|
||||
} else {
|
||||
XP_LOGF( "%s:%d: WSAGetLastError=>%d", __func__, __LINE__,
|
||||
WSAGetLastError() );
|
||||
}
|
||||
}
|
||||
|
||||
LOG_RETURNF( "%d", self->connState == CE_IPST_CONNECTED );
|
||||
return self->connState == CE_IPST_CONNECTED;
|
||||
} /* connectSocket */
|
||||
|
||||
static XP_Bool
|
||||
connectIfNot( CeSocketWrapper* self )
|
||||
{
|
||||
LOG_FUNC();
|
||||
XP_Bool success = self->connState == CE_IPST_CONNECTED;
|
||||
|
||||
if ( !success && CE_IPST_HOSTRESOLVED == self->connState ) {
|
||||
success = connectSocket( self );
|
||||
}
|
||||
return success;
|
||||
} /* connectIfNot */
|
||||
|
||||
static void
|
||||
closeConnection( CeSocketWrapper* self )
|
||||
{
|
||||
if ( self->connState >= CE_IPST_CONNECTED ) {
|
||||
XP_ASSERT( self->socket != -1 );
|
||||
if ( self->socket != -1 ) {
|
||||
closesocket( self->socket );
|
||||
self->socket = -1;
|
||||
}
|
||||
}
|
||||
|
||||
bqRemoveAll( &self->queueOut );
|
||||
|
||||
XP_ASSERT( self->socket == -1 );
|
||||
stateChanged( self, CE_IPST_START );
|
||||
} /* closeConnection */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
static void
|
||||
openNetwork( CeSocketWrapper* self )
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
if ( !!self->connMgrHandle ) { /* already have a connection? */
|
||||
DWORD status;
|
||||
res = CMCALL(ConnMgrConnectionStatus)( self->connMgrHandle, &status );
|
||||
if ( SUCCEEDED(res) && status == CONNMGR_STATUS_CONNECTED ) {
|
||||
stateChanged( self, CE_IPST_NETWORK_OPENED );
|
||||
} else {
|
||||
CMCALL(ConnMgrReleaseConnection)( self->connMgrHandle, 1 );
|
||||
self->connMgrHandle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !self->connMgrHandle ) {
|
||||
CONNMGR_CONNECTIONINFO cmi;
|
||||
HANDLE hand;
|
||||
XP_MEMSET( &cmi, 0, sizeof(cmi) );
|
||||
|
||||
res = CMCALL(ConnMgrMapURL)( L"http://google.com",
|
||||
&cmi.guidDestNet, NULL );
|
||||
if ( SUCCEEDED(res) ) {
|
||||
cmi.cbSize = sizeof(cmi);
|
||||
cmi.bExclusive = FALSE;
|
||||
cmi.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
|
||||
cmi.dwParams = CONNMGR_PARAM_GUIDDESTNET;
|
||||
cmi.dwFlags = CONNMGR_FLAG_PROXY_HTTP;
|
||||
cmi.hWnd = self->hWnd;
|
||||
cmi.uMsg = XWWM_CONNMGR_EVT;
|
||||
|
||||
res = CMCALL(ConnMgrEstablishConnection)( &cmi, &hand );
|
||||
if ( SUCCEEDED(res) ) {
|
||||
self->connMgrHandle = hand;
|
||||
stateChanged( self, CE_IPST_OPENING_NETWORK );
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* openNetwork */
|
||||
#endif
|
||||
|
||||
static void
|
||||
getHostAddr( CeSocketWrapper* self )
|
||||
{
|
||||
if ( self->addrRec.u.ip_relay.hostName[0] ) {
|
||||
XP_LOGF( "%s: calling WSAAsyncGetHostByName(%s)",
|
||||
__func__, self->addrRec.u.ip_relay.hostName );
|
||||
XP_ASSERT( !self->getHostTask );
|
||||
self->getHostTask
|
||||
= WSAAsyncGetHostByName( self->hWnd,
|
||||
XWWM_HOSTNAME_ARRIVED,
|
||||
self->addrRec.u.ip_relay.hostName,
|
||||
(char*)&self->hostNameUnion,
|
||||
sizeof(self->hostNameUnion) );
|
||||
if ( NULL == self->getHostTask ) {
|
||||
XP_LOGF( "%s: WSAGetLastError=>%d", __func__, WSAGetLastError() );
|
||||
}
|
||||
|
||||
stateChanged( self, CE_IPST_RESOLVINGHOST );
|
||||
}
|
||||
}
|
||||
|
||||
CeSocketWrapper*
|
||||
ce_sockwrap_new( MPFORMAL HWND hWnd, DataRecvProc dataCB,
|
||||
StateChangeProc stateCB,
|
||||
#if defined _WIN32_WCE && ! defined CEGCC_DOES_CONNMGR
|
||||
const CMProcs* cmProcs,
|
||||
#endif
|
||||
void* closure )
|
||||
{
|
||||
CeSocketWrapper* self = NULL;
|
||||
|
||||
self = XP_MALLOC( mpool, sizeof(*self) );
|
||||
XP_MEMSET( self, 0, sizeof(*self) );
|
||||
|
||||
self->hWnd = hWnd;
|
||||
self->dataProc = dataCB;
|
||||
self->stateProc = stateCB;
|
||||
#if defined _WIN32_WCE && ! defined CEGCC_DOES_CONNMGR
|
||||
self->cmProcs = cmProcs;
|
||||
#endif
|
||||
self->closure = closure;
|
||||
MPASSIGN(self->mpool, mpool );
|
||||
self->socket = -1;
|
||||
|
||||
bqInit( &self->queueOut, self->bufOut, sizeof(self->bufOut) );
|
||||
|
||||
/* #ifdef _WIN32_WCE */
|
||||
/* openNetwork( self ); /\* kicks off connection process *\/ */
|
||||
/* #else */
|
||||
/* getHostAddr( self ); /\* kicks off connection process *\/ */
|
||||
/* #endif */
|
||||
return self;
|
||||
} /* ce_sockwrap_new */
|
||||
|
||||
void
|
||||
ce_sockwrap_delete( CeSocketWrapper* self )
|
||||
{
|
||||
/* This isn't a good thing to do. Better to signal them to exit
|
||||
some other way */
|
||||
closeConnection( self );
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
if ( !!self->connMgrHandle ) {
|
||||
CMCALL(ConnMgrReleaseConnection)( self->connMgrHandle, 1 );
|
||||
self->connMgrHandle = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
XP_FREE( self->mpool, self );
|
||||
} /* ce_sockwrap_delete */
|
||||
|
||||
void
|
||||
ce_sockwrap_hostname( CeSocketWrapper* self, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
LOG_FUNC();
|
||||
XP_ASSERT( !!self );
|
||||
DWORD err = WSAGETASYNCERROR( lParam );
|
||||
|
||||
XP_ASSERT( CE_IPST_RESOLVINGHOST == self->connState );
|
||||
|
||||
if ( 0 == err ) {
|
||||
if ( (HANDLE)wParam != self->getHostTask ) {
|
||||
XP_LOGF( "%s: ignoring old event", __func__ );
|
||||
} else {
|
||||
|
||||
XP_U32 tmp;
|
||||
XP_MEMCPY( &tmp, &self->hostNameUnion.hent.h_addr_list[0][0],
|
||||
sizeof(tmp) );
|
||||
self->addrRec.u.ip_relay.ipAddr = XP_NTOHL( tmp );
|
||||
|
||||
XP_LOGF( "got address: %d.%d.%d.%d",
|
||||
(int)((tmp>>0) & 0xFF),
|
||||
(int)((tmp>>8) & 0xFF),
|
||||
(int)((tmp>>16) & 0xFF),
|
||||
(int)((tmp>>24) & 0xFF) );
|
||||
|
||||
stateChanged( self, CE_IPST_HOSTRESOLVED );
|
||||
self->getHostTask = NULL;
|
||||
}
|
||||
} else {
|
||||
XP_LOGF( "%s: async operation failed: %ld", __func__, err );
|
||||
/* WSAENETDOWN */
|
||||
/* WSAENOBUFS */
|
||||
/* WSAEFAULT */
|
||||
/* WSAHOST_NOT_FOUND */
|
||||
/* WSATRY_AGAIN */
|
||||
/* WSANO_RECOVERY */
|
||||
/* WSANO_DATA */
|
||||
}
|
||||
} /* ce_sockwrap_hostname */
|
||||
|
||||
static XP_Bool
|
||||
dispatch_msgs( CeSocketWrapper* self )
|
||||
{
|
||||
XP_Bool draw = XP_FALSE;
|
||||
|
||||
/* Repeat until we don't have a complete message in the buffer */
|
||||
for ( ; ; ) {
|
||||
XP_U16 lenInBuffer = self->in_offset;
|
||||
XP_U16 msgLen;
|
||||
XP_U16 lenUsed, lenLeft;
|
||||
|
||||
XP_LOGF( "%s: have %d bytes", __func__, lenInBuffer );
|
||||
|
||||
/* Do we even have the length header? */
|
||||
if ( lenInBuffer < sizeof(msgLen) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
XP_MEMCPY( &msgLen, self->in_buf, sizeof(msgLen) );
|
||||
msgLen = XP_NTOHS( msgLen );
|
||||
|
||||
XP_LOGF( "%s: at least we have len: %d", __func__, msgLen );
|
||||
|
||||
/* We know the length of the full buffer. Do we have it? */
|
||||
if ( lenInBuffer < (msgLen + sizeof(msgLen)) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* first send */
|
||||
XP_LOGF( "%s: sending %d bytes to dataProc", __func__, msgLen );
|
||||
draw = (*self->dataProc)( (XP_U8*)&self->in_buf[sizeof(msgLen)],
|
||||
msgLen, self->closure )
|
||||
|| draw;
|
||||
|
||||
/* then move down any additional bytes */
|
||||
lenUsed = msgLen + sizeof(msgLen);
|
||||
XP_ASSERT( lenInBuffer >= lenUsed );
|
||||
lenLeft = lenInBuffer - lenUsed;
|
||||
if ( lenLeft > 0 ) {
|
||||
XP_MEMCPY( self->in_buf, &self->in_buf[lenUsed], lenLeft );
|
||||
}
|
||||
|
||||
self->in_offset = lenLeft;
|
||||
}
|
||||
|
||||
return draw;
|
||||
} /* dispatch_msgs */
|
||||
|
||||
static XP_Bool
|
||||
read_from_socket( CeSocketWrapper* self )
|
||||
{
|
||||
WSABUF wsabuf;
|
||||
DWORD flags = 0;
|
||||
DWORD nBytesRecvd = 0;
|
||||
|
||||
wsabuf.buf = &self->in_buf[self->in_offset];
|
||||
wsabuf.len = sizeof(self->in_buf) - self->in_offset;
|
||||
|
||||
int err = WSARecv( self->socket, &wsabuf, 1, &nBytesRecvd,
|
||||
&flags, NULL, NULL );
|
||||
XP_ASSERT( nBytesRecvd < 0xFFFF );
|
||||
|
||||
if ( 0 == err ) {
|
||||
XP_LOGF( "%s: got %ld bytes", __func__, nBytesRecvd );
|
||||
self->in_offset += nBytesRecvd;
|
||||
} else {
|
||||
XP_ASSERT( err == SOCKET_ERROR );
|
||||
err = WSAGetLastError();
|
||||
XP_LOGF( "%s: WSARecv=>%d", __func__, err );
|
||||
}
|
||||
|
||||
return nBytesRecvd > 0;
|
||||
} /* read_from_socket */
|
||||
|
||||
/* MSDN: When one of the nominated network events occurs on the specified
|
||||
socket s, the application window hWnd receives message wMsg. The wParam
|
||||
parameter identifies the socket on which a network event has occurred. The
|
||||
low word of lParam specifies the network event that has occurred. The high
|
||||
word of lParam contains any error code. The error code be any error as
|
||||
defined in Winsock2.h.
|
||||
*/
|
||||
XP_Bool
|
||||
ce_sockwrap_event( CeSocketWrapper* self, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
SOCKET socket = (SOCKET)wParam;
|
||||
long event = (long)LOWORD(lParam);
|
||||
XP_Bool draw = XP_FALSE;
|
||||
|
||||
if ( 0 != (FD_WRITE & event) ) {
|
||||
send_packet_if( self );
|
||||
event &= ~FD_WRITE;
|
||||
XP_LOGF( "%s: got FD_WRITE", __func__ );
|
||||
}
|
||||
|
||||
if ( 0 != (FD_READ & event) ) {
|
||||
XP_LOGF( "%s: got FD_READ", __func__ );
|
||||
if ( read_from_socket( self ) ) {
|
||||
draw = dispatch_msgs( self );
|
||||
}
|
||||
event &= ~FD_READ;
|
||||
}
|
||||
|
||||
if ( 0 != (FD_CONNECT & event) ) {
|
||||
int err = WSAGETSELECTERROR(lParam);
|
||||
XP_LOGF( "%s: got FD_CONNECT; err=%d", __func__, err );
|
||||
event &= ~FD_CONNECT;
|
||||
if ( 0 == err ) {
|
||||
XP_ASSERT( self->socket == -1 || self->socket == socket );
|
||||
self->socket = socket;
|
||||
stateChanged( self, CE_IPST_CONNECTED );
|
||||
} else {
|
||||
closeConnection( self );
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 != (FD_CLOSE & event) ) {
|
||||
event &= ~FD_CLOSE;
|
||||
closeConnection( self );
|
||||
}
|
||||
|
||||
if ( 0 != event ) {
|
||||
XP_WARNF( "%s: unexpected bits left: 0x%lx", __func__, event );
|
||||
}
|
||||
return draw;
|
||||
} /* ce_sockwrap_event */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#ifdef DEBUG
|
||||
static const char*
|
||||
CMStatus2Str( WPARAM status )
|
||||
{
|
||||
#define CASESTR(s) case (s): return #s
|
||||
switch( status ) {
|
||||
CASESTR( CONNMGR_STATUS_CONNECTED );
|
||||
CASESTR( CONNMGR_STATUS_NOPATHTODESTINATION );
|
||||
CASESTR( CONNMGR_STATUS_CONNECTIONCANCELED );
|
||||
CASESTR( CONNMGR_STATUS_CONNECTIONLINKFAILED );
|
||||
CASESTR( CONNMGR_STATUS_CONNECTIONDISABLED );
|
||||
CASESTR( CONNMGR_STATUS_AUTHENTICATIONFAILED );
|
||||
CASESTR( CONNMGR_STATUS_PHONEOFF );
|
||||
CASESTR( CONNMGR_STATUS_UNKNOWN );
|
||||
CASESTR( CONNMGR_STATUS_DISCONNECTED );
|
||||
CASESTR( CONNMGR_STATUS_CONNECTIONFAILED );
|
||||
CASESTR( CONNMGR_STATUS_WAITINGFORPATH );
|
||||
CASESTR( CONNMGR_STATUS_WAITINGFORPHONE );
|
||||
CASESTR( CONNMGR_STATUS_EXCLUSIVECONFLICT );
|
||||
CASESTR( CONNMGR_STATUS_WAITINGCONNECTION );
|
||||
CASESTR( CONNMGR_STATUS_WAITINGFORRESOURCE );
|
||||
CASESTR( CONNMGR_STATUS_WAITINGFORNETWORK );
|
||||
CASESTR( CONNMGR_STATUS_WAITINGDISCONNECTION );
|
||||
CASESTR( CONNMGR_STATUS_WAITINGCONNECTIONABORT );
|
||||
CASESTR( CONNMGR_STATUS_NOPATHWITHPROPERTY );
|
||||
}
|
||||
#undef CASESTR
|
||||
XP_ASSERT(0);
|
||||
return "";
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ce_connmgr_event( CeSocketWrapper* self, WPARAM wParam, ConnMgrErr* userErr )
|
||||
{
|
||||
XP_LOGF( "%s: wParam=%s", __func__, CMStatus2Str(wParam) );
|
||||
|
||||
*userErr = CONN_ERR_NONE;
|
||||
|
||||
switch( wParam ) {
|
||||
case CONNMGR_STATUS_CONNECTED:
|
||||
stateChanged( self, CE_IPST_NETWORK_OPENED );
|
||||
break;
|
||||
|
||||
/* no recovery from any of these */
|
||||
case CONNMGR_STATUS_NOPATHTODESTINATION:
|
||||
case CONNMGR_STATUS_CONNECTIONCANCELED:
|
||||
case CONNMGR_STATUS_CONNECTIONLINKFAILED:
|
||||
case CONNMGR_STATUS_CONNECTIONDISABLED:
|
||||
case CONNMGR_STATUS_AUTHENTICATIONFAILED:
|
||||
/* Do I want to release, or keep it around for status messages
|
||||
later? */
|
||||
//(*self->cmProcs->ConnMgrReleaseConnection)( self->connMgrHandle, 1 );
|
||||
//self->connMgrHandle = NULL;
|
||||
stateChanged( self, CE_IPST_START );
|
||||
*userErr = CONN_ERR_NONET;
|
||||
break;
|
||||
|
||||
/* Error the user can fix.... */
|
||||
case CONNMGR_STATUS_PHONEOFF:
|
||||
closeConnection( self );
|
||||
*userErr = CONN_ERR_PHONE_OFF;
|
||||
break;
|
||||
|
||||
case CONNMGR_STATUS_UNKNOWN:
|
||||
case CONNMGR_STATUS_DISCONNECTED:
|
||||
case CONNMGR_STATUS_CONNECTIONFAILED:
|
||||
case CONNMGR_STATUS_WAITINGFORPATH:
|
||||
case CONNMGR_STATUS_WAITINGFORPHONE:
|
||||
case CONNMGR_STATUS_EXCLUSIVECONFLICT:
|
||||
case CONNMGR_STATUS_WAITINGCONNECTION:
|
||||
case CONNMGR_STATUS_WAITINGFORRESOURCE:
|
||||
case CONNMGR_STATUS_WAITINGFORNETWORK:
|
||||
case CONNMGR_STATUS_WAITINGDISCONNECTION:
|
||||
case CONNMGR_STATUS_WAITINGCONNECTIONABORT:
|
||||
case CONNMGR_STATUS_NOPATHWITHPROPERTY:
|
||||
break;
|
||||
default:
|
||||
XP_LOGF( "unknown status: %x", wParam );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
XP_S16
|
||||
ce_sockwrap_send( CeSocketWrapper* self, const XP_U8* buf, XP_U16 len,
|
||||
const CommsAddrRec* addr )
|
||||
{
|
||||
XP_S16 nSent = -1; /* error */
|
||||
XP_LOGF( "%s(len=%d)", __func__, len );
|
||||
|
||||
/* If the address has changed, we need to close the connection, then call
|
||||
getHostAddr() to kick off the async reconnect process. */
|
||||
XP_ASSERT( addr->conType == COMMS_CONN_RELAY );
|
||||
if ( 0 != XP_STRCMP( addr->u.ip_relay.hostName,
|
||||
self->addrRec.u.ip_relay.hostName )
|
||||
|| 0 != XP_STRCMP( addr->u.ip_relay.invite,
|
||||
self->addrRec.u.ip_relay.invite )
|
||||
|| addr->u.ip_relay.port != self->addrRec.u.ip_relay.port ) {
|
||||
closeConnection( self );
|
||||
XP_MEMCPY( &self->addrRec, addr, sizeof(self->addrRec) );
|
||||
|
||||
}
|
||||
|
||||
if ( CE_IPST_START == self->connState ) {
|
||||
#ifdef _WIN32_WCE
|
||||
openNetwork( self ); /* kicks off connection process */
|
||||
#else
|
||||
getHostAddr( self ); /* kicks off connection process */
|
||||
#endif
|
||||
}
|
||||
/* What if we're stuck in some other state? Kick those here too? */
|
||||
|
||||
if ( bqAdd( &self->queueOut, buf, len ) ) {
|
||||
send_packet_if( self );
|
||||
nSent = len;
|
||||
} else {
|
||||
XP_WARNF( "dropping packet; queue full" );
|
||||
}
|
||||
|
||||
LOG_RETURNF( "%d", nSent );
|
||||
return nSent;
|
||||
} /* ce_sockwrap_send */
|
||||
|
||||
#endif
|
|
@ -1,69 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2005-2009 by Eric House (xwords@eehouse.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 _CESOCKWR_H_
|
||||
#define _CESOCKWR_H_
|
||||
|
||||
#include "comms.h"
|
||||
#include "mempool.h"
|
||||
#include "ceconnmg.h"
|
||||
|
||||
typedef enum {
|
||||
CE_IPST_START
|
||||
#ifdef _WIN32_WCE
|
||||
,CE_IPST_OPENING_NETWORK
|
||||
,CE_IPST_NETWORK_OPENED
|
||||
#endif
|
||||
,CE_IPST_RESOLVINGHOST
|
||||
,CE_IPST_HOSTRESOLVED
|
||||
,CE_IPST_CONNECTING
|
||||
,CE_IPST_CONNECTED
|
||||
} CeConnState;
|
||||
|
||||
/* Errors to tell the user about */
|
||||
typedef enum {
|
||||
CONN_ERR_NONE
|
||||
,CONN_ERR_PHONE_OFF
|
||||
,CONN_ERR_NONET
|
||||
} ConnMgrErr;
|
||||
|
||||
typedef struct CeSocketWrapper CeSocketWrapper; /* forward */
|
||||
typedef XP_Bool (*DataRecvProc)( XP_U8* data, XP_U16 len, void* closure );
|
||||
typedef void (*StateChangeProc)( void* closure, CeConnState oldState,
|
||||
CeConnState newState );
|
||||
|
||||
CeSocketWrapper* ce_sockwrap_new( MPFORMAL HWND hWnd, DataRecvProc dataCB,
|
||||
StateChangeProc stateCB,
|
||||
#if defined _WIN32_WCE && ! defined CEGCC_DOES_CONNMGR
|
||||
const CMProcs* cmProcs,
|
||||
#endif
|
||||
void* globals );
|
||||
void ce_sockwrap_delete( CeSocketWrapper* self );
|
||||
|
||||
void ce_sockwrap_hostname( CeSocketWrapper* self, WPARAM wParam,
|
||||
LPARAM lParam );
|
||||
XP_Bool ce_sockwrap_event( CeSocketWrapper* self, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
XP_S16 ce_sockwrap_send( CeSocketWrapper* self, const XP_U8* buf, XP_U16 len,
|
||||
const CommsAddrRec* addr );
|
||||
void ce_connmgr_event( CeSocketWrapper* self, WPARAM wParam,
|
||||
ConnMgrErr* userErr );
|
||||
|
||||
#endif
|
|
@ -1,159 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2002-2009 by Eric House (xwords@eehouse.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 <windowsx.h>
|
||||
|
||||
#include "cestrbx.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
#include "cedebug.h"
|
||||
|
||||
typedef struct StrBoxState {
|
||||
CeDlgHdr dlgHdr;
|
||||
const wchar_t* title;
|
||||
#ifndef _WIN32_WCE
|
||||
HFONT font;
|
||||
#endif
|
||||
XWStreamCtxt* stream;
|
||||
XP_U16 result;
|
||||
XP_Bool isQuery;
|
||||
XP_Bool textIsSet;
|
||||
} StrBoxState;
|
||||
|
||||
static void
|
||||
stuffTextInField( HWND hDlg, StrBoxState* state )
|
||||
{
|
||||
XP_U16 nBytes = stream_getSize(state->stream);
|
||||
XP_U16 len, crlen;
|
||||
XP_UCHAR* sbuf;
|
||||
wchar_t* wbuf;
|
||||
|
||||
sbuf = XP_MALLOC( state->dlgHdr.globals->mpool, nBytes + 1 );
|
||||
stream_getBytes( state->stream, sbuf, nBytes );
|
||||
|
||||
crlen = strlen(XP_CR);
|
||||
if ( 0 == strncmp( XP_CR, &sbuf[nBytes-crlen], crlen ) ) {
|
||||
nBytes -= crlen;
|
||||
}
|
||||
sbuf[nBytes] = '\0';
|
||||
|
||||
len = MultiByteToWideChar( CP_UTF8, 0, sbuf, nBytes, NULL, 0 );
|
||||
wbuf = XP_MALLOC( state->dlgHdr.globals->mpool, (len+1) * sizeof(*wbuf) );
|
||||
MultiByteToWideChar( CP_UTF8, 0, sbuf, nBytes, wbuf, len );
|
||||
XP_FREE( state->dlgHdr.globals->mpool, sbuf );
|
||||
wbuf[len] = 0;
|
||||
|
||||
SetDlgItemText( hDlg, ID_EDITTEXT, wbuf );
|
||||
XP_FREE( state->dlgHdr.globals->mpool, wbuf );
|
||||
} /* stuffTextInField */
|
||||
|
||||
LRESULT CALLBACK
|
||||
StrBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT handled = FALSE;
|
||||
StrBoxState* state;
|
||||
XP_U16 id;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, (long)lParam );
|
||||
state = (StrBoxState*)lParam;
|
||||
|
||||
if ( !!state->title ) {
|
||||
SendMessage( hDlg, WM_SETTEXT, 0, (long)state->title );
|
||||
}
|
||||
#ifndef _WIN32_WCE
|
||||
SendDlgItemMessage( hDlg, ID_EDITTEXT, WM_SETFONT,
|
||||
(WPARAM)state->font, 0L );
|
||||
#endif
|
||||
if ( !state->isQuery ) {
|
||||
ceShowOrHide( hDlg, IDCANCEL, XP_FALSE );
|
||||
}
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg,
|
||||
state->isQuery? DLG_STATE_NONE : DLG_STATE_OKONLY );
|
||||
|
||||
handled = TRUE;
|
||||
} else {
|
||||
state = (StrBoxState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
|
||||
if ( !!state ) {
|
||||
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||
handled = TRUE;
|
||||
} else {
|
||||
switch (message) {
|
||||
|
||||
case WM_COMMAND:
|
||||
|
||||
/* If I add the text above in the WM_INITDIALOG section it
|
||||
shows up selected though selStart and selEnd are 0. */
|
||||
if ( !state->textIsSet ) {
|
||||
state->textIsSet = XP_TRUE;
|
||||
stuffTextInField( hDlg, state );
|
||||
}
|
||||
|
||||
id = LOWORD(wParam);
|
||||
switch( id ) {
|
||||
|
||||
case IDOK:
|
||||
case IDCANCEL:
|
||||
state->result = id;
|
||||
EndDialog(hDlg, id);
|
||||
handled = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return handled;
|
||||
} /* StrBox */
|
||||
|
||||
XP_Bool
|
||||
WrapStrBox( CEAppGlobals* globals, const wchar_t* title,
|
||||
XWStreamCtxt* stream, XP_U16 buttons )
|
||||
{
|
||||
StrBoxState state;
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
|
||||
state.title = title;
|
||||
state.stream = stream;
|
||||
state.isQuery = (buttons & ~MB_ICONMASK) != MB_OK;
|
||||
state.dlgHdr.globals = globals;
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
LOGFONT fontInfo;
|
||||
XP_MEMSET( &fontInfo, 0, sizeof(fontInfo) );
|
||||
fontInfo.lfHeight = 14;
|
||||
fontInfo.lfQuality = PROOF_QUALITY;
|
||||
wcscpy( fontInfo.lfFaceName, IS_SMARTPHONE(globals)?
|
||||
L"Segoe Condensed" : L"Tahoma" );
|
||||
state.font = CreateFontIndirect( &fontInfo );
|
||||
#endif
|
||||
|
||||
assertOnTop( globals->hWnd );
|
||||
DialogBoxParam( globals->locInst, (LPCTSTR)IDD_STRBOX, globals->hWnd,
|
||||
(DLGPROC)StrBox, (long)&state );
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
DeleteObject( state.font );
|
||||
#endif
|
||||
|
||||
return state.result == IDOK;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002 by Eric House (xwords@eehouse.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 "stdafx.h"
|
||||
|
||||
#include "xwstream.h"
|
||||
#include "cemain.h"
|
||||
#include "ceutil.h"
|
||||
|
||||
XP_Bool WrapStrBox( CEAppGlobals* globals, const wchar_t* title,
|
||||
XWStreamCtxt* stream, XP_U16 buttons );
|
|
@ -1,518 +0,0 @@
|
|||
/* -*- fill-column: 77; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2004-2008 by Eric House (xwords@eehouse.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 <windowsx.h>
|
||||
#include "stdafx.h"
|
||||
#include <commdlg.h>
|
||||
#include <wchar.h>
|
||||
#ifdef _win32_wce
|
||||
#include <aygshell.h>
|
||||
#endif
|
||||
|
||||
#include "cemain.h"
|
||||
#include "cesvdgms.h"
|
||||
#include "ceutil.h"
|
||||
#include "ceresstr.h"
|
||||
#include "cedebug.h"
|
||||
#include "debhacks.h"
|
||||
|
||||
typedef struct CeSaveGameNameState {
|
||||
CeDlgHdr dlgHdr;
|
||||
wchar_t* buf;
|
||||
XP_U16 buflen;
|
||||
XP_U16 lableTextId;
|
||||
XP_Bool cancelled;
|
||||
XP_Bool inited;
|
||||
} CeSaveGameNameState;
|
||||
|
||||
static XP_Bool
|
||||
ceFileExists( CEAppGlobals* globals, const wchar_t* name )
|
||||
{
|
||||
wchar_t buf[CE_MAX_PATH_LEN];
|
||||
DWORD attributes;
|
||||
XP_U16 len;
|
||||
|
||||
len = ceGetPath( globals, DEFAULT_DIR_PATH_L, buf, VSIZE(buf) );
|
||||
_snwprintf( &buf[len], VSIZE(buf)-len, L"%s.xwg", name );
|
||||
|
||||
attributes = GetFileAttributes( buf );
|
||||
return attributes != 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
static void
|
||||
makeUniqueName( CEAppGlobals* globals, wchar_t* buf, XP_U16 bufLen )
|
||||
{
|
||||
XP_U16 ii;
|
||||
const wchar_t* fmt = ceGetResStringL( globals, IDS_UNTITLED_FORMAT );
|
||||
for ( ii = 1; ii < 100; ++ii ) {
|
||||
#ifdef DEBUG
|
||||
int len =
|
||||
#endif
|
||||
_snwprintf( buf, bufLen, fmt, ii );
|
||||
XP_ASSERT( len < bufLen );
|
||||
if ( !ceFileExists( globals, buf ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* If we fall out of the loop, the user will be asked to confirm delete
|
||||
of Untitled99 or somesuch. That's ok.... */
|
||||
} /* makeUniqueName */
|
||||
|
||||
static LRESULT CALLBACK
|
||||
SaveNameDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
CeSaveGameNameState* state;
|
||||
XP_U16 wid;
|
||||
BOOL result = FALSE;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
|
||||
state = (CeSaveGameNameState*)lParam;
|
||||
state->cancelled = XP_TRUE;
|
||||
state->inited = XP_FALSE;
|
||||
|
||||
wchar_t buf[128];
|
||||
LoadString( state->dlgHdr.globals->locInst, state->lableTextId,
|
||||
buf, VSIZE(buf) );
|
||||
(void)SetDlgItemText( hDlg, IDC_SVGN_SELLAB, buf );
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||
|
||||
result = TRUE;
|
||||
} else {
|
||||
state = (CeSaveGameNameState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!state ) {
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
if ( !state->inited ) {
|
||||
state->inited = XP_TRUE;
|
||||
(void)SetDlgItemText( hDlg, IDC_SVGN_EDIT, state->buf );
|
||||
}
|
||||
|
||||
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
|
||||
switch (message) {
|
||||
case WM_COMMAND:
|
||||
wid = LOWORD(wParam);
|
||||
switch( wid ) {
|
||||
case IDOK: {
|
||||
wchar_t buf[128];
|
||||
XP_U16 len;
|
||||
(void)GetDlgItemText( hDlg, IDC_SVGN_EDIT, buf,
|
||||
VSIZE(buf) );
|
||||
if ( ceFileExists( globals, buf ) ) {
|
||||
wchar_t widebuf[128];
|
||||
_snwprintf( widebuf, VSIZE(widebuf),
|
||||
ceGetResStringL( globals,
|
||||
IDS_FILEEXISTSFMT_L ),
|
||||
buf );
|
||||
result = MessageBox( hDlg, widebuf,
|
||||
ceGetResStringL(globals,
|
||||
IDS_FYI_L ),
|
||||
MB_OK | MB_ICONHAND );
|
||||
(void)SetDlgItemText( hDlg, IDC_SVGN_EDIT,
|
||||
state->buf );
|
||||
break;
|
||||
}
|
||||
len = ceGetPath( globals, DEFAULT_DIR_PATH_L,
|
||||
state->buf, state->buflen );
|
||||
_snwprintf( &state->buf[len], state->buflen - len,
|
||||
L"%s.xwg", buf );
|
||||
XP_LOGW( __func__, state->buf );
|
||||
/* fallthru */
|
||||
state->cancelled = XP_FALSE;
|
||||
}
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, wid);
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} /* SaveNameDlg */
|
||||
|
||||
XP_Bool
|
||||
ceConfirmUniqueName( CEAppGlobals* globals, HWND hWnd, XP_U16 strId,
|
||||
wchar_t* buf, XP_U16 buflen )
|
||||
{
|
||||
CeSaveGameNameState state;
|
||||
|
||||
makeUniqueName( globals, buf, buflen );
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof(state) );
|
||||
state.dlgHdr.globals = globals;
|
||||
state.buf = buf;
|
||||
state.buflen = buflen;
|
||||
state.lableTextId = strId;
|
||||
(void)DialogBoxParam( globals->locInst, (LPCTSTR)IDD_SAVENAMEDLG,
|
||||
hWnd, (DLGPROC)SaveNameDlg, (long)&state );
|
||||
|
||||
return !state.cancelled;
|
||||
} /* ceConfirmUniqueName */
|
||||
|
||||
typedef struct CeSavedGamesState {
|
||||
CeDlgHdr dlgHdr;
|
||||
wchar_t* buf;
|
||||
XP_U16 buflen;
|
||||
XP_S16 sel; /* index of game name currently selected */
|
||||
XP_U16 openGameIndex; /* index of game that's open */
|
||||
wchar_t openNameW[128];
|
||||
wchar_t newNameW[MAX_PATH];
|
||||
XP_U16 nItems;
|
||||
|
||||
XP_U16 gameListId;
|
||||
XP_Bool inited;
|
||||
XP_Bool relaunch;
|
||||
SavedGamesResult result;
|
||||
} CeSavedGamesState;
|
||||
|
||||
static void
|
||||
ceBasename( wchar_t* buf, const wchar_t* path )
|
||||
{
|
||||
const wchar_t* ptr = path + wcslen(path);
|
||||
const wchar_t* dot = NULL;
|
||||
|
||||
for ( ; ; ) {
|
||||
if ( ptr == path ) {
|
||||
break;
|
||||
} else if ( *ptr == L'\\' ) {
|
||||
++ptr;
|
||||
break;
|
||||
} else if ( !dot && *ptr == L'.' ) {
|
||||
dot = ptr;
|
||||
}
|
||||
--ptr;
|
||||
}
|
||||
lstrcpy( buf, ptr );
|
||||
if ( !!dot ) {
|
||||
buf[dot-ptr] = 0; /* nuke extension */
|
||||
}
|
||||
} /* ceBasename */
|
||||
|
||||
/* Probably belongs as a utility */
|
||||
static void
|
||||
getComboText( CeSavedGamesState* state, wchar_t* buf, XP_U16* lenp )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
XP_U16 id = state->gameListId;
|
||||
XP_U16 sel = state->sel;
|
||||
XP_U16 len;
|
||||
|
||||
len = SendDlgItemMessage( hDlg, id, GETLBTEXTLEN(globals), sel, 0L );
|
||||
|
||||
if ( len < *lenp ) {
|
||||
(void)SendDlgItemMessage( hDlg, id, GETLBTEXT(globals), sel,
|
||||
(LPARAM)buf );
|
||||
} else {
|
||||
XP_ASSERT( 0 );
|
||||
}
|
||||
*lenp = len;
|
||||
} /* getComboText */
|
||||
|
||||
static void
|
||||
getFullSelPath( CeSavedGamesState* state, wchar_t* buf, XP_U16 buflen )
|
||||
{
|
||||
XP_U16 len = ceGetPath( state->dlgHdr.globals,
|
||||
DEFAULT_DIR_PATH_L, buf, buflen );
|
||||
buflen -= len;
|
||||
getComboText( state, &buf[len], &buflen );
|
||||
lstrcat( buf, L".xwg" );
|
||||
}
|
||||
|
||||
static void
|
||||
setButtons( CeSavedGamesState* state )
|
||||
{
|
||||
XP_Bool curSelected = state->openGameIndex == state->sel;
|
||||
XP_Bool haveItem = state->nItems > 0;
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
|
||||
ceEnOrDisable( hDlg, IDC_SVGM_OPEN, haveItem && !curSelected );
|
||||
ceEnOrDisable( hDlg, IDC_SVGM_DUP, haveItem );
|
||||
ceEnOrDisable( hDlg, IDC_SVGM_DEL, haveItem && !curSelected );
|
||||
ceEnOrDisable( hDlg, IDC_SVGM_CHANGE, haveItem );
|
||||
}
|
||||
|
||||
static void
|
||||
initSavedGamesData( CeSavedGamesState* state )
|
||||
{
|
||||
HANDLE fileH;
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
WIN32_FIND_DATA data;
|
||||
wchar_t path[CE_MAX_PATH_LEN];
|
||||
XP_S16 sel;
|
||||
XP_U16 ii;
|
||||
XP_U16 nItems = 0;
|
||||
|
||||
XP_MEMSET( &data, 0, sizeof(data) );
|
||||
ceGetPath( globals, DEFAULT_DIR_PATH_L, path, VSIZE(path) );
|
||||
lstrcat( path, L"*.xwg" );
|
||||
|
||||
fileH = FindFirstFile( path, &data );
|
||||
for ( ii = 0; fileH != INVALID_HANDLE_VALUE; ++ii ) {
|
||||
XP_U16 len = wcslen( data.cFileName );
|
||||
|
||||
XP_ASSERT( data.cFileName[len-4] == L'.');
|
||||
data.cFileName[len-4] = 0;
|
||||
|
||||
(void)SendDlgItemMessage( hDlg, state->gameListId,
|
||||
ADDSTRING(globals),
|
||||
0, (LPARAM)data.cFileName );
|
||||
++nItems;
|
||||
|
||||
if ( !FindNextFile( fileH, &data ) ) {
|
||||
XP_ASSERT( GetLastError() == ERROR_NO_MORE_FILES );
|
||||
break;
|
||||
}
|
||||
}
|
||||
state->nItems = nItems;
|
||||
|
||||
/* Now locate the open game and game we should select (which may
|
||||
differ) */
|
||||
sel = SendDlgItemMessage( hDlg, state->gameListId, FINDSTRINGEXACT(globals),
|
||||
-1, (LPARAM)state->openNameW );
|
||||
XP_ASSERT( sel >= 0 ); /* should always have this */
|
||||
state->openGameIndex = sel;
|
||||
|
||||
sel = SendDlgItemMessage( hDlg,state->gameListId, FINDSTRINGEXACT(globals),
|
||||
-1, (LPARAM)state->newNameW );
|
||||
if ( sel < 0 ) {
|
||||
sel = state->openGameIndex;
|
||||
}
|
||||
|
||||
SendDlgItemMessage( hDlg, state->gameListId, SETCURSEL(globals), sel, 0 );
|
||||
state->sel = sel;
|
||||
|
||||
setButtons( state );
|
||||
} /* initSavedGamesData */
|
||||
|
||||
static XP_Bool
|
||||
renameSelected( CeSavedGamesState* state )
|
||||
{
|
||||
wchar_t newPath[MAX_PATH];
|
||||
XP_Bool confirmed = ceConfirmUniqueName( state->dlgHdr.globals, state->dlgHdr.hDlg,
|
||||
IDS_RENAME, newPath, VSIZE(newPath) );
|
||||
if ( confirmed ) {
|
||||
/* If we're renaming the current game, we have to exit and let
|
||||
calling code handle it. If we're renaming any other game, we can
|
||||
do it here. */
|
||||
if ( state->openGameIndex == state->sel ) {
|
||||
_snwprintf( state->buf, state->buflen, L"%s", newPath );
|
||||
state->result = CE_SVGAME_RENAME;
|
||||
} else {
|
||||
wchar_t curPath[MAX_PATH];
|
||||
getFullSelPath( state, curPath, VSIZE(curPath) );
|
||||
confirmed = MoveFile( curPath, newPath );
|
||||
}
|
||||
}
|
||||
|
||||
if ( confirmed ) {
|
||||
ceBasename( state->newNameW, newPath );
|
||||
} else {
|
||||
state->newNameW[0] = 0;
|
||||
}
|
||||
return confirmed;
|
||||
} /* renameSelected */
|
||||
|
||||
static XP_Bool
|
||||
duplicateSelected( CeSavedGamesState* state )
|
||||
{
|
||||
wchar_t newPath[MAX_PATH];
|
||||
XP_Bool confirmed;
|
||||
|
||||
confirmed = ceConfirmUniqueName( state->dlgHdr.globals, state->dlgHdr.hDlg,
|
||||
IDS_DUPENAME, newPath, VSIZE(newPath) );
|
||||
if ( confirmed ) {
|
||||
wchar_t curPath[MAX_PATH];
|
||||
getFullSelPath( state, curPath, VSIZE(curPath) );
|
||||
confirmed = CopyFile( curPath, newPath, TRUE ); /* TRUE is what??? */
|
||||
}
|
||||
|
||||
if ( confirmed ) {
|
||||
ceBasename( state->newNameW, newPath );
|
||||
} else {
|
||||
state->newNameW[0] = 0;
|
||||
}
|
||||
|
||||
return confirmed;
|
||||
} /* duplicateSelected */
|
||||
|
||||
static XP_Bool
|
||||
deleteSelected( CeSavedGamesState* state )
|
||||
{
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
/* confirm first!!!! */
|
||||
XP_Bool confirmed = queryBoxChar( globals, state->dlgHdr.hDlg,
|
||||
ceGetResString( globals,
|
||||
IDS_CONFIM_DELETE ) );
|
||||
if ( confirmed ) {
|
||||
wchar_t pathW[CE_MAX_PATH_LEN];
|
||||
XP_U16 len = ceGetPath( state->dlgHdr.globals,
|
||||
DEFAULT_DIR_PATH_L, pathW, VSIZE(pathW) );
|
||||
XP_U16 remLen = VSIZE(pathW) - len;
|
||||
getComboText( state, &pathW[len], &remLen );
|
||||
wcscat( pathW, L".xwg" );
|
||||
confirmed = DeleteFile( pathW );
|
||||
if ( confirmed ) {
|
||||
state->sel = -1;
|
||||
}
|
||||
}
|
||||
return confirmed;
|
||||
} /* deleteSelected */
|
||||
|
||||
static XP_Bool
|
||||
tryGameChanged( CeSavedGamesState* state )
|
||||
{
|
||||
XP_S16 sel = SendDlgItemMessage( state->dlgHdr.hDlg, state->gameListId,
|
||||
GETCURSEL(state->dlgHdr.globals), 0, 0L);
|
||||
XP_Bool changing = sel >= 0 && state->sel != sel;
|
||||
if ( changing ) {
|
||||
state->sel = sel;
|
||||
setButtons( state );
|
||||
}
|
||||
return changing;
|
||||
} /* tryGameChanged */
|
||||
|
||||
static LRESULT CALLBACK
|
||||
SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
CeSavedGamesState* state;
|
||||
BOOL result = FALSE;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
SetWindowLongPtr( hDlg, GWL_USERDATA, lParam );
|
||||
|
||||
state = (CeSavedGamesState*)lParam;
|
||||
state->inited = XP_FALSE;
|
||||
state->gameListId = LB_IF_PPC(state->dlgHdr.globals,IDC_SVGM_GAMELIST);
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_DONEONLY );
|
||||
ceDlgComboShowHide( &state->dlgHdr, IDC_SVGM_GAMELIST );
|
||||
|
||||
result = TRUE;
|
||||
} else {
|
||||
state = (CeSavedGamesState*)GetWindowLongPtr( hDlg, GWL_USERDATA );
|
||||
if ( !!state ) {
|
||||
|
||||
if ( !state->inited ) {
|
||||
state->inited = XP_TRUE;
|
||||
initSavedGamesData( state );
|
||||
}
|
||||
|
||||
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||
result = TRUE;
|
||||
} else if ( WM_NOTIFY == message ) {
|
||||
result = tryGameChanged( state );
|
||||
} else if ( message == WM_COMMAND ) {
|
||||
XP_U16 wid = LOWORD(wParam);
|
||||
|
||||
if ( CBN_SELCHANGE == HIWORD(wParam) ) {
|
||||
if (state->gameListId == wid ) {
|
||||
result = tryGameChanged( state );
|
||||
}
|
||||
} else if ( BN_CLICKED == HIWORD(wParam) ) {
|
||||
switch( wid ) {
|
||||
case IDC_SVGM_DUP:
|
||||
state->relaunch = duplicateSelected( state );
|
||||
break;
|
||||
case IDC_SVGM_CHANGE:
|
||||
state->relaunch = renameSelected( state );
|
||||
break;
|
||||
case IDC_SVGM_DEL:
|
||||
state->relaunch = deleteSelected( state );
|
||||
break;
|
||||
|
||||
case IDC_SVGM_OPEN: {
|
||||
wchar_t buf[128];
|
||||
XP_U16 len = VSIZE(buf);
|
||||
getComboText( state, buf, &len );
|
||||
len = ceGetPath( state->dlgHdr.globals,
|
||||
DEFAULT_DIR_PATH_L, state->buf,
|
||||
state->buflen );
|
||||
_snwprintf( &state->buf[len], state->buflen - len,
|
||||
L"%s.xwg", buf );
|
||||
XP_LOGW( "returning", state->buf );
|
||||
state->result = CE_SVGAME_OPEN;
|
||||
}
|
||||
/* fallthrough */
|
||||
case IDOK: /* Done button */
|
||||
EndDialog(hDlg, wid);
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( state->relaunch ) {
|
||||
EndDialog( hDlg, wid );
|
||||
result = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* SavedGamesDlg */
|
||||
|
||||
SavedGamesResult
|
||||
ceSavedGamesDlg( CEAppGlobals* globals, const XP_UCHAR* curPath,
|
||||
wchar_t* buf, XP_U16 buflen )
|
||||
{
|
||||
CeSavedGamesState state;
|
||||
|
||||
LOG_FUNC();
|
||||
|
||||
XP_MEMSET( &state, 0, sizeof(state) ); /* sets cancelled */
|
||||
state.dlgHdr.globals = globals;
|
||||
state.buf = buf;
|
||||
state.buflen = buflen;
|
||||
state.sel = -1;
|
||||
|
||||
if ( !!curPath ) {
|
||||
wchar_t widebuf[MAX_PATH];
|
||||
XP_U16 len;
|
||||
len = (XP_U16)XP_STRLEN( curPath );
|
||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, curPath, len + 1,
|
||||
widebuf, len + 1 );
|
||||
ceBasename( state.openNameW, widebuf );
|
||||
}
|
||||
|
||||
for ( ; ; ) {
|
||||
state.relaunch = XP_FALSE;
|
||||
state.result = CE_SVGAME_CANCEL;
|
||||
|
||||
assertOnTop( globals->hWnd );
|
||||
(void)DialogBoxParam( globals->locInst, (LPCTSTR)IDD_SAVEDGAMESDLG,
|
||||
globals->hWnd,
|
||||
(DLGPROC)SavedGamesDlg, (long)&state );
|
||||
|
||||
if ( !state.relaunch || (state.result == CE_SVGAME_RENAME) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
XP_LOGW( __func__, buf );
|
||||
|
||||
return state.result;
|
||||
} /* ceSavedGamesDlg */
|
|
@ -1,37 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2008 by Eric House (xwords@eehouse.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 _CESVDGMS_H_
|
||||
#define _CESVDGMS_H_
|
||||
|
||||
#include "xptypes.h"
|
||||
#include "cemain.h"
|
||||
|
||||
typedef enum {
|
||||
CE_SVGAME_CANCEL
|
||||
,CE_SVGAME_RENAME
|
||||
,CE_SVGAME_OPEN
|
||||
} SavedGamesResult;
|
||||
|
||||
SavedGamesResult ceSavedGamesDlg( CEAppGlobals* globals,
|
||||
const XP_UCHAR* curPath,
|
||||
wchar_t* buf, XP_U16 buflen );
|
||||
XP_Bool ceConfirmUniqueName( CEAppGlobals* globals, HWND hWnd, XP_U16 strId,
|
||||
wchar_t* buf, XP_U16 buflen );
|
||||
#endif
|
|
@ -1,112 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2002 - 2009 by Eric House (xwords@eehouse.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 _CEUTIL_H_
|
||||
#define _CEUTIL_H_
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cemain.h"
|
||||
|
||||
void ceSetDlgItemText( HWND hDlg, XP_U16 id, const XP_UCHAR* buf );
|
||||
void ceGetDlgItemText( HWND hDlg, XP_U16 id, XP_UCHAR* buf, XP_U16* bLen );
|
||||
|
||||
void ceSetDlgItemNum( HWND hDlg, XP_U16 id, XP_S32 num );
|
||||
XP_S32 ceGetDlgItemNum( HWND hDlg, XP_U16 id );
|
||||
|
||||
void ceSetDlgItemFileName( HWND hDlg, XP_U16 id, XP_UCHAR* buf );
|
||||
|
||||
void positionDlg( HWND hDlg );
|
||||
|
||||
void ce_selectAndShow( HWND hDlg, XP_U16 resID, XP_U16 index );
|
||||
|
||||
void ceShowOrHide( HWND hDlg, XP_U16 resID, XP_Bool visible );
|
||||
void ceEnOrDisable( HWND hDlg, XP_U16 resID, XP_Bool visible );
|
||||
|
||||
XP_Bool ceGetChecked( HWND hDlg, XP_U16 resID );
|
||||
void ceSetChecked( HWND hDlg, XP_U16 resID, XP_Bool check );
|
||||
|
||||
void ceCenterCtl( HWND hDlg, XP_U16 resID );
|
||||
void ceCheckMenus( const CEAppGlobals* globals );
|
||||
|
||||
void ceGetItemRect( HWND hDlg, XP_U16 resID, RECT* rect );
|
||||
void ceMoveItem( HWND hDlg, XP_U16 resID, XP_S16 byX, XP_S16 byY );
|
||||
|
||||
int ceMessageBoxChar( CEAppGlobals* globals, const XP_UCHAR* str,
|
||||
const wchar_t* title, XP_U16 buttons,
|
||||
SkipAlertBits sab );
|
||||
XP_Bool ceCurDictIsUTF8( CEAppGlobals* globals );
|
||||
|
||||
XP_U16 ceDistanceBetween( HWND hDlg, XP_U16 resID1, XP_U16 resID2 );
|
||||
|
||||
typedef enum {
|
||||
PREFS_FILE_PATH_L
|
||||
,DEFAULT_DIR_PATH_L
|
||||
,DEFAULT_GAME_PATH
|
||||
,PROGFILES_PATH
|
||||
} CePathType;
|
||||
XP_U16 ceGetPath( CEAppGlobals* globals, CePathType typ,
|
||||
void* buf, XP_U16 bufLen );
|
||||
|
||||
/* set vHeight to 0 to turn off scrolling */
|
||||
typedef enum { DLG_STATE_NONE = 0
|
||||
, DLG_STATE_TRAPBACK = 1
|
||||
, DLG_STATE_OKONLY = 2
|
||||
, DLG_STATE_DONEONLY = 4
|
||||
} DlgStateTask;
|
||||
typedef struct CeDlgHdr {
|
||||
CEAppGlobals* globals;
|
||||
HWND hDlg;
|
||||
/* set these two if will be calling ceDlgMoveBelow */
|
||||
XP_U16* resIDs;
|
||||
XP_U16 nResIDs;
|
||||
|
||||
/* Below this line is private to ceutil.c */
|
||||
DlgStateTask doWhat;
|
||||
XP_U16 nPage;
|
||||
XP_U16 prevY;
|
||||
XP_U16 nResIDsUsed;
|
||||
XP_Bool penDown;
|
||||
} CeDlgHdr;
|
||||
void ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat );
|
||||
void ceDlgComboShowHide( CeDlgHdr* dlgHdr, XP_U16 baseId );
|
||||
XP_Bool ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void ceDlgMoveBelow( CeDlgHdr* dlgHdr, XP_U16 resID, XP_S16 distance );
|
||||
|
||||
/* Are we drawing things in landscape mode? */
|
||||
XP_Bool ceIsLandscape( CEAppGlobals* globals );
|
||||
|
||||
void ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 id );
|
||||
XP_Bool ceGetExeDir( wchar_t* buf, XP_U16 bufLen );
|
||||
|
||||
#if defined _WIN32_WCE
|
||||
XP_Bool ceSizeIfFullscreen( CEAppGlobals* globals, HWND hWnd );
|
||||
#else
|
||||
# define ceSizeIfFullscreen( globals, hWnd ) XP_FALSE
|
||||
#endif
|
||||
|
||||
#ifdef OVERRIDE_BACKKEY
|
||||
void trapBackspaceKey( HWND hDlg );
|
||||
#else
|
||||
# define trapBackspaceKey( hDlg )
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -1,80 +0,0 @@
|
|||
// -*- mode: c; -*-
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_XWORDS4 ICON DISCARDABLE "xwords4.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_RIGHTARROW BITMAP DISCARDABLE "bmps/rightarrow.bmp"
|
||||
IDB_DOWNARROW BITMAP DISCARDABLE "bmps/downarro.bmp"
|
||||
IDB_ORIGIN BITMAP DISCARDABLE "bmps/origin.bmp"
|
||||
|
||||
#ifdef XWFEATURE_RELAY
|
||||
IDB_NETARROW BITMAP DISCARDABLE "bmps/netarrow.bmp"
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CLRS
|
||||
//
|
||||
|
||||
ID_COLORS_RES CLRS MOVEABLE PURE
|
||||
BEGIN
|
||||
0xAF, 0xAF, 0x00 /* bonus 1 */
|
||||
,0x00, 0xAF, 0xAF
|
||||
,0xAF, 0x00, 0xAF
|
||||
,0xAF, 0xAF, 0xAF
|
||||
,0xFF, 0xFF, 0xFF /* empty cells/CE_BKG_COLOR */
|
||||
,0xFF, 0xFF, 0x99 /* tile background */
|
||||
,0x70, 0x70, 0xFF /* focus */
|
||||
,0x00, 0x00, 0x00 /* player 1 */
|
||||
,0xFF, 0x00, 0x00
|
||||
,0x00, 0x00, 0xFF
|
||||
,0x00, 0x8F, 0x00 /* 8F: full-green contrasts badly with background */
|
||||
,0x00, 0x00, 0x00 /* black */
|
||||
,0xFF, 0xFF, 0xFF /* white */
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// BONS: bonus square values.
|
||||
//
|
||||
|
||||
// Butts' board
|
||||
ID_BONUS_RES BONS MOVEABLE PURE
|
||||
BEGIN
|
||||
0x4001, 0x0004,
|
||||
0x0200, 0x0300,
|
||||
0x0020, 0x0010,
|
||||
0x1002, 0x0001,
|
||||
0x0000, 0x2000,
|
||||
0x0300, 0x0300,
|
||||
0x0010, 0x0010,
|
||||
0x4001, 0x0002
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
#ifdef DEBUG
|
||||
IDS_APP_TITLE "Crossw_dbg"
|
||||
IDC_XWORDS4 "XWORDS4_DBG"
|
||||
#else
|
||||
IDS_APP_TITLE "Crosswords"
|
||||
IDC_XWORDS4 "XWORDS4"
|
||||
#endif
|
||||
END
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
// from http://msdn.microsoft.com/en-us/library/ms838191.aspx: don't
|
||||
// let WinMo draw 320x320 as 240x240
|
||||
HI_RES_AWARE CEUX {1}
|
||||
#endif
|
|
@ -1,161 +0,0 @@
|
|||
/* Copyright notice TBD by cegcc team.
|
||||
*/
|
||||
#ifndef _CONNMGR_H
|
||||
#define _CONNMGR_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef CONNMGR_API_LINKAGE
|
||||
# ifdef __W32API_USE_DLLIMPORT__
|
||||
# define CONNMGR_API_LINKAGE DECLSPEC_IMPORT
|
||||
# else
|
||||
# define CONNMGR_API_LINKAGE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This guy
|
||||
http://www.studio-odyssey.net/content/note/archive01.htm
|
||||
defines all the missing ones. Legit?
|
||||
*/
|
||||
|
||||
#define CONNMGR_PRIORITY_USERINTERACTIVE 0x8000
|
||||
/* CONNMGR_PRIORITY_USERBACKGROUND /\* unknown *\/ */
|
||||
/* CONNMGR_PRIORITY_USERIDLE /\* unknown *\/ */
|
||||
#define CONNMGR_PRIORITY_HIPRIBKGND 0x0200 /* HighPriorityBackground */
|
||||
#define CONNMGR_PRIORITY_IDLEBKGND 0x0008 /* LowPriorityBackground */
|
||||
/* CONNMGR_PRIORITY_EXTERNALINTERACTIVE /\* unknown *\/ */
|
||||
/* CONNMGR_PRIORITY_LOWBKGND /\* unknown *\/ */
|
||||
|
||||
/* dwParams options */
|
||||
#define CONNMGR_PARAM_GUIDDESTNET 0x1
|
||||
#define CONNMGR_PARAM_MAXCOST 0x2
|
||||
#define CONNMGR_PARAM_MINRCVBW 0x4
|
||||
#define CONNMGR_PARAM_MAXCONNLATENCY 0x8
|
||||
|
||||
/* dwFlags options for proxies */
|
||||
#define CONNMGR_FLAG_PROXY_HTTP 0x1
|
||||
#define CONNMGR_FLAG_PROXY_WAP 0x2
|
||||
#define CONNMGR_FLAG_PROXY_SOCKS4 0x4
|
||||
#define CONNMGR_FLAG_PROXY_SOCKS5 0x8
|
||||
|
||||
/* dwFlags options for control */
|
||||
/* CONNMGR_FLAG_SUSPEND_AWARE /\* studio-odyssey doesn't define *\/ */
|
||||
/* CONNMGR_FLAG_REGISTERED_HOME /\* unknown *\/ */
|
||||
/* CONNMGR_FLAG_NO_ERROR_MSGS /\* unknown *\/ */
|
||||
|
||||
/* status constants */
|
||||
#define CONNMGR_STATUS_UNKNOWN 0x00
|
||||
#define CONNMGR_STATUS_CONNECTED 0x10
|
||||
#define CONNMGR_STATUS_SUSPENDED 0x11
|
||||
#define CONNMGR_STATUS_DISCONNECTED 0x20
|
||||
#define CONNMGR_STATUS_CONNECTIONFAILED 0x21
|
||||
#define CONNMGR_STATUS_CONNECTIONCANCELED 0x22
|
||||
#define CONNMGR_STATUS_CONNECTIONDISABLED 0x23
|
||||
#define CONNMGR_STATUS_NOPATHTODESTINATION 0x24
|
||||
#define CONNMGR_STATUS_WAITINGFORPATH 0x25
|
||||
#define CONNMGR_STATUS_WAITINGFORPHONE 0x26
|
||||
#define CONNMGR_STATUS_PHONEOFF 0x27
|
||||
#define CONNMGR_STATUS_EXCLUSIVECONFLICT 0x28
|
||||
#define CONNMGR_STATUS_NORESOURCES 0x29
|
||||
#define CONNMGR_STATUS_CONNECTIONLINKFAILED 0x2a
|
||||
#define CONNMGR_STATUS_AUTHENTICATIONFAILED 0x2b
|
||||
#define CONNMGR_STATUS_NOPATHWITHPROPERTY 0x2c
|
||||
#define CONNMGR_STATUS_WAITINGCONNECTION 0x40
|
||||
#define CONNMGR_STATUS_WAITINGFORRESOURCE 0x41
|
||||
#define CONNMGR_STATUS_WAITINGFORNETWORK 0x42
|
||||
#define CONNMGR_STATUS_WAITINGDISCONNECTION 0x80
|
||||
#define CONNMGR_STATUS_WAITINGCONNECTIONABORT 0x81
|
||||
|
||||
/* from */
|
||||
typedef struct {
|
||||
DWORD cbSize;
|
||||
DWORD dwParams;
|
||||
DWORD dwFlags;
|
||||
DWORD dwPriority;
|
||||
BOOL bExclusive;
|
||||
BOOL bDisabled;
|
||||
GUID guidDestNet;
|
||||
HWND hWnd;
|
||||
UINT uMsg;
|
||||
LPARAM lParam;
|
||||
ULONG ulMaxCost;
|
||||
ULONG ulMinRcvBw;
|
||||
ULONG ulMaxConnLatency
|
||||
} CONNMGR_CONNECTIONINFO;
|
||||
|
||||
typedef struct {
|
||||
GUID guidDest;
|
||||
UINT64 uiStartTime;
|
||||
UINT64 uiEndTime;
|
||||
UINT64 uiPeriod;
|
||||
TCHAR szAppName[MAX_PATH];
|
||||
TCHAR szCmdLine[MAX_PATH];
|
||||
TCHAR szToken[32];
|
||||
BOOL bPiggyback;
|
||||
} SCHEDULEDCONNECTIONINFO;
|
||||
|
||||
#define CONNMGR_MAX_DESC 128
|
||||
typedef struct {
|
||||
GUID guid;
|
||||
TCHAR szDescription[CONNMGR_MAX_DESC];
|
||||
BOOL fSecure;
|
||||
} CONNMGR_DESTINATION_INFO;
|
||||
|
||||
typedef enum _ConnMgrConRefTypeEnum{
|
||||
ConRefType_NAP = 0,
|
||||
ConRefType_PROXY
|
||||
} ConnMgrConRefTypeEnum;
|
||||
|
||||
typedef struct _CONNMGR_CONNECTION_IPADDR {
|
||||
DWORD cIPAddr;
|
||||
SOCKADDR_STORAGE IPAddr[1]
|
||||
} CONNMGR_CONNECTION_IPADDR;
|
||||
|
||||
typedef struct _CONNMGR_CONNECTION_DETAILED_STATUS {
|
||||
struct _CONNMGR_CONNECTION_DETAILED_STATUS* pNext;
|
||||
DWORD dwVer;
|
||||
DWORD dwParams;
|
||||
DWORD dwType;
|
||||
DWORD dwSubtype;
|
||||
DWORD dwFlags;
|
||||
DWORD dwSecure;
|
||||
GUID guidDestNet;
|
||||
GUID guidSourceNet;
|
||||
TCHAR* szDescription;
|
||||
TCHAR* szAdapterName;
|
||||
DWORD dwConnectionStatus;
|
||||
SYSTEMTIME LastConnectTime;
|
||||
DWORD dwSignalQuality;
|
||||
CONNMGR_CONNECTION_IPADDR* pIPAddr;
|
||||
} CONNMGR_CONNECTION_DETAILED_STATUS;
|
||||
|
||||
HANDLE WINAPI ConnMgrApiReadyEvent( void );
|
||||
HRESULT WINAPI ConnMgrConnectionStatus(HANDLE, DWORD*);
|
||||
HRESULT WINAPI ConnMgrEnumDestinations(int,CONNMGR_DESTINATION_INFO*);
|
||||
HRESULT WINAPI ConnMgrEstablishConnection( CONNMGR_CONNECTIONINFO*, HANDLE*);
|
||||
HRESULT WINAPI ConnMgrEstablishConnectionSync( CONNMGR_CONNECTIONINFO*,
|
||||
HANDLE*,DWORD,DWORD*);
|
||||
HRESULT WINAPI ConnMgrMapConRef(ConnMgrConRefTypeEnum,LPCTSTR, GUID*);
|
||||
HRESULT WINAPI ConnMgrMapURL(LPTSTR,GUID*,DWORD*);
|
||||
HRESULT WINAPI ConnMgrProviderMessage(HANDLE,const GUID*,DWORD*,DWORD,DWORD,
|
||||
PBYTE,ULONG);
|
||||
HRESULT WINAPI ConnMgrQueryDetailedStatus( CONNMGR_CONNECTION_DETAILED_STATUS*,
|
||||
DWORD* );
|
||||
HRESULT WINAPI ConnMgrRegisterForStatusChangeNotification(BOOL,HWND);
|
||||
HRESULT WINAPI ConnMgrRegisterScheduledConnection(SCHEDULEDCONNECTIONINFO* );
|
||||
HRESULT WINAPI ConnMgrRegisterScheduledConnection(SCHEDULEDCONNECTIONINFO*);
|
||||
HRESULT WINAPI ConnMgrSetConnectionPriority( HANDLE,DWORD );
|
||||
HRESULT WINAPI ConnMgrUnregisterScheduledConnection(LPCWSTR);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _CONNMGR_H */
|
|
@ -1,102 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2006 by Eric House (xwords@eehouse.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.
|
||||
*/
|
||||
|
||||
#if defined _WIN32_WCE && defined USE_RAW_MINGW
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
/* #include "xptypes.h" */
|
||||
/* #include "debhacks.h" */
|
||||
|
||||
/* These should eventually be replaced by implementations moved into
|
||||
* mingw or the Debian pocketpc-sdk
|
||||
*/
|
||||
|
||||
/* These belong in mingw headers */
|
||||
wchar_t* wcscat( wchar_t *, const wchar_t * );
|
||||
wchar_t *wcscpy( wchar_t*,const wchar_t* );
|
||||
|
||||
wchar_t*
|
||||
lstrcatW( wchar_t *dest, const wchar_t* src )
|
||||
{
|
||||
return wcscat( dest, src );
|
||||
}
|
||||
|
||||
wchar_t*
|
||||
lstrcpyW( wchar_t* dest, const wchar_t* src )
|
||||
{
|
||||
return wcscpy( dest, src );
|
||||
}
|
||||
|
||||
int
|
||||
DialogBoxParamW( HINSTANCE hinst, LPCWSTR name, HWND hwnd,
|
||||
DLGPROC proc, LPARAM lparam )
|
||||
{
|
||||
HRSRC resstr = FindResource( hinst, name, RT_DIALOG );
|
||||
HGLOBAL lr = LoadResource( hinst, resstr );
|
||||
return DialogBoxIndirectParamW(hinst, lr, hwnd, proc, lparam );
|
||||
}
|
||||
|
||||
BOOL
|
||||
GetTextExtentPoint32W( HDC hdc, LPCWSTR str, int i, LPSIZE siz )
|
||||
{
|
||||
return GetTextExtentExPointW(hdc, str, i, 0, NULL, NULL, siz );
|
||||
}
|
||||
|
||||
/*
|
||||
see
|
||||
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcehardware5/html/wce50lrfCeLogImportTable.asp
|
||||
for how to implement SetEvent and ResetEvent in terms of EventModify
|
||||
|
||||
SetEvent(h)->pEventModify(h, EVENT_SET)
|
||||
|
||||
ResetEvent(h)->pEventModify(h, EVENT_RESET)
|
||||
|
||||
PulseEvent(h)->pEventModify(h, EVENT_PULSE)
|
||||
|
||||
http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=257 defines the constants,
|
||||
which are verified if this all works. :-)
|
||||
*/
|
||||
|
||||
enum {
|
||||
EVENT_PULSE = 1,
|
||||
EVENT_RESET = 2,
|
||||
EVENT_SET = 3
|
||||
};
|
||||
|
||||
BOOL
|
||||
debhack_SetEvent(HANDLE h)
|
||||
{
|
||||
return EventModify(h, EVENT_SET);
|
||||
}
|
||||
|
||||
BOOL
|
||||
debhack_ResetEvent(HANDLE h)
|
||||
{
|
||||
return EventModify(h, EVENT_RESET);
|
||||
}
|
||||
|
||||
DWORD
|
||||
GetCurrentThreadId(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* #ifdef _WIN32_WCE */
|
|
@ -1,94 +0,0 @@
|
|||
/* -*- fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 2006 by Eric House (xwords@eehouse.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 file should eventually go away as changes move up into the linux dev
|
||||
* tools
|
||||
*/
|
||||
|
||||
#ifndef _DEBHACKS_H_
|
||||
#define _DEBHACKS_H_
|
||||
|
||||
#if defined USE_RAW_MINGW
|
||||
|
||||
#ifdef USE_DEB_HACKS
|
||||
|
||||
#define DH(func) debhack_##func
|
||||
|
||||
typedef struct DH(WIN32_FIND_DATA) {
|
||||
DWORD dwFileAttributes;
|
||||
FILETIME dh_ftCreationTime;
|
||||
FILETIME dh_ftLastAccessTime;
|
||||
FILETIME dh_ftLastWriteTime;
|
||||
DWORD dh_nFileSizeHigh;
|
||||
DWORD dh_nFileSizeLow;
|
||||
DWORD dh_dwReserved1;
|
||||
WCHAR cFileName[MAX_PATH];
|
||||
} DH(WIN32_FIND_DATA);
|
||||
|
||||
DWORD DH(GetCurrentThreadId)(void);
|
||||
BOOL DH(SetEvent)(HANDLE);
|
||||
BOOL DH(ResetEvent)(HANDLE);
|
||||
|
||||
#else
|
||||
|
||||
#define DH(func) func
|
||||
|
||||
#endif
|
||||
|
||||
/* these are apparently defined in aygshell.h. I got the values by googling
|
||||
for 'define SHFS_SHOWTASKBAR' etc. They should eventually move into the
|
||||
mingw project's headers .*/
|
||||
|
||||
#define SHFS_SHOWTASKBAR 0x0001
|
||||
#define SHFS_HIDETASKBAR 0x0002
|
||||
#define SHFS_SHOWSIPBUTTON 0x0004
|
||||
#define SHFS_HIDESIPBUTTON 0x0008
|
||||
#define SHFS_SHOWSTARTICON 0x0010
|
||||
#define SHFS_HIDESTARTICON 0x0020
|
||||
|
||||
/* got this somewhere else via google */
|
||||
#define SHCMBF_HMENU 0x0010
|
||||
|
||||
#endif /* USE_RAW_MINGW */
|
||||
|
||||
#ifndef IME_ESC_SET_MODE
|
||||
# define IME_ESC_SET_MODE 0x0800
|
||||
#endif
|
||||
#ifndef IM_SPELL
|
||||
# define IM_SPELL 0
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1591512&SiteID=1 */
|
||||
#define IM_SPELL 0
|
||||
#define IME_ESC_SET_MODE 0x0800
|
||||
/* http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1476620&SiteID=1 */
|
||||
#define EIM_SPELL IM_SPELL
|
||||
/* http://wolfpack.twu.net/docs/gtkwin32/gdkprivate-win32.h */
|
||||
#define WM_IME_REQUEST 0x0288
|
||||
|
||||
/* http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1476620&SiteID=1 */
|
||||
#define EM_SETINPUTMODE 0x00DE
|
||||
|
||||
/* #define IMR_ISIMEAWARE 0 */
|
||||
/* #define IMEAF_AWARE 0 */
|
||||
/* #define IME_ESC_RETAIN_MODE_ICON 0 */
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,970 +0,0 @@
|
|||
// -*- mode: c; compile-command: "make TARGET_OS=wince DEBUG=TRUE"; -*-
|
||||
//
|
||||
// Microsoft Developer Studio generated resource script. But now I'm
|
||||
// editing it. :-)
|
||||
//
|
||||
#include "../resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "../newres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
#include "winnt.h"
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""winnt.h""\r\n"
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""newres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#include "contypct.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menubar
|
||||
//
|
||||
|
||||
IDM_MENU MENU DISCARDABLE
|
||||
BEGIN
|
||||
#ifndef _WIN32_WCE
|
||||
POPUP "BUTTON"
|
||||
BEGIN
|
||||
MENUITEM "--", W32_DUMMY_ID
|
||||
END
|
||||
#endif
|
||||
POPUP "MENU" // <- translate
|
||||
BEGIN
|
||||
MENUITEM "TURN DONE", ID_MOVE_TURNDONE // <- translate
|
||||
MENUITEM "JUGGLE", ID_MOVE_JUGGLE // <- translate
|
||||
MENUITEM "FLIP", ID_MOVE_FLIP // <- translate
|
||||
MENUITEM "TRADE", ID_MOVE_TRADE // <- translate
|
||||
MENUITEM "HIDE TRAY", ID_MOVE_HIDETRAY // <- translate
|
||||
|
||||
POPUP "UNDO" // <- translate
|
||||
BEGIN
|
||||
MENUITEM "UNDO CURRENT", ID_MOVE_UNDOCURRENT // <- translate
|
||||
MENUITEM "UNDO LAST", ID_MOVE_UNDOLAST // <- translate
|
||||
END
|
||||
|
||||
POPUP "HINT" // <- translate
|
||||
BEGIN
|
||||
MENUITEM "NEXT HINT", ID_MOVE_NEXTHINT // <- translate
|
||||
MENUITEM "Previous hint", ID_MOVE_PREVHINT
|
||||
MENUITEM "HINT", ID_MOVE_HINT // <- translate
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
MENUITEM "LIMITED HINT...", ID_MOVE_LIMITEDHINT // <- translate
|
||||
#endif
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "SHOW VALUES", ID_MOVE_VALUES // <- translate
|
||||
END
|
||||
|
||||
POPUP "GAME" // <- translate
|
||||
BEGIN
|
||||
MENUITEM "TILE COUNTS AND VALUES", ID_GAME_TILECOUNTSANDVALUES // <- translate
|
||||
MENUITEM "TILES LEFT", ID_GAME_TILESLEFT // <- translate
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "GAME INFO", ID_GAME_GAMEINFO // <- translate
|
||||
MENUITEM "HISTORY", ID_GAME_HISTORY // <- translate
|
||||
MENUITEM "FINAL SCORES", ID_GAME_FINALSCORES // <- translate
|
||||
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||
MENUITEM "RESEND MESSAGES", ID_GAME_RESENDMSGS // <- translate
|
||||
#endif
|
||||
END
|
||||
|
||||
POPUP "FILE" // <- translate
|
||||
BEGIN
|
||||
MENUITEM "FULL SCREEN", ID_FILE_FULLSCREEN // <- translate
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "NEW GAME...", ID_FILE_NEWGAME // <- translate
|
||||
MENUITEM "SAVED GAMES...", ID_FILE_SAVEDGAMES // <- translate
|
||||
MENUITEM "PREFERENCES...", ID_FILE_PREFERENCES // <- translate
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "ABOUT...", ID_FILE_ABOUT // <- translate
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "EXIT", ID_FILE_EXIT // <- translate
|
||||
END
|
||||
END
|
||||
END
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
// soft key bar described at
|
||||
// http://msdn2.microsoft.com/en-us/library/aa457781.aspx
|
||||
IDM_MAIN_MENUBAR RCDATA
|
||||
BEGIN
|
||||
IDM_MENU, 2,
|
||||
I_IMAGENONE, ID_INITIAL_SOFTID, TBSTATE_ENABLED,
|
||||
TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_DUMMY, 0,
|
||||
NOMENU,
|
||||
I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED,
|
||||
TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_MENU, 0,
|
||||
0 // Use the 0th popup above -- the only one
|
||||
END
|
||||
|
||||
IDM_OKCANCEL_MENUBAR RCDATA
|
||||
BEGIN
|
||||
0, 2,
|
||||
I_IMAGENONE, IDOK, TBSTATE_ENABLED,
|
||||
TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_OK, 0,
|
||||
NOMENU,
|
||||
I_IMAGENONE, IDCANCEL, TBSTATE_ENABLED,
|
||||
TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_CANCEL, 0,
|
||||
NOMENU
|
||||
END
|
||||
|
||||
IDM_OK_MENUBAR RCDATA
|
||||
BEGIN
|
||||
0, 1,
|
||||
I_IMAGENONE, IDOK, TBSTATE_ENABLED,
|
||||
TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_OK, 0,
|
||||
NOMENU
|
||||
END
|
||||
|
||||
IDM_DONE_MENUBAR RCDATA
|
||||
BEGIN
|
||||
0, 1,
|
||||
I_IMAGENONE, IDOK, TBSTATE_ENABLED,
|
||||
TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_DONE, 0,
|
||||
NOMENU
|
||||
END
|
||||
#endif
|
||||
|
||||
#include "../rc_incs.h"
|
||||
|
||||
DLL_VERS_RESOURCE
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
#define BUTTON_HT 12
|
||||
#define REPOS_BUTTON_HT BUTTON_HT
|
||||
#define REPOS_BUTTON_WIDTH 28
|
||||
#define REPOS_BUTTON_VPAD 2
|
||||
#define REPOS_BUTTON_HPAD 2
|
||||
|
||||
// ******** IDD_GAMEINFO DIALOG *********
|
||||
#ifdef CEFEATURE_CANSCROLL
|
||||
# define ROW_HEIGHT 10
|
||||
# define ROW_SPACE 12
|
||||
# define ROW_SPACE_PL 11
|
||||
#else
|
||||
# define ROW_HEIGHT 12
|
||||
# define ROW_SPACE 15
|
||||
# define ROW_SPACE_PL ROW_SPACE
|
||||
#endif
|
||||
#define CHECK_WIDTH 10
|
||||
#define LEFT_COL 2
|
||||
#ifdef XWFEATURE_STANDALONE_ONLY
|
||||
# define GAME_NAME_WIDTH 56
|
||||
# define GAME_LABEL_WIDTH (GAME_NAME_WIDTH-10)
|
||||
# define GAME_NAME_LEFT LEFT_COL
|
||||
# define GAME_ROBOT_LEFT (GAME_NAME_LEFT + GAME_NAME_WIDTH + 5)
|
||||
# define GAME_PWD_LEFT (GAME_ROBOT_LEFT + 15)
|
||||
# define NPLAYERS_ROW 3
|
||||
# define GAME_NAMELABEL_LEFT GAME_NAME_LEFT
|
||||
# define GAME_ROBOTLABEL_LEFT (GAME_ROBOT_LEFT-7)
|
||||
# define GAME_PWDLABEL_LEFT GAME_PWD_LEFT
|
||||
#else
|
||||
# define SERVERROLE_ROW 3
|
||||
# define GAME_NAME_WIDTH 56
|
||||
# define NPLAYERS_ROW (SERVERROLE_ROW+ROW_SPACE+3)
|
||||
# define GAME_REMOTE_LEFT 1
|
||||
# define GAME_NAME_LEFT 11
|
||||
# define GAME_ROBOT_LEFT (GAME_NAME_LEFT+GAME_NAME_WIDTH+2)
|
||||
# define GAME_PWD_LEFT (GAME_ROBOT_LEFT + CHECK_WIDTH + 4)
|
||||
# define GAME_NAMELABEL_LEFT (GAME_NAME_LEFT + 20)
|
||||
# define GAME_NAMELABEL_WIDTH (GAME_NAME_WIDTH-15)
|
||||
# define GAME_ROBOTLABEL_LEFT (GAME_ROBOT_LEFT-10)
|
||||
# define GAME_PWDLABEL_LEFT (GAME_PWD_LEFT)
|
||||
#endif
|
||||
|
||||
|
||||
#define LABELS_ROW (NPLAYERS_ROW+ROW_SPACE)
|
||||
#define PLAYER_ROW_1 (LABELS_ROW+ROW_SPACE_PL)
|
||||
#define PLAYER_ROW_2 (PLAYER_ROW_1+ROW_SPACE_PL)
|
||||
#define PLAYER_ROW_3 (PLAYER_ROW_2+ROW_SPACE_PL)
|
||||
#define PLAYER_ROW_4 (PLAYER_ROW_3+ROW_SPACE_PL)
|
||||
#define DICTPICK_LAB_ROW (PLAYER_ROW_4+ROW_SPACE+2)
|
||||
#define DICTPICK_ROW (DICTPICK_LAB_ROW+ROW_SPACE-2)
|
||||
#define PREFS_ROW (DICTPICK_ROW+ROW_SPACE+3)
|
||||
#ifndef _WIN32_WCE
|
||||
# define BUTTONS_ROW (PREFS_ROW+ROW_SPACE+3)
|
||||
#endif
|
||||
#ifdef _WIN32_WCE
|
||||
# define GAMEINFO_HEIGHT (PREFS_ROW + ROW_SPACE + 4)
|
||||
#else
|
||||
# define GAMEINFO_HEIGHT (BUTTONS_ROW + BUTTON_HT + 4)
|
||||
#endif
|
||||
|
||||
|
||||
/* in commctrl.h, but including isn't enough */
|
||||
#undef UPDOWN_CLASS
|
||||
#define UPDOWN_CLASS "msctls_updown32"
|
||||
|
||||
#define CE_PLAYER_ROW(nameEdit,playerRow,robotCheck,passEdit) \
|
||||
EDITTEXT nameEdit,GAME_NAME_LEFT,playerRow,GAME_NAME_WIDTH,ROW_HEIGHT, \
|
||||
ES_AUTOHSCROLL \
|
||||
CONTROL "",robotCheck,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, \
|
||||
GAME_ROBOT_LEFT,playerRow,CHECK_WIDTH,ROW_HEIGHT \
|
||||
EDITTEXT passEdit,GAME_PWD_LEFT,playerRow,15,ROW_HEIGHT, \
|
||||
ES_PASSWORD | ES_AUTOHSCROLL \
|
||||
|
||||
|
||||
IDD_GAMEINFO DIALOG DISCARDABLE 0, 0, 116, GAMEINFO_HEIGHT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
||||
CAPTION "GAME INFO" // <- translate GAME INFO
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
LTEXT "ROLE:",IDC_ROLELABEL,5,SERVERROLE_ROW,20,8
|
||||
XWCOMBO(IDC_ROLECOMBO,26,SERVERROLE_ROW,70,ROW_HEIGHT,0,58,0)
|
||||
PUSHBUTTON "CONF.",GIROLECONF_BUTTON,75,SERVERROLE_ROW,20,ROW_HEIGHT // <- translate CONF. (configure)
|
||||
|
||||
#endif
|
||||
|
||||
LTEXT "",IDC_TOTAL_LABEL,LEFT_COL,NPLAYERS_ROW,43,8
|
||||
XWCOMBO(IDC_NPLAYERSCOMBO,46,NPLAYERS_ROW,24,ROW_HEIGHT,0,58,0)
|
||||
|
||||
PUSHBUTTON "JUGL.",GIJUGGLE_BUTTON,75,NPLAYERS_ROW,20,ROW_HEIGHT // <- translate JUGL. (juggle)
|
||||
|
||||
LTEXT "NAME",IDC_NAMELABEL,GAME_NAMELABEL_LEFT, // <- translate NAME
|
||||
LABELS_ROW,GAME_NAMELABEL_WIDTH,8,SS_NOPREFIX
|
||||
LTEXT "ROBOT",IDC_ROBOTLABEL,GAME_ROBOTLABEL_LEFT,LABELS_ROW,22,8 // <- translate ROBOT
|
||||
LTEXT "PWD",IDC_PASSWDLABEL,GAME_PWDLABEL_LEFT,LABELS_ROW,16,8 // <- translate PWD (password)
|
||||
|
||||
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||
LTEXT "REMOTE",IDC_REMOTE_LABEL,LEFT_COL,LABELS_ROW,25,8,SS_NOPREFIX // <- translate REMOTE
|
||||
CONTROL "",REMOTE_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
GAME_REMOTE_LEFT, PLAYER_ROW_1,CHECK_WIDTH,ROW_HEIGHT
|
||||
CONTROL "",REMOTE_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
GAME_REMOTE_LEFT, PLAYER_ROW_2,CHECK_WIDTH,ROW_HEIGHT
|
||||
CONTROL "",REMOTE_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
GAME_REMOTE_LEFT, PLAYER_ROW_3,CHECK_WIDTH,ROW_HEIGHT
|
||||
CONTROL "",REMOTE_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
GAME_REMOTE_LEFT, PLAYER_ROW_4,CHECK_WIDTH,ROW_HEIGHT
|
||||
#endif
|
||||
CE_PLAYER_ROW( NAME_EDIT1, PLAYER_ROW_1, ROBOT_CHECK1, PASS_EDIT1 )
|
||||
CE_PLAYER_ROW( NAME_EDIT2, PLAYER_ROW_2, ROBOT_CHECK2, PASS_EDIT2 )
|
||||
CE_PLAYER_ROW( NAME_EDIT3, PLAYER_ROW_3, ROBOT_CHECK3, PASS_EDIT3 )
|
||||
CE_PLAYER_ROW( NAME_EDIT4, PLAYER_ROW_4, ROBOT_CHECK4, PASS_EDIT4 )
|
||||
|
||||
LTEXT "DICTIONARY:",IDC_DICTLABEL,LEFT_COL,DICTPICK_LAB_ROW,36,8, // <- translate DICTIONARY
|
||||
SS_NOPREFIX
|
||||
XWCOMBO(IDC_DICTLIST, LEFT_COL+10,DICTPICK_ROW,80,ROW_HEIGHT,LBS_SORT,58,CBS_SORT)
|
||||
|
||||
PUSHBUTTON "PREFERENCES...",OPTIONS_BUTTON,LEFT_COL,PREFS_ROW,55,12 // <- translate PREFERENCES....
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
PUSHBUTTON "OK",IDOK,29,BUTTONS_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT // <- translate OK
|
||||
DEFPUSHBUTTON "CANCEL",IDCANCEL,70,BUTTONS_ROW, // <- translate CANCEL
|
||||
REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
|
||||
#define SB_WIDTH 121
|
||||
#define SB_BUTTON_WIDTH 19
|
||||
#define SB_OK_LEFT ((SB_WIDTH/2)-10-SB_BUTTON_WIDTH)
|
||||
#define SB_CANCEL_LEFT ((SB_WIDTH/2)+10)
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define STRBOX_HT 81
|
||||
#else
|
||||
# define STRBOX_HT 97
|
||||
#endif
|
||||
|
||||
IDD_STRBOX DIALOG DISCARDABLE 0, 25, SB_WIDTH, STRBOX_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
||||
CAPTION "DIALOG" // <- translate DIALOG
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
EDITTEXT ID_EDITTEXT,3,3,115,76,ES_MULTILINE | ES_READONLY
|
||||
| WS_VSCROLL
|
||||
#ifndef _WIN32_WCE
|
||||
PUSHBUTTON "OK",IDOK, SB_OK_LEFT,81,SB_BUTTON_WIDTH,REPOS_BUTTON_HT // <- translate OK
|
||||
DEFPUSHBUTTON "NO",IDCANCEL,SB_CANCEL_LEFT,81,SB_BUTTON_WIDTH,REPOS_BUTTON_HT // <- translate NO
|
||||
#endif
|
||||
END
|
||||
|
||||
#define ASKB_DLG_WIDTH 80
|
||||
#define ASKB_COLLEFT 5
|
||||
#define ASKB_LABELTOP 0
|
||||
#define ASKB_LABELHT 36
|
||||
#define ASKB_LABELWIDTH 40
|
||||
#define ASKB_COMBOLEFT (ASKB_COLLEFT+ASKB_LABELWIDTH)
|
||||
#define ASKB_EDITTOP (ASKB_LABELTOP + ASKB_LABELHT)
|
||||
#define ASKB_EDITHT 24
|
||||
#define ASKB_PUTTOP (ASKB_EDITTOP+ASKB_EDITHT)
|
||||
#define WCE_BOTTOM (ASKB_PUTTOP + BUTTON_HT + 4)
|
||||
#ifdef _WIN32_WCE
|
||||
# define ASKB_DLG_HEIGHT WCE_BOTTOM
|
||||
#else
|
||||
# define ASKB_DLG_HEIGHT (WCE_BOTTOM + REPOS_BUTTON_HT + 4)
|
||||
#endif
|
||||
|
||||
|
||||
IDD_ASKBLANK DIALOG DISCARDABLE 0, 0, ASKB_DLG_WIDTH, ASKB_DLG_HEIGHT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
|
||||
CAPTION "TILE PICKER"
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "ENTER A LETTER FOR THIS BLANK TILE.",IDC_BPICK,
|
||||
ASKB_COLLEFT,ASKB_LABELTOP,ASKB_LABELWIDTH,ASKB_LABELHT
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
LTEXT "PICK A TILE FOR YOUR TRAY.",IDC_CPICK,
|
||||
ASKB_COLLEFT,ASKB_LABELTOP,ASKB_LABELWIDTH,ASKB_LABELHT
|
||||
EDITTEXT IDC_PICKMSG,ASKB_COLLEFT,ASKB_EDITTOP,80,ASKB_EDITHT,
|
||||
ES_MULTILINE | ES_READONLY
|
||||
|
||||
PUSHBUTTON "PUT BACK",IDC_BACKUP,ASKB_COLLEFT,ASKB_PUTTOP,35,14
|
||||
#endif
|
||||
|
||||
XWCOMBO(BLANKFACE_LIST,ASKB_COMBOLEFT,ASKB_COLLEFT,27,12,0,70,0)
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,80,WCE_BOTTOM,REPOS_BUTTON_WIDTH, BUTTON_HT
|
||||
PUSHBUTTON "CANCEL",IDCANCEL,20,WCE_BOTTOM,REPOS_BUTTON_WIDTH, BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
|
||||
#define SVGN_LEFT_COL 2
|
||||
#define SVGN_ROW_1 2
|
||||
#define SVGN_LTEXT_HT 46
|
||||
#define SVGN_ROW_2 (SVGN_ROW_1+SVGN_LTEXT_HT)
|
||||
#define SVGN_ROW_3 (SVGN_ROW_2+18)
|
||||
#ifdef _WIN32_WCE
|
||||
# define SVGN_DLG_HT SVGN_ROW_3
|
||||
#else
|
||||
# define SVGN_DLG_HT (SVGN_ROW_3+BUTTON_HT+3)
|
||||
#endif
|
||||
|
||||
IDD_SAVENAMEDLG DIALOG DISCARDABLE 0, 0, 90, SVGN_DLG_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
|
||||
CAPTION "GAME NAME" // <- translate GAME NAME
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "",
|
||||
IDC_SVGN_SELLAB,SVGN_LEFT_COL,SVGN_ROW_1,86,SVGN_LTEXT_HT
|
||||
EDITTEXT IDC_SVGN_EDIT,SVGN_LEFT_COL,SVGN_ROW_2,86,12,
|
||||
ES_AUTOHSCROLL
|
||||
#ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,SVGN_LEFT_COL+10,SVGN_ROW_3,REPOS_BUTTON_WIDTH, // <- translate OK
|
||||
BUTTON_HT
|
||||
PUSHBUTTON "CANCEL",IDCANCEL,SVGN_LEFT_COL+10+REPOS_BUTTON_WIDTH+10, // <- translate CANCEL
|
||||
SVGN_ROW_3,REPOS_BUTTON_WIDTH, BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
|
||||
#define SVGM_LEFT_COL 2
|
||||
#define SVGM_ROW_1 2
|
||||
#define SVGM_ROW_2 (SVGM_ROW_1+35)
|
||||
#define SVGM_ROW_3 (SVGM_ROW_2+13)
|
||||
#define SVGM_ROW_4 (SVGM_ROW_3+19)
|
||||
#ifdef _WIN32_WCE
|
||||
/* # define SVGM_DLG_HT (SVGM_ROW_3) */
|
||||
# define SVGM_DLG_HT (SVGM_ROW_4+16)
|
||||
|
||||
#else
|
||||
# define SVGM_ROW_OK (SVGM_ROW_4 + 21)
|
||||
# define SVGM_DLG_HT (SVGM_ROW_OK + 16)
|
||||
#endif
|
||||
|
||||
|
||||
IDD_SAVEDGAMESDLG DIALOG DISCARDABLE 0, 0, 85, SVGM_DLG_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
||||
CAPTION "SAVED GAMES" // <- translate SAVED GAMES
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT /* wince windres can't handle split lines....*/
|
||||
"SELECT A SAVED GAME. (SOME BUTTONS WILL BE DISABLED WHEN THE CURRENT GAME IS SELECTED.)",
|
||||
// ^- translate SELECT A SAVED GAME. (SOME BUTTONS WILL BE DISABLED WHEN THE CURRENT GAME IS SELECTED.)
|
||||
IDC_SVGM_SELLAB,SVGM_LEFT_COL,
|
||||
SVGM_ROW_1,90,35
|
||||
XWCOMBO(IDC_SVGM_GAMELIST, SVGM_LEFT_COL,SVGM_ROW_2,70,ROW_HEIGHT,LBS_SORT,58,CBS_SORT)
|
||||
|
||||
PUSHBUTTON "OPEN",IDC_SVGM_OPEN, // <- translate OPEN
|
||||
SVGM_LEFT_COL,SVGM_ROW_3,40,14,WS_DISABLED
|
||||
|
||||
PUSHBUTTON "DUP.",IDC_SVGM_DUP, // <- translate DUP. (=duplicate)
|
||||
SVGM_LEFT_COL,SVGM_ROW_4,20,14,WS_DISABLED
|
||||
PUSHBUTTON "DELETE",IDC_SVGM_DEL, // <- translate DELETE
|
||||
SVGM_LEFT_COL+22,SVGM_ROW_4,28,14,WS_DISABLED
|
||||
PUSHBUTTON "RENAME",IDC_SVGM_CHANGE, // <- translate RENAME
|
||||
SVGM_LEFT_COL+52,SVGM_ROW_4,32,14,WS_DISABLED
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "DONE",IDOK,SVGM_LEFT_COL,SVGM_ROW_OK,REPOS_BUTTON_WIDTH, // <- translate DONE
|
||||
BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
|
||||
#define PW_WIDTH 104
|
||||
#define PW_OK_LEFT ((PW_WIDTH/2)-10-REPOS_BUTTON_WIDTH)
|
||||
#define PW_CANCEL_LEFT ((PW_WIDTH/2)+10)
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define ASKPASS_HT 32
|
||||
#else
|
||||
# define ASKPASS_HT 50
|
||||
#endif
|
||||
|
||||
IDD_ASKPASS DIALOG DISCARDABLE 0, 0, PW_WIDTH, ASKPASS_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
|
||||
CAPTION "PASSWORD" // <- translate PASSWORD
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "",IDC_PWDLABEL,5,8,67,24
|
||||
EDITTEXT PASS_EDIT,76,8,23,12,ES_PASSWORD | ES_AUTOHSCROLL
|
||||
#ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,PW_OK_LEFT,32,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT // <- translate OK
|
||||
PUSHBUTTON "CANCEL",IDCANCEL, // <- translate TILE HINT CANCEL
|
||||
PW_CANCEL_LEFT,32,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
#define HC_LABELS_COL 5
|
||||
#define HC_DROPDOWNS_COL 70
|
||||
#define HC_MINROW 3
|
||||
#define HC_MAXROW 16
|
||||
#define HC_WIDTH 98
|
||||
#define HC_OK_LEFT ((HC_WIDTH/2)-10-REPOS_BUTTON_WIDTH)
|
||||
#define HC_CANCEL_LEFT ((HC_WIDTH/2)+10)
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define ASKHINTLIMTS_HT 31
|
||||
#else
|
||||
# define ASKHINTLIMTS_HT 47
|
||||
#endif
|
||||
|
||||
IDD_ASKHINTLIMTS DIALOG DISCARDABLE 0, 0, HC_WIDTH, ASKHINTLIMTS_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
|
||||
CAPTION "TILE HINT LIMITS" // <- translate TILE HINT LIMITS
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "USE AT LEAST:",HC_MIN_LABEL, // <- translate USE AT LEAST:
|
||||
HC_LABELS_COL,HC_MINROW,60,ROW_HEIGHT
|
||||
XWCOMBO(HC_MIN_COMBO, HC_DROPDOWNS_COL,HC_MINROW, 24, ROW_HEIGHT, 0,58,0)
|
||||
|
||||
LTEXT "BUT NO MORE THAN:",HC_MAX_LABEL,HC_LABELS_COL,HC_MAXROW,60,ROW_HEIGHT // <- translate BUT NO MORE THAN
|
||||
XWCOMBO(HC_MAX_COMBO, HC_DROPDOWNS_COL,HC_MAXROW, 24, ROW_HEIGHT,0,58,0)
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,HC_OK_LEFT,31,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT // <- translate OK
|
||||
PUSHBUTTON "CANCEL",IDCANCEL,HC_CANCEL_LEFT,31,REPOS_BUTTON_WIDTH, // <- translate CANCEL
|
||||
REPOS_BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
#endif
|
||||
|
||||
#define PR_WIDTH 118
|
||||
#define PR_OK_LEFT ((PR_WIDTH/2)-10-REPOS_BUTTON_WIDTH)
|
||||
#define PR_CANCEL_LEFT ((PR_WIDTH/2)+10)
|
||||
#define PREFS_ROW_HT 9
|
||||
|
||||
#define PR_SPACING 13
|
||||
#define PR_ROW1 5
|
||||
#define PR_ROW2 (PR_ROW1+PR_SPACING)
|
||||
#define PR_ROW3 (PR_ROW2+PR_SPACING)
|
||||
#define PR_ROW4 (PR_ROW3+PR_SPACING)
|
||||
#define PR_ROW5 (PR_ROW4+PR_SPACING)
|
||||
#define PR_ROW6 (PR_ROW5+PR_SPACING)
|
||||
#define PR_ROW7 (PR_ROW6+PR_SPACING)
|
||||
#define PR_BUTTONROW (PR_ROW7+PR_SPACING)
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define PREFS_DLG_HT PR_BUTTONROW
|
||||
#else
|
||||
# define PREFS_DLG_HT (PR_BUTTONROW+PR_SPACING+3)
|
||||
#endif
|
||||
|
||||
IDD_OPTIONSDLG DIALOG DISCARDABLE 0, 20, PR_WIDTH, PREFS_DLG_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
||||
CAPTION "PREFERENCES" // <- translate PREFERENCES
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
CONTROL "THIS GAME",IDC_RADIOLOCAL,"Button", // <- translate THIS GAME
|
||||
BS_AUTORADIOBUTTON | WS_GROUP,4,PR_ROW1,47,10
|
||||
CONTROL "ALL GAMES",IDC_RADIOGLOBAL,"Button", // <- translate ALL GAMES
|
||||
BS_AUTORADIOBUTTON,52,PR_ROW1,53,10
|
||||
|
||||
/* Global */
|
||||
CONTROL "COLOR PLAYED TILES",IDC_CHECKCOLORPLAYED,"Button", // <- translate COLOR PLAYED TILES
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,
|
||||
8,PR_ROW2,80,PREFS_ROW_HT
|
||||
CONTROL "ENABLE CURSOR",IDC_CHECKSHOWCURSOR,"Button", // <- translate ENABLE CURSOR
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW3,80,PREFS_ROW_HT
|
||||
CONTROL "EXPLAIN ROBOT SCORES",IDC_CHECKROBOTSCORES,"Button", // <- translate EXPLAIN ROBOT SCORES
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW4,80,PREFS_ROW_HT
|
||||
CONTROL "HIDE TILE VALUES",IDC_HIDETILEVALUES,"Button", // <- translate HIDE TILE VALUES
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW5,80,PREFS_ROW_HT
|
||||
PUSHBUTTON "EDIT COLORS...",IDC_PREFCOLORS,8,PR_ROW6,60,12 // <- translate EDIT COLORS...
|
||||
PUSHBUTTON "CHANGE LANGUAGE...",IDC_PREFLOCALE,8,PR_ROW7,75,12 // <- translate CHANGE LANGUAGE
|
||||
#ifdef ALLOW_CHOOSE_FONTS
|
||||
PUSHBUTTON "CHOOSE FONT...",IDC_PREFFONTS,8,PR_ROW8,60,12 // <- translate CHOOSE FONT...
|
||||
#endif
|
||||
|
||||
/* Per game */
|
||||
CONTROL "SMART ROBOT",IDC_CHECKSMARTROBOT,"Button", // <- translate SMART ROBOT
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,8,PR_ROW2,60,
|
||||
PREFS_ROW_HT
|
||||
CONTROL "ALLOW HINTS",IDC_CHECKHINTSOK,"Button", // <- translate ALLOW HINTS
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW3,60,PREFS_ROW_HT
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
CONTROL "HINT LIMITS",IDC_CHECKHINTSLIMITS,"Button", // <- translate HINT LIMITS
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8+10,PR_ROW4-2,50,10
|
||||
#endif
|
||||
CONTROL "TIMER ON (MINUTES)",TIMER_CHECK,"Button", // <- translate TIMER ON (MINUTES)
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW5,75,PREFS_ROW_HT
|
||||
EDITTEXT TIMER_EDIT,85,PR_ROW5,16,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "PHONIES:",PHONIES_LABEL,8,PR_ROW6,28,PREFS_ROW_HT // <- translate PHONIES:
|
||||
XWCOMBO(PHONIES_COMBO, 38,PR_ROW6,50,PREFS_ROW_HT, 0,58,0)
|
||||
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
CONTROL "PICK TILES FACE-UP", IDC_PICKTILES, "Button", // <- translate PICK TILES FACE-UP
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW7,90,PREFS_ROW_HT
|
||||
#else
|
||||
#endif
|
||||
#ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,PR_OK_LEFT,PR_BUTTONROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT // <- translate OK
|
||||
PUSHBUTTON "CANCEL",IDCANCEL,PR_CANCEL_LEFT,PR_BUTTONROW, // <- translate CANCEL
|
||||
REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
|
||||
# define LAB_COL 5
|
||||
# define LAB_COL_WIDTH 38
|
||||
# define CTRL_COL 15
|
||||
# define CTRL_COL_WIDTH 80
|
||||
# define CONN_ROW_1 2
|
||||
# define CONN_ROW_2 (CONN_ROW_1+ROW_SPACE)
|
||||
# ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
# define CONN_ROW_3 (CONN_ROW_2+ROW_SPACE)
|
||||
# define CONN_ROW_4 (CONN_ROW_3+ROW_SPACE+ROW_HEIGHT)
|
||||
# else
|
||||
# define CONN_ROW_3 (CONN_ROW_1)
|
||||
# define CONN_ROW_4 (CONN_ROW_2+ROW_SPACE)
|
||||
# endif
|
||||
# define CONN_ROW_5 (CONN_ROW_4+ROW_SPACE)
|
||||
# define CONN_ROW_6 (CONN_ROW_5+ROW_SPACE)
|
||||
# define CONN_ROW_7 (CONN_ROW_6+ROW_SPACE)
|
||||
# define CONN_ROW_8 (CONN_ROW_7+ROW_SPACE)
|
||||
# define BUTTON_ROW (CONN_ROW_8+ROW_SPACE)
|
||||
#ifdef _WIN32_WCE
|
||||
# define CONNSDLG_HT BUTTON_ROW
|
||||
#else
|
||||
# define CONNSDLG_HT (BUTTON_ROW+ROW_SPACE+3)
|
||||
#endif
|
||||
|
||||
/* #This is a comment???? */
|
||||
IDD_CONNSSDLG DIALOG DISCARDABLE 0, 20, 120, CONNSDLG_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
||||
CAPTION "CONNECTION" // <- translate CONNECTION
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
LTEXT "CONNECT VIA:",IDC_CCONVIA_LAB,LAB_COL,CONN_ROW_1,40,
|
||||
ROW_HEIGHT // <- translate CONNECT VIA:
|
||||
XWCOMBO(IDC_CONNECT_COMBO, CTRL_COL,CONN_ROW_2,CTRL_COL_WIDTH,
|
||||
ROW_HEIGHT, 0,58,0)
|
||||
#endif
|
||||
|
||||
#ifdef XWFEATURE_RELAY
|
||||
LTEXT "INVITE:",IDC_INVITE_LAB,LAB_COL,CONN_ROW_3,40,ROW_HEIGHT // <- translate INVITE:
|
||||
EDITTEXT INVITE_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT,
|
||||
ES_AUTOHSCROLL
|
||||
|
||||
LTEXT "RELAY NAME (RARELY CHANGES):",IDC_CRELAYNAME_LAB, // <- translate RELAY NAME (RARELY CHANGES):
|
||||
LAB_COL,CONN_ROW_5,120,ROW_HEIGHT
|
||||
EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH,ROW_HEIGHT,
|
||||
ES_AUTOHSCROLL
|
||||
LTEXT "RELAY PORT (RARELY CHANGES):",IDC_CRELAYPORT_LAB, // <- translate RELAY PORT (RARELY CHANGES):
|
||||
LAB_COL,CONN_ROW_7,120,ROW_HEIGHT
|
||||
EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_ROW_8,CTRL_COL_WIDTH,ROW_HEIGHT,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
#else
|
||||
LTEXT "RELAY CONNECTION NOT SUPPORTED.",IDC_INVITE_LAB, // <- translate RELAY CONNECTION NOT SUPPORTED
|
||||
LAB_COL,CONN_ROW_3,40,40
|
||||
#endif
|
||||
|
||||
#ifdef XWFEATURE_IP_DIRECT
|
||||
LTEXT "HOST NAME OR ADDRESS",IDC_IPNAME_LAB, // <- translate HOST NAME OR ADDRESS
|
||||
LAB_COL,CONN_ROW_3,100,ROW_HEIGHT
|
||||
EDITTEXT IPNAME_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT,ES_AUTOHSCROLL
|
||||
#else
|
||||
LTEXT "DIRECT IP CONNECTION NOT SUPPORTED.",IDC_IPNAME_LAB, // <- translate DIRECT IP CONNECTION NOT SUPPORTED
|
||||
LAB_COL,CONN_ROW_3,40,40
|
||||
#endif
|
||||
|
||||
#ifdef XWFEATURE_SMS
|
||||
LTEXT "HOST PHONE:",IDC_SMS_PHONE_LAB,LAB_COL,CONN_ROW_3,60,ROW_HEIGHT // <- translate HOST PHONE:
|
||||
EDITTEXT IDC_SMS_PHONE_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "HOST PORT:",IDC_SMS_PORT_LAB,LAB_COL,CONN_ROW_5,60,ROW_HEIGHT // <- translate HOST PORT:
|
||||
EDITTEXT IDC_SMS_PORT_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH,ROW_HEIGHT,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
#else
|
||||
LTEXT "TEXTING NOT SUPPORTED.", // <- translate TEXTING NOT SUPPORTED
|
||||
IDC_SMS_PHONE_LAB,LAB_COL,CONN_ROW_3,40,ROW_HEIGHT
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
PUSHBUTTON "OK",IDOK,9,BUTTON_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT // <- translate EDIT
|
||||
DEFPUSHBUTTON "CANCEL",IDCANCEL,70,BUTTON_ROW, // <- translate EDIT
|
||||
REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
#endif
|
||||
|
||||
#define CLR_WIDTH 114
|
||||
#define CLR_OK_LEFT ((CLR_WIDTH/2)-10-REPOS_BUTTON_WIDTH)
|
||||
#define CLR_CANCEL_LEFT ((CLR_WIDTH/2)+10)
|
||||
#define CLR_LAB_WIDTH 45
|
||||
#define CLR_SAMPLE_WIDTH 12
|
||||
#define CLR_LAB_HT 12
|
||||
#define CLR_BUT_WIDTH 12
|
||||
#define CLR_BUT_HT 10
|
||||
|
||||
#define CLR_SMALL_GAP 12
|
||||
#define CLR_LRG_GAP 16
|
||||
|
||||
#define CLR_ROW_1 4
|
||||
#define CLR_ROW_2 (CLR_ROW_1+CLR_SMALL_GAP)
|
||||
#define CLR_ROW_3 (CLR_ROW_2+CLR_SMALL_GAP)
|
||||
#define CLR_ROW_4 (CLR_ROW_3+CLR_SMALL_GAP)
|
||||
#define CLR_ROW_5 (CLR_ROW_4+CLR_LRG_GAP)
|
||||
#define CLR_ROW_6 (CLR_ROW_5+CLR_SMALL_GAP)
|
||||
#define CLR_ROW_7 (CLR_ROW_6+CLR_SMALL_GAP)
|
||||
#define CLR_ROW_8 (CLR_ROW_7+CLR_LRG_GAP)
|
||||
#define CLR_ROW_9 (CLR_ROW_8+CLR_SMALL_GAP)
|
||||
#define CLR_ROW_10 (CLR_ROW_9+CLR_SMALL_GAP)
|
||||
#define CLR_ROW_11 (CLR_ROW_10+CLR_SMALL_GAP)
|
||||
|
||||
#define CLR_BUTTON_ROW CLR_ROW_11 + CLR_LRG_GAP
|
||||
#define CLR_COL_1 7
|
||||
#define CLR_COL_2 (CLR_COL_1 + CLR_LAB_WIDTH+2)
|
||||
/* #define CLR_COL_3 58 */
|
||||
/* #define CLR_COL_4 99 */
|
||||
#define CLR_COL_3 CLR_COL_1
|
||||
#define CLR_COL_4 CLR_COL_2
|
||||
#ifdef _WIN32_WCE
|
||||
# define COLORSDLG_HT CLR_BUTTON_ROW
|
||||
#else
|
||||
# define COLORSDLG_HT CLR_BUTTON_ROW + BUTTON_HT + 3
|
||||
#endif
|
||||
|
||||
#define COLOR_BUTTON(txt,id,xx,yy) \
|
||||
LTEXT txt,id,xx,yy,CLR_LAB_WIDTH,CLR_LAB_HT
|
||||
/* Hack alert. Smartphone isn't delivering WM_COMMAND events for
|
||||
clicks on BS_OWNERDRAW buttons, and WinMo (PPC and Smartphone)
|
||||
won't deliver WM_DRAWITEM events for SS_OWNERDRAW static
|
||||
controls. The solution: use an OWNERDRAW button as the color
|
||||
sample (must disable it in code; WS_DISABLED doesn't work here)
|
||||
and have a separate button to trigger the edit dialog. */
|
||||
#define COLOR_SAMPLE(id1,id2,xx,yy) \
|
||||
PUSHBUTTON "",id2,xx,yy,CLR_BUT_WIDTH,CLR_BUT_HT,BS_OWNERDRAW \
|
||||
PUSHBUTTON "EDIT",id1,xx+CLR_SAMPLE_WIDTH+4,yy,20,CLR_BUT_HT,BS_NOTIFY // <- translate EDIT
|
||||
|
||||
IDD_COLORSDLG DIALOG DISCARDABLE 0, 20, CLR_WIDTH, COLORSDLG_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
||||
CAPTION "COLOR PREFERENCES" // <- translate COLOR PREFERENCES
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
COLOR_BUTTON("DOUBLE LETTER:",DLBLTR_LABEL,CLR_COL_1,CLR_ROW_1) // <- translate DOUBLE LETTER
|
||||
COLOR_SAMPLE(DLBLTR_BUTTON,DLBLTR_SAMPLE,CLR_COL_2,CLR_ROW_1)
|
||||
|
||||
COLOR_BUTTON("DOUBLE WORD:",DBLWRD_LABEL,CLR_COL_1,CLR_ROW_2 ) // <- translate DOUBLE WORD
|
||||
COLOR_SAMPLE(DBLWRD_BUTTON,DBLWRD_SAMPLE,CLR_COL_2,CLR_ROW_2)
|
||||
COLOR_BUTTON("TRIPLE LETTER:",TPLLTR_LABEL,CLR_COL_1,CLR_ROW_3 ) // <- translate TRIPLE LETTER
|
||||
COLOR_SAMPLE(TPLLTR_BUTTON,TPLLTR_SAMPLE,CLR_COL_2,CLR_ROW_3)
|
||||
|
||||
COLOR_BUTTON("TRIPLE WORD:",TPLWRD_LABEL,CLR_COL_3,CLR_ROW_4) // <- translate TRIPLE WORD
|
||||
COLOR_SAMPLE(TPLWRD_BUTTON,TPLWRD_SAMPLE,CLR_COL_4,CLR_ROW_4)
|
||||
COLOR_BUTTON("EMPTY CELL:",EMPCELL_LABEL,CLR_COL_1,CLR_ROW_5) // <- translate EMPTY CELL
|
||||
COLOR_SAMPLE(EMPCELL_BUTTON,EMPCELL_SAMPLE,CLR_COL_2,CLR_ROW_5)
|
||||
COLOR_BUTTON("TILE BACK:",TBACK_LABEL,CLR_COL_3,CLR_ROW_6) // <- translate TILE BACK
|
||||
COLOR_SAMPLE(TBACK_BUTTON,TBACK_SAMPLE,CLR_COL_4,CLR_ROW_6)
|
||||
COLOR_BUTTON("FOCUS COLOR:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_7) // <- translate FOCUS COLOR
|
||||
COLOR_SAMPLE(FOCUSCLR_BUTTON,FOCUSCLR_SAMPLE,CLR_COL_2,CLR_ROW_7)
|
||||
COLOR_BUTTON("PLAYER 1:",PLAYER1_LABEL,CLR_COL_1,CLR_ROW_8) // <- translate PLAYER 1
|
||||
COLOR_SAMPLE(PLAYER1_BUTTON,PLAYER1_SAMPLE,CLR_COL_2,CLR_ROW_8)
|
||||
COLOR_BUTTON("PLAYER 2:",PLAYER2_LABEL,CLR_COL_3,CLR_ROW_9) // <- translate PLAYER 2
|
||||
COLOR_SAMPLE(PLAYER2_BUTTON,PLAYER2_SAMPLE,CLR_COL_4,CLR_ROW_9)
|
||||
COLOR_BUTTON("PLAYER 3:",PLAYER3_LABEL,CLR_COL_1,CLR_ROW_10) // <- translate PLAYER 3
|
||||
COLOR_SAMPLE(PLAYER3_BUTTON,PLAYER3_SAMPLE,CLR_COL_2,CLR_ROW_10)
|
||||
COLOR_BUTTON("PLAYER 4:",PLAYER4_LABEL,CLR_COL_3,CLR_ROW_11) // <- translate PLAYER 4
|
||||
COLOR_SAMPLE(PLAYER4_BUTTON,PLAYER4_SAMPLE,CLR_COL_4,CLR_ROW_11)
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,CLR_OK_LEFT,CLR_BUTTON_ROW, // <- translate OK
|
||||
REPOS_BUTTON_WIDTH,BUTTON_HT,BS_NOTIFY
|
||||
PUSHBUTTON "CANCEL",IDCANCEL,CLR_CANCEL_LEFT,CLR_BUTTON_ROW, // <- translate CANCEL
|
||||
REPOS_BUTTON_WIDTH,BUTTON_HT,BS_NOTIFY
|
||||
#endif
|
||||
END
|
||||
|
||||
//
|
||||
// Editor for individual colors
|
||||
//
|
||||
#ifdef MY_COLOR_SEL
|
||||
|
||||
# define CLRE_LAB_WIDTH 22
|
||||
# define CLEDIT_WIDTH 18
|
||||
# define CLSLIDER_WIDTH 30
|
||||
# define CLSAMPLE_WIDTH 15
|
||||
|
||||
# define CLRELABEL_COL 3
|
||||
# define CLREEDIT_COL (CLRELABEL_COL+CLRE_LAB_WIDTH+2)
|
||||
# define CLRESLIDER_COL (CLREEDIT_COL+CLEDIT_WIDTH+3)
|
||||
# define CLSAMPLE_COL (CLRESLIDER_COL+CLSLIDER_WIDTH+5)
|
||||
# define CLRE_LAB_HT 12
|
||||
# define CLREDIT_ROW_1 5
|
||||
# define CLREDIT_ROW_2 21
|
||||
# define CLREDIT_ROW_3 37
|
||||
# define CLRE_WIDTH (CLSAMPLE_COL+CLSAMPLE_WIDTH+5)
|
||||
# define CLRE_OK_LEFT ((CLRE_WIDTH/2)-10-REPOS_BUTTON_WIDTH)
|
||||
# define CLRE_CANCEL_LEFT ((CLRE_WIDTH/2)+10)
|
||||
# ifdef _WIN32_WCE
|
||||
# define COLOREDITDLG_HT 56
|
||||
# else
|
||||
# define COLOREDITDLG_HT 72
|
||||
# endif
|
||||
|
||||
# define COLOR_EDIT_LINE(txt,row,labelId,editId,sliderId) \
|
||||
LTEXT txt,labelId,CLRELABEL_COL,row, \
|
||||
CLRE_LAB_WIDTH,CLRE_LAB_HT \
|
||||
EDITTEXT editId,CLREEDIT_COL,row,CLEDIT_WIDTH,12, \
|
||||
ES_AUTOHSCROLL | ES_NUMBER \
|
||||
CONTROL "",sliderId,"msctls_trackbar32", \
|
||||
TBS_BOTH|TBS_NOTICKS|WS_TABSTOP, \
|
||||
CLRESLIDER_COL,row,CLSLIDER_WIDTH,12
|
||||
|
||||
IDD_COLOREDITDLG DIALOG DISCARDABLE 0, 0, CLRE_WIDTH, COLOREDITDLG_HT
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
|
||||
CAPTION "" /* set by code */
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
COLOR_EDIT_LINE("RED:", CLREDIT_ROW_1, RED_LABEL, RED_EDIT, CLREDT_SLIDER1 ) // <- translate RED
|
||||
COLOR_EDIT_LINE("GREEN:", CLREDIT_ROW_2, GREEN_LABEL, GREEN_EDIT, CLREDT_SLIDER2 ) // <- translate GREEN
|
||||
COLOR_EDIT_LINE("BLUE:", CLREDIT_ROW_3, BLUE_LABEL, BLUE_EDIT, CLREDT_SLIDER3 ) // <- translate BLUE
|
||||
|
||||
/* See hack alert above. Bogus owner-draw button seems the only way to get a sample
|
||||
color rect into the dialog. */
|
||||
PUSHBUTTON "",CLSAMPLE_BUTTON_ID,CLSAMPLE_COL,CLREDIT_ROW_1,
|
||||
CLSAMPLE_WIDTH,CLREDIT_ROW_3-CLREDIT_ROW_1+CLRE_LAB_HT,BS_OWNERDRAW
|
||||
|
||||
# ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,CLRE_OK_LEFT,56,REPOS_BUTTON_WIDTH, // <- translate OK
|
||||
REPOS_BUTTON_HT
|
||||
PUSHBUTTON "CANCEL",IDCANCEL,CLRE_CANCEL_LEFT,56,REPOS_BUTTON_WIDTH, // <- translate CANCEL
|
||||
REPOS_BUTTON_HT
|
||||
# endif
|
||||
END
|
||||
#endif
|
||||
|
||||
|
||||
IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 95
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
|
||||
CAPTION "LANGUAGE PICKER"// <- translate
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "CHOOSE THE LANGUAGE FOR MENUS AND DIALOG TEXT. (YOU CAN DOWNLOAD SUPPORT FILES FOR NEW LANGUAGES FROM xwords.sf.net.)",// <- translate
|
||||
LOCALES_LABEL,LEFT_COL,2,80,60
|
||||
|
||||
XWCOMBO(LOCALES_COMBO,LEFT_COL,65,70,12,0,58,0)
|
||||
|
||||
# ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,LEFT_COL,80,REPOS_BUTTON_WIDTH, // <- translate
|
||||
REPOS_BUTTON_HT
|
||||
PUSHBUTTON "CANCEL",IDCANCEL,40,80,REPOS_BUTTON_WIDTH, // <- translate
|
||||
REPOS_BUTTON_HT
|
||||
# endif
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table. Note that these are ascii strings unless L proceeds the
|
||||
// first ".
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_MENU "MENU" // <- translate
|
||||
IDS_DUMMY "--"
|
||||
IDS_CANCEL "CANCEL" // <- translate
|
||||
IDS_OK "OK" // <- translate
|
||||
IDS_DONE "DONE" // <- translate
|
||||
IDS_LANGUAGE_NAME "ENGLISH" // <- translate
|
||||
IDS_NEW_GAME "NEW GAME" // <- translate
|
||||
IDS_ABOUT "CROSSWORDS " ABOUT_VERSION " (REV " SVN_REV ") "\
|
||||
"FOR WINDOWS MOBILE. COPYRIGHT 1998-2009 BY "\
|
||||
"ERIC HOUSE. THIS SOFTWARE IS RELEASED UNDER THE GNU "\
|
||||
"PUBLIC LICENSE.\r\r"\
|
||||
"FOR DICTIONARIES, A MANUAL, OR SOURCE CODE GO TO "\
|
||||
"HTTP://XWORDS.SF.NET OR HTTP://EEHOUSE.ORG/XWORDS/." // <- translate
|
||||
IDS_DICTLOC "PLEASE INSTALL A CROSSWORDS DICTIONARY (.xwd FILE) "\
|
||||
"IN THE SAME DIRECTORY AS THE CROSSWORDS .EXE FILE, OR "\
|
||||
"IN A DIRECTORY CALLED CROSSWORDS ON AN EXTERNAL CARD, "\
|
||||
"E.G. IN \\STORAGE CARD\\CROSSWORDS. "\
|
||||
"DOWNLOAD DICTIONARIES FROM HTTP://XWORDS.SF.NET OR "\
|
||||
"HTTP://EEHOUSE.ORG/XWORDS." // <- translate
|
||||
IDS_SAVENAME "ENTER A NAME FOR THE CURRENT GAME. (YOU CAN CHANGE THE "\
|
||||
"NAME LATER USING THE SAVED GAMES DIALOG.)" // <- translate
|
||||
IDS_DUPENAME "ENTER A NAME FOR A COPY OF THIS GAME." // <- translate
|
||||
IDS_RENAME "ENTER A NEW NAME FOR THIS GAME." // <- translate
|
||||
|
||||
IDS_REMAINING_TILES_ADD "+ %d [ALL REMAINING TILES]" // <- translate
|
||||
IDS_UNUSED_TILES_SUB "- %d [UNUSED TILES]" // <- translate
|
||||
IDS_BONUS_ALL "BONUS FOR USING ALL TILES: 50" XP_CR // <- translate
|
||||
IDS_TURN_SCORE "SCORE FOR TURN: %d" XP_CR // <- translate
|
||||
IDS_COMMIT_CONFIRM "COMMIT THE CURRENT MOVE?" XP_CR // <- translate
|
||||
IDS_LOCAL_NAME "%s" // <- translate
|
||||
IDS_REM "REM"
|
||||
IDS_IGNORE_L "IGNORE"
|
||||
IDS_WARN_L "WARN"
|
||||
IDS_DISALLOW_L "DISALLOW"
|
||||
IDS_NONLOCAL_NAME "%s (REMOTE)" // <- translate
|
||||
IDS_TIME_PENALTY_SUB " - %d [TIME]" // <- translate
|
||||
IDS_CUMULATIVE_SCORE "CUMULATIVE SCORE: %d" XP_CR // <- translate
|
||||
IDS_MOVE_ACROSS "MOVE (FROM %s ACROSS)" XP_CR // <- translate
|
||||
IDS_MOVE_DOWN "MOVE (FROM %s DOWN)" XP_CR // <- translate
|
||||
IDS_TRAY_AT_START "TRAY AT START: %s" XP_CR // <- translate
|
||||
IDS_NEW_TILES "NEW TILES: %s" XP_CR // <- translate
|
||||
IDS_TRADED_FOR "TRADED %s FOR %s." // <- translate
|
||||
IDS_PASS "PASS" XP_CR // <- translate
|
||||
IDS_PHONY_REJECTED "ILLEGAL WORD IN MOVE; TURN LOST!" XP_CR // <- translate
|
||||
IDS_ROBOT_TRADED "ROBOT TRADED TILES %d THIS TURN." // <- translate
|
||||
IDS_ROBOT_MOVED "THE ROBOT MADE THIS MOVE:" XP_CR // <- translate
|
||||
IDS_REMOTE_MOVED "REMOTE PLAYER MADE THIS MOVE:" XP_CR // <- translate
|
||||
IDS_PASSED "PASSED" // <- translate
|
||||
IDS_SUMMARYSCORED "%s:%d" // <- translate
|
||||
IDS_TRADED "TRADED %d" // <- translate
|
||||
IDS_LOSTTURN "LOST TURN" // <- translate
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
IDS_LOCALPLAYERS "LOCL PLAYRS:" // <- translate
|
||||
#endif
|
||||
IDS_TOTALPLAYERS "PLAYER COUNT:" // <- translate
|
||||
IDS_VALUES_HEADER "%s COUNTS/VALUES:" XP_CR // <- translate
|
||||
IDS_QUERY_TRADE "ARE YOU SURE YOU WANT TO TRADE THE SELECTED TILES?" // <- translate
|
||||
IDS_DOUBLE_LETTER "DOUBLE LETTER" // <- translate
|
||||
IDS_DOUBLE_WORD "DOUBLE WORD" // <- translate
|
||||
IDS_TRIPLE_LETTER "TRIPLE LETTER" // <- translate
|
||||
IDS_TRIPLE_WORD "TRIPLE WORD" // <- translate
|
||||
IDS_INTRADE_MW "TRADING TILES." XP_CR "SELECT 'TURN DONE' WHEN READY" // <- translate
|
||||
|
||||
|
||||
IDS_TILES_NOT_IN_LINE "ALL TILES PLAYED MUST BE IN A LINE." // <- translate
|
||||
IDS_NO_EMPTIES_IN_TURN "EMPTY SQUARES CANNOT SEPARATE TILES PLAYED." // <- translate
|
||||
IDS_TWO_TILES_FIRST_MOVE "MUST PLAY TWO OR MORE PIECES ON THE FIRST MOVE." // <- translate
|
||||
IDS_TILES_MUST_CONTACT "NEW PIECES MUST CONTACT OTHERS ALREADY IN PLACE (OR "\
|
||||
"THE MIDDLE SQUARE ON THE FIRST MOVE)." // <- translate
|
||||
IDS_NOT_YOUR_TURN "YOU CAN'T DO THAT; IT'S NOT YOUR TURN!" // <- translate
|
||||
IDS_NO_PEEK_ROBOT_TILES "NO PEEKING AT THE ROBOT'S TILES!" // <- translate
|
||||
IDS_CANT_TRADE_MID_MOVE "REMOVE PLAYED TILES BEFORE TRADING." // <- translate
|
||||
IDS_TOO_FEW_TILES_LEFT_TO_TRADE "TOO FEW TILES LEFT TO TRADE." // <- translate
|
||||
IDS_CANT_UNDO_TILEASSIGN "TILE ASSIGNMENT CAN'T BE UNDONE." // <- translate
|
||||
IDS_CANT_HINT_WHILE_DISABLED "THE HINT FEATURE IS DISABLED FOR THIS GAME. "\
|
||||
"ENABLE IT FOR A NEW GAME USING THE PREFERENCES "\
|
||||
"DIALOG." // <- translate
|
||||
|
||||
IDS_COUNTSVALS_L "TILE COUNTS AND VALUES" // <- translate
|
||||
IDS_REMTILES_L "REMAINING TILES" // <- translate
|
||||
IDS_GAMEHIST_L "GAME HISTORY" // <- translate
|
||||
IDS_FINALSCORE_L "FINAL SCORES" // <- translate
|
||||
IDS_QUESTION_L "QUESTION" // <- translate
|
||||
IDS_FYI_L "FYI" // <- translate
|
||||
IDS_ILLEGALWRD_L "ILLEGAL WORD" // <- translate
|
||||
IDS_WRDNOTFOUND "WORD[S] %s NOT FOUND IN DICTIONARY." // <- translate
|
||||
IDS_USEANYWAY "USE IT ANYWAY?" // <- translate
|
||||
IDS_CANNOTOPEN_GAME "SAVED GAME CANNOT BE OPENED." // <- translate
|
||||
IDS_NODICT_L "DICTIONARY NOT FOUND" // <- translate
|
||||
IDS_ABOUT_L "ABOUT CROSSWORDS" // <- translate
|
||||
IDS_OVERWRITE "DO YOU REALLY WANT TO OVERWRITE THE CURRENT GAME?" // <- translate
|
||||
IDS_ENDNOW "ARE YOU SURE YOU WANT TO END THE GAME NOW?" // <- translate
|
||||
IDS_CANNOTOPEN_DICT "UNABLE TO OPEN DICTIONARY: %s" // <- translate
|
||||
IDS_CONFIM_DELETE "ARE YOU CERTAIN YOU WANT TO DELETE THE "\
|
||||
"SELECTED GAME? THIS ACTION CANNOT BE UNDONE." // <- translate
|
||||
|
||||
IDS_ROLE_STANDALONE "STANDALONE" // <- translate
|
||||
IDS_ROLE_HOST "HOST" // <- translate
|
||||
IDS_ROLE_GUEST "GUEST" // <- translate
|
||||
IDS_PLAYER_FORMAT "PLAYER %d" // <- translate
|
||||
IDS_UNTITLED_FORMAT "UNTITLED %d" // <- translate
|
||||
IDS_PASSWDFMT_L "ENTER PASSWORD FOR %ls:" // <- translate
|
||||
IDS_FILEEXISTSFMT_L "FILE ""%s"" ALREADY EXISTS." // <- translate
|
||||
IDS_NEED_TOUCH "THIS FEATURE REQUIRES A TOUCH SCREEN."
|
||||
IDS_EDITCOLOR_FORMAT "EDIT COLOR FOR %s"
|
||||
IDS_LANG_CHANGE_RESTART "YOU MUST RESTART CROSSWORDS FOR THIS CHANGE TO TAKE EFFECT." // <- translate
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
IDS_CONN_RELAY_L "RELAY" // <- translate
|
||||
IDS_CONN_DIRECT "DIRECT CONNECTION" // <- translate
|
||||
|
||||
# ifdef XWFEATURE_IP_DIRECT
|
||||
IDS_DIRECT_CONN_L "DIRECT CONNECTION" // <- translate
|
||||
# endif
|
||||
|
||||
IDS_NO_PEEK_REMOTE_TILES "NO PEEKING AT REMOTE PLAYERS' TILES!" // <- translate
|
||||
IDS_REG_UNEXPECTED_USER "REFUSED ATTEMPT TO REGISTER UNEXPECTED USER[S]." // <- translate
|
||||
IDS_SERVER_DICT_WINS "CONFLICT BETWEEN HOST AND GUEST DICTIONARIES; "\
|
||||
"HOST WINS." // <- translate
|
||||
IDS_REG_SERVER_SANS_REMOTE "AT LEAST ONE PLAYER MUST BE MARKED REMOTE FOR "\
|
||||
"A GAME STARTED AS HOST." // <- translate
|
||||
|
||||
# ifdef XWFEATURE_SMS
|
||||
IDS_SMS_CONN_L "TEXTING" // <- translate
|
||||
|
||||
# endif
|
||||
# ifdef XWFEATURE_RELAY
|
||||
IDS_XWRELAY_ERROR_TIMEOUT "THE RELAY TIMED YOU OUT; USUALLY THAT "\
|
||||
"MEANS THE OTHER PLAYERS DIDN'T SHOW." // <- translate
|
||||
IDS_ERROR_HEART_YOU "YOU WERE DISCONNECTED FROM RELAY BECAUSE "\
|
||||
"IT DIDN'T HEAR FROM YOU IN TOO LONG." // <- translate
|
||||
IDS_XWRELAY_ERROR_HEART_OTHER "THE RELAY HAS LOST CONTACT WITH A DEVICE "\
|
||||
"IN THIS GAME." // <- translate
|
||||
/* IDS_XWRELAY_ERROR_LOST_OTHER "THE RELAY HAS LOST CONTACT WITH A DEVICE IN THIS GAME." */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
END
|
||||
|
||||
#ifdef AM_BASE_LANGUAGE
|
||||
# include "../common_rsrc.rc"
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,39 +0,0 @@
|
|||
#ifndef __NEWRES_H__
|
||||
#define __NEWRES_H__
|
||||
|
||||
#if !defined(UNDER_CE)
|
||||
#define UNDER_CE _WIN32_WCE
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
#if !defined(WCEOLE_ENABLE_DIALOGEX)
|
||||
#define DIALOGEX DIALOG DISCARDABLE
|
||||
#endif
|
||||
#include <commctrl.h>
|
||||
#define SHMENUBAR RCDATA
|
||||
#if defined(WIN32_PLATFORM_PSPC) && (_WIN32_WCE >= 300)
|
||||
#include <aygshell.h>
|
||||
#else
|
||||
#define I_IMAGENONE (-2)
|
||||
#define NOMENU 0xFFFF
|
||||
#define IDS_SHNEW 1
|
||||
|
||||
#define IDM_SHAREDNEW 10
|
||||
#define IDM_SHAREDNEWDEFAULT 11
|
||||
#endif
|
||||
#endif // _WIN32_WCE
|
||||
|
||||
|
||||
#ifdef RC_INVOKED
|
||||
#ifndef _INC_WINDOWS
|
||||
#define _INC_WINDOWS
|
||||
#include "winuser.h" // extract from windows header
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef IDC_STATIC
|
||||
#undef IDC_STATIC
|
||||
#endif
|
||||
#define IDC_STATIC (-1)
|
||||
|
||||
#endif //__NEWRES_H__
|
|
@ -1,31 +0,0 @@
|
|||
// -*- mode: c; compile-command: "make TARGET_OS=wince DEBUG=TRUE"; -*-
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define UDS_EXPANDABLE 0x0200
|
||||
# define UDS_NOSCROLL 0x0400
|
||||
# define LISTBOX_CONTROL_FLAGS \
|
||||
NOT LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_TABSTOP
|
||||
# define SPINNER_CONTROL_FLAGS \
|
||||
UDS_AUTOBUDDY | UDS_HORZ | UDS_ALIGNRIGHT | UDS_ARROWKEYS |\
|
||||
UDS_SETBUDDYINT | UDS_EXPANDABLE
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define XWCOMBO(id,xx,yy,ww,ht1,exf1,ht2,exf2) \
|
||||
LISTBOX id, xx,yy,ww,ht1, LISTBOX_CONTROL_FLAGS | exf1 \
|
||||
CONTROL "", id+1, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS,0,0,0,0 \
|
||||
COMBOBOX id+2,xx,yy,ww,ht2, \
|
||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
#else
|
||||
# define XWCOMBO(id,xx,yy,ww,ht1,exf1,ht2,exf2) \
|
||||
COMBOBOX id+2,xx,yy,ww,ht1, \
|
||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | exf2
|
||||
#endif
|
||||
|
||||
#define ABOUT_VERSION "4.4 b9"
|
||||
|
||||
#define DLL_VERS_RESOURCE \
|
||||
ID_DLLVERS_RES DLLV MOVEABLE PURE \
|
||||
BEGIN \
|
||||
CUR_DLL_VERSION \
|
||||
END
|
|
@ -1,320 +0,0 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by xwords4.rc
|
||||
//
|
||||
|
||||
#include "contypct.h"
|
||||
|
||||
// Stuff needed by C and .rc files...
|
||||
// 'Doze expects a carraige return followed by a linefeed
|
||||
#define XP_CR "\015\012"
|
||||
|
||||
|
||||
#define IDS_APP_TITLE 1
|
||||
#define IDC_XWORDS4 3
|
||||
#define IDI_XWORDS4 101
|
||||
#define IDM_MENU 102
|
||||
#define IDD_SAVEDGAMESDLG 103
|
||||
#define IDD_SAVENAMEDLG 107
|
||||
#define IDD_GAMEINFO 104
|
||||
#define IDD_STRBOX 106
|
||||
#define IDB_RIGHTARROW 111
|
||||
#define IDB_DOWNARROW 112
|
||||
#define IDD_ASKBLANK 113
|
||||
#define IDD_ASKPASS 116
|
||||
#define IDD_OPTIONSDLG 117
|
||||
#define IDD_COLORSDLG 118
|
||||
#define IDD_COLOREDITDLG 119
|
||||
#define IDM_MAIN_MENUBAR 120
|
||||
#define IDM_OKCANCEL_MENUBAR 121
|
||||
#define IDM_DONE_MENUBAR 122
|
||||
#define IDM_OK_MENUBAR 123
|
||||
#define IDB_ORIGIN 124
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
# define IDD_ASKHINTLIMTS 125
|
||||
#endif
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
# define IDD_CONNSSDLG 126
|
||||
#endif
|
||||
#ifdef ALLOW_CHOOSE_FONTS
|
||||
# define IDD_FONTSSDLG 127
|
||||
#endif
|
||||
#define IDD_LOCALESDLG 128
|
||||
|
||||
#ifdef XWFEATURE_RELAY
|
||||
# define IDB_NETARROW 129
|
||||
#endif
|
||||
|
||||
#define REMOTE_CHECK1 1005
|
||||
#define NAME_EDIT1 1006
|
||||
#define ROBOT_CHECK1 1007
|
||||
#define PASS_EDIT1 1008
|
||||
|
||||
#define REMOTE_CHECK2 1009
|
||||
#define NAME_EDIT2 1010
|
||||
#define ROBOT_CHECK2 1011
|
||||
#define PASS_EDIT2 1012
|
||||
|
||||
#define REMOTE_CHECK3 1013
|
||||
#define NAME_EDIT3 1014
|
||||
#define ROBOT_CHECK3 1015
|
||||
#define PASS_EDIT3 1016
|
||||
|
||||
#define REMOTE_CHECK4 1017
|
||||
#define NAME_EDIT4 1018
|
||||
#define ROBOT_CHECK4 1019
|
||||
#define PASS_EDIT4 1020
|
||||
|
||||
#define IDC_COMBO1 1021
|
||||
#define PLAYERNUM_COMBO 1022
|
||||
#define TIMER_CHECK 1024
|
||||
#define NAME_EDIT5 1025
|
||||
#define TIMER_EDIT 1026
|
||||
#define BLANKFACE_COMBO 1029
|
||||
#define IDC_PWDLABEL 1031
|
||||
#define PASS_EDIT 1032
|
||||
#define IDC_NPLAYERSLIST 1034
|
||||
#define OPTIONS_BUTTON 1035
|
||||
#define IDC_RADIOGLOBAL 1036
|
||||
#define IDC_RADIOLOCAL 1037
|
||||
#define IDC_LEFTYCHECK 1038
|
||||
#define IDC_CHECKCOLORPLAYED 1039
|
||||
#define IDC_CHECKSMARTROBOT 1040
|
||||
#define IDC_CHECKHINTSOK 1041
|
||||
#define IDC_CHECKSHOWCURSOR 1042
|
||||
#define IDC_CHECKROBOTSCORES 1043
|
||||
#define IDC_SKIPCONFIRM 1044
|
||||
#define IDC_HIDETILEVALUES 1045
|
||||
#define IDC_PREFCOLORS 1046
|
||||
#define IDC_PREFLOCALE 1047
|
||||
#define IDC_PREFFONTS 1048
|
||||
#define PHONIES_LABEL 1049
|
||||
#define GIROLECONF_BUTTON 1050
|
||||
#define GIJUGGLE_BUTTON 1051
|
||||
#define IDC_TOTAL_LABEL 1052
|
||||
#define IDC_REMOTE_LABEL 1053
|
||||
#define IDC_PICKTILES 1054
|
||||
#define IDC_BPICK 1055
|
||||
#define IDC_PICKMSG 1056
|
||||
#ifdef FEATURE_TRAY_EDIT
|
||||
# define IDC_CPICK 1057
|
||||
# define IDC_BACKUP 1058
|
||||
#endif
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
# define IDC_CHECKHINTSLIMITS 1059
|
||||
#endif
|
||||
|
||||
/* buttons and lables must be parallel arrays so CLRSEL_LABEL_OFFSET
|
||||
works. */
|
||||
#define DLBLTR_BUTTON 1060
|
||||
#define DBLWRD_BUTTON 1061
|
||||
#define TPLLTR_BUTTON 1062
|
||||
#define TPLWRD_BUTTON 1063
|
||||
#define EMPCELL_BUTTON 1064
|
||||
#define TBACK_BUTTON 1065
|
||||
#define FOCUSCLR_BUTTON 1066
|
||||
#define PLAYER1_BUTTON 1067
|
||||
#define PLAYER2_BUTTON 1068
|
||||
#define PLAYER3_BUTTON 1069
|
||||
#define PLAYER4_BUTTON 1070
|
||||
|
||||
#define DLBLTR_LABEL 1071
|
||||
#define DBLWRD_LABEL 1072
|
||||
#define TPLLTR_LABEL 1073
|
||||
#define TPLWRD_LABEL 1074
|
||||
#define EMPCELL_LABEL 1075
|
||||
#define TBACK_LABEL 1076
|
||||
#define FOCUSCLR_LABEL 1077
|
||||
#define PLAYER1_LABEL 1078
|
||||
#define PLAYER2_LABEL 1079
|
||||
#define PLAYER3_LABEL 1080
|
||||
#define PLAYER4_LABEL 1081
|
||||
|
||||
#define DLBLTR_SAMPLE 1082
|
||||
#define DBLWRD_SAMPLE 1083
|
||||
#define TPLLTR_SAMPLE 1084
|
||||
#define TPLWRD_SAMPLE 1085
|
||||
#define EMPCELL_SAMPLE 1086
|
||||
#define TBACK_SAMPLE 1087
|
||||
#define FOCUSCLR_SAMPLE 1088
|
||||
#define PLAYER1_SAMPLE 1089
|
||||
#define PLAYER2_SAMPLE 1090
|
||||
#define PLAYER3_SAMPLE 1091
|
||||
#define PLAYER4_SAMPLE 1092
|
||||
|
||||
#define CLRSEL_LABEL_OFFSET (DLBLTR_LABEL-DLBLTR_BUTTON)
|
||||
|
||||
/* editor dlg: assumption is that the edit field's ID is one more
|
||||
than the corresponding slider's */
|
||||
#ifdef MY_COLOR_SEL
|
||||
# define CLREDT_SLIDER1 1093
|
||||
# define RED_EDIT 1094
|
||||
# define CLREDT_SLIDER2 1095
|
||||
# define GREEN_EDIT 1096
|
||||
# define CLREDT_SLIDER3 1097
|
||||
# define BLUE_EDIT 1098
|
||||
|
||||
# define RED_LABEL 1099
|
||||
# define GREEN_LABEL 1100
|
||||
# define BLUE_LABEL 1101
|
||||
# define CLSAMPLE_BUTTON_ID 1123
|
||||
#endif // MY_COLOR_SEL
|
||||
|
||||
#ifdef ALLOW_CHOOSE_FONTS
|
||||
# define FONTS_LABEL 1123
|
||||
# define FONTS_COMBO 1124
|
||||
# define IDC_FONTSUPDOWN 1125
|
||||
# define FONTS_COMBO_PPC 1126
|
||||
# define FONTSIZE_LABEL 1127
|
||||
# define FONTSIZE_COMBO 1128
|
||||
# define IDC_FONTSIZEUPDOWN 1129
|
||||
# define FONTSIZE_COMBO_PPC 1130
|
||||
#endif
|
||||
|
||||
/* Dll/language picker */
|
||||
#define LOCALES_COMBO 1131
|
||||
#define IDC_LOCALESUPDOWN 1132
|
||||
#define LOCALES_COMBO_PPC 1133
|
||||
|
||||
#define IDC_ROLELABEL 1134
|
||||
#define IDC_NAMELABEL 1135
|
||||
#define IDC_ROBOTLABEL 1136
|
||||
#define IDC_PASSWDLABEL 1137
|
||||
#define HC_MIN_LABEL 1138
|
||||
#define HC_MAX_LABEL 1139
|
||||
#define LOCALES_LABEL 1140
|
||||
|
||||
#ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
# define IDC_CCONVIA_LAB 1106
|
||||
#endif
|
||||
|
||||
#define IDC_INVITE_LAB 1107
|
||||
#ifdef XWFEATURE_RELAY
|
||||
# define IDC_CRELAYNAME_LAB 1108
|
||||
# define IDC_CRELAYPORT_LAB 1109
|
||||
|
||||
# define INVITE_EDIT 1110
|
||||
# define IDC_INVITE_HELP_HOST 1111
|
||||
# define IDC_INVITE_HELP_GUEST 1112
|
||||
# ifndef RELAY_NOEDIT_ADDR
|
||||
# define RELAYPORT_EDIT 1113
|
||||
# define RELAYNAME_EDIT 1114
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#define IDC_BLUET_ADDR_LAB 1300
|
||||
#ifdef XWFEATURE_BLUETOOTH
|
||||
# define IDC_BLUET_ADDR_EDIT 1301
|
||||
# define IDC_BLUET_ADDR_BROWSE 1302
|
||||
#endif
|
||||
/* #define IDS_UPDOWN 1118 */
|
||||
|
||||
/* Direct IP connection */
|
||||
# define IDC_IPNAME_LAB 1303
|
||||
# define IPNAME_EDIT 1304
|
||||
/* SMS connection */
|
||||
# define IDC_SMS_PHONE_LAB 1305
|
||||
# define IDC_SMS_PHONE_EDIT 1306
|
||||
# define IDC_SMS_PORT_LAB 1307
|
||||
# define IDC_SMS_PORT_EDIT 1308
|
||||
|
||||
#define IDC_SVGM_SELLAB 1127
|
||||
/* Let's remove these until they're implemented */
|
||||
#define IDC_SVGM_EDITLAB 1131
|
||||
#define IDC_SVGM_CHANGE 1130
|
||||
#define IDC_SVGM_DUP 1129
|
||||
#define IDC_SVGM_DEL 1128
|
||||
#define IDC_SVGM_OPEN 1120
|
||||
|
||||
#define IDC_SVGN_SELLAB 1125
|
||||
#define IDC_SVGN_EDIT 1122
|
||||
|
||||
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define IDM_HELP_ABOUT 40003
|
||||
#define ID_FILE_ABOUT 40004
|
||||
#define ID_GAME_GAMEINFO 40005
|
||||
#define ID_GAME_HISTORY 40006
|
||||
#define ID_GAME_FINALSCORES 40007
|
||||
#define ID_GAME_TILECOUNTSANDVALUES 40008
|
||||
#define ID_GAME_TILESLEFT 40009
|
||||
#define ID_MOVE_HINT 40010
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
# define ID_MOVE_LIMITEDHINT 40011
|
||||
#endif
|
||||
#define ID_MOVE_NEXTHINT 40012
|
||||
#define ID_MOVE_PREVHINT 40013
|
||||
#define ID_MOVE_UNDOCURRENT 40014
|
||||
#define ID_MOVE_UNDOLAST 40015
|
||||
#define ID_MOVE_TRADE 40016
|
||||
#define ID_MOVE_JUGGLE 40017
|
||||
#define ID_MOVE_HIDETRAY 40018
|
||||
#define ID_MOVE_TURNDONE 40019
|
||||
#define ID_MOVE_FLIP 40020
|
||||
#define ID_MOVE_VALUES 40021
|
||||
#define ID_FILE_NEWGAME 40022
|
||||
#define ID_FILE_SAVEDGAMES 40023
|
||||
#define ID_EDITTEXT 40024
|
||||
#define ID_FILE_PREFERENCES 40025
|
||||
#define ID_GAME_RESENDMSGS 40026
|
||||
#define ID_FILE_FULLSCREEN 40027
|
||||
|
||||
#define ID_INITIAL_SOFTID ID_MOVE_TURNDONE
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
# define W32_DUMMY_ID 40028
|
||||
#endif
|
||||
|
||||
#define ID_COLORS_RES 9999
|
||||
#define ID_BONUS_RES 9998
|
||||
#define ID_DLLVERS_RES 9997
|
||||
|
||||
#define IDM_MAIN_COMMAND1 40000
|
||||
#define IDS_DUMMY 40001
|
||||
|
||||
#include "strids.h"
|
||||
|
||||
// These are in sets of three, and must be consecutive and in the right order within each set
|
||||
#define PHONIES_COMBO 1200
|
||||
#define IDC_PHONIESUPDOWN 1201
|
||||
#define PHONIES_COMBO_PPC 1202
|
||||
|
||||
#define HC_MIN_COMBO 1203
|
||||
#define HC_MIN_UPDOWN 1204
|
||||
#define HC_MIN_COMBO_PPC 1205
|
||||
|
||||
#define HC_MAX_COMBO 1206
|
||||
#define HC_MAX_UPDOWN 1207
|
||||
#define HC_MAX_COMBO_PPC 1208
|
||||
|
||||
#define IDC_SVGM_GAMELIST 1209
|
||||
#define IDC_SVGM_UPDOWN 1210
|
||||
#define IDC_SVGM_GAMELIST_PPC 1211
|
||||
|
||||
#define BLANKFACE_LIST 1212
|
||||
#define IDC_ASKBLANK_UPDOWN 1213
|
||||
#define BLANKFACE_LIST_PPC 1214
|
||||
|
||||
#define IDC_DICTLIST 1215
|
||||
#define IDC_DICTUPDOWN 1216
|
||||
#define IDC_DICTLIST_PPC 1217
|
||||
|
||||
#define IDC_NPLAYERSCOMBO 1218
|
||||
#define IDC_NPLAYERSUPDOWN 1219
|
||||
#define IDC_NPLAYERSCOMBO_PPC 1220
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
# define IDC_ROLECOMBO 1224
|
||||
# define IDC_ROLEUPDOWN 1225
|
||||
# define IDC_ROLECOMBO_PPC 1226
|
||||
|
||||
# ifdef NEEDS_CHOOSE_CONNTYPE
|
||||
# define IDC_CONNECT_COMBO 1221
|
||||
# define IDC_CONNECTUPDOWN 1222
|
||||
# define IDC_CONNECT_COMBO_PPC 1223
|
||||
# endif
|
||||
|
||||
#endif /* XWFEATURE_STANDALONE_ONLY */
|
||||
|
||||
#define IDC_DICTLABEL 1227
|
|
@ -1,40 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
ID_FILE=${ID_FILE:-./strids.h}
|
||||
|
||||
if [ ! -f $ID_FILE ]; then
|
||||
echo "$0: $ID_FILE not found"
|
||||
exit 0;
|
||||
elif [ -z "$1" ]; then
|
||||
echo "usage: <rc file> [<rc file>*]"
|
||||
fi
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
RC_FILE=$1
|
||||
cat $ID_FILE | grep '^# *define.* IDS' \
|
||||
| sed 's/^# *define *\(IDS_.*\) .*$/\1/' \
|
||||
| while read ID; do
|
||||
COUNT=$(grep -w -c $ID $RC_FILE)
|
||||
if [ 0 -eq "$COUNT" ]; then
|
||||
echo $ID not found in $RC_FILE
|
||||
elif [ 1 -lt "$COUNT" ]; then
|
||||
echo "$ID found $COUNT times in $RC_FILE"
|
||||
fi
|
||||
if ! grep -q $ID *.c; then
|
||||
echo $ID not used in any .c file
|
||||
fi
|
||||
done
|
||||
|
||||
grep '^\s*IDS_.*' "$RC_FILE" | sed 's/^ *\(IDS[A-Z_]*\).*$/\1/' | \
|
||||
sort -u > /tmp/ids_cur$$.txt
|
||||
if [ -e /tmp/ids_prev$$.txt ]; then
|
||||
echo -e "\ncomparing IDs in $RC_FILE, $PREV"
|
||||
diff /tmp/ids_prev$$.txt /tmp/ids_cur$$.txt
|
||||
fi
|
||||
mv /tmp/ids_cur$$.txt /tmp/ids_prev$$.txt
|
||||
PREV=$RC_FILE
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
#rm -f /tmp/ids_cur$$.txt /tmp/ids_prev$$.txt
|
|
@ -1,59 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Script for turning the Crosswords executable into a cab, along with
|
||||
# a shortcut in the games menu
|
||||
|
||||
use strict;
|
||||
|
||||
sub main() {
|
||||
my $provider = "\"Crosswords project\"";
|
||||
|
||||
usage() if 1 != @ARGV;
|
||||
|
||||
my $path = shift @ARGV;
|
||||
|
||||
usage() unless $path =~ m|.dll$|;
|
||||
|
||||
die "$path not found\n" unless -f $path;
|
||||
|
||||
my $cabname = `basename $path`;
|
||||
chomp $cabname;
|
||||
|
||||
# Create a link. The format, says Shaun, is
|
||||
# <number of characters>#command line<no carriage return or line feed>
|
||||
|
||||
my $userName = $cabname;
|
||||
|
||||
$cabname =~ s/.dll$//;
|
||||
|
||||
my $fname = "/tmp/file$$.list";
|
||||
|
||||
# see this url for %CE5% and other definitions:
|
||||
# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevGuideSP/html/sp_wce51consmartphonewindowscestringsozup.asp
|
||||
|
||||
open FILE, "> $fname";
|
||||
|
||||
my $tmpfile = "/tmp/$userName";
|
||||
`cp $path $tmpfile`;
|
||||
print FILE "$tmpfile ";
|
||||
print FILE '%CE1%\\\\Crosswords', "\n";
|
||||
|
||||
close FILE;
|
||||
|
||||
my $appname = $cabname;
|
||||
$cabname .= ".cab";
|
||||
|
||||
my $cmd = "pocketpc-cab -p $provider -a $appname "
|
||||
. "$fname $cabname";
|
||||
print( STDERR $cmd, "\n");
|
||||
`$cmd`;
|
||||
|
||||
unlink $tmpfile;
|
||||
}
|
||||
|
||||
sub usage() {
|
||||
print STDERR "usage: $0 path/to/xwords4_language.dll\n";
|
||||
exit 2;
|
||||
}
|
||||
|
||||
main();
|
|
@ -1,80 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Script for turning the Crosswords executable into a cab, along with
|
||||
# a shortcut in the games menu
|
||||
|
||||
use strict;
|
||||
|
||||
my $userName = "Crosswords.exe";
|
||||
|
||||
sub main() {
|
||||
my $provider = "\"Crosswords project\"";
|
||||
|
||||
usage() if 1 > @ARGV;
|
||||
|
||||
my $path = shift @ARGV;
|
||||
my $dict = shift @ARGV;
|
||||
if ( ! $dict ) {
|
||||
$dict = "../../../dawg/English/BasEnglish2to8.xwd";
|
||||
}
|
||||
|
||||
usage() unless $path =~ m|.exe$|;
|
||||
|
||||
die "$path not found\n" unless -f $path;
|
||||
|
||||
my $cabname = `basename $path`;
|
||||
chomp $cabname;
|
||||
|
||||
# Create a link. The format, says Shaun, is
|
||||
# <number of characters>#command line<no carriage return or line feed>
|
||||
|
||||
$userName = $cabname unless $userName;
|
||||
my $cmdline = "\"\\Program Files\\Crosswords\\" . $userName . "\"";
|
||||
my $cmdlen = length( $cmdline );
|
||||
|
||||
$cabname =~ s/.exe$//;
|
||||
my $linkName = "Crosswords.lnk";
|
||||
open LINKFILE, "> $linkName";
|
||||
print LINKFILE $cmdlen, "#", $cmdline;
|
||||
close LINKFILE;
|
||||
|
||||
my $fname = "/tmp/file$$.list";
|
||||
|
||||
# see this url for %CE5% and other definitions:
|
||||
# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevGuideSP/html/sp_wce51consmartphonewindowscestringsozup.asp
|
||||
|
||||
open FILE, "> $fname";
|
||||
|
||||
my $tmpfile = "/tmp/$userName";
|
||||
`cp $path $tmpfile`;
|
||||
print FILE "$tmpfile ";
|
||||
print FILE '%CE1%\\\\Crosswords', "\n";
|
||||
|
||||
print FILE "$dict ";
|
||||
print FILE '%CE1%\\\\Crosswords', "\n";
|
||||
|
||||
# print FILE "$ENV{'CEOPT_ROOT'}/opt/mingw32ce/arm-wince-mingw32ce/bin/mingwm10.dll ";
|
||||
# print FILE '%CE2%\\mingwm10.dll', "\n";
|
||||
|
||||
print FILE "$linkName ";
|
||||
print FILE '%CE14%', "\n";
|
||||
|
||||
close FILE;
|
||||
|
||||
my $appname = $cabname;
|
||||
$cabname .= ".cab";
|
||||
|
||||
my $cmd = "pocketpc-cab -p $provider -a $appname "
|
||||
. "$fname $cabname";
|
||||
print( STDERR $cmd, "\n");
|
||||
`$cmd`;
|
||||
|
||||
unlink $linkName, $tmpfile;
|
||||
}
|
||||
|
||||
sub usage() {
|
||||
print STDERR "usage: $0 path/to/xwords4.exe [path/to/dict.xwd]\n";
|
||||
exit 2;
|
||||
}
|
||||
|
||||
main();
|
|
@ -1,77 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
DICT=../dawg/English/BasEnglish2to8.xwd
|
||||
TMPDIR=/tmp/_$$
|
||||
README=$TMPDIR/README.txt
|
||||
|
||||
function usage() {
|
||||
echo "usage: $0 --exe exe_file "
|
||||
echo " [--name exe_name_to_use]"
|
||||
echo " [--dict dict_to_include]"
|
||||
echo " [--out zipfile_to_produce]"
|
||||
exit 0
|
||||
}
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
[ -z "$2" ] && usage
|
||||
case "$1" in
|
||||
--exe)
|
||||
EXE="$2"
|
||||
;;
|
||||
--name)
|
||||
NAME="$2"
|
||||
;;
|
||||
--dict)
|
||||
DICT="$2"
|
||||
;;
|
||||
--out)
|
||||
OUTFILE="$2"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
esac
|
||||
shift 2
|
||||
done
|
||||
|
||||
[ -z "$EXE" ] && usage
|
||||
[ -z "$OUTFILE" ] && OUTFILE=${EXE%.exe}.zip
|
||||
|
||||
mkdir -p $TMPDIR
|
||||
|
||||
# If name's specified, we need to create that file. Do it before
|
||||
# catting text below so EXE will be correct
|
||||
|
||||
if [ ! -z "$NAME" ]; then
|
||||
NAME=$TMPDIR/$NAME
|
||||
echo "copying $EXE to $NAME"
|
||||
cp $EXE $NAME
|
||||
EXE=$NAME
|
||||
fi
|
||||
|
||||
cat > $README <<EOF
|
||||
|
||||
Thanks for downloading Crosswords 4.4 Beta 8 for Smartphone and PocketPC.
|
||||
|
||||
To install, copy the enclosed executable file ($(basename $EXE)) and dictionary file ($(basename $DICT)) into the same directory on your device using File Explorer, then double-click on the executable to launch it.
|
||||
|
||||
For a users manual, dictionaries in other languages, upgrades, information on reporting bugs, etc., point your browser at http://xwords.sf.net. See the "Smartphone" menu there for navigation tips.
|
||||
|
||||
Crosswords is free/open source software. Share it with your friends. If you develop software yourself, check out the code (at the above URL.)
|
||||
|
||||
Enjoy!
|
||||
|
||||
--Eric House (ehouse@users.sf.net)
|
||||
EOF
|
||||
|
||||
# Make README readable on Wince
|
||||
todos $README
|
||||
|
||||
rm -f $OUTFILE
|
||||
CMD="zip -j $OUTFILE $EXE $DICT $README"
|
||||
echo $CMD
|
||||
eval $CMD
|
||||
|
||||
echo "Done: "
|
||||
zipinfo $OUTFILE
|
||||
|
||||
rm -rf $TMPDIR
|
|
@ -1,720 +0,0 @@
|
|||
#!/usr/bin/perl -w
|
||||
# Build an installable Pocket PC cabinet file.
|
||||
# Copyright 2006 Shaun Jackman
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use Text::ParseWords;
|
||||
use MIME::Base64;
|
||||
|
||||
|
||||
# Constants.
|
||||
my $architecture = 0;
|
||||
my @version_requirements = (4, 0, 6, 99, 0, -536870912); # 4.0.0 to 6.99.0xE0000000 (-536870912)
|
||||
my $verbose = 0;
|
||||
|
||||
# Strings.
|
||||
my $string_count = 0;
|
||||
my %string_ids;
|
||||
|
||||
# Directories.
|
||||
my $directory_count = 0;
|
||||
my %directory_ids;
|
||||
my @directories;
|
||||
|
||||
# Files.
|
||||
my $file_count = 0;
|
||||
my %file_ids;
|
||||
my %file_dirs;
|
||||
my @files;
|
||||
|
||||
# RegHives.
|
||||
my $reghive_count = 0;
|
||||
my %reghive_ids;
|
||||
my @reghive_roots;
|
||||
my @reghives;
|
||||
|
||||
# RegKeys.
|
||||
my $regkey_count = 0;
|
||||
my %regkey_ids;
|
||||
my @regkey_hives;
|
||||
my @regkey_keys;
|
||||
my @regkey_names;
|
||||
my @regkey_values;
|
||||
my @regkey_xmlvalues;
|
||||
my @regkey_types;
|
||||
my @regkey_typeids;
|
||||
|
||||
# Links.
|
||||
my $links_count = 0;
|
||||
my %links;
|
||||
my %link_targets;
|
||||
my %link_dirs;
|
||||
|
||||
|
||||
# Returns the ID of the specified string.
|
||||
sub get_string_id($)
|
||||
{
|
||||
my $string = shift;
|
||||
my $id = $string_ids{$string};
|
||||
if( defined $id) {
|
||||
return $id;
|
||||
} else {
|
||||
$id = ++$string_count;
|
||||
$string_ids{$string} = $id;
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Returns the ID of the specified directory.
|
||||
sub get_directory_id($)
|
||||
{
|
||||
my $directory = shift;
|
||||
my $id = $directory_ids{$directory};
|
||||
if( defined $id) {
|
||||
return $id;
|
||||
} else {
|
||||
$id = ++$directory_count;
|
||||
$directory_ids{$directory} = $id;
|
||||
|
||||
my @strings = split '/', $directory;
|
||||
my @ids;
|
||||
foreach my $string (@strings) {
|
||||
next if length $string == 0;
|
||||
push @ids, get_string_id( $string);
|
||||
}
|
||||
push @ids, 0;
|
||||
$directories[$id] = \@ids;
|
||||
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Returns the ID of the specified registry key
|
||||
sub get_reghive_id($$)
|
||||
{
|
||||
my $root = shift;
|
||||
my $key = shift;
|
||||
my $hive_name = "$root/$key";
|
||||
my $id = $reghive_ids{$hive_name};
|
||||
if( defined $id) {
|
||||
return $id;
|
||||
} else {
|
||||
$id = ++$reghive_count;
|
||||
$reghive_ids{$hive_name} = $id;
|
||||
|
||||
my @strings = split '/', $key;
|
||||
my @ids;
|
||||
foreach my $string (@strings) {
|
||||
next if length $string == 0;
|
||||
push @ids, get_string_id( $string);
|
||||
}
|
||||
push @ids, 0;
|
||||
$reghives[$id] = \@ids;
|
||||
$reghive_roots[$id] = $root;
|
||||
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
sub parseint($)
|
||||
{
|
||||
my $str = shift;
|
||||
if ($str =~ /^0x/i) {
|
||||
return hex($str);
|
||||
} elsif ($str =~ /^0b/i) {
|
||||
return oct($str);
|
||||
} else {
|
||||
return int($str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Returns a list of keys sorted by value.
|
||||
sub get_value_sorted_keys(%)
|
||||
{
|
||||
my %hash = @_;
|
||||
return sort { $hash{$a} <=> $hash{$b} } keys %hash;
|
||||
}
|
||||
|
||||
|
||||
# Creates the files.
|
||||
sub parse_input($)
|
||||
{
|
||||
my $destdir = shift;
|
||||
while(<>) {
|
||||
my ($file, $directory, $linkname, $linkdir) = &shellwords($_);
|
||||
next if length $directory == 0;
|
||||
|
||||
my $id = ++$file_count;
|
||||
$file_ids{$file} = $id;
|
||||
$file_dirs{$file} = "$destdir$directory";
|
||||
$files[$id] = get_directory_id "$destdir$directory";
|
||||
|
||||
|
||||
if (defined $linkdir) {
|
||||
$linkname .= '.lnk';
|
||||
|
||||
$link_targets{$linkname} = "$destdir$directory/$file";
|
||||
$link_dirs{$linkname} = $linkdir;
|
||||
|
||||
my $linknameid = get_string_id $linkname;
|
||||
my $dirid = 0;
|
||||
my $basedir = 0;
|
||||
if ($linkdir =~ /^%CE(\d+)%$/) {
|
||||
$basedir = $1;
|
||||
} else {
|
||||
$dirid = get_directory_id $linkdir;
|
||||
}
|
||||
|
||||
my @strings = split '/', $linkname;
|
||||
my @stringids;
|
||||
foreach my $string (@strings) {
|
||||
next if length $string == 0;
|
||||
push @stringids, get_string_id $string;
|
||||
}
|
||||
|
||||
my $fileid = $id;
|
||||
my $id = ++$links_count;
|
||||
my $type = 1;
|
||||
$links{$id} = [ $dirid, $basedir, $fileid, 1, [ @stringids ] ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub parse_regfile($)
|
||||
{
|
||||
my $regfile = shift;
|
||||
open REGFILE, "<$regfile";
|
||||
while(<REGFILE>) {
|
||||
my @line = &shellwords($_);
|
||||
my $root = shift @line;
|
||||
my $key = shift @line;
|
||||
my $name = shift @line;
|
||||
my $type = shift @line;
|
||||
my $value = shift @line;
|
||||
next if length $root == 0;
|
||||
|
||||
$root = uc($root);
|
||||
my $rootid;
|
||||
if ($root eq "HKCR") {
|
||||
$rootid = 1;
|
||||
} elsif ($root eq "HKCU") {
|
||||
$rootid = 2;
|
||||
} elsif ($root eq "HKLM") {
|
||||
$rootid = 3;
|
||||
} elsif ($root eq "HKU") {
|
||||
$rootid = 4;
|
||||
} else {
|
||||
print STDERR "Unrecognised registry root $root\n";
|
||||
next;
|
||||
}
|
||||
$type = lc($type);
|
||||
my $manifest_value = '';
|
||||
my $xml_value = '';
|
||||
my $typeid;
|
||||
if ($type eq "string") {
|
||||
$manifest_value = $value . "\0";
|
||||
$xml_value = $value;
|
||||
$typeid = 0x00000000;
|
||||
$type = "string";
|
||||
} elsif ($type eq "binary") {
|
||||
$manifest_value = '';
|
||||
while (length $value > 0) {
|
||||
my $byte = hex(substr $value,0,2,'');
|
||||
$manifest_value .= pack 'C',$byte;
|
||||
}
|
||||
$xml_value = encode_base64($manifest_value);
|
||||
chomp $xml_value;
|
||||
$typeid = 0x00000001;
|
||||
$type = "binary";
|
||||
} elsif ($type eq "integer" || $type eq "int" || $type eq "dword") {
|
||||
my $int = parseint($value);
|
||||
$manifest_value = pack 'V', $int;
|
||||
$xml_value = "$int";
|
||||
$typeid = 0x00010001;
|
||||
$type = "integer";
|
||||
} elsif ($type eq "multistring") {
|
||||
my @strings;
|
||||
push @strings, $value if defined $value;
|
||||
push @strings, @line;
|
||||
$manifest_value = '';
|
||||
$xml_value = '';
|
||||
foreach my $string (@strings) {
|
||||
$manifest_value .= $string . "\0";
|
||||
$xml_value .= $string . "\xEF\x80\x80"; # separate using EF8080, which is 0xF000 encoded as utf8
|
||||
}
|
||||
$manifest_value .= "\0";
|
||||
$typeid = 0x00010000;
|
||||
$type = "multiplestring";
|
||||
} else {
|
||||
print STDERR "Unrecognised registry type $type\n";
|
||||
next;
|
||||
}
|
||||
my $id = ++$regkey_count;
|
||||
$regkey_ids{$id} = $id;
|
||||
$regkey_hives[$id] = get_reghive_id $rootid, $key;
|
||||
$regkey_keys[$id] = "$root/$key";
|
||||
$regkey_names[$id] = $name;
|
||||
$regkey_values[$id] = $manifest_value;
|
||||
$regkey_xmlvalues[$id] = $xml_value;
|
||||
$regkey_typeids[$id] = $typeid;
|
||||
$regkey_types[$id] = $type;
|
||||
}
|
||||
close REGFILE;
|
||||
}
|
||||
|
||||
|
||||
# Returns the entire manifest.
|
||||
sub get_manifest($$)
|
||||
{
|
||||
my ($provider, $application) = @_;
|
||||
|
||||
# Header.
|
||||
my $offset = 100;
|
||||
|
||||
# Application.
|
||||
my $application_offset = $offset;
|
||||
$application .= "\0";
|
||||
while ((length $application) % 4 != 0) {
|
||||
$application .= "\0";
|
||||
}
|
||||
$offset += length $application;
|
||||
|
||||
# Provider.
|
||||
my $provider_offset = $offset;
|
||||
$provider .= "\0";
|
||||
while ((length $provider) % 4 != 0) {
|
||||
$provider .= "\0";
|
||||
}
|
||||
$offset += length $provider;
|
||||
|
||||
# Unsupported platforms.
|
||||
my $unsupported_offset = $offset;
|
||||
my $unsupported = '';
|
||||
$offset += length $unsupported;
|
||||
|
||||
# Strings.
|
||||
my $strings_offset = $offset;
|
||||
my $strings = '';
|
||||
foreach my $string (get_value_sorted_keys %string_ids) {
|
||||
my $string_id = $string_ids{$string};
|
||||
print "$string($string_id)\n" if $verbose;
|
||||
$string .= "\0";
|
||||
while ((length $string) % 4 != 0) {
|
||||
$string .= "\0";
|
||||
}
|
||||
$strings .= pack 'vv', $string_id, length $string;
|
||||
$strings .= $string;
|
||||
}
|
||||
$offset += length $strings;
|
||||
|
||||
# Directories.
|
||||
my $directories_offset = $offset;
|
||||
my $directories = '';
|
||||
foreach my $directory (get_value_sorted_keys %directory_ids) {
|
||||
my $directory_id = $directory_ids{$directory};
|
||||
my @ids = @{$directories[$directory_id]};
|
||||
print "$directory($directory_id): @ids\n" if $verbose;
|
||||
$directories .= pack 'vv', $directory_id, 2 * scalar @ids;
|
||||
foreach my $id (@ids) {
|
||||
$directories .= pack 'v', $id;
|
||||
}
|
||||
}
|
||||
$offset += length $directories;
|
||||
|
||||
# Files.
|
||||
my $files_offset = $offset;
|
||||
my $files = '';
|
||||
foreach my $path (get_value_sorted_keys %file_ids) {
|
||||
my $file_id = $file_ids{$path};
|
||||
my $directory_id = $files[$file_id];
|
||||
my $file = $path;
|
||||
$file =~ s/^.*\///;
|
||||
$file .= "\0";
|
||||
while ((length $file) % 4 != 0) {
|
||||
$file .= "\0";
|
||||
}
|
||||
print "$file($file_id): $directory_id\n" if $verbose;
|
||||
$files .= pack 'vvvVv', $file_id, $directory_id, $file_id,
|
||||
0, length $file;
|
||||
$files .= $file;
|
||||
}
|
||||
$offset += length $files;
|
||||
|
||||
# RegHives.
|
||||
my $reghives_offset = $offset;
|
||||
my $reghives = '';
|
||||
foreach my $reghive (get_value_sorted_keys %reghive_ids) {
|
||||
my $reghive_id = $reghive_ids{$reghive};
|
||||
my $reghive_root = $reghive_roots[$reghive_id];
|
||||
my @ids = @{$reghives[$reghive_id]};
|
||||
print "$reghive($reghive_id): @ids\n" if $verbose;
|
||||
$reghives .= pack 'vvvv', $reghive_id, $reghive_root, 0, 2 * scalar @ids;
|
||||
foreach my $id (@ids) {
|
||||
$reghives .= pack 'v', $id;
|
||||
}
|
||||
}
|
||||
$offset += length $reghives;
|
||||
|
||||
# RegKeys.
|
||||
my $regkeys_offset = $offset;
|
||||
my $regkeys = '';
|
||||
foreach my $regkey_id (get_value_sorted_keys %regkey_ids) {
|
||||
my $hive = $regkey_hives[$regkey_id];
|
||||
my $name = $regkey_names[$regkey_id];
|
||||
my $value = $regkey_values[$regkey_id];
|
||||
my $len = length($value);
|
||||
my $typeid = $regkey_typeids[$regkey_id];
|
||||
print "$name($regkey_id): \n" if $verbose;
|
||||
$regkeys .= pack 'vvvVv', $regkey_id, $hive, 0, $typeid, length($name) + 1 + length($value);
|
||||
$regkeys .= $name . "\0" . $value;
|
||||
}
|
||||
$offset += length $regkeys;
|
||||
|
||||
# Links.
|
||||
my $links_offset = $offset;
|
||||
my $links = '';
|
||||
foreach my $link_id (keys %links) {
|
||||
my @link = @{ $links{$link_id} };
|
||||
my $dirid = $link[0];
|
||||
my $basedir = $link[1];
|
||||
my $fileid = $link[2];
|
||||
my $type = $link[3];
|
||||
my @stringids = @{ $link[4] };
|
||||
my $length = 2 * scalar @stringids;
|
||||
$links .= pack 'vvvvvv', $link_id, $dirid, $basedir, $fileid, $type, $length;
|
||||
foreach my $id (@stringids) {
|
||||
$links .= pack 'v', $id;
|
||||
}
|
||||
}
|
||||
$offset += length $links;
|
||||
|
||||
# Header.
|
||||
my $length = $offset;
|
||||
my @fields = (
|
||||
0, $length, 0, 1, $architecture,
|
||||
@version_requirements,
|
||||
$string_count, $directory_count, $file_count,
|
||||
$reghive_count, $regkey_count, $links_count,
|
||||
$strings_offset, $directories_offset, $files_offset,
|
||||
$reghives_offset, $regkeys_offset, $links_offset,
|
||||
$application_offset, length $application,
|
||||
$provider_offset, length $provider,
|
||||
$unsupported_offset, length $unsupported,
|
||||
0, 0);
|
||||
my $header = 'MSCE';
|
||||
$header .= pack 'V11 v6 V6 v8', @fields;
|
||||
|
||||
return $header . $application . $provider . $unsupported .
|
||||
$strings . $directories . $files .
|
||||
$reghives . $regkeys . $links;
|
||||
}
|
||||
|
||||
# Returns a munged version of the specified filename.
|
||||
# Removes the leading path. Removes the extension. Removes spaces.
|
||||
# Truncates to eight characters. Pads to eight characters with leading
|
||||
# zeros. Adds a numeric extension.
|
||||
sub munge_filename($$)
|
||||
{
|
||||
my $munged = shift;
|
||||
my $extension = shift;
|
||||
$munged =~ s/^.*\///;
|
||||
$munged =~ s/\..*$//;
|
||||
$munged =~ s/ //;
|
||||
$munged = substr $munged, 0, 8;
|
||||
$munged = sprintf '%08s.%03d', $munged, $extension;
|
||||
return $munged;
|
||||
}
|
||||
|
||||
# Returns the _setup.xml file
|
||||
sub get_setupxml($$)
|
||||
{
|
||||
my ($provider, $application) = @_;
|
||||
|
||||
my $output;
|
||||
|
||||
$output .= "<wap-provisioningdoc>\n";
|
||||
$output .= "\t<characteristic type=\"Install\">\n";
|
||||
$output .= "\t\t<parm name=\"InstallPhase\" value=\"install\" />\n";
|
||||
$output .= "\t\t<parm name=\"OSVersionMin\" value=\"$version_requirements[0].$version_requirements[1]\" />\n";
|
||||
$output .= "\t\t<parm name=\"OSVersionMax\" value=\"$version_requirements[2].$version_requirements[3]\" />\n";
|
||||
$output .= "\t\t<parm name=\"BuildNumberMin\" value=\"$version_requirements[4]\" />\n";
|
||||
$output .= "\t\t<parm name=\"BuildNumberMax\" value=\"$version_requirements[5]\" />\n";
|
||||
$output .= "\t\t<parm name=\"AppName\" value=\"$provider $application\" />\n";
|
||||
my @filenames = get_value_sorted_keys %file_ids;
|
||||
my $firstdir = $file_dirs{$filenames[0]};
|
||||
$firstdir =~ s/\//\\/g;
|
||||
$output .= "\t\t<parm name=\"InstallDir\" value=\"$firstdir\" translation=\"install\" />\n";
|
||||
my $dirs = scalar keys %directory_ids;
|
||||
my $files = scalar keys %file_ids;
|
||||
$output .= "\t\t<parm name=\"NumDirs\" value=\"$dirs\" />\n";
|
||||
$output .= "\t\t<parm name=\"NumFiles\" value=\"$files\" />\n";
|
||||
$output .= "\t\t<parm name=\"NumRegKeys\" value=\"$regkey_count\" />\n";
|
||||
$output .= "\t\t<parm name=\"NumRegVals\" value=\"$regkey_count\" />\n";
|
||||
my $shortcuts = scalar keys %links;
|
||||
$output .= "\t\t<parm name=\"NumShortcuts\" value=\"$shortcuts\" />\n";
|
||||
$output .= "\t</characteristic>\n";
|
||||
|
||||
$output .= "\t<characteristic type=\"FileOperation\">\n";
|
||||
|
||||
foreach my $path (get_value_sorted_keys %file_ids) {
|
||||
my $file_id = $file_ids{$path};
|
||||
my $dir = $file_dirs{$path};
|
||||
my $file = $path;
|
||||
$file =~ s/^.*\///g;
|
||||
$file =~ s/\//\\/g;
|
||||
$dir =~ s/\//\\/g;
|
||||
my $munged_file = munge_filename $file, $file_id;
|
||||
$output .= "\t\t<characteristic type=\"$dir\" translation=\"install\">\n";
|
||||
$output .= "\t\t\t<characteristic type=\"MakeDir\" />\n";
|
||||
$output .= "\t\t\t<characteristic type=\"$file\" translation=\"install\">\n";
|
||||
$output .= "\t\t\t\t<characteristic type=\"Extract\">\n";
|
||||
$output .= "\t\t\t\t\t<parm name=\"Source\" value=\"$munged_file\" />\n";
|
||||
$output .= "\t\t\t\t</characteristic>\n";
|
||||
$output .= "\t\t\t</characteristic>\n";
|
||||
$output .= "\t\t</characteristic>\n";
|
||||
}
|
||||
foreach my $link (get_value_sorted_keys %link_dirs) {
|
||||
my $link_dir = $link_dirs{$link};
|
||||
my $link_target = $link_targets{$link};
|
||||
$link =~ s/\//\\/g;
|
||||
$link_dir =~ s/\//\\/g;
|
||||
$link_target =~ s/\//\\/g;
|
||||
$output .= "\t\t<characteristic type=\"$link_dir\" translation=\"install\">\n";
|
||||
$output .= "\t\t\t<characteristic type=\"MakeDir\" />\n";
|
||||
$output .= "\t\t\t<characteristic type=\"$link\" translation=\"install\">\n";
|
||||
$output .= "\t\t\t\t<characteristic type=\"Shortcut\">\n";
|
||||
$output .= "\t\t\t\t\t<parm name=\"Source\" value=\"$link_target\" translation=\"install\" />\n";
|
||||
$output .= "\t\t\t\t</characteristic>\n";
|
||||
$output .= "\t\t\t</characteristic>\n";
|
||||
$output .= "\t\t</characteristic>\n";
|
||||
}
|
||||
$output .= "\t</characteristic>\n";
|
||||
$output .= "\t<characteristic type=\"Registry\">\n";
|
||||
foreach my $regkey_id (get_value_sorted_keys %regkey_ids) {
|
||||
my $key = $regkey_keys[$regkey_id];
|
||||
my $name = $regkey_names[$regkey_id];
|
||||
my $type = $regkey_types[$regkey_id];
|
||||
my $value = $regkey_xmlvalues[$regkey_id];
|
||||
$key =~ s/\//\\/g;
|
||||
$output .= "\t\t<characteristic type=\"$key\">\n";
|
||||
$output .= "\t\t\t<parm name=\"$name\" value=\"$value\" datatype=\"$type\" />\n";
|
||||
$output .= "\t\t</characteristic>\n";
|
||||
}
|
||||
$output .= "\t</characteristic>\n";
|
||||
$output .= "</wap-provisioningdoc>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
# Prints the version message and exits.
|
||||
sub version()
|
||||
{
|
||||
print
|
||||
"pocketpc-cab 1.0.1\n" .
|
||||
"Written by Shaun Jackman <sjackman\@gmail.com>.\n" .
|
||||
"\n" .
|
||||
"Copyright 2006 Shaun Jackman\n" .
|
||||
"This is free software; see the source for copying\n" .
|
||||
"conditions. There is NO warranty; not even for\n" .
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
# Main.
|
||||
sub main()
|
||||
{
|
||||
# Parse the command line.
|
||||
my $provider = 'Provider';
|
||||
my $application = 'Application';
|
||||
my $sourcedir = '';
|
||||
my $destdir = '';
|
||||
my $regfile;
|
||||
|
||||
GetOptions(
|
||||
"provider=s" => \$provider,
|
||||
"application=s" => \$application,
|
||||
"source=s" => \$sourcedir,
|
||||
"dest=s" => \$destdir,
|
||||
"registry=s" => \$regfile,
|
||||
"verbose|v!" => \$verbose,
|
||||
"help|?" => sub { pod2usage(
|
||||
-exitstatus => 0, -verbose => 1) },
|
||||
"man" => sub { pod2usage(
|
||||
-exitstatus => 0, -verbose => 2) },
|
||||
"version" => \&version);
|
||||
|
||||
$sourcedir .= '/' if length $sourcedir > 0;
|
||||
$destdir .= '/' if length $destdir > 0;
|
||||
|
||||
if( scalar @ARGV < 1) {
|
||||
print
|
||||
"pocketpc-cab: missing file arguments\n" .
|
||||
"Try `pocketpc-cab --help' for more information.\n";
|
||||
exit 1;
|
||||
}
|
||||
my $cab_filename = pop @ARGV;
|
||||
|
||||
# Parse the input file.
|
||||
parse_input( $destdir);
|
||||
parse_regfile($regfile) if defined $regfile;
|
||||
|
||||
# Create the manifest.
|
||||
my $manifest = "manifest.000";
|
||||
open MANIFEST, ">$manifest";
|
||||
binmode MANIFEST;
|
||||
print MANIFEST get_manifest( $provider, $application);
|
||||
close MANIFEST;
|
||||
|
||||
# Create the _setup.xml
|
||||
my $setupxml = "_setup.xml";
|
||||
open SETUPXML, ">$setupxml";
|
||||
print SETUPXML get_setupxml( $provider, $application);
|
||||
close SETUPXML;
|
||||
|
||||
# Copy the data files.
|
||||
my $munged_files = " $setupxml";
|
||||
my $i = 0;
|
||||
foreach my $file (get_value_sorted_keys %file_ids) {
|
||||
my $munged_file = munge_filename $file, ++$i;
|
||||
print "$file: $munged_file\n" if $verbose;
|
||||
`cp "$sourcedir$file" "$munged_file"`;
|
||||
exit $? >> 8 if $? > 0;
|
||||
$munged_files = ' ' . $munged_file . $munged_files;
|
||||
}
|
||||
$munged_files = 'manifest.000' . $munged_files;
|
||||
|
||||
# Create the cab.
|
||||
print "$cab_filename: $munged_files\n" if $verbose;
|
||||
my $lcab_output = `lcab $munged_files $cab_filename`;
|
||||
exit $? >> 8 if $? > 0;
|
||||
print $lcab_output if $verbose;
|
||||
`rm $munged_files`;
|
||||
}
|
||||
|
||||
|
||||
# Entry-point.
|
||||
main;
|
||||
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
pocketpc-cab - build an installable Pocket PC cabinet file
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<pocketpc-cab> [I<OPTION>]... I<INPUTFILE> I<CABINET>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Read the INPUTFILE, which is a list of filenames and destination
|
||||
directories, and create CABINET, a cabinet file, that will install
|
||||
those files into the specified directories.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over
|
||||
|
||||
=item B<-p, --provider>=I<PROVIDER>
|
||||
|
||||
set the provider name
|
||||
|
||||
=item B<-a, --application>=I<APPLICATION>
|
||||
|
||||
set the application name
|
||||
|
||||
=item B<-s, --source>=I<SOURCE>
|
||||
|
||||
set the source directory
|
||||
|
||||
=item B<-d, --dest>=I<DEST>
|
||||
|
||||
set the destination directory
|
||||
|
||||
=item B<-r, --registry>=I<REGISTRYFILE>
|
||||
|
||||
use a registry specification file
|
||||
|
||||
=item B<-v, --verbose>
|
||||
|
||||
display verbose output
|
||||
|
||||
=item B<--help>
|
||||
|
||||
display a brief help message
|
||||
|
||||
=item B<--man>
|
||||
|
||||
display the full documentation
|
||||
|
||||
=back
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
$ cat > foobar.files <<EOF
|
||||
foobar.exe /bin "Shortcut Name" %CE11%
|
||||
foobar.dll /windows
|
||||
EOF
|
||||
$ cat > foobar.regkeys <<EOF
|
||||
HKCU Software/Fooware/Foobar Name string "Some string"
|
||||
HKCU Software/Fooware/Foobar Data binary 00112233445566778899aabbccddeeff
|
||||
HKCU Software/Fooware/Foobar Value integer 42
|
||||
HKCU Software/Fooware/Foobar HexValue integer 0xff
|
||||
HKCU Software/Fooware/Foobar Names multistring "String 1" "String 2"
|
||||
EOF
|
||||
$ pocketpc-cab -p Fooware -a FooBar -r foobar.regkeys foobar.files foobar.cab
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Written by Shaun Jackman.
|
||||
|
||||
=head1 REPORTING BUGS
|
||||
|
||||
Report bugs to Shaun Jackman <sjackman@gmail.com>.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2006 Shaun Jackman
|
||||
|
||||
This is free software; see the source for copying conditions. There is
|
||||
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
=over
|
||||
|
||||
=item B<lcab>(1)
|
||||
|
||||
create cabinet archives
|
||||
|
||||
=item B</usr/share/doc/pocketpc-cab/wince_cab_format.html>
|
||||
|
||||
Windows CE installation cabinet file format
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
ChangeLog
|
||||
|
||||
2006-04-06 Shaun Jackman <sjackman@gmail.com>
|
||||
|
||||
* Release version 1.0.1.
|
||||
* Fix the CAB for WinCE5 by putting the manifest.000 file first in
|
||||
the cabinet file.
|
||||
Thanks to Rouven Schürch <rouven.schuerch@tegonal.com>.
|
||||
|
||||
2004-09-17 Shaun Jackman <sjackman@debian.org>
|
||||
|
||||
* Initial release, version 1.0.0.
|
|
@ -1,129 +0,0 @@
|
|||
/*
|
||||
* Generates #defines that are best kept sequential
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
static char* ids[] = {
|
||||
"IDS_MENU"
|
||||
,"IDS_CANCEL"
|
||||
,"IDS_OK"
|
||||
,"IDS_ABOUT"
|
||||
,"IDS_DONE"
|
||||
,"IDS_LANGUAGE_NAME"
|
||||
,"IDS_NEW_GAME"
|
||||
,"IDS_DICTLOC"
|
||||
,"IDS_SAVENAME"
|
||||
,"IDS_DUPENAME"
|
||||
,"IDS_RENAME"
|
||||
,"IDS_REMAINING_TILES_ADD"
|
||||
,"IDS_UNUSED_TILES_SUB"
|
||||
,"IDS_BONUS_ALL"
|
||||
,"IDS_TURN_SCORE"
|
||||
,"IDS_COMMIT_CONFIRM"
|
||||
,"IDS_LOCAL_NAME"
|
||||
,"IDS_REM"
|
||||
,"IDS_IGNORE_L"
|
||||
,"IDS_WARN_L"
|
||||
,"IDS_DISALLOW_L"
|
||||
,"IDS_NONLOCAL_NAME"
|
||||
,"IDS_TIME_PENALTY_SUB"
|
||||
,"IDS_CUMULATIVE_SCORE"
|
||||
,"IDS_MOVE_ACROSS"
|
||||
,"IDS_MOVE_DOWN"
|
||||
,"IDS_TRAY_AT_START"
|
||||
,"IDS_NEW_TILES"
|
||||
,"IDS_TRADED_FOR"
|
||||
,"IDS_PASS"
|
||||
,"IDS_PHONY_REJECTED"
|
||||
,"IDS_ROBOT_TRADED"
|
||||
,"IDS_ROBOT_MOVED"
|
||||
,"IDS_REMOTE_MOVED"
|
||||
,"IDS_PASSED"
|
||||
,"IDS_REMTILES_L"
|
||||
,"IDS_SUMMARYSCORED"
|
||||
,"IDS_TRADED"
|
||||
,"IDS_LOSTTURN"
|
||||
,"IDS_TOTALPLAYERS"
|
||||
,"IDS_VALUES_HEADER"
|
||||
,"IDS_TILES_NOT_IN_LINE"
|
||||
,"IDS_NO_EMPTIES_IN_TURN"
|
||||
,"IDS_TWO_TILES_FIRST_MOVE"
|
||||
,"IDS_TILES_MUST_CONTACT"
|
||||
,"IDS_NOT_YOUR_TURN"
|
||||
,"IDS_NO_PEEK_ROBOT_TILES"
|
||||
,"IDS_CANT_TRADE_MID_MOVE"
|
||||
,"IDS_TOO_FEW_TILES_LEFT_TO_TRADE"
|
||||
,"IDS_CANT_UNDO_TILEASSIGN"
|
||||
,"IDS_CANT_HINT_WHILE_DISABLED"
|
||||
,"IDS_QUERY_TRADE"
|
||||
,"IDS_DOUBLE_LETTER"
|
||||
,"IDS_DOUBLE_WORD"
|
||||
,"IDS_TRIPLE_LETTER"
|
||||
,"IDS_TRIPLE_WORD"
|
||||
,"IDS_INTRADE_MW"
|
||||
,"IDS_COUNTSVALS_L"
|
||||
,"IDS_GAMEHIST_L"
|
||||
,"IDS_FINALSCORE_L"
|
||||
,"IDS_QUESTION_L"
|
||||
,"IDS_FYI_L"
|
||||
,"IDS_ILLEGALWRD_L"
|
||||
,"IDS_WRDNOTFOUND"
|
||||
,"IDS_USEANYWAY"
|
||||
,"IDS_CANNOTOPEN_GAME"
|
||||
,"IDS_NODICT_L"
|
||||
,"IDS_ABOUT_L"
|
||||
,"IDS_OVERWRITE"
|
||||
,"IDS_ENDNOW"
|
||||
,"IDS_CANNOTOPEN_DICT"
|
||||
,"IDS_CONFIM_DELETE"
|
||||
,"IDS_ROLE_STANDALONE"
|
||||
,"IDS_ROLE_HOST"
|
||||
,"IDS_ROLE_GUEST"
|
||||
,"IDS_PLAYER_FORMAT"
|
||||
,"IDS_UNTITLED_FORMAT"
|
||||
,"IDS_CONN_RELAY"
|
||||
,"IDS_CONN_DIRECT"
|
||||
,"IDS_CONN_SMS"
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
,"IDS_LOCALPLAYERS"
|
||||
,"IDS_NO_PEEK_REMOTE_TILES"
|
||||
,"IDS_REG_UNEXPECTED_USER"
|
||||
,"IDS_SERVER_DICT_WINS"
|
||||
,"IDS_REG_SERVER_SANS_REMOTE"
|
||||
# ifdef XWFEATURE_RELAY
|
||||
,"IDS_XWRELAY_ERROR_TIMEOUT"
|
||||
,"IDS_ERROR_HEART_YOU"
|
||||
,"IDS_XWRELAY_ERROR_HEART_OTHER"
|
||||
,"IDS_XWRELAY_ERROR_LOST_OTHER"
|
||||
# endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#define FIRST_ID 40002
|
||||
|
||||
int
|
||||
main( int argc, char** argv )
|
||||
{
|
||||
int firstID = FIRST_ID;
|
||||
int ii;
|
||||
|
||||
printf( "/* -*- mode: c; -*- */\n" );
|
||||
printf( "/***********************************************************\n" );
|
||||
printf( " * GENERATED CODE; DO NOT EDIT\n" );
|
||||
printf( " * (edit scripts/strids.c instead)\n" );
|
||||
printf( " ***********************************************************/\n" );
|
||||
printf( "\n" );
|
||||
|
||||
for ( ii = 0; ii < sizeof(ids)/sizeof(ids[0]); ++ii ) {
|
||||
printf( "#define %-60s %d\n", ids[ii], firstID++ );
|
||||
}
|
||||
|
||||
printf( "\n" );
|
||||
printf( "#define %-60s %d\n", "CE_FIRST_RES_ID", FIRST_ID );
|
||||
printf( "#define %-60s %d\n", "CE_LAST_RES_ID", FIRST_ID + ii - 1 );
|
||||
|
||||
return 0;
|
||||
|
||||
argc = argc;
|
||||
argv = argv;
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Make sure the windres we have is correctly converting utf-8 to
|
||||
# utf-16. We'll cons up a fake .rc file, compile it, hexdump it and
|
||||
# look for a pattern. Use Polish for grins.
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 path/to/windres"
|
||||
}
|
||||
|
||||
STR="Wartości i ilości klocków"
|
||||
RC_FILE=/tmp/test_$$.rc
|
||||
DOT_O_FILE=/tmp/test_$$.o
|
||||
WINDRES=$1
|
||||
which $WINDRES || usage
|
||||
|
||||
# Create the .rc file
|
||||
cat > $RC_FILE <<EOF
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
1000 "$STR"
|
||||
END
|
||||
EOF
|
||||
|
||||
# compile it
|
||||
${WINDRES} -c 65001 $RC_FILE -o $DOT_O_FILE
|
||||
|
||||
NEEDLE=$(echo -n "$STR" | iconv -t UTF-16LE | hexdump -v -e '1/1 "%02X"')
|
||||
HAYSTACK=$(hexdump -v -e '1/1 "%02X"' < $DOT_O_FILE)
|
||||
|
||||
rm -f $RC_FILE $DOT_O_FILE
|
||||
|
||||
if echo $HAYSTACK | grep -q $NEEDLE; then
|
||||
exit 0
|
||||
else
|
||||
echo "failed!!!"
|
||||
echo $NEEDLE
|
||||
echo $HAYSTACK
|
||||
exit 1
|
||||
fi
|
|
@ -1,58 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
PLAT=win32
|
||||
DBG=dbg
|
||||
|
||||
SIZES=(
|
||||
240x214 # Treo in full-screen mode
|
||||
240x188 # Treo in normal mode
|
||||
|
||||
176x200 # 6.1 standard
|
||||
200x176 # flipped
|
||||
|
||||
480x536 # VGA, non full-screen
|
||||
536x480
|
||||
|
||||
400x240
|
||||
240x400
|
||||
440x240
|
||||
240x440
|
||||
|
||||
320x186 # WM 6.1 Standard landscape
|
||||
186x320
|
||||
|
||||
240x266 # WM 6.1 Standard QVGA
|
||||
266x240 # flipped
|
||||
|
||||
266x320 # WM 6.1 Standard square w/title bar
|
||||
320x266 # flipped
|
||||
320x320 # full-screen mode
|
||||
|
||||
320x250 # WM 6 Pro 320x320 short for some reason
|
||||
320x285 # with tile bar
|
||||
# 320x320 # full-screen mode
|
||||
)
|
||||
|
||||
cd $(dirname $0)
|
||||
EXES=$(ls -c ../obj_${PLAT}_${DBG}/built/xwords4_*.exe)
|
||||
|
||||
if ls ../obj_${PLAT}_${DBG}/built/*.xwd >/dev/null 2>&1; then
|
||||
: # nothing to do
|
||||
elif [ -s "$XWDICT" ]; then
|
||||
cp $XWDICT ../obj_${PLAT}_${DBG}
|
||||
else
|
||||
cp ../../dawg/English/BasEnglish2to8.xwd ../obj_${PLAT}_${DBG}
|
||||
fi
|
||||
|
||||
for SIZE in ${SIZES[*]}; do
|
||||
WIDTH=${SIZE%x*}
|
||||
HEIGHT=${SIZE#*x}
|
||||
|
||||
for EXE in $EXES; do #
|
||||
CMD="wine $EXE width=$WIDTH height=$HEIGHT"
|
||||
echo $CMD
|
||||
eval "$CMD"
|
||||
break # -c sorts by date, so quit after running newest
|
||||
done
|
||||
|
||||
done
|
|
@ -1,49 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Script for turning Crosswords .xwd files into .cab files that, when
|
||||
# run on a PPC device, will install the enclosed .xwd file into a
|
||||
# Crosswords directory in "c:\Program Files\Crosswords".
|
||||
|
||||
use strict;
|
||||
|
||||
my $provider = "\"Crosswords project\"";
|
||||
|
||||
usage() if 0 == @ARGV;
|
||||
|
||||
while ( my $path = shift @ARGV ) {
|
||||
|
||||
unless ( $path =~ m|.xwd$| ) {
|
||||
print STDERR "skipping $path: doesn't end in .xwd\n";
|
||||
next;
|
||||
}
|
||||
unless (-f $path ) {
|
||||
print STDERR "skipping $path: not found\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my $fname = "/tmp/file$$.list";
|
||||
|
||||
# see this url for %CE5% and other definitions:
|
||||
# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevGuideSP/html/sp_wce51consmartphonewindowscestringsozup.asp
|
||||
|
||||
open FILE, "> $fname";
|
||||
print FILE "$path ";
|
||||
print FILE '%CE1%\\\\Crosswords', "\n";
|
||||
close FILE;
|
||||
|
||||
my $cabname = `basename $path`;
|
||||
chomp $cabname;
|
||||
$cabname =~ s/.xwd$//;
|
||||
my $appname = $cabname;
|
||||
$cabname .= "_xwd.cab";
|
||||
|
||||
`./scripts/pocketpc-cab -p $provider -a $appname $fname $cabname`;
|
||||
|
||||
print STDERR "$cabname done\n";
|
||||
unlink $fname;
|
||||
}
|
||||
|
||||
sub usage() {
|
||||
print STDERR "usage: $0 xwdfile[ xwdfile]*\n";
|
||||
exit 2;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
# -*- mode: Makefile; -*-
|
||||
|
||||
ifeq (x$(shell echo $$PPC_SDK_PPC)x,xx)
|
||||
WINCE_PATH = "PLEASE DEFINE shell env variable WINCE_DEV_PATH"
|
||||
include exit_right_now
|
||||
else
|
||||
WINCE_PATH = $(shell echo $$PPC_SDK_PPC)
|
||||
endif
|
||||
|
||||
PLATOBJ = \
|
||||
$(PLATFORM)/StdAfx.o \
|
||||
$(PLATFORM)/ceaskpwd.o \
|
||||
$(PLATFORM)/ceblank.o \
|
||||
$(PLATFORM)/cedict.o \
|
||||
$(PLATFORM)/cedraw.o \
|
||||
$(PLATFORM)/ceginfo.o \
|
||||
$(PLATFORM)/cecondlg.o \
|
||||
$(PLATFORM)/cemain.o \
|
||||
$(PLATFORM)/ceprefs.o \
|
||||
$(PLATFORM)/cestrbx.o \
|
||||
$(PLATFORM)/ceutil.o \
|
||||
$(PLATFORM)/ceclrsel.o \
|
||||
$(PLATFORM)/cesockwr.o \
|
||||
$(PLATFORM)/cehntlim.o \
|
||||
|
||||
XW_BOTH_DEFINES = \
|
||||
/DBEYOND_IR /DNODE_CAN_4 /DMY_COLOR_SEL \
|
||||
/DCOLOR_SUPPORT /DFEATURE_TRAY_EDIT /DXWFEATURE_SEARCHLIMIT \
|
||||
/DXWFEATURE_HINT_CONFIG \
|
||||
/D POINTER_SUPPORT /D KEY_SUPPORT /D __LITTLE_ENDIAN \
|
||||
/DCEFEATURE_CANSCROLL \
|
||||
$(DEBUG) $(MEM_DEBUG) \
|
||||
|
||||
XW_C_DEFINES = \
|
||||
$(XW_BOTH_DEFINES) \
|
||||
|
||||
XW_RES_DEFINES = \
|
||||
$(XW_BOTH_DEFINES)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
debug:
|
||||
$(MAKE) DEBUG="/DDEBUG"
|
||||
|
||||
memdebug:
|
||||
$(MAKE) DEBUG="/DDEBUG" MEM_DEBUG="/DMEM_DEBUG"
|
|
@ -1,59 +0,0 @@
|
|||
# -*- mode: Makefile; compile-command: "make -f simrel.mk"; -*-
|
||||
|
||||
PLATFORM = emulatorDbg
|
||||
TARGET = $(PLATFORM)/xwords4.exe
|
||||
|
||||
LIBS = commctrl.lib coredll.lib corelibc.lib winsock.lib aygshell.lib
|
||||
RSRC = $(PLATFORM)/xwords4.res
|
||||
|
||||
MAKE = make -f simrel.mk
|
||||
CC = $(WCE420)/bin/cl.exe
|
||||
LINK = $(WCE420)/bin/link.exe
|
||||
RC = $(VSDIR)/Common/MSDev98/Bin/rc.exe
|
||||
|
||||
include ../common/config.mk
|
||||
|
||||
include ./shared.mk
|
||||
|
||||
C_CMD = \
|
||||
$(CC) /nologo /W3 /Zi /Od \
|
||||
/I "$(WINCE_PATH)\Include\Emulator" \
|
||||
/I "..\common" /I "..\relay" /I "." /D "DEBUG" /D "_i386_" /D UNDER_CE=420 \
|
||||
/D _WIN32_WCE=420 /D "WIN32_PLATFORM_PSPC=400" /D "i_386_" \
|
||||
/D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" $(XW_C_DEFINES) \
|
||||
/Fo$@ /Gs8192 /GF /c $<
|
||||
|
||||
$(PLATFORM)/StdAfx.o: StdAfx.cpp
|
||||
$(C_CMD)
|
||||
|
||||
$(PLATFORM)/%.o: %.c
|
||||
$(C_CMD)
|
||||
|
||||
../common/$(PLATFORM)/%.o: ../common/%.c
|
||||
$(C_CMD)
|
||||
|
||||
$(RSRC): xwords4.rc
|
||||
$(RC) /l 0x409 /fo$@ \
|
||||
/i "$(WINCE_PATH)\Include\Emulator" \
|
||||
/d "WIN32_PLATFORM_PSPC=400" /d UNDER_CE=420 /d _WIN32_WCE=420 \
|
||||
/d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "_X86_" /d "x86" /d "_i386_" \
|
||||
$(XW_RES_DEFINES) \
|
||||
/r $<
|
||||
|
||||
test:
|
||||
echo $(basename $(TARGET)).pdb
|
||||
|
||||
$(TARGET): $(COMMONOBJ) $(PLATOBJ) $(RSRC)
|
||||
$(LINK) $(LIBS) /nologo /base:"0x00010000" /stack:0x10000,0x1000 \
|
||||
/entry:"WinMainCRTStartup" /incremental:yes \
|
||||
/pdb:$(basename $(TARGET)).pdb \
|
||||
/debug /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:libc.lib \
|
||||
/nodefaultlib:libcd.lib /nodefaultlib:libcmt.lib \
|
||||
/nodefaultlib:libcmtd.lib /nodefaultlib:msvcrt.lib \
|
||||
/nodefaultlib:msvcrtd.lib /out:$@ \
|
||||
/libpath:"$(WINCE_PATH)\Lib\emulator" \
|
||||
/subsystem:windowsce,4.20 /MACHINE:IX86 \
|
||||
$(COMMONOBJ) $(PLATOBJ) $(RSRC)
|
||||
|
||||
clean:
|
||||
rm -f $(COMMONOBJ) $(PLATOBJ) $(TARGET) $(RSRC) $(PLATFORM)/*.pdb
|
|
@ -1,25 +0,0 @@
|
|||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
|
||||
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
|
||||
// Local Header Files
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
|
|
@ -1,144 +0,0 @@
|
|||
/* -*- mode: c; -*- */
|
||||
|
||||
/* Don't change these casually. .exe and .dll must agree on them. Also, they
|
||||
* should be kept sequential since an array of length
|
||||
* CE_LAST_RES_ID-CE_FIRST_RES_ID is allocated in ceresstr.c.
|
||||
*/
|
||||
|
||||
#ifndef _STRIDS_H_
|
||||
#define _STRIDS_H_
|
||||
|
||||
/* CUR_DLL_VERSION is included in all .dll resources and can be used to check
|
||||
* whether a given resource can be trusted. Up it when changing the order of
|
||||
* strings. Which do only when unavoidable.
|
||||
*/
|
||||
#define CUR_DLL_VERSION 0x0003
|
||||
|
||||
|
||||
#define CE_FIRST_RES_ID 40002
|
||||
|
||||
#define IDS_MENU CE_FIRST_RES_ID
|
||||
#define IDS_CANCEL 40003
|
||||
#define IDS_OK 40004
|
||||
#define IDS_ABOUT 40005
|
||||
#define IDS_DONE 40006
|
||||
#define IDS_LANGUAGE_NAME 40007
|
||||
#define IDS_NEW_GAME 40008
|
||||
#define IDS_DICTLOC 40009
|
||||
#define IDS_SAVENAME 40010
|
||||
#define IDS_DUPENAME 40011
|
||||
#define IDS_RENAME 40012
|
||||
#define IDS_REMAINING_TILES_ADD 40013
|
||||
#define IDS_UNUSED_TILES_SUB 40014
|
||||
#define IDS_BONUS_ALL 40015
|
||||
#define IDS_TURN_SCORE 40016
|
||||
#define IDS_COMMIT_CONFIRM 40017
|
||||
#define IDS_LOCAL_NAME 40018
|
||||
#define IDS_IGNORE_L 40019
|
||||
#define IDS_WARN_L 40020
|
||||
#define IDS_DISALLOW_L 40021
|
||||
#define IDS_NONLOCAL_NAME 40022
|
||||
#define IDS_TIME_PENALTY_SUB 40023
|
||||
#define IDS_CUMULATIVE_SCORE 40024
|
||||
#define IDS_MOVE_ACROSS 40025
|
||||
#define IDS_MOVE_DOWN 40026
|
||||
#define IDS_TRAY_AT_START 40027
|
||||
#define IDS_NEW_TILES 40028
|
||||
#define IDS_TRADED_FOR 40029
|
||||
#define IDS_PASS 40030
|
||||
#define IDS_PHONY_REJECTED 40031
|
||||
#define IDS_ROBOT_TRADED 40032
|
||||
#define IDS_ROBOT_MOVED 40033
|
||||
#define IDS_REMOTE_MOVEDF 40034
|
||||
#define IDS_PASSED 40035
|
||||
#define IDS_REMTILES_L 40036
|
||||
#define IDS_SUMMARYSCORED 40037
|
||||
#define IDS_TRADED 40038
|
||||
#define IDS_LOSTTURN 40039
|
||||
#define IDS_TOTALPLAYERS 40040
|
||||
#define IDS_VALUES_HEADER 40041
|
||||
#define IDS_TILES_NOT_IN_LINE 40042
|
||||
#define IDS_NO_EMPTIES_IN_TURN 40043
|
||||
#define IDS_TWO_TILES_FIRST_MOVE 40044
|
||||
#define IDS_TILES_MUST_CONTACT 40045
|
||||
#define IDS_NOT_YOUR_TURN 40046
|
||||
#define IDS_NO_PEEK_ROBOT_TILES 40047
|
||||
#define IDS_NO_EMPTY_TRADE 40048
|
||||
#define IDS_TOO_FEW_TILES_LEFT_TO_TRADE 40049
|
||||
#define IDS_CANT_UNDO_TILEASSIGN 40050
|
||||
#define IDS_CANT_HINT_WHILE_DISABLED 40051
|
||||
#define IDS_QUERY_TRADE 40052
|
||||
#define IDS_DOUBLE_LETTER 40053
|
||||
#define IDS_DOUBLE_WORD 40054
|
||||
#define IDS_TRIPLE_LETTER 40055
|
||||
#define IDS_TRIPLE_WORD 40056
|
||||
#define IDS_INTRADE_MW 40057
|
||||
#define IDS_COUNTSVALS_L 40058
|
||||
#define IDS_GAMEHIST_L 40059
|
||||
#define IDS_FINALSCORE_L 40060
|
||||
#define IDS_QUESTION_L 40061
|
||||
#define IDS_FYI_L 40062
|
||||
#define IDS_ILLEGALWRD_L 40063
|
||||
#define IDS_WRDNOTFOUND 40064
|
||||
#define IDS_USEANYWAY 40065
|
||||
#define IDS_CANNOTOPEN_GAME 40066
|
||||
#define IDS_NODICT_L 40067
|
||||
#define IDS_ABOUT_L 40068
|
||||
#define IDS_OVERWRITE 40069
|
||||
#define IDS_ENDNOW 40070
|
||||
#define IDS_CANNOTOPEN_DICT 40071
|
||||
#define IDS_CONFIM_DELETE 40072
|
||||
#define IDS_ROLE_STANDALONE 40073
|
||||
#define IDS_ROLE_HOST 40074
|
||||
#define IDS_ROLE_GUEST 40075
|
||||
#define IDS_PLAYER_FORMAT 40076
|
||||
#define IDS_UNTITLED_FORMAT 40077
|
||||
#define IDS_PASSWDFMT_L 40078
|
||||
#define IDS_FILEEXISTSFMT_L 40079
|
||||
#define IDS_NEED_TOUCH 40080
|
||||
#define IDS_EDITCOLOR_FORMAT 40081
|
||||
#define IDS_LANG_CHANGE_RESTART 40082
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
# define IDS_CONN_RELAY_L 40083
|
||||
# define IDS_CONN_DIRECT 40084
|
||||
# define IDS_LOCALPLAYERS 40085
|
||||
# define IDS_NO_PEEK_REMOTE_TILES 40086
|
||||
# define IDS_REG_UNEXPECTED_USER 40087
|
||||
# define IDS_SERVER_DICT_WINS 40088
|
||||
# define IDS_REG_SERVER_SANS_REMOTE 40089
|
||||
# define IDS_RESEND_STANDALONE 40090
|
||||
# define IDS_PHONE_OFF 40091
|
||||
# define IDS_NETWORK_FAILED 40092
|
||||
|
||||
|
||||
# ifdef XWFEATURE_SMS
|
||||
# define IDS_SMS_CONN_L 40093
|
||||
# endif
|
||||
|
||||
# ifdef XWFEATURE_IP_DIRECT
|
||||
# define IDS_DIRECT_CONN_L 40094
|
||||
# endif
|
||||
|
||||
# ifdef XWFEATURE_RELAY
|
||||
# define IDS_XWRELAY_ERROR_TIMEOUT 40095
|
||||
# define IDS_ERROR_HEART_YOU 40096
|
||||
# define IDS_XWRELAY_ERROR_HEART_OTHER 40097
|
||||
# define IDS_XWRELAY_ERROR_LOST_OTHER 40098
|
||||
# define IDS_XWRELAY_RELAY_INCOMPAT 40099
|
||||
# define IDS_RELAY_ALLHERE 40100
|
||||
# define IDS_RELAY_HOST_WAITINGD 40101
|
||||
# define IDS_RELAY_GUEST_WAITINGD 40102
|
||||
# define IDS_ERROR_NO_ROOM 40103
|
||||
# define IDS_ERROR_DUP_ROOM 40104
|
||||
# define IDS_ERROR_TOO_MANY 40105
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if ! defined XWFEATURE_STANDALONE_ONLY
|
||||
# define CE_LAST_RES_ID 40106
|
||||
#else
|
||||
# define CE_LAST_RES_ID 40082
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,15 +0,0 @@
|
|||
CEOPT_ROOT ?= /opt
|
||||
|
||||
CE_ARCH = arm-mingw32ce
|
||||
CC = $(CE_ARCH)-gcc
|
||||
|
||||
LFLAGS += -Wl,--major-subsystem-version,4,--minor-subsystem-version,20
|
||||
CFLAGS += -D_WIN32_WCE=0x0400 -D__W32API_USE_DLLIMPORT__
|
||||
CELIBS = -L${CEOPT_ROOT}/${CE_ARCH}/lib/ -lws2
|
||||
|
||||
messagebox.exe: messagebox.c
|
||||
$(CC) $(CFLAGS) $(LFLAGS) $^ $(CELIBS) -o $@
|
||||
|
||||
|
||||
clean:
|
||||
rm -f messagebox.exe
|
|
@ -1,9 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
int
|
||||
WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine,
|
||||
int nCmdShow )
|
||||
{
|
||||
MessageBox(0, L"HELLO!", L"H3LLO!", 0);
|
||||
return 0;
|
||||
}
|
|
@ -1,147 +0,0 @@
|
|||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
|
||||
/*
|
||||
* Copyright 1999-2009 by Eric House (xwords@eehouse.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 "stdafx.h"
|
||||
#include <stdlib.h>
|
||||
#include "xwords4.h"
|
||||
#include <commctrl.h>
|
||||
#include <winuser.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
typedef unsigned char XP_U8;
|
||||
typedef signed char XP_S8;
|
||||
|
||||
typedef unsigned short XP_U16;
|
||||
typedef signed short XP_S16;
|
||||
|
||||
typedef unsigned long XP_U32;
|
||||
typedef signed long XP_S32;
|
||||
|
||||
typedef char XP_UCHAR;
|
||||
|
||||
typedef signed short XP_FontCode; /* not sure how I'm using this yet */
|
||||
typedef BOOL XP_Bool;
|
||||
typedef XP_U32 XP_Time;
|
||||
|
||||
#define XP_TRUE ((XP_Bool)(1==1))
|
||||
#define XP_FALSE ((XP_Bool)(1==0))
|
||||
|
||||
#define XP_S "%s"
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define XP_RANDOM() Random()
|
||||
#else
|
||||
# define XP_RANDOM() rand()
|
||||
#endif
|
||||
|
||||
#ifdef MEM_DEBUG
|
||||
# define XP_PLATMALLOC(nbytes) malloc(nbytes)
|
||||
# define XP_PLATREALLOC(p,s) realloc((p), (s))
|
||||
# define XP_PLATFREE(p) free(p)
|
||||
#else
|
||||
# define XP_MALLOC(pool, nbytes) malloc(nbytes)
|
||||
# define XP_REALLOC(pool, p, bytes) realloc((p), (bytes))
|
||||
# define XP_FREE(pool, p) free(p)
|
||||
#endif
|
||||
|
||||
#define XP_MEMSET(src, val, nbytes) memset( (src), (val), (nbytes) )
|
||||
#define XP_MEMCPY(d,s,l) memcpy((d),(s),(l))
|
||||
#define XP_MEMMOVE(d,s,l) memmove((d),(s),(l))
|
||||
#define XP_MEMCMP( a1, a2, l ) memcmp((a1),(a2),(l))
|
||||
#define XP_STRLEN(s) strlen((s))
|
||||
#define XP_STRCAT(d,s) strcat((d),(s))
|
||||
#define XP_STRCMP(s1,s2) strcmp((char*)(s1),(char*)(s2))
|
||||
#define XP_STRNCMP(s1,s2,l) strncmp((char*)(s1),(char*)(s2),(l))
|
||||
#define XP_STRNCPY(s,d,l) strncpy((s),(d),(l))
|
||||
#define XP_SNPRINTF wince_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) if(!(b)) { wince_assert(#b, __LINE__, __FILE__, __func__); }
|
||||
#else
|
||||
# define XP_ASSERT(b)
|
||||
#endif
|
||||
|
||||
//#define XP_STATUSF if(0)p_ignore
|
||||
#define XP_STATUSF XP_DEBUGF
|
||||
|
||||
#ifdef ENABLE_LOGGING
|
||||
#define XP_DEBUGF(...) wince_debugf(__VA_ARGS__)
|
||||
#define XP_LOGF(...) wince_debugf(__VA_ARGS__)
|
||||
#define XP_WARNF(...) wince_warnf(__VA_ARGS__)
|
||||
#else
|
||||
#define XP_DEBUGF(...)
|
||||
#define XP_LOGF(...)
|
||||
#define XP_WARNF(...)
|
||||
#endif
|
||||
|
||||
#ifdef CPLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void wince_assert(XP_UCHAR* s, int line, const char* fileName, const char* func );
|
||||
void wince_debugf(const XP_UCHAR*, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
void wince_warnf(const XP_UCHAR*, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
void p_ignore(XP_UCHAR*, ...);
|
||||
XP_U16 wince_snprintf( XP_UCHAR* buf, XP_U16 len,
|
||||
const XP_UCHAR* format, ... );
|
||||
|
||||
#define XP_NTOHL(l) ntohl(l)
|
||||
#define XP_NTOHS(s) ntohs(s)
|
||||
#define XP_HTONL(l) htonl(l)
|
||||
#define XP_HTONS(s) htons(s)
|
||||
|
||||
#define XP_LD "%ld"
|
||||
#define XP_P "%p"
|
||||
|
||||
/* The pocketpc sdk on linux renames certain functions to avoid conflicts
|
||||
with same-named posix symbols. */
|
||||
/* #if defined __GNUC__ && defined _WIN32_WCE */
|
||||
/* # define MS(func) M$_##func */
|
||||
/* #else */
|
||||
# define MS(func) func
|
||||
/* #endif */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# undef CALLBACK
|
||||
# define CALLBACK
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define XP_UNUSED_CE(x) XP_UNUSED(x)
|
||||
# define XP_UNUSED_32(x) x
|
||||
#else
|
||||
# define XP_UNUSED_32(x) XP_UNUSED(x)
|
||||
# define XP_UNUSED_CE(x) x
|
||||
#endif
|
||||
|
||||
#ifdef CPLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#if !defined(AFX_XWORDS4_H__3DCA3EAB_CFD4_4487_BE8C_E563D65B4008__INCLUDED_)
|
||||
#define AFX_XWORDS4_H__3DCA3EAB_CFD4_4487_BE8C_E563D65B4008__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
#endif // !defined(AFX_XWORDS4_H__3DCA3EAB_CFD4_4487_BE8C_E563D65B4008__INCLUDED_)
|
Before Width: | Height: | Size: 1.5 KiB |