From 1e5024f4d5d084c064bc3f87aae0fb81ed4ecc09 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 20 May 2019 06:26:57 -0700 Subject: [PATCH] remove wince files --- xwords4/wince/.gitignore | 4 - xwords4/wince/LocalizedStrIncludes.h | 65 - xwords4/wince/Makefile | 305 -- xwords4/wince/README.txt | 102 - xwords4/wince/StdAfx.cpp | 8 - xwords4/wince/armrel.mk | 73 - xwords4/wince/bmps/.gitignore | 1 - xwords4/wince/bmps/downarro.pgm | 15 - xwords4/wince/bmps/flip.bmp | Bin 126 -> 0 bytes xwords4/wince/bmps/hint.bmp | Bin 126 -> 0 bytes xwords4/wince/bmps/juggle.bmp | Bin 126 -> 0 bytes xwords4/wince/bmps/netarrow.pgm | 19 - xwords4/wince/bmps/origin.pgm | 15 - xwords4/wince/bmps/rightarrow.pgm | 15 - xwords4/wince/bmps/values.bmp | Bin 126 -> 0 bytes xwords4/wince/bmps/xwords4_ico_16x16.png | Bin 278 -> 0 bytes xwords4/wince/bmps/xwords4_ico_22x22.png | Bin 343 -> 0 bytes xwords4/wince/bmps/xwords4_ico_32x32.png | Bin 352 -> 0 bytes xwords4/wince/ceaskpwd.c | 84 - xwords4/wince/ceaskpwd.h | 37 - xwords4/wince/ceblank.c | 183 - xwords4/wince/ceblank.h | 29 - xwords4/wince/ceclrsel.c | 473 --- xwords4/wince/ceclrsel.h | 28 - xwords4/wince/cecondlg.c | 374 -- xwords4/wince/cecondlg.h | 33 - xwords4/wince/ceconnmg.h | 44 - xwords4/wince/cedebug.c | 153 - xwords4/wince/cedebug.h | 45 - xwords4/wince/cedefines.h | 37 - xwords4/wince/cedict.c | 863 ---- xwords4/wince/cedict.h | 51 - xwords4/wince/cedraw.c | 2384 ----------- xwords4/wince/cedraw.h | 52 - xwords4/wince/cefonts.c | 265 -- xwords4/wince/cefonts.h | 29 - xwords4/wince/ceginfo.c | 832 ---- xwords4/wince/ceginfo.h | 49 - xwords4/wince/cehntlim.c | 108 - xwords4/wince/cehntlim.h | 39 - xwords4/wince/ceir.h | 32 - xwords4/wince/cemain.c | 3940 ------------------ xwords4/wince/cemain.h | 281 -- xwords4/wince/ceprefs.c | 431 -- xwords4/wince/ceprefs.h | 68 - xwords4/wince/ceresstr.c | 407 -- xwords4/wince/ceresstr.h | 40 - xwords4/wince/cesms.c | 41 - xwords4/wince/cesms.h | 28 - xwords4/wince/cesockwr.c | 684 ---- xwords4/wince/cesockwr.h | 69 - xwords4/wince/cestrbx.c | 159 - xwords4/wince/cestrbx.h | 27 - xwords4/wince/cesvdgms.c | 518 --- xwords4/wince/cesvdgms.h | 37 - xwords4/wince/ceutil.c | 1122 ------ xwords4/wince/ceutil.h | 112 - xwords4/wince/common_rsrc.rc | 80 - xwords4/wince/connmgr.h | 161 - xwords4/wince/debhacks.c | 102 - xwords4/wince/debhacks.h | 94 - xwords4/wince/l10n/xwords4_caps.rc | 970 ----- xwords4/wince/l10n/xwords4_catalan.rc | 1047 ----- xwords4/wince/l10n/xwords4_czech.rc | 1056 ----- xwords4/wince/l10n/xwords4_english.rc | 1062 ----- xwords4/wince/l10n/xwords4_french.rc | 1017 ----- xwords4/wince/l10n/xwords4_polish.rc | 1023 ----- xwords4/wince/newres.h | 39 - xwords4/wince/rc_incs.h | 31 - xwords4/wince/resource.h | 320 -- xwords4/wince/scripts/check_ids.sh | 40 - xwords4/wince/scripts/dll2cab.pl | 59 - xwords4/wince/scripts/exe2cab.pl | 80 - xwords4/wince/scripts/makezip.sh | 77 - xwords4/wince/scripts/pocketpc-cab | 720 ---- xwords4/wince/scripts/strids.c | 129 - xwords4/wince/scripts/test_windres.sh | 40 - xwords4/wince/scripts/testsizes.sh | 58 - xwords4/wince/scripts/xwd2cab.pl | 49 - xwords4/wince/shared.mk | 46 - xwords4/wince/simrel.mk | 59 - xwords4/wince/stdafx.h | 25 - xwords4/wince/strids.h | 144 - xwords4/wince/test/Makefile | 15 - xwords4/wince/test/messagebox.c | 9 - xwords4/wince/xptypes.h | 147 - xwords4/wince/xwords.vcp | 4630 ---------------------- xwords4/wince/xwords4.h | 11 - xwords4/wince/xwords4.ico | Bin 1550 -> 0 bytes 89 files changed, 28150 deletions(-) delete mode 100644 xwords4/wince/.gitignore delete mode 100755 xwords4/wince/LocalizedStrIncludes.h delete mode 100644 xwords4/wince/Makefile delete mode 100644 xwords4/wince/README.txt delete mode 100755 xwords4/wince/StdAfx.cpp delete mode 100755 xwords4/wince/armrel.mk delete mode 100644 xwords4/wince/bmps/.gitignore delete mode 100644 xwords4/wince/bmps/downarro.pgm delete mode 100755 xwords4/wince/bmps/flip.bmp delete mode 100755 xwords4/wince/bmps/hint.bmp delete mode 100644 xwords4/wince/bmps/juggle.bmp delete mode 100644 xwords4/wince/bmps/netarrow.pgm delete mode 100644 xwords4/wince/bmps/origin.pgm delete mode 100644 xwords4/wince/bmps/rightarrow.pgm delete mode 100755 xwords4/wince/bmps/values.bmp delete mode 100644 xwords4/wince/bmps/xwords4_ico_16x16.png delete mode 100644 xwords4/wince/bmps/xwords4_ico_22x22.png delete mode 100644 xwords4/wince/bmps/xwords4_ico_32x32.png delete mode 100755 xwords4/wince/ceaskpwd.c delete mode 100755 xwords4/wince/ceaskpwd.h delete mode 100755 xwords4/wince/ceblank.c delete mode 100755 xwords4/wince/ceblank.h delete mode 100644 xwords4/wince/ceclrsel.c delete mode 100644 xwords4/wince/ceclrsel.h delete mode 100755 xwords4/wince/cecondlg.c delete mode 100755 xwords4/wince/cecondlg.h delete mode 100644 xwords4/wince/ceconnmg.h delete mode 100644 xwords4/wince/cedebug.c delete mode 100644 xwords4/wince/cedebug.h delete mode 100755 xwords4/wince/cedefines.h delete mode 100755 xwords4/wince/cedict.c delete mode 100755 xwords4/wince/cedict.h delete mode 100755 xwords4/wince/cedraw.c delete mode 100644 xwords4/wince/cedraw.h delete mode 100644 xwords4/wince/cefonts.c delete mode 100644 xwords4/wince/cefonts.h delete mode 100755 xwords4/wince/ceginfo.c delete mode 100755 xwords4/wince/ceginfo.h delete mode 100755 xwords4/wince/cehntlim.c delete mode 100755 xwords4/wince/cehntlim.h delete mode 100755 xwords4/wince/ceir.h delete mode 100755 xwords4/wince/cemain.c delete mode 100755 xwords4/wince/cemain.h delete mode 100755 xwords4/wince/ceprefs.c delete mode 100755 xwords4/wince/ceprefs.h delete mode 100644 xwords4/wince/ceresstr.c delete mode 100644 xwords4/wince/ceresstr.h delete mode 100644 xwords4/wince/cesms.c delete mode 100644 xwords4/wince/cesms.h delete mode 100755 xwords4/wince/cesockwr.c delete mode 100755 xwords4/wince/cesockwr.h delete mode 100755 xwords4/wince/cestrbx.c delete mode 100755 xwords4/wince/cestrbx.h delete mode 100644 xwords4/wince/cesvdgms.c delete mode 100644 xwords4/wince/cesvdgms.h delete mode 100755 xwords4/wince/ceutil.c delete mode 100755 xwords4/wince/ceutil.h delete mode 100644 xwords4/wince/common_rsrc.rc delete mode 100644 xwords4/wince/connmgr.h delete mode 100644 xwords4/wince/debhacks.c delete mode 100644 xwords4/wince/debhacks.h delete mode 100644 xwords4/wince/l10n/xwords4_caps.rc delete mode 100644 xwords4/wince/l10n/xwords4_catalan.rc delete mode 100755 xwords4/wince/l10n/xwords4_czech.rc delete mode 100755 xwords4/wince/l10n/xwords4_english.rc delete mode 100644 xwords4/wince/l10n/xwords4_french.rc delete mode 100644 xwords4/wince/l10n/xwords4_polish.rc delete mode 100755 xwords4/wince/newres.h delete mode 100644 xwords4/wince/rc_incs.h delete mode 100755 xwords4/wince/resource.h delete mode 100755 xwords4/wince/scripts/check_ids.sh delete mode 100755 xwords4/wince/scripts/dll2cab.pl delete mode 100755 xwords4/wince/scripts/exe2cab.pl delete mode 100755 xwords4/wince/scripts/makezip.sh delete mode 100755 xwords4/wince/scripts/pocketpc-cab delete mode 100644 xwords4/wince/scripts/strids.c delete mode 100755 xwords4/wince/scripts/test_windres.sh delete mode 100755 xwords4/wince/scripts/testsizes.sh delete mode 100755 xwords4/wince/scripts/xwd2cab.pl delete mode 100755 xwords4/wince/shared.mk delete mode 100755 xwords4/wince/simrel.mk delete mode 100755 xwords4/wince/stdafx.h delete mode 100644 xwords4/wince/strids.h delete mode 100644 xwords4/wince/test/Makefile delete mode 100644 xwords4/wince/test/messagebox.c delete mode 100755 xwords4/wince/xptypes.h delete mode 100644 xwords4/wince/xwords.vcp delete mode 100755 xwords4/wince/xwords4.h delete mode 100644 xwords4/wince/xwords4.ico diff --git a/xwords4/wince/.gitignore b/xwords4/wince/.gitignore deleted file mode 100644 index 380e1961e..000000000 --- a/xwords4/wince/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -obj*/ -Cross_dbg/ -xwDbgLog.txt -*.xwd diff --git a/xwords4/wince/LocalizedStrIncludes.h b/xwords4/wince/LocalizedStrIncludes.h deleted file mode 100755 index 21b6400a1..000000000 --- a/xwords4/wince/LocalizedStrIncludes.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/Makefile b/xwords4/wince/Makefile deleted file mode 100644 index c1a7acafb..000000000 --- a/xwords4/wince/Makefile +++ /dev/null @@ -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]'" - diff --git a/xwords4/wince/README.txt b/xwords4/wince/README.txt deleted file mode 100644 index 21fa13bdf..000000000 --- a/xwords4/wince/README.txt +++ /dev/null @@ -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. - diff --git a/xwords4/wince/StdAfx.cpp b/xwords4/wince/StdAfx.cpp deleted file mode 100755 index 70fe87a0b..000000000 --- a/xwords4/wince/StdAfx.cpp +++ /dev/null @@ -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 diff --git a/xwords4/wince/armrel.mk b/xwords4/wince/armrel.mk deleted file mode 100755 index 0207dfb56..000000000 --- a/xwords4/wince/armrel.mk +++ /dev/null @@ -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) \ No newline at end of file diff --git a/xwords4/wince/bmps/.gitignore b/xwords4/wince/bmps/.gitignore deleted file mode 100644 index 93e173cdb..000000000 --- a/xwords4/wince/bmps/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.bmp diff --git a/xwords4/wince/bmps/downarro.pgm b/xwords4/wince/bmps/downarro.pgm deleted file mode 100644 index f87bb2052..000000000 --- a/xwords4/wince/bmps/downarro.pgm +++ /dev/null @@ -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 \ No newline at end of file diff --git a/xwords4/wince/bmps/flip.bmp b/xwords4/wince/bmps/flip.bmp deleted file mode 100755 index 3f163fcae2257527ee1beb333661be165d1c58cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmZ?rtz&=yJ0PV2!~#&v$iN7eZ~&4=_#hZ8044ta{|{!>|6yRL{{h4wfcOCr9{}P8 YAO^~U%&r0A3Lq{3;shXe0Ad&b00^`Zb^rhX diff --git a/xwords4/wince/bmps/hint.bmp b/xwords4/wince/bmps/hint.bmp deleted file mode 100755 index 005dbca0b8c7b1dc1b407970cb32b9864b3b98f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmZ?rtz&=yJ0PV2!~#&v$iN7eZ~&4=_#hZ8044ta{}1OfHZU+KwlFXVb}%r2*h~%# Z3@i!|oT3JyL1G{|0S*QR1r`P{007QZ3hn>^ diff --git a/xwords4/wince/bmps/juggle.bmp b/xwords4/wince/bmps/juggle.bmp deleted file mode 100644 index e426658c3391493f5fb87b7ae1550234849834f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmZ?rtz&=yJ0PV2!~#&v$iN7eZ~&4=_#hZ8044ta|BuXNV0gg5zzEbVzyUM|h(nZs TY!L__WG06L0|R>lkbwjMjU)*{ diff --git a/xwords4/wince/bmps/netarrow.pgm b/xwords4/wince/bmps/netarrow.pgm deleted file mode 100644 index e6c5a50ec..000000000 --- a/xwords4/wince/bmps/netarrow.pgm +++ /dev/null @@ -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 diff --git a/xwords4/wince/bmps/origin.pgm b/xwords4/wince/bmps/origin.pgm deleted file mode 100644 index aec788ea1..000000000 --- a/xwords4/wince/bmps/origin.pgm +++ /dev/null @@ -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 diff --git a/xwords4/wince/bmps/rightarrow.pgm b/xwords4/wince/bmps/rightarrow.pgm deleted file mode 100644 index 708b80f02..000000000 --- a/xwords4/wince/bmps/rightarrow.pgm +++ /dev/null @@ -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 diff --git a/xwords4/wince/bmps/values.bmp b/xwords4/wince/bmps/values.bmp deleted file mode 100755 index e30faba4a43987c0b8b1942a276a04944d651bca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmZ?rtz&=yJ0PV2!~#&v$iN7eZ~&4=_#hZ8044ta{|{!_|6^c?2jcu=3=HM(7#OO7 ixE6@(fH>9QL70(Y)*K0-AbW|YuPgfvE=f^i*&8!rRDeR$JY5_^EKX0I z9LRN8LBQpH1ovJi|B0Kw?OIy$Tab5G?=Hy+rk!UD{10toOz8faqQIDTEJTQ5rLDH2 zvCdBC<2*0IVi)h4KJ(PC61KGJUrYS{e$xHTGJ*N->U-+%<=BtRdiPu_;p745ujgf( z%iKiwwO;(1<{%_qT+MuDLVK8Rc!IO2&HQcWQ%Vuivyo8L#{8SED|Icxo9 STEhx-A%mx@pUXO@geCwsp=C?} diff --git a/xwords4/wince/bmps/xwords4_ico_22x22.png b/xwords4/wince/bmps/xwords4_ico_22x22.png deleted file mode 100644 index 030fe18d552df8de978162dd1f6332e21d95f397..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-;44oT#}JFtPp4kwYck+*^;dThW{!VoeeC~# z*8RuCn;L&5EKhF8)AGN!ByyW+Y{aGmxo#-h`Fe`B)h z8u^H?m9>xcS+^dYpb+=9yT>|#!OYJ70n?NjT5@9N|K4hvD}K#Sd1ob;la^7&%<0ix z#piZ)v)EUju)kW^5zar&>GCQ`d6##QXCh-}E>ua@Z2QM#aa-oi0>&GRYc18chRR=& zf3;F#(Z;Pk-z4`|Ivq93Q2O|I>rU1u?(AQ}9v80&YFgFT&Ha1xF3X=YoaZlYnb7y> j?A5FVA`fR(Hr!z-w=Un3vrKRr(ANx}u6{1-oD!M<1EYsM diff --git a/xwords4/wince/bmps/xwords4_ico_32x32.png b/xwords4/wince/bmps/xwords4_ico_32x32.png deleted file mode 100644 index 1fef881b1d3a88957585aaec1f4e8e2d6f078570..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}Y)RhkE)4%c zaKYZ?lYt_f1s;*b3=G`DAk4@xYmNj^kiEpy*OmPSm!znn$qJcer+`8aJY5_^A`ZWu zX2{oUz~ee!`PjWh><)YXw_26Ic*PeQFe}N!!)d|+A@2hpzi2e9`x1LQ%<;e|z*8*5)v{u)O6=$gJPZZ2o|A zPh&W@>Y0t9S7U_NMue{Z>d^J!OzmdL19u*6+HxYIN5oJ-U+ - -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 */ diff --git a/xwords4/wince/ceaskpwd.h b/xwords4/wince/ceaskpwd.h deleted file mode 100755 index e29c8de6b..000000000 --- a/xwords4/wince/ceaskpwd.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/ceblank.c b/xwords4/wince/ceblank.c deleted file mode 100755 index 35c4dd831..000000000 --- a/xwords4/wince/ceblank.c +++ /dev/null @@ -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; -} diff --git a/xwords4/wince/ceblank.h b/xwords4/wince/ceblank.h deleted file mode 100755 index 8d13f3049..000000000 --- a/xwords4/wince/ceblank.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/ceclrsel.c b/xwords4/wince/ceclrsel.c deleted file mode 100644 index e54d4c27d..000000000 --- a/xwords4/wince/ceclrsel.c +++ /dev/null @@ -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 -#include "stdafx.h" -#include - -#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 */ diff --git a/xwords4/wince/ceclrsel.h b/xwords4/wince/ceclrsel.h deleted file mode 100644 index 15ac495e4..000000000 --- a/xwords4/wince/ceclrsel.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/cecondlg.c b/xwords4/wince/cecondlg.c deleted file mode 100755 index 255189d4f..000000000 --- a/xwords4/wince/cecondlg.c +++ /dev/null @@ -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 diff --git a/xwords4/wince/cecondlg.h b/xwords4/wince/cecondlg.h deleted file mode 100755 index 9c14cf846..000000000 --- a/xwords4/wince/cecondlg.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/ceconnmg.h b/xwords4/wince/ceconnmg.h deleted file mode 100644 index d6f5d8e81..000000000 --- a/xwords4/wince/ceconnmg.h +++ /dev/null @@ -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 - - -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 diff --git a/xwords4/wince/cedebug.c b/xwords4/wince/cedebug.c deleted file mode 100644 index 088cabcd8..000000000 --- a/xwords4/wince/cedebug.c +++ /dev/null @@ -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 -#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 = ""; - } - 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 */ diff --git a/xwords4/wince/cedebug.h b/xwords4/wince/cedebug.h deleted file mode 100644 index 2e3622777..000000000 --- a/xwords4/wince/cedebug.h +++ /dev/null @@ -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_ */ diff --git a/xwords4/wince/cedefines.h b/xwords4/wince/cedefines.h deleted file mode 100755 index ed338354b..000000000 --- a/xwords4/wince/cedefines.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/cedict.c b/xwords4/wince/cedict.c deleted file mode 100755 index 6353372a8..000000000 --- a/xwords4/wince/cedict.c +++ /dev/null @@ -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 /* _snwprintf */ -#include /* _snwprintf */ - -#include "stdafx.h" -/* #include */ -#include -#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 */ diff --git a/xwords4/wince/cedict.h b/xwords4/wince/cedict.h deleted file mode 100755 index 26ac98afa..000000000 --- a/xwords4/wince/cedict.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/cedraw.c b/xwords4/wince/cedraw.c deleted file mode 100755 index 57f483b41..000000000 --- a/xwords4/wince/cedraw.c +++ /dev/null @@ -1,2384 +0,0 @@ -/* -*- fill-column: 77; compile-command: "make TARGET_OS=wince DEBUG=TRUE"; -*- */ -/* - * 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. - */ -/* #include */ -/* #include */ - -#include - -#include /* for sprintf, etc. */ - -#include "xptypes.h" -#include "cedraw.h" -#include "board.h" -#include "draw.h" -#include "mempool.h" - -#include "cemain.h" -#include "cedict.h" -#include "cedefines.h" -#include "cedebug.h" -#include "ceresstr.h" -#include "debhacks.h" -#include "strutils.h" - -#ifndef DRAW_FUNC_NAME -#define DRAW_FUNC_NAME(nam) ce_draw_ ## nam -#endif - -#define FCE_TEXT_PADDING 2 -#define CE_MINI_V_PADDING 6 -#define CE_MINI_H_PADDING 8 -#define CE_MINIW_PADDING 0 -#define CE_TIMER_PADDING -2 -#define SCORE_HPAD 2 - -//#define DRAW_FOCUS_FRAME 1 -#ifdef DRAW_FOCUS_FRAME -# define CE_FOCUS_BORDER_WIDTH 6 -# define TREAT_AS_CURSOR(d,f) ((((f) & CELL_ISCURSOR) != 0) && !(d)->topFocus ) -#else -# define TREAT_AS_CURSOR(d,f) (((f) & CELL_ISCURSOR) != 0) -#endif - - -typedef enum { NO_FOCUS, SINGLE_FOCUS, TOP_FOCUS } CeFocusLevel; - -typedef enum { - RFONTS_TRAY - ,RFONTS_TRAYNOVAL - ,RFONTS_TRAYVAL - ,RFONTS_CELL - ,RFONTS_PTS - ,RFONTS_SCORE - ,RFONTS_SCORE_BOLD - - ,N_RESIZE_FONTS -} RFIndex; - -typedef struct _PenColorPair { - COLORREF ref; - HGDIOBJ pen; -} PenColorPair; - -typedef struct _FontCacheEntry { - HFONT setFont; - /* NOTE: indexHt >= glyphHt. fontHt will usually be > indexHt */ - XP_U16 indexHt; /* the size we match on, the space we have */ - XP_U16 indexWidth; /* width we match on. 0 if we don't care */ - XP_U16 lfHeight; /* What CE thinks is the "size" of the font we - found to best fill indexHt */ - XP_U16 glyphHt; /* range from tops to bottoms of glyphs we use */ - XP_U16 offset; - XP_U16 minLen; -} FontCacheEntry; - -typedef struct _CeBMCacheEntry { - const XP_UCHAR* letters; /* pointer into dict; don't free!!! */ - HBITMAP bms[2]; -} CeBMCacheEntry; - -struct CEDrawCtx { - DrawCtxVTable* vtable; - - HWND mainWin; - CEAppGlobals* globals; - const DictionaryCtxt* dict; - - XP_UCHAR scoreCache[MAX_NUM_PLAYERS][32]; - - COLORREF prevBkColor; - - HBRUSH brushes[CE_NUM_COLORS]; -#ifdef DRAW_FOCUS_FRAME - PenColorPair pens[CE_NUM_COLORS]; -#endif - HGDIOBJ hintPens[MAX_NUM_PLAYERS]; - - FontCacheEntry fcEntry[N_RESIZE_FONTS]; - CeBMCacheEntry bmCache[3]; /* 3: max specials in current use */ - - HBITMAP rightArrow; - HBITMAP downArrow; - HBITMAP origin; -#ifdef XWFEATURE_RELAY - HBITMAP netArrow; -#endif - XP_U16 trayOwner; - XP_U16 miniLineHt; - XP_U16 maxScoreLen; - XP_Bool scoreIsVertical; - XP_Bool topFocus; - - MPSLOT -}; - -static void ceClearToBkground( CEDrawCtx* dctx, const XP_Rect* rect ); -static void ceDrawBitmapInRect( HDC hdc, const RECT* r, HBITMAP bitmap, - XP_Bool stretch ); -static void ceClipToRect( HDC hdc, const RECT* rt ); -static void ceClearFontCache( CEDrawCtx* dctx ); - -#ifdef DEBUG -const char* -RFI2Str( RFIndex rfi ) -{ - const char* str; -# define CASE_STR(c) case c: str = #c; break - switch( rfi ) { - CASE_STR( RFONTS_TRAY ); - CASE_STR( RFONTS_TRAYNOVAL ); - CASE_STR( RFONTS_TRAYVAL ); - CASE_STR( RFONTS_CELL ); - CASE_STR( RFONTS_PTS ); - CASE_STR( RFONTS_SCORE ); - CASE_STR( RFONTS_SCORE_BOLD ); - case N_RESIZE_FONTS: - XP_ASSERT(0); - return ""; - } -# undef CASE_STR - return str; -} -#else -# define RFI2Str( rfi ) "" -#endif - -static void -XPRtoRECT( RECT* rt, const XP_Rect* xprect ) -{ - rt->left = xprect->left; - rt->top = xprect->top; - rt->right = rt->left + xprect->width; - rt->bottom = rt->top + xprect->height; -} /* XPRtoRECT */ - -static void -ceDeleteObjectNotNull( HGDIOBJ obj ) -{ - if ( !!obj ) { - DeleteObject( obj ); - } -} - -#ifdef DRAW_FOCUS_FRAME -static HGDIOBJ -ceGetPen( CEDrawCtx* dctx, XP_U16 colorIndx, XP_U16 width ) -{ - PenColorPair* pair = &dctx->pens[colorIndx]; - HGDIOBJ pen = pair->pen; - COLORREF ref = dctx->globals->appPrefs.colors[colorIndx]; - - /* Make sure cached value is still good */ - if ( !!pen && (ref != pair->ref) ) { - DeleteObject( pen ); - pen = NULL; - } - - if ( !pen ) { - pen = CreatePen( PS_SOLID, width, ref ); - pair->pen = pen; - pair->ref = ref; - } - return pen; -} -#endif - -static void -ceDrawTextClipped( HDC hdc, wchar_t* buf, XP_S16 len, XP_Bool clip, - const FontCacheEntry* fce, XP_U16 left, XP_U16 top, - XP_U16 width, XP_U16 hJust ) -{ - RECT rect = { - .left = left, - .top = top, - .bottom = top + fce->glyphHt, - .right = left + width - }; - - if ( clip ) { - ceClipToRect( hdc, &rect ); - } - rect.top -= fce->offset; -/* XP_LOGF( "%s: drawing left: %ld, top: %ld, right: %ld, bottom: %ld", */ -/* __func__, rect.left, rect.top, rect.right, rect.bottom ); */ - DrawText( hdc, buf, len, &rect, DT_SINGLELINE | DT_TOP | hJust ); -} /* ceDrawTextClipped */ - -static void -ceDrawLinesClipped( HDC hdc, const FontCacheEntry* fce, const XP_UCHAR* buf, - UINT codePage, XP_Bool clip, const RECT* bounds ) -{ - XP_U16 top = bounds->top; - XP_U16 width = bounds->right - bounds->left; - - for ( ; ; ) { - XP_UCHAR* newline = strstr( buf, XP_CR ); - XP_U16 len = newline==NULL? strlen(buf): newline - buf; - XP_U16 wlen; - wchar_t widebuf[len]; - - wlen = MultiByteToWideChar( codePage, 0, buf, len, widebuf, len ); - - ceDrawTextClipped( hdc, widebuf, wlen, clip, fce, bounds->left, top, - width, DT_CENTER ); - if ( !newline ) { - break; - } - top += fce->glyphHt + FCE_TEXT_PADDING; - buf = newline + XP_STRLEN(XP_CR); /* skip '\n' */ - } -} /* ceDrawLinesClipped */ - -/* CE doesn't have FrameRect, so we'll roll our own */ -#ifdef DRAW_FOCUS_FRAME -static int -ceDrawFocusRect( HDC hdc, CEDrawCtx* dctx, LPCRECT rect ) -{ - RECT lr = *rect; - HGDIOBJ oldObj; - HGDIOBJ pen = ceGetPen( dctx, CE_FOCUS_COLOR, CE_FOCUS_BORDER_WIDTH ); - - InsetRect( &lr, CE_FOCUS_BORDER_WIDTH/2, CE_FOCUS_BORDER_WIDTH/2 ); - - oldObj = SelectObject( hdc, pen ); - - MoveToEx( hdc, lr.left, lr.top, NULL ); - LineTo( hdc, lr.right, lr.top ); - LineTo( hdc, lr.right, lr.bottom ); - LineTo( hdc, lr.left, lr.bottom ); - LineTo( hdc, lr.left, lr.top ); - - SelectObject( hdc, oldObj ); - return 0; -} -#endif - -static void -ceClipToRect( /* CEDrawCtx* dctx, */HDC hdc, const RECT* rt ) -{ - /* -NULLREGION Region is empty. -SIMPLEREGION Region is a single rectangle. -COMPLEXREGION Region is more than one rectangle. -ERROR - */ -#if 0 - /* Docs suggest I should be able to reuse the region but it doesn't - work. At least under WINE... */ - HRGN clipRgn = dctx->clipRgn; - int ret; - if ( !clipRgn ) { - clipRgn = CreateRectRgn( rt->left, rt->top, rt->right, rt->bottom ); - dctx->clipRgn = clipRgn; - } else { - (void)SetRectRgn( clipRgn, rt->left, rt->top, rt->right, rt->bottom ); - } - (void)SelectClipRgn( hdc, clipRgn ); /* returns SIMPLEREGION */ -#else - HRGN clipRgn = CreateRectRgn( rt->left, rt->top, rt->right, rt->bottom ); - SelectClipRgn( hdc, clipRgn ); - DeleteObject( clipRgn ); -#endif -} /* ceClipToRect */ - -static void -makeTestBuf( CEDrawCtx* dctx, RFIndex index, XP_UCHAR* buf, XP_U16 bufLen ) -{ - switch( index ) { - case RFONTS_TRAY: - case RFONTS_TRAYNOVAL: - case RFONTS_CELL: { - Tile tile; - Tile blank = (Tile)-1; - const DictionaryCtxt* dict = dctx->dict; - XP_U16 nFaces = dict_numTileFaces( dict ); - Tile tiles[nFaces]; - XP_U16 nOut = 0; - XP_ASSERT( !!dict ); - XP_ASSERT( nFaces < bufLen ); - if ( dict_hasBlankTile(dict) ) { - blank = dict_getBlankTile( dict ); - } - for ( tile = 0; tile < nFaces; ++tile ) { - if ( tile != blank ) { - tiles[nOut++] = tile; - } - } - buf[0] = '0'; /* so can use for numbers too */ - (void)dict_tilesToString( dict, tiles, nOut, &buf[1], bufLen-1 ); - } - break; - case RFONTS_TRAYVAL: - strcpy( buf, "10" ); /* all numbers the same :-) */ - break; - case RFONTS_PTS: - strcpy( buf, "123p" ); - break; - case RFONTS_SCORE: - case RFONTS_SCORE_BOLD: - strcpy( buf, "0:" ); - break; - case N_RESIZE_FONTS: - XP_ASSERT(0); - } - XP_LOGF( "test buf: \"%s\"", buf ); - -} /* makeTestBuf */ - -// #define LOG_BITMAP -#ifdef LOG_BITMAP -static void -logBitmap( const BITMAP* bm, XP_U16 width, XP_U16 height ) -{ - int ii, jj, kk; - XP_U8* ptr = bm->bmBits; - - XP_ASSERT( height <= bm->bmHeight ); - XP_ASSERT( width <= bm->bmWidth ); - - for ( ii = 0; ii < height; ++ii ) { - XP_UCHAR str[width+1]; - int count = 0; - for ( jj = 0; jj < bm->bmWidthBytes && count < width; ++jj ) { - XP_U8 byt = ptr[(ii*bm->bmWidthBytes)+jj]; - for ( kk = 0; kk < 8; ++kk ) { - str[count++] = (byt & 0x80) == 0 ? '.':'+'; - if ( count == width ) { - break; - } - byt <<= 1; - } - } - XP_ASSERT( count == width ); - str[count] = 0; - XP_LOGF( "%.2d %s", ii, str ); - } -} -#else -# define logBitmap( a, b, c ) -#endif - -static XP_Bool -anyBitSet( const XP_U8* rowPtr, XP_S16 rowBits ) -{ - XP_Bool set = XP_FALSE; - - XP_ASSERT( ((int)rowPtr & 0x0001) == 0 ); /* ptr to word? */ - for ( ; rowBits > 0; rowBits -= 8, ++rowPtr ) { - XP_U8 byt = *rowPtr; - if ( rowBits < 8 ) { - byt &= (0xFF << (8-rowBits)); - } - if ( 0 != byt ) { - set = XP_TRUE; - break; - } - } - return set; -} /* anyBitSet */ - -#define USE_STACKED -#ifndef USE_STACKED -static void -ceMeasureGlyph( HDC hdc, HBITMAP bmp, wchar_t glyph, - XP_U16 minTopSeen, XP_U16 maxBottomSeen, - XP_U16* top, XP_U16* bottom ) -{ - SIZE size; - XP_U16 yy; - - GetTextExtentPoint32( hdc, &glyph, 1, &size ); - RECT rect = { 0, 0, size.cx, size.cy }; - DrawText( hdc, &glyph, 1, &rect, DT_TOP | DT_LEFT ); - - BITMAP bminfo; -#ifdef DEBUG - int result = -#endif - GetObject( bmp, sizeof(bminfo), &bminfo ); - XP_ASSERT( result != 0 ); - - /* Find out if this guy's taller than what we have */ - const XP_U8* rowPtr = bminfo.bmBits; - if ( *rowPtr != 0x00 ) { -#ifdef DEBUG - wchar_t wbuf[2] = { glyph, 0 }; - XP_LOGW( __func__, wbuf ); -#endif - logBitmap( &bminfo, size.cx, size.cy ); - } - for ( yy = 0; yy < minTopSeen; ++yy ) { - if ( anyBitSet( rowPtr, size.cx ) ) { - *top = yy; - break; - } - rowPtr += bminfo.bmWidthBytes; - } - - /* Extends lower than seen */ - for ( yy = size.cy - 1, rowPtr = bminfo.bmBits + (bminfo.bmWidthBytes * yy); - yy > maxBottomSeen; --yy, rowPtr -= bminfo.bmWidthBytes ) { - if ( anyBitSet( rowPtr, size.cx ) ) { - *bottom = yy; - break; - } - } -/* XP_LOGF( "%s: top: %d; bottom: %d", __func__, *top, *bottom ); */ -} /* ceMeasureGlyph */ - -static void -ceMeasureGlyphs( HDC hdc, HBITMAP bmp, wchar_t* str, - XP_U16* hasMinTop, XP_U16* hasMaxBottom ) -{ - XP_U16 ii; - XP_U16 len = wcslen(str); - XP_U16 minTopSeen, maxBottomSeen; - XP_U16 maxBottomIndex = 0; - XP_U16 minTopIndex = 0; - - minTopSeen = 1000; /* really large... */ - maxBottomSeen = 0; - for ( ii = 0; ii < len; ++ii ) { - XP_U16 thisTop, thisBottom; - - /* TODO: Find a way to to keep minTopIndex && maxBottomIndex the same - IFF there's a character, like Q, that has the lowest point but - as high a top as anybody else. Maybe for > until both are set, - then >= ? */ - - ceMeasureGlyph( hdc, bmp, str[ii], minTopSeen, maxBottomSeen, - &thisTop, &thisBottom ); - if ( thisBottom > maxBottomSeen ) { - maxBottomSeen = thisBottom; - maxBottomIndex = ii; - } - if ( thisTop < minTopSeen ) { - minTopSeen = thisTop; - minTopIndex = ii; - } - } - - *hasMinTop = minTopIndex; - *hasMaxBottom = maxBottomIndex; -} /* ceMeasureGlyphs */ -#endif - -static void -ceClearFontCache( CEDrawCtx* dctx ) -{ - XP_U16 ii; - for ( ii = 0; ii < N_RESIZE_FONTS; ++ii ) { - ceDeleteObjectNotNull( dctx->fcEntry[ii].setFont ); - } - XP_MEMSET( &dctx->fcEntry, 0, sizeof(dctx->fcEntry) ); -} - -static void -ceClearBmCache( CEDrawCtx* dctx ) -{ - XP_U16 ii; - CeBMCacheEntry* entry; - - for ( entry = dctx->bmCache, ii = 0; - ii < VSIZE(dctx->bmCache); ++ii, ++entry ) { - ceDeleteObjectNotNull( entry->bms[0] ); - ceDeleteObjectNotNull( entry->bms[1] ); - } - - /* clear letters in case we're changing not deleting */ - XP_MEMSET( &dctx->bmCache[0], 0, sizeof(dctx->bmCache) ); -} /* ceClearBmCache */ - -static void -ceFillFontInfo( const CEDrawCtx* dctx, LOGFONT* fontInfo, - XP_U16 height/* , XP_Bool bold */ ) -{ - XP_MEMSET( fontInfo, 0, sizeof(*fontInfo) ); - fontInfo->lfHeight = height; - fontInfo->lfQuality = PROOF_QUALITY; - -/* if ( bold ) { */ -/* fontInfo->lfWeight = FW_BOLD; */ -/* } else { */ -/* fontInfo->lfWeight = FW_LIGHT; */ -/* } */ - wcscpy( fontInfo->lfFaceName, -#ifdef FORCE_FONT - FORCE_FONT -#else - IS_SMARTPHONE(dctx->globals)? L"Segoe Condensed" : L"Tahoma" -#endif - ); -} - -#ifdef USE_STACKED - -/* Measure all the glyphs in a string at once by stacking them on top of each - other. Assumes caller has called SetBkMode on the HDC correctly. */ -static void -ceMeasureStacked( HDC memDC, int lfHeight, const wchar_t* wbuf, - XP_U16* topp, XP_U16* bottomp ) -{ - int width = lfHeight; /* assume no char wider than its font's ht? */ - struct { - BITMAPINFOHEADER hdr; - RGBQUAD bmiColors[2]; /* these matter. Dunno why */ - } bmi_mono; - XP_MEMSET( &bmi_mono, 0, sizeof(bmi_mono) ); - - bmi_mono.hdr.biSize = sizeof(bmi_mono.hdr); - bmi_mono.hdr.biWidth = width; - bmi_mono.hdr.biHeight = -lfHeight; /* negative means 0,0 at top left */ - bmi_mono.hdr.biBitCount = 1; - bmi_mono.hdr.biPlanes = 1; - bmi_mono.hdr.biCompression = BI_RGB; - bmi_mono.bmiColors[0].rgbRed = 0xFF; - bmi_mono.bmiColors[0].rgbGreen = 0xFF; - bmi_mono.bmiColors[0].rgbBlue = 0xFF; - - HBITMAP memBM = CreateDIBSection( memDC, (BITMAPINFO*)&bmi_mono, - DIB_RGB_COLORS, NULL, NULL, 0 ); - SelectObject( memDC, memBM ); - - XP_ASSERT( 0 != *wbuf ); - RECT rect = { 0, 0, width, lfHeight }; - while ( 0 != *wbuf ) { - DrawText( memDC, wbuf++, 1, &rect, DT_TOP | DT_LEFT ); - } - - BITMAP bminfo; - (void)GetObject( memBM, sizeof(bminfo), &bminfo ); - - logBitmap( &bminfo, width, lfHeight ); - - XP_S16 top; - const XP_U8* rowPtr = bminfo.bmBits; - for ( top = 0; top < lfHeight; ++top ) { - if ( anyBitSet( rowPtr, width ) ) { - break; - } - rowPtr += bminfo.bmWidthBytes; - } - - /* Extends lower than seen */ - XP_S16 bottom; - for ( bottom = lfHeight - 1, - rowPtr = bminfo.bmBits + (bminfo.bmWidthBytes * bottom); - bottom >= 0; --bottom, rowPtr -= bminfo.bmWidthBytes ) { - if ( anyBitSet( rowPtr, width ) ) { - break; - } - } - - DeleteObject( memBM ); - - *topp = top; - *bottomp = bottom; -} /* ceMeasureStacked */ - -static void -ceBestFitFontStacked( CEDrawCtx* dctx, RFIndex index, const XP_U16 soughtHeight, - const XP_U16 soughtWidth, /* pass 0 to ignore width */ - const XP_U16 minLen, FontCacheEntry* fce ) -{ - wchar_t widebuf[65]; - wchar_t widthBuf[minLen]; - HDC memDC; - XP_U16 testHeight = soughtHeight * 2; - HFONT testFont = NULL; - /* For nextFromHeight and nextFromWidth, 0 means "found" */ - XP_U16 nextFromHeight = soughtHeight; - XP_U16 nextFromWidth = soughtWidth; /* starts at 0 if width ignored */ - - char sample[VSIZE(widebuf)]; - makeTestBuf( dctx, index, sample, VSIZE(sample) ); - (void)MultiByteToWideChar( CP_UTF8, 0, sample, -1, - widebuf, VSIZE(widebuf) ); - if ( soughtWidth != 0 ) { - XP_U16 ii; - XP_ASSERT( minLen > 0 ); - for ( ii = 0; ii < minLen; ++ii ) { - widthBuf[ii] = widebuf[0]; /* one char for the sample */ - } - } - - memDC = CreateCompatibleDC( NULL ); - (void)SetBkMode( memDC, TRANSPARENT ); - - for ( ; ; ) { - XP_U16 prevHeight = testHeight; - LOGFONT fontInfo; - - ceDeleteObjectNotNull( testFont ); - - ceFillFontInfo( dctx, &fontInfo, testHeight ); - testFont = CreateFontIndirect( &fontInfo ); - - if ( !!testFont ) { - XP_U16 thisHeight = 0, top, bottom; - - SelectObject( memDC, testFont ); - - /* first time, measure all of them to determine which chars have - the set's high and low points. Note that we need to measure - even if height already fits because that's how glyphHt and top - are calculated. */ - if ( nextFromHeight > 0 || nextFromWidth > 0 ) { - ceMeasureStacked( memDC, testHeight, widebuf, &top, &bottom ); - - thisHeight = bottom - top + 1; - - if ( nextFromHeight > 0 ) { /* skip if height already fits */ - /* If we don't meet the height test, continue based on - best guess at height. Only after height looks ok do - we try based on width */ - - if ( thisHeight > soughtHeight ) { /* height too big... */ - nextFromHeight = 1 + ((testHeight * soughtHeight) - / thisHeight); - } else { - nextFromHeight = 0; /* we're good */ - } - } - } - - if ( (soughtWidth > 0) && (nextFromWidth > 0) ) { - SIZE size; - GetTextExtentPoint32( memDC, widthBuf, minLen, &size ); - - if ( size.cx > soughtWidth ) { /* width too big... */ - nextFromWidth = 1 + ((testHeight * soughtWidth) / size.cx); - } else { - nextFromWidth = 0; - } - } - - if ( (0 == nextFromWidth) && (0 == nextFromHeight) ) { - /* we get here, we have our font */ - fce->setFont = testFont; - fce->indexHt = soughtHeight; - fce->indexWidth = soughtWidth; - fce->lfHeight = testHeight; - fce->offset = top; - fce->glyphHt = thisHeight; - fce->minLen = minLen; - break; - } - - if ( nextFromHeight > 0 ) { - testHeight = nextFromHeight; - } - if ( nextFromWidth > 0 && nextFromWidth < testHeight ) { - testHeight = nextFromWidth; - } - if ( testHeight >= prevHeight ) { - /* guarantee progress regardless of rounding errors */ - testHeight = prevHeight - 1; - } - } - } - - DeleteDC( memDC ); -} /* ceBestFitFontStacked */ - -#else -static void -ceBestFitFont( CEDrawCtx* dctx, RFIndex index, const XP_U16 soughtHeight, - const XP_U16 soughtWidth, /* pass 0 to ignore width */ - const XP_U16 minLen, FontCacheEntry* fce ) -{ - wchar_t widebuf[65]; - wchar_t widthBuf[minLen]; - XP_U16 hasMinTop = 0, hasMaxBottom = 0; /* make compiler happy */ - XP_Bool firstPass; - HDC memDC; - HBITMAP memBM; - XP_U16 testHeight = soughtHeight * 2; - HFONT testFont = NULL; - /* For nextFromHeight and nextFromWidth, 0 means "found" */ - XP_U16 nextFromHeight = soughtHeight; - XP_U16 nextFromWidth = soughtWidth; /* starts at 0 if width ignored */ - - char sample[65]; - - makeTestBuf( dctx, index, sample, VSIZE(sample) ); - (void)MultiByteToWideChar( CP_UTF8, 0, sample, -1, - widebuf, VSIZE(widebuf) ); - if ( soughtWidth != 0 ) { - XP_U16 ii; - XP_ASSERT( minLen > 0 ); - for ( ii = 0; ii < minLen; ++ii ) { - widthBuf[ii] = widebuf[0]; /* one char for the sample */ - } - } - - struct { - BITMAPINFOHEADER hdr; - RGBQUAD bmiColors[2]; /* these matter. Dunno why */ - } bmi_mono; - XP_MEMSET( &bmi_mono, 0, sizeof(bmi_mono) ); - - bmi_mono.hdr.biSize = sizeof(bmi_mono.hdr); - bmi_mono.hdr.biWidth = testHeight; - bmi_mono.hdr.biHeight = -testHeight; /* negative means 0,0 at top left */ - bmi_mono.hdr.biBitCount = 1; - bmi_mono.hdr.biPlanes = 1; - bmi_mono.hdr.biCompression = BI_RGB; - bmi_mono.bmiColors[0].rgbRed = 0xFF; - bmi_mono.bmiColors[0].rgbGreen = 0xFF; - bmi_mono.bmiColors[0].rgbBlue = 0xFF; - - memDC = CreateCompatibleDC( NULL ); - memBM = CreateDIBSection( memDC, (BITMAPINFO*)&bmi_mono, DIB_RGB_COLORS, - NULL, NULL, 0 ); - SelectObject( memDC, memBM ); - - for ( firstPass = XP_TRUE; ; ) { - XP_U16 prevHeight = testHeight; - LOGFONT fontInfo; - - ceDeleteObjectNotNull( testFont ); - - ceFillFontInfo( dctx, &fontInfo, testHeight ); - testFont = CreateFontIndirect( &fontInfo ); - - if ( !!testFont ) { - XP_U16 thisHeight = 0, top, bottom; - - SelectObject( memDC, testFont ); - - /* first time, measure all of them to determine which chars have - the set's high and low points. Note that we need to measure - even if height already fits because that's how glyphHt and top - are calculated. */ - if ( nextFromHeight > 0 || nextFromWidth > 0 ) { - if ( firstPass ) { - ceMeasureGlyphs( memDC, memBM, widebuf, - &hasMinTop, &hasMaxBottom ); - firstPass = XP_FALSE; - } - /* Thereafter, just measure the two we know about */ - ceMeasureGlyph( memDC, memBM, widebuf[hasMinTop], 1000, 0, - &top, &bottom ); - if ( hasMaxBottom != hasMinTop ) { - ceMeasureGlyph( memDC, memBM, widebuf[hasMaxBottom], - top, bottom, &top, &bottom ); - } - - thisHeight = bottom - top + 1; - - if ( nextFromHeight > 0 ) { /* skip if height already fits */ - /* If we don't meet the height test, continue based on - best guess at height. Only after height looks ok do - we try based on width */ - - if ( thisHeight > soughtHeight ) { /* height too big... */ - nextFromHeight = 1 + ((testHeight * soughtHeight) - / thisHeight); - } else { - nextFromHeight = 0; /* we're good */ - } - } - } - - if ( (soughtWidth > 0) && (nextFromWidth > 0) ) { - SIZE size; - GetTextExtentPoint32( memDC, widthBuf, minLen, &size ); - - if ( size.cx > soughtWidth ) { /* width too big... */ - nextFromWidth = 1 + ((testHeight * soughtWidth) / size.cx); - } else { - nextFromWidth = 0; - } - } - - if ( (0 == nextFromWidth) && (0 == nextFromHeight) ) { - /* we get here, we have our font */ - fce->setFont = testFont; - fce->indexHt = soughtHeight; - fce->indexWidth = soughtWidth; - fce->lfHeight = testHeight; - fce->offset = top; - fce->glyphHt = thisHeight; - fce->minLen = minLen; - break; - } - - if ( nextFromHeight > 0 ) { - testHeight = nextFromHeight; - } - if ( nextFromWidth > 0 && nextFromWidth < testHeight ) { - testHeight = nextFromWidth; - } - if ( testHeight >= prevHeight ) { - /* guarantee progress regardless of rounding errors */ - testHeight = prevHeight - 1; - } - } - } - - DeleteObject( memBM ); - DeleteDC( memDC ); -} /* ceBestFitFont */ - -#endif - -static const FontCacheEntry* -ceGetSizedFont( CEDrawCtx* dctx, RFIndex index, XP_U16 height, XP_U16 width, - XP_U16 minLen ) -{ - FontCacheEntry* fce = &dctx->fcEntry[index]; - if ( (0 != height) /* 0 means use what we have */ - && ( (fce->indexHt != height) - || (fce->indexWidth != width) - || (fce->minLen != minLen) ) ) { -#ifdef USE_STACKED - ceBestFitFontStacked( dctx, index, height, width, minLen, fce ); -#else - ceBestFitFont( dctx, index, height, width, minLen, fce ); -#endif - - /* XP_LOGF( "%s: no match for %s (have %d, want %d (width %d, minLen %d) " */ - /* "so recalculating", */ - /* __func__, RFI2Str(index), fce->indexHt, height, width, minLen ); */ - } - - XP_ASSERT( !!fce->setFont ); - return fce; -} /* ceGetSizedFont */ - -static HBITMAP -checkBMCache( CEDrawCtx* dctx, HDC hdc, const XP_UCHAR* letters, - const XP_U16 index, const XP_Bitmaps* bitmaps, XP_Bool* cached ) -{ - HBITMAP bm = NULL; - CeBMCacheEntry* entry = NULL; - XP_Bool canCache = XP_FALSE; - - XP_ASSERT( !!letters ); - XP_ASSERT( index < 2 ); - - XP_U16 ii; - for ( ii = 0, entry = dctx->bmCache; ii < VSIZE(dctx->bmCache); - ++ii, ++entry ) { - if ( !entry->letters ) { /* available */ - entry->letters = letters; - canCache = XP_TRUE; - break; - } else if ( entry->letters == letters ) { - canCache = XP_TRUE; - bm = entry->bms[index]; /* may be null */ - break; - } - } - -#ifdef DEBUG - if ( !canCache ) { - XP_WARNF( "%s: unable to cache bitmap for %s", __func__, letters ); - } -#endif - - if ( !bm ) { - const CEBitmapInfo* info = (const CEBitmapInfo*)(bitmaps->bmps[index]); - XP_U16 row, col; - COLORREF black = dctx->globals->appPrefs.colors[CE_BLACK_COLOR]; - COLORREF white = dctx->globals->appPrefs.colors[CE_WHITE_COLOR]; - HDC tmpDC; - XP_U8* bits = info->bits; - XP_U16 nCols = info->nCols; - XP_U16 nRows = info->nRows; - XP_U16 rowBytes = (info->nCols + 7) / 8; /* rows are 8-bit padded */ - - bm = CreateBitmap( info->nCols, info->nRows, 1, 1, NULL ); - tmpDC = CreateCompatibleDC( hdc ); - SelectObject( tmpDC, bm ); - for ( row = 0; row < nRows; ++row ) { - for ( col = 0; col < nCols; ++col ) { - /* Optimize me... */ - XP_U8 byt = bits[col / 8]; - XP_Bool set = (byt & (0x80 >> (col % 8))) != 0; - (void)SetPixel( tmpDC, col, row, set ? black:white ); - } - bits += rowBytes; - } - DeleteDC( tmpDC ); - -#ifdef DEBUG - { - BITMAP bmp; - int nBytes = GetObject( bm, sizeof(bmp), &bmp ); - XP_ASSERT( nBytes > 0 ); - XP_ASSERT( bmp.bmWidth == nCols ); - XP_ASSERT( bmp.bmHeight == nRows ); - } -#endif - if ( canCache && entry->bms[index] != bm ) { - XP_ASSERT( !entry->bms[index] || (entry->bms[index] == bm) ); - entry->bms[index] = bm; - } - } - - *cached = canCache; - return bm; -} /* checkBMCache */ - -static void -makeAndDrawBitmap( CEDrawCtx* dctx, HDC hdc, const RECT* bnds, - const XP_UCHAR* letters, const XP_Bitmaps* bitmaps, - XP_Bool center ) -{ - XP_Bool cached; - XP_U16 index; - RECT lrt = *bnds; - XP_U16 useSize; - - SIZE size; - GetTextExtentPoint32( hdc, L"M", 1, &size ); - useSize = size.cx; - - for ( index = bitmaps->nBitmaps - 1; ; --index ) { - const CEBitmapInfo* info = (const CEBitmapInfo*)(bitmaps->bmps[index]); - if ( info->nCols <= useSize && info->nRows <= useSize ) { - break; - } else if ( index == 0 ) { - /* none fits */ - useSize = XP_MAX( info->nCols, info->nRows ); - break; - } - } - - if ( center ) { - lrt.left += ((lrt.right - lrt.left) - useSize) / 2; - lrt.top += ((lrt.bottom - lrt.top) - useSize) / 2; - } - lrt.right = lrt.left + useSize; - lrt.bottom = lrt.top + useSize; - - HBITMAP bm = checkBMCache( dctx, hdc, letters, index, bitmaps, &cached ); - - ceDrawBitmapInRect( hdc, &lrt, bm, XP_TRUE ); - - if ( !cached ) { - DeleteObject( bm ); - } -} /* makeAndDrawBitmap */ - -static void -ceMeasureText( CEDrawCtx* dctx, HDC hdc, const FontCacheEntry* fce, - const XP_UCHAR* str, XP_S16 padding, - XP_U16* widthP, XP_U16* heightP ) -{ - XP_U16 height = 0; - XP_U16 maxWidth = 0; - - for ( ; ; ) { - wchar_t widebuf[64]; - XP_UCHAR* nextStr = strstr( str, XP_CR ); - XP_U16 len = nextStr==NULL? strlen(str): nextStr - str; - XP_U16 wlen; - SIZE size; - - XP_ASSERT( nextStr != str ); - - wlen = MultiByteToWideChar( CP_UTF8, 0, str, len, - widebuf, VSIZE(widebuf) ); - (void)GetTextExtentPoint32( hdc, widebuf, wlen, &size ); - - maxWidth = (XP_U16)XP_MAX( maxWidth, size.cx ); - if ( !!fce ) { - size.cy = fce->glyphHt; - padding = FCE_TEXT_PADDING; /* minimal */ - } - height += size.cy; - dctx->miniLineHt = (XP_U16)size.cy; - - if ( nextStr == NULL ) { - break; - } - height += padding; - str = nextStr + XP_STRLEN(XP_CR); /* skip '\n' */ - } - - *widthP = maxWidth; - *heightP = height; -} /* ceMeasureText */ - -static void -drawTextLines( CEDrawCtx* dctx, HDC hdc, const XP_UCHAR* text, XP_S16 padding, - const RECT* rp, int flags ) -{ - wchar_t widebuf[128]; - RECT textRt = *rp; - - for ( ; ; ) { /* draw up to the '\n' each time */ - XP_UCHAR* nextStr = strstr( text, XP_CR ); - XP_U16 len, wlen; - - if ( nextStr == NULL ) { - len = XP_STRLEN(text); - } else { - len = nextStr - text; - } - - wlen = MultiByteToWideChar( CP_UTF8, 0, text, len, - widebuf, VSIZE(widebuf) ); - - textRt.bottom = textRt.top + dctx->miniLineHt; - - DrawText( hdc, widebuf, wlen, &textRt, flags ); - - if ( nextStr == NULL ) { - break; - } - textRt.top = textRt.bottom + padding; - text = nextStr + XP_STRLEN(XP_CR); - } -} /* drawTextLines */ - -static void -ceGetCharValHts( const CEDrawCtx* dctx, const XP_Rect* xprect, - XP_Bool valHidden, XP_U16* charHtP, XP_U16* valHtP ) -{ - XP_U16 visHt = xprect->height - TRAY_BORDER; - XP_U16 visWidth = xprect->width - 5; /* ??? */ - XP_U16 minHt; - XP_U16 charHt, valHt; - - /* if tiles are wider than tall we can let them overlap vertically */ - if ( valHidden ) { - valHt = 0; - charHt = visHt; - } else if ( visWidth > visHt ) { - if ( visWidth > (visHt*2) ) { - charHt = visHt; - valHt = (3*visHt) / 4; - } else { - charHt = (visHt * 4) / 5; - valHt = visHt / 2; - } - } else { - valHt = visHt / 3; - charHt = visHt - valHt; - } - - minHt = dctx->globals->cellHt - CELL_BORDER; - if ( charHt < minHt ) { - charHt = minHt; - } - - if ( !valHidden && (valHt < MIN_CELL_HEIGHT - CELL_BORDER - 2) ) { - valHt = MIN_CELL_HEIGHT - CELL_BORDER - 2; - } - *valHtP = valHt; - *charHtP = charHt; -/* XP_LOGF( "%s(width:%d, height:%d)=>char: %d, val:%d", __func__, */ -/* xprect->width, xprect->height, *charHt, *valHt ); */ -} /* ceGetCharValHts */ - -DLSTATIC XP_Bool -DRAW_FUNC_NAME(boardBegin)( DrawCtx* p_dctx, const XP_Rect* XP_UNUSED(rect), - XP_U16 XP_UNUSED(hScale), XP_U16 XP_UNUSED(vScale), - DrawFocusState dfs ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - XP_Bool canDraw = !!hdc && !!dctx->dict; - if ( canDraw ) { - dctx->prevBkColor = GetBkColor( hdc ); - dctx->topFocus = dfs == DFS_TOP; - } - return canDraw; -} /* draw_boardBegin */ - -DLSTATIC void -DRAW_FUNC_NAME(objFinished)( DrawCtx* XP_UNUSED(p_dctx), - BoardObjectType XP_UNUSED(typ), - const XP_Rect* XP_UNUSED(rect), - DrawFocusState XP_UNUSED(dfs) ) -{ -#ifdef DRAW_FOCUS_FRAME - if ( (dfs == DFS_TOP) && (typ == OBJ_BOARD || typ == OBJ_TRAY) ) { - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - RECT rt; - - XPRtoRECT( &rt, rect ); - ceClipToRect( hdc, &rt ); - - ceDrawFocusRect( hdc, dctx, &rt ); - } -#endif -} - -static XP_U16 -getPlayerColor( XP_S16 player ) -{ - if ( player < 0 ) { - return CE_BLACK_COLOR; - } else { - return CE_PLAYER0_COLOR + player; - } -} /* getPlayerColor */ - -static void -ceDrawLine( HDC hdc, XP_S32 x1, XP_S32 y1, XP_S32 x2, XP_S32 y2 ) -{ - MoveToEx( hdc, x1, y1, NULL ); - LineTo( hdc, x2, y2); -} /* ceDrawLine */ - -static void -ceDrawHintBorders( CEDrawCtx* dctx, const XP_Rect* xprect, HintAtts hintAtts ) -{ - if ( hintAtts != HINT_BORDER_NONE && hintAtts != HINT_BORDER_CENTER ) { - RECT rt; - HDC hdc = dctx->globals->hdc; - HGDIOBJ pen, oldPen; - - pen = dctx->hintPens[dctx->trayOwner]; - if ( !pen ) { - COLORREF ref = dctx->globals->appPrefs.colors[CE_PLAYER0_COLOR - + dctx->trayOwner]; - pen = CreatePen( PS_SOLID, 4, ref ); /* 4 must be an even number - thx to clipping */ - dctx->hintPens[dctx->trayOwner] = pen; - } - - XPRtoRECT( &rt, xprect ); - InsetRect( &rt, 1, 1 ); - - oldPen = SelectObject( hdc, pen ); - - if ( (hintAtts & HINT_BORDER_LEFT) != 0 ) { - ceDrawLine( hdc, rt.left+1, rt.top, rt.left+1, rt.bottom+1 ); - } - if ( (hintAtts & HINT_BORDER_RIGHT) != 0 ) { - ceDrawLine( hdc, rt.right, rt.top, rt.right, rt.bottom+1 ); - } - if ( (hintAtts & HINT_BORDER_TOP) != 0 ) { - ceDrawLine( hdc, rt.left, rt.top+1, rt.right+1, rt.top+1 ); - } - if ( (hintAtts & HINT_BORDER_BOTTOM) != 0 ) { - ceDrawLine( hdc, rt.left, rt.bottom, rt.right+1, rt.bottom ); - } - (void)SelectObject( hdc, oldPen ); - } -} /* ceDrawHintBorders */ - -static void -ceSetTextColor( HDC hdc, const CEDrawCtx* dctx, XP_U16 index ) -{ - SetTextColor( hdc, dctx->globals->appPrefs.colors[index] ); -} - -static void -ceSetBkColor( HDC hdc, const CEDrawCtx* dctx, XP_U16 index ) -{ - SetBkColor( hdc, dctx->globals->appPrefs.colors[index] ); -} - -DLSTATIC XP_Bool -DRAW_FUNC_NAME(drawCell)( DrawCtx* p_dctx, const XP_Rect* xprect, - const XP_UCHAR* letters, - const XP_Bitmaps* bitmaps, - Tile XP_UNUSED(tile), XP_U16 XP_UNUSED(value), - XP_S16 owner, XWBonusType bonus, - HintAtts hintAtts, CellFlags flags ) -{ -#ifndef NO_DRAW - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - RECT rt; - RECT textRect; - XP_U16 bkIndex; - XP_U16 foreColorIndx; - XP_Bool isPending = (flags & CELL_HIGHLIGHT) != 0; - XP_Bool isFocussed = TREAT_AS_CURSOR( dctx, flags ); - XP_Bool isDragSrc = (flags & CELL_DRAGSRC) != 0; - HFONT oldFont; - const FontCacheEntry* fce; - - XP_ASSERT( !!hdc ); - - XPRtoRECT( &rt, xprect ); - ++rt.bottom; - ++rt.right; - ceClipToRect( hdc, &rt ); - - Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom ); - textRect = rt; - - InsetRect( &rt, 1, 1 ); - ceClipToRect( hdc, &rt ); - - fce = ceGetSizedFont( dctx, RFONTS_CELL, xprect->height - CELL_BORDER, - 0, 0 ); - oldFont = SelectObject( hdc, fce->setFont ); - - /* always init to silence compiler warning */ - foreColorIndx = getPlayerColor(owner); - - if ( !isDragSrc && (!!letters || !!bitmaps) ) { - if ( isPending ) { - bkIndex = CE_BLACK_COLOR; - foreColorIndx = CE_WHITE_COLOR; - } else { - bkIndex = CE_TILEBACK_COLOR; - // foreColorIndx already has right val - } - } else if ( bonus == BONUS_NONE ) { - bkIndex = CE_BKG_COLOR; - } else { - bkIndex = (bonus - BONUS_DOUBLE_LETTER) + CE_BONUS0_COLOR; - } - - if ( isFocussed ) { - bkIndex = CE_FOCUS_COLOR; - } - - FillRect( hdc, &rt, dctx->brushes[bkIndex] ); - - if ( (flags&CELL_ISBLANK) != 0 ) { - /* For some reason windoze won't let me paint just the corner pixels - when certain colors are involved, but it will let me paint the - whole rect and then erase all but the corners. File this under - "don't ask, but it works". */ - RECT tmpRT; - FillRect( hdc, &rt, - dctx->brushes[isPending?CE_WHITE_COLOR:CE_BLACK_COLOR] ); - tmpRT = rt; - InsetRect( &tmpRT, 0, 2 ); - FillRect( hdc, &tmpRT, dctx->brushes[bkIndex] ); - - tmpRT = rt; - InsetRect( &tmpRT, 1, 0 ); - FillRect( hdc, &tmpRT, dctx->brushes[bkIndex] ); - } - - ceSetBkColor( hdc, dctx, bkIndex ); - ceSetTextColor( hdc, dctx, foreColorIndx ); - - if ( !isDragSrc && !!bitmaps ) { - makeAndDrawBitmap( dctx, hdc, &rt, letters, bitmaps, XP_TRUE ); - } else if ( !isDragSrc && !!letters && (letters[0] != '\0') ) { - wchar_t widebuf[4]; - - MultiByteToWideChar( CP_UTF8, 0, letters, -1, - widebuf, VSIZE(widebuf) ); - ceDrawTextClipped( hdc, widebuf, -1, XP_FALSE, fce, xprect->left+1, - xprect->top+2, xprect->width, DT_CENTER ); - } else if ( (flags&CELL_ISSTAR) != 0 ) { - ceSetTextColor( hdc, dctx, CE_BLACK_COLOR ); - ceDrawBitmapInRect( hdc, &textRect, dctx->origin, XP_FALSE ); - } - - ceDrawHintBorders( dctx, xprect, hintAtts ); - - SelectObject( hdc, oldFont ); -#endif - return XP_TRUE; -} /* ce_draw_drawCell */ - -DLSTATIC void -DRAW_FUNC_NAME(invertCell)( DrawCtx* XP_UNUSED(p_dctx), - const XP_Rect* XP_UNUSED(rect) ) -{ -} /* ce_draw_invertCell */ - -#ifdef DEBUG -#if 0 -static char* -logClipResult( int icrResult ) -{ -#define caseStr(d) case d: return #d - switch ( icrResult ) { - caseStr(SIMPLEREGION); - caseStr(COMPLEXREGION); - caseStr(NULLREGION); - caseStr(ERROR); - } -#undef caseStr - return "unknown"; -} /* logClipResult */ -#endif -#endif - -DLSTATIC XP_Bool -DRAW_FUNC_NAME(trayBegin)( DrawCtx* p_dctx, const XP_Rect* XP_UNUSED(rect), - XP_U16 owner, XP_S16 XP_UNUSED(score), - DrawFocusState dfs ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - XP_Bool canDraw = !!hdc && !!dctx->dict; - if ( canDraw ) { - dctx->trayOwner = owner; - dctx->topFocus = dfs == DFS_TOP; - } - return canDraw; -} /* ce_draw_trayBegin */ - -static void -drawDrawTileGuts( DrawCtx* p_dctx, const XP_Rect* xprect, - const XP_UCHAR* letters, const XP_Bitmaps* bitmaps, - XP_U16 val, CellFlags flags ) -{ -#ifndef NO_DRAW - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - RECT rt; - XP_U16 index; - XP_Bool highlighted = XP_FALSE; - CeFocusLevel focLevel; - XP_Bool isEmpty = (flags & CELL_ISEMPTY) != 0; - - if ( 0 != (flags & CELL_ISCURSOR) ) { - if ( dctx->topFocus ) { - focLevel = TOP_FOCUS; - } else { - focLevel = SINGLE_FOCUS; - } - } else { - focLevel = NO_FOCUS; - } - - XPRtoRECT( &rt, xprect ); - ceClipToRect( hdc, &rt ); - FillRect( hdc, &rt, dctx->brushes[focLevel == TOP_FOCUS?CE_FOCUS_COLOR:CE_BKG_COLOR] ); - - if ( !isEmpty || focLevel == SINGLE_FOCUS ) { /* don't draw anything unless SINGLE_FOCUS */ - XP_U16 backIndex = focLevel == NO_FOCUS? CE_TILEBACK_COLOR : CE_FOCUS_COLOR; - - ceSetBkColor( hdc, dctx, backIndex ); - - InsetRect( &rt, 1, 0 ); - ++rt.top; /* inset top but not bottom */ - Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom); /* draw frame */ - InsetRect( &rt, 1, 1 ); - - if ( !isEmpty ) { - index = getPlayerColor(dctx->trayOwner); - ceSetTextColor( hdc, dctx, index ); - - /* For some reason Rectangle isn't using the background brush to - fill, so FillRect has to get called after Rectangle. Need to - call InsetRect either way to put chars in the right place. */ - highlighted = (flags & CELL_HIGHLIGHT) != 0; - if ( highlighted ) { - /* draw thicker hilight frame */ - Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom ); - InsetRect( &rt, 1, 1 ); - } - } - - FillRect( hdc, &rt, dctx->brushes[backIndex] ); - - if ( !isEmpty ) { - const FontCacheEntry* fce; - wchar_t widebuf[4]; - /* Dumb to calc these when only needed once.... */ - XP_U16 valHt, charHt; - XP_Bool valHidden = 0 != (flags & CELL_VALHIDDEN); - - if ( !highlighted ) { - InsetRect( &rt, 1, 1 ); - } - - ceGetCharValHts( dctx, xprect, valHidden, &charHt, &valHt ); - fce = ceGetSizedFont( dctx, valHidden ? RFONTS_TRAYNOVAL:RFONTS_TRAY, - charHt, 0, 0 ); - - if ( !!bitmaps || !!letters ) { - HFONT oldFont = SelectObject( hdc, fce->setFont ); - XP_U16 wlen = MultiByteToWideChar( CP_UTF8, 0, letters, - -1, widebuf, VSIZE(widebuf) ); - - /* see if there's room to use text instead of bitmap */ - if ( !!bitmaps && valHidden ) { - SIZE size; - GetTextExtentPoint32( hdc, widebuf, wlen - 1, /* drop null */ - &size ); - if ( size.cx < (rt.right - rt.left) ) { - bitmaps = NULL; /* use the letters instead */ - } - } - - if ( !!bitmaps ) { - makeAndDrawBitmap( dctx, hdc, &rt, letters, bitmaps, - valHidden ); - } else if ( !!letters ) { - ceDrawTextClipped( hdc, widebuf, -1, XP_TRUE, fce, - xprect->left + 4, xprect->top + 4, - xprect->width - 8, - valHidden?DT_CENTER:DT_LEFT ); - } - SelectObject( hdc, oldFont ); - } - - if ( !valHidden ) { - fce = ceGetSizedFont( dctx, RFONTS_TRAYVAL, valHt, 0, 0 ); - HFONT oldFont = SelectObject( hdc, fce->setFont ); - swprintf( widebuf, L"%d", val ); - - ceDrawTextClipped( hdc, widebuf, -1, XP_TRUE, fce, - xprect->left + 4, - xprect->top + xprect->height - 4 - - fce->glyphHt, - xprect->width - 8, DT_RIGHT ); - SelectObject( hdc, oldFont ); - } - } - } -#endif -} /* drawDrawTileGuts */ - -DLSTATIC void -DRAW_FUNC_NAME(drawTile)( DrawCtx* p_dctx, const XP_Rect* xprect, - const XP_UCHAR* letters, const XP_Bitmaps* bitmaps, - XP_U16 val, CellFlags flags ) -{ - drawDrawTileGuts( p_dctx, xprect, letters, bitmaps, val, flags ); -} /* ce_draw_drawTile */ - -#ifdef POINTER_SUPPORT -DLSTATIC void -DRAW_FUNC_NAME(drawTileMidDrag)( DrawCtx* p_dctx, const XP_Rect* xprect, - const XP_UCHAR* letters, - const XP_Bitmaps* bitmaps, XP_U16 val, - XP_U16 owner, CellFlags flags ) -{ - if ( draw_trayBegin( p_dctx, xprect, owner, 0, DFS_NONE ) ) { - drawDrawTileGuts( p_dctx, xprect, letters, bitmaps, val, flags ); - } -} /* ce_draw_drawTile */ -#endif - -DLSTATIC void -DRAW_FUNC_NAME(drawTileBack)( DrawCtx* p_dctx, const XP_Rect* xprect, - CellFlags flags ) -{ - drawDrawTileGuts( p_dctx, xprect, "?", NULL, 0, flags | CELL_VALHIDDEN ); -} /* ce_draw_drawTileBack */ - -DLSTATIC void -DRAW_FUNC_NAME(drawTrayDivider)( DrawCtx* p_dctx, const XP_Rect* rect, - CellFlags flags ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - RECT rt; - XP_Bool selected = (flags & CELL_HIGHLIGHT) != 0; - XP_Bool isFocussed = TREAT_AS_CURSOR(dctx,flags); - - XPRtoRECT( &rt, rect ); - ceClipToRect( hdc, &rt ); - - if ( isFocussed ) { - FillRect( hdc, &rt, dctx->brushes[CE_FOCUS_COLOR] ); - InsetRect( &rt, 0, (rt.bottom - rt.top) >> 2 ); - } - - if ( selected ) { - Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom ); - } else { - FillRect( hdc, &rt, dctx->brushes[dctx->trayOwner+CE_PLAYER0_COLOR] ); - } -} /* ce_draw_drawTrayDivider */ - -static void -ceClearToBkground( CEDrawCtx* dctx, const XP_Rect* rect ) -{ - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - RECT rt; - - XPRtoRECT( &rt, rect ); - - FillRect( hdc, &rt, dctx->brushes[CE_BKG_COLOR] ); -} /* ceClearToBkground */ - -/* Draw bitmap in rect. Use StretchBlt to fit it to the rect, but don't - * change the proportions. - */ -static void -ceDrawBitmapInRect( HDC hdc, const RECT* rect, HBITMAP bitmap, - XP_Bool stretch ) -{ - BITMAP bmp; - int nBytes; - - XP_ASSERT( !!bitmap ); - nBytes = GetObject( bitmap, sizeof(bmp), &bmp ); - XP_ASSERT( nBytes > 0 ); - if ( nBytes == 0 ) { - logLastError( "ceDrawBitmapInRect:GetObject" ); - } else { - int left = rect->left; - int top = rect->top; - XP_U16 width = rect->right - left; - XP_U16 height = rect->bottom - top; - HDC tmpDC; - - if ( !stretch ) { - /* Find dimensions that'll fit multiplying an integral number of - times */ - XP_U16 factor = XP_MIN( width/bmp.bmWidth, height/bmp.bmHeight ); - if ( factor == 0 ) { - XP_LOGF( "%s: cell at %dx%d too small for bitmap at %ldx%ld", - __func__, width, height, bmp.bmWidth, bmp.bmHeight ); - factor = 1; - } - - width = bmp.bmWidth * factor; - height = bmp.bmHeight * factor; - } - - tmpDC = CreateCompatibleDC( hdc ); - SelectObject( tmpDC, bitmap ); - - (void)IntersectClipRect( tmpDC, left, top, rect->right, rect->bottom ); - - left += ((rect->right - left) - width) / 2; - top += ((rect->bottom - top) - height) / 2; - - StretchBlt( hdc, left, top, width, height, - tmpDC, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY ); - DeleteDC( tmpDC ); - } -} /* ceDrawBitmapInRect */ - -DLSTATIC void -DRAW_FUNC_NAME(drawBoardArrow)( DrawCtx* p_dctx, const XP_Rect* xprect, - XWBonusType cursorBonus, XP_Bool vertical, - HintAtts hintAtts, CellFlags flags ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - RECT rt; - XP_U16 bkIndex; - HBITMAP cursor; - - XPRtoRECT( &rt, xprect ); - ++rt.bottom; - ++rt.right; - ceClipToRect( hdc, &rt ); - - Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom ); - InsetRect( &rt, 1, 1 ); - ceClipToRect( hdc, &rt ); - - if ( vertical ) { - cursor = dctx->downArrow; - } else { - cursor = dctx->rightArrow; - } - - if ( TREAT_AS_CURSOR( dctx, flags ) ) { - bkIndex = CE_FOCUS_COLOR; - } else if ( cursorBonus == BONUS_NONE ) { - bkIndex = CE_BKG_COLOR; - } else { - bkIndex = cursorBonus - BONUS_DOUBLE_LETTER + CE_BONUS0_COLOR; - } - FillRect( hdc, &rt, dctx->brushes[bkIndex] ); - ceSetBkColor( hdc, dctx, bkIndex ); - ceSetTextColor( hdc, dctx, CE_BLACK_COLOR ); - - ceDrawBitmapInRect( hdc, &rt, cursor, XP_FALSE ); - - ceDrawHintBorders( dctx, xprect, hintAtts ); -} /* ce_draw_drawBoardArrow */ - -DLSTATIC XP_Bool -DRAW_FUNC_NAME(scoreBegin)( DrawCtx* p_dctx, const XP_Rect* xprect, - XP_U16 numPlayers, const XP_S16* const scores, - XP_S16 remCount, DrawFocusState XP_UNUSED(dfs) ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - RECT rt; - HDC hdc = dctx->globals->hdc; - XP_U16 ii; - XP_U16 scoreLen = 0; - - XP_ASSERT( !!hdc ); - ceSetBkColor( hdc, dctx, CE_BKG_COLOR ); - - dctx->scoreIsVertical = xprect->height > xprect->width; - - for ( ii = 0; ii <= numPlayers; ++ii ) { - XP_UCHAR buf[8]; - XP_S16 num = ii < numPlayers? scores[ii] : remCount; - XP_U16 len = XP_SNPRINTF( buf, VSIZE(buf), "%d", num ); - if ( len > scoreLen ) { - scoreLen = len; - } - } - dctx->maxScoreLen = scoreLen; - - /* I don't think the clip rect's set at this point but drawing seems fine - anyway.... ceClearToBkground() is definitely needed here. */ - XPRtoRECT( &rt, xprect ); - ceClipToRect( hdc, &rt ); - ceClearToBkground( (CEDrawCtx*)p_dctx, xprect ); - return XP_TRUE; -} /* ce_draw_scoreBegin */ - -static void -formatRemText( XP_S16 nTilesLeft, XP_UCHAR* buf, XP_U16 bufLen ) -{ - XP_ASSERT( nTilesLeft > 0 ); - XP_SNPRINTF( buf, bufLen, "%d", nTilesLeft ); -} /* formatRemText */ - -static void -scoreFontDims( CEDrawCtx* dctx, const XP_Rect* rect, - XP_U16* width, XP_U16* height ) -{ - XP_U16 fontHt, cellHt; - fontHt = rect->height; - - cellHt = dctx->globals->cellHt; - if ( !dctx->scoreIsVertical ) { - cellHt -= SCORE_TWEAK; - } - - if ( fontHt > cellHt ) { - fontHt = cellHt; - } - fontHt -= 2; /* for whitespace top and bottom */ - *height = fontHt; - *width = rect->width - 2; -} - -DLSTATIC void -DRAW_FUNC_NAME(measureRemText)( DrawCtx* p_dctx, const XP_Rect* xprect, - XP_S16 nTilesLeft, - XP_U16* widthP, XP_U16* heightP ) -{ - if ( nTilesLeft > 0 ) { - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - XP_UCHAR buf[4]; - const FontCacheEntry* fce; - XP_U16 width, height; - HFONT oldFont; - - XP_ASSERT( !!hdc ); - - formatRemText( nTilesLeft, buf, VSIZE(buf) ); - - scoreFontDims( dctx, xprect, &width, &height ); - - fce = ceGetSizedFont( dctx, RFONTS_SCORE, height, width, - dctx->maxScoreLen ); - oldFont = SelectObject( hdc, fce->setFont ); - ceMeasureText( dctx, hdc, fce, buf, 0, widthP, heightP ); - - (void)SelectObject( hdc, oldFont ); - } else { - *widthP = *heightP = 0; - } -} /* ce_draw_measureRemText */ - -DLSTATIC void -DRAW_FUNC_NAME(drawRemText)( DrawCtx* p_dctx, const XP_Rect* rInner, - const XP_Rect* rOuter, - XP_S16 nTilesLeft, XP_Bool focussed ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - XP_UCHAR buf[4]; - HFONT oldFont; - const FontCacheEntry* fce; - RECT rt; - XP_U16 bkColor; - - formatRemText( nTilesLeft, buf, VSIZE(buf) ); - - XPRtoRECT( &rt, rOuter ); - - ceSetTextColor( hdc, dctx, CE_BLACK_COLOR ); - bkColor = focussed ? CE_FOCUS_COLOR : CE_TILEBACK_COLOR; - ceSetBkColor( hdc, dctx, bkColor ); - FillRect( hdc, &rt, dctx->brushes[bkColor] ); - - XPRtoRECT( &rt, rInner ); - fce = ceGetSizedFont( dctx, RFONTS_SCORE, 0, 0, 0 ); - oldFont = SelectObject( hdc, fce->setFont ); - - ceDrawLinesClipped( hdc, fce, buf, CP_UTF8, XP_TRUE, &rt ); - - (void)SelectObject( hdc, oldFont ); -} /* ce_draw_drawRemText */ - -static void -ceFormatScoreText( CEDrawCtx* dctx, const DrawScoreInfo* dsi, XP_U16 nameLen ) -{ - XP_UCHAR optPart[16]; - XP_UCHAR name[nameLen+1+1]; - const XP_UCHAR* div = dctx->scoreIsVertical? XP_CR : ":"; - - /* For a horizontal scoreboard, we want [name:]300[:6] - * For a vertical, it's - * - * [name] - * 300 - * [6] - */ - - while ( nameLen >= 1 ) { - snprintf( name, nameLen+1, "%s", dsi->name ); - if ( name[nameLen-1] == ' ' ) { /* don't end with space */ - --nameLen; - } else { - XP_STRCAT( name, div ); - break; - } - } - if ( nameLen < 1 ) { - name[0] = '\0'; - } - - if ( dsi->nTilesLeft >= 0 ) { - sprintf( optPart, "%s%d", div, dsi->nTilesLeft ); - } else { - optPart[0] = '\0'; - } - - snprintf( dctx->scoreCache[dsi->playerNum], - VSIZE(dctx->scoreCache[dsi->playerNum]), - "%s%d%s", name, dsi->totalScore, optPart ); -} /* ceFormatScoreText */ - -DLSTATIC void -DRAW_FUNC_NAME(measureScoreText)( DrawCtx* p_dctx, const XP_Rect* xprect, - const DrawScoreInfo* dsi, - XP_U16* widthP, XP_U16* heightP ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - HFONT oldFont; - const FontCacheEntry* fce; - XP_U16 fontWidth, fontHt; - XP_U16 nameLen; - XP_U16 targetWidth = xprect->width; - - scoreFontDims( dctx, xprect, &fontWidth, &fontHt ); - - if ( !dctx->scoreIsVertical ) { - targetWidth -= (SCORE_HPAD * 2); - } - - fce = ceGetSizedFont( dctx, dsi->selected ? RFONTS_SCORE_BOLD:RFONTS_SCORE, - fontHt, fontWidth, dctx->maxScoreLen ); - nameLen = dsi->isTurn? XP_STRLEN(dsi->name) : 0; - oldFont = SelectObject( hdc, fce->setFont ); - - /* Iterate until score line fits. This currently fails when the score - itself won't fit (veritical scoreboard on large screen) because it's - the name that's being shrunk but the width is eventually determined by - the score that isn't shrinking. Need to bound font size by width of - "000" in vertical-scoreboard case. PENDING */ - - for ( ; ; ) { - XP_U16 width, height; - ceFormatScoreText( dctx, dsi, nameLen ); - - ceMeasureText( dctx, hdc, fce, dctx->scoreCache[dsi->playerNum], 0, - &width, &height ); - - if ( width <= targetWidth && height <= xprect->height ) { - if ( !dctx->scoreIsVertical ) { - width += (SCORE_HPAD * 2); - } - *widthP = width; - *heightP = height; - break; - } - - // XP_ASSERT( dsi->isTurn ); firing. See comment above. - if ( --nameLen == 0 ) { - break; - } - } - - SelectObject( hdc, oldFont ); -} /* ce_draw_measureScoreText */ - -DLSTATIC void -DRAW_FUNC_NAME(score_drawPlayer)( DrawCtx* p_dctx, - const XP_Rect* rInner, - const XP_Rect* rOuter, - const DrawScoreInfo* dsi ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - RECT rt; - HFONT oldFont; - XP_Bool isFocussed = (dsi->flags & CELL_ISCURSOR) != 0; - XP_U16 bkIndex = isFocussed ? CE_FOCUS_COLOR : CE_BKG_COLOR; - const FontCacheEntry* fce; - - fce = ceGetSizedFont( dctx, dsi->selected ? RFONTS_SCORE_BOLD:RFONTS_SCORE, - 0, 0, 0 ); - - oldFont = SelectObject( hdc, fce->setFont ); - - ceSetTextColor( hdc, dctx, getPlayerColor(dsi->playerNum) ); - ceSetBkColor( hdc, dctx, bkIndex ); - - XPRtoRECT( &rt, rOuter ); - ceClipToRect( hdc, &rt ); - if ( isFocussed ) { - FillRect( hdc, &rt, dctx->brushes[CE_FOCUS_COLOR] ); - } - - XPRtoRECT( &rt, rInner ); - - if ( !dctx->scoreIsVertical ) { - rt.left += SCORE_HPAD; - rt.right -= SCORE_HPAD; - } - ceDrawLinesClipped( hdc, fce, dctx->scoreCache[dsi->playerNum], - CP_ACP, XP_TRUE, &rt ); - - SelectObject( hdc, oldFont ); -} /* ce_draw_score_drawPlayer */ - -DLSTATIC void -DRAW_FUNC_NAME(score_pendingScore)( DrawCtx* p_dctx, const XP_Rect* xprect, - XP_S16 score, XP_U16 playerNum, - CellFlags flags ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - - wchar_t widebuf[5]; - RECT rt; - XP_Bool focussed = TREAT_AS_CURSOR(dctx,flags); - XP_U16 bkIndex = focussed ? CE_FOCUS_COLOR : CE_BKG_COLOR; - const FontCacheEntry* fce; - HFONT oldFont; - XP_U16 spareHt; - - if ( score < 0 ) { - widebuf[0] = '?'; - widebuf[1] = '?'; - widebuf[2] = '\0'; - } else { - swprintf( widebuf, L"%dp", score ); - } - - fce = ceGetSizedFont( dctx, RFONTS_PTS, xprect->height, xprect->width, - wcslen(widebuf) ); - spareHt = xprect->height - fce->glyphHt; - - oldFont = SelectObject( hdc, fce->setFont ); - - ceSetTextColor( hdc, dctx, getPlayerColor(playerNum) ); - ceSetBkColor( hdc, dctx, bkIndex ); - - XPRtoRECT( &rt, xprect ); - ceClipToRect( hdc, &rt ); - FillRect( hdc, &rt, dctx->brushes[bkIndex] ); - - ceDrawTextClipped( hdc, widebuf, -1, XP_FALSE, fce, - xprect->left, xprect->top + (spareHt/2), - xprect->width, DT_CENTER ); - - (void)SelectObject( hdc, oldFont ); -} /* ce_draw_score_pendingScore */ - -DLSTATIC void -DRAW_FUNC_NAME(drawTimer)( DrawCtx* p_dctx, const XP_Rect* xprect, - XP_U16 player, XP_S16 secondsLeft ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc = globals->hdc; - XP_UCHAR buf[16]; - XP_U16 mins, secs; - RECT rt; - PAINTSTRUCT ps; - XP_Bool isNegative; - HFONT oldFont; - const FontCacheEntry* fce; - - fce = ceGetSizedFont( dctx, RFONTS_SCORE, 0, 0, 0 ); - - XPRtoRECT( &rt, xprect ); - - isNegative = secondsLeft < 0; - if ( isNegative ) { - secondsLeft *= -1; - } - - mins = secondsLeft / 60; - secs = secondsLeft % 60; - - snprintf( buf, sizeof(buf), - dctx->scoreIsVertical? "%s%.1dm" XP_CR "%.2ds" : "%s%.1d:%.2d", - isNegative? "-": "", mins, secs ); - - if ( !hdc ) { - InvalidateRect( dctx->mainWin, &rt, FALSE ); - hdc = BeginPaint( dctx->mainWin, &ps ); - } - - ceClipToRect( hdc, &rt ); - - ceSetTextColor( hdc, dctx, getPlayerColor(player) ); - ceSetBkColor( hdc, dctx, CE_BKG_COLOR ); - ceClearToBkground( dctx, xprect ); - - /* distribute any extra space */ - XP_U16 width, height; - ceMeasureText( dctx, hdc, fce, buf, 0, &width, &height ); - XP_S16 diff = (xprect->height - height) / 2; - rt.top += diff; - rt.bottom -= diff; - - oldFont = SelectObject( hdc, fce->setFont ); - ceDrawLinesClipped( hdc, fce, buf, CP_ACP, XP_TRUE, &rt ); - SelectObject( hdc, oldFont ); - - if ( !globals->hdc ) { - EndPaint( dctx->mainWin, &ps ); - } -} /* ce_draw_drawTimer */ - -DLSTATIC const XP_UCHAR* -DRAW_FUNC_NAME(getMiniWText)( DrawCtx* p_dctx, - XWMiniTextType whichText ) -{ - const XP_UCHAR* str = NULL; - XP_U16 resID = 0; - - switch( whichText ) { - case BONUS_DOUBLE_LETTER: - resID = IDS_DOUBLE_LETTER; - break; - case BONUS_DOUBLE_WORD: - resID = IDS_DOUBLE_WORD; - break; - case BONUS_TRIPLE_LETTER: - resID = IDS_TRIPLE_LETTER; - break; - case BONUS_TRIPLE_WORD: - resID = IDS_TRIPLE_WORD; - break; - case INTRADE_MW_TEXT: - resID = IDS_INTRADE_MW; - break; - default: - XP_ASSERT( XP_FALSE ); - break; - } - - - if ( resID != 0 ) { - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - str = ceGetResString( dctx->globals, resID ); - } - return str; -} /* ce_draw_getMiniWText */ - -DLSTATIC void -DRAW_FUNC_NAME(measureMiniWText)( DrawCtx* p_dctx, const XP_UCHAR* str, - XP_U16* widthP, XP_U16* heightP ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - HDC hdc = GetDC(dctx->mainWin); - ceMeasureText( dctx, hdc, NULL, str, CE_MINIW_PADDING, widthP, heightP ); - *heightP += CE_MINI_V_PADDING; - *widthP += CE_MINI_H_PADDING; -} /* ce_draw_measureMiniWText */ - -DLSTATIC void -DRAW_FUNC_NAME(drawMiniWindow)( DrawCtx* p_dctx, const XP_UCHAR* text, - const XP_Rect* rect, - void** XP_UNUSED(closureP) ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - HDC hdc; - RECT rt, textRt; - PAINTSTRUCT ps; - - XPRtoRECT( &rt, rect ); - - if ( !!globals->hdc ) { - hdc = globals->hdc; - } else { - InvalidateRect( dctx->mainWin, &rt, FALSE ); - hdc = BeginPaint( dctx->mainWin, &ps ); - } - ceClipToRect( hdc, &rt ); - - ceClearToBkground( dctx, rect ); - - ceSetBkColor( hdc, dctx, CE_BKG_COLOR ); - ceSetTextColor( hdc, dctx, CE_BLACK_COLOR ); - - Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom ); - InsetRect( &rt, 1, 1 ); - Rectangle( hdc, rt.left, rt.top, rt.right, rt.bottom ); - - textRt = rt; - textRt.top += 2; - InsetRect( &textRt, 3, 0 ); - - drawTextLines( dctx, hdc, text, CE_MINIW_PADDING, &textRt, - DT_CENTER | DT_VCENTER ); - - if ( !globals->hdc ) { - EndPaint( dctx->mainWin, &ps ); - } -} /* ce_draw_drawMiniWindow */ - -DLSTATIC void -DRAW_FUNC_NAME(destroyCtxt)( DrawCtx* p_dctx ) -{ - XP_U16 ii; - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - - for ( ii = 0; ii < CE_NUM_COLORS; ++ii ) { - DeleteObject( dctx->brushes[ii] ); -#ifdef DRAW_FOCUS_FRAME - ceDeleteObjectNotNull( dctx->pens[ii].pen ); -#endif - } - - for ( ii = 0; ii < VSIZE(dctx->hintPens); ++ii ) { - ceDeleteObjectNotNull( dctx->hintPens[ii] ); - } - - ceClearBmCache( dctx ); - ceClearFontCache( dctx ); - - DeleteObject( dctx->rightArrow ); - DeleteObject( dctx->downArrow ); - DeleteObject( dctx->origin ); - -#ifdef XWFEATURE_RELAY - DeleteObject( dctx->netArrow ); -#endif - -#ifndef DRAW_LINK_DIRECT - XP_FREE( dctx->mpool, p_dctx->vtable ); -#endif - - XP_FREE( dctx->mpool, dctx ); -} /* ce_draw_destroyCtxt */ - -DLSTATIC void -DRAW_FUNC_NAME(dictChanged)( DrawCtx* p_dctx, XP_S16 XP_UNUSED(playerNum), - const DictionaryCtxt* dict ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - XP_ASSERT( !!dict ); - - ceClearBmCache( dctx ); - - /* If we don't yet have a dict, stick with the cache we have, which is - either empty or came from the saved game and likely belong with the - dict we're getting now. */ - if ( !!dctx->dict && !dict_tilesAreSame( dctx->dict, dict ) ) { - ceClearFontCache( dctx ); - } - dctx->dict = dict; -} - -#ifdef DRAW_LINK_DIRECT -DLSTATIC XP_Bool -DRAW_FUNC_NAME(vertScrollBoard)( DrawCtx* p_dctx, XP_Rect* rect, - XP_S16 dist, DrawFocusState XP_UNUSED(dfs) ) -{ - XP_Bool success = XP_FALSE; - /* board passes in the whole board rect, so we need to subtract from it - the height of the area to be overwritten. If dist is negative, the - dest is above the src. Otherwise it's below. */ - - CEDrawCtx* dctx = (CEDrawCtx*)p_dctx; - CEAppGlobals* globals = dctx->globals; - int destY, srcY; - RECT rt; - XP_Bool down = dist <= 0; - - XPRtoRECT( &rt, rect ); - ceClipToRect( globals->hdc, &rt ); - - if ( down ) { - srcY = rect->top; - dist = -dist; /* make it positive */ - destY = srcY + dist; - } else { - destY = rect->top; - srcY = destY + dist; - } - - success = FALSE != BitBlt( globals->hdc, /* HDC hdcDest, */ - rect->left, /* int nXDest */ - destY, - rect->width, /* width */ - rect->height - dist, /* int nHeight */ - globals->hdc, /* HDC hdcSrc */ - rect->left, /* int nXSrc */ - srcY, - SRCCOPY ); /* DWORD dwRop */ - /* need to return the rect that must still be redrawn */ - if ( success ) { - if ( !down ) { - rect->top += rect->height - dist; - } - rect->height = dist; - } - return success; -} -#else /* #ifdef DRAW_LINK_DIRECT */ -static void -ce_draw_doNothing( DrawCtx* dctx, ... ) -{ -} /* ce_draw_doNothing */ -#endif - -void -ce_draw_update( CEDrawCtx* dctx ) -{ - XP_U16 ii; - - for ( ii = 0; ii < CE_NUM_COLORS; ++ii ) { - ceDeleteObjectNotNull( dctx->brushes[ii] ); - dctx->brushes[ii] = CreateSolidBrush(dctx->globals->appPrefs.colors[ii]); - } -} /* ce_drawctxt_update */ - -static void -drawColoredRect( CEDrawCtx* dctx, const RECT* invalR, XP_U16 index ) -{ - CEAppGlobals* globals = dctx->globals; - FillRect( globals->hdc, invalR, dctx->brushes[index] ); -} - -void -ce_draw_erase( CEDrawCtx* dctx, const RECT* invalR ) -{ - drawColoredRect( dctx, invalR, CE_BKG_COLOR ); -} - -void -ce_draw_focus( CEDrawCtx* dctx, const RECT* invalR ) -{ - drawColoredRect( dctx, invalR, CE_FOCUS_COLOR ); -} - -#ifdef XWFEATURE_RELAY -void -ce_draw_status( CEDrawCtx* dctx, const RECT* rect, CeNetState state ) -{ - RECT localR = *rect; - XP_U16 share; - HDC hdc = dctx->globals->hdc; - XP_Bool hasRed; - - FillRect( hdc, &localR, dctx->brushes[CE_BKG_COLOR] ); - InsetRect( &localR, 1, 1 ); - -/* static int count = 0; */ -/* state = count++ % CENSTATE_NSTATES; */ - - hasRed = state < (CENSTATE_NSTATES - 1); - - /* First state is all-red. Last is all-green. In between we have red on - the right, green on the left. */ - - share = localR.right - localR.left; - if ( hasRed ) { - ceSetTextColor( hdc, dctx, CE_BKG_COLOR ); - - share /= CENSTATE_NSTATES-1; - share *= state; - } else { - ceSetTextColor( hdc, dctx, CE_BLACK_COLOR ); - } - - if ( share > 0 ) { - XP_U16 oldRight = localR.right; - localR.right = localR.left + share; - ceClipToRect( hdc, &localR ); - ceSetBkColor( hdc, dctx, CE_PLAYER3_COLOR ); - ceDrawBitmapInRect( hdc, rect, dctx->netArrow, XP_TRUE ); - localR.right = oldRight; - } - if ( hasRed ) { - localR.left += share; - ceClipToRect( hdc, &localR ); - ceSetBkColor( hdc, dctx, CE_PLAYER1_COLOR ); - ceDrawBitmapInRect( hdc, rect, dctx->netArrow, XP_TRUE ); - } -} -#endif - -#ifndef _WIN32_WCE -HBRUSH -ce_draw_getFocusBrush( const CEDrawCtx* dctx ) -{ - return dctx->brushes[CE_FOCUS_COLOR]; -} -#endif - -CEDrawCtx* -ce_drawctxt_make( MPFORMAL HWND mainWin, CEAppGlobals* globals ) -{ - CEDrawCtx* dctx = (CEDrawCtx*)XP_MALLOC( mpool, - sizeof(*dctx) ); - XP_MEMSET( dctx, 0, sizeof(*dctx) ); - MPASSIGN(dctx->mpool, mpool); - -#ifndef DRAW_LINK_DIRECT - dctx->vtable = (DrawCtxVTable*)XP_MALLOC( mpool, sizeof(*((dctx)->vtable))); - - for ( i = 0; i < sizeof(*dctx->vtable)/4; ++i ) { - ((void**)(dctx->vtable))[i] = ce_draw_doNothing; - } - - SET_VTABLE_ENTRY( dctx->vtable, draw_destroyCtxt, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_dictChanged, ce ); - - SET_VTABLE_ENTRY( dctx->vtable, draw_boardBegin, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_drawCell, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_invertCell, ce ); - - SET_VTABLE_ENTRY( dctx->vtable, draw_trayBegin, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_drawTile, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_drawTileBack, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_drawTrayDivider, ce ); - - SET_VTABLE_ENTRY( dctx->vtable, draw_clearRect, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_drawBoardArrow, ce ); - - SET_VTABLE_ENTRY( dctx->vtable, draw_scoreBegin, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_measureRemText, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_drawRemText, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_measureScoreText, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_score_drawPlayer, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_score_pendingScore, ce ); - - SET_VTABLE_ENTRY( dctx->vtable, draw_objFinished, ce ); - - SET_VTABLE_ENTRY( dctx->vtable, draw_drawTimer, ce ); - - SET_VTABLE_ENTRY( dctx->vtable, draw_getMiniWText, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_measureMiniWText, ce ); - SET_VTABLE_ENTRY( dctx->vtable, draw_drawMiniWindow, ce ); -#endif - - dctx->mainWin = mainWin; - dctx->globals = globals; - - ce_draw_update( dctx ); - - dctx->rightArrow = LoadBitmap( globals->hInst, - MAKEINTRESOURCE(IDB_RIGHTARROW) ); - dctx->downArrow = LoadBitmap( globals->hInst, - MAKEINTRESOURCE(IDB_DOWNARROW) ); - dctx->origin = LoadBitmap( globals->hInst, - MAKEINTRESOURCE(IDB_ORIGIN) ); - -#ifdef XWFEATURE_RELAY - dctx->netArrow = LoadBitmap( globals->hInst, - MAKEINTRESOURCE(IDB_NETARROW) ); -#endif - - return dctx; -} /* ce_drawctxt_make */ - -void -ce_draw_toStream( const CEDrawCtx* dctx, XWStreamCtxt* stream ) -{ - XP_U16 ii; - - stream_putU8( stream, N_RESIZE_FONTS ); - for ( ii = 0; ii < N_RESIZE_FONTS; ++ii ) { - const FontCacheEntry* fce = &dctx->fcEntry[ii]; - stream_putU8( stream, fce->indexHt ); - if ( fce->indexHt > 0 ) { - stream_putU8( stream, fce->indexWidth ); - stream_putU8( stream, fce->lfHeight ); - stream_putU8( stream, fce->offset ); - stream_putU8( stream, fce->glyphHt ); - } - } -} - -//#define DROP_CACHE -void -ce_draw_fromStream( CEDrawCtx* dctx, XWStreamCtxt* stream, XP_U8 flags ) -{ - XP_U16 ii; - XP_U16 nEntries; - - ceClearFontCache( dctx ); /* no leaking! */ - - nEntries = (XP_U16)stream_getU8( stream ); - - for ( ii = 0; ii < nEntries; ++ii ) { - FontCacheEntry fce; - - fce.indexHt = (XP_U16)stream_getU8( stream ); - if ( fce.indexHt > 0 ) { - if ( flags >= CE_GAMEFILE_VERSION2 ) { - fce.indexWidth = (XP_U16)stream_getU8( stream ); - } - fce.lfHeight = (XP_U16)stream_getU8( stream ); - fce.offset = (XP_U16)stream_getU8( stream ); - fce.glyphHt = (XP_U16)stream_getU8( stream ); - - /* We need to read from the file no matter how many entries, but - only populate what we have room for -- in case N_RESIZE_FONTS - was different when file written. */ -#ifndef DROP_CACHE - if ( ii < N_RESIZE_FONTS ) { - LOGFONT fontInfo; - - ceFillFontInfo( dctx, &fontInfo, fce.lfHeight ); - fce.setFont = CreateFontIndirect( &fontInfo ); - XP_ASSERT( !!fce.setFont ); - if ( !!fce.setFont ) { - XP_MEMCPY( &dctx->fcEntry[ii], &fce, - sizeof(dctx->fcEntry[ii]) ); - } - } -#endif - } - } -} /* ce_draw_fromStream */ diff --git a/xwords4/wince/cedraw.h b/xwords4/wince/cedraw.h deleted file mode 100644 index 4bc2416f3..000000000 --- a/xwords4/wince/cedraw.h +++ /dev/null @@ -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 - diff --git a/xwords4/wince/cefonts.c b/xwords4/wince/cefonts.c deleted file mode 100644 index 6e00c3c45..000000000 --- a/xwords4/wince/cefonts.c +++ /dev/null @@ -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 -#include "stdafx.h" -#include - -#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 diff --git a/xwords4/wince/cefonts.h b/xwords4/wince/cefonts.h deleted file mode 100644 index 0176c4d12..000000000 --- a/xwords4/wince/cefonts.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/ceginfo.c b/xwords4/wince/ceginfo.c deleted file mode 100755 index cf63a42aa..000000000 --- a/xwords4/wince/ceginfo.c +++ /dev/null @@ -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 /* 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 */ diff --git a/xwords4/wince/ceginfo.h b/xwords4/wince/ceginfo.h deleted file mode 100755 index 9360b3e1d..000000000 --- a/xwords4/wince/ceginfo.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/cehntlim.c b/xwords4/wince/cehntlim.c deleted file mode 100755 index 3bdf6d313..000000000 --- a/xwords4/wince/cehntlim.c +++ /dev/null @@ -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 -#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 */ diff --git a/xwords4/wince/cehntlim.h b/xwords4/wince/cehntlim.h deleted file mode 100755 index 791556c1e..000000000 --- a/xwords4/wince/cehntlim.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/ceir.h b/xwords4/wince/ceir.h deleted file mode 100755 index 5f794a63d..000000000 --- a/xwords4/wince/ceir.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/cemain.c b/xwords4/wince/cemain.c deleted file mode 100755 index 17a7c0e33..000000000 --- a/xwords4/wince/cemain.c +++ /dev/null @@ -1,3940 +0,0 @@ -/* -*- fill-column: 77; compile-command: "make -j2 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. - * - * Derived from code generated by M$'s eVC++. - */ - -#include "stdafx.h" -#include "xwords4.h" -#include -#include -#include -#include /* time() */ -#include -#ifdef _WIN32_WCE -# include -#endif -/* #include */ -#include "strutils.h" - -#include "memstream.h" - -#include "cemain.h" -#include "cedefines.h" - -#include "ceginfo.h" -#include "cestrbx.h" -#include "cedict.h" -#include "ceblank.h" -#include "ceprefs.h" -#include "ceaskpwd.h" -#include "ceutil.h" -#include "ceir.h" -#include "ceclrsel.h" -#include "cehntlim.h" -#include "cedebug.h" -#include "LocalizedStrIncludes.h" -#include "debhacks.h" -#include "cesvdgms.h" -#include "cedraw.h" -#include "cesms.h" -#include "cesockwr.h" -#include "ceresstr.h" -#include "ceconnmg.h" - -#include "dbgutil.h" - -#define MAX_LOADSTRING 100 - -#define MAX_SCROLLBAR_WIDTH 12 -#define MIN_SCROLLBAR_WIDTH 6 -#define SCROLLBARID 0x4321 /* needs to be unique! */ - -#ifdef MEM_DEBUG -# define MEMPOOL globals->mpool, -#else -# define MEMPOOL -#endif - -typedef struct FileWriteState { - CEAppGlobals* globals; - XP_UCHAR* path; -} FileWriteState; - -/* forward util function decls */ -#ifndef XWFEATURE_STANDALONE_ONLY -static XP_S16 ce_send_proc( const XP_U8* buf, XP_U16 len, - const CommsAddrRec* addr, - void* closure ); -static void ce_relay_status( void* closure, - CommsRelayState newState ); -static void ce_relay_connd( void* closure, XP_UCHAR* const room, - XP_Bool reconnect, - XP_U16 devOrder, /* 1 means created room, etc. */ - XP_Bool allHere, XP_U16 nMissing ); -static void ce_relay_error( void* closure, XWREASON relayErr ); - -# ifdef COMMS_HEARTBEAT -static void ce_reset_proc( void* closure ); -# endif -#endif - -static VTableMgr* ce_util_getVTManager( XW_UtilCtxt* uc ); -static void ce_util_userError( XW_UtilCtxt* uc, UtilErrID id ); -static XP_Bool ce_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, - XWStreamCtxt* stream ); -static XP_Bool ce_util_confirmTrade( XW_UtilCtxt* uc, const XP_UCHAR** tiles, - XP_U16 nTiles ); -static XWBonusType ce_util_getSquareBonus( XW_UtilCtxt* uc, XP_U16 boardSize, - XP_U16 col, XP_U16 row ); -static XP_S16 ce_util_userPickTileBlank( XW_UtilCtxt* uc, XP_U16 playerNum, - const XP_UCHAR** tileFaces, - XP_U16 nTiles ); -static XP_S16 ce_util_userPickTileTray( XW_UtilCtxt* uc, const PickInfo* pi, - XP_U16 playerNum, - const XP_UCHAR** texts, XP_U16 nTiles ); -static XP_Bool ce_util_askPassword( XW_UtilCtxt* uc, const XP_UCHAR* name, - XP_UCHAR* buf, XP_U16* len ); -static void ce_util_trayHiddenChange( XW_UtilCtxt* uc, - XW_TrayVisState newState, - XP_U16 nVisibleRows ); -static void ce_util_yOffsetChange( XW_UtilCtxt* uc, XP_U16 maxOffset, - XP_U16 oldOffset, XP_U16 newOffset ); -static void ce_util_turnChanged( XW_UtilCtxt* uc ); -static void ce_util_notifyGameOver( XW_UtilCtxt* uc ); -static void ce_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl, - XWStreamCtxt* words ); - -static XP_Bool ce_util_hiliteCell( XW_UtilCtxt* uc, XP_U16 col, - XP_U16 row ); -static XP_Bool ce_util_engineProgressCallback( XW_UtilCtxt* uc ); -static void ce_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why, XP_U16 when, - XWTimerProc proc, void* closure); -static void ce_util_clearTimer( XW_UtilCtxt* uc, XWTimerReason why ); -static XP_Bool ce_util_altKeyDown( XW_UtilCtxt* uc ); -static void ce_util_requestTime( XW_UtilCtxt* uc ); -static XP_U32 ce_util_getCurSeconds( XW_UtilCtxt* uc ); -static DictionaryCtxt* ce_util_makeEmptyDict( XW_UtilCtxt* uc ); -#ifdef XWFEATURE_RELAY -static XWStreamCtxt* ce_util_makeStreamFromAddr( XW_UtilCtxt* uc, - XP_PlayerAddr channelNo ); -#endif -static const XP_UCHAR* ce_util_getUserString( XW_UtilCtxt* uc, - XP_U16 stringCode ); -static XP_Bool ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, - XP_U16 turn, XP_Bool turnLost ); -static void ce_util_remSelected( XW_UtilCtxt* uc ); -#ifndef XWFEATURE_STANDALONE_ONLY -static void ce_util_addrChange( XW_UtilCtxt* uc, const CommsAddrRec* oldAddr, - const CommsAddrRec* newAddr ); -#endif - -#ifdef XWFEATURE_SEARCHLIMIT -static XP_Bool ce_util_getTraySearchLimits( XW_UtilCtxt* uc, XP_U16* min, - XP_U16* max ); -#endif -#ifdef SHOW_PROGRESS -static void ce_util_engineStarting( XW_UtilCtxt* uc ); -static void ce_util_engineStopping( XW_UtilCtxt* uc ); -#endif - -static XP_Bool ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream, - const wchar_t* title, XP_U16 buttons, - XP_Bool destroy ); -static void RECTtoXPR( XP_Rect* dest, const RECT* src ); -static XP_Bool ceDoNewGame( CEAppGlobals* globals, GIShow showWhat ); -static XP_Bool ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave ); -static void closeGame( CEAppGlobals* globals ); -static void ceInitPrefs( CEAppGlobals* globals, CEAppPrefs* prefs ); -static void updateForColors( CEAppGlobals* globals ); -static XWStreamCtxt* make_generic_stream( const CEAppGlobals* globals ); -#ifndef XWFEATURE_STANDALONE_ONLY -static void ce_send_on_close( XWStreamCtxt* stream, void* closure ); -#endif -static XP_Bool ceSetDictName( const wchar_t* wPath, XP_U16 index, void* ctxt ); -static int messageBoxStream( CEAppGlobals* globals, XWStreamCtxt* stream, - const wchar_t* title, XP_U16 buttons ); -static XP_Bool ceQueryFromStream( CEAppGlobals* globals, XWStreamCtxt* stream); -static int ceOopsId( CEAppGlobals* globals, XP_U16 strId, SkipAlertBits sab ); -static int ceOops( CEAppGlobals* globals, const XP_UCHAR* str, - SkipAlertBits sab ); -static XP_Bool isDefaultName( CEAppGlobals* globals, const XP_UCHAR* name ); -static void ceSetTitleFromName( CEAppGlobals* globals ); -static void removeScrollbar( CEAppGlobals* globals ); -static void ceToggleFullScreen( CEAppGlobals* globals ); - - -#ifndef _WIN32_WCE -/* Very basic cmdline args meant at first to let me vary the size of the - * screen. Form is of arg=digits, with no spaces and digits having to be an - * integer. Right now only width and height work: e.g. - * "wine obj_win32_dbg/xwords4.exe height=240 width=320" - */ -static XP_Bool -tryIntParam( const char* buf, const char* param, XP_U16* value ) -{ - XP_U16 len = strlen( param ); - XP_Bool found = 0 == strncmp( buf, param, len ); - if ( found ) { - *value = atoi( &buf[len] ); - } - return found; -} - -static XP_Bool -tryCharParam( const char* buf, const char* param, char* out ) -{ - XP_U16 len = strlen( param ); - XP_Bool found = 0 == strncmp( buf, param, len ); - if ( found ) { - int ii; - for ( ii = len; buf[ii] != ' ' && buf[ii] != 0 ; ++ii ) { - } - memcpy( out, &buf[len], ii - len ); - out[ii-len] = 0; - XP_LOGF( "%s: \"%s\"", __func__, out ); - } - return found; -} - -static void -parseCmdLine( const char* cmdline, XP_U16* width, XP_U16* height, - char* dll ) -{ - XP_U16 ii; - for ( ii = 0; ; ++ii ) { - const char* cmd; - char ch; - char buf[64]; - int len; - for ( cmd = cmdline ; ; ++cmd ) { - ch = *cmd; - if ( ch == '\0' || ch == ' ' ) { - break; - } - } - len = cmd - cmdline; - if ( len < sizeof(buf) ) { - memcpy( buf, cmdline, cmd - cmdline ); - buf[len] = '\0'; - if ( ii > 0 ) { /* skip argv[0] */ - if ( tryIntParam( buf, "width=", width ) ) { - } else if ( tryIntParam( buf, "height=", height ) ) { - } else if ( tryCharParam( buf, "dll=", dll ) ) { - } else { - XP_LOGF( "failed to match cmdline arg \"%s\"", buf ); - } - } - } - if ( ch == '\0' ) { - break; - } - cmdline = ++cmd; - } -} -#endif - -// Forward declarations of functions included in this code module: -ATOM MyRegisterClass (HINSTANCE, LPTSTR); -BOOL InitInstance (HINSTANCE, int -#ifndef _WIN32_WCE - , XP_U16, XP_U16, const char* -#endif - ); -LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); -LRESULT CALLBACK ceAbout (HWND, UINT, WPARAM, LPARAM); - -int WINAPI -WinMain( HINSTANCE hInstance, - HINSTANCE XP_UNUSED(hPrevInstance), -#ifdef _WIN32_WCE - LPWSTR XP_UNUSED_CE(lpCmdLine), -#else - LPSTR lpCmdLine, -#endif - int nCmdShow) -{ - MSG msg; - HACCEL hAccelTable; - -#ifndef _WIN32_WCE - XP_U16 width = 320, height = 320; - char dll[MAX_PATH] = {0}; - parseCmdLine( lpCmdLine, &width, &height, dll ); -#endif - - // Perform application initialization: - if (!InitInstance (hInstance, nCmdShow -#ifndef _WIN32_WCE - , width, height, dll -#endif - )) { - return FALSE; - } - - hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_XWORDS4); - - // Main message loop. Return of 0 indicates quit message. Return of -1 - // indicates major error (so we just bail.) - while ( 0 < GetMessage(&msg, NULL, 0, 0) ) { - if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - - /* This would be a good place to free up memory, close sockets, etc. */ - - LOG_RETURNF( "%d", msg.wParam ); - return msg.wParam; -} - -#ifdef __GNUC__ -int -main() -{ - LOG_FUNC(); - - return WinMain( GetModuleHandle(NULL), 0, -#ifdef _WIN32_WCE - GetCommandLineW(), -#else - GetCommandLineA(), -#endif - SW_SHOWDEFAULT ); -} -#endif - - -// -// FUNCTION: MyRegisterClass() -// -// PURPOSE: Registers the window class. -// -// COMMENTS: -// -// It is important to call this function so that the application -// will get 'well formed' small icons associated with it. -// -ATOM -MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass) -{ - WNDCLASS wc; - - XP_MEMSET( &wc, 0, sizeof(wc) ); - - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = (WNDPROC) WndProc; - wc.cbWndExtra = sizeof(CEAppGlobals*); - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_XWORDS4)); - wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); -#ifndef _WIN32_WCE - wc.lpszMenuName = (LPCTSTR)IDM_MENU; -#endif - wc.lpszClassName = szWindowClass; - - return RegisterClass(&wc); -} - -static void -ceInitUtilFuncs( CEAppGlobals* globals ) -{ - UtilVtable* vtable = globals->util.vtable = - XP_MALLOC( globals->mpool, sizeof( UtilVtable ) ); - globals->util.closure = (void*)globals; - globals->util.gameInfo = &globals->gameInfo; - - MPASSIGN( globals->util.mpool, globals->mpool ); - - vtable->m_util_getVTManager = ce_util_getVTManager; - vtable->m_util_userError = ce_util_userError; - vtable->m_util_getSquareBonus = ce_util_getSquareBonus; - vtable->m_util_userQuery = ce_util_userQuery; - vtable->m_util_confirmTrade = ce_util_confirmTrade; - vtable->m_util_userPickTileBlank = ce_util_userPickTileBlank; - vtable->m_util_userPickTileTray = ce_util_userPickTileTray; - vtable->m_util_askPassword = ce_util_askPassword; - vtable->m_util_trayHiddenChange = ce_util_trayHiddenChange; - vtable->m_util_yOffsetChange = ce_util_yOffsetChange; - vtable->m_util_turnChanged = ce_util_turnChanged; - vtable->m_util_notifyGameOver = ce_util_notifyGameOver; - vtable->m_util_informMove = ce_util_informMove; - vtable->m_util_hiliteCell = ce_util_hiliteCell; - vtable->m_util_engineProgressCallback = ce_util_engineProgressCallback; - vtable->m_util_setTimer = ce_util_setTimer; - vtable->m_util_clearTimer = ce_util_clearTimer; - vtable->m_util_altKeyDown = ce_util_altKeyDown; - vtable->m_util_requestTime = ce_util_requestTime; - vtable->m_util_getCurSeconds = ce_util_getCurSeconds; - vtable->m_util_makeEmptyDict = ce_util_makeEmptyDict; - vtable->m_util_getUserString = ce_util_getUserString; - vtable->m_util_warnIllegalWord = ce_util_warnIllegalWord; - vtable->m_util_remSelected = ce_util_remSelected; -#ifdef XWFEATURE_RELAY - vtable->m_util_addrChange = ce_util_addrChange; - vtable->m_util_makeStreamFromAddr = ce_util_makeStreamFromAddr; -#endif -#ifdef XWFEATURE_SEARCHLIMIT - vtable->m_util_getTraySearchLimits = ce_util_getTraySearchLimits; -#endif -#ifdef SHOW_PROGRESS - vtable->m_util_engineStarting = ce_util_engineStarting; - vtable->m_util_engineStopping = ce_util_engineStopping; -#endif - -} /* ceInitUtilFuncs */ - -#ifdef CEFEATURE_CANSCROLL -# define SCROLL_SHRINK 1 - -static void -updateScrollInfo( CEAppGlobals* globals, XP_U16 nHidden ) -{ - SCROLLINFO sinfo; - - XP_MEMSET( &sinfo, 0, sizeof(sinfo) ); - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; - sinfo.nMax = model_numRows( globals->game.model ); - sinfo.nPage = sinfo.nMax - nHidden + 1; - - (void)SetScrollInfo( globals->scrollHandle, SB_CTL, &sinfo, TRUE ); -} - -LRESULT CALLBACK -scrollWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) -{ - CEAppGlobals* globals = (CEAppGlobals*)GetWindowLongPtr( hWnd, GWL_USERDATA ); - LRESULT result = 1; - -/* XP_LOGF( "%s: event=%s (%d)", __func__, messageToStr(message), message ); */ - - /* Trap key events. Left and right always shift the focus off. Up and - down shift focus off IFF they're going to be no-ops on the theory that - the user needs to get some visual feedback and on some devices the - scrollbar isn't even drawn differently when focussed. */ - if ( WM_KEYDOWN == message ) { - XP_Bool setFocus = XP_FALSE; - - if ( (VK_RIGHT == wParam) || - (VK_LEFT == wParam) || - (VK_TAB == wParam) ) { - setFocus = XP_TRUE; - } else if ( (VK_UP == wParam) || (VK_DOWN == wParam) ) { - SCROLLINFO sinfo; - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SIF_POS | SIF_RANGE | SIF_PAGE; - GetScrollInfo( globals->scrollHandle, SB_CTL, &sinfo ); - - if ( (VK_UP == wParam) && (sinfo.nPos <= sinfo.nMin) ) { - setFocus = XP_TRUE; - } else if ( (VK_DOWN == wParam) - && (sinfo.nPos > (sinfo.nMax - sinfo.nPage)) ) { - setFocus = XP_TRUE; - } - } - - if ( setFocus ) { - SetFocus( globals->hWnd ); - result = 0; - globals->keyDown = XP_TRUE; - } - } - if ( 0 != result ) { - result = CallWindowProc( globals->oldScrollProc, hWnd, message, - wParam, lParam ); - } - return result; -} /* scrollWindowProc */ - -static void -makeScrollbar( CEAppGlobals* globals, XP_U16 nHidden, XP_U16 xx, XP_U16 yy, - XP_U16 width, XP_U16 height ) -{ - HWND hwndSB; -#ifdef _WIN32_WCE - RECT tmp; - XP_U16 rectHt; -#endif - - ++xx; - width -= 2; /* make narrower: on CE will erase cell border */ - -#ifdef _WIN32_WCE - tmp.left = xx; - tmp.right = xx + width; - rectHt = height / 10; /* each focus rect to be 1/10th height */ - - tmp.top = yy; - tmp.bottom = yy + rectHt; - XP_MEMCPY( &globals->scrollRects[0], &tmp, sizeof(globals->scrollRects[0]) ); - - tmp.bottom = yy + height; - tmp.top = tmp.bottom - rectHt; - XP_MEMCPY( &globals->scrollRects[1], &tmp, sizeof(globals->scrollRects[1]) ); - - yy += rectHt; - height -= rectHt * 2; /* above and below */ -#endif - - /* Need to destroy it, or resize it, because board size may be changing - in case where portrait display's been flipped. */ - removeScrollbar( globals ); - - hwndSB = CreateWindow( TEXT("SCROLLBAR"), // Class name - NULL, // Window text - // Window style - SBS_VERT|WS_VISIBLE|WS_CHILD, - xx, yy, width, height, globals->hWnd, - (HMENU)SCROLLBARID, // The control identifier - globals->hInst, // The instance handle - NULL ); // s'pposed to be NULL - - globals->scrollHandle = hwndSB; - - globals->oldScrollProc = (WNDPROC) GetWindowLongPtr( hwndSB, - GWL_WNDPROC ); - XP_ASSERT( 0 == GetWindowLongPtr( hwndSB, GWL_USERDATA ) ); - SetWindowLongPtr( hwndSB, GWL_WNDPROC, (LPARAM)scrollWindowProc ); - SetWindowLongPtr( hwndSB, GWL_USERDATA, (LPARAM)globals ); - - updateScrollInfo( globals, nHidden ); - EnableWindow( hwndSB, nHidden > 0 ); - - ShowWindow( globals->scrollHandle, SW_SHOW ); -} /* makeScrollbar */ - -static void -removeScrollbar( CEAppGlobals* globals ) -{ - if ( !!globals->scrollHandle ) { - DestroyWindow( globals->scrollHandle ); - globals->scrollHandle = NULL; - globals->scrollerHasFocus = XP_FALSE; - } -} /* removeScrollbar */ -#endif - -typedef struct CEBoardParms { - XP_U16 scrnWidth; - XP_U16 scrnHeight; - XP_U16 adjLeft; - XP_U16 adjTop; - - XP_U16 boardWidth; - XP_U16 boardHeight; - XP_U16 boardTop; - XP_U16 trayTop; - - XP_U16 trayHeight; - XP_U16 trayWidth; - - XP_U16 timerLeft, timerTop, timerWidth, timerHeight; -#ifndef XWFEATURE_STANDALONE_ONLY - XP_U16 netstatLeft, netstatTop, netstatWidth, netstatHeight; -#endif - - XP_U16 boardLeft, trayLeft; - XP_U16 scoreWidth; - XP_U16 scoreHeight; - XP_U16 scrollWidth; - XP_Bool horiz; -#ifdef CEFEATURE_CANSCROLL - XP_Bool needsScroller; -#endif -} CEBoardParms; - -static void -figureBoardParms( CEAppGlobals* globals, const XP_U16 nRows, - CEBoardParms* bparms ) -{ - RECT rc; - XP_U16 scrnWidth, scrnHeight; - XP_U16 trayHeight, scoreWidth, scoreHeight; - XP_U16 hScale, vScale, nVisibleRows; - XP_U16 tmp; - XP_Bool horiz; - XP_U16 scrollWidth = 0; - XP_U16 adjLeft, adjTop; - - XP_MEMSET( bparms, 0, sizeof(*bparms) ); - - GetClientRect( globals->hWnd, &rc ); -#ifndef _WIN32_WCE -# if defined FORCE_HEIGHT && defined FORCE_WIDTH - rc.right = rc.left + FORCE_WIDTH; - rc.bottom = rc.top + FORCE_HEIGHT; -# else - if ( !globals->appPrefs.fullScreen ) { - if ( globals->dbWidth != 0 ) { - rc.right = rc.left + globals->dbWidth; - } - if ( globals->dbHeight != 0 ) { - rc.bottom = rc.top + globals->dbHeight; - } - } -# endif -#endif /* #ifndef _WIN32_WCE */ - - scrnWidth = (XP_U16)(rc.right - rc.left); - scrnHeight = (XP_U16)(rc.bottom - rc.top); - - XP_LOGF( "%s: scrnWidth: %d, scrnHeight: %d", __func__, - scrnWidth, scrnHeight ); - - /* Figure layout style based on proportion UNLESS there's just no room - for anything but 15 columns on the board -- because vertically is the - only dimension in which we can scroll. */ - if ( scrnWidth <= (MIN_CELL_WIDTH * (nRows+2)) ) { - horiz = XP_TRUE; - } else { - horiz = scrnHeight >= scrnWidth; - } - - /* vScale. Tray must be a few pixels taller than cells to use same - sized, minimum-sized font. Subtract out that difference here and it's - guaranteed that tray will wind up at least that much taller later - though for the rest of the calculation we reserve only a cell's height - for it. */ - vScale = (scrnHeight - (MIN_TRAY_HEIGHT-MIN_CELL_HEIGHT)) - / (nRows + (horiz?2:1)); /* horiz means scoreboard *and* tray */ - if ( vScale >= MIN_CELL_HEIGHT ) { - nVisibleRows = nRows; /* no scrolling needed */ - } else { - XP_U16 nRowsPossible = (scrnHeight-MIN_TRAY_HEIGHT) / MIN_CELL_HEIGHT; - XP_S16 num2Scroll; - num2Scroll = (nRows + (horiz?1:0)) - nRowsPossible; /* 1: scoreboard */ - XP_ASSERT( num2Scroll > 0 ); - if ( num2Scroll < 0 ) { /* no-scroll case should be caught above */ - num2Scroll = 0; - } - nVisibleRows = nRows - num2Scroll; - vScale = (scrnHeight-MIN_TRAY_HEIGHT) / (nVisibleRows + (horiz? 1:0)); - } - - tmp = nRows + (horiz ? 0 : 2); - hScale = scrnWidth / tmp; - - if ( vScale > hScale ) { - vScale = XP_MAX( MIN_CELL_HEIGHT, hScale ); - } else if ( hScale > vScale ) { - hScale = XP_MAX( MIN_CELL_WIDTH, vScale ); - } - - /* Figure out tray size */ - tmp = vScale * (nVisibleRows + (horiz? 1:0)); - trayHeight = XP_MIN( vScale * 2, scrnHeight - tmp ); - -#ifdef CEFEATURE_CANSCROLL - /* Does this need to be in a loop? */ - while ( nVisibleRows < nRows && hScale > MIN_CELL_WIDTH ) { /* need scroller? (while allows break) */ - scrollWidth = scrnWidth - (tmp * hScale); - if ( scrollWidth >= MIN_SCROLLBAR_WIDTH ) { - break; - } - --hScale; - } - if ( scrollWidth > MAX_SCROLLBAR_WIDTH ) { - scrollWidth = MAX_SCROLLBAR_WIDTH; - } -#endif - - if ( horiz ) { - scoreWidth = scrollWidth + (hScale * nRows); - scoreHeight = vScale - SCORE_TWEAK; - trayHeight += SCORE_TWEAK; - } else { - scoreWidth = XP_MIN( 2*hScale, scrnWidth - (hScale * nRows) ); - scoreHeight = (nVisibleRows * vScale) + trayHeight; - } -/* XP_LOGF( "hScale=%d; vScale=%d; trayHeight=%d", hScale, vScale, trayHeight ); */ - -#ifndef XWFEATURE_STANDALONE_ONLY - if ( !!globals->game.comms ) { - /* If we're horizontal, steal from the right of the scoreboard. If - vertical, from the bottom. */ - if ( horiz ) { - bparms->netstatWidth = hScale; - scoreWidth -= bparms->netstatWidth; - bparms->netstatLeft = scoreWidth; - bparms->netstatTop = 0; - bparms->netstatHeight = scoreHeight; - } else { - bparms->netstatLeft = 0; - bparms->netstatHeight = vScale; - scoreHeight -= bparms->netstatHeight; - bparms->netstatTop = scoreHeight; - bparms->netstatWidth = scoreWidth; - } - } -#endif - - if ( globals->gameInfo.timerEnabled ) { - if ( horiz ) { - bparms->timerWidth = scoreWidth / 6; /* arbitrarily, one sixth */ - scoreWidth -= bparms->timerWidth; - bparms->timerLeft = scoreWidth; - bparms->timerTop = 0; - bparms->timerHeight = scoreHeight; - } else { - bparms->timerLeft = 0; - bparms->timerHeight = vScale * 2; - bparms->timerTop = scoreHeight - bparms->timerHeight; - bparms->timerWidth = scoreWidth; - - scoreHeight -= bparms->timerHeight; - } - } - - globals->cellHt = vScale; - - /* figure actual width and height */ - tmp = scrollWidth + (hScale * nRows) + (horiz ? 0 : scoreWidth); - adjLeft = (scrnWidth - tmp)/2; - tmp = trayHeight + (vScale * nVisibleRows) + (horiz?scoreHeight:0); - adjTop = (scrnHeight - tmp)/2; - - bparms->scrnWidth = scrnWidth; - bparms->scrnHeight = scrnHeight; - bparms->adjLeft = adjLeft; - bparms->adjTop = adjTop; - bparms->boardWidth = hScale * nRows; - bparms->boardHeight = nVisibleRows * vScale; - bparms->boardTop = adjTop + (horiz? scoreHeight : 0); - bparms->trayTop = bparms->boardTop + (nVisibleRows * vScale) + 1; - bparms->trayHeight = trayHeight - 1; - bparms->trayWidth = (hScale * nRows) + scrollWidth; - bparms->boardLeft = adjLeft + (horiz ? 0 : scoreWidth); - bparms->trayLeft = bparms->boardLeft;//horiz? 0 : scoreWidth; - bparms->scoreWidth = scoreWidth; - bparms->scoreHeight = scoreHeight; - bparms->scrollWidth = scrollWidth; - bparms->horiz = horiz; - -#ifdef CEFEATURE_CANSCROLL - bparms->needsScroller = scrollWidth > 0; - if ( bparms->needsScroller ) { - XP_U16 boardRight; - boardRight = bparms->boardLeft + (nRows * hScale); - makeScrollbar( globals, nRows - nVisibleRows, - boardRight, bparms->boardTop, - scrollWidth, - vScale * nVisibleRows ); - } else { - removeScrollbar( globals ); - } -#endif -} /* figureBoardParms */ - -static void -setOwnedRects( CEAppGlobals* globals, const CEBoardParms* bparms ) -{ - RECT tmp; - XP_U16 scrollWidth = bparms->scrollWidth; - - XP_MEMSET( &globals->ownedRects, 0, sizeof(globals->ownedRects) ); - - tmp.top = bparms->adjTop; /* Same for both */ - tmp.bottom = bparms->trayTop + bparms->trayHeight; /* Same for both */ - - tmp.left = 0; - tmp.right = bparms->adjLeft; - XP_MEMCPY( &globals->ownedRects[OWNED_RECT_LEFT], &tmp, - sizeof(globals->ownedRects[OWNED_RECT_LEFT]) ); - - tmp.left = tmp.right + bparms->boardWidth + scrollWidth; - tmp.right = bparms->scrnWidth; - XP_MEMCPY( &globals->ownedRects[OWNED_RECT_RIGHT], &tmp, - sizeof(globals->ownedRects[OWNED_RECT_RIGHT]) ); - - tmp.left = 0; - tmp.top = 0; - tmp.right = bparms->scrnWidth; - tmp.bottom = bparms->adjTop; - XP_MEMCPY( &globals->ownedRects[OWNED_RECT_TOP], &tmp, - sizeof(globals->ownedRects[OWNED_RECT_TOP]) ); - - tmp.top = bparms->trayTop + bparms->trayHeight; - tmp.bottom = bparms->scrnHeight; - XP_MEMCPY( &globals->ownedRects[OWNED_RECT_BOTTOM], &tmp, - sizeof(globals->ownedRects[OWNED_RECT_BOTTOM]) ); -} /* setOwnedRects */ - - -/* PENDING cePositionBoard gets called a lot when the screen size hasn't - changed. It'd be better to cache the size used to do layout and not - repeat those steps (including possibly nuking and rebuilding a - scrollbar). */ -static XP_Bool -cePositionBoard( CEAppGlobals* globals ) -{ - XP_Bool erase = XP_FALSE; - XP_U16 nCols; - CEBoardParms bparms; - - XP_ASSERT( !!globals->game.model ); - nCols = model_numCols( globals->game.model ); - XP_ASSERT( nCols <= CE_MAX_ROWS ); - - figureBoardParms( globals, nCols, &bparms ); - setOwnedRects( globals, &bparms ); - -#ifdef XWFEATURE_RELAY - if ( !!globals->game.comms ) { - globals->relayStatusR.left = bparms.adjLeft + bparms.netstatLeft; - globals->relayStatusR.top = bparms.adjTop + bparms.netstatTop; - globals->relayStatusR.right = globals->relayStatusR.left - + bparms.netstatWidth; - globals->relayStatusR.bottom = globals->relayStatusR.top - + bparms.netstatHeight; - } -#endif - - if ( globals->gameInfo.timerEnabled ) { - board_setTimerLoc( globals->game.board, - bparms.adjLeft + bparms.timerLeft, - bparms.adjTop + bparms.timerTop, bparms.timerWidth, - bparms.timerHeight ); - } - - board_setPos( globals->game.board, bparms.boardLeft, - bparms.boardTop, bparms.boardWidth, bparms.boardHeight, - bparms.trayHeight /*whatever; no zoom yet*/, XP_FALSE ); - - board_setScoreboardLoc( globals->game.board, bparms.adjLeft, bparms.adjTop, - bparms.scoreWidth, - bparms.scoreHeight, bparms.horiz ); - board_setYOffset( globals->game.board, 0 ); - - board_prefsChanged( globals->game.board, &globals->appPrefs.cp ); - - board_setTrayLoc( globals->game.board, bparms.trayLeft, bparms.trayTop, - bparms.trayWidth, bparms.trayHeight, - bparms.trayWidth/40 ); /* 1/8 of a tile width, roughly */ - - server_prefsChanged( globals->game.server, &globals->appPrefs.cp ); - -#if ! defined _WIN32_WCE && defined DEBUG - ceSetTitleFromName( globals ); -#endif - ceCheckMenus( globals ); - return erase; -} /* cePositionBoard */ - -/* Set the title. If there's a game name, replace the window title with that - * in case both won't fit. If there's no name yet, install the app name as - * title. - */ -static void -ceSetTitleFromName( CEAppGlobals* globals ) -{ - wchar_t widebuf[64]; - const XP_UCHAR* gameName = globals->curGameName; - - /* if default name, remove any current name */ - if ( !gameName || isDefaultName( globals, gameName ) ) { - LoadString( globals->locInst, IDS_APP_TITLE, widebuf, VSIZE(widebuf) ); - } else { - wchar_t* dotPos; - XP_UCHAR* baseStart = 1 + strrchr( gameName, '\\' ); - XP_U16 len = (XP_U16)XP_STRLEN( baseStart ); - - MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, baseStart, len + 1, - widebuf, len + 1 ); - - /* now get rid of the ".xwg" */ - dotPos = wcsrchr( widebuf, '.' ); - if ( dotPos != NULL ) { - *dotPos = 0; - } - } - -#if ! defined _WIN32_WCE && defined DEBUG - swprintf( &widebuf[wcslen(widebuf)], L":%dx%d", - globals->dbWidth, globals->dbHeight ); -#endif - SendMessage( globals->hWnd, WM_SETTEXT, 0, (long)widebuf ); -} /* ceSetTitleFromName */ - -static void -ceInitTProcs( CEAppGlobals* globals, TransportProcs* procs ) -{ - XP_MEMSET( procs, 0, sizeof(*procs) ); - procs->send = ce_send_proc; -#ifdef COMMS_HEARTBEAT - procs->reset = ce_reset_proc; -#endif -#ifdef XWFEATURE_RELAY - procs->rstatus = ce_relay_status; - procs->rconnd = ce_relay_connd; - procs->rerror = ce_relay_error; -#endif - procs->closure = globals; -} - -static void -ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, - const CommsAddrRec* XP_UNUSED_STANDALONE(addr) ) -{ - DictionaryCtxt* dict; - DictionaryCtxt* toBeDestroyed = NULL; - XP_UCHAR* newDictName = globals->gameInfo.dictName; - - /* This needs to happen even when !newGame because it's how the dict - slots in PlayerInfo get loaded. That really ought to happen earlier, - though. */ - XP_ASSERT( !!globals->game.model ); - dict = model_getDictionary( globals->game.model ); - - if ( !!dict ) { - const XP_UCHAR* curDictName = dict_getName( dict ); - if ( !!newDictName && - ( !curDictName || 0 != strcmp( curDictName, newDictName ) ) ) { - toBeDestroyed = dict; - dict = NULL; - } else { - replaceStringIfDifferent( globals->mpool, - &globals->gameInfo.dictName, - curDictName ); - } - } - - if ( !dict ) { -#ifdef STUBBED_DICT - dict = make_stubbed_dict( MPPARM_NOCOMMA(globals->mpool) ); -#else - XP_ASSERT( !!newDictName ); - XP_LOGF( "calling ce_dictionary_make" ); - dict = ce_dictionary_make( globals, newDictName); -#endif - XP_ASSERT( !!dict ); - model_setDictionary( globals->game.model, dict ); - } - - if ( newGame ) { - TransportProcs procs; - ceInitTProcs( globals, &procs ); - game_reset( MEMPOOL &globals->game, &globals->gameInfo, &globals->util, - &globals->appPrefs.cp, &procs ); - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - if ( !!addr && !!globals->game.comms ) { - comms_setAddr( globals->game.comms, addr ); - } -#endif - } - - XP_ASSERT( !!globals->game.board ); - (void)ceSizeIfFullscreen( globals, globals->hWnd ); - (void)cePositionBoard( globals ); - - board_invalAll( globals->game.board ); - InvalidateRect( globals->hWnd, NULL, TRUE /* erase */ ); - -#ifndef XWFEATURE_STANDALONE_ONLY - if ( !!globals->game.comms ) { - comms_start( globals->game.comms ); - } - if ( newGame && globals->gameInfo.serverRole == SERVER_ISCLIENT ) { - XWStreamCtxt* stream; - XP_ASSERT( !!globals->game.comms ); - stream = make_generic_stream( globals ); - stream_setOnCloseProc( stream, ce_send_on_close ); - server_initClientConnection( globals->game.server, stream ); - } -#endif - - ceSetLeftSoftkey( globals, ID_MOVE_TURNDONE ); - - server_do( globals->game.server ); - - globals->isNewGame = FALSE; - - if ( !!toBeDestroyed ) { - dict_destroy( toBeDestroyed ); - } -} /* ceInitAndStartBoard */ - -static XP_UCHAR* -ceReadString( const CEAppGlobals* XP_UNUSED_DBG(globals), HANDLE fileH ) -{ - XP_U16 nameLen; - XP_UCHAR* name = NULL; - XP_U32 nRead; - - if ( ReadFile( fileH, &nameLen, sizeof(nameLen), &nRead, NULL ) - && nameLen > 0 ) { - name = XP_MALLOC( globals->mpool, nameLen + 1 ); - ReadFile( fileH, name, nameLen, &nRead, NULL ); - name[nameLen] = '\0'; - } - - return name; -} /* ceReadString */ - -static void -ceWriteString( const XP_UCHAR* str, HANDLE fileH ) -{ - XP_U32 nWritten; - XP_U16 len = !!str? XP_STRLEN( str ) : 0; - WriteFile( fileH, &len, sizeof(len), &nWritten, NULL ); - if ( 0 < len ) { - WriteFile( fileH, str, len, &nWritten, NULL ); - } -} - -static void -ceSavePrefs( CEAppGlobals* globals ) -{ - HANDLE fileH; - wchar_t path[CE_MAX_PATH_LEN]; - - (void)ceGetPath( globals, PREFS_FILE_PATH_L, path, VSIZE(path) ); - fileH = CreateFile( path, GENERIC_WRITE, 0, NULL, - OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL ); - if ( fileH != INVALID_HANDLE_VALUE ) { - XP_U32 nWritten; - - SetFilePointer( fileH, 0, 0, FILE_BEGIN ); - /* write prefs, including version num */ - WriteFile( fileH, &globals->appPrefs, sizeof(globals->appPrefs), - &nWritten, NULL ); - - ceWriteString( globals->curGameName, fileH ); - - WriteFile( fileH, &globals->flags, sizeof(globals->flags), &nWritten, - NULL ); - - ceWriteString( globals->langFileName, fileH ); - - SetEndOfFile( fileH ); /* truncate anything previously there */ - - CloseHandle( fileH ); /* am I not supposed to do this? PENDING */ - XP_LOGW( "prefs file written", path ); - } else { - logLastError( "failed to create prefs file" ); - } -} /* ceSavePrefs */ - -static XP_Bool -peekVersion( HANDLE fileH, XP_U16* version ) -{ - XP_Bool success = XP_FALSE; - XP_U32 nRead; - success = ReadFile( fileH, version, sizeof(*version), &nRead, NULL ); - if ( success ) { - SetFilePointer( fileH, -nRead, 0, FILE_CURRENT ); - } - return success; -} /* peekVersion */ - -static XP_Bool -canUpdatePrefs( CEAppGlobals* globals, HANDLE fileH, XP_U16 curVersion, - CEAppPrefs* prefs ) -{ - XP_Bool success = XP_FALSE; - if ( curVersion == 0x0003 && CUR_CE_PREFS_FLAGS == 0x0004 ) { - /* common prefs has gotten bigger, pushing colors down. */ - CEAppPrefs0003 oldPrefs; - XP_U32 nRead; - if ( ReadFile( fileH, &oldPrefs, sizeof(oldPrefs), &nRead, NULL ) ) { - ceInitPrefs( globals, prefs ); - - XP_MEMCPY( &prefs->cp, &oldPrefs.cp, sizeof(oldPrefs.cp) ); - prefs->cp.showColors = oldPrefs.showColors; - prefs->fullScreen = oldPrefs.fullScreen; - - success = XP_TRUE; - } else { - XP_LOGF( "%s: ReadFile bad", __func__ ); - } - } else { - XP_LOGF( "%s: can't convert from %d to %d", __func__, - curVersion, CUR_CE_PREFS_FLAGS ); - } - LOG_RETURNF( "%d", (int)success ); - return success; -} /* canUpdatePrefs */ - -static XP_Bool -ceLoadPrefs( CEAppGlobals* globals ) -{ - XP_Bool result = XP_FALSE; - HANDLE fileH; - wchar_t path[CE_MAX_PATH_LEN]; - - (void)ceGetPath( globals, PREFS_FILE_PATH_L, path, VSIZE(path) ); - fileH = CreateFile( path, GENERIC_READ, 0, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, NULL ); - if ( fileH != INVALID_HANDLE_VALUE ) { - XP_U32 fileSize = GetFileSize( fileH, NULL ); - XP_U16 curVersion; - if ( fileSize >= sizeof(curVersion) && peekVersion( fileH, - &curVersion ) ) { - CEAppPrefs tmpPrefs = {0}; - if ( curVersion == CUR_CE_PREFS_FLAGS ) { - if ( fileSize >= sizeof( CEAppPrefs ) ) { - XP_U32 bytesRead; - if ( ReadFile( fileH, &tmpPrefs, sizeof(tmpPrefs), - &bytesRead, NULL ) ) { - XP_ASSERT( tmpPrefs.versionFlags == CUR_CE_PREFS_FLAGS ); - result = XP_TRUE; - } - } - } else if ( canUpdatePrefs( globals, fileH, curVersion, - &tmpPrefs ) ) { - result = XP_TRUE; - } else { - XP_LOGF( "%s: old prefs; cannot read.", __func__ ); - } - - if ( result ) { - XP_U16 flags; - XP_U32 nRead; - - XP_MEMCPY( &globals->appPrefs, &tmpPrefs, - sizeof(globals->appPrefs) ); - - globals->curGameName = ceReadString( globals, fileH ); - - if ( ReadFile( fileH, &flags, sizeof(flags), &nRead, - NULL ) - && nRead == sizeof(flags) ) { - } else { - flags = 0; - } - globals->flags = flags; - - globals->langFileName = ceReadString( globals, fileH ); - } - } - CloseHandle( fileH ); - } else { - XP_LOGF( "ceLoadPrefs: prefs file not found" ); - } - return result; /* none found */ -} /* ceLoadPrefs */ - -static XWStreamCtxt* -make_generic_stream( const CEAppGlobals* globals ) -{ - return mem_stream_make( MPPARM(globals->mpool) globals->vtMgr, - (void*)globals, 0, NULL ); -} /* make_generic_stream */ - -static XWStreamCtxt* -fileToStream( const CEAppGlobals* globals, const XP_UCHAR* path ) -{ - XWStreamCtxt* stream = NULL; - HANDLE fileH; - wchar_t widebuf[257]; - XP_U16 len; - - len = (XP_U16)XP_STRLEN( path ); - MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, path, len + 1, - widebuf, len + 1 ); - - fileH = CreateFile( widebuf, GENERIC_READ, 0, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - - if ( fileH != INVALID_HANDLE_VALUE ) { - XP_U32 len = GetFileSize( fileH, NULL ); - XP_U32 nRead; - XP_UCHAR* buf = XP_MALLOC( globals->mpool, len ); - - XP_DEBUGF( "fileSize = %ld", len ); - - ReadFile( fileH, buf, len, &nRead, NULL ); - CloseHandle( fileH ); - - stream = make_generic_stream( globals ); - stream_open( stream ); - stream_putBytes( stream, buf, (XP_U16)nRead ); - - XP_FREE( globals->mpool, buf ); - } - - XP_DEBUGF( "fileToStream => 0x%lx", (unsigned long)stream ); - - return stream; -} /* fileToStream */ - -static XP_Bool -ceLoadSavedGame( CEAppGlobals* globals ) -{ - XP_Bool success = XP_FALSE; - XWStreamCtxt* stream; - - LOG_FUNC(); - - stream = fileToStream( globals, globals->curGameName ); - success = stream != NULL; - if ( success ) { - DictionaryCtxt* dict; - XP_U8 flags = stream_getU8( stream ); - XP_Bool hasDict = (flags & 0x01) != 0; - flags >>= 1; - - if ( hasDict ) { -#ifdef STUBBED_DICT - XP_ASSERT(0); /* just don't do this!!!! */ -#else - XP_UCHAR* dictName = stringFromStream( globals->mpool, stream ); - dict = ce_dictionary_make( globals, dictName ); - success = dict != NULL; - if ( !success ) { - XP_UCHAR buf[128]; - snprintf( buf, VSIZE(buf), - ceGetResString( globals, IDS_CANNOTOPEN_DICT ), - dictName ); - buf[VSIZE(buf)-1] = '\0'; - ceOops( globals, buf, SAB_NONE ); - - } - XP_FREE( globals->mpool, dictName ); -#endif - } else { - dict = NULL; - } - - if ( success ) { - TransportProcs procs; - - if ( flags >= CE_GAMEFILE_VERSION1 ) { - ce_draw_fromStream( globals->draw, stream, flags ); - } - - XP_DEBUGF( "calling game_makeFromStream" ); - ceInitTProcs( globals, &procs ); - success = game_makeFromStream( MEMPOOL stream, &globals->game, - &globals->gameInfo, dict, NULL, - &globals->util, - (DrawCtx*)globals->draw, - &globals->appPrefs.cp, &procs ); - if ( success ) { - ceSetTitleFromName( globals ); - } else { - if ( !!dict ) { - dict_destroy( dict ); - } - ceOopsId( globals, IDS_CANNOTOPEN_GAME, SAB_NONE ); - } - } - - stream_destroy( stream ); - } - - return success; -} /* ceLoadSavedGame */ - -static void -colorsFromRsrc( const CEAppGlobals* globals, CEAppPrefs* prefs ) -{ - XP_U16 i; - HGLOBAL globH; - HRSRC rsrcH; - XP_U16* ptr; - - rsrcH = FindResource( globals->hInst, MAKEINTRESOURCE(ID_COLORS_RES), - TEXT("CLRS") ); - globH = LoadResource( globals->hInst, rsrcH ); - ptr = (XP_U16*)globH; - - for ( i = 0; i < CE_NUM_COLORS; ++i ) { - XP_U8 r = (XP_U8)*ptr++; - XP_U8 g = (XP_U8)*ptr++; - XP_U8 b = (XP_U8)*ptr++; - prefs->colors[i] = RGB( r, g, b ); - } - - DeleteObject( globH ); -} /* colorsFromRsrc */ - -static void -ceInitPrefs( CEAppGlobals* globals, CEAppPrefs* prefs ) -{ - prefs->versionFlags = CUR_CE_PREFS_FLAGS; - prefs->fullScreen = XP_FALSE; - - prefs->cp.showBoardArrow = XP_TRUE; - prefs->cp.showRobotScores = XP_FALSE; - prefs->cp.showColors = XP_TRUE; - - colorsFromRsrc( globals, prefs ); -} /* ceInitPrefs */ - -#ifdef _WIN32_WCE -static void -getOSInfo( CEAppGlobals* globals ) -{ - OSVERSIONINFO ver = {0}; - TCHAR buf[128]; - XW_WinceVersion winceVersion = WINCE_UNKNOWN; - - if ( GetVersionEx( &ver )) { - XP_LOGF( "version = %ld.%ld", ver.dwMajorVersion, ver.dwMinorVersion ); - } else { - XP_WARNF( "GetVersionEx failed" ); - } - - if ( SystemParametersInfo( SPI_GETPLATFORMTYPE, sizeof(buf), buf, FALSE ) ) { - if ( 0 == lstrcmp( buf, L"PocketPC") ) { - // We are on a Pocket PC, so check the OS version, - // Pocket PC 2003 used WinCE 4.2 - if ( ver.dwMajorVersion < 4 ) { - winceVersion = WINCE_PPC_V1; - } else if ( ver.dwMajorVersion == 4 ) { - winceVersion = WINCE_PPC_2003; - } else if ( ver.dwMajorVersion > 4 ) { - winceVersion = WINCE_PPC_2005; - } - } else if ( 0 == lstrcmp( buf, L"SmartPhone") ) { - if ( ver.dwMajorVersion < 4 ) { - winceVersion = WINCE_SMARTPHONE_V1; - } else if ( ver.dwMajorVersion == 4 ) { - winceVersion = WINCE_SMARTPHONE_2003; - } else if ( ver.dwMajorVersion > 4 ) { - winceVersion = WINCE_SMARTPHONE_2005; - } - } else { - XP_LOGW( "unknown OS type", buf ); - } - } else if ( GetLastError() == ERROR_ACCESS_DENIED ) { - if ( ver.dwMajorVersion < 4 ) { - winceVersion = WINCE_SMARTPHONE_V1; - } else { - winceVersion = WINCE_SMARTPHONE_2003; - } - } - - XP_ASSERT( winceVersion != WINCE_UNKNOWN ); - globals->winceVersion = winceVersion; - XP_LOGF( "%s: set version to %d", __func__, winceVersion ); -} /* getOSInfo */ -#else -#define getOSInfo( g ) -#endif - - -#ifndef XWFEATURE_STANDALONE_ONLY -#if defined _WIN32_WCE && ! defined CEGCC_DOES_CONNMGR -# define LOAD_PTR( typ, name ) { \ - typ proc; \ - proc = (typ)GetProcAddress( hcellDll, TEXT(#name));\ - XP_ASSERT( !!proc ); \ - globals->cmProcs.name = proc; \ -} - -static void -initConnMgr( CEAppGlobals* globals ) -{ - HINSTANCE hcellDll = LoadLibrary(TEXT("cellcore.dll")); - XP_ASSERT( !!hcellDll ); - if ( !!hcellDll ) { - globals->hcellDll = hcellDll; - - LOAD_PTR( ConnMgrEstablishConnectionProc, ConnMgrEstablishConnection ); - LOAD_PTR( ConnMgrConnectionStatusProc, ConnMgrConnectionStatus ); - LOAD_PTR( ConnMgrMapURLProc, ConnMgrMapURL ); - LOAD_PTR( ConnMgrReleaseConnectionProc, ConnMgrReleaseConnection ); - } -} - -# undef LOAD_PTR -#endif -#endif - -// -// FUNCTION: InitInstance(HANDLE, int) -// -// PURPOSE: Saves instance handle and creates main window -// -// COMMENTS: -// -// In this function, we save the instance handle in a global variable and -// create and display the main program window. -// -BOOL -InitInstance(HINSTANCE hInstance, int nCmdShow -#ifndef _WIN32_WCE - ,XP_U16 width, XP_U16 height, const char* dll -#endif - ) -{ - HWND hWnd; - TCHAR szTitle[MAX_LOADSTRING]; // The title bar text - TCHAR szWindowClass[MAX_LOADSTRING]; // The window class name - CEAppGlobals* globals; - BOOL result = FALSE; - XP_Bool oldGameLoaded; - XP_Bool prevStateExists; - XP_Bool newDone = XP_FALSE; - wchar_t path[CE_MAX_PATH_LEN]; - MPSLOT; - -#ifndef XWFEATURE_STANDALONE_ONLY - { - WORD wVersionRequested; - WSADATA wsaData; - int err; - wVersionRequested = MAKEWORD( 2, 2 ); - err = WSAStartup( wVersionRequested, &wsaData ); - if ( err != 0 ) { - /* Tell the user that we could not find a usable */ - /* WinSock DLL. */ - XP_LOGF( "unable to load winsock" ); - } - } -#endif - - LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); - LoadString(hInstance, IDC_XWORDS4, szWindowClass, MAX_LOADSTRING); - - // If it is already running, then focus on the window. Skip title in - // search as we change title to include game name - hWnd = FindWindow( szWindowClass, NULL ); - if ( hWnd ) { - XP_LOGF( "Looks like I'm running already; " - "calling SetForegroundWindow and exiting" ); - SetForegroundWindow( (HWND)((ULONG) hWnd | 0x00000001) ); - goto exit; - } - -#ifdef MEM_DEBUG - mpool = mpool_make(); -#endif - - globals = (CEAppGlobals*)XP_MALLOC( mpool, sizeof(*globals) ); - XP_DEBUGF( "globals created: 0x%p", globals ); - XP_MEMSET( globals, 0, sizeof(*globals) ); - MPASSIGN( globals->mpool, mpool ); - -#ifndef _WIN32_WCE - globals->dbWidth = width; - globals->dbHeight = height; -#endif - - (void)ceGetPath( globals, DEFAULT_DIR_PATH_L, path, VSIZE(path) ); - (void)CreateDirectory( path, 0 ); - - getOSInfo( globals ); - - globals->vtMgr = make_vtablemgr( MPPARM_NOCOMMA(mpool) ); - - globals->hInst = hInstance; - // Initialize global strings - MyRegisterClass(hInstance, szWindowClass); - - prevStateExists = ceLoadPrefs( globals ); - if ( !prevStateExists ) { - ceInitPrefs( globals, &globals->appPrefs ); - } - -#ifndef _WIN32_WCE - srand( time(NULL) ); - - /* Was a language file named in preferences? If so, and if none was - provided on the cmdline, load it (if it exists; if it doesn't, act as - if none set). */ - if ( !!dll && !!dll[0] ) { - replaceStringIfDifferent( globals->mpool, &globals->langFileName, dll ); - } -#endif - - if ( !!globals->langFileName && !globals->locInst ) { - HINSTANCE inst = ceLoadResFile( globals->langFileName ); - if ( !!inst ) { - globals->locInst = inst; - } else { - XP_FREE( globals->mpool, globals->langFileName ); - globals->langFileName = NULL; - } - } - if ( !globals->locInst ) { - globals->locInst = globals->hInst; - } - - hWnd = CreateWindow( szWindowClass, szTitle, WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, NULL, NULL, hInstance, globals ); - if (!hWnd) { - goto exit; - } - globals->hWnd = hWnd; - -#ifdef _WIN32_WCE - if ( globals->hwndCB && !IS_SMARTPHONE(globals) ) { - RECT rc, rcmb; - - GetWindowRect( hWnd, &rc ); - GetWindowRect( globals->hwndCB, &rcmb ); - rc.bottom -= (rcmb.bottom - rcmb.top); - - MoveWindow( hWnd, rc.left, rc.top, rc.right-rc.left, - rc.bottom-rc.top, FALSE ); - } -#endif - - ceInitUtilFuncs( globals ); - - gi_initPlayerInfo( MPPARM(mpool) &globals->gameInfo, NULL ); - - -#ifndef _WIN32_WCE - SetMenu( hWnd, LoadMenu( globals->locInst, MAKEINTRESOURCE(IDM_MENU) ) ); -#endif - - /* choose one. If none found it's an error. */ -#ifndef STUBBED_DICT - result = 1 == ceLocateNDicts( globals, 1, ceSetDictName, - globals ); - if ( !result ) { - wchar_t buf[512]; - (void)LoadString( globals->locInst, (UINT)IDS_DICTLOC, buf, VSIZE(buf) ); - assertOnTop( globals->hWnd ); - MessageBox( globals->hWnd, buf, - ceGetResStringL( globals, IDS_NODICT_L ), - MB_OK | MB_ICONHAND ); - goto exit; - } -#else - result = TRUE; -#endif - -#if defined _WIN32_WCE && ! defined CEGCC_DOES_CONNMGR - initConnMgr( globals ); -#endif - - /* must load prefs before creating draw ctxt */ - globals->draw = ce_drawctxt_make( MPPARM(globals->mpool) - hWnd, globals ); - - oldGameLoaded = prevStateExists && ceLoadSavedGame( globals ); - - if ( !oldGameLoaded ) { - TransportProcs procs; - ceInitTProcs( globals, &procs ); - game_makeNewGame( MPPARM(mpool) &globals->game, &globals->gameInfo, - &globals->util, (DrawCtx*)globals->draw, - &globals->appPrefs.cp, &procs ); - - /* calls ceInitAndStartBoard */ - newDone = ceDoNewGame( globals, GI_NEW_GAME ); - if ( !newDone ) { - result = FALSE; - } - } - - trapBackspaceKey( hWnd ); - - ShowWindow(hWnd, nCmdShow); - UpdateWindow(hWnd); -#ifdef _WIN32_WCE - if (globals->hwndCB) { - CommandBar_Show(globals->hwndCB, TRUE); - } -#endif - if ( result && !newDone ) { - ceInitAndStartBoard( globals, !oldGameLoaded, NULL ); - } - - exit: - return result; -} /* InitInstance */ - -static XP_Bool -ceSetDictName( const wchar_t* XP_UNUSED(wPath), XP_U16 XP_UNUSED_DBG(index), - void* XP_UNUSED(ctxt) ) -{ -/* CEAppGlobals* globals = (CEAppGlobals*)ctxt; */ -/* XP_UCHAR* str; */ -/* XP_UCHAR buf[CE_MAX_PATH_LEN]; */ - XP_ASSERT( index == 0 ); /* we said one only! */ - -/* WideCharToMultiByte( CP_ACP, 0, wPath, -1, */ -/* buf, sizeof(buf)-1, NULL, NULL ); */ - -/* XP_LOGF( "%s: got path \"%s\"", __func__, buf ); */ -/* str = copyString( MPPARM(globals->mpool) buf ); */ -/* XP_LOGF( "%s: got %p", __func__, str ); /\* this is leaking *\/ */ -/* XP_ASSERT( NULL == globals->gameInfo.dictName ); */ -/* globals->gameInfo.dictName = str; */ - return XP_FALSE; -} /* ceSetDictName */ - -static XP_Bool -ceHandleHintRequest( CEAppGlobals* globals, int wmId ) -{ - XP_Bool notDone; - XP_Bool draw; - XP_ASSERT( !!globals->game.board ); - - draw = board_requestHint( globals->game.board, -#ifdef XWFEATURE_SEARCHLIMIT - globals->askTrayLimits, -#endif - wmId == ID_MOVE_PREVHINT, ¬Done ); - globals->hintPending = notDone; - if ( draw ) { /* don't turn on if disallowed */ - ceSetLeftSoftkey( globals, wmId ); - } - return draw; -} /* ceHandleHintRequest */ - -static XP_Bool -handleTradeCmd( CEAppGlobals* globals ) -{ - XP_Bool success = board_beginTrade( globals->game.board ); - if ( success ) { - ceSetLeftSoftkey( globals, ID_MOVE_TURNDONE ); - } - return success; -} /* handleTradeCmd */ - -static XP_Bool -handleJuggleCmd( CEAppGlobals* globals ) -{ - ceSetLeftSoftkey( globals, ID_MOVE_JUGGLE ); - return board_juggleTray( globals->game.board ); -} /* handleJuggleCmd */ - -static XP_Bool -handleHidetrayCmd( CEAppGlobals* globals ) -{ - XP_Bool result; - XW_TrayVisState curState = board_getTrayVisState( globals->game.board ); - - if ( curState == TRAY_REVEALED ) { - result = board_hideTray( globals->game.board ); - } else { - result = board_showTray( globals->game.board ); - } - - ceSetLeftSoftkey( globals, ID_MOVE_HIDETRAY ); - return result; -} /* handleHidetrayCmd */ - -static XP_Bool -handleDoneCmd( CEAppGlobals* globals) -{ - return board_commitTurn( globals->game.board, XP_FALSE ); -} /* handleDoneCmd */ - -static void -ceCountsAndValues( CEAppGlobals* globals ) -{ - if ( !!globals->game.server ) { - XWStreamCtxt* stream = make_generic_stream( globals ); - - server_formatDictCounts( globals->game.server, stream, 3 ); - - (void)ceMsgFromStream( globals, stream, - ceGetResStringL( globals, IDS_COUNTSVALS_L ), - MB_OK | MB_ICONINFORMATION, XP_TRUE ); - } -} /* ceCountsAndValues */ - -static void -ceTilesLeft( CEAppGlobals* globals ) -{ - if ( !!globals->game.board ) { - XWStreamCtxt* stream = make_generic_stream( globals ); - board_formatRemainingTiles( globals->game.board, stream ); - - (void)ceMsgFromStream( globals, stream, - ceGetResStringL( globals, IDS_REMTILES_L ), - MB_OK | MB_ICONINFORMATION, XP_TRUE ); - } -} /* ceTilesLeft */ - -static void -ceDoHistory( CEAppGlobals* globals ) -{ - XP_Bool gameOver = server_getGameIsOver(globals->game.server); - XWStreamCtxt* stream; - - stream = make_generic_stream( globals ); - - model_writeGameHistory( globals->game.model, stream, - globals->game.server, gameOver ); - (void)ceMsgFromStream( globals, stream, - ceGetResStringL( globals, IDS_GAMEHIST_L ), - MB_OK | MB_ICONINFORMATION, XP_TRUE ); -} /* ceDoHistory */ - -#ifdef XWFEATURE_RELAY -static CeNetState -ceFlattenState( const CEAppGlobals* globals ) -{ - /* Idea is to give user a clue how the network connection's coming. - Relay only matters if we have a socket open. So use that first. */ - CommsRelayState relayState = globals->relayState; - CeConnState socketState = globals->socketState; - CeNetState state = CENSTATE_NONE; - - if ( socketState == CE_IPST_CONNECTED ) { - switch( relayState ) { - case COMMS_RELAYSTATE_UNCONNECTED: - case COMMS_RELAYSTATE_DENIED: - case COMMS_RELAYSTATE_CONNECT_PENDING: - state = CENSTATE_TRYING_RELAY; - break; - case COMMS_RELAYSTATE_CONNECTED: - case COMMS_RELAYSTATE_RECONNECTED: - state = CENSTATE_HAVE_RELAY; - break; - case COMMS_RELAYSTATE_ALLCONNECTED: - state = CENSTATE_ALL_HERE; - break; - } - } else { - switch( socketState ) { - case CE_IPST_START: -#ifdef _WIN32_WCE - case CE_IPST_OPENING_NETWORK: - case CE_IPST_NETWORK_OPENED: -#endif -/* state = CENSTATE_NONE; */ - break; - case CE_IPST_RESOLVINGHOST: - case CE_IPST_HOSTRESOLVED: - case CE_IPST_CONNECTING: - case CE_IPST_CONNECTED: - state = CENSTATE_TRYING_RELAY; - break; - } - } - return state; -} /* ceFlattenState */ -#endif - -static void -drawInsidePaint( CEAppGlobals* globals, const RECT* invalR ) -{ - HDC hdc; - - hdc = GetDC( globals->hWnd ); - if ( !hdc ) { - logLastError( __func__ ); - } else { - int oldMode = SetBkMode( hdc, TRANSPARENT ); - HDC prevHDC = globals->hdc; - globals->hdc = hdc; - - if ( !!invalR ) { - XP_U16 ii; - RECT interR; - for ( ii = 0; ii < N_OWNED_RECTS; ++ii ) { - if ( IntersectRect( &interR, invalR, - &globals->ownedRects[ii] ) ) { - ce_draw_erase( globals->draw, &interR ); - } - } - -#ifdef XWFEATURE_RELAY - if ( IntersectRect( &interR, invalR, &globals->relayStatusR ) ) { - CeNetState state = ceFlattenState( globals ); - ce_draw_status( globals->draw, &globals->relayStatusR, state ); - } -#endif - -#ifdef _WIN32_WCE - for ( ii = 0; ii < VSIZE(globals->scrollRects); ++ii ) { - if ( IntersectRect( &interR, invalR, - &globals->scrollRects[ii] ) ) { - if ( globals->scrollerHasFocus ) { - ce_draw_focus( globals->draw, &interR ); - } else { - ce_draw_erase( globals->draw, &interR ); - } - } - } -#endif - } - - board_draw( globals->game.board ); - - (void)SetBkMode( hdc, oldMode ); - globals->hdc = prevHDC; - } -} /* drawInsidePaint */ - -static void -ceDisplayFinalScores( CEAppGlobals* globals ) -{ - XWStreamCtxt* stream; - - stream = make_generic_stream( globals ); - server_writeFinalScores( globals->game.server, stream ); - stream_putU8( stream, '\0' ); - - (void)ceMsgFromStream( globals, stream, - ceGetResStringL( globals, IDS_FINALSCORE_L), - MB_OK | MB_ICONINFORMATION, XP_TRUE ); -} /* ceDisplayFinalScores */ - -static void -ceWarnLangChange( CEAppGlobals* globals ) -{ - const wchar_t* msg = ceGetResStringL( globals, - IDS_LANG_CHANGE_RESTART ); - MessageBox( globals->hWnd, msg, - ceGetResStringL( globals, IDS_FYI_L ), - MB_OK | MB_ICONINFORMATION ); -} - -static XP_Bool -ceDoNewGame( CEAppGlobals* globals, GIShow showWhat ) -{ - CommsAddrRec* addr = NULL; - XP_Bool changed = XP_FALSE; - CePrefsPrefs prefsPrefs; - XP_UCHAR newDictName[CE_MAX_PATH_LEN+1]; - GInfoResults results; - - if ( WrapGameInfoDialog( globals, showWhat, &prefsPrefs, newDictName, - VSIZE(newDictName), &results ) -#ifndef STUBBED_DICT - && ( newDictName[0] != '\0' ) -#endif - ) { - - if ( globals->curGameName != NULL ) { - XP_FREE( globals->mpool, globals->curGameName ); - globals->curGameName = NULL; - } - - if ( results.prefsChanged ) { - loadCurPrefsFromState( globals, &globals->appPrefs, - &globals->gameInfo, &prefsPrefs ); - if ( results.colorsChanged ) { - updateForColors( globals ); - } - } - - if ( results.langChanged ) { - ceWarnLangChange( globals ); - } - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - if ( results.addrChanged ) { - addr = &prefsPrefs.addrRec; - } -#endif - - ceInitAndStartBoard( globals, XP_TRUE, addr ); - ceSetTitleFromName( globals ); - changed = XP_TRUE; - } - - return changed; -} /* ceDoNewGame */ - -static void -ceChooseAndOpen( CEAppGlobals* globals ) -{ - assertOnTop( globals->hWnd ); - // Save in case we'll be duplicating it - again: - if ( ceSaveCurGame( globals, XP_FALSE ) ) { - SavedGamesResult choice; - wchar_t newName[256]; - newName[0] = 0; - - ceSetTitleFromName( globals ); /* in case we named it above */ - - choice = ceSavedGamesDlg( globals, globals->curGameName, newName, - VSIZE(newName) ); - if ( CE_SVGAME_CANCEL != choice ) { - XP_UCHAR* name; - XP_U16 len; - - len = wcslen(newName); - name = XP_MALLOC( globals->mpool, len + 1 ); - - WideCharToMultiByte( CP_ACP, 0, newName, len + 1, - name, len + 1, NULL, NULL ); - - if ( globals->curGameName != NULL - && 0 == XP_STRCMP( name, globals->curGameName ) ){ - /* User chose already-open game; no-op */ - XP_FREE( globals->mpool, name ); - } else { - /* Save old name in case fail to open new, e.g. because dict - not there */ - XP_UCHAR* oldName; - - /* Need to save a second time, with auto-save, in case user - wants to overwrite yet chooses a game whose dict is - missing -- since then we'll be re-opening this game! */ - ceSaveCurGame( globals, XP_TRUE ); /* may change curGameName */ - - oldName = globals->curGameName; - globals->curGameName = NULL; /* prevent being destroyed */ - closeGame( globals ); - - if ( CE_SVGAME_RENAME == choice ) { - XP_U16 len = 1 + XP_STRLEN( oldName ); - wchar_t widebuf[len]; - MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, oldName, len, - widebuf, len ); - (void)MoveFile( widebuf, newName ); - } - - globals->curGameName = name; - if ( ceLoadSavedGame( globals ) ) { - XP_FREE( globals->mpool, oldName ); - } else { - XP_ASSERT( CE_SVGAME_RENAME != choice ); - XP_LOGF( "failed to open chosen game" ); - XP_FREE( globals->mpool, globals->curGameName ); - globals->curGameName = oldName; - if ( !ceLoadSavedGame( globals ) ) { - XP_LOGF( "failed to open old game too!!!" ); - } - } - ceInitAndStartBoard( globals, XP_FALSE, NULL ); - if ( CE_SVGAME_RENAME == choice ) { - goto again; - } - } - } else { - XP_LOGF( "GetOpenFileName() failed" ); - } - } -} /* ceChooseAndOpen */ - -static void -updateForColors( CEAppGlobals* globals ) -{ - ce_draw_update( globals->draw ); - if ( !!globals->game.board ) { - board_invalAll( globals->game.board ); - } -} /* updateForColors */ - -static void -ceDoPrefsDlg( CEAppGlobals* globals ) -{ - CePrefsPrefs prefsPrefs; - XP_Bool colorsChanged, langChanged; - - loadStateFromCurPrefs( globals, &globals->appPrefs, &globals->gameInfo, - &prefsPrefs ); - - assertOnTop( globals->hWnd ); - if ( WrapPrefsDialog( globals->hWnd, globals, &prefsPrefs, - XP_FALSE, &colorsChanged, &langChanged ) ) { - loadCurPrefsFromState( globals, &globals->appPrefs, &globals->gameInfo, - &prefsPrefs ); - - (void)cePositionBoard( globals ); - - if ( colorsChanged ) { - updateForColors( globals ); - } - - if ( langChanged ) { - ceWarnLangChange( globals ); - } - - /* need to reflect vars set in state into globals, and update/inval - as appropriate. */ - } -} /* ceDoPrefsDlg */ - -static void -ceWriteToFile( XWStreamCtxt* stream, void* closure ) -{ - FileWriteState* fwState = (FileWriteState*)closure; -#ifdef MEM_DEBUG - CEAppGlobals* globals = fwState->globals; -#endif - XP_UCHAR* path = fwState->path; - XP_U16 len = (XP_U16)XP_STRLEN( path ) + 1; /* 1: null byte */ - wchar_t widebuf[len]; - HANDLE fileH; - - MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, path, len, widebuf, len ); - - fileH = CreateFile( widebuf, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - - if ( fileH != INVALID_HANDLE_VALUE ) { - XP_UCHAR* buf; - XP_U32 nWritten; - - len = stream_getSize( stream ); - buf = XP_MALLOC( globals->mpool, len ); - stream_getBytes( stream, buf, len ); - - WriteFile( fileH, buf, len, &nWritten, NULL ); - SetEndOfFile( fileH ); - CloseHandle( fileH ); - - XP_FREE( globals->mpool, buf ); - } -} /* ceWriteToFile */ - -static XP_Bool -isDefaultName( CEAppGlobals* globals, const XP_UCHAR* name ) -{ - wchar_t path[CE_MAX_PATH_LEN]; - (void)ceGetPath( globals, DEFAULT_GAME_PATH, path, VSIZE(path) ); - return 0 == XP_STRCMP( path, name ); -} /* isDefaultName */ - -static XP_Bool -ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave ) -{ - XP_Bool confirmed = XP_FALSE; - /* If it doesn't yet have a name, get a path at which to save it. User - has a chance to cancel this. But if there is a name go ahead and save - using it and don't bother giving cancel chance -- since there's no - harm in making 'em restart. Not sure how this changes when IR's - involved. */ - XP_UCHAR* name = globals->curGameName; - if ( name == NULL || isDefaultName( globals, name ) ) { - XP_UCHAR* newName = NULL; - - if ( autoSave ) { - XP_U16 len; - wchar_t path[CE_MAX_PATH_LEN]; - len = 1 + ceGetPath( globals, DEFAULT_GAME_PATH, - path, VSIZE(path) ); - newName = XP_MALLOC( globals->mpool, len ); - XP_MEMCPY( newName, path, len ); - - confirmed = XP_TRUE; - } else { - wchar_t nameBuf[MAX_PATH]; - - confirmed = ceConfirmUniqueName( globals, globals->hWnd, - IDS_SAVENAME, nameBuf, - VSIZE(nameBuf) ); - if ( confirmed ) { - XP_U16 len = wcslen(nameBuf); - newName = XP_MALLOC( globals->mpool, len + 1 ); - WideCharToMultiByte( CP_ACP, 0, nameBuf, len + 1, - newName, len + 1, NULL, NULL ); - } - } - - if ( confirmed ) { - XP_ASSERT( !!newName ); - if ( !!globals->curGameName ) { - XP_FREE( globals->mpool, globals->curGameName ); - } - globals->curGameName = newName; - } - } else { - confirmed = XP_TRUE; - } - - if ( confirmed ) { - if ( !!globals->game.server ) { - XWStreamCtxt* memStream; - DictionaryCtxt* dict; - FileWriteState fwState; - const char* dictName; - XP_U8 flags; - - fwState.path = globals->curGameName; - fwState.globals = globals; - board_hideTray( globals->game.board ); /* so won't be visible when - next opened */ - memStream = mem_stream_make( MEMPOOL globals->vtMgr, &fwState, 0, - ceWriteToFile ); - stream_open( memStream ); - - /* the dictionary */ - dict = model_getDictionary( globals->game.model ); -#ifdef STUBBED_DICT /* don't check this in!!! */ - dictName = NULL; -#else - dictName = !!dict? dict_getName( dict ) : NULL; -#endif - flags = !!dictName? 0x01 : 0x00; - flags |= CE_GAMEFILE_VERSION << 1; - stream_putU8( memStream, flags ); - - if ( !!dictName ) { - stringToStream( memStream, dictName ); - } - - ce_draw_toStream( globals->draw, memStream ); - - game_saveToStream( &globals->game, &globals->gameInfo, memStream ); - - stream_destroy( memStream ); - } - } - - return confirmed; -} /* ceSaveCurGame */ - -static void -ceSaveAndExit( CEAppGlobals* globals ) -{ - globals->exiting = XP_TRUE; - (void)ceSaveCurGame( globals, XP_TRUE ); - ceSavePrefs( globals ); - -#ifdef _WIN32_WCE - if ( !globals->appPrefs.fullScreen ) { - /* For some reason a Treo700w crashes on exit if not in full-screen - mode. Dunno if it's a bug in the software on that device or in - Wince 5.0 or my code, but going into fullscreen mode (after saving - prefs so it doesn't stick) fixes it. Need to track down why, what - part of the mode change matters. So far I know I can't remove - cePositionBoard()... */ -#if 0 - globals->appPrefs.fullScreen = !globals->appPrefs.fullScreen; - ceSizeIfFullscreen( globals, globals->hWnd ); - (void)cePositionBoard( globals ); -#else - ceToggleFullScreen( globals ); -#endif - } -#endif - - DestroyWindow(globals->hWnd); -} /* ceSaveAndExit */ - -static void -closeGame( CEAppGlobals* globals ) -{ - game_dispose( &globals->game ); - gi_disposePlayerInfo( MPPARM(globals->mpool) &globals->gameInfo ); - - if ( !!globals->curGameName ) { - XP_FREE( globals->mpool, globals->curGameName ); - } -} - -static void -freeGlobals( CEAppGlobals* globals ) -{ - XP_U16 ii; - MPSLOT; - - MPASSIGN( mpool, globals->mpool ); - - draw_destroyCtxt( (DrawCtx*)globals->draw ); - - closeGame( globals ); - -#ifndef XWFEATURE_STANDALONE_ONLY - if ( !!globals->socketWrap ) { - ce_sockwrap_delete( globals->socketWrap ); - globals->socketWrap = NULL; - } - WSACleanup(); - -# if defined _WIN32_WCE && ! defined CEGCC_DOES_CONNMGR - if ( !!globals->hcellDll ) { - FreeLibrary( globals->hcellDll ); - globals->hcellDll = NULL; - } -# endif -#endif - - if ( !!globals->vtMgr ) { - vtmgr_destroy( MPPARM(mpool) globals->vtMgr ); - } - if ( !!globals->util.vtable ) { - XP_FREE( mpool, globals->util.vtable ); - } - for ( ii = 0; ii < N_CACHED_PATHS; ++ii ) { - if ( !!globals->specialDirs[ii] ) { - XP_FREE( mpool, globals->specialDirs[ii] ); - } - } - - ceFreeResStrings( globals ); - if ( globals->locInst != globals->hInst ) { - ceCloseResFile( globals->locInst ); - } - if ( globals->langFileName != NULL ) { - XP_FREE( globals->mpool, globals->langFileName ); - globals->langFileName = NULL; - } - - XP_FREE( globals->mpool, globals ); - mpool_destroy( mpool ); -} /* freeGlobals */ - -#ifdef _WIN32_WCE -static HWND -makeCommandBar( HWND hwnd, HINSTANCE hInst ) -{ - SHMENUBARINFO mbi; - HWND result = NULL; - - XP_MEMSET( &mbi, 0, sizeof(mbi) ); - mbi.cbSize = sizeof(mbi); - mbi.hwndParent = hwnd; - mbi.nToolBarId = IDM_MAIN_MENUBAR; - mbi.hInstRes = hInst; - /* Don't set dwFlags if you want the Wince5 two-button softkey menu. */ -/* mbi.dwFlags = SHCMBF_HMENU; */ - - //mbi.dwFlags = SHCMBF_HIDESIPBUTTON; /* eeh added. Why??? */ - - if ( SHCreateMenuBar(&mbi) ) { - result = mbi.hwndMB; - } else { - /* will want to use this to change menubar: SHEnableSoftkey? */ - XP_LOGF( "SHCreateMenuBar failed" ); - } - - return result; -} /* makeCommandBar */ -#endif - -#ifdef CEFEATURE_CANSCROLL -static XP_Bool -handleScroll( CEAppGlobals* globals, XP_S16 pos, /* only valid for THUMB* */ - XP_S16 code, HWND wnd ) -{ - XP_Bool result = XP_FALSE; - - if ( wnd == globals->scrollHandle ) { - XP_U16 curYOffset = board_getYOffset( globals->game.board ); - XP_S16 newOffset = curYOffset; - - XP_ASSERT( !!globals->game.board ); - - switch ( code ) { -/* case SB_BOTTOM: // Scrolls to the lower right */ -/* case SB_ENDSCROLL: // Ends scroll */ - - case SB_LINEUP: // Scrolls one line up - case SB_PAGEUP: // - --newOffset; - break; - - case SB_LINEDOWN: // Scrolls one line down - case SB_PAGEDOWN: // Scrolls one page down - ++newOffset; - break; - - case SB_THUMBTRACK: /* still dragging; don't redraw */ - case SB_THUMBPOSITION: - newOffset = pos; - default: - break; - /* do nothing: leave newOffset == curYOffset */ - } - - result = curYOffset != newOffset - && board_setYOffset( globals->game.board, newOffset ); - } - return result; -} /* handleScroll */ -#endif - -static XP_Bool -ceFireTimer( CEAppGlobals* globals, XWTimerReason why ) -{ - XP_Bool draw = XP_FALSE; - TimerData* timer = &globals->timerData[why]; - XWTimerProc proc = timer->proc; - - if ( !!proc ) { - timer->proc = NULL; - draw = (*proc)( timer->closure, why ); - /* Setting draw after firing timer allows scrolling to happen - while pen is held down. This is a hack. Perhaps having - the timer proc return whether drawing is needed would be - more consistent. */ - } else { - XP_LOGF( "skipped timer; alread fired?" ); - } - return draw; -} /* ceFireTimer */ - -/* WM_TIMER messages are low-priority. Hold a key down and key events will - * crowd it out of the queue so that the app doesn't see it until the key is - * released. There are more reliable timers, but they seem to require - * advanced techniques like semaphores. At least one article recommends - * polling over going to those lengths. This is better that polling. I hope - * it's enough. - */ -static XP_Bool -checkFireLateKeyTimer( CEAppGlobals* globals ) -{ - XP_Bool drop = XP_FALSE; - XWTimerReason why; - XP_U32 now = GetCurrentTime(); - - for ( why = 1; why < NUM_TIMERS_PLUS_ONE; ++why ) { - TimerData* timer = &globals->timerData[why]; - if ( !!timer->proc && now >= timer->when ) { - (void)ceFireTimer( globals, why ); - drop = XP_TRUE; - } - } - - return drop; -} /* checkFireLateKeyTimer */ - -static XP_Bool -checkPenDown( CEAppGlobals* globals ) -{ - XP_Bool draw = globals->penDown; - if ( draw ) { - draw = board_handlePenUp( globals->game.board, 0x7FFF, 0x7FFF ); - globals->penDown = XP_FALSE; - } - return draw; -} /* checkPenDown */ - -#ifdef KEYBOARD_NAV - -static XP_Bool -ceCheckHandleFocusKey( CEAppGlobals* globals, WPARAM wParam, LPARAM lParam, - XP_Bool keyDown, XP_Bool* handledP ) -{ - XP_Bool draw = XP_FALSE; - - /* Sometimes, e.g. after a menu is released, we get KEY_UP not preceeded - by KEY_DOWN. Just drop those. */ - if ( !keyDown && !globals->keyDown ) { - /* drop key; don't log as it happens all the time */ - } else { - XP_Bool isRepeat = keyDown && ((HIWORD(lParam) & KF_REPEAT) != 0); - XP_Key key; - XP_S16 incr = 0; - - switch ( wParam ) { - case VK_UP: - key = XP_CURSOR_KEY_UP; - incr = -1; - break; - case VK_RIGHT: - key = XP_CURSOR_KEY_RIGHT; - incr = 1; - break; - case VK_DOWN: - key = XP_CURSOR_KEY_DOWN; - incr = 1; - break; - case VK_LEFT: - key = XP_CURSOR_KEY_LEFT; - incr = -1; - break; - case 0x0d: - case 0x5d: /* center key on WinMo5 Treo (at least) -- but also ']'*/ - case VK_HOME: - key = XP_RETURN_KEY; - if ( isRepeat ) { - (void)checkFireLateKeyTimer( globals ); - } - break; - - /* Still need to produce these somehow */ - /* XP_CURSOR_KEY_ALTRIGHT, */ - /* XP_CURSOR_KEY_ALTUP, */ - /* XP_CURSOR_KEY_ALTLEFT, */ - /* XP_CURSOR_KEY_ALTDOWN, */ - - default: - key = XP_KEY_NONE; - break; - } - - if ( key != XP_KEY_NONE ) { - BoardCtxt* board = globals->game.board; - - if ( isRepeat ) { - draw = board_handleKeyRepeat( board, key, handledP ); - } else if ( keyDown ) { - draw = board_handleKeyDown( board, key, handledP ); - } else { - draw = board_handleKeyUp( board, key, handledP ); - } - - if ( !*handledP && incr != 0 && !keyDown ) { - BoardObjectType orderScroll[] = { - OBJ_SCORE, OBJ_BOARD, OBJ_NONE, OBJ_TRAY }; - BoardObjectType orderNoScroll[] = { - OBJ_SCORE, OBJ_BOARD, OBJ_TRAY }; - BoardObjectType* order; - XP_U16 orderLen; - BoardObjectType cur = board_getFocusOwner( board ); - XP_U16 index = 0; - - if ( !!globals->scrollHandle ) { - order = orderScroll; - orderLen = VSIZE(orderScroll); - } else { - order = orderNoScroll; - orderLen = VSIZE(orderNoScroll); - } - - if ( !!globals->scrollHandle || (cur != OBJ_NONE) ) { - for ( ; ; ) { - if ( order[index] == cur ) { - break; - } - ++index; - XP_ASSERT( index < orderLen ); - } - index = (index + orderLen + incr) % orderLen; - } - draw = board_focusChanged( board, order[index], XP_TRUE ); - - if ( !!globals->scrollHandle ) { - XP_Bool scrollerHasFocus = globals->scrollerHasFocus; - if ( order[index] == OBJ_NONE ) { - XP_ASSERT( !scrollerHasFocus ); - SetFocus( globals->scrollHandle ); - scrollerHasFocus = XP_TRUE; - } else if ( scrollerHasFocus ) { - SetFocus( globals->hWnd ); - scrollerHasFocus = XP_FALSE; - } - if ( scrollerHasFocus != globals->scrollerHasFocus ) { - globals->scrollerHasFocus = scrollerHasFocus; -#ifdef _WIN32_WCE - InvalidateRect( globals->hWnd, &globals->scrollRects[0], FALSE ); - InvalidateRect( globals->hWnd, &globals->scrollRects[1], FALSE ); -#else - InvalidateRect( globals->scrollHandle, NULL, FALSE ); -#endif - } - } - } - } - } - globals->keyDown = keyDown; - return draw; -} /* ceCheckHandleFocusKey */ -#endif /* KEYBOARD_NAV */ - -static void -ceToggleFullScreen( CEAppGlobals* globals ) -{ - globals->appPrefs.fullScreen = !globals->appPrefs.fullScreen; - - (void)ceSizeIfFullscreen( globals, globals->hWnd ); - - (void)cePositionBoard( globals ); -} /* ceToggleFullScreen */ - -static void -doAbout( CEAppGlobals* globals ) -{ - wchar_t buf[1024]; - (void)LoadString( globals->locInst, (UINT)IDS_ABOUT, buf, VSIZE(buf) ); - assertOnTop( globals->hWnd ); - MessageBox( globals->hWnd, buf, ceGetResStringL( globals, IDS_ABOUT_L ), - MB_OK | MB_ICONINFORMATION ); -} - -#ifdef _WIN32_WCE -static void -connEvtAndError( CEAppGlobals* globals, WPARAM wParam ) -{ - ConnMgrErr userErr; - ce_connmgr_event( globals->socketWrap, wParam, &userErr ); - switch( userErr ) { - case CONN_ERR_NONE: - break; - case CONN_ERR_PHONE_OFF: - ceOopsId( globals, IDS_PHONE_OFF, SAB_PHONEOFF ); - break; - case CONN_ERR_NONET: - ceOopsId( globals, IDS_NETWORK_FAILED, SAB_NETFAILED ); - break; - } -} -#endif - -LRESULT CALLBACK -WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - LRESULT result = 0; - int wmId; - XP_Bool draw = XP_FALSE; - XWTimerReason why; - CEAppGlobals* globals; - XP_Bool handled = XP_FALSE; - XP_Bool callDefault = XP_FALSE; - - if ( message == WM_CREATE ) { - globals = ((CREATESTRUCT*)lParam)->lpCreateParams; - SetWindowLongPtr( hWnd, GWL_USERDATA, (long)globals ); -#ifdef _WIN32_WCE - globals->hwndCB = makeCommandBar( hWnd, globals->locInst ); -#endif - -#ifdef _WIN32_WCE - globals->sai.cbSize = sizeof(globals->sai); -#endif - } else { -/* XP_LOGF( "%s: event=%s (%d)", __func__, messageToStr(message), message ); */ - globals = (CEAppGlobals*)GetWindowLongPtr( hWnd, GWL_USERDATA ); - - switch (message) { - -#ifdef _WIN32_WCE - case WM_ACTIVATE: - // Notify shell of our activate message - SHHandleWMActivate( hWnd, wParam, lParam, &globals->sai, FALSE ); - if ( !!globals && !!globals->game.board ) { - if ( ceSizeIfFullscreen( globals, globals->hWnd ) ) { - (void)cePositionBoard( globals ); - } - } - break; - - case WM_SETTINGCHANGE: - SHHandleWMSettingChange( hWnd, wParam, lParam, &globals->sai ); - if ( !!globals && !!globals->game.model ) { - cePositionBoard( globals ); - board_invalAll( globals->game.board ); - draw = XP_TRUE; - } - break; -#endif - -#ifdef CEFEATURE_CANSCROLL -# ifndef _WIN32_WCE - /* WM_CTLCOLORSCROLLBAR aren't delivered on CE. Some say can - * work around using WM_PAINT or WM_ERASEBKGND but no luck - * yet. */ - case WM_CTLCOLORSCROLLBAR: - if ( (HWND)lParam == globals->scrollHandle ) { - if ( globals->scrollerHasFocus ) { - return (LRESULT)ce_draw_getFocusBrush( globals->draw ); - } - } - break; -# endif - case WM_VSCROLL: - draw = checkPenDown( globals ); - draw = handleScroll( globals, (short int)HIWORD(wParam), - (short int)LOWORD(wParam), - (HWND)lParam ) || draw; - break; -#endif - - case WM_COMMAND: - (void)checkPenDown( globals ); - wmId = LOWORD(wParam); - - // Parse the menu selections: - switch (wmId) { - case ID_FILE_ABOUT: - doAbout( globals ); - break; - - case ID_GAME_GAMEINFO: { - GInfoResults results; - CePrefsPrefs prefsPrefs; - XP_UCHAR dictName[CE_MAX_PATH_LEN+1]; - - if ( WrapGameInfoDialog( globals, GI_INFO_ONLY, &prefsPrefs, - dictName, VSIZE(dictName), - &results ) ) { - if ( results.prefsChanged ) { - updateForColors( globals ); - } - if ( results.langChanged ) { - ceWarnLangChange( globals ); - } - draw = server_do( globals->game.server ); - } - } - break; - - case ID_FILE_NEWGAME: - XP_LOGF( "ID_FILE_NEWGAME" ); - if ( ceSaveCurGame( globals, XP_FALSE ) - || queryBoxChar( globals, hWnd, - ceGetResString( globals, - IDS_OVERWRITE ) ) ) { - draw = ceDoNewGame( globals, GI_NEW_GAME ); - } - break; - - case ID_FILE_SAVEDGAMES: - ceChooseAndOpen( globals ); - break; - - case ID_FILE_PREFERENCES: - ceDoPrefsDlg( globals ); - break; - case ID_FILE_FULLSCREEN: - ceToggleFullScreen( globals ); - break; - case ID_GAME_FINALSCORES: - if ( server_getGameIsOver( globals->game.server ) ) { - ceDisplayFinalScores( globals ); - } else if ( queryBoxChar( globals, hWnd, - ceGetResString( globals, - IDS_ENDNOW ) ) ) { - server_endGame( globals->game.server ); - draw = TRUE; - } - break; - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - case ID_GAME_RESENDMSGS: - if ( !!globals->game.comms ) { - (void)comms_resendAll( globals->game.comms ); - } else { - ceOopsId( globals, IDS_RESEND_STANDALONE, SAB_NONE ); - } - break; -#endif - case ID_GAME_TILECOUNTSANDVALUES: - ceCountsAndValues( globals ); - break; - - case ID_GAME_TILESLEFT: - ceTilesLeft( globals ); - break; - - case ID_GAME_HISTORY: - ceDoHistory( globals ); - break; - - case ID_MOVE_TRADE: - draw = handleTradeCmd( globals ); - break; - case ID_MOVE_JUGGLE: - draw = handleJuggleCmd( globals ); - break; - - case ID_MOVE_HIDETRAY: - draw = handleHidetrayCmd( globals ); - break; - case ID_MOVE_TURNDONE: - draw = handleDoneCmd( globals); - break; - - case ID_MOVE_FLIP: - draw = board_flip( globals->game.board ); - ceCheckMenus( globals ); - break; - case ID_MOVE_VALUES: - draw = board_toggle_showValues( globals->game.board ); - ceSetLeftSoftkey( globals, ID_MOVE_VALUES ); - ceCheckMenus( globals ); - break; - - case ID_MOVE_HINT: -#ifdef XWFEATURE_SEARCHLIMIT - case ID_MOVE_LIMITEDHINT: - globals->askTrayLimits = wmId == ID_MOVE_LIMITEDHINT; -#endif - board_resetEngine( globals->game.board ); - /* fallthru */ - case ID_MOVE_NEXTHINT: - case ID_MOVE_PREVHINT: - draw = ceHandleHintRequest( globals, wmId ); - break; - - case ID_FILE_EXIT: - ceSaveAndExit( globals ); /* autosaves; no user interaction */ - break; - - case ID_MOVE_UNDOCURRENT: - draw = board_replaceTiles( globals->game.board ); - break; - - case ID_MOVE_UNDOLAST: - draw = server_handleUndo( globals->game.server ); - ceSetLeftSoftkey( globals, ID_MOVE_UNDOLAST ); - break; - - default: - callDefault = XP_TRUE; - } - break; - case WM_PAINT: - if ( !!globals ) { - RECT winrect; - if ( GetUpdateRect( hWnd, &winrect, FALSE ) ) { - if ( !!globals->game.board ) { - XP_Rect xprect; - /* When an obscuring window goes away, the update region - needs to be redrawn. This allows invalidating it. */ - - RECTtoXPR( &xprect, &winrect ); - board_invalRect( globals->game.board, &xprect ); - - XP_ASSERT( globals->hWnd == hWnd ); - drawInsidePaint( globals, &winrect ); - } - if ( !ValidateRect( hWnd, &winrect ) ) { - logLastError( "WM_PAINT:ValidateRect" ); - } - } - } - break; - - case WM_LBUTTONDOWN: - draw = checkPenDown( globals ); - globals->penDown = XP_TRUE; - draw = board_handlePenDown( globals->game.board, LOWORD(lParam), - HIWORD(lParam), &handled ) - || draw; - break; - - case WM_MOUSEMOVE: - if ( globals->penDown ) { - draw = board_handlePenMove( globals->game.board, - LOWORD(lParam), - HIWORD(lParam) ); - } - break; - - case WM_LBUTTONUP: - if ( globals->penDown ) { - draw = board_handlePenUp( globals->game.board, LOWORD(lParam), - HIWORD(lParam) ); - globals->penDown = XP_FALSE; - } - break; - -#ifdef OVERRIDE_BACKKEY - /* Make the back key mean raise focus, but only if dived. - Otherwise allow the OS to do what it wants. Which means - exit? */ - case WM_HOTKEY: - if ( (VK_TBACK == HIWORD(lParam)) && !!globals->game.board ) { - draw = board_handleKey( globals->game.board, - XP_RAISEFOCUS_KEY, &handled ); - if ( !draw && !handled - /* Hack alert. Winders sends two WM_HOTKEY events per - press of the key. (lParam isn't well documented for - this event, but likely they're down and up.) - Unfiltered, the first raises focus and the second - exits the app. Bad. So we'll only raise if the - first was not handled. Note that this may well break - on devices I haven't tested on, later, whenever. */ - && (0 == (BACK_KEY_UP_MAYBE & LOWORD(lParam))) ) { - XP_LOGF( "calling ceSaveAndExit for VK_TBACK" ); - /* I'm actually exiting the app rather than minimize. As - it stands, minimizing means that even if I relaunch - the app and quit properly I can't delete the .exe, - suggesting that the minimized guy isn't getting - reassociated when I relaunch. Until I fix that - exiting is best. - */ - ceSaveAndExit( globals ); - /* SHNavigateBack() is the right way to handle this, but - isn't available via cegcc yet. Others have suggested - this as well as ShowWindow( hWnd, SW_MINIMIZE ); - or SetWindowPos( hWnd, &CWnd::wndBottom, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); - */ - } - } - break; -#endif - -#ifdef KEYBOARD_NAV - case WM_KEYDOWN: - case WM_KEYUP: - draw = ceCheckHandleFocusKey( globals, wParam, lParam, - message==WM_KEYDOWN, &handled ); - break; -#endif - case WM_CHAR: - if ( wParam == 0x08 ) { - wParam = XP_CURSOR_KEY_DEL; -#ifdef KEYBOARD_NAV - } else if ( wParam == ' ' ) { - wParam = XP_RAISEFOCUS_KEY; -#endif - } - draw = board_handleKey( globals->game.board, wParam, &handled ) - || board_handleKey( globals->game.board, wParam - ('a'-'A'), - &handled ); - break; - - case WM_TIMER: - why = (XWTimerReason)wParam; - if ( why == TIMER_PENDOWN || why == TIMER_TIMERTICK -#if defined XWFEATURE_RELAY || defined COMMS_HEARTBEAT - || why == TIMER_COMMS -#endif - ) { - XP_ASSERT( why < NUM_TIMERS_PLUS_ONE ); - - /* Kill since they otherwise repeat, but kill before firing - as fired proc may set another. */ - (void)KillTimer( hWnd, globals->timerData[why].id ); - - draw = ceFireTimer( globals, why ); - } - break; - -#ifdef _WIN32_WCE -/* case WM_SETFOCUS: */ -/* hC = ImmGetContext( hWnd ); */ -/* globals->imeWasOpen = ImmGetOpenStatus( hC ); */ -/* ImmSetOpenStatus( hC, TRUE ); */ -/* ImmEscape( NULL, hC, IME_ESC_SET_MODE, (LPVOID)IM_SPELL ); */ -/* break; */ -/* case WM_KILLFOCUS: */ -/* ImmSetOpenStatus( hC, globals->imeWasOpen ); */ -/* break; */ - - /* The code above this point works to turn 12-key->text - translation on, but not to turn it off, so other apps wind up - with it on after Crosswords quits. The recommended code is - below, but includes constants not in the version of cegcc I'm - using. Need to look into upgrading, but that requires a lot - of changes. Post B2.... */ - -/* DWORD dwRes = SendMessage((HWND)wParam, WM_IME_REQUEST, IMR_ISIMEAWARE, 0); */ -/* hC = ImmGetContext( hWnd ); */ -/* if ( (dwRes & IMEAF_AWARE) == IMEAF_AWARE ) { */ -/* ImmEscape( NULL, hC, IME_ESC_RETAIN_MODE_ICON, (LPVOID)TRUE); */ -/* } */ -/* ImmSetOpenStatus( hC, FALSE); */ -/* } */ -/* break; */ -/* case WM_IME_REQUEST: */ -/* if ( wParam == IMR_ISIMEAWARE ) { */ -/* return IMEAF_AWARE; */ -/* } */ -/* break; */ -#endif - - case WM_DESTROY: -#ifdef _WIN32_WCE - CommandBar_Destroy(globals->hwndCB); /* supposedly not needed */ -#endif - PostQuitMessage(0); - freeGlobals( globals ); - globals = NULL; - SetWindowLongPtr( hWnd, GWL_USERDATA, 0L ); - break; - - case XWWM_TIME_RQST: - draw = server_do( globals->game.server ); - break; - - case XWWM_REM_SEL: - ceTilesLeft( globals ); - break; - - case XWWM_RELAY_REQ_NEW: - draw = ceDoNewGame( globals, GI_NEW_GAME ); - break; - - case XWWM_RELAY_REQ_CONN: - draw = ceDoNewGame( globals, GI_GOTO_CONNS ); - break; - -#ifndef XWFEATURE_STANDALONE_ONLY - case XWWM_HOSTNAME_ARRIVED: - /* drop it if we're standalone now */ - if ( !!globals->socketWrap ) { - ce_sockwrap_hostname( globals->socketWrap, wParam, lParam ); - } - break; - - case XWWM_SOCKET_EVT: - if ( !!globals->socketWrap ) { - draw = ce_sockwrap_event( globals->socketWrap, wParam, lParam ); - } - break; -#ifdef _WIN32_WCE - case XWWM_CONNMGR_EVT: - connEvtAndError( globals, wParam ); - break; -#endif -#endif - - default: - callDefault = XP_TRUE; - } - } - - if ( callDefault ) { - result = DefWindowProc(hWnd, message, wParam, lParam ); - } else if ( draw ) { - /* This is stupid. We can't just say "draw" because windoze clips - drawing to the inval rect, and the board isn't set up to tell us - what its inval rect is. So we inval everything, and then when the - WM_PAINT message comes we inval the whole board because there's a - huge inval rect. Dumb. Need to figure out how to have the - methods in cedraw.c set the clip region to encompass the object - being drawn -- taking board's word for it -- or the intersection - of that with the actual clip rgn in the case where some window's - gone away and revealed a large rect board didn't know about. That - was the source of some trouble on Palm, and CE's so fast this - works. But it's stupid. */ - RECT r = { 100, 100, 102, 102 }; - InvalidateRect( globals->hWnd, &r, FALSE /* erase */ ); - } - - return result; -} /* WndProc */ - -// Mesage handler for the About box. -LRESULT CALLBACK -ceAbout(HWND hDlg, UINT message, WPARAM wParam, LPARAM XP_UNUSED(lParam)) -{ - switch (message) { - case WM_INITDIALOG: - return TRUE; - - case WM_COMMAND: - if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) { - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - } - break; - } - return FALSE; -} /* ceAbout */ - -static XP_Bool -ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream, - const wchar_t* title, XP_U16 buttons, XP_Bool destroy ) -{ - /* It seems we want to use messagebox for everything on smartphone and - Windows, but not on PPC since it doesn't scroll and doesn't use - softkeys. Well, on Windows since there's no scrolling limit by - size */ - XP_Bool saidYes; - XP_Bool useMB; -#ifdef _WIN32_WCE - useMB = IS_SMARTPHONE(globals); -#else - useMB = stream_getSize(stream) <= 256; /* arbitrary... */ -#endif - if ( useMB ) { - int result = messageBoxStream( globals, stream, title, buttons ); - saidYes = (IDOK == result) | (IDRETRY == result) | (IDYES == result); - } else { - saidYes = WrapStrBox( globals, title, stream, buttons ); - } - - if ( destroy ) { - stream_destroy( stream ); - } - - return saidYes; -} /* ceMsgFromStream */ - -static XP_UCHAR* -ceStreamToStrBuf( MPFORMAL XWStreamCtxt* stream ) -{ - XP_U16 len = stream_getSize( stream ); - XP_UCHAR* buf = XP_MALLOC( mpool, len + 1 ); - stream_getBytes( stream, buf, len ); - buf[len] = '\0'; - - return buf; -} /* ceStreamToStrBuf */ - -static int -ceOops( CEAppGlobals* globals, const XP_UCHAR* str, SkipAlertBits bit ) -{ - return ceMessageBoxChar( globals, str, NULL, - MB_OK | MB_ICONHAND, bit ); -} - -static int -ceOopsId( CEAppGlobals* globals, XP_U16 strId, SkipAlertBits bit ) -{ - return ceOops( globals, ceGetResString( globals, strId ), bit ); -} - -static int -messageBoxStream( CEAppGlobals* globals, XWStreamCtxt* stream, - const wchar_t* title, XP_U16 buttons ) -{ - XP_UCHAR* buf = ceStreamToStrBuf( MPPARM(globals->mpool) stream ); - int result; - - result = ceMessageBoxChar( globals, buf, title, buttons, SAB_NONE ); - - XP_FREE( globals->mpool, buf ); - return result; -} /* messageBoxStream */ - -XP_Bool -queryBoxChar( CEAppGlobals* globals, HWND hWnd, const XP_UCHAR* msg ) -{ - wchar_t widebuf[128]; - XP_U16 answer; - - (void)MultiByteToWideChar( CP_UTF8, 0, msg, -1, widebuf, VSIZE(widebuf) ); - - answer = MessageBox( hWnd, widebuf, - ceGetResStringL( globals, IDS_QUESTION_L ), - MB_YESNO | MB_ICONQUESTION ); - return answer == IDOK || answer == IDYES; -} /* queryBoxChar */ - -static XP_Bool -ceQueryFromStream( CEAppGlobals* globals, XWStreamCtxt* stream ) -{ - return ceMsgFromStream( globals, stream, - ceGetResStringL( globals, IDS_QUESTION_L ), - MB_OKCANCEL | MB_ICONQUESTION, XP_FALSE ); -} /* ceQueryFromStream */ - -static void -RECTtoXPR( XP_Rect* dest, const RECT* src ) -{ - dest->top = (short)src->top; - dest->left = (short)src->left; - dest->width = (short)(src->right - src->left); - dest->height = (short)(src->bottom - src->top); -} /* RECTtoXPR */ - -void -wince_assert( XP_UCHAR* XP_UNUSED_LOG(s), int XP_UNUSED_LOG(line), - const char* XP_UNUSED_LOG(fileName), - const char* XP_UNUSED_LOG(func) ) -{ - XP_WARNF( "ASSERTION FAILED %s: %s in file %s, line %d\n", s, - func, fileName, line ); -} /* wince_assert */ - -#ifdef ENABLE_LOGGING -static void -makeTimeStamp( XP_UCHAR* timeStamp, XP_U16 XP_UNUSED_DBG(size) ) -{ - SYSTEMTIME st; - DWORD tid; - - tid = GetCurrentThreadId(); - - GetLocalTime( &st ); - sprintf( timeStamp, "<%lx>%d:%.2d:%.2d ", tid, st.wHour, st.wMinute, - st.wSecond ); - XP_ASSERT( size > strlen(timeStamp) ); -} /* makeTimeStamp */ - -void -wince_warnf(const XP_UCHAR* format, ...) -{ - XP_UCHAR buf[256]; - va_list ap; - XP_U16 slen; - - va_start( ap, format ); - vsnprintf( buf, sizeof(buf), format, ap ); - va_end(ap); - - wince_debugf( "%s", buf ); - - slen = strlen(buf)+1; - wchar_t widebuf[slen]; - - MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, buf, slen, - widebuf, slen ); - - MessageBox( NULL, widebuf, L"WARNF", MB_OK | MB_ICONHAND ); -} /* wince_warnf */ - -void -wince_debugf(const XP_UCHAR* format, ...) -{ -#ifdef XWFEATURE_RELAY - static HANDLE s_logMutex = NULL; -#endif - XP_UCHAR buf[256]; - XP_UCHAR timeStamp[32]; - XP_U16 nBytes; - XP_U32 nWritten; - HANDLE fileH; - va_list ap; - wchar_t* logFileName; - - va_start( ap, format ); - vsprintf( buf, format, ap ); - va_end(ap); - - /* Create logfile if necessary and write to it in ascii. If there are - multiple threads, protect with mutex. */ - -#ifdef XWFEATURE_RELAY - if ( s_logMutex == NULL ) { - s_logMutex = CreateMutex( NULL, FALSE, NULL ); - } - if ( WaitForSingleObject( s_logMutex, 200L ) == WAIT_OBJECT_0 ) { -#endif - makeTimeStamp(timeStamp, sizeof(timeStamp)); - -#ifdef _WIN32_WCE - logFileName = L"\\My Documents\\" LCROSSWORDS_DIR L"\\xwDbgLog.txt"; -#else - logFileName = L"xwDbgLog.txt"; -#endif - fileH = CreateFile( logFileName, - GENERIC_WRITE, 0, NULL, - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - -#ifdef _WIN32_WCE_EMULATION - strcat( buf, "\n" ); -#else - strcat( buf, XP_CR ); -#endif - SetFilePointer( fileH, 0, 0, FILE_END ); -#ifdef DEBUG_TS - nBytes = strlen( timeStamp ); - WriteFile( fileH, timeStamp, nBytes, &nWritten, NULL ); -#endif - nBytes = strlen( buf ); - WriteFile( fileH, buf, nBytes, &nWritten, NULL ); - CloseHandle( fileH ); -#ifdef XWFEATURE_RELAY - ReleaseMutex( s_logMutex ); - } -#endif -} /* wince_debugf */ -#endif /* ENABLE_LOGGING */ - -XP_U16 -wince_snprintf( XP_UCHAR* buf, XP_U16 len, const XP_UCHAR* format, ... ) -{ - va_list ap; - - va_start( ap, format ); - - _vsnprintf( buf, len, format, ap ); - - /* FormatMessage( */ - /* FORMAT_MESSAGE_FROM_STRING, */ - /* format, */ - /* 0, */ - /* 0, // Default language */ - /* (LPTSTR)buf, */ - /* len, &ap ); */ - - va_end(ap); - - return strlen(buf); -} /* wince_snprintf */ - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH -static XP_Bool -got_data_proc( XP_U8* data, XP_U16 len, void* closure ) -{ - CEAppGlobals* globals = (CEAppGlobals*)closure; - XWStreamCtxt* stream; - XP_Bool draw = XP_FALSE; - - stream = make_generic_stream( globals ); - stream_putBytes( stream, data, len ); - - XP_ASSERT( !!globals->game.comms ); - if ( comms_checkIncomingStream( globals->game.comms, stream, NULL ) ) { - draw = server_receiveMessage( globals->game.server, stream ); - } - stream_destroy( stream ); - ce_util_requestTime( &globals->util ); - - return draw; -} /* got_data_proc */ - -static void -sock_state_change( void* closure, CeConnState oldState, CeConnState newState ) -{ - CEAppGlobals* globals = (CEAppGlobals*)closure; - globals->socketState = newState; - InvalidateRect( globals->hWnd, &globals->relayStatusR, TRUE /* erase */ ); - - if ( newState < oldState ) { - comms_transportFailed( globals->game.comms ); - } -} -#endif - -#ifdef COMMS_HEARTBEAT -static void -ce_reset_proc( void* XP_UNUSED(closure) ) -{ - LOG_FUNC(); -} -#endif - -#ifndef XWFEATURE_STANDALONE_ONLY -#ifdef XWFEATURE_RELAY -static void -ce_relay_status( void* closure, CommsRelayState newState ) -{ - CEAppGlobals* globals = (CEAppGlobals*)closure; - globals->relayState = newState; - InvalidateRect( globals->hWnd, &globals->relayStatusR, TRUE /* erase */ ); -} - -static void -ce_relay_connd( void* closure, XP_UCHAR* const XP_UNUSED(room), - XP_Bool XP_UNUSED(reconnect), - XP_U16 XP_UNUSED(devOrder), /* 1 means created room, etc. */ - XP_Bool allHere, XP_U16 nMissing ) -{ - CEAppGlobals* globals = (CEAppGlobals*)closure; - XP_U16 strID = 0; - SkipAlertBits bit = SAB_NONE; - - if ( allHere ) { - strID = IDS_RELAY_ALLHERE; - bit = SAB_ALL_HERE; - } else { - DeviceRole role = globals->gameInfo.serverRole; - if ( role == SERVER_ISSERVER ) { - strID = IDS_RELAY_HOST_WAITINGD; - bit = SAB_HOST_CONND; - } else if ( nMissing > 0 ) { - strID = IDS_RELAY_GUEST_WAITINGD; - bit = SAB_CLIENT_CONND; - } else { - /* an allHere message should be coming immediately, so no - notification now. */ - } - } - - if ( 0 != strID ) { - XP_UCHAR buf[256]; - const XP_UCHAR* fmt = ceGetResString( globals, strID ); - XP_SNPRINTF( buf, VSIZE(buf), fmt, nMissing ); - ceMessageBoxChar( globals, buf, ceGetResStringL( globals, IDS_FYI_L ), - MB_OK | MB_ICONHAND, bit ); - } -} /* ce_relay_connd */ - -static void -ce_relay_error( void* closure, XWREASON relayErr ) -{ - CEAppGlobals* globals = (CEAppGlobals*)closure; - UINT evt; - - switch( relayErr ) { - case XWRELAY_ERROR_NO_ROOM: - case XWRELAY_ERROR_DUP_ROOM: - evt = XWWM_RELAY_REQ_CONN; - break; - case XWRELAY_ERROR_TOO_MANY: - evt = XWWM_RELAY_REQ_NEW; - break; - default: - evt = 0; /* silence compiler */ - XP_ASSERT(0); - } - - PostMessage( globals->hWnd, evt, 0, 0 ); -} -#endif - -static XP_S16 -ce_send_proc( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addrp, - void* closure ) -{ - XP_S16 nSent = -1; - CEAppGlobals* globals = (CEAppGlobals*)closure; - LOG_FUNC(); - if ( !globals->exiting ) { - CommsAddrRec addr; - - XP_ASSERT( !!globals->game.comms ); - - if ( !addrp ) { - comms_getAddr( globals->game.comms, &addr ); - addrp = &addr; - } - - XP_ASSERT( !!addrp ); /* firing */ - switch( addrp->conType ) { -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - case COMMS_CONN_IP_DIRECT: - break; - case COMMS_CONN_RELAY: - if ( !globals->exiting ) { - if ( !globals->socketWrap ) { - globals->socketWrap - = ce_sockwrap_new( MPPARM(globals->mpool) - globals->hWnd, - got_data_proc,sock_state_change, -#if defined _WIN32_WCE && ! defined CEGCC_DOES_CONNMGR - &globals->cmProcs, -#endif - globals ); - } - - nSent = ce_sockwrap_send( globals->socketWrap, buf, len, addrp ); - break; -#endif -#ifdef XWFEATURE_SMS - case COMMS_CONN_SMS: - nSent = ce_sms_send( globals, buf, len, addrp ); - break; -#endif - default: - XP_LOGF( "unexpected conType %d", addrp->conType ); - XP_ASSERT( 0 ); - } - } - } - return nSent; -} /* ce_send_proc */ - -static void -ce_send_on_close( XWStreamCtxt* stream, void* closure ) -{ - CEAppGlobals* globals = (CEAppGlobals*)closure; - - XP_ASSERT( !!globals->game.comms ); - comms_send( globals->game.comms, stream ); -} -#endif - -static VTableMgr* -ce_util_getVTManager( XW_UtilCtxt* uc ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - return globals->vtMgr; -} /* ce_util_getVTManager */ - -static void -ce_util_userError( XW_UtilCtxt* uc, UtilErrID id ) -{ - XP_U16 resID = 0; - SkipAlertBits sab = SAB_NONE; - - switch( id ) { - case ERR_TILES_NOT_IN_LINE: - resID = IDS_TILES_NOT_IN_LINE; - break; - case ERR_NO_EMPTIES_IN_TURN: - resID = IDS_NO_EMPTIES_IN_TURN; - break; - - case ERR_TWO_TILES_FIRST_MOVE: - resID = IDS_TWO_TILES_FIRST_MOVE; - break; - case ERR_TILES_MUST_CONTACT: - resID = IDS_TILES_MUST_CONTACT; - break; - case ERR_NOT_YOUR_TURN: - resID = IDS_NOT_YOUR_TURN; - break; - case ERR_NO_PEEK_ROBOT_TILES: - resID = IDS_NO_PEEK_ROBOT_TILES; - break; - case ERR_TOO_FEW_TILES_LEFT_TO_TRADE: - resID = IDS_TOO_FEW_TILES_LEFT_TO_TRADE; - break; - case ERR_NO_EMPTY_TRADE: - resID = IDS_NO_EMPTY_TRADE; - break; - case ERR_CANT_UNDO_TILEASSIGN: - resID = IDS_CANT_UNDO_TILEASSIGN; - break; - - case ERR_CANT_HINT_WHILE_DISABLED: - resID = IDS_CANT_HINT_WHILE_DISABLED; - break; - -#ifndef XWFEATURE_STANDALONE_ONLY - case ERR_NO_PEEK_REMOTE_TILES: - resID = IDS_NO_PEEK_REMOTE_TILES; - break; - case ERR_REG_UNEXPECTED_USER: - resID = IDS_REG_UNEXPECTED_USER; - break; - case ERR_SERVER_DICT_WINS: - resID = IDS_SERVER_DICT_WINS; - break; - case ERR_REG_SERVER_SANS_REMOTE: - resID = IDS_REG_SERVER_SANS_REMOTE; - break; -#endif - -#ifdef XWFEATURE_RELAY - case ERR_RELAY_BASE + XWRELAY_ERROR_OLDFLAGS: - resID = IDS_XWRELAY_RELAY_INCOMPAT; - break; - case ERR_RELAY_BASE + XWRELAY_ERROR_TIMEOUT: - resID = IDS_XWRELAY_ERROR_TIMEOUT; - break; - case ERR_RELAY_BASE + XWRELAY_ERROR_HEART_YOU: - sab = SAB_HEART_YOU; - resID = IDS_ERROR_HEART_YOU; - break; - case ERR_RELAY_BASE + XWRELAY_ERROR_HEART_OTHER: - case ERR_RELAY_BASE + XWRELAY_ERROR_LOST_OTHER: - case ERR_RELAY_BASE + XWRELAY_ERROR_OTHER_DISCON: - sab = SAB_HEART_OTHER; - resID = IDS_XWRELAY_ERROR_HEART_OTHER; - break; - - case ERR_RELAY_BASE + XWRELAY_ERROR_NO_ROOM: - resID = IDS_ERROR_NO_ROOM; - break; - case ERR_RELAY_BASE + XWRELAY_ERROR_DUP_ROOM: - resID = IDS_ERROR_DUP_ROOM; - break; - case ERR_RELAY_BASE + XWRELAY_ERROR_TOO_MANY: - resID = IDS_ERROR_TOO_MANY; - break; - - /* Same string as above for now */ -/* resID = IDS_XWRELAY_ERROR_LOST_OTHER; */ -/* break; */ -#endif - - default: - XP_WARNF( "unknown error code: %d", id ); - break; - } - - if ( 0 != resID ) { - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - ceOopsId( globals, resID, sab ); - } -} /* ce_util_userError */ - -static XP_Bool -ce_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - - switch( id ) { - case QUERY_COMMIT_TURN: - return ceQueryFromStream( globals, stream ); - - /* case QUERY_COMMIT_TRADE: */ - /* query = ceGetResString( globals, IDS_QUERY_TRADE ); */ - /* assertOnTop( globals->hWnd ); */ - /* return queryBoxChar( globals, globals->hWnd, query ); */ - - /* case QUERY_ROBOT_MOVE: */ - /* return ceMsgFromStream( globals, stream, */ - /* ceGetResStringL( globals, IDS_FYI_L), */ - /* MB_OK | MB_ICONINFORMATION, XP_FALSE ); */ - - case QUERY_ROBOT_TRADE: - messageBoxStream( globals, stream, - ceGetResStringL( globals, IDS_FYI_L), - MB_OK | MB_ICONINFORMATION); - break; - - default: - XP_ASSERT(0); - } - - return XP_FALSE; -} /* ce_util_userQuery */ - -static XP_Bool -ce_util_confirmTrade( XW_UtilCtxt* uc, const XP_UCHAR** XP_UNUSED(tiles), - XP_U16 XP_UNUSED(nTiles) ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - const XP_UCHAR* query = ceGetResString( globals, IDS_QUERY_TRADE ); - assertOnTop( globals->hWnd ); - return queryBoxChar( globals, globals->hWnd, query ); -} - -static XWBonusType -ce_util_getSquareBonus( XW_UtilCtxt* uc, XP_U16 XP_UNUSED(boardSize), - XP_U16 col, XP_U16 row ) -{ - XWBonusType result = BONUS_NONE; - XP_U16 index; - - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - - if ( !globals->bonusInfo ) { - HRSRC rsrcH; - HGLOBAL globH; - - rsrcH = FindResource( globals->hInst, MAKEINTRESOURCE(ID_BONUS_RES), - TEXT("BONS") ); - if ( !!rsrcH ) { - globH = LoadResource( globals->hInst, rsrcH ); - - if ( !!globH ) { - globals->bonusInfo = (XP_U16*)globH; - /* We don't want to call DeleteObject here, but should when - the app closes. Or does Wince free up all memory - associated with a process when it closes? PENDING(eeh) */ - // DeleteObject( globH ); - } - } - } - - if ( col > 7 ) col = 14 - col; - if ( row > 7 ) row = 14 - row; - index = (row*8) + col; - - if ( !globals->bonusInfo || (index >= 8*8) ) { - XP_ASSERT( 0 ); - } else { - /* This is probably a bit slow. Consider caching the resource in - memory with one bonus value per byte. */ - XP_U16 value = globals->bonusInfo[index/4]; - value >>= ((3 - (index % 4)) * 4); - result = value & 0x0F; - } - return result; -} /* ce_util_getSquareBonus */ - -static XP_S16 -ce_util_userPickTileBlank( XW_UtilCtxt* uc, XP_U16 playerNum, - const XP_UCHAR** tileFaces, XP_U16 nTiles ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - return WrapBlankDlg( globals, NULL, playerNum, tileFaces, nTiles ); -} /* ce_util_userPickTile */ - -static XP_S16 -ce_util_userPickTileTray( XW_UtilCtxt* uc, const PickInfo* pi, XP_U16 playerNum, - const XP_UCHAR** tileFaces, XP_U16 nTiles ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - return WrapBlankDlg( globals, pi, playerNum, tileFaces, nTiles ); -} /* ce_util_userPickTile */ - -static XP_Bool -ce_util_askPassword( XW_UtilCtxt* uc, const XP_UCHAR* name, - XP_UCHAR* buf, XP_U16* len ) -{ - PasswdDialogState state; - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - XP_MEMSET( &state, 0, sizeof(state) ); - - state.dlgHdr.globals = globals; - state.name = name; - state.buf = buf; - state.lenp = len; - - assertOnTop( globals->hWnd ); - DialogBoxParam( globals->locInst, (LPCTSTR)IDD_ASKPASS, globals->hWnd, - (DLGPROC)PasswdDlg, (long)&state ); - - return !state.userCancelled; -} /* ce_util_askPassword */ - -static void -ce_util_trayHiddenChange( XW_UtilCtxt* uc, XW_TrayVisState XP_UNUSED(newState), - XP_U16 nVisibleRows ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - XP_U16 nHiddenRows; - -#ifdef CEFEATURE_CANSCROLL - /* If there's a scrollbar, hide/show it. It wants to be - active/visible only when the tray is NOT hidden */ - - if ( !!globals->scrollHandle ) { - nHiddenRows = model_numRows( globals->game.model ) - nVisibleRows; - updateScrollInfo( globals, nHiddenRows ); - } -#endif - ceCheckMenus( globals ); - drawInsidePaint( globals, NULL ); -} /* ce_util_trayHiddenChange */ - -static void -ce_util_yOffsetChange( XW_UtilCtxt* uc, XP_U16 XP_UNUSED(maxOffset), - XP_U16 XP_UNUSED(oldOffset), XP_U16 newOffset ) -{ -#ifdef CEFEATURE_CANSCROLL - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - if ( !!globals->scrollHandle ) { - (void)SetScrollPos( globals->scrollHandle, SB_CTL, newOffset, XP_TRUE ); - } -#endif -} /* ce_util_yOffsetChange */ - -static void -ce_util_turnChanged( XW_UtilCtxt* uc ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - ceSetLeftSoftkey( globals, ID_MOVE_TURNDONE ); -} - -static void -ce_util_notifyGameOver( XW_UtilCtxt* uc ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - drawInsidePaint( globals, NULL ); - ceDisplayFinalScores( globals ); - - ceSetLeftSoftkey( globals, ID_FILE_NEWGAME ); -} /* ce_util_notifyGameOver */ - - -static void -ce_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl, XWStreamCtxt* words ) -{ - XP_USE( uc ); - XP_USE( expl ); - XP_USE( words ); - LOG_FUNC(); -} - -static XP_Bool -ce_util_hiliteCell( XW_UtilCtxt* XP_UNUSED(uc), XP_U16 XP_UNUSED(col), - XP_U16 XP_UNUSED(row) ) -{ - return XP_TRUE; -} /* ce_util_hiliteCell */ - -static XP_Bool -ce_util_engineProgressCallback( XW_UtilCtxt* XP_UNUSED(uc) ) -{ - return XP_TRUE; -} /* ce_util_engineProgressCallback */ - -static void -ce_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why, - XP_U16 XP_UNUSED_STANDALONE(when), XWTimerProc proc, - void* closure ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - XP_U32 timerID; - XP_U32 howLong; - TimerData* timer = &globals->timerData[why]; - - XP_ASSERT( why < NUM_TIMERS_PLUS_ONE ); - timer->proc = proc; - timer->closure = closure; - - switch ( why ) { - case TIMER_PENDOWN: - howLong = 400; - break; - case TIMER_TIMERTICK: - howLong = 1000; /* 1 second */ - break; -#if defined XWFEATURE_RELAY || defined COMMS_HEARTBEAT - case TIMER_COMMS: - howLong = when * 1000; - break; -#endif - default: - XP_ASSERT(0); - return; - } - - timer->when = GetCurrentTime() + howLong; - - timerID = SetTimer( globals->hWnd, why, howLong, NULL); - - timer->id = timerID; -} /* ce_util_setTimer */ - -static void -ce_util_clearTimer( XW_UtilCtxt* uc, XWTimerReason why ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - TimerData* timer = &globals->timerData[why]; - if ( !!timer->proc ) { - timer->proc = NULL; - KillTimer( globals->hWnd, timer->id ); - } -} - -static XP_Bool -ce_util_altKeyDown( XW_UtilCtxt* XP_UNUSED(uc) ) -{ - return GetKeyState(VK_LSHIFT) < 0 - || GetKeyState(VK_RSHIFT) < 0; -} - -static void -ce_util_requestTime( XW_UtilCtxt* uc ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - - PostMessage( globals->hWnd, XWWM_TIME_RQST, 0, 0 ); -} /* palm_util_requestTime */ - -static XP_U32 -ce_util_getCurSeconds( XW_UtilCtxt* XP_UNUSED(uc) ) -{ - /* This function is never called! */ - XP_U32 ticks = GetCurrentTime(); - ticks /= 1000; - LOG_RETURNF( "%ld", ticks ); - return ticks; -/* return 0L; */ -} /* ce_util_getCurSeconds */ - -static DictionaryCtxt* -ce_util_makeEmptyDict( XW_UtilCtxt* uc ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; -#ifdef STUBBED_DICT - return make_stubbed_dict( MPPARM_NOCOMMA(globals->mpool) ); -#else - return ce_dictionary_make_empty( globals ); -#endif -} /* ce_util_makeEmptyDict */ - -#ifdef XWFEATURE_RELAY -static XWStreamCtxt* -ce_util_makeStreamFromAddr( XW_UtilCtxt* uc, XP_PlayerAddr channelNo ) -{ - XWStreamCtxt* stream; - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - - stream = make_generic_stream( globals ); - stream_setOnCloseProc( stream, ce_send_on_close ); - stream_setAddress( stream, channelNo ); - - return stream; -} /* ce_util_makeStreamFromAddr */ -#endif - -static const XP_UCHAR* -ce_util_getUserString( XW_UtilCtxt* uc, XP_U16 stringCode ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - XP_U16 resID = 0; - const XP_UCHAR* result = NULL; - - switch( stringCode ) { - case STRD_REMAINING_TILES_ADD: - resID = IDS_REMAINING_TILES_ADD; - break; - case STRD_UNUSED_TILES_SUB: - resID = IDS_UNUSED_TILES_SUB; - break; - case STR_BONUS_ALL: - resID = IDS_BONUS_ALL; - break; - case STRD_TURN_SCORE: - resID = IDS_TURN_SCORE; - break; - case STR_COMMIT_CONFIRM: - resID = IDS_COMMIT_CONFIRM; - break; - case STR_LOCAL_NAME: - resID = IDS_LOCAL_NAME; - break; - case STR_NONLOCAL_NAME: - resID = IDS_NONLOCAL_NAME; - break; - case STRD_TIME_PENALTY_SUB: - resID = IDS_TIME_PENALTY_SUB; - break; - - case STRD_CUMULATIVE_SCORE: - resID = IDS_CUMULATIVE_SCORE; - break; - case STRS_MOVE_ACROSS: - resID = IDS_MOVE_ACROSS; - break; - case STRS_MOVE_DOWN: - resID = IDS_MOVE_DOWN; - break; - case STRS_TRAY_AT_START: - resID = IDS_TRAY_AT_START; - break; - - case STRS_NEW_TILES: - resID = IDS_NEW_TILES; - break; - case STRSS_TRADED_FOR: - resID = IDS_TRADED_FOR; - break; - case STR_PASS: - resID = IDS_PASS; - break; - case STR_PHONY_REJECTED: - resID = IDS_PHONY_REJECTED; - break; - - case STRD_ROBOT_TRADED: - resID = IDS_ROBOT_TRADED; - break; - case STR_ROBOT_MOVED: - resID = IDS_ROBOT_MOVED; - break; - - case STRS_REMOTE_MOVED: - resID = IDS_REMOTE_MOVEDF; - break; - - case STR_PASSED: - resID = IDS_PASSED; - break; - case STRSD_SUMMARYSCORED: - resID = IDS_SUMMARYSCORED; - break; - case STRD_TRADED: - resID = IDS_TRADED; - break; - case STR_LOSTTURN: - resID = IDS_LOSTTURN; - break; - -#ifndef XWFEATURE_STANDALONE_ONLY - case STR_LOCALPLAYERS: - resID = IDS_LOCALPLAYERS; - break; -#endif - case STR_TOTALPLAYERS: - resID = IDS_TOTALPLAYERS; - break; - - case STRS_VALUES_HEADER: - resID = IDS_VALUES_HEADER; - break; - - default: - XP_WARNF( "id for stringCode %d not found", stringCode ); - break; - } - - if ( 0 != resID ) { - result = ceGetResString( globals, resID ); - } else { - XP_WARNF( "%s: no resource for id %d", __func__, stringCode ); - result = ""; - } - return result; -} /* ce_util_getUserString */ - -static void -ce_formatBadWords( BadWordInfo* bwi, XP_UCHAR buf[], XP_U16 bufsiz ) -{ - XP_U16 i; - - for ( i = 0, buf[0] = '\0'; ; ) { - XP_UCHAR wordBuf[24]; - sprintf( wordBuf, "\"%s\"", bwi->words[i] ); - XP_ASSERT( strlen(wordBuf) < sizeof(wordBuf)-1 ); - strncat( buf, wordBuf, bufsiz - 1 ); - if ( ++i == bwi->nWords ) { - break; - } - bufsiz -= strlen( wordBuf ); - strncat( buf, ", ", bufsiz - 1 ); - bufsiz -= 2; - } -} /* ce_formatBadWords */ - -static XP_Bool -ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, - XP_U16 XP_UNUSED(turn), XP_Bool turnLost ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - XP_UCHAR wordsBuf[256]; - XP_UCHAR msgBuf[256]; - const XP_UCHAR* fmt; - XP_Bool isOk; - - ce_formatBadWords( bwi, wordsBuf, sizeof(wordsBuf) ); - fmt = ceGetResString( globals, IDS_WRDNOTFOUND ); - snprintf( msgBuf, VSIZE(msgBuf), fmt, wordsBuf ); - - if ( turnLost ) { - ceMessageBoxChar( globals, msgBuf, - ceGetResStringL( globals, IDS_ILLEGALWRD_L ), - MB_OK | MB_ICONHAND, SAB_NONE ); - isOk = XP_TRUE; - } else { - const XP_UCHAR* str = ceGetResString( globals, IDS_USEANYWAY ); - XP_U16 len = strlen( msgBuf ); - XP_SNPRINTF( &msgBuf[len], VSIZE(msgBuf)-len, " %s", str ); - assertOnTop( globals->hWnd ); - isOk = queryBoxChar( globals, globals->hWnd, msgBuf ); - } - - return isOk; -} /* ce_util_warnIllegalWord */ - -static void -ce_util_remSelected( XW_UtilCtxt* uc ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - PostMessage( globals->hWnd, XWWM_REM_SEL, 0, 0 ); -} - -#ifndef XWFEATURE_STANDALONE_ONLY -static void -ce_util_addrChange( XW_UtilCtxt* uc, - const CommsAddrRec* XP_UNUSED_DBG(oldAddr), - const CommsAddrRec* newAddr ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - - XP_LOGF( "%s: old: %s -> new: %s", __func__, - ConnType2Str( oldAddr->conType ), - ConnType2Str( newAddr->conType ) ); - - /* A lot more needs to be tested for and done here... */ - if ( COMMS_CONN_NONE == newAddr->conType ) { - if ( !!globals->socketWrap ) { - ce_sockwrap_delete( globals->socketWrap ); - globals->socketWrap = NULL; - } - } -} /* ce_util_addrChange */ -#endif - -#ifdef XWFEATURE_SEARCHLIMIT -static XP_Bool -ce_util_getTraySearchLimits( XW_UtilCtxt* uc, XP_U16* min, XP_U16* max ) -{ - CEAppGlobals* globals = (CEAppGlobals*)uc->closure; - HintLimitsState hls; - - XP_MEMSET( &hls, 0, sizeof(hls) ); - - hls.dlgHdr.globals = globals; - hls.min = *min; - hls.max = *max; - - assertOnTop( globals->hWnd ); - DialogBoxParam( globals->locInst, (LPCTSTR)IDD_ASKHINTLIMTS, globals->hWnd, - (DLGPROC)HintLimitsDlg, (long)&hls ); - - if ( !hls.cancelled ) { - *min = hls.min; - *max = hls.max; - } - - return !hls.cancelled; -} /* ce_util_getTraySearchLimits */ -#endif - -#ifdef SHOW_PROGRESS -blah blah -- these are not in use -static void -ce_util_engineStarting( XW_UtilCtxt* uc ) -{ -} /* ce_util_engineStarting */ - -static void -ce_util_engineStopping( XW_UtilCtxt* uc ) -{ -} /* ce_util_engineStopping */ -#endif diff --git a/xwords4/wince/cemain.h b/xwords4/wince/cemain.h deleted file mode 100755 index e81e31e54..000000000 --- a/xwords4/wince/cemain.h +++ /dev/null @@ -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 -#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_ */ diff --git a/xwords4/wince/ceprefs.c b/xwords4/wince/ceprefs.c deleted file mode 100755 index f261284c5..000000000 --- a/xwords4/wince/ceprefs.c +++ /dev/null @@ -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 - -#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 */ diff --git a/xwords4/wince/ceprefs.h b/xwords4/wince/ceprefs.h deleted file mode 100755 index cb4141136..000000000 --- a/xwords4/wince/ceprefs.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/ceresstr.c b/xwords4/wince/ceresstr.c deleted file mode 100644 index 44fb3acf3..000000000 --- a/xwords4/wince/ceresstr.c +++ /dev/null @@ -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; -} diff --git a/xwords4/wince/ceresstr.h b/xwords4/wince/ceresstr.h deleted file mode 100644 index 1ae7c1e89..000000000 --- a/xwords4/wince/ceresstr.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/cesms.c b/xwords4/wince/cesms.c deleted file mode 100644 index e1055658b..000000000 --- a/xwords4/wince/cesms.c +++ /dev/null @@ -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 diff --git a/xwords4/wince/cesms.h b/xwords4/wince/cesms.h deleted file mode 100644 index cf7a3167e..000000000 --- a/xwords4/wince/cesms.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/cesockwr.c b/xwords4/wince/cesockwr.c deleted file mode 100755 index c0fd91b24..000000000 --- a/xwords4/wince/cesockwr.c +++ /dev/null @@ -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 -#include - -#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 ""; -} -#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 diff --git a/xwords4/wince/cesockwr.h b/xwords4/wince/cesockwr.h deleted file mode 100755 index eb8147237..000000000 --- a/xwords4/wince/cesockwr.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/cestrbx.c b/xwords4/wince/cestrbx.c deleted file mode 100755 index b55a73efd..000000000 --- a/xwords4/wince/cestrbx.c +++ /dev/null @@ -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 - -#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; -} diff --git a/xwords4/wince/cestrbx.h b/xwords4/wince/cestrbx.h deleted file mode 100755 index 59fe844f5..000000000 --- a/xwords4/wince/cestrbx.h +++ /dev/null @@ -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 ); diff --git a/xwords4/wince/cesvdgms.c b/xwords4/wince/cesvdgms.c deleted file mode 100644 index d9e432a74..000000000 --- a/xwords4/wince/cesvdgms.c +++ /dev/null @@ -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 -#include "stdafx.h" -#include -#include -#ifdef _win32_wce -#include -#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 */ diff --git a/xwords4/wince/cesvdgms.h b/xwords4/wince/cesvdgms.h deleted file mode 100644 index be3685610..000000000 --- a/xwords4/wince/cesvdgms.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/ceutil.c b/xwords4/wince/ceutil.c deleted file mode 100755 index 6f4ce8bc6..000000000 --- a/xwords4/wince/ceutil.c +++ /dev/null @@ -1,1122 +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 "stdafx.h" -#include -#include - -#include "ceutil.h" -#include "cedefines.h" -#include "cedebug.h" -#include "debhacks.h" -#include "ceresstr.h" - -#define BUF_SIZE 128 -#define VPADDING 4 -#define HPADDING_L 2 -#define HPADDING_R 3 - -static XP_Bool ceDoDlgScroll( CeDlgHdr* dlgHdr, WPARAM wParam ); -static void ceDoDlgFocusScroll( CeDlgHdr* dlgHdr, HWND nextCtrl ); -static void adjustScrollPos( HWND hDlg, XP_S16 vertChange ); - -void -ceSetDlgItemText( HWND hDlg, XP_U16 id, const XP_UCHAR* str ) -{ - wchar_t widebuf[BUF_SIZE]; - XP_U16 len, wlen; - - XP_ASSERT( str != NULL ); - - len = (XP_U16)XP_STRLEN( str ); - - if ( len >= VSIZE(widebuf) ) { - len = VSIZE(widebuf) - 1; - } - - wlen = MultiByteToWideChar( CP_UTF8, 0, str, len, widebuf, len ); - widebuf[wlen] = 0; - SendDlgItemMessage( hDlg, id, WM_SETTEXT, 0, (long)widebuf ); -} /* ceSetDlgItemText */ - -void -ceSetDlgItemFileName( HWND hDlg, XP_U16 id, XP_UCHAR* str ) -{ - XP_UCHAR* stripstart; - XP_UCHAR buf[BUF_SIZE]; - XP_U16 len = XP_STRLEN(str); - - if ( len >= BUF_SIZE ) { - len = BUF_SIZE - 1; - } - - XP_MEMCPY( buf, str, len ); - buf[len] = '\0'; - - stripstart = strrchr( (const char*)buf, '.' ); - if ( !!stripstart ) { - *stripstart = '\0'; - } - - ceSetDlgItemText( hDlg, id, buf ); -} /* ceSetDlgItemFileName */ - -void -ceGetDlgItemText( HWND hDlg, XP_U16 id, XP_UCHAR* buf, XP_U16* bLen ) -{ - XP_U16 len = *bLen; - XP_U16 gotLen; - wchar_t wbuf[BUF_SIZE]; - - XP_ASSERT( len <= BUF_SIZE ); - - gotLen = (XP_U16)SendDlgItemMessage( hDlg, id, WM_GETTEXT, len, - (long)wbuf ); - if ( gotLen > 0 ) { - XP_ASSERT( gotLen < len ); - if ( gotLen >= len ) { - gotLen = len - 1; - } - gotLen = WideCharToMultiByte( CP_ACP, 0, wbuf, gotLen, - buf, len, NULL, NULL ); - *bLen = gotLen; - buf[gotLen] = '\0'; - } else { - buf[0] = '\0'; - *bLen = 0; - } -} /* ceGetDlgItemText */ - -void -ceSetDlgItemNum( HWND hDlg, XP_U16 id, XP_S32 num ) -{ - XP_UCHAR buf[20]; - XP_SNPRINTF( buf, sizeof(buf), "%ld", num ); - ceSetDlgItemText( hDlg, id, buf ); -} /* ceSetDlgItemNum */ - -XP_S32 -ceGetDlgItemNum( HWND hDlg, XP_U16 id ) -{ - XP_S32 result = 0; - XP_UCHAR buf[24]; - XP_U16 len = sizeof(buf); - ceGetDlgItemText( hDlg, id, buf, &len ); - - result = atoi( buf ); - return result; -} /* ceGetDlgItemNum */ - -void -ceShowOrHide( HWND hDlg, XP_U16 resID, XP_Bool visible ) -{ - HWND itemH = GetDlgItem( hDlg, resID ); - if ( !!itemH ) { - ShowWindow( itemH, visible? SW_SHOW: SW_HIDE ); - } -} /* ceShowOrHide */ - -void -ceEnOrDisable( HWND hDlg, XP_U16 resID, XP_Bool enable ) -{ - HWND itemH = GetDlgItem( hDlg, resID ); - if ( !!itemH ) { - EnableWindow( itemH, enable ); - } -} /* ceShowOrHide */ - -void -ceSetChecked( HWND hDlg, XP_U16 resID, XP_Bool check ) -{ - SendDlgItemMessage( hDlg, resID, BM_SETCHECK, - check? BST_CHECKED:BST_UNCHECKED, 0L ); -} /* ceSetBoolCheck */ - -XP_Bool -ceGetChecked( HWND hDlg, XP_U16 resID ) -{ - XP_U16 checked; - checked = (XP_U16)SendDlgItemMessage( hDlg, resID, BM_GETCHECK, 0, 0L ); - return checked == BST_CHECKED; -} /* ceGetChecked */ - -/* Return dlg-relative rect. - */ -void -ceGetItemRect( HWND hDlg, XP_U16 resID, RECT* rect ) -{ - HWND itemH; - POINT pt = { .x = 0, .y = 0 }; - ScreenToClient( hDlg, &pt ); - - itemH = GetDlgItem( hDlg, resID ); - GetWindowRect( itemH, rect ); - (void)OffsetRect( rect, pt.x, pt.y ); -} /* ceGetItemRect */ - -void -ceMoveItem( HWND hDlg, XP_U16 resID, XP_S16 byX, XP_S16 byY ) -{ - RECT rect; - HWND itemH = GetDlgItem( hDlg, resID ); - ceGetItemRect( hDlg, resID, &rect ); - if ( !MoveWindow( itemH, rect.left + byX, rect.top + byY, - rect.right - rect.left, rect.bottom - rect.top, - TRUE ) ) { - XP_LOGF( "MoveWindow=>%ld", GetLastError() ); - } -} /* ceMoveItem */ - -XP_U16 -ceDistanceBetween( HWND hDlg, XP_U16 resID1, XP_U16 resID2 ) -{ - RECT rect; - ceGetItemRect( hDlg, resID1, &rect ); - XP_U16 top = rect.top; - ceGetItemRect( hDlg, resID2, &rect ); - XP_ASSERT( rect.top > top ); - return rect.top - top; -} - -#if 0 -/* This has not been tested with ceMoveItem... */ -void -ceCenterCtl( HWND hDlg, XP_U16 resID ) -{ - RECT buttonR, dlgR; - XP_U16 buttonWidth; - XP_S16 byX; - - GetClientRect( hDlg, &dlgR ); - XP_ASSERT( dlgR.left == 0 && dlgR.top == 0 ); - - ceGetItemRect( hDlg, resID, &buttonR ); - - buttonWidth = buttonR.right - buttonR.left; - byX = buttonR.left - ((dlgR.right - buttonWidth) / 2); - - ceMoveItem( hDlg, resID, byX, 0 ); -} /* ceCenterCtl */ -#endif - -/* XP_Bool */ -/* ceIsLandscape( CEAppGlobals* globals ) */ -/* { */ -/* XP_U16 width, height; */ -/* XP_Bool landscape; */ - -/* XP_ASSERT( !!globals ); */ -/* XP_ASSERT( !!globals->hWnd ); */ - -/* if ( 0 ) { */ -/* #if defined DEBUG && !defined _WIN32_WCE */ -/* } else if ( globals->dbWidth != 0 ) { */ -/* width = globals->dbWidth; */ -/* height = globals->dbHeight; */ -/* #endif */ -/* } else { */ -/* RECT rect; */ -/* GetClientRect( globals->hWnd, &rect ); */ -/* width = (XP_U16)(rect.right - rect.left); */ -/* height = (XP_U16)(rect.bottom - rect.top); */ -/* } */ - -/* landscape = (height - CE_SCORE_HEIGHT) */ -/* < (width - CE_MIN_SCORE_WIDTH); */ -/* return landscape; */ -/* } /\* ceIsLandscape *\/ */ - -#ifdef _WIN32_WCE -static XP_Bool -ceIsFullScreen( CEAppGlobals* globals, HWND hWnd ) -{ - XP_S16 screenHt; - XP_U16 winHt; - RECT rect; - - GetClientRect( hWnd, &rect ); - winHt = rect.bottom - rect.top; /* top should always be 0 */ - - screenHt = GetSystemMetrics( SM_CYSCREEN ); - XP_ASSERT( screenHt >= winHt ); - - screenHt -= winHt; - - if ( !!globals->hwndCB ) { - RECT rect; - GetWindowRect( globals->hwndCB, &rect ); - screenHt -= rect.bottom - rect.top; - } - - XP_ASSERT( screenHt >= 0 ); - return screenHt == 0; -} /* ceIsFullScreen */ - -static void -ceSize( CEAppGlobals* globals, HWND hWnd, XP_Bool fullScreen ) -{ - RECT rect; - XP_U16 cbHeight = 0; - if ( !!globals->hwndCB ) { - GetWindowRect( globals->hwndCB, &rect ); - cbHeight = rect.bottom - rect.top; - } - - /* I'm leaving the SIP/cmdbar in place until I can figure out how to - get menu events with it hidden -- and also the UI for making sure - users don't get stuck in fullscreen mode not knowing how to reach - menus to get out. Later, add SHFS_SHOWSIPBUTTON and - SHFS_HIDESIPBUTTON to the sets shown and hidden below.*/ - if ( fullScreen ) { - SHFullScreen( hWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON ); - - SetRect( &rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN) ); - - } else { - SHFullScreen( hWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON ); - SystemParametersInfo( SPI_GETWORKAREA, 0, &rect, FALSE ); - if ( IS_SMARTPHONE(globals) ) { - cbHeight = 0; - } - } - - rect.bottom -= cbHeight; - MoveWindow( hWnd, rect.left, rect.top, rect.right - rect.left, - rect.bottom - rect.top, TRUE ); -} /* ceSize */ - -XP_Bool -ceSizeIfFullscreen( CEAppGlobals* globals, HWND hWnd ) -{ - XP_Bool resized = globals->appPrefs.fullScreen - != ceIsFullScreen(globals, hWnd); - if ( resized ) { - ceSize( globals, hWnd, globals->appPrefs.fullScreen ); - } - return resized; -} - -static XP_Bool -mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg, XP_U16 curHt, - DlgStateTask doWhat ) -{ - XP_Bool success = XP_FALSE; - - SHMENUBARINFO mbi; - XP_MEMSET( &mbi, 0, sizeof(mbi) ); - mbi.cbSize = sizeof(mbi); - mbi.hwndParent = hDlg; - if ( 0 != (doWhat & DLG_STATE_DONEONLY) ) { - mbi.nToolBarId = IDM_DONE_MENUBAR; - } else if ( 0 != (doWhat & DLG_STATE_OKONLY) ) { - mbi.nToolBarId = IDM_OK_MENUBAR; - } else { - mbi.nToolBarId = IDM_OKCANCEL_MENUBAR; - } - mbi.hInstRes = globals->locInst; - success = SHCreateMenuBar( &mbi ); - if ( !success ) { - XP_LOGF( "SHCreateMenuBar failed: %ld", GetLastError() ); - } else { - - if ( IS_SMARTPHONE(globals) ) { - SHINITDLGINFO info; - XP_MEMSET( &info, 0, sizeof(info) ); - info.dwMask = SHIDIM_FLAGS; - info.dwFlags = SHIDIF_SIZEDLGFULLSCREEN; - info.hDlg = hDlg; - success = SHInitDialog( &info ); - if ( !success ) { - XP_LOGF( "SHInitDialog failed: %ld", GetLastError() ); - } - } else { - XP_U16 screenHt = GetSystemMetrics(SM_CYFULLSCREEN); - RECT rect; - GetWindowRect( mbi.hwndMB, &rect ); - screenHt -= (rect.bottom - rect.top); - if ( screenHt < curHt ) { - ceSize( globals, hDlg, XP_TRUE ); - } - } - } - - return success; -} /* mkFullscreenWithSoftkeys */ -#endif - -static void -ceCenterBy( HWND hDlg, XP_U16 byHowMuch ) -{ - HWND child; - - for ( child = GetWindow( hDlg, GW_CHILD ); - !!child; - child = GetWindow( child, GW_HWNDNEXT ) ) { - XP_S16 resID = GetDlgCtrlID( child ); - ceMoveItem( hDlg, resID, byHowMuch, 0 ); - } -} /* ceCenterBy */ - -#define MAX_DLG_ROWS 20 -typedef struct _DlgRow { - XP_U16 top, bottom; - XP_U16 nIds; - XP_U16 ids[12]; -} DlgRow; - -typedef struct _DlgRows { - DlgRow rows[MAX_DLG_ROWS]; - XP_U16 nRows; -} DlgRows; - -static void -insertId( HWND hDlg, DlgRows* rows, XP_U16 id ) -{ - RECT rect; - XP_U16 ii; - DlgRow* row; - ceGetItemRect( hDlg, id, &rect ); - - // Find an entry it fits in, or add a new one. - - for ( ii = 0; ii < MAX_DLG_ROWS; ++ii ) { - row = &rows->rows[ii]; - if ( row->bottom == 0 ) { - row->top = rect.top; - row->bottom = rect.bottom; - ++rows->nRows; - break; - } else if ( rect.top >= row->bottom ) { - /* continue */ - } else if ( rect.bottom <= row->top ) { - /* continue */ - } else { - if ( row->top < rect.top ) { - row->top = rect.top; - } - if ( row->bottom > rect.bottom ) { - row->bottom = rect.bottom; - } - break; - } - } - - XP_ASSERT( ii < VSIZE(rows->rows) ); - - row->ids[row->nIds++] = id; - XP_ASSERT( row->nIds < VSIZE(row->ids) ); -} - -static void -buildIdList( CeDlgHdr* dlgHdr ) -{ - HWND child; - XP_U16 ii, jj; - DlgRows rows; - XP_U16 nResIDsUsed; - - XP_MEMSET( &rows, 0, sizeof(rows) ); - - for ( child = GetWindow( dlgHdr->hDlg, GW_CHILD ), ii = 0; - !!child; - child = GetWindow( child, GW_HWNDNEXT ) ) { - XP_S16 resID = GetDlgCtrlID( child ); - if ( resID > 0 ) { - insertId( dlgHdr->hDlg, &rows, resID ); - } - } - - /* might need to sort first */ - nResIDsUsed = 0; - for ( ii = 0; ii < rows.nRows; ++ii ) { - DlgRow* row = &rows.rows[ii]; - for ( jj = 0; jj < row->nIds; ++jj ) { - XP_U16 id = row->ids[jj]; - dlgHdr->resIDs[nResIDsUsed++] = id; - XP_ASSERT( nResIDsUsed < dlgHdr->nResIDs ); - } - - dlgHdr->resIDs[nResIDsUsed++] = 0; - XP_ASSERT( nResIDsUsed <= dlgHdr->nResIDs ); - } - dlgHdr->nResIDsUsed = nResIDsUsed; -} - -#define TITLE_HT 20 /* Need to get this from the OS */ -void -ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat ) -{ - RECT rect; - XP_U16 fullHeight, origWidth; - CEAppGlobals* globals = dlgHdr->globals; - - dlgHdr->hDlg = hDlg; - - XP_ASSERT( !!globals ); - XP_ASSERT( !!hDlg ); - /* at most one of these two should be set */ - XP_ASSERT( (doWhat & (DLG_STATE_OKONLY|DLG_STATE_DONEONLY)) - != (DLG_STATE_OKONLY|DLG_STATE_DONEONLY)); - - GetClientRect( hDlg, &rect ); - XP_ASSERT( rect.top == 0 ); - fullHeight = rect.bottom; /* This is before we've resized it */ - origWidth = rect.right; - -#ifdef _WIN32_WCE - (void)mkFullscreenWithSoftkeys( globals, hDlg, fullHeight, doWhat); -#elif defined DEBUG - /* Force it to be small so we can test scrolling etc. */ - if ( globals->dbWidth > 0 && globals->dbHeight > 0) { - MoveWindow( hDlg, 0, 0, globals->dbWidth, globals->dbHeight, TRUE ); - rect.bottom = globals->dbHeight; - } -#endif - - /* Measure again post-resize */ - GetClientRect( hDlg, &rect ); - if ( rect.right > origWidth ) { - ceCenterBy( hDlg, (rect.right - origWidth) / 2 ); - } - - /* Set up the scrollbar if we're on PPC */ - if ( !IS_SMARTPHONE(globals) ) { - SCROLLINFO sinfo; - - XP_MEMSET( &sinfo, 0, sizeof(sinfo) ); - sinfo.cbSize = sizeof(sinfo); - - sinfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; - if ( rect.bottom < fullHeight ) { - sinfo.nMax = fullHeight; - dlgHdr->nPage = sinfo.nPage = rect.bottom - 1; - } - - (void)SetScrollInfo( hDlg, SB_VERT, &sinfo, FALSE ); - } - - if ( !!dlgHdr->resIDs ) { - buildIdList( dlgHdr ); - } - - dlgHdr->doWhat = doWhat; - -#ifdef _WIN32_WCE - /* Need to trap this for all dialogs, even if they don't have edit - controls. The need goes away if the main window stops trapping it, - but I don't understand why: trapping here is still required. */ - if ( IS_SMARTPHONE(globals) ) { - trapBackspaceKey( hDlg ); - } -#endif -} /* ceDlgSetup */ - -void -ceDlgComboShowHide( CeDlgHdr* dlgHdr, XP_U16 baseId ) -{ - HWND hDlg = dlgHdr->hDlg; - - if ( IS_SMARTPHONE(dlgHdr->globals) ) { - ceShowOrHide( hDlg, baseId+2, XP_FALSE ); - } else { - ceShowOrHide( hDlg, baseId, XP_FALSE ); - ceShowOrHide( hDlg, baseId+1, XP_FALSE ); - } -} - -#ifdef OVERRIDE_BACKKEY -static XP_Bool -editHasFocus( void ) -{ - HWND focus = GetFocus(); - wchar_t buf[32]; - XP_Bool isEdit = !!focus - && ( 0 != GetClassName( focus, buf, VSIZE(buf) ) ) - && !wcscmp( L"Edit", buf ); - return isEdit; -} /* editHasFocus */ -#endif - - -static void -scrollForMove( CeDlgHdr* dlgHdr, XP_U16 newY ) -{ - if ( dlgHdr->penDown ) { - XP_S16 vertChange = dlgHdr->prevY - newY; - dlgHdr->prevY = newY; - adjustScrollPos( dlgHdr->hDlg, vertChange ); - } -} - -XP_Bool -ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam ) -{ - XP_Bool handled = XP_FALSE; - XP_U16 hiword = HIWORD(lParam); - XP_U16 hwwp; - - switch( message ) { -#ifdef OVERRIDE_BACKKEY - case WM_HOTKEY: - if ( VK_TBACK == hiword ) { - if ( editHasFocus() ) { - SHSendBackToFocusWindow( message, wParam, lParam ); - } else if ( 0 != (BACK_KEY_UP_MAYBE & LOWORD(lParam) ) ) { - WPARAM cmd = (0 != (dlgHdr->doWhat - & (DLG_STATE_DONEONLY|DLG_STATE_OKONLY))) ? - IDOK : IDCANCEL; - SendMessage( dlgHdr->hDlg, WM_COMMAND, cmd, 0L ); - } - handled = TRUE; - } - break; -#endif - case WM_VSCROLL: - handled = ceDoDlgScroll( dlgHdr, wParam ); - break; - - case WM_LBUTTONDOWN: - dlgHdr->penDown = XP_TRUE; - dlgHdr->prevY = hiword; - handled = XP_TRUE; - break; - case WM_MOUSEMOVE: - scrollForMove( dlgHdr, hiword ); - handled = XP_TRUE; - break; - case WM_LBUTTONUP: - dlgHdr->penDown = XP_FALSE; - handled = XP_TRUE; - break; - - case WM_COMMAND: - hwwp = HIWORD(wParam); - if ( BN_SETFOCUS == hwwp || EN_SETFOCUS == hwwp ) { - ceDoDlgFocusScroll( dlgHdr, (HWND)lParam ); - /* don't set handled: dialog must handle EN_SETFOCUS! */ - } else if ( BN_KILLFOCUS == hwwp/* || EN_KILLFOCUS == hiword*/ ) { - /* dialogs shouldn't have to handle these */ - handled = TRUE; - } - break; - } - return handled; -} /* ceDoDlgHandle */ - -void -ceDlgMoveBelow( CeDlgHdr* dlgHdr, XP_U16 resID, XP_S16 distance ) -{ - XP_U16 ii; - XP_ASSERT( !!dlgHdr->resIDs ); - XP_U16 nResIDsUsed = dlgHdr->nResIDsUsed; - - for ( ii = 0; ii < nResIDsUsed; ++ii ) { - if ( dlgHdr->resIDs[ii] == resID ) { - break; - } - } - - if ( ii < nResIDsUsed ) { /* found it? */ - while ( dlgHdr->resIDs[ii] != 0 ) { /* skip to end of row */ - ++ii; - XP_ASSERT( ii < nResIDsUsed ); /* found it? */ - } - ++ii; /* skip past the 0 */ - - for ( ; ii < nResIDsUsed; ++ii ) { - XP_U16 id = dlgHdr->resIDs[ii]; - if ( 0 != id ) { - ceMoveItem( dlgHdr->hDlg, id, 0, distance ); - } - } - -#ifdef _WIN32_WCE - if ( IS_SMARTPHONE(dlgHdr->globals) ) { - SendMessage( dlgHdr->hDlg, DM_RESETSCROLL, - (WPARAM)FALSE, (LPARAM)TRUE ); - } -#endif - } else { - XP_LOGF( "%s: resID %d not found", __func__, resID ); - } - -} - -static void -setScrollPos( HWND hDlg, XP_S16 newPos ) -{ - SCROLLINFO sinfo; - XP_S16 vertChange; - - XP_MEMSET( &sinfo, 0, sizeof(sinfo) ); - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SIF_POS; - GetScrollInfo( hDlg, SB_VERT, &sinfo ); - - if ( sinfo.nPos != newPos ) { - XP_U16 oldPos = sinfo.nPos; - sinfo.nPos = newPos; - SetScrollInfo( hDlg, SB_VERT, &sinfo, XP_TRUE ); - - GetScrollInfo( hDlg, SB_VERT, &sinfo ); - vertChange = oldPos - sinfo.nPos; - if ( 0 != vertChange ) { - RECT updateR; - ScrollWindowEx( hDlg, 0, vertChange, NULL, NULL, NULL, - &updateR, SW_SCROLLCHILDREN|SW_ERASE); - InvalidateRect( hDlg, &updateR, TRUE ); - (void)UpdateWindow( hDlg ); - } - } -} /* setScrollPos */ - -static void -adjustScrollPos( HWND hDlg, XP_S16 vertChange ) -{ - if ( vertChange != 0 ) { - SCROLLINFO sinfo; - - XP_MEMSET( &sinfo, 0, sizeof(sinfo) ); - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SIF_POS; - GetScrollInfo( hDlg, SB_VERT, &sinfo ); - - setScrollPos( hDlg, sinfo.nPos + vertChange ); - } -} /* adjustScrollPos */ - -static XP_Bool -ceDoDlgScroll( CeDlgHdr* dlgHdr, WPARAM wParam ) -{ - XP_Bool handled = !IS_SMARTPHONE(dlgHdr->globals); - if ( handled ) { - XP_S16 vertChange = 0; - - switch ( LOWORD(wParam) ) { - - case SB_LINEUP: // Scrolls one line up - vertChange = -1; - break; - case SB_PAGEUP: // - vertChange = -dlgHdr->nPage; - break; - - case SB_LINEDOWN: // Scrolls one line down - vertChange = 1; - break; - case SB_PAGEDOWN: // Scrolls one page down - vertChange = dlgHdr->nPage; - break; - - case SB_THUMBTRACK: /* still dragging; don't redraw */ - case SB_THUMBPOSITION: - setScrollPos( dlgHdr->hDlg, HIWORD(wParam) ); - break; - } - - if ( 0 != vertChange ) { - adjustScrollPos( dlgHdr->hDlg, vertChange ); - } - } - return handled; -} /* ceDoDlgScroll */ - - -/* wParam */ -/* If lParam is TRUE, this parameter identifies the control that - receives the focus. If lParam is FALSE, this parameter indicates - whether the next or previous control with the WS_TABSTOP style - receives the focus. If wParam is zero, the next control receives - the focus; otherwise, the previous control with the WS_TABSTOP - style receives the focus. */ -/* lParam */ -/* The low-order word indicates how the system uses wParam. If the - low-order word is TRUE, wParam is a handle associated with the - control that receives the focus; otherwise, wParam is a flag that - indicates whether the next or previous control with the WS_TABSTOP - style receives the focus. */ - -static void -ceDoDlgFocusScroll( CeDlgHdr* dlgHdr, HWND nextCtrl ) -{ - /* Scroll the current focus owner into view. - * - * There's nothing passed in to tell us who it is, so look it up. - * - * What's in view? First, a window has a scroll position, nPos, that - * tells how many pixels are scrolled out of view above the window. Then - * a control has an offset within the containing rect (which shifts as - * it's scrolled.) Finally, all rects are relative to the screen, so we - * need to get the containing rect to figure out what the control's - * position is. - * - * The first question, which can be answered without reference to - * scrolling, is "Are we in view?" If we're not, then we need to look at - * scrolling to see how to fix it. - */ - - if ( !IS_SMARTPHONE(dlgHdr->globals) && !!nextCtrl ) { - HWND hDlg = dlgHdr->hDlg; - RECT rect; - XP_U16 dlgHeight, ctrlHeight, dlgTop; - XP_S16 ctrlPos; - - GetClientRect( hDlg, &rect ); - dlgHeight = rect.bottom - rect.top; - - GetWindowRect( hDlg, &rect ); - dlgTop = rect.top; - - GetWindowRect( nextCtrl, &rect ); - ctrlPos = rect.top - dlgTop - TITLE_HT; - ctrlHeight = rect.bottom - rect.top; - - if ( ctrlPos < 0 ) { - adjustScrollPos( hDlg, ctrlPos ); - } else if ( (ctrlPos + ctrlHeight) > dlgHeight ) { - setScrollPos( hDlg, ctrlPos - ctrlHeight ); - } - } -} /* ceDoDlgFocusScroll */ - -static XP_Bool -ceFindMenu( HMENU menu, XP_U16 id, -#ifndef _WIN32_WCE - HMENU* foundMenu, XP_U16* foundPos, -#endif - wchar_t* foundBuf, XP_U16 bufLen ) -{ - XP_Bool found = XP_FALSE; - XP_U16 pos; - MENUITEMINFO minfo; - - XP_MEMSET( &minfo, 0, sizeof(minfo) ); - minfo.cbSize = sizeof(minfo); - - for ( pos = 0; !found; ++pos ) { - /* Set these each time through loop. GetMenuItemInfo can change - some of 'em. */ - minfo.fMask = MIIM_SUBMENU | MFT_STRING | MIIM_ID | MIIM_TYPE; - minfo.dwTypeData = foundBuf; - minfo.fType = MFT_STRING; - minfo.cch = bufLen; - - if ( !GetMenuItemInfo( menu, pos, TRUE, &minfo ) ) { - break; /* pos is too big */ - } else if ( NULL != minfo.hSubMenu ) { - found = ceFindMenu( minfo.hSubMenu, id, -#ifndef _WIN32_WCE - foundMenu, foundPos, -#endif - foundBuf, bufLen ); - } else if ( MFT_SEPARATOR == minfo.fType ) { - continue; - } else if ( minfo.wID == id ) { - found = XP_TRUE; -#ifndef _WIN32_WCE - *foundPos = pos; - *foundMenu = menu; -#endif - } - } - return found; -} /* ceFindMenu */ - -#ifndef _WIN32_WCE -static void -setW32DummyMenu( CEAppGlobals* globals, HMENU menu, XP_U16 id, wchar_t* oldNm ) -{ - XP_LOGW( __func__, oldNm ); - if ( globals->dummyMenu == NULL ) { - HMENU tmenu; - XP_U16 tpos; - wchar_t ignore[32]; - if ( ceFindMenu( menu, W32_DUMMY_ID, &tmenu, &tpos, ignore, - VSIZE(ignore) ) ) { - globals->dummyMenu = tmenu; - globals->dummyPos = tpos; - } - } - - if ( globals->dummyMenu != NULL ) { - MENUITEMINFO minfo; - XP_MEMSET( &minfo, 0, sizeof(minfo) ); - minfo.cbSize = sizeof(minfo); - minfo.fMask = MFT_STRING | MIIM_TYPE | MIIM_ID; - minfo.fType = MFT_STRING; - minfo.dwTypeData = oldNm; - minfo.cch = wcslen( oldNm ); - minfo.wID = id; - - if ( !SetMenuItemInfo( globals->dummyMenu, globals->dummyPos, - TRUE, &minfo ) ) { - XP_LOGF( "SetMenuItemInfo failed" ); - } - } -} -#endif - -static HMENU -ceGetMenu( const CEAppGlobals* globals ) -{ -#ifdef _WIN32_WCE - TBBUTTONINFO info; - XP_MEMSET( &info, 0, sizeof(info) ); - info.cbSize = sizeof(info); - info.dwMask = TBIF_LPARAM; - SendMessage( globals->hwndCB, TB_GETBUTTONINFO, IDM_MENU, - (LPARAM)&info ); - return (HMENU)info.lParam; -#else - return GetMenu( globals->hWnd ); -#endif -} - -void -ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 newId ) -{ - if ( newId != globals->softKeyId ) { - wchar_t menuTxt[32]; /* text of newId menu */ - HMENU menu = ceGetMenu( globals ); -#ifdef _WIN32_WCE - TBBUTTONINFO info; -#else - HMENU prevMenu; - XP_U16 prevPos; -#endif - XP_U16 oldId = globals->softKeyId; - if ( 0 == oldId ) { - oldId = ID_INITIAL_SOFTID; - } - - /* Look up the text... */ - if ( ceFindMenu( menu, newId, -#ifndef _WIN32_WCE - &prevMenu, &prevPos, -#endif - menuTxt, VSIZE(menuTxt) ) ) { - globals->softKeyId = newId; -#ifndef _WIN32_WCE - globals->softKeyMenu = prevMenu; -#endif - } else { - XP_LOGF( "%s: ceFindMenu failed", __func__ ); - } - - /* Make it the button */ -#ifdef _WIN32_WCE - XP_MEMSET( &info, 0, sizeof(info) ); - info.cbSize = sizeof(info); - info.dwMask = TBIF_TEXT | TBIF_COMMAND; - info.idCommand = newId; - info.pszText = menuTxt; - SendMessage( globals->hwndCB, TB_SETBUTTONINFO, oldId, (LPARAM)&info ); -#else - setW32DummyMenu( globals, menu, newId, menuTxt ); -#endif - } - ceCheckMenus( globals ); /* in case left key was or should be checked */ -} /* ceSetLeftSoftkey */ - -static void -checkOneItem( const CEAppGlobals* globals, XP_U16 id, XP_Bool check ) -{ - UINT uCheck = check ? MF_CHECKED : MF_UNCHECKED; - HMENU menu = ceGetMenu( globals ); - - (void)CheckMenuItem( menu, id, uCheck ); -#ifndef _WIN32_WCE - if ( id == globals->softKeyId ) { - (void)CheckMenuItem( globals->softKeyMenu, id, uCheck ); - } -#endif -} - -void -ceCheckMenus( const CEAppGlobals* globals ) -{ - const BoardCtxt* board = globals->game.board; - - checkOneItem( globals, ID_MOVE_VALUES, board_get_showValues( board )); - checkOneItem( globals, ID_MOVE_FLIP, board_get_flipped( board ) ); - checkOneItem( globals, ID_FILE_FULLSCREEN, globals->appPrefs.fullScreen ); - checkOneItem( globals, ID_MOVE_HIDETRAY, - TRAY_REVEALED != board_getTrayVisState( board ) ); -} /* ceCheckMenus */ - -#ifdef OVERRIDE_BACKKEY -void -trapBackspaceKey( HWND hDlg ) -{ - /* Override back key so we can pass it to edit controls */ - SendMessage( SHFindMenuBar(hDlg), SHCMBM_OVERRIDEKEY, VK_TBACK, - MAKELPARAM (SHMBOF_NODEFAULT | SHMBOF_NOTIFY, - SHMBOF_NODEFAULT | SHMBOF_NOTIFY)); - /* To undo the above - SendMessage( SHFindMenuBar(hDlg), SHCMBM_OVERRIDEKEY, VK_TBACK, - MAKELPARAM( SHMBOF_NODEFAULT | SHMBOF_NOTIFY, - 0 ) ); - */ -} -#endif - -/* Bugs in mingw32ce headers force defining _WIN32_IE, which causes - * SHGetSpecialFolderPath to be defined as SHGetSpecialFolderPathW which - * is not on Wince. Once I turn off _WIN32_IE this can go away. */ -#ifdef _WIN32_IE -# ifdef SHGetSpecialFolderPath -# undef SHGetSpecialFolderPath -# endif -BOOL SHGetSpecialFolderPath( HWND hwndOwner, - LPTSTR lpszPath, - int nFolder, - BOOL fCreate ); -#endif - -static void -lookupSpecialDir( wchar_t* bufW, XP_U16 indx ) -{ - bufW[0] = 0; -#ifdef _WIN32_WCE - SHGetSpecialFolderPath( NULL, bufW, - (indx == MY_DOCS_CACHE)? - CSIDL_PERSONAL : CSIDL_PROGRAM_FILES, - TRUE ); - if ( 0 == bufW[0] ) { - XP_WARNF( "SHGetSpecialFolderPath failed" ); - wcscpy( bufW, L"\\My Documents" ); - } -#else - wcscat( bufW, L"." ); -#endif - if ( indx == PROGFILES_CACHE ) { - wcscat( bufW, L"\\" LCROSSWORDS_DIR_NODBG ); - } else { - wcscat( bufW, L"\\" LCROSSWORDS_DIR L"\\" ); - } -} - -XP_U16 -ceGetPath( CEAppGlobals* globals, CePathType typ, - void* bufOut, XP_U16 bufLen ) -{ - XP_U16 len; - wchar_t bufW[CE_MAX_PATH_LEN]; - XP_U16 cacheIndx = typ == PROGFILES_PATH ? PROGFILES_CACHE : MY_DOCS_CACHE; - wchar_t* specialDir = globals->specialDirs[cacheIndx]; - XP_Bool asAscii = XP_FALSE; - - if ( !specialDir ) { - wchar_t buf[128]; - XP_U16 len; - lookupSpecialDir( buf, cacheIndx ); - len = 1 + wcslen( buf ); - specialDir = XP_MALLOC( globals->mpool, len * sizeof(specialDir[0]) ); - wcscpy( specialDir, buf ); - globals->specialDirs[cacheIndx] = specialDir; - } - - wcscpy( bufW, specialDir ); - - switch( typ ) { - case PREFS_FILE_PATH_L: - wcscat( bufW, L"xwprefs" ); - break; - case DEFAULT_DIR_PATH_L: - /* nothing to do */ - break; - case DEFAULT_GAME_PATH: - asAscii = XP_TRUE; - wcscat( bufW, L"_newgame" ); - break; - - case PROGFILES_PATH: - /* nothing to do */ - break; - } - - len = wcslen( bufW ); - if ( asAscii ) { - (void)WideCharToMultiByte( CP_ACP, 0, bufW, len + 1, - (char*)bufOut, bufLen, NULL, NULL ); - } else { - wcscpy( (wchar_t*)bufOut, bufW ); - } - return len; -} /* ceGetPath */ - -int -ceMessageBoxChar( CEAppGlobals* globals, const XP_UCHAR* str, - const wchar_t* title, XP_U16 buttons, SkipAlertBits bit ) -{ - int result = IDOK; - XP_Bool callIt; - - if ( SAB_NONE == bit ) { - callIt = XP_TRUE; - } else { - callIt = 0 == (bit & globals->skipAlrtBits); - } - - if ( callIt ) { - HWND parent; - /* Get the length required, then alloc and go. This is technically - correct, but everywhere else I assume a 2:1 ratio for wchar_t:char. */ - XP_U16 clen = 1 + strlen(str); - XP_U32 wlen = 1 + MultiByteToWideChar( CP_UTF8, 0, str, clen, NULL, 0 ); - wchar_t widebuf[wlen]; - - MultiByteToWideChar( CP_UTF8, 0, str, clen, widebuf, wlen ); - - parent = GetForegroundWindow(); - - globals->skipAlrtBits |= bit; - result = MessageBox( parent, widebuf, title, buttons ); - globals->skipAlrtBits &= ~bit; - } - - return result; -} /* ceMessageBoxChar */ - -XP_Bool -ceGetExeDir( wchar_t* buf, XP_U16 bufLen ) -{ - /* I wanted to use SHGetKnownFolderPath to search in \\Program - Files\\Crosswords, but perhaps it's better to search in the directory - in which the app is located. If I get CAB files working for - Smartphone, then that directory will be \\Program Files\\Crosswords. - But if users have to install files using the File Explorer it'll be - easier for them if all that's required is that the app and dictionaries - be in the same place. GetModuleFileName() supports both. - */ - - DWORD nChars = GetModuleFileName( NULL, buf, bufLen ); - XP_Bool success = nChars < bufLen; - if ( success ) { - wchar_t* lastSlash = wcsrchr( buf, '\\' ); - if ( !!lastSlash ) { - *lastSlash = 0; - } - } - -/* SHGetSpecialFolderPath(NULL,NULL,0,FALSE); */ - - return success; -} /* ceGetExeDir */ diff --git a/xwords4/wince/ceutil.h b/xwords4/wince/ceutil.h deleted file mode 100755 index 1d06e0fbd..000000000 --- a/xwords4/wince/ceutil.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/common_rsrc.rc b/xwords4/wince/common_rsrc.rc deleted file mode 100644 index 1fb7e8cea..000000000 --- a/xwords4/wince/common_rsrc.rc +++ /dev/null @@ -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 diff --git a/xwords4/wince/connmgr.h b/xwords4/wince/connmgr.h deleted file mode 100644 index 31889e075..000000000 --- a/xwords4/wince/connmgr.h +++ /dev/null @@ -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 - -#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 */ diff --git a/xwords4/wince/debhacks.c b/xwords4/wince/debhacks.c deleted file mode 100644 index 522bf4e3b..000000000 --- a/xwords4/wince/debhacks.c +++ /dev/null @@ -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 -#include - -/* #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 */ diff --git a/xwords4/wince/debhacks.h b/xwords4/wince/debhacks.h deleted file mode 100644 index 680e757f4..000000000 --- a/xwords4/wince/debhacks.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/l10n/xwords4_caps.rc b/xwords4/wince/l10n/xwords4_caps.rc deleted file mode 100644 index 487eeac12..000000000 --- a/xwords4/wince/l10n/xwords4_caps.rc +++ /dev/null @@ -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 diff --git a/xwords4/wince/l10n/xwords4_catalan.rc b/xwords4/wince/l10n/xwords4_catalan.rc deleted file mode 100644 index 81b65615d..000000000 --- a/xwords4/wince/l10n/xwords4_catalan.rc +++ /dev/null @@ -1,1047 +0,0 @@ -// -*- mode: c; compile-command: "cd ../ && 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_CATALAN, SUBLANG_CATALAN_CATALAN -#pragma code_page(65001) -#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 "Menú" - BEGIN - MENUITEM "Fet", ID_MOVE_TURNDONE - MENUITEM "Remena", ID_MOVE_JUGGLE - MENUITEM "Canvia l'horientació", ID_MOVE_FLIP - MENUITEM "Canvia", ID_MOVE_TRADE - MENUITEM "Amaga el faristol", ID_MOVE_HIDETRAY - - POPUP "Desfés" - BEGIN - MENUITEM "Desfés l'actual", ID_MOVE_UNDOCURRENT - MENUITEM "Desfés l'últim", ID_MOVE_UNDOLAST - END - - POPUP "Pista" - BEGIN - MENUITEM "Pista següent", ID_MOVE_NEXTHINT - MENUITEM "Previous hint", ID_MOVE_PREVHINT - MENUITEM "Pista", ID_MOVE_HINT -#ifdef XWFEATURE_SEARCHLIMIT - MENUITEM "Límits de pistes...", ID_MOVE_LIMITEDHINT -#endif - MENUITEM SEPARATOR - MENUITEM "Mostra els valors", ID_MOVE_VALUES - END - - POPUP "Partida" - BEGIN - MENUITEM "Nombre i valor de les fitxes", ID_GAME_TILECOUNTSANDVALUES - MENUITEM "Fitxes romanents", ID_GAME_TILESLEFT - MENUITEM SEPARATOR - MENUITEM "Informació de la partida", ID_GAME_GAMEINFO - MENUITEM "Historial", ID_GAME_HISTORY - MENUITEM "Puntuacions finals", ID_GAME_FINALSCORES -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - MENUITEM SEPARATOR - MENUITEM "Torna a enviar els missatges", ID_GAME_RESENDMSGS -#endif - END - - POPUP "Fitxer" - BEGIN - MENUITEM "Pantalla completa", ID_FILE_FULLSCREEN - MENUITEM SEPARATOR - MENUITEM "Partida nova...", ID_FILE_NEWGAME - MENUITEM "Partides desades...", ID_FILE_SAVEDGAMES - MENUITEM "Preferències...", ID_FILE_PREFERENCES - MENUITEM SEPARATOR - MENUITEM "Quant a...", ID_FILE_ABOUT - MENUITEM SEPARATOR - MENUITEM "Surt", ID_FILE_EXIT - END - END -END - -#ifdef _WIN32_WCE -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" - -#ifndef AM_BASE_LANGUAGE -DLL_VERS_RESOURCE -#endif - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// -#define BUTTON_HT 12 -#define REPOS_BUTTON_HT BUTTON_HT -#define REPOS_BUTTON_WIDTH 36 -#define REPOS_BUTTON_VPAD 2 -#define REPOS_BUTTON_HPAD 2 -/* How tall does a single line of label text turn out to be */ -# define LABEL_ROW_HT 10 -#ifdef CEFEATURE_CANSCROLL -# define ROW_HEIGHT 11 -#else -# define ROW_HEIGHT 12 -#endif - - -// ******** IDD_GAMEINFO DIALOG ********* -#define GAMEINFO_WIDTH 116 -#ifdef CEFEATURE_CANSCROLL -# define ROW_HEIGHT 11 -# 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 50 -# define SERVERCONF_ROW (SERVERROLE_ROW+ROW_SPACE+3) -# define NPLAYERS_ROW (SERVERCONF_ROW+ROW_SPACE+3) -# define GAME_REMOTE_LEFT 1 -# define GAME_NAME_LEFT 11 -# define ROBOT_LABEL_ADJUST 10 -# define GAME_ROBOT_LEFT (GAME_NAME_LEFT+GAME_NAME_WIDTH+2) -# define GAME_PWD_LEFT (GAME_ROBOT_LEFT + CHECK_WIDTH + 4) -# define NAME_LABEL_ADJUST 20 -# define GAME_NAMELABEL_LEFT (GAME_NAME_LEFT+NAME_LABEL_ADJUST) -# define GAME_NAMELABEL_WIDTH (GAME_NAME_WIDTH-ROBOT_LABEL_ADJUST-NAME_LABEL_ADJUST) -# define GAME_ROBOTLABEL_LEFT (GAME_ROBOT_LEFT-ROBOT_LABEL_ADJUST) -# define GAME_ROBOTLABEL_WIDTH (GAME_PWD_LEFT-GAME_ROBOT_LEFT+ROBOT_LABEL_ADJUST) -# define GAME_PWDLABEL_LEFT (GAME_PWD_LEFT) -# define GAME_PWDLABEL_WIDTH (GAMEINFO_WIDTH-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 JUGGLE_ROW (PLAYER_ROW_4+ROW_SPACE) -#define DICTPICK_LAB_ROW (JUGGLE_ROW+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, GAMEINFO_WIDTH, GAMEINFO_HEIGHT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Informació de la partida" -FONT 8, "System" -BEGIN -#ifndef XWFEATURE_STANDALONE_ONLY - LTEXT "Rol:",IDC_ROLELABEL,LEFT_COL,SERVERROLE_ROW,20,8 - XWCOMBO(IDC_ROLECOMBO,26,SERVERROLE_ROW,50,ROW_HEIGHT,0,58,0) - - PUSHBUTTON "Configura el rol",GIROLECONF_BUTTON,LEFT_COL+10, - SERVERCONF_ROW,60,ROW_HEIGHT -#endif - - LTEXT "",IDC_TOTAL_LABEL,LEFT_COL,NPLAYERS_ROW,70,8 - XWCOMBO(IDC_NPLAYERSCOMBO,72,NPLAYERS_ROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Nom",IDC_NAMELABEL,GAME_NAMELABEL_LEFT, - LABELS_ROW,GAME_NAMELABEL_WIDTH,8,SS_NOPREFIX - LTEXT "Robot",IDC_ROBOTLABEL,GAME_ROBOTLABEL_LEFT,LABELS_ROW, - GAME_ROBOTLABEL_WIDTH,8 - LTEXT "Contrasenya",IDC_PASSWDLABEL,GAME_PWDLABEL_LEFT,LABELS_ROW, - GAME_PWDLABEL_WIDTH,8 - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - LTEXT "Remot",IDC_REMOTE_LABEL,LEFT_COL,LABELS_ROW,25,8,SS_NOPREFIX - 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 ) - - PUSHBUTTON "Remena les posicions de joc",GIJUGGLE_BUTTON,LEFT_COL+10, - JUGGLE_ROW,86,BUTTON_HT - - LTEXT "Diccionari:",IDC_DICTLABEL,LEFT_COL,DICTPICK_LAB_ROW,36,8, - SS_NOPREFIX - XWCOMBO(IDC_DICTLIST, LEFT_COL+10,DICTPICK_ROW,80,ROW_HEIGHT,LBS_SORT,58,CBS_SORT) - - PUSHBUTTON "Preferències...",OPTIONS_BUTTON,LEFT_COL,PREFS_ROW, - 55,BUTTON_HT - -#ifndef _WIN32_WCE - PUSHBUTTON "D'acord",IDOK,15,BUTTONS_ROW,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - DEFPUSHBUTTON "Cancel·la",IDCANCEL,55,BUTTONS_ROW, - REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT -#endif -END - -#define SB_WIDTH 121 -#define SB_BUTTON_WIDTH REPOS_BUTTON_WIDTH -#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 "Diàleg" -FONT 8, "System" -BEGIN - EDITTEXT ID_EDITTEXT,3,3,115,76,ES_MULTILINE | ES_READONLY - | WS_VSCROLL -#ifndef _WIN32_WCE - PUSHBUTTON "D'acord",IDOK, SB_OK_LEFT,81,SB_BUTTON_WIDTH, - REPOS_BUTTON_HT - DEFPUSHBUTTON "Cancel·la",IDCANCEL,SB_CANCEL_LEFT,81,SB_BUTTON_WIDTH, - REPOS_BUTTON_HT -#endif -END - -#define ASKB_DLG_WIDTH 80 -#define ASKB_COLLEFT 5 -#define ASKB_LABELTOP 0 -#define ASKB_LABELHT 42 -#define ASKB_LABELWIDTH 40 -#define ASKB_COMBOLEFT (ASKB_COLLEFT+ASKB_LABELWIDTH+5) -#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 "Selecció de les fitxes" -FONT 8, "System" -BEGIN - LTEXT "Indiqueu quina fitxa ha de representar l'escarràs.", - IDC_BPICK, ASKB_COLLEFT,ASKB_LABELTOP,ASKB_LABELWIDTH, - ASKB_LABELHT -#ifdef FEATURE_TRAY_EDIT - LTEXT "Seleccioneu una fitxa del faristol.",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 "Torna-la al sac",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 "D'acord",IDOK,80,WCE_BOTTOM,REPOS_BUTTON_WIDTH, BUTTON_HT - PUSHBUTTON "Cancel·la",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 "Nom de la partida" -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 "D'acord",IDOK,SVGN_LEFT_COL+10,SVGN_ROW_3,REPOS_BUTTON_WIDTH, - BUTTON_HT - PUSHBUTTON "Cancel·la",IDCANCEL,SVGN_LEFT_COL+10+REPOS_BUTTON_WIDTH+10, - 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 "Partides desades" -FONT 8, "System" -BEGIN - LTEXT /* wince windres can't handle split lines....*/ - "Seleccioneu una partida desada. (En seleccionar la partida actual s'inhabilitaran alguns botons.)", - 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 "Obre",IDC_SVGM_OPEN, - SVGM_LEFT_COL,SVGM_ROW_3,40,14,WS_DISABLED - - PUSHBUTTON "Dupl.",IDC_SVGM_DUP, - SVGM_LEFT_COL,SVGM_ROW_4,20,14,WS_DISABLED - PUSHBUTTON "Supr.",IDC_SVGM_DEL, - SVGM_LEFT_COL+22,SVGM_ROW_4,28,14,WS_DISABLED - PUSHBUTTON "Reanom.",IDC_SVGM_CHANGE, - SVGM_LEFT_COL+52,SVGM_ROW_4,32,14,WS_DISABLED - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "Fet",IDOK,SVGM_LEFT_COL,SVGM_ROW_OK,REPOS_BUTTON_WIDTH, - 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 "Contrasenya" -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 "D'acord",IDOK,PW_OK_LEFT,32,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - PUSHBUTTON "Cancel·la",IDCANCEL,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 24 -#define HC_WIDTH 98 -#define HC_OK_LEFT ((HC_WIDTH/2)-10-REPOS_BUTTON_WIDTH) -#define HC_CANCEL_LEFT ((HC_WIDTH/2)+10) -#define HC_BUTTONS_ROW 40 - -#ifdef _WIN32_WCE -# define ASKHINTLIMTS_HT HC_BUTTONS_ROW -#else -# define ASKHINTLIMTS_HT (HC_BUTTONS_ROW+ROW_HEIGHT) -#endif - -IDD_ASKHINTLIMTS DIALOG DISCARDABLE 0, 0, HC_WIDTH, ASKHINTLIMTS_HT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "Límits de les pistes" -FONT 8, "System" -BEGIN - LTEXT "Com a mínim mostra'n:",HC_MIN_LABEL,HC_LABELS_COL, - HC_MINROW,60,2*ROW_HEIGHT - XWCOMBO(HC_MIN_COMBO, HC_DROPDOWNS_COL,HC_MINROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Però no més de:",HC_MAX_LABEL,HC_LABELS_COL, - HC_MAXROW,60,ROW_HEIGHT - XWCOMBO(HC_MAX_COMBO, HC_DROPDOWNS_COL,HC_MAXROW, 24, ROW_HEIGHT, 0,58,0) - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "D'acord",IDOK,HC_OK_LEFT,HC_BUTTONS_ROW,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Cancel·la",IDCANCEL,HC_CANCEL_LEFT,HC_BUTTONS_ROW,REPOS_BUTTON_WIDTH, - 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_ROW8 (PR_ROW7+PR_SPACING) -#define PR_BUTTONROW (PR_ROW8+PR_SPACING+3) -#define PR_LEFT 6 - -#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 "Preferències" -FONT 8, "System" -BEGIN - CONTROL "Aquesta partida",IDC_RADIOLOCAL,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,4,PR_ROW1,47,10 - CONTROL "Totes les partides",IDC_RADIOGLOBAL,"Button", - BS_AUTORADIOBUTTON,52,PR_ROW1,53,10 - - /* Global */ - CONTROL "Color de les fitxes jugades",IDC_CHECKCOLORPLAYED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP, - PR_LEFT,PR_ROW2,95,PREFS_ROW_HT - CONTROL "Habilita el cursor",IDC_CHECKSHOWCURSOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW3,80,PREFS_ROW_HT - CONTROL "Explica la puntuació dels robots",IDC_CHECKROBOTSCORES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW4,95,PREFS_ROW_HT - CONTROL "Omet la confirmació de la jugada",IDC_SKIPCONFIRM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW5,95,PREFS_ROW_HT - CONTROL "Amaga els valors de les lletres",IDC_HIDETILEVALUES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW6,95,PREFS_ROW_HT - PUSHBUTTON "Edita els colors...",IDC_PREFCOLORS,PR_LEFT,PR_ROW7,70,12 - PUSHBUTTON "Canvia la llengua...",IDC_PREFLOCALE,PR_LEFT,PR_ROW8,70,12 -#ifdef ALLOW_CHOOSE_FONTS - PUSHBUTTON "Trieu el tipus de lletra...",IDC_PREFFONTS,PR_LEFT,PR_ROW9,60,12 -#endif - - /* Per game */ - CONTROL "Robot intel·ligent",IDC_CHECKSMARTROBOT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,PR_LEFT,PR_ROW2,70, - PREFS_ROW_HT - CONTROL "Permet mostrar les pistes",IDC_CHECKHINTSOK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW3,95,PREFS_ROW_HT -#ifdef XWFEATURE_SEARCHLIMIT - CONTROL "Límit de les pistes",IDC_CHECKHINTSLIMITS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8+10,PR_ROW4-2,85,10 -#endif - CONTROL "Temps (min.)",TIMER_CHECK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW5,75,PREFS_ROW_HT - EDITTEXT TIMER_EDIT,85,PR_ROW5,16,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Mots fora-dicc.:",PHONIES_LABEL,PR_LEFT,PR_ROW6,28,PREFS_ROW_HT - XWCOMBO(PHONIES_COMBO, 38,PR_ROW6,50,PREFS_ROW_HT, 0, 58, 0) - -#ifdef FEATURE_TRAY_EDIT - CONTROL "Les fitxes es trien veient-les", IDC_PICKTILES, "Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW7,95,PREFS_ROW_HT -#else -#endif -#ifndef _WIN32_WCE - DEFPUSHBUTTON "D'acord",IDOK,PR_OK_LEFT,PR_BUTTONROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - PUSHBUTTON "Cancel·la",IDCANCEL,PR_CANCEL_LEFT,PR_BUTTONROW, - 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_LABEL_HT LABEL_ROW_HT /* try to make them all same ht! */ -# define CONN_HELP_HT 25 -# define CONN_LABEL_ROW_1 2 -# define CONN_EDIT_ROW_2 (CONN_LABEL_ROW_1+ROW_SPACE) -# ifdef NEEDS_CHOOSE_CONNTYPE -# define CONN_LABEL_ROW_3 (CONN_EDIT_ROW_2+ROW_SPACE) -# define CONN_EDIT_ROW_4 (CONN_LABEL_ROW_3+ROW_SPACE+ROW_HEIGHT) -# else -# define CONN_LABEL_ROW_3 (CONN_LABEL_ROW_1) -# define CONN_EDIT_ROW_4 (CONN_LABEL_ROW_3+ROW_SPACE) -# endif -# ifndef RELAY_NOEDIT_ADDR -# define CONN_LABEL_ROW_5 (CONN_EDIT_ROW_4+CONN_HELP_HT+5) -# define CONN_EDIT_ROW_6 (CONN_LABEL_ROW_5+CONN_LABEL_HT+3) -# define CONN_LABEL_ROW_7 (CONN_EDIT_ROW_6+ROW_SPACE+5) -# define CONN_EDIT_ROW_8 (CONN_LABEL_ROW_7+CONN_LABEL_HT+3) -# define BUTTON_ROW (CONN_EDIT_ROW_8+ROW_SPACE) -#else -# define BUTTON_ROW (CONN_EDIT_ROW_4+CONN_HELP_HT) -#endif -#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 "Connexió" -FONT 8, "System" -BEGIN - -#ifdef NEEDS_CHOOSE_CONNTYPE - LTEXT "Connecta via:",IDC_CCONVIA_LAB,LAB_COL,CONN_LABEL_ROW_1,40, - ROW_HEIGHT - XWCOMBO(IDC_CONNECT_COMBO,CTRL_COL,CONN_EDIT_ROW_2,CTRL_COL_WIDTH,ROW_HEIGHT, - 0,58,0) -#endif -#if defined XWFEATURE_RELAY - LTEXT "Sala:", - IDC_INVITE_LAB,LAB_COL,CONN_LABEL_ROW_3,23,CONN_LABEL_HT - EDITTEXT INVITE_EDIT,LAB_COL+25,CONN_LABEL_ROW_3,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL - LTEXT "(As host, you name the room for the game, and must " - "connect first.)", - IDC_INVITE_HELP_HOST,LAB_COL,CONN_EDIT_ROW_4,110,CONN_HELP_HT - LTEXT "(As guest, wait for the host to connect then tell you " - "the room name.)", - IDC_INVITE_HELP_GUEST,LAB_COL,CONN_EDIT_ROW_4,100,CONN_HELP_HT - -# ifndef RELAY_NOEDIT_ADDR - LTEXT "Nom del repetidor (canvia poques vegades):", - IDC_CRELAYNAME_LAB,LAB_COL,CONN_LABEL_ROW_5,90,CONN_LABEL_HT - EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_EDIT_ROW_6,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL - LTEXT "Port del repetidor (canvia poques vegades):", - IDC_CRELAYPORT_LAB,LAB_COL,CONN_LABEL_ROW_7,90,CONN_LABEL_HT - EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_EDIT_ROW_8,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER -#endif -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "La connexió al repetidor no és possible.",IDC_INVITE_LAB,LAB_COL,CONN_ROW_3,40,40 -#endif - -#if defined XWFEATURE_IP_DIRECT - LTEXT "Nom de l'amfitrió o adreça",IDC_IPNAME_LAB,LAB_COL,CONN_ROW_3,90,ROW_HEIGHT - EDITTEXT IPNAME_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT,ES_AUTOHSCROLL -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "La connexió amb IP directa no és permesa.",IDC_IPNAME_LAB, - LAB_COL,CONN_LABEL_ROW_3,40,40 -#endif - -#if defined XWFEATURE_SMS - LTEXT "Telèfon amfitrió:",IDC_SMS_PHONE_LAB,LAB_COL,CONN_ROW_3,60,ROW_HEIGHT - EDITTEXT IDC_SMS_PHONE_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Port amfitrió:",IDC_SMS_PORT_LAB,LAB_COL,CONN_ROW_5,60,ROW_HEIGHT - EDITTEXT IDC_SMS_PORT_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL | ES_NUMBER -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "No es permet enviar missatges de text.", - IDC_SMS_PHONE_LAB,LAB_COL,CONN_LABEL_ROW_3,40,ROW_HEIGHT -#endif - -#ifndef _WIN32_WCE - PUSHBUTTON "D'acord",IDOK,9,BUTTON_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - DEFPUSHBUTTON "Cancel·la",IDCANCEL,70,BUTTON_ROW, - 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 - -IDD_COLORSDLG DIALOG DISCARDABLE 0, 20, CLR_WIDTH, COLORSDLG_HT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Preferències de color" -FONT 8, "System" -BEGIN - COLOR_BUTTON("Lletra ×2:",DLBLTR_LABEL,CLR_COL_1,CLR_ROW_1) - COLOR_SAMPLE(DLBLTR_BUTTON,DLBLTR_SAMPLE,CLR_COL_2,CLR_ROW_1) - - COLOR_BUTTON("Paraula ×2:",DBLWRD_LABEL,CLR_COL_1,CLR_ROW_2 ) - COLOR_SAMPLE(DBLWRD_BUTTON,DBLWRD_SAMPLE,CLR_COL_2,CLR_ROW_2) - COLOR_BUTTON("Lletra ×3:",TPLLTR_LABEL,CLR_COL_1,CLR_ROW_3 ) - COLOR_SAMPLE(TPLLTR_BUTTON,TPLLTR_SAMPLE,CLR_COL_2,CLR_ROW_3) - - COLOR_BUTTON("Paraula ×3:",TPLWRD_LABEL,CLR_COL_3,CLR_ROW_4) - COLOR_SAMPLE(TPLWRD_BUTTON,TPLWRD_SAMPLE,CLR_COL_4,CLR_ROW_4) - COLOR_BUTTON("Casella buida:",EMPCELL_LABEL,CLR_COL_1,CLR_ROW_5) - COLOR_SAMPLE(EMPCELL_BUTTON,EMPCELL_SAMPLE,CLR_COL_2,CLR_ROW_5) - COLOR_BUTTON("Darrera fitxa:",TBACK_LABEL,CLR_COL_3,CLR_ROW_6) - COLOR_SAMPLE(TBACK_BUTTON,TBACK_SAMPLE,CLR_COL_4,CLR_ROW_6) - COLOR_BUTTON("Enfocament:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_7) - COLOR_SAMPLE(FOCUSCLR_BUTTON,FOCUSCLR_SAMPLE,CLR_COL_2,CLR_ROW_7) - COLOR_BUTTON("Jugador 1:",PLAYER1_LABEL,CLR_COL_1,CLR_ROW_8) - COLOR_SAMPLE(PLAYER1_BUTTON,PLAYER1_SAMPLE,CLR_COL_2,CLR_ROW_8) - COLOR_BUTTON("Jugador 2:",PLAYER2_LABEL,CLR_COL_3,CLR_ROW_9) - COLOR_SAMPLE(PLAYER2_BUTTON,PLAYER2_SAMPLE,CLR_COL_4,CLR_ROW_9) - COLOR_BUTTON("Jugador 3:",PLAYER3_LABEL,CLR_COL_1,CLR_ROW_10) - COLOR_SAMPLE(PLAYER3_BUTTON,PLAYER3_SAMPLE,CLR_COL_2,CLR_ROW_10) - COLOR_BUTTON("Jugador 4:",PLAYER4_LABEL,CLR_COL_3,CLR_ROW_11) - COLOR_SAMPLE(PLAYER4_BUTTON,PLAYER4_SAMPLE,CLR_COL_4,CLR_ROW_11) - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "D'acord",IDOK,CLR_OK_LEFT,CLR_BUTTON_ROW, - REPOS_BUTTON_WIDTH,BUTTON_HT,BS_NOTIFY - PUSHBUTTON "Cancel·la",IDCANCEL,CLR_CANCEL_LEFT,CLR_BUTTON_ROW, - 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("Vermell:", CLREDIT_ROW_1, RED_LABEL, RED_EDIT, CLREDT_SLIDER1 ) - COLOR_EDIT_LINE("Verd:", CLREDIT_ROW_2, GREEN_LABEL, GREEN_EDIT, CLREDT_SLIDER2 ) - COLOR_EDIT_LINE("Blau:", CLREDIT_ROW_3, BLUE_LABEL, BLUE_EDIT, CLREDT_SLIDER3 ) - - /* 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 "D'acord",IDOK,CLRE_OK_LEFT,56,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Cancel·la",IDCANCEL,CLRE_CANCEL_LEFT,56,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END - -#endif - -#ifdef ALLOW_CHOOSE_FONTS -IDD_FONTSSDLG DIALOG DISCARDABLE 0, 0, 120, 115 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "" /* set by code */ -FONT 8, "System" -BEGIN - - LTEXT "Fonts:",FONTS_LABEL,5,2,25,12 - XWCOMBO(FONTS_COMBO, 30,2,70,12,0,58,0) - - LTEXT "Mida:",FONTSIZE_LABEL,5,16,25,12 - XWCOMBO(FONTSIZE_COMBO, 30,16,25,12,0,58,0) - -# ifndef _WIN32_WCE - DEFPUSHBUTTON "D'acord",IDOK,20,100,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Cancel·la",IDCANCEL,100,100,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END -#endif - -IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 80 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "Selector d'idioma" -FONT 8, "System" -BEGIN - LTEXT "Trieu la llengua dels menús i els quadres de text. (Podeu baixar-vos els fitxer de llengua necessaris per a més llengües des de xwords.sf.net.)", - LOCALES_LABEL,LEFT_COL,2,80,57 - - XWCOMBO(LOCALES_COMBO,LEFT_COL,60,70,12,0,58,0) -# ifndef _WIN32_WCE - DEFPUSHBUTTON "D'acord",IDOK,LEFT_COL,75,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Cancel·la",IDCANCEL,40,75,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_MENU "Menú" - IDS_DUMMY "--" - IDS_CANCEL "Cancel·la" - IDS_OK "D'acord" - IDS_DONE "Fet" - IDS_LANGUAGE_NAME "Català" - IDS_NEW_GAME "Partida nova" - IDS_ABOUT "Crosswords " ABOUT_VERSION " (versió " SVN_REV ") "\ - "per a Windows Mobile. Copyright 1998-2010 "\ - "d'Eric House. Traduït per en Joan Montané. "\ - "Aquest programari es troba sota la"\ - "Llicència Pública GNU.\r\r"\ - "Per als diccionaris, instruccions, o el codi font, aneu a "\ - "http://xwords.sf.net o a http://eehouse.org/xwords/." - IDS_DICTLOC "Instal·leu un diccionari del Crosswords (fitxer .xwd) "\ - "al mateix directori que el fitxer .exe del Crosswords, o "\ - "en un directori anomenat Crosswords en una targeta externa, "\ - "p.ex. a \\Targeta\\Crosswords. "\ - "Podeu baixar-vos els diccionaris des de http://xwords.sf.net o "\ - "http://eehouse.org/xwords." - IDS_SAVENAME "Introduïu un nom per a la partida actual. (Podeu canviar-lo "\ - "més endavant al menú Partides desades.)" - IDS_DUPENAME "Introduïu un nom per a la còpia de la partida." - IDS_RENAME "Introduïu un nom per a aquesta partida." - - IDS_REMAINING_TILES_ADD "+ %d [les fitxes romanents]" - IDS_UNUSED_TILES_SUB "- %d [al faristol]" - IDS_BONUS_ALL "Bonificació per emprar totes les fitxes: 50" XP_CR - IDS_TURN_SCORE "Puntuació del torn: %d" XP_CR - IDS_COMMIT_CONFIRM - "Voleu fer la jugada?" XP_CR - IDS_LOCAL_NAME "%s" - IDS_IGNORE_L "Ignora-ho" - IDS_WARN_L "Avisa" - IDS_DISALLOW_L "Inhabilita" - IDS_NONLOCAL_NAME "%s (remot)" - IDS_TIME_PENALTY_SUB " - %d [temps]" - IDS_CUMULATIVE_SCORE "Puntuació acumulada: %d" XP_CR - IDS_MOVE_ACROSS "mou (des de %s horitzontal)" XP_CR - IDS_MOVE_DOWN "mou (des de %s avall)" XP_CR - IDS_TRAY_AT_START "Faristol a l'inici: %s" XP_CR - IDS_NEW_TILES "Fitxes noves: %s" XP_CR - IDS_TRADED_FOR "Ha canviat %s per %s." - IDS_PASS "passa" XP_CR - IDS_PHONY_REJECTED "Hi ha una o més paraules no vàlides a la jugada; torn perdut!" XP_CR - IDS_ROBOT_TRADED "El robot ha canviat %d fitxes al seu torn." - IDS_ROBOT_MOVED "El robot ha fet la seva jugada:" XP_CR - IDS_REMOTE_MOVEDF "El jugador remot ha fet la seva jugada:" XP_CR - IDS_PASSED "Ha passat" - IDS_SUMMARYSCORED "%s:%d" - IDS_TRADED "N'ha canviat %d" - IDS_LOSTTURN "Ha perdut torn" - IDS_TOTALPLAYERS "Nombre de jugadors:" - IDS_VALUES_HEADER "%s quantitat/valors:" XP_CR - IDS_QUERY_TRADE "Esteu segur de voler canviar les fitxes seleccionades?" - - IDS_DOUBLE_LETTER "Doble de lletra" - IDS_DOUBLE_WORD "Doble de paraula" - IDS_TRIPLE_LETTER "Triple de lletra" - IDS_TRIPLE_WORD "Triple de paraula" - IDS_INTRADE_MW "Canvi de fitxes." XP_CR "Pitgeu 'fet' quan" XP_CR "estigueu a punt." - - IDS_TILES_NOT_IN_LINE "Heu de jugar les fitxes en una mateixa línia." - IDS_NO_EMPTIES_IN_TURN "No podeu deixar caselles buides entre les fitxes jugades." - IDS_TWO_TILES_FIRST_MOVE "Heu de jugar dues o més fitxes en la primera jugada." - IDS_TILES_MUST_CONTACT "Les fitxes noves han de tocar alguna de les que ja estan jugades al tauler (o "\ - "la casella central en la primera jugada)." - IDS_NOT_YOUR_TURN "No podeu fer això, no és el vostre torn!" - IDS_NO_PEEK_ROBOT_TILES "No podeu mirar les fitxes del robot!" - IDS_TOO_FEW_TILES_LEFT_TO_TRADE "Hi ha poques fitxes al saquet i ja no podeu canviar-les." - IDS_CANT_UNDO_TILEASSIGN "L'assignació de fitxers no es pot desfer." - IDS_CANT_HINT_WHILE_DISABLED "Les pistes es troben inhabilitades per a aquesta partida. Habiliteu-les"\ - "per a una partida nova al menú Preferències." - - IDS_COUNTSVALS_L "Quantitat i valor de les fitxes" - IDS_REMTILES_L "Fitxes romanents" - IDS_GAMEHIST_L "Historial de la partida" - IDS_FINALSCORE_L "Puntuacions finals" - IDS_QUESTION_L "Pregunta" - IDS_FYI_L "FYI" - IDS_ILLEGALWRD_L "La paraula no és vàlida" - IDS_WRDNOTFOUND "La paraula o paraules no es troben al diccionari." - IDS_USEANYWAY "Desitgeu donar-la com a válida igualment?" - IDS_CANNOTOPEN_GAME "No es pot obrir la partida desada." - IDS_NODICT_L "No s'ha trobat el diccionari" - IDS_ABOUT_L "Quant al Crosswords" - IDS_OVERWRITE "Voleu sobreescriure la partida actual?" - IDS_ENDNOW "Esteu segur que voleu finalitzar ara la partida?" - IDS_CANNOTOPEN_DICT "No s'ha pogut obrir el diccionari: %s" - IDS_CONFIM_DELETE "Esteu segur que voleu suprimir la partida seleccionada?"\ - "No podeu desfer aquesta acció." - - IDS_ROLE_STANDALONE "Solitari" - IDS_ROLE_HOST "Amfitrió" - IDS_ROLE_GUEST "Visitant" - IDS_PLAYER_FORMAT "Jugador %d" - IDS_UNTITLED_FORMAT "Sense nom %d" - IDS_PASSWDFMT_L "Introduïu la contrasenya per a %ls:" - - IDS_FILEEXISTSFMT_L "El fitxer %s ja existeix." - IDS_NEED_TOUCH "Aquesta funcionalitat requereix una pantalla tàctil." - IDS_EDITCOLOR_FORMAT "Edita el color per a %s" - - IDS_LANG_CHANGE_RESTART "Aquest canvi serà efectiu quan reinicieu el Crosswords." - -#ifndef XWFEATURE_STANDALONE_ONLY - IDS_RESEND_STANDALONE "Aquesta és una partida en solitari. No hi ha res per a reenviar." - IDS_PHONE_OFF "El Crosswords no pot connectar perquè el telèfon "\ - "sembla apagat. Reinicieu el Crosswords "\ - "després d'engegar-lo." - IDS_NETWORK_FAILED "No s'ha pogut preparar la xarxa." - IDS_CONN_RELAY_L "Repetidor" - IDS_CONN_DIRECT "Connexió directa" - IDS_LOCALPLAYERS "Jugadors locals:" - IDS_NO_PEEK_REMOTE_TILES "No podeu mirar a les fitxes dels jugadors remots!" - IDS_REG_UNEXPECTED_USER "S'ha refusat l'intent de registre d'usuaris inesperats." - IDS_SERVER_DICT_WINS "Hi ha un conflicte entre els diccionaris de l'amfitrió i dels visitants; " - "L'amfitrió guanya." - IDS_REG_SERVER_SANS_REMOTE "Com a mínim un jugador ha de ser remot "\ - "per a una partida iniciada com a amfitrió." - -# ifdef XWFEATURE_SMS - IDS_SMS_CONN_L "Enviament de missatges de text" -# endif -# ifdef XWFEATURE_IP_DIRECT - IDS_DIRECT_CONN_L "Connexió directa" -# endif -# ifdef XWFEATURE_RELAY - IDS_XWRELAY_ERROR_TIMEOUT "El repetidor us ha fet fora; normalment això significa "\ - "que els altres jugadors no us veien." - IDS_ERROR_HEART_YOU "Us han desconnectat del repetidor perquè "\ - "no s'han rebut dades vostres en una bona estona." - IDS_XWRELAY_ERROR_HEART_OTHER "El repetidor ha perdut el contacte amb el un dispositiu d'aquesta partida." -/* IDS_XWRELAY_ERROR_LOST_OTHER "El repetidor ha perdut el contacte amb un dispositiu d'aquesta partida." */ - IDS_XWRELAY_RELAY_INCOMPAT "Aquesta versió del Crosswords no coincideix amb la del repetidor."\ - " Probablement heu d'actualitzar a la darrera versió." - IDS_RELAY_HOST_WAITINGD "Esteu connectat al repetidor com amfitrió. S'està esperant a "\ - "%d jugador/s." - IDS_RELAY_GUEST_WAITINGD "Esteu connectat al repetidor com a visitant. Encara esperem a "\ - "%d jugador/s." - IDS_RELAY_ALLHERE "Tot els jugadors són aquí." - - IDS_ERROR_NO_ROOM "No existeix aquesta habitació. L'amfitrió ja ha connectat per a reservar-la?" - IDS_ERROR_DUP_ROOM "Aquesta habitació està reservada per una altre amfitrió. "\ - "Canvieu el nom a l'habitació, entreu com a visitant, o intenteu-ho "\ - "de nou d'aquí uns minuts." - IDS_ERROR_TOO_MANY "L'amfitrió no espera tants jugadors. "\ - "Reduïu el nombre de jugadors locals." -# endif -#endif - -END - -#ifdef AM_BASE_LANGUAGE -# include "../common_rsrc.rc" -#endif - -#endif diff --git a/xwords4/wince/l10n/xwords4_czech.rc b/xwords4/wince/l10n/xwords4_czech.rc deleted file mode 100755 index 7d2424c71..000000000 --- a/xwords4/wince/l10n/xwords4_czech.rc +++ /dev/null @@ -1,1056 +0,0 @@ -// -*- mode: c; compile-command: "cd ../ && 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_CZECH, SUBLANG_CZECH_CZECH_REPUBLIC -#pragma code_page(65001) -#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 "Nabídka" - BEGIN - MENUITEM "Konec tahu", ID_MOVE_TURNDONE - MENUITEM "Přeházet kameny", ID_MOVE_JUGGLE - MENUITEM "Otočit", ID_MOVE_FLIP - MENUITEM "Výměna kamenů", ID_MOVE_TRADE - MENUITEM "Skrýt zásobník", ID_MOVE_HIDETRAY - - POPUP "Zpět" - BEGIN - MENUITEM "Vrátit kameny", ID_MOVE_UNDOCURRENT - MENUITEM "Vrátit tah", ID_MOVE_UNDOLAST - END - - POPUP "Nápověda" - BEGIN - MENUITEM "Další nápověda", ID_MOVE_NEXTHINT - MENUITEM "Previous hint", ID_MOVE_PREVHINT - MENUITEM "Nápověda", ID_MOVE_HINT -#ifdef XWFEATURE_SEARCHLIMIT - MENUITEM "Omezená nápověda...", ID_MOVE_LIMITEDHINT -#endif - MENUITEM SEPARATOR - MENUITEM "Ukázat hodnoty", ID_MOVE_VALUES - END - - POPUP "Hra" - BEGIN - MENUITEM "Množství a hodnoty kamenů",ID_GAME_TILECOUNTSANDVALUES - MENUITEM "Zbylé kameny", ID_GAME_TILESLEFT - MENUITEM SEPARATOR - MENUITEM "Vlastnosti", ID_GAME_GAMEINFO - MENUITEM "Historie", ID_GAME_HISTORY - MENUITEM "Ukončit hru", ID_GAME_FINALSCORES -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - MENUITEM SEPARATOR - MENUITEM "Přepošli zprávu", ID_GAME_RESENDMSGS -#endif - END - - POPUP "Soubor" - BEGIN - MENUITEM "Celá obrazovka", ID_FILE_FULLSCREEN - MENUITEM SEPARATOR - MENUITEM "Nová hra...", ID_FILE_NEWGAME - MENUITEM "Uložené hry...", ID_FILE_SAVEDGAMES - MENUITEM "Volby...", ID_FILE_PREFERENCES - MENUITEM SEPARATOR - MENUITEM "O hře...", ID_FILE_ABOUT - MENUITEM SEPARATOR - MENUITEM "Ukončit", ID_FILE_EXIT - 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" - -#ifndef AM_BASE_LANGUAGE -DLL_VERS_RESOURCE -#endif - -///////////////////////////////////////////////////////////////////////////// -// -// 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 -/* How tall does a single line of label text turn out to be */ -# define LABEL_ROW_HT 10 -#ifdef CEFEATURE_CANSCROLL -# define ROW_HEIGHT 11 -#else -# define ROW_HEIGHT 12 -#endif - -// ******** IDD_GAMEINFO DIALOG ********* -#define GAMEINFO_WIDTH 116 -#ifdef CEFEATURE_CANSCROLL -# define ROW_SPACE 12 -# define ROW_SPACE_PL 11 -#else -# 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 50 -# define SERVERCONF_ROW (SERVERROLE_ROW+ROW_SPACE+3) -# define NPLAYERS_ROW (SERVERCONF_ROW+ROW_SPACE+3) -# define GAME_REMOTE_LEFT 1 -# define GAME_NAME_LEFT 11 -# define ROBOT_LABEL_ADJUST 7 -# define GAME_ROBOT_LEFT (GAME_NAME_LEFT+GAME_NAME_WIDTH+2) -# define GAME_PWD_LEFT (GAME_ROBOT_LEFT + CHECK_WIDTH + 4) -# define NAME_LABEL_ADJUST 22 -# define GAME_NAMELABEL_LEFT (GAME_NAME_LEFT+NAME_LABEL_ADJUST) -# define GAME_NAMELABEL_WIDTH (GAME_NAME_WIDTH-ROBOT_LABEL_ADJUST-NAME_LABEL_ADJUST) -# define GAME_ROBOTLABEL_LEFT (GAME_ROBOT_LEFT-ROBOT_LABEL_ADJUST) -# define GAME_ROBOTLABEL_WIDTH (GAME_PWD_LEFT-GAME_ROBOT_LEFT+ROBOT_LABEL_ADJUST) -# define GAME_PWDLABEL_LEFT (GAME_PWD_LEFT) -# define GAME_PWDLABEL_WIDTH (GAMEINFO_WIDTH-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 JUGGLE_ROW (PLAYER_ROW_4+ROW_SPACE) -#define DICTPICK_LAB_ROW (JUGGLE_ROW+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, GAMEINFO_WIDTH, GAMEINFO_HEIGHT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Vlastnosti hry" -FONT 8, "System" -BEGIN -#ifndef XWFEATURE_STANDALONE_ONLY - LTEXT "Role:",IDC_ROLELABEL,LEFT_COL,SERVERROLE_ROW,20,8 - XWCOMBO(IDC_ROLECOMBO,26,SERVERROLE_ROW,70,ROW_HEIGHT,0,58,0) - - /* translate */ - PUSHBUTTON "Configure role",GIROLECONF_BUTTON,LEFT_COL+10, - SERVERCONF_ROW,60,ROW_HEIGHT -#endif - - LTEXT "",IDC_TOTAL_LABEL,LEFT_COL,NPLAYERS_ROW,60,8 - XWCOMBO(IDC_NPLAYERSCOMBO,68,NPLAYERS_ROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Jméno",IDC_NAMELABEL,GAME_NAMELABEL_LEFT, - LABELS_ROW,GAME_NAMELABEL_WIDTH,8,SS_NOPREFIX - LTEXT "Robot",IDC_ROBOTLABEL,GAME_ROBOTLABEL_LEFT,LABELS_ROW, - GAME_ROBOTLABEL_WIDTH,8 - LTEXT "Heslo",IDC_PASSWDLABEL,GAME_PWDLABEL_LEFT,LABELS_ROW, - GAME_PWDLABEL_WIDTH,8 - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - LTEXT "Vzdálený",IDC_REMOTE_LABEL,LEFT_COL,LABELS_ROW,28,8, - SS_NOPREFIX - 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 ) - - PUSHBUTTON "Přeházet hráče",GIJUGGLE_BUTTON,LEFT_COL+10,JUGGLE_ROW, - 60,BUTTON_HT - - LTEXT "Slovník:",IDC_DICTLABEL,LEFT_COL,DICTPICK_LAB_ROW,36,8, - SS_NOPREFIX - XWCOMBO(IDC_DICTLIST, LEFT_COL+10,DICTPICK_ROW,80,ROW_HEIGHT,LBS_SORT,58,CBS_SORT) - - PUSHBUTTON "Volby...",OPTIONS_BUTTON,LEFT_COL,PREFS_ROW, - 55,BUTTON_HT - -#ifndef _WIN32_WCE - PUSHBUTTON "Ano",IDOK,20,BUTTONS_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - DEFPUSHBUTTON "Zruš",IDCANCEL,50,BUTTONS_ROW, - 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" -FONT 8, "System" -BEGIN - EDITTEXT ID_EDITTEXT,3,3,115,76,ES_MULTILINE | ES_READONLY - | WS_VSCROLL -#ifndef _WIN32_WCE - PUSHBUTTON "Ano",IDOK, SB_OK_LEFT,81,SB_BUTTON_WIDTH,REPOS_BUTTON_HT - DEFPUSHBUTTON "Ne",IDCANCEL,SB_CANCEL_LEFT,81,SB_BUTTON_WIDTH,REPOS_BUTTON_HT -#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 "Určete písmeno žolíka.",IDC_BPICK, - ASKB_COLLEFT,ASKB_LABELTOP,ASKB_LABELWIDTH,ASKB_LABELHT -#ifdef FEATURE_TRAY_EDIT - LTEXT "Vyberte kámen do zásobníku.",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 "Vložit zpět",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 "Ano",IDOK,80,WCE_BOTTOM,REPOS_BUTTON_WIDTH, BUTTON_HT - PUSHBUTTON "Zruš",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 "Jméno hry" -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 "Ano",IDOK,SVGN_LEFT_COL+10,SVGN_ROW_3,REPOS_BUTTON_WIDTH, - BUTTON_HT - PUSHBUTTON "Zruš",IDCANCEL,SVGN_LEFT_COL+10+REPOS_BUTTON_WIDTH+10, - 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 "Uložené hry" -FONT 8, "System" -BEGIN - LTEXT /* wince windres can't handle split lines....*/ - "Vyberte uloženou hru. (Některá tlačítka budou nefunkční při výběru současné hry.)", - 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 "Otevřít",IDC_SVGM_OPEN, - SVGM_LEFT_COL,SVGM_ROW_3,40,14,WS_DISABLED - - PUSHBUTTON "Kopírovat",IDC_SVGM_DUP, - SVGM_LEFT_COL,SVGM_ROW_4,20,14,WS_DISABLED - PUSHBUTTON "Vymazat",IDC_SVGM_DEL, - SVGM_LEFT_COL+22,SVGM_ROW_4,28,14,WS_DISABLED - PUSHBUTTON "Přejmenovat",IDC_SVGM_CHANGE, - SVGM_LEFT_COL+52,SVGM_ROW_4,32,14,WS_DISABLED - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "Hotovo",IDOK,SVGM_LEFT_COL,SVGM_ROW_OK,REPOS_BUTTON_WIDTH, - 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" -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 "Ano",IDOK,PW_OK_LEFT,32,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - PUSHBUTTON "Zruš",IDCANCEL,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 "Omezení nápovědy" -FONT 8, "System" -BEGIN - LTEXT "Použít nejméně:",HC_MIN_LABEL,HC_LABELS_COL,HC_MINROW,60, - ROW_HEIGHT - XWCOMBO(HC_MIN_COMBO, HC_DROPDOWNS_COL,HC_MINROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Ne však více než:",HC_MAX_LABEL,HC_LABELS_COL,HC_MAXROW,60, - ROW_HEIGHT - XWCOMBO(HC_MAX_COMBO, HC_DROPDOWNS_COL,HC_MAXROW, 24, ROW_HEIGHT, 0,58,0) - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "Ano",IDOK,HC_OK_LEFT,31,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - PUSHBUTTON "Zruš",IDCANCEL,HC_CANCEL_LEFT,31,REPOS_BUTTON_WIDTH, - 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_ROW8 (PR_ROW7+PR_SPACING) -#define PR_BUTTONROW (PR_ROW8+PR_SPACING+3) - -#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 "Volby" -FONT 8, "System" -BEGIN - CONTROL "Tato hra",IDC_RADIOLOCAL,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,4,PR_ROW1,40,10 - CONTROL "Všechny hry",IDC_RADIOGLOBAL,"Button", - BS_AUTORADIOBUTTON,44,PR_ROW1,53,10 - - /* Global */ - CONTROL "Vybarvit kameny dle hráče",IDC_CHECKCOLORPLAYED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP, - 4,PR_ROW2,80,PREFS_ROW_HT - CONTROL "Povolit kurzor",IDC_CHECKSHOWCURSOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW3,60,PREFS_ROW_HT - CONTROL "Mezisoučty hry robota",IDC_CHECKROBOTSCORES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW4,90,PREFS_ROW_HT - CONTROL "Přeskočit potvrzení konce tahu",IDC_SKIPCONFIRM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW5,90,PREFS_ROW_HT - CONTROL "Skrýt hodnoty kamenů",IDC_HIDETILEVALUES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW6,90,PREFS_ROW_HT - PUSHBUTTON "Nastavení barev...",IDC_PREFCOLORS,4,PR_ROW7,70,12 - PUSHBUTTON "Změna jazyka...",IDC_PREFLOCALE,4,PR_ROW8,70,12 -#ifdef ALLOW_CHOOSE_FONTS - PUSHBUTTON "Vybrat font...",IDC_PREFFONTS,4,PR_ROW9,60,12 -#endif - - /* Per game */ - CONTROL "Chytrý robot",IDC_CHECKSMARTROBOT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,4,PR_ROW2,60, - PREFS_ROW_HT - CONTROL "Povolit nápovědu",IDC_CHECKHINTSOK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW3,80,PREFS_ROW_HT -#ifdef XWFEATURE_SEARCHLIMIT - CONTROL "Omezení nápovědy",IDC_CHECKHINTSLIMITS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8+10,PR_ROW4-2,80,10 -#endif - CONTROL "Časomíra (minuty)",TIMER_CHECK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW5,75,PREFS_ROW_HT - EDITTEXT TIMER_EDIT,75,PR_ROW5,16,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Citoslovce:",PHONIES_LABEL,4,PR_ROW6,36,PREFS_ROW_HT - XWCOMBO(PHONIES_COMBO, 44,PR_ROW6,46,PREFS_ROW_HT, 0, 58, 0) - -#ifdef FEATURE_TRAY_EDIT - CONTROL "Výběr kamenů hráčem", IDC_PICKTILES, "Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW7,90,PREFS_ROW_HT -#else -#endif -#ifndef _WIN32_WCE - DEFPUSHBUTTON "Ano",IDOK,PR_OK_LEFT,PR_BUTTONROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - PUSHBUTTON "Zruš",IDCANCEL,PR_CANCEL_LEFT,PR_BUTTONROW, - REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT -#endif -END - -#ifndef XWFEATURE_STANDALONE_ONLY - - /* Rule for this dialog, which wants to lay out different fields for the - different transports all using the same coordinates: it's always label - one one line followed by an edittext on the next. Deal with it until - CE supports layout via html (or I write a dialog layout function - myself....) */ - -# define LAB_COL 5 -# define LAB_COL_WIDTH 38 -# define CTRL_COL 15 -# define CTRL_COL_WIDTH 80 -# define CONN_LABEL_HT (LABEL_ROW_HT*2) /* try to make them all same ht! */ -# define CONN_HELP_HT 25 -# 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_3+ROW_SPACE) -# endif -# ifndef RELAY_NOEDIT_ADDR -# define CONN_ROW_5 (CONN_ROW_4+CONN_HELP_HT+5) -# define CONN_ROW_6 (CONN_ROW_5+CONN_LABEL_HT+3) -# define CONN_ROW_7 (CONN_ROW_6+ROW_SPACE+5) -# define CONN_ROW_8 (CONN_ROW_7+CONN_LABEL_HT+3) -# define BUTTON_ROW (CONN_ROW_8+ROW_SPACE) -#else -# define BUTTON_ROW (CONN_ROW_4+CONN_HELP_HT) -#endif -#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 "Spojení" -FONT 4, "System" -BEGIN - -#ifdef NEEDS_CHOOSE_CONNTYPE - LTEXT "Spojit přes:",IDC_CCONVIA_LAB,LAB_COL,CONN_ROW_1, - 40,ROW_HEIGHT - XWCOMBO(IDC_CONNECT_COMBO,CTRL_COL,CONN_ROW_2,CTRL_COL_WIDTH, - ROW_HEIGHT,0,58,0) -#endif -#if defined XWFEATURE_RELAY - LTEXT "Místnost:", - IDC_INVITE_LAB,LAB_COL,CONN_ROW_3,23,CONN_LABEL_HT - EDITTEXT INVITE_EDIT,LAB_COL+25,CONN_ROW_3,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL - LTEXT "(As host, you name the room for the game, and must " - "connect first.)", /* translate */ - IDC_INVITE_HELP_HOST,LAB_COL,CONN_ROW_4,110,CONN_HELP_HT - LTEXT "(As guest, wait for the host to connect then tell you " - "the room name.)", /* translate */ - IDC_INVITE_HELP_GUEST,LAB_COL,CONN_ROW_4,100,CONN_HELP_HT - -#ifndef RELAY_NOEDIT_ADDR - LTEXT "Název přenosu (málokdy změněno):",IDC_CRELAYNAME_LAB, - LAB_COL,CONN_ROW_5,90,CONN_LABEL_HT - EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL - LTEXT "Port přenosu (málokdy změněn):",IDC_CRELAYPORT_LAB,LAB_COL, - CONN_ROW_7,90,CONN_LABEL_HT - EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_ROW_8,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER -#endif -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Přenos není podporován.",IDC_INVITE_LAB,LAB_COL, - CONN_ROW_3,40,40 -#endif - -#if defined XWFEATURE_IP_DIRECT - LTEXT "Jméno nebo adresa hostitele",IDC_IPNAME_LAB,LAB_COL,CONN_ROW_3,90, - ROW_HEIGHT - EDITTEXT IPNAME_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Přímé IP spojení není podporováno.",IDC_IPNAME_LAB,LAB_COL, - CONN_ROW_3,40,40 -#endif - -#if defined XWFEATURE_SMS - LTEXT "Telefon hostitele:",IDC_SMS_PHONE_LAB,LAB_COL,CONN_ROW_3,60, - ROW_HEIGHT - EDITTEXT IDC_SMS_PHONE_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Port hostitele:",IDC_SMS_PORT_LAB,LAB_COL,CONN_ROW_5,60,ROW_HEIGHT - EDITTEXT IDC_SMS_PORT_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Krátké zprávy nejsou podporovány.", - IDC_SMS_PHONE_LAB,LAB_COL,CONN_ROW_3,40,ROW_HEIGHT -#endif - -#ifndef _WIN32_WCE - PUSHBUTTON "Ano",IDOK,9,BUTTON_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - DEFPUSHBUTTON "Zruš",IDCANCEL,70,BUTTON_ROW, - 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 43 -#define CLR_SAMPLE_WIDTH 12 -#define CLR_LAB_HT 16 -#define CLR_LAB_ONELINE_ADD 2 -#define CLR_BUT_WIDTH 12 -#define CLR_SAMP_HT CLR_LAB_HT -#define CLR_BUT_HT 12 -#define CLR_BUT_OFFSET ((CLR_LAB_HT-CLR_BUT_HT)/2) - -#define CLR_SMALL_GAP (CLR_LAB_HT+2) -#define CLR_LRG_GAP (CLR_LAB_HT+4) - -#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) -#ifdef _WIN32_WCE -# define COLORSDLG_HT CLR_BUTTON_ROW -#else -# define COLORSDLG_HT CLR_BUTTON_ROW + BUTTON_HT + 3 -#endif - -#define COLOR_LABEL(txt,id,yy) \ - LTEXT txt,id,CLR_COL_1,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,yy) \ - PUSHBUTTON "",id2,CLR_COL_2,yy,CLR_BUT_WIDTH,CLR_SAMP_HT,BS_OWNERDRAW \ - PUSHBUTTON "Upravit",id1,CLR_COL_2+CLR_SAMPLE_WIDTH+4,yy+CLR_BUT_OFFSET,\ - 32,CLR_BUT_HT,BS_NOTIFY - -IDD_COLORSDLG DIALOG DISCARDABLE 0, 20, CLR_WIDTH, COLORSDLG_HT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Volby barev" -FONT 8, "System" -BEGIN - COLOR_LABEL("Zdvojené písmeno:",DLBLTR_LABEL,CLR_ROW_1) - COLOR_SAMPLE(DLBLTR_BUTTON,DLBLTR_SAMPLE,CLR_ROW_1) - - COLOR_LABEL("Zdvojené slovo:",DBLWRD_LABEL,CLR_ROW_2 ) - COLOR_SAMPLE(DBLWRD_BUTTON,DBLWRD_SAMPLE,CLR_ROW_2) - COLOR_LABEL("Ztrojené písmeno:",TPLLTR_LABEL,CLR_ROW_3 ) - COLOR_SAMPLE(TPLLTR_BUTTON,TPLLTR_SAMPLE,CLR_ROW_3) - - COLOR_LABEL("Ztrojené slovo:",TPLWRD_LABEL,CLR_ROW_4) - COLOR_SAMPLE(TPLWRD_BUTTON,TPLWRD_SAMPLE,CLR_ROW_4) - COLOR_LABEL("Prázdné políčko:",EMPCELL_LABEL,CLR_ROW_5) - COLOR_SAMPLE(EMPCELL_BUTTON,EMPCELL_SAMPLE,CLR_ROW_5) - COLOR_LABEL("Pozadí kamene:",TBACK_LABEL,CLR_ROW_6) - COLOR_SAMPLE(TBACK_BUTTON,TBACK_SAMPLE,CLR_ROW_6) - COLOR_LABEL("Zvýraznění:",FOCUSCLR_LABEL,CLR_ROW_7+CLR_LAB_ONELINE_ADD) - COLOR_SAMPLE(FOCUSCLR_BUTTON,FOCUSCLR_SAMPLE,CLR_ROW_7) - COLOR_LABEL("Hráč 1:",PLAYER1_LABEL,CLR_ROW_8+CLR_LAB_ONELINE_ADD) - COLOR_SAMPLE(PLAYER1_BUTTON,PLAYER1_SAMPLE,CLR_ROW_8) - COLOR_LABEL("Hráč 2:",PLAYER2_LABEL,CLR_ROW_9+CLR_LAB_ONELINE_ADD) - COLOR_SAMPLE(PLAYER2_BUTTON,PLAYER2_SAMPLE,CLR_ROW_9) - COLOR_LABEL("Hráč 3:",PLAYER3_LABEL,CLR_ROW_10+CLR_LAB_ONELINE_ADD) - COLOR_SAMPLE(PLAYER3_BUTTON,PLAYER3_SAMPLE,CLR_ROW_10) - COLOR_LABEL("Hráč 4:",PLAYER4_LABEL,CLR_ROW_11+CLR_LAB_ONELINE_ADD) - COLOR_SAMPLE(PLAYER4_BUTTON,PLAYER4_SAMPLE,CLR_ROW_11) - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "Ano",IDOK,CLR_OK_LEFT,CLR_BUTTON_ROW, - REPOS_BUTTON_WIDTH,BUTTON_HT,BS_NOTIFY - PUSHBUTTON "Zruš",IDCANCEL,CLR_CANCEL_LEFT,CLR_BUTTON_ROW, - 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("Červená:", CLREDIT_ROW_1, RED_LABEL, RED_EDIT, CLREDT_SLIDER1 ) - COLOR_EDIT_LINE("Zelená:", CLREDIT_ROW_2, GREEN_LABEL, GREEN_EDIT, CLREDT_SLIDER2 ) - COLOR_EDIT_LINE("Modrá:", CLREDIT_ROW_3, BLUE_LABEL, BLUE_EDIT, CLREDT_SLIDER3 ) - - /* 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 "Ano",IDOK,CLRE_OK_LEFT,56,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Zruš",IDCANCEL,CLRE_CANCEL_LEFT,56,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END - -#endif - -#ifdef ALLOW_CHOOSE_FONTS -IDD_FONTSSDLG DIALOG DISCARDABLE 0, 0, 120, 115 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "" /* set by code */ -FONT 8, "System" -BEGIN - - LTEXT "Font:",FONTS_LABEL,5,2,25,12 - XWCOMBO(FONTS_COMBO, 30,2,70,12,0,58,0) - - LTEXT "Velikost:",FONTSIZE_LABEL,5,16,25,12 - XWCOMBO(FONTSIZE_COMBO, 30,16,25,12,0,58,0) - -# ifndef _WIN32_WCE - DEFPUSHBUTTON "Ano",IDOK,20,100,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Zruš",IDCANCEL,100,100,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END -#endif - -IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 80 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "Výběr jazyka" -FONT 8, "System" -BEGIN - LTEXT "Vyberte jazyk pro nabídku a texty dialogů. (Soubory pro podporu dalších jazyků můžete stáhnout z xwords.sf.net.)", - LOCALES_LABEL,LEFT_COL,2,80,50 - - XWCOMBO(LOCALES_COMBO,LEFT_COL,53,70,12,0,58,0) -# ifndef _WIN32_WCE - DEFPUSHBUTTON "Ano",IDOK,LEFT_COL,70,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Zruš",IDCANCEL,40,70,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_MENU "Nabídka" - IDS_DUMMY "--" - IDS_CANCEL "Zruš" - IDS_OK "Ano" - IDS_DONE "Hotovo" - IDS_LANGUAGE_NAME "Čeština" - IDS_NEW_GAME "Nová hra" - IDS_ABOUT "Crosswords " ABOUT_VERSION " (rev " SVN_REV ") "\ - "pro Windows Mobile. Copyright 1998-2010 by "\ - "Eric House. Tento software je šířen pod licencí "\ - "GNU Public License.\r\r"\ - "Slovníky, manuály, nebo zdrojové kódy naleznete na "\ - "http://xwords.sf.net nebo http://eehouse.org/xwords/." - IDS_DICTLOC "Slovníky ke hře (.xwd file) instalujte do stejné "\ - "složky, ve které je umístěn soubor Crosswords.exe, nebo "\ - "na externí kartu do složky nazvané Crosswords, "\ - "např. do \\Storage Card\\Crosswords. "\ - "Slovníky naleznete na http://xwords.sf.net nebo "\ - "http://eehouse.org/xwords." - IDS_SAVENAME "Pojmenujte hru. (Hru můžete později "\ - "přejmenovat v dialogu uložených her.)" - IDS_DUPENAME "Pojmenujte kopii hry." - IDS_RENAME "Pojmenujte hru." - - IDS_REMAINING_TILES_ADD "+ %d [všechny zbylé kameny]" - IDS_UNUSED_TILES_SUB "- %d [nepoužité kameny]" - IDS_BONUS_ALL "Prémie za užití všech kamenů: 50" XP_CR - IDS_TURN_SCORE "Bodový zisk za tah: %d" XP_CR - IDS_COMMIT_CONFIRM - "Souhlasíte s posledním tahem?" XP_CR - IDS_LOCAL_NAME "%s" - IDS_IGNORE_L "Ignorovat" - IDS_WARN_L "Upozornit" - IDS_DISALLOW_L "Odmítnout" - IDS_NONLOCAL_NAME "%s (vzdálený)" - IDS_TIME_PENALTY_SUB " - %d [čas]" - IDS_CUMULATIVE_SCORE "Celkový bodový zisk: %d" XP_CR - IDS_MOVE_ACROSS "tah (od %s napříč)" XP_CR - IDS_MOVE_DOWN "tah (od %s dolu)" XP_CR - IDS_TRAY_AT_START "Zásobník na začátku: %s" XP_CR - IDS_NEW_TILES "Nové kameny: %s" XP_CR - IDS_TRADED_FOR "Směněno %s za %s." - IDS_PASS "pass" XP_CR - IDS_PHONY_REJECTED "Neplatné slovo v tahu. Tah ztracen!" XP_CR - IDS_ROBOT_TRADED "Robot tento tah směnil kameny %d." - IDS_ROBOT_MOVED "Robot hrál takto:" XP_CR - IDS_REMOTE_MOVEDF "Vzdálený hráč hrál takto:" XP_CR - IDS_PASSED "Vynecháno" - IDS_SUMMARYSCORED "%s:%d" - IDS_TRADED "Směněno %d" - IDS_LOSTTURN "Ztracený tah" - IDS_TOTALPLAYERS "Počet hráčů:" - IDS_VALUES_HEADER "%s počet/hodnota:" XP_CR - IDS_QUERY_TRADE "Opravdu chcete směnit vybrané kameny?" - - IDS_DOUBLE_LETTER "Zdvojené písmeno" - IDS_DOUBLE_WORD "Zdvojené slovo" - IDS_TRIPLE_LETTER "Ztrojené písmeno" - IDS_TRIPLE_WORD "Ztrojené slovo" - IDS_INTRADE_MW "Směna kamenů." XP_CR "Pro dokončení stiskněte "\ - XP_CR "'Konec tahu'" - - IDS_TILES_NOT_IN_LINE "Všechny kameny položené během tahu musí být v linii." - IDS_NO_EMPTIES_IN_TURN "Mezi kameny položenými během tahu nesmí být "\ - "prázdná políčka." - IDS_TWO_TILES_FIRST_MOVE "V prvním tahu se musí položit nejméně dva kameny." - IDS_TILES_MUST_CONTACT "Kameny položené během tahu se musí dotýkat předchozích, "\ - "nebo v prvním tahu procházet středovým políčkem ." - IDS_NOT_YOUR_TURN "Toto nelze, nejste na tahu!" - IDS_NO_PEEK_ROBOT_TILES "Nelze prohlížet kameny robota" - IDS_TOO_FEW_TILES_LEFT_TO_TRADE "Pro směnu je málo kamenů v zásobníku." - IDS_CANT_UNDO_TILEASSIGN "Návrat zpět nelze provést." - IDS_CANT_HINT_WHILE_DISABLED "Pro tuto hru je nápověda vypnuta."\ - "Pro novou hru je možné ji zapnout ve volbách." - - IDS_COUNTSVALS_L "Počty a hodnoty kamenů" - IDS_REMTILES_L "Zbývající kameny" - IDS_GAMEHIST_L "Historie hry" - IDS_FINALSCORE_L "Konečné skóre" - IDS_QUESTION_L "Dotaz" - IDS_FYI_L "Upozornění" - IDS_ILLEGALWRD_L "Neplatné slovo" - IDS_WRDNOTFOUND "Slovo(a) %s nebylo(a) ve slovníku nalezeno(a)." - IDS_USEANYWAY "Přesto povolit?" - IDS_CANNOTOPEN_GAME "Nelze otevřít uložená hra." - IDS_NODICT_L "Nebyl nalezen slovník" - IDS_ABOUT_L "O hře Crosswords" - IDS_OVERWRITE "Opravdu chcete přepsat rozehranou hru?" - IDS_ENDNOW "Opravdu chcete skončit rozehranou hru?" - IDS_CANNOTOPEN_DICT "Nedaří se otevřít slovník: %s" - IDS_CONFIM_DELETE "Opravdu chcete vymazat vybranou hru? "\ - "Vymazaná hra již nelze vrátit zpět." - - IDS_ROLE_STANDALONE "Samostatný" - IDS_ROLE_HOST "Hostitel" /* translate (confirm: "host") */ - IDS_ROLE_GUEST "Guest" /* translate (confirm: "guest") */ - IDS_PLAYER_FORMAT "Hráč %d" - IDS_UNTITLED_FORMAT "Neoznačený %d" - IDS_PASSWDFMT_L "Vložte heslo pro %ls:" - - IDS_FILEEXISTSFMT_L "Soubor %s již existuje." - IDS_NEED_TOUCH "Pro toto je třeba mít dotykovou obrazovku." - IDS_EDITCOLOR_FORMAT "Upravit barvu pro %s" - - IDS_LANG_CHANGE_RESTART "Změna jazyka se projeví po restartu hry." - -#ifndef XWFEATURE_STANDALONE_ONLY - IDS_RESEND_STANDALONE "Hrajete pouze na tomto přístroji. Není co posílat." - IDS_PHONE_OFF "Crosswords cannot connect because the phone "\ - "appears to be off. Please restart Crosswords "\ - "after turning it on." /* translate */ - IDS_NETWORK_FAILED "Unable to bring up networking." /* translate */ - IDS_CONN_RELAY_L "Přenos" - IDS_CONN_DIRECT "Přímé spojení" - IDS_LOCALPLAYERS "Místní hráči:" - IDS_NO_PEEK_REMOTE_TILES "Nelze prohlížet kameny vzdálených hráčů!" - IDS_REG_UNEXPECTED_USER "Odmítnut pokus o přípojení nečekaného "\ - "uživatele." - IDS_SERVER_DICT_WINS "Nesoulad mezi slovníky hostitele a hosta. " - "Hostitel vyhrává." - IDS_REG_SERVER_SANS_REMOTE "Minimálně jeden hráč musí být označene jako vzdálený, "\ - "aby jste mohl začít hrát jako hostitel." - -# ifdef XWFEATURE_SMS - IDS_SMS_CONN_L "Krátké textové zprávy" -# endif -# ifdef XWFEATURE_IP_DIRECT - IDS_DIRECT_CONN_L "Přímé spojení" -# endif -# ifdef XWFEATURE_RELAY - IDS_XWRELAY_ERROR_TIMEOUT "Vypršel časový limit přenosu. Pravděpodobně "\ - "se neohlásil další vzdálený hráč." - IDS_ERROR_HEART_YOU "Byl jste odpojen z přenosu, pravděpodobně "\ - "jste se dlouho neukázal." - IDS_XWRELAY_ERROR_HEART_OTHER "Bylo ztraceno spojení s dalším zařízením ve hře." -/* IDS_XWRELAY_ERROR_LOST_OTHER "Bylo ztraceno spojení s dalším zařízením ve hře." */ - - IDS_XWRELAY_RELAY_INCOMPAT "This version of Crosswords does not match the "\ - "relay. You probably need to upgrade to the "\ - "latest version." /* translate */ - IDS_RELAY_HOST_WAITINGD "Connected to relay as host. Waiting for "\ - "%d player[s]." /* translate */ - IDS_RELAY_GUEST_WAITINGD "Connected to relay as guest. Still waiting "\ - "for %d player[s]." /* translate */ - IDS_RELAY_ALLHERE "All players are here." /* translate */ - - IDS_ERROR_NO_ROOM "No such room. Has the host connected yet "\ - "to reserve it?" /* translate */ - IDS_ERROR_DUP_ROOM "That room is reserved by another host. "\ - "Rename your room, become a guest, or try "\ - "again in a few minutes." /* translate */ - IDS_ERROR_TOO_MANY "The host is not expecting this many players. "\ - "Please reduce the number of Local players." /* translate */ -# endif -#endif - -END - -#ifdef AM_BASE_LANGUAGE -# include "../common_rsrc.rc" -#endif - -#endif diff --git a/xwords4/wince/l10n/xwords4_english.rc b/xwords4/wince/l10n/xwords4_english.rc deleted file mode 100755 index f688ae9bb..000000000 --- a/xwords4/wince/l10n/xwords4_english.rc +++ /dev/null @@ -1,1062 +0,0 @@ -// -*- mode: c; compile-command: "cd ../ && 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" - BEGIN - MENUITEM "Turn done", ID_MOVE_TURNDONE - MENUITEM "Juggle", ID_MOVE_JUGGLE - MENUITEM "Flip", ID_MOVE_FLIP - MENUITEM "Trade", ID_MOVE_TRADE - MENUITEM "Hide tray", ID_MOVE_HIDETRAY - - POPUP "Undo" - BEGIN - MENUITEM "Undo current", ID_MOVE_UNDOCURRENT - MENUITEM "Undo last", ID_MOVE_UNDOLAST - END - - POPUP "Hint" - BEGIN - MENUITEM "Next hint", ID_MOVE_NEXTHINT - MENUITEM "Previous hint", ID_MOVE_PREVHINT - MENUITEM "Hint", ID_MOVE_HINT -#ifdef XWFEATURE_SEARCHLIMIT - MENUITEM "Limited hint...", ID_MOVE_LIMITEDHINT -#endif - MENUITEM SEPARATOR - MENUITEM "Show values", ID_MOVE_VALUES - END - - POPUP "Game" - BEGIN - MENUITEM "Tile counts and values", ID_GAME_TILECOUNTSANDVALUES - MENUITEM "Tiles left", ID_GAME_TILESLEFT - MENUITEM SEPARATOR - MENUITEM "Game info", ID_GAME_GAMEINFO - MENUITEM "History", ID_GAME_HISTORY - MENUITEM "Final scores", ID_GAME_FINALSCORES -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - MENUITEM SEPARATOR - MENUITEM "Resend messages", ID_GAME_RESENDMSGS -#endif - END - - POPUP "File" - BEGIN - MENUITEM "Full screen", ID_FILE_FULLSCREEN - MENUITEM SEPARATOR - MENUITEM "New game...", ID_FILE_NEWGAME - MENUITEM "Saved games...", ID_FILE_SAVEDGAMES - MENUITEM "Preferences...", ID_FILE_PREFERENCES - MENUITEM SEPARATOR - MENUITEM "About...", ID_FILE_ABOUT - MENUITEM SEPARATOR - MENUITEM "Exit", ID_FILE_EXIT - 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" - -#ifndef AM_BASE_LANGUAGE -DLL_VERS_RESOURCE -#endif - -///////////////////////////////////////////////////////////////////////////// -// -// 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 -/* How tall does a single line of label text turn out to be */ -# define LABEL_ROW_HT 10 -#ifdef CEFEATURE_CANSCROLL -# define ROW_HEIGHT 11 -#else -# define ROW_HEIGHT 12 -#endif - -// ******** IDD_GAMEINFO DIALOG ********* -#define GAMEINFO_WIDTH 116 -#ifdef CEFEATURE_CANSCROLL -# define ROW_SPACE 12 -# define ROW_SPACE_PL 11 -#else -# 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 50 -# define SERVERCONF_ROW (SERVERROLE_ROW+ROW_SPACE+3) -# define NPLAYERS_ROW (SERVERCONF_ROW+ROW_SPACE+3) -# define GAME_REMOTE_LEFT 1 -# define GAME_NAME_LEFT 11 -# define ROBOT_LABEL_ADJUST 10 -# define GAME_ROBOT_LEFT (GAME_NAME_LEFT+GAME_NAME_WIDTH+2) -# define GAME_PWD_LEFT (GAME_ROBOT_LEFT + CHECK_WIDTH + 4) -# define NAME_LABEL_ADJUST 20 -# define GAME_NAMELABEL_LEFT (GAME_NAME_LEFT+NAME_LABEL_ADJUST) -# define GAME_NAMELABEL_WIDTH (GAME_NAME_WIDTH-ROBOT_LABEL_ADJUST-NAME_LABEL_ADJUST) -# define GAME_ROBOTLABEL_LEFT (GAME_ROBOT_LEFT-ROBOT_LABEL_ADJUST) -# define GAME_ROBOTLABEL_WIDTH (GAME_PWD_LEFT-GAME_ROBOT_LEFT+ROBOT_LABEL_ADJUST) -# define GAME_PWDLABEL_LEFT (GAME_PWD_LEFT) -# define GAME_PWDLABEL_WIDTH (GAMEINFO_WIDTH-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 JUGGLE_ROW (PLAYER_ROW_4+ROW_SPACE) -#define DICTPICK_LAB_ROW (JUGGLE_ROW+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, GAMEINFO_WIDTH, GAMEINFO_HEIGHT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Game info" -FONT 8, "System" -BEGIN -#ifndef XWFEATURE_STANDALONE_ONLY - LTEXT "Role:",IDC_ROLELABEL,LEFT_COL,SERVERROLE_ROW,20,8 - XWCOMBO(IDC_ROLECOMBO,26,SERVERROLE_ROW,70,ROW_HEIGHT,0,58,0) - - PUSHBUTTON "Configure role",GIROLECONF_BUTTON,LEFT_COL+10, - SERVERCONF_ROW,60,ROW_HEIGHT -#endif - - LTEXT "",IDC_TOTAL_LABEL,LEFT_COL,NPLAYERS_ROW,66,8 - XWCOMBO(IDC_NPLAYERSCOMBO,68,NPLAYERS_ROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Name",IDC_NAMELABEL,GAME_NAMELABEL_LEFT, - LABELS_ROW,GAME_NAMELABEL_WIDTH,8,SS_NOPREFIX - LTEXT "Robot",IDC_ROBOTLABEL,GAME_ROBOTLABEL_LEFT,LABELS_ROW, - GAME_ROBOTLABEL_WIDTH,8 - LTEXT "Pwd",IDC_PASSWDLABEL,GAME_PWDLABEL_LEFT,LABELS_ROW, - GAME_PWDLABEL_WIDTH,8 - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - LTEXT "Remote",IDC_REMOTE_LABEL,LEFT_COL,LABELS_ROW,28,8,SS_NOPREFIX - 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 ) - - PUSHBUTTON "Juggle players",GIJUGGLE_BUTTON,LEFT_COL+10,JUGGLE_ROW, - 60,BUTTON_HT - - LTEXT "Dictionary:",IDC_DICTLABEL,LEFT_COL,DICTPICK_LAB_ROW,36,8, - 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,BUTTON_HT - -#ifndef _WIN32_WCE - PUSHBUTTON "OK",IDOK,20,BUTTONS_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - DEFPUSHBUTTON "Cancel",IDCANCEL,50,BUTTONS_ROW, - 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" -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 - DEFPUSHBUTTON "No",IDCANCEL,SB_CANCEL_LEFT,81,SB_BUTTON_WIDTH,REPOS_BUTTON_HT -#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" -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, - BUTTON_HT - PUSHBUTTON "Cancel",IDCANCEL,SVGN_LEFT_COL+10+REPOS_BUTTON_WIDTH+10, - 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" -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.)", - 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, - SVGM_LEFT_COL,SVGM_ROW_3,40,14,WS_DISABLED - - PUSHBUTTON "Dup.",IDC_SVGM_DUP, - SVGM_LEFT_COL,SVGM_ROW_4,20,14,WS_DISABLED - PUSHBUTTON "Delete",IDC_SVGM_DEL, - SVGM_LEFT_COL+22,SVGM_ROW_4,28,14,WS_DISABLED - PUSHBUTTON "Rename",IDC_SVGM_CHANGE, - 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, - 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" -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 - PUSHBUTTON "Cancel",IDCANCEL,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" -FONT 8, "System" -BEGIN - LTEXT "Use at least:",HC_MIN_LABEL,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 - 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 - PUSHBUTTON "Cancel",IDCANCEL,HC_CANCEL_LEFT,31,REPOS_BUTTON_WIDTH, - 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_ROW8 (PR_ROW7+PR_SPACING) -#define PR_BUTTONROW (PR_ROW8+PR_SPACING+3) - -#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" -FONT 8, "System" -BEGIN - CONTROL "This game",IDC_RADIOLOCAL,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,4,PR_ROW1,47,10 - CONTROL "All games",IDC_RADIOGLOBAL,"Button", - BS_AUTORADIOBUTTON,52,PR_ROW1,53,10 - - /* Global */ - CONTROL "Color played tiles",IDC_CHECKCOLORPLAYED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP, - 8,PR_ROW2,80,PREFS_ROW_HT - CONTROL "Enable cursor",IDC_CHECKSHOWCURSOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW3,80,PREFS_ROW_HT - CONTROL "Explain robot scores",IDC_CHECKROBOTSCORES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW4,80,PREFS_ROW_HT - CONTROL "Skip turn confirmation",IDC_SKIPCONFIRM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW5,90,PREFS_ROW_HT - CONTROL "Hide tile values",IDC_HIDETILEVALUES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW6,80,PREFS_ROW_HT - PUSHBUTTON "Edit colors...",IDC_PREFCOLORS,8,PR_ROW7,80,12 - PUSHBUTTON "Change language...",IDC_PREFLOCALE,8,PR_ROW8,80,12 -#ifdef ALLOW_CHOOSE_FONTS - PUSHBUTTON "Choose font...",IDC_PREFFONTS,8,PR_ROW9,60,12 -#endif - - /* Per game */ - CONTROL "Smart robot",IDC_CHECKSMARTROBOT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,8,PR_ROW2,60, - PREFS_ROW_HT - CONTROL "Allow hints",IDC_CHECKHINTSOK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW3,60,PREFS_ROW_HT -#ifdef XWFEATURE_SEARCHLIMIT - CONTROL "Hint limits",IDC_CHECKHINTSLIMITS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8+10,PR_ROW4-2,50,10 -#endif - CONTROL "Timer on (minutes)",TIMER_CHECK,"Button", - 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 - 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", - 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 - PUSHBUTTON "Cancel",IDCANCEL,PR_CANCEL_LEFT,PR_BUTTONROW, - REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT -#endif -END - -#ifndef XWFEATURE_STANDALONE_ONLY - - /* Rule for this dialog, which wants to lay out different fields for the - different transports all using the same coordinates: it's always label - one one line followed by an edittext on the next. Deal with it until - CE supports layout via html (or I write a dialog layout function - myself....) */ - -# define LAB_COL 5 -# define LAB_COL_WIDTH 38 -# define CTRL_COL 15 -# define CTRL_COL_WIDTH 80 -# define CONN_LABEL_HT (LABEL_ROW_HT) /* try to make them all same ht! */ -# define CONN_HELP_HT 25 -# 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_3+ROW_SPACE) -# endif -# ifndef RELAY_NOEDIT_ADDR -# define CONN_ROW_5 (CONN_ROW_4+CONN_HELP_HT+5) -# define CONN_ROW_6 (CONN_ROW_5+CONN_LABEL_HT+3) -# define CONN_ROW_7 (CONN_ROW_6+ROW_SPACE+5) -# define CONN_ROW_8 (CONN_ROW_7+CONN_HELP_HT+3) -# define CONN_ROW_9 (CONN_ROW_8+CONN_LABEL_HT+3) -# define BUTTON_ROW (CONN_ROW_9+CONN_HELP_HT) -# else -# define BUTTON_ROW (CONN_ROW_4+CONN_HELP_HT) -#endif - -#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" -FONT 8, "System" -BEGIN - -#ifdef NEEDS_CHOOSE_CONNTYPE - LTEXT "Connect via:",IDC_CCONVIA_LAB,LAB_COL,CONN_ROW_1, - 40,ROW_HEIGHT - XWCOMBO(IDC_CONNECT_COMBO,CTRL_COL,CONN_ROW_2,60,ROW_HEIGHT,0,58,0) -#endif -#if defined XWFEATURE_RELAY - LTEXT "Room:", - IDC_INVITE_LAB,LAB_COL,CONN_ROW_3,23,CONN_LABEL_HT - EDITTEXT INVITE_EDIT,LAB_COL+25,CONN_ROW_3,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL - LTEXT "(As host, you name the room for the game, and must " - "connect first.)", - IDC_INVITE_HELP_HOST,LAB_COL,CONN_ROW_4,110,CONN_HELP_HT - LTEXT "(As guest, wait for the host to connect then tell you " - "the room name.)", - IDC_INVITE_HELP_GUEST,LAB_COL,CONN_ROW_4,100,CONN_HELP_HT - -#ifndef RELAY_NOEDIT_ADDR - LTEXT "Relay name:",IDC_CRELAYNAME_LAB, - LAB_COL,CONN_ROW_5,30,CONN_LABEL_HT - EDITTEXT RELAYNAME_EDIT,LAB_COL+30,CONN_ROW_5,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL -/* LTEXT "(This should be eehouse.org unless you really know what you're doing)", */ -/* IDC_INVITE_HELP_RELAY,LAB_COL,CONN_ROW_6,110,CONN_HELP_HT */ - - - LTEXT "Relay port:",IDC_CRELAYPORT_LAB,LAB_COL,CONN_ROW_8, - 30,CONN_LABEL_HT - EDITTEXT RELAYPORT_EDIT,LAB_COL+30,CONN_ROW_8,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER -/* LTEXT "(This should be 10999 unless you really know what you're doing)", */ -/* IDC_INVITE_HELP_PORT,LAB_COL,CONN_ROW_9,110,CONN_HELP_HT */ -#endif -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Relay connection not supported.",IDC_INVITE_LAB,LAB_COL, - CONN_ROW_3,40,40 -#endif - -#if defined XWFEATURE_IP_DIRECT - LTEXT "Host name or address",IDC_IPNAME_LAB,LAB_COL,CONN_ROW_3,90, - ROW_HEIGHT - EDITTEXT IPNAME_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Direct IP connection not supported.",IDC_IPNAME_LAB,LAB_COL, - CONN_ROW_3,40,40 -#endif - -#if defined XWFEATURE_SMS - LTEXT "Host Phone:",IDC_SMS_PHONE_LAB,LAB_COL,CONN_ROW_3,60, - ROW_HEIGHT - 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 - EDITTEXT IDC_SMS_PORT_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "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 - DEFPUSHBUTTON "Cancel",IDCANCEL,70,BUTTON_ROW, - 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 - -IDD_COLORSDLG DIALOG DISCARDABLE 0, 20, CLR_WIDTH, COLORSDLG_HT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Color preferences" -FONT 8, "System" -BEGIN - COLOR_BUTTON("Double letter:",DLBLTR_LABEL,CLR_COL_1,CLR_ROW_1) - COLOR_SAMPLE(DLBLTR_BUTTON,DLBLTR_SAMPLE,CLR_COL_2,CLR_ROW_1) - - COLOR_BUTTON("Double word:",DBLWRD_LABEL,CLR_COL_1,CLR_ROW_2 ) - COLOR_SAMPLE(DBLWRD_BUTTON,DBLWRD_SAMPLE,CLR_COL_2,CLR_ROW_2) - COLOR_BUTTON("Triple letter:",TPLLTR_LABEL,CLR_COL_1,CLR_ROW_3 ) - COLOR_SAMPLE(TPLLTR_BUTTON,TPLLTR_SAMPLE,CLR_COL_2,CLR_ROW_3) - - COLOR_BUTTON("Triple word:",TPLWRD_LABEL,CLR_COL_3,CLR_ROW_4) - COLOR_SAMPLE(TPLWRD_BUTTON,TPLWRD_SAMPLE,CLR_COL_4,CLR_ROW_4) - COLOR_BUTTON("Empty cell:",EMPCELL_LABEL,CLR_COL_1,CLR_ROW_5) - COLOR_SAMPLE(EMPCELL_BUTTON,EMPCELL_SAMPLE,CLR_COL_2,CLR_ROW_5) - COLOR_BUTTON("Tile back:",TBACK_LABEL,CLR_COL_3,CLR_ROW_6) - COLOR_SAMPLE(TBACK_BUTTON,TBACK_SAMPLE,CLR_COL_4,CLR_ROW_6) - COLOR_BUTTON("Focus color:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_7) - COLOR_SAMPLE(FOCUSCLR_BUTTON,FOCUSCLR_SAMPLE,CLR_COL_2,CLR_ROW_7) - COLOR_BUTTON("Player 1:",PLAYER1_LABEL,CLR_COL_1,CLR_ROW_8) - COLOR_SAMPLE(PLAYER1_BUTTON,PLAYER1_SAMPLE,CLR_COL_2,CLR_ROW_8) - COLOR_BUTTON("Player 2:",PLAYER2_LABEL,CLR_COL_3,CLR_ROW_9) - COLOR_SAMPLE(PLAYER2_BUTTON,PLAYER2_SAMPLE,CLR_COL_4,CLR_ROW_9) - COLOR_BUTTON("Player 3:",PLAYER3_LABEL,CLR_COL_1,CLR_ROW_10) - COLOR_SAMPLE(PLAYER3_BUTTON,PLAYER3_SAMPLE,CLR_COL_2,CLR_ROW_10) - COLOR_BUTTON("Player 4:",PLAYER4_LABEL,CLR_COL_3,CLR_ROW_11) - COLOR_SAMPLE(PLAYER4_BUTTON,PLAYER4_SAMPLE,CLR_COL_4,CLR_ROW_11) - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "OK",IDOK,CLR_OK_LEFT,CLR_BUTTON_ROW, - REPOS_BUTTON_WIDTH,BUTTON_HT,BS_NOTIFY - PUSHBUTTON "Cancel",IDCANCEL,CLR_CANCEL_LEFT,CLR_BUTTON_ROW, - 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 ) - COLOR_EDIT_LINE("Green:", CLREDIT_ROW_2, GREEN_LABEL, GREEN_EDIT, CLREDT_SLIDER2 ) - COLOR_EDIT_LINE("Blue:", CLREDIT_ROW_3, BLUE_LABEL, BLUE_EDIT, CLREDT_SLIDER3 ) - - /* 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, - REPOS_BUTTON_HT - PUSHBUTTON "Cancel",IDCANCEL,CLRE_CANCEL_LEFT,56,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END - -#endif - -#ifdef ALLOW_CHOOSE_FONTS -IDD_FONTSSDLG DIALOG DISCARDABLE 0, 0, 120, 115 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "" /* set by code */ -FONT 8, "System" -BEGIN - - LTEXT "Fonts:",FONTS_LABEL,5,2,25,12 - XWCOMBO(FONTS_COMBO, 30,2,70,12,0,58,0) - - LTEXT "Size:",FONTSIZE_LABEL,5,16,25,12 - XWCOMBO(FONTSIZE_COMBO, 30,16,25,12,0,58,0) - -# ifndef _WIN32_WCE - DEFPUSHBUTTON "OK",IDOK,20,100,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Cancel",IDCANCEL,100,100,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END -#endif - -IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 80 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "Language Picker" -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.)", - LOCALES_LABEL,LEFT_COL,2,80,50 - - XWCOMBO(LOCALES_COMBO,LEFT_COL,53,70,12,0,58,0) -# ifndef _WIN32_WCE - DEFPUSHBUTTON "OK",IDOK,LEFT_COL,70,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Cancel",IDCANCEL,40,70,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_MENU "Menu" - IDS_DUMMY "--" - IDS_CANCEL "Cancel" - IDS_OK "Ok" - IDS_DONE "Done" - IDS_LANGUAGE_NAME "English" - IDS_NEW_GAME "New Game" - IDS_ABOUT "Crosswords " ABOUT_VERSION " (rev " SVN_REV ") "\ - "for Windows Mobile. Copyright 1998-2010 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/." - 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." - IDS_SAVENAME "Enter a name for the current game. (You can change the "\ - "name later using the Saved Games dialog.)" - IDS_DUPENAME "Enter a name for a copy of this game." - IDS_RENAME "Enter a new name for this game." - - IDS_REMAINING_TILES_ADD "+ %d [all remaining tiles]" - IDS_UNUSED_TILES_SUB "- %d [unused tiles]" - IDS_BONUS_ALL "Bonus for using all tiles: 50" XP_CR - IDS_TURN_SCORE "Score for turn: %d" XP_CR - IDS_COMMIT_CONFIRM - "Commit the current move?" XP_CR - IDS_LOCAL_NAME "%s" - IDS_IGNORE_L "Ignore" - IDS_WARN_L "Warn" - IDS_DISALLOW_L "Disallow" - IDS_NONLOCAL_NAME "%s (remote)" - IDS_TIME_PENALTY_SUB " - %d [time]" - IDS_CUMULATIVE_SCORE "Cumulative score: %d" XP_CR - IDS_MOVE_ACROSS "move (from %s across)" XP_CR - IDS_MOVE_DOWN "move (from %s down)" XP_CR - IDS_TRAY_AT_START "Tray at start: %s" XP_CR - IDS_NEW_TILES "New tiles: %s" XP_CR - IDS_TRADED_FOR "Traded %s for %s." - IDS_PASS "pass" XP_CR - IDS_PHONY_REJECTED "Illegal word in move; turn lost!" XP_CR - IDS_ROBOT_TRADED "Robot traded tiles %d this turn." - IDS_ROBOT_MOVED "The robot made this move:" XP_CR - IDS_REMOTE_MOVEDF "Remote player %s made this move:" XP_CR - IDS_PASSED "Passed" - IDS_SUMMARYSCORED "%s:%d" - IDS_TRADED "Traded %d" - IDS_LOSTTURN "Lost turn" - IDS_TOTALPLAYERS "Number of players:" - IDS_VALUES_HEADER "%s counts/values:" XP_CR - IDS_QUERY_TRADE "Are you sure you want to trade the selected tiles?" - - IDS_DOUBLE_LETTER "Double Letter" - IDS_DOUBLE_WORD "Double Word" - IDS_TRIPLE_LETTER "Triple Letter" - IDS_TRIPLE_WORD "Triple Word" - IDS_INTRADE_MW "Trading tiles." XP_CR "Select 'turn done' when ready" - - IDS_TILES_NOT_IN_LINE "All tiles played must be in a line." - IDS_NO_EMPTIES_IN_TURN "Empty squares cannot separate tiles played." - IDS_TWO_TILES_FIRST_MOVE "Must play two or more pieces on the first move." - IDS_TILES_MUST_CONTACT "New pieces must contact others already in place (or "\ - "the middle square on the first move)." - IDS_NOT_YOUR_TURN "You can't do that; it's not your turn!" - IDS_NO_PEEK_ROBOT_TILES "No peeking at the robot's tiles!" - IDS_TOO_FEW_TILES_LEFT_TO_TRADE "Too few tiles left to trade." - IDS_CANT_UNDO_TILEASSIGN "Tile assignment can't be undone." - IDS_NO_EMPTY_TRADE "No tiles selected; trade cancelled." - IDS_CANT_HINT_WHILE_DISABLED "The hint feature is disabled for this game. Enable "\ - "it for a new game using the Preferences dialog." - - IDS_COUNTSVALS_L "Tile Counts and Values" - IDS_REMTILES_L "Remaining tiles" - IDS_GAMEHIST_L "Game history" - IDS_FINALSCORE_L "Final scores" - IDS_QUESTION_L "Question" - IDS_FYI_L "FYI" - IDS_ILLEGALWRD_L "Illegal word" - IDS_WRDNOTFOUND "Word[s] %s not found in dictionary." - IDS_USEANYWAY "Use it anyway?" - IDS_CANNOTOPEN_GAME "Saved game cannot be opened." - IDS_NODICT_L "Dictionary Not Found" - IDS_ABOUT_L "About Crosswords" - IDS_OVERWRITE "Do you really want to overwrite the current game?" - IDS_ENDNOW "Are you sure you want to end the game now?" - IDS_CANNOTOPEN_DICT "Unable to open dictionary: %s" - IDS_CONFIM_DELETE "Are you certain you want to delete the "\ - "selected game? This action cannot be undone." - - IDS_ROLE_STANDALONE "Standalone" - IDS_ROLE_HOST "Host" - IDS_ROLE_GUEST "Guest" - IDS_PLAYER_FORMAT "Player %d" - IDS_UNTITLED_FORMAT "Untitled %d" - IDS_PASSWDFMT_L "Enter password for %ls:" - - IDS_FILEEXISTSFMT_L "File %s already exists." - IDS_NEED_TOUCH "This feature requires a touch screen." - IDS_EDITCOLOR_FORMAT "Edit color for %s" - - IDS_LANG_CHANGE_RESTART "You will see the new language after you restart Crosswords." - -#ifndef XWFEATURE_STANDALONE_ONLY - IDS_RESEND_STANDALONE "This is a standalone game. There is nothing to "\ - "resend." - IDS_PHONE_OFF "Crosswords cannot connect because the phone "\ - "appears to be off. Please restart Crosswords "\ - "after turning it on." - IDS_NETWORK_FAILED "Unable to bring up networking." - - IDS_CONN_RELAY_L "Relay" - IDS_CONN_DIRECT "Direct connection" - IDS_LOCALPLAYERS "Local players:" - IDS_NO_PEEK_REMOTE_TILES "No peeking at remote players' tiles!" - IDS_REG_UNEXPECTED_USER "Refused attempt to register unexpected "\ - "user[s]." - IDS_SERVER_DICT_WINS "Conflict between Host and Guest dictionaries; " - "Host wins." - IDS_REG_SERVER_SANS_REMOTE "At least one player must be marked ""Remote"" "\ - "for a game started as Host." - -# ifdef XWFEATURE_SMS - IDS_SMS_CONN_L "Texting" -# endif -# ifdef XWFEATURE_IP_DIRECT - IDS_DIRECT_CONN_L "Direct connection" -# endif -# ifdef XWFEATURE_RELAY - IDS_XWRELAY_ERROR_TIMEOUT "The relay timed you out; usually that means "\ - "the other players didn't show." - IDS_ERROR_HEART_YOU "You were disconnected from relay because it "\ - "didn't hear from you in too long." - IDS_XWRELAY_ERROR_HEART_OTHER "The relay has lost contact with a device in this game." -/* IDS_XWRELAY_ERROR_LOST_OTHER "The relay has lost contact with a device in this game." */ - IDS_XWRELAY_RELAY_INCOMPAT "This version of Crosswords does not match the "\ - "relay. You probably need to upgrade to the "\ - "latest version." - - IDS_RELAY_HOST_WAITINGD "Connected to relay as host. Waiting for "\ - "%d player[s]." - IDS_RELAY_GUEST_WAITINGD "Connected to relay as guest. Still waiting "\ - "for %d player[s]." - IDS_RELAY_ALLHERE "All players are here." - - IDS_ERROR_NO_ROOM "No such room. Has the host connected yet "\ - "to reserve it?" - IDS_ERROR_DUP_ROOM "That room is reserved by another host. "\ - "Rename your room, become a guest, or try "\ - "again in a few minutes." - IDS_ERROR_TOO_MANY "The host is not expecting this many players. "\ - "Please reduce the number of Local players." -# endif -#endif - -END - -#ifdef AM_BASE_LANGUAGE -# include "../common_rsrc.rc" -#endif - -#endif diff --git a/xwords4/wince/l10n/xwords4_french.rc b/xwords4/wince/l10n/xwords4_french.rc deleted file mode 100644 index 6faaee7fd..000000000 --- a/xwords4/wince/l10n/xwords4_french.rc +++ /dev/null @@ -1,1017 +0,0 @@ -// -*- mode: c; compile-command: "cd ../ && make TARGET_OS=wince DEBUG=TRUE obj_wince_dbg/built/xwords4_french.dll"; -*- -// -// 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 - -///////////////////////////////////////////////////////////////////////////// -// French resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -#include "winnt.h" -LANGUAGE LANG_FRENCH, SUBLANG_FRENCH -#pragma code_page(65001) -#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" - BEGIN - MENUITEM "Jouer le coup", ID_MOVE_TURNDONE - MENUITEM "Mélanger", ID_MOVE_JUGGLE - MENUITEM "Retourner", ID_MOVE_FLIP - MENUITEM "Echanger", ID_MOVE_TRADE - MENUITEM "Cacher tirage", ID_MOVE_HIDETRAY - - POPUP "Annuler" - BEGIN - MENUITEM "Annuler actuel", ID_MOVE_UNDOCURRENT - MENUITEM "Annuler précédent", ID_MOVE_UNDOLAST - END - - POPUP "Conseil" - BEGIN - MENUITEM "Conseil suivant", ID_MOVE_NEXTHINT - MENUITEM "Previous hint", ID_MOVE_PREVHINT - MENUITEM "Conseil", ID_MOVE_HINT -#ifdef XWFEATURE_SEARCHLIMIT - MENUITEM "Conseil limité...", ID_MOVE_LIMITEDHINT -#endif - MENUITEM SEPARATOR - MENUITEM "Montrer les valeurs", ID_MOVE_VALUES - END - - POPUP "Partie" - BEGIN - MENUITEM "Nombre/Valeur des lettres", ID_GAME_TILECOUNTSANDVALUES - MENUITEM "Lettres restantes", ID_GAME_TILESLEFT - MENUITEM SEPARATOR - MENUITEM "Infos partie", ID_GAME_GAMEINFO - MENUITEM "Historique", ID_GAME_HISTORY - MENUITEM "Score final", ID_GAME_FINALSCORES -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - MENUITEM SEPARATOR - MENUITEM "Renvoyer message", ID_GAME_RESENDMSGS -#endif - END - - POPUP "Fichier" - BEGIN - MENUITEM "Plein écran", ID_FILE_FULLSCREEN - MENUITEM SEPARATOR - MENUITEM "Nouvelle partie...", ID_FILE_NEWGAME - MENUITEM "Parties enregistrées...", ID_FILE_SAVEDGAMES - MENUITEM "Préférences...", ID_FILE_PREFERENCES - MENUITEM SEPARATOR - MENUITEM "A propos...", ID_FILE_ABOUT - MENUITEM SEPARATOR - MENUITEM "Quitter", ID_FILE_EXIT - 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" - -#include "../rc_incs.h" - -#ifndef AM_BASE_LANGUAGE -DLL_VERS_RESOURCE -#endif - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// -#define BUTTON_HT 12 -#define REPOS_BUTTON_HT BUTTON_HT -#define REPOS_BUTTON_WIDTH 32 -#define REPOS_BUTTON_VPAD 2 -#define REPOS_BUTTON_HPAD 2 -/* How tall does a single line of label text turn out to be */ -# define LABEL_ROW_HT 10 -#ifdef CEFEATURE_CANSCROLL -# define ROW_HEIGHT 11 -#else -# define ROW_HEIGHT 12 -#endif - -// ******** IDD_GAMEINFO DIALOG ********* -#define GAMEINFO_WIDTH 116 -#ifdef CEFEATURE_CANSCROLL -# define ROW_SPACE 12 -# define ROW_SPACE_PL 11 -#else -# 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-4) -#else -# define SERVERROLE_ROW 3 -# define GAME_NAME_WIDTH 56 -# define SERVERCONF_ROW (SERVERROLE_ROW+ROW_SPACE+3) -# define NPLAYERS_ROW (SERVERCONF_ROW+ROW_SPACE+3) -# define GAME_REMOTE_LEFT 1 -# define GAME_NAME_LEFT 11 -# define ROBOT_LABEL_ADJUST 10 -# define GAME_ROBOT_LEFT (GAME_NAME_LEFT+GAME_NAME_WIDTH+2) -# define GAME_PWD_LEFT (GAME_ROBOT_LEFT + CHECK_WIDTH + 4) -# define NAME_LABEL_ADJUST 20 -# define GAME_NAMELABEL_LEFT (GAME_NAME_LEFT+NAME_LABEL_ADJUST) -# define GAME_NAMELABEL_WIDTH (GAME_NAME_WIDTH-ROBOT_LABEL_ADJUST-NAME_LABEL_ADJUST) -# define GAME_ROBOTLABEL_LEFT (GAME_ROBOT_LEFT-ROBOT_LABEL_ADJUST) -# define GAME_ROBOTLABEL_WIDTH (GAME_PWD_LEFT-GAME_ROBOT_LEFT+ROBOT_LABEL_ADJUST) -# define GAME_PWDLABEL_LEFT (GAME_PWD_LEFT) -# define GAME_PWDLABEL_WIDTH (GAMEINFO_WIDTH-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 JUGGLE_ROW (PLAYER_ROW_4+ROW_SPACE) -#define DICTPICK_LAB_ROW (JUGGLE_ROW+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,13,ROW_HEIGHT, \ - ES_PASSWORD | ES_AUTOHSCROLL \ - - -IDD_GAMEINFO DIALOG DISCARDABLE 0, 0, GAMEINFO_WIDTH, GAMEINFO_HEIGHT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Infos partie" -FONT 8, "System" -BEGIN -#ifndef XWFEATURE_STANDALONE_ONLY - LTEXT "Mode:",IDC_ROLELABEL,LEFT_COL,SERVERROLE_ROW,20,8 - XWCOMBO(IDC_ROLECOMBO,26,SERVERROLE_ROW,70,ROW_HEIGHT,0,58,0) - - PUSHBUTTON "Configurer le mode",GIROLECONF_BUTTON,LEFT_COL+10, - SERVERCONF_ROW,60,ROW_HEIGHT -#endif - - LTEXT "",IDC_TOTAL_LABEL,LEFT_COL,NPLAYERS_ROW,70,8 - XWCOMBO(IDC_NPLAYERSCOMBO,74,NPLAYERS_ROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Nom",IDC_NAMELABEL,GAME_NAMELABEL_LEFT, - LABELS_ROW,GAME_NAMELABEL_WIDTH,8,SS_NOPREFIX - LTEXT "Robot",IDC_ROBOTLABEL,GAME_ROBOTLABEL_LEFT,LABELS_ROW,GAME_ROBOTLABEL_WIDTH,8 - LTEXT "Mdp",IDC_PASSWDLABEL,GAME_PWDLABEL_LEFT,LABELS_ROW,GAME_PWDLABEL_WIDTH,8 - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - LTEXT "Distant",IDC_REMOTE_LABEL,LEFT_COL,LABELS_ROW,25,8,SS_NOPREFIX - 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 ) - - PUSHBUTTON "Mélanger",GIJUGGLE_BUTTON,LEFT_COL+10,JUGGLE_ROW, - 60,BUTTON_HT - - LTEXT "Dictionnaire:",IDC_DICTLABEL,LEFT_COL,DICTPICK_LAB_ROW,50,8, - SS_NOPREFIX - XWCOMBO(IDC_DICTLIST,LEFT_COL+10,DICTPICK_ROW,80,ROW_HEIGHT,LBS_SORT,58,CBS_SORT) - - PUSHBUTTON "Préférences...",OPTIONS_BUTTON,LEFT_COL,PREFS_ROW,55,12 - -#ifndef _WIN32_WCE - PUSHBUTTON "OK",IDOK,20,BUTTONS_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - DEFPUSHBUTTON "Annuler",IDCANCEL,50,BUTTONS_ROW, - 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 "Dialogue" -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 - DEFPUSHBUTTON "Non",IDCANCEL,SB_CANCEL_LEFT,81,SB_BUTTON_WIDTH,REPOS_BUTTON_HT -#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 "Choix de lettre" -FONT 8, "System" -BEGIN - LTEXT "Entrez une lettre pour ce joker.",IDC_BPICK, - ASKB_COLLEFT,ASKB_LABELTOP,ASKB_LABELWIDTH,ASKB_LABELHT -#ifdef FEATURE_TRAY_EDIT - LTEXT "Choisissez une lettre de votre tirage.",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 "Remettre",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 "Annuler",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 "Nom partie" -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, - BUTTON_HT - PUSHBUTTON "Annuler",IDCANCEL,SVGN_LEFT_COL+10+REPOS_BUTTON_WIDTH+10, - 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+45) -#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 "Parties enregistrées" -FONT 8, "System" -BEGIN - LTEXT /* wince windres can't handle split lines....*/ - "Sélectionnez une partie enregistrée. (Certains boutons seront désactivés si la partie en cours est sélectionnée.)", - IDC_SVGM_SELLAB,SVGM_LEFT_COL,SVGM_ROW_1,90,45 - XWCOMBO(IDC_SVGM_GAMELIST, SVGM_LEFT_COL,SVGM_ROW_2,70,ROW_HEIGHT,LBS_SORT,58,CBS_SORT) - - PUSHBUTTON "Ouvrir",IDC_SVGM_OPEN, - SVGM_LEFT_COL,SVGM_ROW_3,40,14,WS_DISABLED - - PUSHBUTTON "Dupl.",IDC_SVGM_DUP, - SVGM_LEFT_COL,SVGM_ROW_4,20,14,WS_DISABLED - PUSHBUTTON "Effacer",IDC_SVGM_DEL, - SVGM_LEFT_COL+22,SVGM_ROW_4,26,14,WS_DISABLED - PUSHBUTTON "Renommer",IDC_SVGM_CHANGE, - SVGM_LEFT_COL+50,SVGM_ROW_4,40,14,WS_DISABLED - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "Terminé",IDOK,SVGM_LEFT_COL,SVGM_ROW_OK,REPOS_BUTTON_WIDTH, - 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 "Mot de passe" -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 - PUSHBUTTON "Annuler",IDCANCEL, - 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 "Longueur des mots conseillés" -FONT 8, "System" -BEGIN - LTEXT "Utiliser au moins:",HC_MIN_LABEL, - HC_LABELS_COL,HC_MINROW,60,ROW_HEIGHT - XWCOMBO(HC_MIN_COMBO,HC_DROPDOWNS_COL,HC_MINROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Mais pas plus de:",HC_MAX_LABEL, - HC_LABELS_COL,HC_MAXROW,60,ROW_HEIGHT - 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 - PUSHBUTTON "Annuler",IDCANCEL,HC_CANCEL_LEFT,31,REPOS_BUTTON_WIDTH, - 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_ROW8 (PR_ROW7+PR_SPACING) -#define PR_BUTTONROW (PR_ROW8+PR_SPACING) -#define PR_LEFT 6 - -#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 "Préférences" -FONT 8, "System" -BEGIN - CONTROL "Cette partie",IDC_RADIOLOCAL,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,4,PR_ROW1,47,10 - CONTROL "Générales",IDC_RADIOGLOBAL,"Button", - BS_AUTORADIOBUTTON,52,PR_ROW1,53,10 - - /* Global */ - CONTROL "Couleur des lettres placées",IDC_CHECKCOLORPLAYED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP, - PR_LEFT,PR_ROW2,90,PREFS_ROW_HT - CONTROL "Activer curseur",IDC_CHECKSHOWCURSOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW3,60,PREFS_ROW_HT - CONTROL "Détails des points du robot",IDC_CHECKROBOTSCORES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW4,90,PREFS_ROW_HT - CONTROL "Ne pas confirmer le coup",IDC_SKIPCONFIRM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW5,90,PREFS_ROW_HT - CONTROL "Cacher valeur des lettres",IDC_HIDETILEVALUES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW6,87,PREFS_ROW_HT - PUSHBUTTON "Editer les couleurs...",IDC_PREFCOLORS,PR_LEFT,PR_ROW7,75,12 - PUSHBUTTON "Changer la langue...",IDC_PREFLOCALE,PR_LEFT,PR_ROW8,75,12 -#ifdef ALLOW_CHOOSE_FONTS - PUSHBUTTON "Choisir une police...",IDC_PREFFONTS,PR_LEFT,PR_ROW9,60,12 -#endif - - /* Per game */ - CONTROL "Robot intelligent",IDC_CHECKSMARTROBOT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,PR_LEFT,PR_ROW2,70, - PREFS_ROW_HT - CONTROL "Conseils permis",IDC_CHECKHINTSOK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW3,80,PREFS_ROW_HT -#ifdef XWFEATURE_SEARCHLIMIT - CONTROL "Limitation des conseils",IDC_CHECKHINTSLIMITS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4+PR_LEFT,PR_ROW4-2,85,10 -#endif - CONTROL "Chrono",TIMER_CHECK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,PR_ROW5,65, - PREFS_ROW_HT - EDITTEXT TIMER_EDIT,65,PR_ROW5,16,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Erreurs:",PHONIES_LABEL,PR_LEFT,PR_ROW6,28,PREFS_ROW_HT - XWCOMBO(PHONIES_COMBO, 38,PR_ROW6,50,PREFS_ROW_HT,0,58,0) - -#ifdef FEATURE_TRAY_EDIT - CONTROL "Tirage manuel", IDC_PICKTILES, "Button", - BS_AUTOCHECKBOX | WS_TABSTOP,PR_LEFT,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 - PUSHBUTTON "Annuler",IDCANCEL,PR_CANCEL_LEFT,PR_BUTTONROW, - 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_LABEL_HT (LABEL_ROW_HT) /* try to make them all same ht! */ -# define CONN_HELP_HT 25 -# 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_3+ROW_SPACE) -# endif -# ifndef RELAY_NOEDIT_ADDR -# define CONN_ROW_5 (CONN_ROW_4+CONN_HELP_HT+5) -# 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) -# else -# define BUTTON_ROW (CONN_ROW_4+CONN_HELP_HT) -# endif -#ifdef _WIN32_WCE -# define CONNSDLG_HT BUTTON_ROW -#else -# define CONNSDLG_HT (BUTTON_ROW+ROW_SPACE+3) -#endif - -IDD_CONNSSDLG DIALOG DISCARDABLE 0, 20, 120, CONNSDLG_HT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Connexion" -FONT 8, "System" -BEGIN - -#ifdef NEEDS_CHOOSE_CONNTYPE - LTEXT "Connecter via:",IDC_CCONVIA_LAB,LAB_COL,CONN_ROW_1,40,ROW_HEIGHT - XWCOMBO(IDC_CONNECT_COMBO, CTRL_COL,CONN_ROW_2,CTRL_COL_WIDTH,ROW_HEIGHT,0,58,0) -#endif -#ifdef XWFEATURE_RELAY - LTEXT "Partie distante:", - IDC_INVITE_LAB,LAB_COL,CONN_ROW_3,23,CONN_LABEL_HT - EDITTEXT INVITE_EDIT,LAB_COL+25,CONN_ROW_3,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL - - LTEXT "(comme hôte, vous devez nommer la partie et vous " - "connecter en premier.)", - IDC_INVITE_HELP_HOST,LAB_COL,CONN_ROW_4,110,CONN_HELP_HT - LTEXT "(comme invité, attendez que l'hôte se connecte et vous " - "indique le nom de la partie.)", - IDC_INVITE_HELP_GUEST,LAB_COL,CONN_ROW_4,100,CONN_HELP_HT - -# ifndef RELAY_NOEDIT_ADDR - LTEXT "Nom du serveur relai (change rarement):",IDC_CRELAYNAME_LAB, - LAB_COL,CONN_ROW_5,120,ROW_HEIGHT - EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL - LTEXT "Port du serveur relai (change rarement):",IDC_CRELAYPORT_LAB, - 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 -# endif -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Connexion non supportée.",IDC_INVITE_LAB, - LAB_COL,CONN_ROW_3,40,40 -#endif - -#ifdef XWFEATURE_IP_DIRECT - LTEXT "Nom et adresse de l'hôte",IDC_IPNAME_LAB, - LAB_COL,CONN_ROW_3,100,ROW_HEIGHT - EDITTEXT IPNAME_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT,ES_AUTOHSCROLL -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Connexion IP directe non supportée.",IDC_IPNAME_LAB, - LAB_COL,CONN_ROW_3,40,40 -#endif - -#ifdef XWFEATURE_SMS - LTEXT "Téléphone hôte:",IDC_SMS_PHONE_LAB,LAB_COL,CONN_ROW_3,60,ROW_HEIGHT - EDITTEXT IDC_SMS_PHONE_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Port hôte:",IDC_SMS_PORT_LAB,LAB_COL,CONN_ROW_5,60,ROW_HEIGHT - EDITTEXT IDC_SMS_PORT_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL | ES_NUMBER -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "SMS non supporté.", - 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 - DEFPUSHBUTTON "Annuler",IDCANCEL,70,BUTTON_ROW, - 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+5) -#define CLR_ROW_8 (CLR_ROW_7+CLR_LRG_GAP+5) -#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,ht) \ - LTEXT txt,id,xx,yy,CLR_LAB_WIDTH,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 "Editer",id1,xx+CLR_SAMPLE_WIDTH+4,yy,24,CLR_BUT_HT,BS_NOTIFY - -IDD_COLORSDLG DIALOG DISCARDABLE 0, 20, CLR_WIDTH, COLORSDLG_HT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Préférences des couleurs" -FONT 8, "System" -BEGIN - COLOR_BUTTON("Lettre double:",DLBLTR_LABEL,CLR_COL_1,CLR_ROW_1,CLR_LAB_HT) - COLOR_SAMPLE(DLBLTR_BUTTON,DLBLTR_SAMPLE,CLR_COL_2,CLR_ROW_1) - - COLOR_BUTTON("Mot double:",DBLWRD_LABEL,CLR_COL_1,CLR_ROW_2,CLR_LAB_HT ) - COLOR_SAMPLE(DBLWRD_BUTTON,DBLWRD_SAMPLE,CLR_COL_2,CLR_ROW_2) - COLOR_BUTTON("Lettre triple:",TPLLTR_LABEL,CLR_COL_1,CLR_ROW_3,CLR_LAB_HT ) - COLOR_SAMPLE(TPLLTR_BUTTON,TPLLTR_SAMPLE,CLR_COL_2,CLR_ROW_3) - - COLOR_BUTTON("Mot triple:",TPLWRD_LABEL,CLR_COL_3,CLR_ROW_4,CLR_LAB_HT) - COLOR_SAMPLE(TPLWRD_BUTTON,TPLWRD_SAMPLE,CLR_COL_4,CLR_ROW_4) - COLOR_BUTTON("Case vide:",EMPCELL_LABEL,CLR_COL_1,CLR_ROW_5,CLR_LAB_HT) - COLOR_SAMPLE(EMPCELL_BUTTON,EMPCELL_SAMPLE,CLR_COL_2,CLR_ROW_5) - - COLOR_BUTTON("Fond de lettre:",TBACK_LABEL,CLR_COL_3,CLR_ROW_6,CLR_LAB_HT+10) - - COLOR_SAMPLE(TBACK_BUTTON,TBACK_SAMPLE,CLR_COL_4,CLR_ROW_6) - COLOR_BUTTON("Couleur sélection:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_7,CLR_LAB_HT+10) - COLOR_SAMPLE(FOCUSCLR_BUTTON,FOCUSCLR_SAMPLE,CLR_COL_2,CLR_ROW_7+5) - COLOR_BUTTON("Joueur 1:",PLAYER1_LABEL,CLR_COL_1,CLR_ROW_8,CLR_LAB_HT) - COLOR_SAMPLE(PLAYER1_BUTTON,PLAYER1_SAMPLE,CLR_COL_2,CLR_ROW_8) - COLOR_BUTTON("Joueur 2:",PLAYER2_LABEL,CLR_COL_3,CLR_ROW_9,CLR_LAB_HT) - COLOR_SAMPLE(PLAYER2_BUTTON,PLAYER2_SAMPLE,CLR_COL_4,CLR_ROW_9) - COLOR_BUTTON("Joueur 3:",PLAYER3_LABEL,CLR_COL_1,CLR_ROW_10,CLR_LAB_HT) - COLOR_SAMPLE(PLAYER3_BUTTON,PLAYER3_SAMPLE,CLR_COL_2,CLR_ROW_10) - COLOR_BUTTON("Joueur 4:",PLAYER4_LABEL,CLR_COL_3,CLR_ROW_11,CLR_LAB_HT) - COLOR_SAMPLE(PLAYER4_BUTTON,PLAYER4_SAMPLE,CLR_COL_4,CLR_ROW_11) - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "OK",IDOK,CLR_OK_LEFT,CLR_BUTTON_ROW, - REPOS_BUTTON_WIDTH,BUTTON_HT,BS_NOTIFY - PUSHBUTTON "Annuler",IDCANCEL,CLR_CANCEL_LEFT,CLR_BUTTON_ROW, - 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("Rouge:", CLREDIT_ROW_1, RED_LABEL, RED_EDIT, CLREDT_SLIDER1 ) - COLOR_EDIT_LINE("Vert:", CLREDIT_ROW_2, GREEN_LABEL, GREEN_EDIT, CLREDT_SLIDER2 ) - COLOR_EDIT_LINE("Bleu:", CLREDIT_ROW_3, BLUE_LABEL, BLUE_EDIT, CLREDT_SLIDER3 ) - - /* 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, - REPOS_BUTTON_HT - PUSHBUTTON "Annuler",IDCANCEL,CLRE_CANCEL_LEFT,56,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END -#endif - -IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 80 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "Sélection de la langue" -FONT 8, "System" -BEGIN - LTEXT "Choisissez la langue des menus et des dialogues. (Vous pouvez télécharger d'autres langues sur xwords.sf.net.)", - LOCALES_LABEL,LEFT_COL,2,80,50 - - XWCOMBO(LOCALES_COMBO,LEFT_COL,53,70,12,0,58,0) - -# ifndef _WIN32_WCE - DEFPUSHBUTTON "OK",IDOK,LEFT_COL,70,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Annuler",IDCANCEL,40,70,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END - -///////////////////////////////////////////////////////////////////////////// -// -// String Table. Note that these are ascii strings unless L proceeds the -// first ". -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_MENU "Menu" - IDS_DUMMY "--" - IDS_CANCEL "Annuler" - IDS_OK "OK" - IDS_DONE "Terminé" - IDS_LANGUAGE_NAME "Français" - IDS_NEW_GAME "Nouvelle partie" - IDS_ABOUT "Crosswords " ABOUT_VERSION " (rev " SVN_REV ") "\ - "pour Windows Mobile. Copyright 1998-2010 "\ - "Eric House. Ce logiciel est produit sous licence "\ - "publique GNU.\r\r"\ - "Pour obtenir des dictionnaires, le manuel ou le "\ - "code source, allez sur "\ - "http://xwords.sf.net ou http://eehouse.org/xwords/.\r\r"\ - "Traduction française par Jean-Marc Charette." - IDS_DICTLOC "Veuillez installer un dictionnaire (Fichier .xwd) "\ - "dans le męme dossier que le fichier exécutable crosswords.exe ou "\ - "dans un dossier nommé crosswords sur la carte de stockage, "\ - "par exemple dans \\Carte de Stockage\\crosswords. "\ - "Téléchargez des dictionnaires sur le site http://xwords.sf.net ou "\ - "http://eehouse.org/xwords." - IDS_SAVENAME "Entrez un nom pour la partie. (Vous pourrez le changer "\ - "plus tard via la boîte de dialogue Enregistrer partie.)" - IDS_DUPENAME "Entrez un nom pour une copie de cette partie." - IDS_RENAME "Entrez un nouveau nom pour cette partie." - - IDS_REMAINING_TILES_ADD "+ %d [Toutes les lettres restantes]" - IDS_UNUSED_TILES_SUB "- %d [Lettres non utilisées]" - IDS_BONUS_ALL "Bonus scrabble: 50" XP_CR - IDS_TURN_SCORE "Score pour ce coup: %d" XP_CR - IDS_COMMIT_CONFIRM "Accepter ce coup?" XP_CR - IDS_LOCAL_NAME "%s" - IDS_IGNORE_L "Ignorer" - IDS_WARN_L "Avertir" - IDS_DISALLOW_L "Refuser" - IDS_NONLOCAL_NAME "%s (Distant)" - IDS_TIME_PENALTY_SUB " - %d [Temps]" - IDS_CUMULATIVE_SCORE "Score cumulé: %d" XP_CR - IDS_MOVE_ACROSS "Placement (de %s horizontalement)" XP_CR - IDS_MOVE_DOWN "Placement (de %s verticalement)" XP_CR - IDS_TRAY_AT_START "Tirage de départ: %s" XP_CR - IDS_NEW_TILES "Nouvelles lettres: %s" XP_CR - IDS_TRADED_FOR "Echangé %s contre %s." - IDS_PASS "Passe" XP_CR - IDS_PHONY_REJECTED "Mot refusé dans ce coup; tour perdu!" XP_CR - IDS_ROBOT_TRADED "Le robot a échangé %d lettre(s) durant ce tour." - IDS_ROBOT_MOVED "Le robot a joué ce coup:" XP_CR - IDS_REMOTE_MOVEDF "Le joueur distant a joué ce coup:" XP_CR - IDS_PASSED "Passé" - IDS_SUMMARYSCORED "%s:%d" - IDS_TRADED "Echangé %d" - IDS_LOSTTURN "Tour perdu" - IDS_TOTALPLAYERS "Nombre de joueurs:" - IDS_VALUES_HEADER "%s Nombres/Valeurs:" XP_CR - IDS_QUERY_TRADE "Etes-vous sűr de vouloir échanger les lettres sélectionnées?" - IDS_DOUBLE_LETTER "Lettre compte double" - IDS_DOUBLE_WORD "Mot compte double" - IDS_TRIPLE_LETTER "Lettre compte triple" - IDS_TRIPLE_WORD "Mot compte triple" - - IDS_INTRADE_MW "Echange de lettres. Choisir" XP_CR "'Jouer le coup' quand vous" XP_CR "avez fini." - - IDS_TILES_NOT_IN_LINE "Toutes les lettres jouées doivent ętre alignées." - IDS_NO_EMPTIES_IN_TURN "Aucune case vide ne peut séparer deux lettres placées." - IDS_TWO_TILES_FIRST_MOVE "Lors du premier coup, vous devez placer deux lettres au minimum." - IDS_TILES_MUST_CONTACT "Les lettres doivent ętre placées en contact avec des lettres déja présentes sur le plateau de jeu (ou "\ - "recouvrir la case centrale du plateau lors du premier coup)." - IDS_NOT_YOUR_TURN "Vous ne pouvez pas faire cela, ce n'est pas votre tour!" - IDS_NO_PEEK_ROBOT_TILES "Pas de coup d'oeil sur les lettres du robot!" - IDS_TOO_FEW_TILES_LEFT_TO_TRADE "Il reste trop peu de lettres pour l'échange." - IDS_CANT_UNDO_TILEASSIGN "L'attribution des lettres ne peut ętre annulé." - IDS_CANT_HINT_WHILE_DISABLED "Les conseils sont désactivés dans cette partie. "\ - "activez-les pour une nouvelle partie en utilisant les préférences." - - IDS_COUNTSVALS_L "Nombre et valeur des lettres" - IDS_REMTILES_L "Lettres restantes" - IDS_GAMEHIST_L "Historique de la partie" - IDS_FINALSCORE_L "Score final" - IDS_QUESTION_L "Question" // <- translate? - IDS_FYI_L "Info" - IDS_ILLEGALWRD_L "Mot interdit" - IDS_WRDNOTFOUND "Mot(s) %s non trouvé(s) dans le dictionnaire." - IDS_USEANYWAY "L'utiliser malgré tout?" - IDS_CANNOTOPEN_GAME "La partie enregistrée ne peut ętre ouverte." - IDS_NODICT_L "Dictionnaire non trouvé" - IDS_ABOUT_L "A propos de Crosswords" - IDS_OVERWRITE "Voulez-vous vraiment effacer la partie en cours?" - IDS_ENDNOW "Etes-vous sűr de vouloir terminer la partie maintenant?" - IDS_CANNOTOPEN_DICT "Impossible d'ouvrir le dictionnaire: %s" - IDS_CONFIM_DELETE "Etes-vous certain de vouloir effacer la partie "\ - "sélectionnée? Cette action ne pourra pas ętre annulée." - - IDS_ROLE_STANDALONE "Autonome" - IDS_ROLE_HOST "Hôte" - IDS_ROLE_GUEST "Invité" - IDS_PLAYER_FORMAT "Joueur %d" - IDS_UNTITLED_FORMAT "Sans titre %d" - IDS_PASSWDFMT_L "Entrez le mot de passe pour %ls:" - IDS_FILEEXISTSFMT_L "Le fichier %s existe déjà." - IDS_NEED_TOUCH "Cette fonctionnalité nécessite un écran tactile." - IDS_EDITCOLOR_FORMAT "Editer la couleur pour %s" - IDS_LANG_CHANGE_RESTART "La nouvelle langue apparaîtra après avoir redémarré Crosswords." - -#ifndef XWFEATURE_STANDALONE_ONLY - IDS_RESEND_STANDALONE "Ceci est une partie autonome. Il n'y a rien à renvoyer." - IDS_PHONE_OFF "Crosswords ne peut se connecter car le téléphone "\ - "semble éteint. Veuillez le mettre en fonction et ensuite "\ - "redémarrer Crosswords." - IDS_NETWORK_FAILED "Impossible de mettre en place le réseau." - IDS_CONN_RELAY_L "Transmission" - IDS_CONN_DIRECT "Connexion directe" - IDS_LOCALPLAYERS "Joueurs loc.:" - IDS_NO_PEEK_REMOTE_TILES "Pas de coup d'oeil sur le jeu des joueurs distants!" - IDS_REG_UNEXPECTED_USER "Refus de la tentative d'enregistrer un joueur non prévu." - IDS_SERVER_DICT_WINS "Conflit de dictionnaire entre l'hôte et l'invité; l'hôte gagne." - IDS_REG_SERVER_SANS_REMOTE "Au moins un joueur doit ętre distant dans une partie "\ - "débutée en tant qu'hôte." - -# ifdef XWFEATURE_SMS - IDS_SMS_CONN_L "Texting" -# endif -# ifdef XWFEATURE_IP_DIRECT - IDS_DIRECT_CONN_L "Connexion directe" // but not visible in version 4.2 -# endif -# ifdef XWFEATURE_RELAY - IDS_XWRELAY_ERROR_TIMEOUT "La transmission a échoué dans les délais; cela signifie généralement "\ - "que les autres joueurs ne vous ont pas vu." - IDS_ERROR_HEART_YOU "Vous avez été déconnecté parce que vous n'avez rien émis "\ - "pendant trop longtemps." - IDS_XWRELAY_ERROR_HEART_OTHER "La transmission a perdu le contact avec un appareil durant cette partie." -/* IDS_XWRELAY_ERROR_LOST_OTHER "The relay has lost contact with a device in this game." */ - IDS_XWRELAY_RELAY_INCOMPAT "Cette version de Crosswords ne peut accéder au serveur relai. Vous devriez probablement mettre à jour vers la dernière version." - IDS_RELAY_HOST_WAITINGD "Connecté au serveur relai en tant qu'hôte. En attente de "\ - "%d joueur[s]." - IDS_RELAY_GUEST_WAITINGD "Connecté au serveur relai en tant qu'invité. En attente "\ - "de %d joueur[s]." - IDS_RELAY_ALLHERE "Tous les joueurs sont là." - - IDS_ERROR_NO_ROOM "Partie inexistante. L'hôte s'est-il connecté "\ - "pour la créer?" - IDS_ERROR_DUP_ROOM "Cette partie est déjà utilisée par un autre hôte. "\ - "Renommez votre partie, continuez comme invité "\ - "ou réessayez dans quelques minutes." - IDS_ERROR_TOO_MANY "L'hôte n'est pas en attente d'autant de joueurs. "\ - "Veuillez réduire le nombre de joueurs locaux." -# endif -#endif /* XWFEATURE_STANDALONE_ONLY */ - -END - -#ifdef AM_BASE_LANGUAGE -# include "../common_rsrc.rc" -#endif - -#endif diff --git a/xwords4/wince/l10n/xwords4_polish.rc b/xwords4/wince/l10n/xwords4_polish.rc deleted file mode 100644 index 11aa97ed0..000000000 --- a/xwords4/wince/l10n/xwords4_polish.rc +++ /dev/null @@ -1,1023 +0,0 @@ -// -*- mode: c; compile-command: "cd ../ && make TARGET_OS=win32 DEBUG=TRUE obj_win32_dbg/built/xwords4_polish.dll"; -*- -// -// 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 - -///////////////////////////////////////////////////////////////////////////// -// Polish resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -#include "winnt.h" -LANGUAGE LANG_POLISH, SUBLANG_POLISH_POLAND -#pragma code_page(65001) -#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" - BEGIN - MENUITEM "Koniec kolejki", ID_MOVE_TURNDONE - MENUITEM "Mieszaj", ID_MOVE_JUGGLE - MENUITEM "Odwróć planszę", ID_MOVE_FLIP - MENUITEM "Wymień", ID_MOVE_TRADE - MENUITEM "Ukryj klocki", ID_MOVE_HIDETRAY - - POPUP "Cofnij" - BEGIN - MENUITEM "Cofnij słowo", ID_MOVE_UNDOCURRENT - MENUITEM "Cofnij kolejkę", ID_MOVE_UNDOLAST - END - - POPUP "Podpowiedź" - BEGIN - MENUITEM "Następna podp.", ID_MOVE_NEXTHINT - MENUITEM "Previous hint", ID_MOVE_PREVHINT - MENUITEM "Podpowiedź", ID_MOVE_HINT -#ifdef XWFEATURE_SEARCHLIMIT - MENUITEM "Podp. ograniczona...", ID_MOVE_LIMITEDHINT -#endif - MENUITEM SEPARATOR - MENUITEM "Pokaż wartości", ID_MOVE_VALUES - END - - POPUP "Gra" - BEGIN - MENUITEM "Ilość klocków i wartości", ID_GAME_TILECOUNTSANDVALUES - MENUITEM "Pozostałe klocki", ID_GAME_TILESLEFT - MENUITEM SEPARATOR - MENUITEM "Informacje", ID_GAME_GAMEINFO - MENUITEM "Historia", ID_GAME_HISTORY - MENUITEM "Koniec gry", ID_GAME_FINALSCORES -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - MENUITEM SEPARATOR - MENUITEM "Prześlij wiadom.", ID_GAME_RESENDMSGS -#endif - END - - POPUP "Plik" - BEGIN - MENUITEM "Pełen ekran", ID_FILE_FULLSCREEN - MENUITEM SEPARATOR - MENUITEM "Nowa gra...", ID_FILE_NEWGAME - MENUITEM "Zapisane gry...", ID_FILE_SAVEDGAMES - MENUITEM "Ustawienia...", ID_FILE_PREFERENCES - MENUITEM SEPARATOR - MENUITEM "O...", ID_FILE_ABOUT - MENUITEM SEPARATOR - MENUITEM "Wyjście", ID_FILE_EXIT - 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" - -#ifndef AM_BASE_LANGUAGE -DLL_VERS_RESOURCE -#endif - -///////////////////////////////////////////////////////////////////////////// -// -// 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 - -/* How tall does a single line of label text turn out to be */ -# define LABEL_ROW_HT 10 -#ifdef CEFEATURE_CANSCROLL -# define ROW_HEIGHT 11 -#else -# define ROW_HEIGHT 12 -#endif - - -// ******** IDD_GAMEINFO DIALOG ********* -#define GAMEINFO_WIDTH 116 -#ifdef CEFEATURE_CANSCROLL -# define ROW_SPACE 12 -# define ROW_SPACE_PL 11 -#else -# 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-4) -#else -# define SERVERROLE_ROW 3 -# define GAME_NAME_WIDTH 56 -# define SERVERCONF_ROW (SERVERROLE_ROW+ROW_SPACE+3) -# define NPLAYERS_ROW (SERVERCONF_ROW+ROW_SPACE+3) -# define GAME_REMOTE_LEFT 1 -# define GAME_NAME_LEFT 11 -# define ROBOT_LABEL_ADJUST 10 -# define GAME_ROBOT_LEFT (GAME_NAME_LEFT+GAME_NAME_WIDTH+2) -# define GAME_PWD_LEFT (GAME_ROBOT_LEFT + CHECK_WIDTH + 4) -# define NAME_LABEL_ADJUST 20 -# define GAME_NAMELABEL_LEFT (GAME_NAME_LEFT+NAME_LABEL_ADJUST) -# define GAME_NAMELABEL_WIDTH (GAME_NAME_WIDTH-ROBOT_LABEL_ADJUST-NAME_LABEL_ADJUST) -# define GAME_ROBOTLABEL_LEFT (GAME_ROBOT_LEFT-ROBOT_LABEL_ADJUST) -# define GAME_ROBOTLABEL_WIDTH (GAME_PWD_LEFT-GAME_ROBOT_LEFT+ROBOT_LABEL_ADJUST) -# define GAME_PWDLABEL_LEFT (GAME_PWD_LEFT) -# define GAME_PWDLABEL_WIDTH (GAMEINFO_WIDTH-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 JUGGLE_ROW (PLAYER_ROW_4+ROW_SPACE) -#define DICTPICK_LAB_ROW (JUGGLE_ROW+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,13,ROW_HEIGHT, \ - ES_PASSWORD | ES_AUTOHSCROLL \ - - -IDD_GAMEINFO DIALOG DISCARDABLE 0, 0, GAMEINFO_WIDTH, GAMEINFO_HEIGHT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Informacje w grze" -FONT 8, "System" -BEGIN -#ifndef XWFEATURE_STANDALONE_ONLY - LTEXT "Tryb:",IDC_ROLELABEL,LEFT_COL,SERVERROLE_ROW,20,8 - XWCOMBO(IDC_ROLECOMBO,26,SERVERROLE_ROW,70,ROW_HEIGHT,0,58,0) - - PUSHBUTTON "Ustaw.",GIROLECONF_BUTTON,LEFT_COL+10, - SERVERCONF_ROW,60,ROW_HEIGHT - -#endif - - LTEXT "",IDC_TOTAL_LABEL,LEFT_COL,NPLAYERS_ROW,70,8 - XWCOMBO(IDC_NPLAYERSCOMBO,74,NPLAYERS_ROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Imię",IDC_NAMELABEL,GAME_NAMELABEL_LEFT, - LABELS_ROW,GAME_NAMELABEL_WIDTH,8,SS_NOPREFIX - LTEXT "Robot",IDC_ROBOTLABEL,GAME_ROBOTLABEL_LEFT,LABELS_ROW, - GAME_ROBOTLABEL_WIDTH,8 - LTEXT "Kod",IDC_PASSWDLABEL,GAME_PWDLABEL_LEFT,LABELS_ROW, - GAME_PWDLABEL_WIDTH,8 - -#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH - LTEXT "Zdalny",IDC_REMOTE_LABEL,LEFT_COL,LABELS_ROW,25,8,SS_NOPREFIX - 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 ) - - PUSHBUTTON "Losuj",GIJUGGLE_BUTTON,LEFT_COL+10,JUGGLE_ROW, - 60,BUTTON_HT - - LTEXT "Słownik:",IDC_DICTLABEL,LEFT_COL,DICTPICK_LAB_ROW,50,8, - SS_NOPREFIX - XWCOMBO(IDC_DICTLIST,LEFT_COL+10,DICTPICK_ROW,80,ROW_HEIGHT,LBS_SORT,58,CBS_SORT) - - PUSHBUTTON "Ustawienia...",OPTIONS_BUTTON,LEFT_COL,PREFS_ROW,55,12 - -#ifndef _WIN32_WCE - PUSHBUTTON "OK",IDOK,20,BUTTONS_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT - DEFPUSHBUTTON "Anuluj",IDCANCEL,50,BUTTONS_ROW, - 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" -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 - DEFPUSHBUTTON "Nie",IDCANCEL,SB_CANCEL_LEFT,81,SB_BUTTON_WIDTH,REPOS_BUTTON_HT -#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+5) -#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 "Wybór Klocków" -FONT 8, "System" -BEGIN - LTEXT "Podaj literę jaką chcesz zastąpić.",IDC_BPICK, - ASKB_COLLEFT,ASKB_LABELTOP,ASKB_LABELWIDTH,ASKB_LABELHT -#ifdef FEATURE_TRAY_EDIT - LTEXT "Wybierz klocek do wymiany.",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 "Odłóż",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 "Anuluj",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 "Nazwa gry" -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, - BUTTON_HT - PUSHBUTTON "Anuluj",IDCANCEL,SVGN_LEFT_COL+10+REPOS_BUTTON_WIDTH+10, - 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 "Zapisane gry" -FONT 8, "System" -BEGIN - LTEXT /* wince windres can't handle split lines....*/ - "Wybierz zapisaną grę. (Niektóre klawisze mogą być zablokowane przy wyborze aktualnej gry.)", - - 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 "Otwórz",IDC_SVGM_OPEN, - SVGM_LEFT_COL,SVGM_ROW_3,32,14,WS_DISABLED - - PUSHBUTTON "Kopia",IDC_SVGM_DUP, - SVGM_LEFT_COL,SVGM_ROW_4,26,14,WS_DISABLED - PUSHBUTTON "Usuń",IDC_SVGM_DEL, - SVGM_LEFT_COL+28,SVGM_ROW_4,22,14,WS_DISABLED - PUSHBUTTON "Zmień",IDC_SVGM_CHANGE, - SVGM_LEFT_COL+52,SVGM_ROW_4,32,14,WS_DISABLED - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "Gotowe",IDOK,SVGM_LEFT_COL,SVGM_ROW_OK,REPOS_BUTTON_WIDTH, - 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 "Kod/Hasło" -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 - PUSHBUTTON "Anuluj",IDCANCEL, - 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 "Ogranicz podpowiedzi" -FONT 8, "System" -BEGIN - LTEXT "Użyj min.:",HC_MIN_LABEL, - HC_LABELS_COL,HC_MINROW,60,ROW_HEIGHT - XWCOMBO(HC_MIN_COMBO,HC_DROPDOWNS_COL,HC_MINROW,24,ROW_HEIGHT,0,58,0) - - LTEXT "Nie więcej niż:",HC_MAX_LABEL,HC_LABELS_COL,HC_MAXROW,60,ROW_HEIGHT - 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 - PUSHBUTTON "Anuluj",IDCANCEL,HC_CANCEL_LEFT,31,REPOS_BUTTON_WIDTH, - 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_ROW8 (PR_ROW7+PR_SPACING) -#define PR_BUTTONROW (PR_ROW8+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 "Ustawienia" -FONT 8, "System" -BEGIN - CONTROL "Ust. Gry",IDC_RADIOLOCAL,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,0,PR_ROW1,44,10 - CONTROL "Globalne",IDC_RADIOGLOBAL,"Button", - BS_AUTORADIOBUTTON,44,PR_ROW1,56,10 - - /* Global */ - CONTROL "Koloruj używane klocki ",IDC_CHECKCOLORPLAYED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP, - 4,PR_ROW2,85,PREFS_ROW_HT - CONTROL "Włącz kursor",IDC_CHECKSHOWCURSOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW3,80,PREFS_ROW_HT - CONTROL "Pokazuj pkty robotów",IDC_CHECKROBOTSCORES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW4,90,PREFS_ROW_HT - CONTROL "Nie pytaj o ruch",IDC_SKIPCONFIRM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW5,80,PREFS_ROW_HT - CONTROL "Ukryj wartość klocków",IDC_HIDETILEVALUES,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW6,82,PREFS_ROW_HT - PUSHBUTTON "Ustaw kolory...",IDC_PREFCOLORS,4,PR_ROW7,60,12 - PUSHBUTTON "Zmień język...",IDC_PREFLOCALE,4,PR_ROW8,60,12 -#ifdef ALLOW_CHOOSE_FONTS - PUSHBUTTON "Wybierz font...",IDC_PREFFONTS,4,PR_ROW9,60,12 -#endif - - /* Per game */ - CONTROL "Mądry robot",IDC_CHECKSMARTROBOT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,4,PR_ROW2,60, - PREFS_ROW_HT - CONTROL "Włącz podpowiedzi",IDC_CHECKHINTSOK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW3,80,PREFS_ROW_HT -#ifdef XWFEATURE_SEARCHLIMIT - CONTROL "Ogranicz podp.",IDC_CHECKHINTSLIMITS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8+10,PR_ROW4-2,60,10 -#endif - CONTROL "Włącz zegar (minuty)",TIMER_CHECK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,PR_ROW5,74,PREFS_ROW_HT - EDITTEXT TIMER_EDIT,79,PR_ROW5,16,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Zmyślone:",PHONIES_LABEL,4,PR_ROW6,32,PREFS_ROW_HT - XWCOMBO(PHONIES_COMBO, 42,PR_ROW6,40,PREFS_ROW_HT,0,58,0) - -#ifdef FEATURE_TRAY_EDIT - CONTROL "Pokaż awers klocków", IDC_PICKTILES, "Button", - BS_AUTOCHECKBOX | WS_TABSTOP,4,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 - PUSHBUTTON "Anuluj",IDCANCEL,PR_CANCEL_LEFT,PR_BUTTONROW, - 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_LABEL_HT (LABEL_ROW_HT*1) /* try to make them all same ht! */ -# define CONN_HELP_HT 25 -# 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_3+CONN_LABEL_HT+3) -# endif -# ifndef RELAY_NOEDIT_ADDR -# define CONN_ROW_5 (CONN_ROW_4+CONN_HELP_HT+5) -# define CONN_ROW_6 (CONN_ROW_5+CONN_LABEL_HT+3) -# define CONN_ROW_7 (CONN_ROW_6+ROW_SPACE+5) -# define CONN_ROW_8 (CONN_ROW_7+CONN_LABEL_HT+3) -# define BUTTON_ROW (CONN_ROW_8+ROW_SPACE) -#else -# define BUTTON_ROW (CONN_ROW_4+CONN_HELP_HT) -#endif -#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 "Połączenie" -FONT 8, "System" -BEGIN - -#ifdef NEEDS_CHOOSE_CONNTYPE - LTEXT "Połącz przez:",IDC_CCONVIA_LAB,LAB_COL,CONN_ROW_1,40, - ROW_HEIGHT - XWCOMBO(IDC_CONNECT_COMBO, CTRL_COL,CONN_ROW_2,CTRL_COL_WIDTH,ROW_HEIGHT, - 0,58,0) -#endif - -#if defined XWFEATURE_RELAY - LTEXT "Pokój:", - IDC_INVITE_LAB,LAB_COL,CONN_ROW_3,23,CONN_LABEL_HT - EDITTEXT INVITE_EDIT,LAB_COL+25,CONN_ROW_3,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL - LTEXT "(As host, you name the room for the game, and must " - "connect first.)", - IDC_INVITE_HELP_HOST,LAB_COL,CONN_ROW_4,110,CONN_HELP_HT - LTEXT "(As guest, wait for the host to connect then tell you " - "the room name.)", - IDC_INVITE_HELP_GUEST,LAB_COL,CONN_ROW_4,100,CONN_HELP_HT -# ifndef RELAY_NOEDIT_ADDR - LTEXT "Serwer (raczej niezmienny):",IDC_CRELAYNAME_LAB, - LAB_COL,CONN_ROW_5,120,ROW_HEIGHT - EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH, - ROW_HEIGHT,ES_AUTOHSCROLL - LTEXT "Port (raczej niezmienny):",IDC_CRELAYPORT_LAB, - 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 -# endif -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Połączenie z serwerem niedostępne.",IDC_INVITE_LAB, - LAB_COL,CONN_ROW_3,40,40 -#endif - -#if defined XWFEATURE_IP_DIRECT - LTEXT "Nazwa hosta lub adres",IDC_IPNAME_LAB, - LAB_COL,CONN_ROW_3,100,ROW_HEIGHT - EDITTEXT IPNAME_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT,ES_AUTOHSCROLL -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "Połączenie bezpośrednie z IP niedostępne.",IDC_IPNAME_LAB, - LAB_COL,CONN_ROW_3,40,40 -#endif - -#if defined XWFEATURE_SMS - LTEXT "Nr telefonu hosta:",IDC_SMS_PHONE_LAB,LAB_COL,CONN_ROW_3,60,ROW_HEIGHT - EDITTEXT IDC_SMS_PHONE_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Port hosta:",IDC_SMS_PORT_LAB,LAB_COL,CONN_ROW_5,60,ROW_HEIGHT - EDITTEXT IDC_SMS_PORT_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH,ROW_HEIGHT, - ES_AUTOHSCROLL | ES_NUMBER -#elif defined NEEDS_CHOOSE_CONNTYPE - LTEXT "SMSy niedostępne.", - 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 - DEFPUSHBUTTON "Anuluj",IDCANCEL,70,BUTTON_ROW, - 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+5) -#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 4 -#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,ht) \ - LTEXT txt,id,xx,yy,CLR_LAB_WIDTH,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 "Edycja",id1,xx+CLR_SAMPLE_WIDTH+4,yy,26,CLR_BUT_HT,BS_NOTIFY - -IDD_COLORSDLG DIALOG DISCARDABLE 0, 20, CLR_WIDTH, COLORSDLG_HT -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL -CAPTION "Ustawienia kolorów" -FONT 8, "System" -BEGIN - COLOR_BUTTON("Litera x2:",DLBLTR_LABEL,CLR_COL_1,CLR_ROW_1,CLR_LAB_HT) - COLOR_SAMPLE(DLBLTR_BUTTON,DLBLTR_SAMPLE,CLR_COL_2,CLR_ROW_1) - - COLOR_BUTTON("Słowo x2:",DBLWRD_LABEL,CLR_COL_1,CLR_ROW_2,CLR_LAB_HT ) - COLOR_SAMPLE(DBLWRD_BUTTON,DBLWRD_SAMPLE,CLR_COL_2,CLR_ROW_2) - COLOR_BUTTON("Litera x3:",TPLLTR_LABEL,CLR_COL_1,CLR_ROW_3,CLR_LAB_HT ) - COLOR_SAMPLE(TPLLTR_BUTTON,TPLLTR_SAMPLE,CLR_COL_2,CLR_ROW_3) - - COLOR_BUTTON("Słowo x3:",TPLWRD_LABEL,CLR_COL_3,CLR_ROW_4,CLR_LAB_HT) - COLOR_SAMPLE(TPLWRD_BUTTON,TPLWRD_SAMPLE,CLR_COL_4,CLR_ROW_4) - COLOR_BUTTON("Pusta:",EMPCELL_LABEL,CLR_COL_1,CLR_ROW_5,CLR_LAB_HT) - COLOR_SAMPLE(EMPCELL_BUTTON,EMPCELL_SAMPLE,CLR_COL_2,CLR_ROW_5) - COLOR_BUTTON("Rewers:",TBACK_LABEL,CLR_COL_3,CLR_ROW_6,CLR_LAB_HT) - COLOR_SAMPLE(TBACK_BUTTON,TBACK_SAMPLE,CLR_COL_4,CLR_ROW_6) - COLOR_BUTTON("Kolor wybranego:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_7, - CLR_LAB_HT+10) - COLOR_SAMPLE(FOCUSCLR_BUTTON,FOCUSCLR_SAMPLE,CLR_COL_2,CLR_ROW_7+5) - COLOR_BUTTON("Gracz 1:",PLAYER1_LABEL,CLR_COL_1,CLR_ROW_8,CLR_LAB_HT) - COLOR_SAMPLE(PLAYER1_BUTTON,PLAYER1_SAMPLE,CLR_COL_2,CLR_ROW_8) - COLOR_BUTTON("Gracz 2:",PLAYER2_LABEL,CLR_COL_3,CLR_ROW_9,CLR_LAB_HT) - COLOR_SAMPLE(PLAYER2_BUTTON,PLAYER2_SAMPLE,CLR_COL_4,CLR_ROW_9) - COLOR_BUTTON("Gracz 3:",PLAYER3_LABEL,CLR_COL_1,CLR_ROW_10,CLR_LAB_HT) - COLOR_SAMPLE(PLAYER3_BUTTON,PLAYER3_SAMPLE,CLR_COL_2,CLR_ROW_10) - COLOR_BUTTON("Gracz 4:",PLAYER4_LABEL,CLR_COL_3,CLR_ROW_11,CLR_LAB_HT) - COLOR_SAMPLE(PLAYER4_BUTTON,PLAYER4_SAMPLE,CLR_COL_4,CLR_ROW_11) - -#ifndef _WIN32_WCE - DEFPUSHBUTTON "OK",IDOK,CLR_OK_LEFT,CLR_BUTTON_ROW, - REPOS_BUTTON_WIDTH,BUTTON_HT,BS_NOTIFY - PUSHBUTTON "Anuluj",IDCANCEL,CLR_CANCEL_LEFT,CLR_BUTTON_ROW, - 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("Czerw.:", CLREDIT_ROW_1, RED_LABEL, RED_EDIT, CLREDT_SLIDER1 ) - COLOR_EDIT_LINE("Ziel.:", CLREDIT_ROW_2, GREEN_LABEL, GREEN_EDIT, CLREDT_SLIDER2 ) - COLOR_EDIT_LINE("Nieb.:", CLREDIT_ROW_3, BLUE_LABEL, BLUE_EDIT, CLREDT_SLIDER3 ) - - /* 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, - REPOS_BUTTON_HT - PUSHBUTTON "Anuluj",IDCANCEL,CLRE_CANCEL_LEFT,56,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END -#endif - -IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 80 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER -CAPTION "Language Picker" -FONT 8, "System" -BEGIN - LTEXT "Wybierz język menu oraz okien dialogowych. (języki dostępne są na stronie xwords.sf.net.)", - LOCALES_LABEL,LEFT_COL,2,80,50 - - XWCOMBO(LOCALES_COMBO,LEFT_COL,53,70,12,0,58,0) - -# ifndef _WIN32_WCE - DEFPUSHBUTTON "OK",IDOK,LEFT_COL,70,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT - PUSHBUTTON "Anuluj",IDCANCEL,40,70,REPOS_BUTTON_WIDTH, - REPOS_BUTTON_HT -# endif -END - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table. Note that these are utf-8 strings unless L proceeds the -// first ". -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_MENU "Menu" - IDS_DUMMY "--" - IDS_CANCEL "Anuluj" - IDS_OK "OK" - IDS_DONE "Gotowe" - IDS_LANGUAGE_NAME "Polski" - IDS_NEW_GAME "Nowa gra" - IDS_ABOUT "Crosswords " ABOUT_VERSION " (REV " SVN_REV ") "\ - "dla Windows Mobile. Copyright 1998-2010 "\ - "Eric House. Oprogramowanie wydane na "\ - "publicznej licencji GNU.\r\r"\ - "Tłumaczenie: Piotr Bartkowiak."\ - "Słowniki, dokumentacja i kod źródłowy, dostępne na "\ - "http://xwords.sf.net i http://eehouse.org/xwords/." - IDS_DICTLOC "Pliki słowników (.xwd) zainstaluj "\ - "w tym samym katalogu co plik .exe, lub "\ - "w katalogu nazwanym Crosswords na karcie pamięci, "\ - "np. w \\storage card\\crosswords. "\ - "Pobierz słowniki z http://xwords.sf.net lub "\ - "http://eehouse.org/xwords." - IDS_SAVENAME "Podaj nazwę aktualnej gry (możesz ją zmienić "\ - "korzystając z okna zapisanych gier.)" - IDS_DUPENAME "Podaj nazwę dla kopii aktualnej gry." - IDS_RENAME "Podaj nową nazwę dla wybranej gry." - - IDS_REMAINING_TILES_ADD "+ %d [pozostałych klocków]" - IDS_UNUSED_TILES_SUB "- %d [nieużytych klocków]" - IDS_BONUS_ALL "bonus za użycie wszystkich: 50" XP_CR - IDS_TURN_SCORE "punktacja za kolejkę: %d" XP_CR - IDS_COMMIT_CONFIRM "wykonać ruch?" XP_CR - IDS_LOCAL_NAME "%s" - IDS_IGNORE_L "Ignoruj" - IDS_WARN_L "Ostrzeż" - IDS_DISALLOW_L "Zabroń" - IDS_NONLOCAL_NAME "%s (zdalne)" - IDS_TIME_PENALTY_SUB " - %d [czas]" - IDS_CUMULATIVE_SCORE "wynik kumulowany: %d" XP_CR - IDS_MOVE_ACROSS "przesuń (od %s w poziomie)" XP_CR - IDS_MOVE_DOWN "przesuń (od %s w pionie)" XP_CR - IDS_TRAY_AT_START "na początku w ręce: %s" XP_CR - IDS_NEW_TILES "nowych klocków: %s" XP_CR - IDS_TRADED_FOR "wymieniono %s za %s." - IDS_PASS "pass" XP_CR - IDS_PHONY_REJECTED "niedozwolone słowo; kolejka stracona!" XP_CR - IDS_ROBOT_TRADED "Robot wymienił %d klocków." - IDS_ROBOT_MOVED "Robot wykonał ruch:" XP_CR - IDS_REMOTE_MOVEDF "Zdalny gracz wykonał ruch:" XP_CR - IDS_PASSED "spasował" - IDS_SUMMARYSCORED "%s:%d" - IDS_TRADED "wymienione %d" - IDS_LOSTTURN "stracona kolejka" - IDS_TOTALPLAYERS "Ilość graczy:" - IDS_VALUES_HEADER "%s liczone/wartości:" XP_CR - IDS_QUERY_TRADE "Na pewno wymienić wybrane literki?" - IDS_DOUBLE_LETTER "Litera x2" - IDS_DOUBLE_WORD "Słowo x2" - IDS_TRIPLE_LETTER "Litera x3" - IDS_TRIPLE_WORD "Słowo x3" - IDS_INTRADE_MW "Wymiana klocków." XP_CR "Wybierz 'koniec kolejki'"\ - XP_CR "gdy zakończysz." - - IDS_TILES_NOT_IN_LINE "Wszystkie układane litery muszą być w linii." - IDS_NO_EMPTIES_IN_TURN "W układanym słowie nie może być pustych miejsc." - IDS_TWO_TILES_FIRST_MOVE "W pierwszym ruchu musisz użyc minimum 2 liter." - IDS_TILES_MUST_CONTACT "Układane litery muszą dotykać istniejących słów (lub "\ - "środkowego pola przy pierwszym ruchu)." - IDS_NOT_YOUR_TURN "Nie możesz tego zrobić; To nie Twoja kolejka!" - IDS_NO_PEEK_ROBOT_TILES "Nie można podglądać klocków Robota!" - IDS_TOO_FEW_TILES_LEFT_TO_TRADE "Zbyt mało klocków by dokonać wymiany." - IDS_CANT_UNDO_TILEASSIGN "Nie można zmienić ułożenia klocków." - IDS_CANT_HINT_WHILE_DISABLED "Podpowiedzi są wyłączone dla tej gry. "\ - "Można je włączyć dla nowej gry, korzystając z "\ - "okna Ustawień." - - IDS_COUNTSVALS_L "Wartości i ilości klocków" - IDS_REMTILES_L "Pozostałe klocki" - IDS_GAMEHIST_L "Historia gry" - IDS_FINALSCORE_L "Ostateczne wyniki" - IDS_QUESTION_L "Pytanie" - IDS_ILLEGALWRD_L "Niedozwolone słowo" - IDS_WRDNOTFOUND "Słowo[a] %s nie znalezione w słowniku." - IDS_USEANYWAY "Użyć go tak czy siak?" - IDS_FYI_L "Ups!" - IDS_CANNOTOPEN_GAME "Nie mogę otworzyć zapisanej gry." - IDS_NODICT_L "Nie znalazłem słownika" - IDS_ABOUT_L "O grze Crosswords" - IDS_OVERWRITE "Na pewno chcesz nadpisać istniejący plik?" - IDS_ENDNOW "Na pewno chcesz zakończyć grę?" - IDS_CANNOTOPEN_DICT "Nie mogę otworzyć słownika: %s" - IDS_CONFIM_DELETE "Czy na pewno mam skasować wybraną grę? "\ - "Tej operacji nie można później cofnąć." - - IDS_ROLE_STANDALONE "Niezależny" - IDS_ROLE_HOST "Host" - IDS_ROLE_GUEST "Gość" - IDS_PLAYER_FORMAT "Gracz %d" - IDS_UNTITLED_FORMAT "Beznazwy %d" - IDS_PASSWDFMT_L "Wprowadź hasło dla %ls:" - IDS_FILEEXISTSFMT_L "Plik %s już istnieje." - IDS_NEED_TOUCH "Ta opcja wymaga ekranu dotykowego." - IDS_EDITCOLOR_FORMAT "Edycja koloru %s" - IDS_LANG_CHANGE_RESTART "Musisz zrestartować Crosswords aby nowe ustawienia zadziałały." - -#ifndef XWFEATURE_STANDALONE_ONLY - IDS_RESEND_STANDALONE "To jest gra lokalna, nie ma czego wysyłać." - IDS_PHONE_OFF "Crosswords nie może się połączyć, prawdopodobnie "\ - "moduł GSM/WLAN jest wyłączony. Uruchom moduł sieciowy "\ - "i zrestartuj Crosswords." - IDS_NETWORK_FAILED "Nie mogę uruchomić połączenia sieciowego." - IDS_CONN_RELAY_L "Serwer" - IDS_CONN_DIRECT "Bezpośrednie" - IDS_LOCALPLAYERS "lokalni gracze:" - IDS_NO_PEEK_REMOTE_TILES "Nie można podejrzeć zdalnych graczy!" - IDS_REG_UNEXPECTED_USER "Odmowa rejestracji niespodziewanego gracza." - IDS_SERVER_DICT_WINS "Konflikt słowników hosta i gościa. Host jest ważniejszy." - IDS_REG_SERVER_SANS_REMOTE "Przynajmniej jeden gracz musi być ustawiony jako zdalny "\ - "Rozpoczyna host." - -# ifdef XWFEATURE_SMS - IDS_SMS_CONN_L "Wiadomości" -# endif -# ifdef XWFEATURE_IP_DIRECT - IDS_DIRECT_CONN_L "Połączenie bezpośrednie." -# endif - -# ifdef XWFEATURE_RELAY - IDS_XWRELAY_ERROR_TIMEOUT "Minął czas połączenia z serwerem; najczęściej oznacza to,"\ - "że inni gracze się nie pojawili." - IDS_ERROR_HEART_YOU "Rozłączono grę przez serwer, z powodu zbyt długiego "\ - "oczekiwania na Twoją odpowiedź." - IDS_XWRELAY_ERROR_HEART_OTHER "Serwer utracił połączenie z graczem." -/* IDS_XWRELAY_ERROR_LOST_OTHER "Utracono połączenie z graczem." */ - IDS_XWRELAY_RELAY_INCOMPAT "Serwer wymaga nowej wersji Crosswords. "\ - "Musisz zainstalować nowszą wersję Aplikacji." - IDS_RELAY_HOST_WAITINGD "Połączony jako host. Czekam na połączenie "\ - "%d gracza[y]." - IDS_RELAY_GUEST_WAITINGD "Połączony jako gość. Wciąż czekam za "\ - "for %d graczem[ami]." - IDS_RELAY_ALLHERE "Wszyscy gracze połączeni." - - IDS_ERROR_NO_ROOM "Brak pokoju. Czy host na pewno jest połączony "\ - "i zarezerwował nazwę pokoju?" - IDS_ERROR_DUP_ROOM "Ten pokój został zarezerwowany przez innego hosta. "\ - "Zmień nazwę, połącz się jako gość lub "\ - "spróbuj jeszcze raz za parę minut." - IDS_ERROR_TOO_MANY "Brak hosta oczekującego na tylu graczy. "\ - "Zmniejsz ilość graczy w ustawieniach." -# endif -#endif - -END - -#ifdef AM_BASE_LANGUAGE -# include "../common_rsrc.rc" -#endif - -#endif diff --git a/xwords4/wince/newres.h b/xwords4/wince/newres.h deleted file mode 100755 index ac5edb7bc..000000000 --- a/xwords4/wince/newres.h +++ /dev/null @@ -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 - #define SHMENUBAR RCDATA - #if defined(WIN32_PLATFORM_PSPC) && (_WIN32_WCE >= 300) - #include - #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__ diff --git a/xwords4/wince/rc_incs.h b/xwords4/wince/rc_incs.h deleted file mode 100644 index 9715454f1..000000000 --- a/xwords4/wince/rc_incs.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/resource.h b/xwords4/wince/resource.h deleted file mode 100755 index 31a596ad2..000000000 --- a/xwords4/wince/resource.h +++ /dev/null @@ -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 diff --git a/xwords4/wince/scripts/check_ids.sh b/xwords4/wince/scripts/check_ids.sh deleted file mode 100755 index a29f08f25..000000000 --- a/xwords4/wince/scripts/check_ids.sh +++ /dev/null @@ -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: [*]" -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 diff --git a/xwords4/wince/scripts/dll2cab.pl b/xwords4/wince/scripts/dll2cab.pl deleted file mode 100755 index 055faafa3..000000000 --- a/xwords4/wince/scripts/dll2cab.pl +++ /dev/null @@ -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 - # #command line - - 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(); diff --git a/xwords4/wince/scripts/exe2cab.pl b/xwords4/wince/scripts/exe2cab.pl deleted file mode 100755 index b1d3080d0..000000000 --- a/xwords4/wince/scripts/exe2cab.pl +++ /dev/null @@ -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 - # #command line - - $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(); diff --git a/xwords4/wince/scripts/makezip.sh b/xwords4/wince/scripts/makezip.sh deleted file mode 100755 index 47b482b42..000000000 --- a/xwords4/wince/scripts/makezip.sh +++ /dev/null @@ -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 < $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() { - 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 .= "\n"; - $output .= "\t\n"; - $output .= "\t\t\n"; - $output .= "\t\t\n"; - $output .= "\t\t\n"; - $output .= "\t\t\n"; - $output .= "\t\t\n"; - $output .= "\t\t\n"; - my @filenames = get_value_sorted_keys %file_ids; - my $firstdir = $file_dirs{$filenames[0]}; - $firstdir =~ s/\//\\/g; - $output .= "\t\t\n"; - my $dirs = scalar keys %directory_ids; - my $files = scalar keys %file_ids; - $output .= "\t\t\n"; - $output .= "\t\t\n"; - $output .= "\t\t\n"; - $output .= "\t\t\n"; - my $shortcuts = scalar keys %links; - $output .= "\t\t\n"; - $output .= "\t\n"; - - $output .= "\t\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\n"; - $output .= "\t\t\t\n"; - $output .= "\t\t\t\n"; - $output .= "\t\t\t\t\n"; - $output .= "\t\t\t\t\t\n"; - $output .= "\t\t\t\t\n"; - $output .= "\t\t\t\n"; - $output .= "\t\t\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\n"; - $output .= "\t\t\t\n"; - $output .= "\t\t\t\n"; - $output .= "\t\t\t\t\n"; - $output .= "\t\t\t\t\t\n"; - $output .= "\t\t\t\t\n"; - $output .= "\t\t\t\n"; - $output .= "\t\t\n"; - } - $output .= "\t\n"; - $output .= "\t\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\n"; - $output .= "\t\t\t\n"; - $output .= "\t\t\n"; - } - $output .= "\t\n"; - $output .= "\n"; - - return $output; -} - - -# Prints the version message and exits. -sub version() -{ - print - "pocketpc-cab 1.0.1\n" . - "Written by Shaun Jackman .\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 [I