remove unused platforms for speedier checkouts

This commit is contained in:
eehouse 2010-02-06 19:08:36 +00:00
parent fb65fecebb
commit 4de6b82899
182 changed files with 0 additions and 34703 deletions

View file

@ -1,23 +0,0 @@
xwords4.seb
xwords4_sa.coff
xwords4_sa.link
xwords4_sa.map
xwords4_sa.seg
xwords4_sa.sym
xwords4.chk
xwords4.coff
xwords4.fxe
xwords4.icn
xwords4.link
xwords4.map
bmps_includes.h
lib.snk32
libraries.link
os.cmd
sGDB
GDB
xwords4.mp
xwords4.seg
xwords4.sym
xwords4_sa
xwords4

View file

@ -1,53 +0,0 @@
/*
* Copyright 1997 - 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.
*/
/*
* For faking out franklin compiler for now.
*/
enum {
STRD_REMAINING_TILES_ADD,
STRD_UNUSED_TILES_SUB,
STR_COMMIT_CONFIRM,
STR_BONUS_ALL,
STRD_TURN_SCORE,
STR_NONLOCAL_NAME,
STR_LOCAL_NAME,
STRD_TIME_PENALTY_SUB,
STRD_CUMULATIVE_SCORE,
STRS_TRAY_AT_START,
STRS_MOVE_DOWN,
STRS_MOVE_ACROSS,
STRS_NEW_TILES,
STRSS_TRADED_FOR,
STR_PASS,
STR_PHONY_REJECTED,
STRD_ROBOT_TRADED,
STR_ROBOT_MOVED,
STR_REMOTE_MOVED,
STRD_TRADED,
STRSD_SUMMARYSCORED,
STR_PASSED,
STR_LOSTTURN,
STRS_VALUES_HEADER,
STR_LAST
};

View file

@ -1,166 +0,0 @@
# -*- mode: Makefile; compile-command: "make -k ARCH=i686"; -*-
# ©2001 Franklin Electronic Publishers, Inc. Burlington, NJ.
# File: gui/test/Makefile
#
PLATFORM = franklin
COMMON = ../common
ifndef ARCH
$(error "Franklin builds require the environment variable ARCH. ")
endif
XW_DEFINES = -DPLATFORM_EBOOK -DPOINTER_SUPPORT -DKEY_SUPPORT -DSHOW_PROGRESS \
-DXWFEATURE_STANDALONE_ONLY -DFEATURE_TRAY_EDIT -DXWFEATURE_SEARCHLIMIT \
-DNODE_CAN_4 -DUSE_PATTERNS -D__LITTLE_ENDIAN
include ../common/config.mk
APPNAME = xwords4
# Define the list of source files
SRCS_CPP = frankdraw.cpp \
frankmain.cpp \
franksavedgames.cpp \
frankask.cpp \
frankgamesdb.cpp \
frankpasswd.cpp \
frankshowtext.cpp \
frankdict.cpp \
frankletter.cpp \
frankplayer.cpp \
frankdlist.cpp
SRCS_C =
SRCS_S =
# Program parameters (ebo_locate needs 12K of stack)
#HEAPSPACE = 98304
HEAPSPACE = 409600 # 0x64000
MAINSTACKSPACE = 16384
TIMERSTACKSPACE = 4096
# Environment: Use "yes" or "no"
GUI_LOCAL_COPY = no
OS_LOCAL_COPY = no
LANG_LOCAL_COPY = no
GUI_LANGUAGE = GUI_Amr.pkg
OS_BASEDIR = ../../../os
GUI_BASEDIR = ../source
#To prevent warnings from stopping the compilation, change the following line
#to "ERROR=" or start the make using "make ERROR=".
ERROR = -Werror
OBJS = ${COMMONOBJ}
# Include the standard Makefile targets
ifeq (x$(EBSDK_LIBS)x,xx)
# Normal: binary release version
include ${EBOOKMAN_SDK}/ebsdk.uses
include ${ESDK_TARGET_INC}/Makefile.GUI
else
# Special: building the SDK
include ${EBSDK_LIBS}/ebookman_libs.uses
include ../source/Makefile.GUI
endif
#
# At this point in the Makefile, you can put overrides for variables that
# were set in "Makefile.GUI".
#
#Create linkable version of VoiceAge file
#${OBJDIR}/objects.link: welcome.voiceage
#welcome.voiceage: welcome.seb
# tail -c+4097 <welcome.seb >welcome.voiceage
#CLEANLIST += welcome.voiceage
#Need this for an os1 link of a program that uses floating-point
#GCC_LIB = ${ESDK_LIBGCC_INSTALL_LIBFILE_FLOAT}
INCFLAGS += -I$(COMMON) -I../relay -I./
CFLAGS += ${XW_DEFINES} -DCPLUS
CFL_NOCPLUS = $(subst -DCPLUS,,${CFLAGS})
CLEANLIST += ${COMMONOBJ}
# dependencies for image generation
BMPS = ./bmps
frankmain.cpp: bmps_includes.h
$(BMPS)/%.cpp: $(BMPS)/%.pbitm
./pbitm2frank.pl $< $* > $@
GENIMGS = $(BMPS)/flip.cpp \
$(BMPS)/lightbulb.cpp \
$(BMPS)/valuebutton.cpp \
$(BMPS)/undo.cpp \
# listing the .cpp files here as dependencies should be all that's
# needed to get them generated.
bmps_includes.h: $(GENIMGS)
@echo "/* This file generated in Makefile; do not edit!!! */" > $@
for f in $^; do echo "#include \"$$f\"" >> $@; done
#
# Generic rules for invoking the compiler and assembler. Stolen from
# Makefile.GUI
#
${COMMONOBJDIR}/%.s :: ${COMMON}/%.c
${ESDK_GCC32_EXE} -b sneak32 -g $(CFL_NOCPLUS) -mclist -S -o $@ -c $<
${COMMONOBJDIR}/%.i :: ${COMMON}/%.c
${ESDK_GCC32_EXE} -b sneak32 -g $(CFL_NOCPLUS) -mclist -E -o $@ -c $<
${COMMONOBJDIR}/%.i :: ${COMMON}/%.cpp
${ESDK_GXX32_EXE} -b sneak32 -g $(CFLAGS) -mclist -E -o $@ -c $<
${COMMONOBJDIR}/%.s :: ${COMMON}/%.cpp
${ESDK_GXX32_EXE} -b sneak32 -g $(CFLAGS) -mclist -S -o $@ -c $<
${COMMONOBJDIR}/%.o :: ${COMMON}/%.cpp
${ESDK_GXX32_EXE} -b sneak32 -g $(CFLAGS) -o $@ -c $<
${COMMONOBJDIR}/%.o :: ${COMMON}/%.c
${ESDK_GCC32_EXE} -b sneak32 -g $(CFL_NOCPLUS) -o $@ -c $<
${COMMONOBJDIR}/%.o :: ${COMMONOBJDIR}/%.s
${ESDK_ASM32_EXE} -case ${INCFLAGS} -po ${COMMONOBJDIR} -o $<
# Targets to allow build without copying lots of files in. First has
# hack to force directory creation
os.link os.def standalone.link:
mkdir -p ../common/franklin
ln -s $$(find $${EBOOKMAN_SDK} -follow -name $@ | grep gui) $@
# get rid of the welcome crap
libraries.link:
cat $$(find $${EBOOKMAN_SDK} -follow -name $@ | grep gui) | \
grep -v Welcome > $@
#
# The following targets are usable only during SDK creation. They are for
# copying this directory to samples/gui/test.
#
build: os sa
configure:
do_install_out: build
mkdir -p ${ELIB_GUI_INSTALL_SAMPLE_TESTDIR}
(tar cf - . | (cd ${ELIB_GUI_INSTALL_SAMPLE_TESTDIR} && tar xf -))
memdebug:
$(MAKE) "XW_DEFINES = ${XW_DEFINES} -DMEM_DEBUG -DDEBUG"
test:
echo ${OBJS}

View file

@ -1,56 +0,0 @@
This file describes how to build Crosswords for Franklin's eBookman.
It should be possible to do eBookman development on either Windows
(with cygwin) or Linux, but I've only done it on Linux, so that's what
I'll describe. I expect it's not much different on Windows once
cygwin's installed.
You can get the SDK, and instructions for installing it, here:
http://download.franklin.com/franklin/ebookman/developer/
There are two environment variables you'll need to build for eBookman.
Add these to your shell startup script. Here's mine (for bash):
export ARCH=i686
export EBOOKMAN_SDK=/home/ehouse/franklin/SDK
You can build either for the simulator/debugger, or to run on a
device. For the simulator, type at a commandline in this directory:
# make memdebug
or
# make
Provided you have a copy of BasEnglish2to8.xwd in this directory, you
can then run Crosswords in the simulator by typing:
# ./sGDB
(To run with additional dictionaries, edit initial.mom.)
The command ./GDB is also available. The difference is that the
former is much faster and launches you directly into Crosswords, while
the latter launches the device's App Picker screen, allowing you to
launch Crosswords the way an end-user would. sGDB is what I use 95%
of the time.
(The simulator is a bit rough. Not all of the buttons work, etc. To
at least get started, wait for the two windows to come up. Go to the
one titled "Source Window", and choose "Continue" on the "Control"
menu. That'll get Crosswords running.)
To build a .seb file you can install on a device, type
# make xwords4.seb
Install this on an eBookman together with at least one dictionary
(e.g. BasEnglish2to8.seb) and you're good to go.
******************
On debugging: I've never had much luck with the source-level debugger
in the eBookman SDK. I use XP_DEBUGF statements a lot, and do common
code development on the Linux port where debugging's better. If you're
using cygwin on Windows you may have better luck.

View file

@ -1,4 +0,0 @@
flip.cpp
lightbulb.cpp
undo.cpp
valuebutton.cpp

View file

@ -1,12 +0,0 @@
############
#-##########
#--#########
#---########
#----#######
#-----######
#------#####
#-------####
#--------###
#---------##
#----------#
############

View file

@ -1,11 +0,0 @@
############
#-###--###-#
####-##-####
###-####-###
#-#-####-#-#
####-##-####
####-##-####
##-##--##-##
#-###--###-#
#####--#####
############

View file

@ -1,11 +0,0 @@
############
#####-######
####--######
###---######
##--------##
#---------##
##--------##
###---######
####--######
#####-######
############

View file

@ -1,12 +0,0 @@
############
##--######-#
###-#####-##
###-####-###
###-###-####
##---#-#####
#####-#---##
####-#-###-#
###-##-----#
##-###-###-#
#-####-###-#
############

View file

@ -1,108 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 1999-2001 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 0
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "sys.h"
#include "gui.h"
#include "OpenDatabases.h"
#include "ebm_object.h"
extern "C" {
#include "xptypes.h"
#include "board.h"
#include "model.h"
}
#include "frankids.h"
#include "frankask.h"
#define FIRST_BUTTON_ID 2000
CAskDialog::CAskDialog( U16* resultP, char* question, U16 numButtons, ... )
: CWindow( ASK_WINDOW_ID, 2, 50, 196, 80, "Question..." )
{
U16 i;
va_list ap;
this->resultP = resultP;
this->question = question;
this->drawInProgress = FALSE;
U16 horSpacing = 196 / (numButtons+1);
va_start(ap, numButtons);
for ( i = 0; i < numButtons; ++i ) {
char* buttName = va_arg( ap, char*);
XP_DEBUGF( "button %d's title is %s\n", i, buttName );
CButton* button = new CButton( i+FIRST_BUTTON_ID, 0, 0, buttName );
U16 width = button->GetWidth();
U16 bx = horSpacing * (i+1);
this->AddChild( button, bx - (width/2), 40 );
}
va_end(ap);
this->textY = 10;
this->textX = 5;
} // CAskDialog::CAskDialog
void
CAskDialog::Draw()
{
if ( !this->drawInProgress ) {
this->drawInProgress = TRUE;
CWindow::Draw(); // buttons, etc.
this->DrawText( this->question, this->textX, this->textY );
this->drawInProgress = FALSE;
}
} // CAskDialog::Draw
S32
CAskDialog::MsgHandler( MSG_TYPE type, CViewable *object, S32 data )
{
S32 result = 0;
S16 id;
switch (type) {
case MSG_BUTTON_SELECT:
id = object->GetID();
*this->resultP = id - FIRST_BUTTON_ID;
this->Close();
result = 1;
default:
break;
}
if ( result == 0 ) {
result = CWindow::MsgHandler( type, object, data );
}
return result;
} // CGamesBrowserWindow::MsgHandler
#endif /* 0 */

View file

@ -1,40 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001 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 0
#ifndef _FRANKASK_H_
#define _FRANKASK_H_
class CAskDialog : public CWindow {
private:
U16* resultP;
U16 textY;
U16 textX;
char* question;
BOOL drawInProgress;
public:
CAskDialog( U16* resultP, char* question, U16 numButtons, ...);
void Draw();
S32 MsgHandler( MSG_TYPE type, CViewable *object, S32 data );
};
#endif
#endif /* 0 */

View file

@ -1,445 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
/*
* Copyright 1997-2001 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 <ebm_object.h>
#include "dictnryp.h"
#include "frankdict.h"
#include "frankids.h"
#ifdef CPLUS
extern "C" {
#endif
typedef struct FrankDictionaryCtxt {
DictionaryCtxt super;
void* base;
size_t dictSize;
BOOL isMMC; /* means the base must be free()d */
} FrankDictionaryCtxt;
static void frank_dictionary_destroy( DictionaryCtxt* dict );
static void loadSpecialData( FrankDictionaryCtxt* ctxt, U8** ptr );
static U16 countSpecials( FrankDictionaryCtxt* ctxt );
static int tryLoadMMCFile( MPFORMAL XP_UCHAR* dictName, U8** ptrP,
size_t* size );
static U32 ntohl_noalign(U8* n);
static U16 ntohs_noalign(U8** n);
U16
GetDictFlags( ebo_enumerator_t* eboe, FileLoc loc )
{
U16 flags = FRANK_DICT_FLAGS_ERROR;
U16 tmp;
if ( loc == IN_RAM ) {
ebo_name_t* name = &eboe->name;
size_t size = EBO_BLK_SIZE;
U8* ptr = (U8*)OS_availaddr + FLAGS_CHECK_OFFSET;
#ifdef DEBUG
int result =
#endif
ebo_mapin( name, 0, (void*)ptr, &size, 0 );
XP_ASSERT( result >= 0 );
tmp = *(U16*)ptr;
(void)ebo_unmap( ptr, size );
} else if ( loc == ON_MMC ) {
#ifdef DEBUG
long read =
#endif
ebo_iread( eboe->index, &tmp, 0, sizeof(tmp) );
XP_ASSERT( read == sizeof(tmp) );
}
XP_DEBUGF( "raw value: 0x%x", tmp );
#if BYTE_ORDER==LITTLE_ENDIAN
((char*)&flags)[0] = ((char*)&tmp)[1];
((char*)&flags)[1] = ((char*)&tmp)[0];
#else
flags = tmp;
#endif
XP_DEBUGF( "GetDictFlags returning 0x%x", flags );
return flags;
} /* GetDictFlags */
DictionaryCtxt*
frank_dictionary_make( MPFORMAL XP_UCHAR* dictName )
{
FrankDictionaryCtxt* ctxt = (FrankDictionaryCtxt*)NULL;
ctxt = (FrankDictionaryCtxt*)XP_MALLOC(mpool, sizeof(*ctxt));
XP_MEMSET( ctxt, 0, sizeof(*ctxt) );
dict_super_init( (DictionaryCtxt*)ctxt );
MPASSIGN( ctxt->super.mpool, mpool );
if ( !!dictName ) {
ebo_enumerator_t eboe;
XP_MEMSET( &eboe.name, 0, sizeof(eboe.name) );
U8* ptr = (U8*)OS_availaddr + DICT_OFFSET;
size_t size = EBO_BLK_SIZE * 75; /* PENDING(ehouse) how to find size
of file */
strcpy( (char*)eboe.name.name, (char*)dictName );
strcpy( eboe.name.publisher, PUB_ERICHOUSE );
strcpy( eboe.name.extension, EXT_XWORDSDICT );
XP_DEBUGF( "makedict: looking for %s.%s\n", dictName,
&eboe.name.extension );
int result = ebo_mapin( &eboe.name, 0, (void*)ptr, &size, 0 );
XP_DEBUGF( "ebo_mapin returned %d; size=%d\n", result, size );
int flags;
if ( result >= 0 ) {
flags = GetDictFlags( &eboe, IN_RAM );
if ( flags != 0x0001 && flags != 0x0002 && flags != 0x0003 ) {
result = -1;
}
}
if ( result < 0 ) {
result = tryLoadMMCFile( MPPARM(mpool) dictName, &ptr, &size );
if ( result >= 0 ) {
ctxt->isMMC = true;
}
}
if ( result >= 0 ) {
XP_U16 numFaces;
XP_U16 facesSize;
XP_U16 charSize;
/* save for later */
ctxt->base = (void*)ptr;
ctxt->dictSize = size;
ctxt->super.destructor = frank_dictionary_destroy;
U16 flags = ntohs_noalign( &ptr );
if ( flags == 0x0001 ) {
charSize = 1;
ctxt->super.nodeSize = 3;
} else if ( flags == 0x0002 ) {
charSize = 2;
ctxt->super.nodeSize = 3;
} else if ( flags == 0x0003 ) {
charSize = 2;
ctxt->super.nodeSize = 4;
} else {
XP_ASSERT( XP_FALSE );
charSize = 0; /* shut up compiler */
}
ctxt->super.nFaces = numFaces = *ptr++;
XP_DEBUGF( "read %d faces from dict\n", numFaces );
facesSize = numFaces * sizeof(ctxt->super.faces16[0]);
ctxt->super.faces16 = (XP_U16*)XP_MALLOC( mpool, facesSize );
XP_MEMSET( ctxt->super.faces16, 0, facesSize );
for ( XP_U16 i = 0; i < numFaces; ++i ) {
if ( charSize == 2 ) {
++ptr; /* skip the extra byte; screw unicode for
now. :-) */
}
ctxt->super.faces16[i] = *ptr++;
}
ctxt->super.countsAndValues =
(XP_U8*)XP_MALLOC(mpool, numFaces*2);
ptr += 2; /* skip xloc header */
for ( U16 i = 0; i < numFaces*2; i += 2 ) {
ctxt->super.countsAndValues[i] = *ptr++;
ctxt->super.countsAndValues[i+1] = *ptr++;
}
loadSpecialData( ctxt, &ptr );
U32 topOffset = ntohl_noalign( ptr );
ptr += sizeof(topOffset);
XP_DEBUGF( "incremented ptr by startOffset: %ld", topOffset );
ctxt->super.topEdge = ptr + topOffset;
ctxt->super.base = ptr;
#ifdef DEBUG
XP_U32 dictLength = size - (ptr - ((U8*)ctxt->base));
/* Can't do this because size is a multiple of 0x1000 created
during the memory-mapping process. Need to figure out how to
get the actual size if it ever matter. */
/* XP_ASSERT( (dictLength % 3) == 0 ); */
ctxt->super.numEdges = dictLength / 3;
#endif
}
setBlankTile( (DictionaryCtxt*)ctxt );
ctxt->super.name = frankCopyStr(MPPARM(mpool) dictName);
}
return (DictionaryCtxt*)ctxt;
} // frank_dictionary_make
static int
tryLoadMMCFile( MPFORMAL XP_UCHAR* dictName, U8** ptrP, size_t* size )
{
int result;
ebo_enumerator_t eboe;
for ( result = ebo_first_xobject( &eboe );
result == EBO_OK;
result = ebo_next_xobject( &eboe ) ) {
U16 flags;
if ( strcmp( eboe.name.publisher, PUB_ERICHOUSE ) == 0
&& strcmp( eboe.name.extension, EXT_XWORDSDICT ) == 0
&& strcmp( eboe.name.name, (char*)dictName ) == 0
&& ( ((flags = GetDictFlags(&eboe, ON_MMC)) == 0x0001)
|| (flags == 0x0002)
|| (flags == 0x0003) ) ) {
XP_DEBUGF( "looking to allocate %ld bytes", eboe.size );
void* buf = (void*)XP_MALLOC( mpool, eboe.size );
long read = ebo_iread (eboe.index, buf, 0, eboe.size );
if ( read != (long)eboe.size ) {
XP_FREE( mpool, buf );
result = -1;
} else {
*ptrP = (U8*)buf;
*size = eboe.size;
}
break;
}
}
return result;
} /* tryLoadMMCFile */
static U32
ntohl_noalign( U8* np )
{
union {
U32 num;
unsigned char aschars[4];
} u;
S16 i;
#if BYTE_ORDER==LITTLE_ENDIAN
for ( i = 3; i >= 0; --i ) {
u.aschars[i] = *np++;
}
#else
for ( i = 0; i < 4; ++i ) {
u.aschars[i] = *np++;
}
#endif
XP_DEBUGF( "ntohl_noalign returning %ld", u.num );
return u.num;
} /* ntohl_noalign */
static U16
ntohs_noalign( U8** p )
{
U8* np = *p;
union {
U16 num;
unsigned char aschars[2];
} u;
S16 i;
#if BYTE_ORDER==LITTLE_ENDIAN
for ( i = 1; i >= 0; --i ) {
u.aschars[i] = *np++;
}
#else
for ( i = 0; i < 2; ++i ) {
u.aschars[i] = *np++;
}
#endif
XP_DEBUGF( "ntohl_noalign returning %ld", u.num );
*p = np;
return u.num;
} /* */
static U16
countSpecials( FrankDictionaryCtxt* ctxt )
{
U16 result = 0;
for ( U16 i = 0; i < ctxt->super.nFaces; ++i ) {
if ( IS_SPECIAL(ctxt->super.faces16[i] ) ) {
++result;
}
}
return result;
} /* countSpecials */
static XP_Bitmap*
makeBitmap( FrankDictionaryCtxt* ctxt, U8** ptrp )
{
U8* ptr = *ptrp;
IMAGE* bitmap = (IMAGE*)NULL;
U8 nCols = *ptr++;
if ( nCols > 0 ) {
U8 nRows = *ptr++;
U16 rowBytes = (nCols+7) / 8;
bitmap = (IMAGE*)XP_MALLOC( ctxt->super.mpool,
sizeof(IMAGE) + (nRows * rowBytes) );
bitmap->img_width = nCols;
bitmap->img_height = nRows;
bitmap->img_rowbytes = rowBytes;
bitmap->img_colmode = COLOR_MODE_MONO;
bitmap->img_palette = (COLOR*)NULL;
U8* dest = ((U8*)&bitmap->img_buffer) + sizeof(bitmap->img_buffer);
bitmap->img_buffer = dest;
U8 srcByte = 0, destByte = 0;
U8 nBits = nRows*nCols;
for ( U16 i = 0; i < nBits; ++i ) {
U8 srcBitIndex = i % 8;
U8 destBitIndex = (i % nCols) % 8;
if ( srcBitIndex == 0 ) {
srcByte = *ptr++;
}
U8 srcMask = 1 << (7 - srcBitIndex);
U8 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;
}
}
}
*ptrp = ptr;
return (XP_Bitmap*)bitmap;
} /* makeBitmap */
static void
loadSpecialData( FrankDictionaryCtxt* ctxt, U8** ptrp )
{
U16 nSpecials = countSpecials( ctxt );
U8* ptr = *ptrp;
XP_DEBUGF( "loadSpecialData: there are %d specials\n", nSpecials );
XP_UCHAR** texts = (XP_UCHAR**)XP_MALLOC( ctxt->super.mpool,
nSpecials * sizeof(*texts) );
SpecialBitmaps* bitmaps = (SpecialBitmaps*)
XP_MALLOC( ctxt->super.mpool, nSpecials * sizeof(*bitmaps) );
for ( Tile i = 0; i < ctxt->super.nFaces; ++i ) {
XP_UCHAR face = ctxt->super.faces16[(short)i];
if ( IS_SPECIAL(face) ) {
/* get the string */
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( face < nSpecials );
texts[face] = text;
XP_DEBUGF( "making bitmaps for %s", texts[face] );
bitmaps[face].largeBM = makeBitmap( ctxt, &ptr );
bitmaps[face].smallBM = makeBitmap( ctxt, &ptr );
}
}
ctxt->super.chars = texts;
ctxt->super.bitmaps = bitmaps;
XP_DEBUGF( "loadSpecialData consumed %ld bytes",
ptr - *ptrp );
*ptrp = ptr;
} /* loadSpecialData */
#if 0
char*
frank_dictionary_getName(DictionaryCtxt* dict )
{
FrankDictionaryCtxt* ctxt = (FrankDictionaryCtxt*)dict;
return ctxt->name;
} /* frank_dictionary_getName */
#endif
static void
frank_dictionary_destroy( DictionaryCtxt* dict )
{
FrankDictionaryCtxt* ctxt = (FrankDictionaryCtxt*)dict;
U16 nSpecials = countSpecials( ctxt );
U16 i;
if ( !!dict->chars ) {
for ( i = 0; i < nSpecials; ++i ) {
XP_UCHAR* text = dict->chars[i];
if ( !!text ) {
XP_FREE( dict->mpool, text );
}
}
XP_FREE( dict->mpool, dict->chars );
}
if ( !!dict->countsAndValues ) {
XP_FREE( dict->mpool, dict->countsAndValues );
}
if ( !!ctxt->super.faces16 ) {
XP_FREE( dict->mpool, ctxt->super.faces16 );
}
if ( !!ctxt->super.bitmaps ) {
for ( i = 0; i < nSpecials; ++i ) {
XP_Bitmap bmp = ctxt->super.bitmaps[i].largeBM;
if ( !!bmp ) {
XP_FREE( ctxt->super.mpool, bmp );
}
bmp = ctxt->super.bitmaps[i].smallBM;
if ( !!bmp ) {
XP_FREE( ctxt->super.mpool, bmp );
}
}
XP_FREE( ctxt->super.mpool, ctxt->super.bitmaps );
}
if ( ctxt->isMMC ) {
XP_FREE( ctxt->super.mpool, ctxt->base );
} else {
(void)ebo_unmap( ctxt->base, ctxt->dictSize );
}
XP_FREE( ctxt->super.mpool, ctxt );
} // frank_dictionary_destroy
#ifdef CPLUS
}
#endif

View file

@ -1,47 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 1999-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 _FRANKDICT_H_
#define _FRANKDICT_H_
#include <ebm_object.h>
#ifdef CPLUS
extern "C" {
#endif
typedef enum {
LOC_UNKNOWN,
IN_RAM,
ON_MMC
} FileLoc ;
#define FRANK_DICT_FLAGS_ERROR 0xFFFF
U16 GetDictFlags( ebo_enumerator_t* eboe, FileLoc loc );
DictionaryCtxt* frank_dictionary_make( MPFORMAL XP_UCHAR* name );
void debugf( char* format, ... );
#ifdef CPLUS
}
#endif
#endif /* _FRANKDICT_H_ */

View file

@ -1,122 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001-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 "frankdlist.h"
#include "frankids.h"
#include "strutils.h"
FrankDictList::FrankDictList(MPFORMAL_NOCOMMA)
{
MPASSIGN( this->mpool, mpool );
fNDicts = 0;
for ( XP_U16 i = 0; i < MAX_DICTS; ++i ) {
fDictNames[i] = (XP_UCHAR*)NULL;
}
populateList();
} // FrankDictList::FrankDictList
FrankDictList::~FrankDictList()
{
for ( XP_U16 i = 0; i < fNDicts; ++i ) {
XP_ASSERT( !!fDictNames[i] );
XP_FREE( mpool, fDictNames[i] );
}
}
XP_S16
FrankDictList::IndexForName( XP_UCHAR* name )
{
XP_ASSERT( !!name );
for ( XP_S16 i = 0; i < fNDicts; ++i ) {
if ( 0 == XP_STRCMP( name, fDictNames[i] ) ) {
return i;
}
}
XP_ASSERT(0);
return -1;
} // FrankDictList::IndexForName
XP_S16
FrankDictList::dictListInsert( ebo_enumerator_t* eboep, FileLoc loc )
{
U16 flags;
if ( strcmp( eboep->name.publisher, PUB_ERICHOUSE ) == 0
&& strcmp( eboep->name.extension, EXT_XWORDSDICT ) == 0
&& ( ((flags = GetDictFlags( eboep, loc )) == 0x0001 )
|| (flags == 0x0002) || (flags == 0x0003) ) ) {
XP_UCHAR* newName = (XP_UCHAR*)eboep->name.name;
XP_U16 nDicts = fNDicts;
XP_S16 pred; // predecessor
// it's a keeper. Insert in alphabetical order
for ( pred = nDicts - 1; pred >= 0; --pred ) {
XP_S16 cmps = XP_STRCMP( newName, fDictNames[pred] );
// 0 means a duplicate, e.g one on MMC and another in
// RAM. Drop the dup in favor of the RAM copy.
if ( cmps == 0 ) {
return -1;
}
if ( cmps > 0 ) {
break; // found it
}
}
/* Now move any above the new location up */
XP_S16 newLoc = pred + 1;
for ( XP_U16 j = nDicts; j > newLoc; --j ) {
fDictNames[j] = fDictNames[j-1];
}
XP_ASSERT( newLoc >= 0 );
fDictNames[newLoc] = copyString( MPPARM(mpool) newName );
fDictLocs[newLoc] = loc;
++fNDicts;
return newLoc;
} else {
return -1;
}
}
void
FrankDictList::populateList()
{
int result;
ebo_enumerator_t eboe;
for ( result = ebo_first_object( &eboe );
result == EBO_OK;
result = ebo_next_object( &eboe ) ) {
dictListInsert( &eboe, IN_RAM );
}
for ( result = ebo_first_xobject( &eboe );
result == EBO_OK;
result = ebo_next_xobject( &eboe ) ) {
dictListInsert( &eboe, ON_MMC );
}
} // FrankDictList::populateList

View file

@ -1,65 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001-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 _FRANKDLIST_H_
#define _FRANKDLIST_H_
#include <ebm_object.h>
extern "C" {
#include "comtypes.h"
}
#include "mempool.h"
#include "frankdict.h"
#define MAX_DICTS 16
class FrankDictList {
public:
FrankDictList( MPFORMAL_NOCOMMA );
~FrankDictList();
XP_U16 GetDictCount() { return fNDicts; }
XP_UCHAR* GetNthName( XP_U16 n ) {
XP_ASSERT( n < fNDicts );
return fDictNames[n];
}
FileLoc GetNthLoc( XP_U16 n ) {
XP_ASSERT( n < fNDicts );
return fDictLocs[n];
}
XP_S16 IndexForName( XP_UCHAR* name );
private:
void populateList();
XP_S16 dictListInsert( ebo_enumerator_t* eboep, FileLoc loc );
XP_U16 fNDicts;
XP_UCHAR* fDictNames[MAX_DICTS];
FileLoc fDictLocs[MAX_DICTS];
MPSLOT
};
#endif

View file

@ -1,638 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
/*
* Copyright 1997-2001 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 <stdlib.h>
extern "C" {
#include "xptypes.h"
#include "board.h"
#include "draw.h"
#include "mempool.h"
} /* extern "C" */
#include "frankmain.h"
static void
insetRect( RECT* r, short i )
{
r->x += i;
r->y += i;
i *= 2;
r->width -= i;
r->height -= i;
} /* insetRect */
static void
eraseRect(FrankDrawCtx* dctx, RECT* rect )
{
dctx->window->DrawRectFilled( rect, COLOR_WHITE );
} /* eraseRect */
static XP_Bool
frank_draw_boardBegin( DrawCtx* p_dctx, const DictionaryCtxt* dict,
const XP_Rect* rect, XP_Bool hasfocus )
{
return XP_TRUE;
} /* draw_finish */
static void
frank_draw_boardFinished( DrawCtx* p_dctx )
{
// GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
} /* draw_finished */
static void
XP_RectToRECT( RECT* d, const XP_Rect* s )
{
d->x = s->left;
d->y = s->top;
d->width = s->width;
d->height = s->height;
} /* XP_RectToRECT */
/* Called by methods that draw cells, i.e. drawCell and drawCursor, to do
* common prep of the area.
*/
static void
cellDrawPrep( FrankDrawCtx* dctx, const XP_Rect* xprect, RECT* insetRect )
{
XP_RectToRECT( insetRect, xprect );
++insetRect->height;
++insetRect->width;
eraseRect( dctx, insetRect );
} /* cellDrawPrep */
static XP_Bool
frank_draw_drawCell( DrawCtx* p_dctx, const XP_Rect* xprect,
const XP_UCHAR* letters, const XP_Bitmap* bitmap,
Tile tile, XP_S16 owner, XWBonusType bonus,
HintAtts hintAtts,
XP_Bool isBlank, XP_Bool isPending, XP_Bool isStar )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
RECT rectInset;
XP_Bool showGrid = XP_TRUE;
cellDrawPrep( dctx, xprect, &rectInset );
if ( !!letters ) {
if ( *letters == LETTER_NONE ) {
if ( bonus != BONUS_NONE ) {
XP_ASSERT( bonus <= 4 );
#ifdef USE_PATTERNS
dctx->window->DrawTiledImage( xprect->left, xprect->top,
xprect->width,
xprect->height,
&dctx->bonusImages[bonus-1] );
#else
RECT filledR = rectInset;
COLOR color;
insetRect( &filledR, 1 );
switch( bonus ) {
case BONUS_DOUBLE_LETTER:
color = COLOR_GRAY53;
break;
case BONUS_TRIPLE_LETTER:
color = COLOR_GRAY40;
break;
case BONUS_DOUBLE_WORD:
color = COLOR_GRAY27;
break;
case BONUS_TRIPLE_WORD:
color = COLOR_GRAY13;
break;
default:
color = COLOR_WHITE; /* make compiler happy */
XP_ASSERT(0);
}
dctx->window->DrawRectFilled( &filledR, color );
#endif
}
if ( isStar ) {
dctx->window->DrawImage( xprect->left+2, xprect->top+2,
&dctx->startMark );
}
} else {
dctx->window->DrawText( (const char*)letters, rectInset.x+2,
rectInset.y+1 );
}
} else if ( !!bitmap ) {
dctx->window->DrawImage( xprect->left+2, xprect->top+2,
(IMAGE*)bitmap );
}
if ( showGrid ) {
COLOR color = isBlank? COLOR_GRAY53:COLOR_BLACK;
dctx->window->DrawRect( &rectInset, color );
}
if ( isPending ) {
insetRect( &rectInset, 1 );
dctx->window->InvertRect( &rectInset );
}
return XP_TRUE;
} /* frank_draw_drawCell */
static void
frank_draw_invertCell( DrawCtx* p_dctx, const XP_Rect* rect )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
RECT r;
XP_RectToRECT( &r, rect );
r.x += 3;
r.y += 3;
r.width -= 5;
r.height -= 5;
/* insetRect( &r, 2 ); */
dctx->window->InvertRect( &r );
GUI_UpdateNow();
} /* frank_draw_invertCell */
static XP_Bool
frank_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* rect, XP_U16 owner,
XP_Bool hasfocus )
{
/* FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx; */
/* clip? */
/* eraseRect( dctx, rect ); */
return XP_TRUE;
} /* frank_draw_trayBegin */
static void
frank_draw_drawTile( DrawCtx* p_dctx, const XP_Rect* xprect,
const XP_UCHAR* letter,
XP_Bitmap* bitmap, XP_S16 val, XP_Bool highlighted )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
char numbuf[3];
U32 width;
XP_Rect insetR = *xprect;
RECT rect;
XP_RectToRECT( &rect, xprect );
eraseRect( dctx, &rect );
/* frame the tile */
dctx->window->DrawRect( &rect, COLOR_BLACK );
if ( !!letter ) {
if ( *letter != LETTER_NONE ) { /* blank */
dctx->window->DrawText( (char*)letter, rect.x+1, rect.y+1,
dctx->trayFont );
}
} else if ( !!bitmap ) {
dctx->window->DrawImage( rect.x+2, rect.y+3, (IMAGE*)bitmap );
}
if ( val >= 0 ) {
sprintf( (char*)numbuf, (const char*)"%d", val );
width = GUI_TextWidth( dctx->valFont, numbuf, strlen(numbuf));
U16 height = GUI_FontHeight( dctx->valFont );
dctx->window->DrawText( (char*)numbuf, rect.x+rect.width - width - 1,
rect.y + rect.height - height - 1,
dctx->valFont );
}
if ( highlighted ) {
insetRect( &rect, 1 );
dctx->window->DrawRect( &rect, COLOR_BLACK );
}
} /* frank_draw_drawTile */
static void
frank_draw_drawTileBack( DrawCtx* p_dctx, const XP_Rect* xprect )
{
/* FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx; */
frank_draw_drawTile( p_dctx, xprect, (XP_UCHAR*)"?",
(XP_Bitmap*)NULL, -1, XP_FALSE );
} /* frank_draw_drawTileBack */
static void
frank_draw_drawTrayDivider( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool selected )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
RECT winRect;
XP_RectToRECT( &winRect, rect );
eraseRect( dctx, &winRect );
++winRect.x;
winRect.width -= 2;
COLOR color;
if ( selected ) {
color = COLOR_GRAY27;
} else {
color = COLOR_BLACK;
}
dctx->window->DrawRectFilled( &winRect, color );
} /* frank_draw_drawTrayDivider */
static void
frank_draw_clearRect( DrawCtx* p_dctx, const XP_Rect* rectP )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
RECT rect;
XP_RectToRECT( &rect, rectP );
eraseRect( dctx, &rect );
} /* frank_draw_clearRect */
static void
frank_draw_drawBoardArrow( DrawCtx* p_dctx, const XP_Rect* xprect,
XWBonusType cursorBonus, XP_Bool vertical,
HintAtts hintAtts )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
RECT rect;
cellDrawPrep( dctx, xprect, &rect );
dctx->window->DrawImage( rect.x+3, rect.y+2,
vertical?&dctx->downcursor:&dctx->rightcursor );
/* frame the cell */
dctx->window->DrawRect( &rect, COLOR_BLACK );
} /* frank_draw_drawBoardArrow */
static void
frank_draw_scoreBegin( DrawCtx* p_dctx, const XP_Rect* rect,
XP_U16 numPlayers, XP_Bool hasfocus )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
RECT r;
XP_RectToRECT( &r, rect );
eraseRect( dctx, &r );
} /* frank_draw_scoreBegin */
static void
frank_draw_measureRemText( DrawCtx* p_dctx, const XP_Rect* r,
XP_S16 nTilesLeft,
XP_U16* width, XP_U16* height )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
*height = SCORE_HEIGHT;
char buf[15];
sprintf( (char*)buf, "rem:%d", nTilesLeft );
*width = GUI_TextWidth( dctx->scoreFnt, (char*)buf,
strlen(buf) );
} /* frank_draw_measureRemText */
static void
frank_draw_drawRemText( DrawCtx* p_dctx, const XP_Rect* rInner,
const XP_Rect* rOuter, XP_S16 nTilesLeft )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
char buf[15];
sprintf( (char*)buf, "rem:%d", nTilesLeft );
dctx->window->DrawText( (char*)buf, rInner->left, rInner->top,
dctx->scoreFnt );
} /* frank_draw_drawRemText */
static XP_U16
scoreWidthAndText( char* buf, const FONT* font, const DrawScoreInfo* dsi )
{
char* borders = "";
if ( dsi->isTurn ) {
borders = "*";
}
sprintf( buf, "%s%.3d", borders, dsi->score );
if ( dsi->nTilesLeft >= 0 ) {
char nbuf[10];
sprintf( nbuf, ":%d", dsi->nTilesLeft );
strcat( buf, nbuf );
}
strcat( buf, borders );
S32 width = GUI_TextWidth( font, buf, strlen(buf) );
return width;
} /* scoreWidthAndText */
static void
frank_draw_measureScoreText( DrawCtx* p_dctx, const XP_Rect* r,
const DrawScoreInfo* dsi,
XP_U16* width, XP_U16* height )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
char buf[20];
const FONT* font = dsi->selected? dctx->scoreFntBold:dctx->scoreFnt;
*height = SCORE_HEIGHT;
*width = scoreWidthAndText( buf, font, dsi );
} /* frank_draw_measureScoreText */
static void
frank_draw_score_drawPlayer( DrawCtx* p_dctx,
const XP_Rect* rInner, const XP_Rect* rOuter,
const DrawScoreInfo* dsi )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
char buf[20];
XP_U16 x;
const FONT* font = dsi->selected? dctx->scoreFntBold:dctx->scoreFnt;
S32 width = scoreWidthAndText( buf, font, dsi );
x = rInner->left + ((rInner->width - width) /2);
dctx->window->DrawText( buf, x, rInner->top, font );
} /* frank_draw_score_drawPlayer */
static void
frank_draw_score_pendingScore( DrawCtx* p_dctx, const XP_Rect* rect,
XP_S16 score, XP_U16 playerNum )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
char buf[5];
XP_U16 left;
if ( score >= 0 ) {
sprintf( buf, "%.3d", score );
} else {
strcpy( buf, "???" );
}
RECT r;
XP_RectToRECT( &r, rect );
eraseRect( dctx, &r );
left = r.x+1;
dctx->window->DrawText( "Pts:", left, r.y, dctx->valFont );
dctx->window->DrawText( buf, left, r.y+(r.height/2),
dctx->scoreFnt );
} /* frank_draw_score_pendingScore */
static void
frank_draw_scoreFinished( DrawCtx* p_dctx )
{
} /* frank_draw_scoreFinished */
static U16
frankFormatTimerText( char* buf, XP_S16 secondsLeft )
{
XP_U16 minutes, seconds;
XP_U16 nChars = 0;
if ( secondsLeft < 0 ) {
*buf++ = '-';
secondsLeft *= -1;
++nChars;
}
minutes = secondsLeft / 60;
seconds = secondsLeft % 60;
char secBuf[6];
sprintf( secBuf, "0%d", seconds );
nChars += sprintf( buf, "%d:%s", minutes,
secBuf[2] == '\0'? secBuf:&secBuf[1] );
return nChars;
} /* frankFormatTimerText */
static void
frank_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rInner,
const XP_Rect* rOuter, XP_U16 player,
XP_S16 secondsLeft )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
char buf[12];
(void)frankFormatTimerText( buf, secondsLeft );
XP_DEBUGF( "drawing timer text: %s at %d,%d", buf, rInner->left,
rInner->top );
RECT r;
XP_RectToRECT( &r, rInner );
eraseRect( dctx, &r );
dctx->window->DrawText( buf, rInner->left, rInner->top, dctx->scoreFnt );
} /* frank_draw_drawTimer */
static XP_UCHAR*
frank_draw_getMiniWText( DrawCtx* p_dctx, XWMiniTextType whichText )
{
char* str = (char*)NULL;
switch( whichText ) {
case BONUS_DOUBLE_LETTER:
str = "Double letter"; break;
case BONUS_DOUBLE_WORD:
str = "Double word"; break;
case BONUS_TRIPLE_LETTER:
str = "Triple letter"; break;
case BONUS_TRIPLE_WORD:
str = "Triple word"; break;
case INTRADE_MW_TEXT:
str = "Click D when done"; break;
default:
XP_ASSERT( XP_FALSE );
}
return (XP_UCHAR*)str;
} /* frank_draw_getMiniWText */
static void
frank_draw_measureMiniWText( DrawCtx* p_dctx, const XP_UCHAR* str,
XP_U16* widthP, XP_U16* heightP )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
*widthP = 6 + GUI_TextWidth( dctx->scoreFnt, (const char*)str,
strlen((const char*)str) );
*heightP = 6 + GUI_FontHeight( dctx->scoreFnt );
} /* frank_draw_measureMiniWText */
static void
frank_draw_drawMiniWindow( DrawCtx* p_dctx, const XP_UCHAR* text,
const XP_Rect* rect, void** closureP )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx;
RECT r;
XP_RectToRECT( &r, rect );
eraseRect( dctx, &r );
--r.width;
--r.height;
++r.x;
++r.y;
dctx->window->DrawRect( &r, COLOR_BLACK );
--r.x;
--r.y;
eraseRect( dctx, &r );
dctx->window->DrawRect( &r, COLOR_BLACK );
dctx->window->DrawText( (const char*)text, r.x+2, r.y+2, dctx->scoreFnt );
} /* frank_draw_drawMiniWindow */
static void
frank_draw_eraseMiniWindow( DrawCtx* p_dctx, const XP_Rect* rect,
XP_Bool lastTime,
void** closure, XP_Bool* invalUnder )
{
/* FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx; */
*invalUnder = XP_TRUE;
} /* frank_draw_eraseMiniWindow */
#define SET_GDK_COLOR( c, r, g, b ) { \
c.red = (r); \
c.green = (g); \
c.blue = (b); \
}
static void
draw_doNothing( DrawCtx* dctx, ... )
{
} /* draw_doNothing */
const unsigned char downcursor_bits[] = {
0x00, 0x00,
0x10, 0x00,
0x10, 0x00,
0x10, 0x00,
0xfe, 0x00,
0x7c, 0x00,
0x38, 0x00,
0x10, 0x00,
0x00, 0x00,
};
const unsigned char rightcursor_bits[] = {
0x00, 0x00, 0x10, 0x00, 0x18, 0x00, 0x1c, 0x00, 0xfe, 0x00, 0x1c, 0x00,
0x18, 0x00, 0x10, 0x00, 0x00, 0x00
};
const unsigned char startMark_bits[] = {
0xc1, 0x80, /* ##-- ---# # */
0xe3, 0x80, /* ###- --## # */
0x77, 0x00, /* -### -### - */
0x3e, 0x00, /* --## ###- - */
0x1c, 0x00, /* ---# ##-- - */
0x3e, 0x00, /* --## ###- - */
0x77, 0x00, /* -### -### - */
0xe3, 0x80, /* ###- --## # */
0xc1, 0x80, /* ##-- ---# # */
};
#ifdef USE_PATTERNS
const unsigned char bonus_bits[][4] = {
{ 0x88, 0x44, 0x22, 0x11 },
{ 0xaa, 0x55, 0xaa, 0x55 },
{ 0xCC, 0x66, 0x33, 0x99 },
{ 0xCC, 0xCC, 0x33, 0x33 }
};
#endif
DrawCtx*
frank_drawctxt_make( MPFORMAL CWindow* window )
{
FrankDrawCtx* dctx = (FrankDrawCtx*)XP_MALLOC( mpool,
sizeof(FrankDrawCtx) );
U16 i;
dctx->vtable = (DrawCtxVTable*)
XP_MALLOC( mpool, sizeof(*(((FrankDrawCtx*)dctx)->vtable)) );
for ( i = 0; i < sizeof(*dctx->vtable)/4; ++i ) {
((void**)(dctx->vtable))[i] = draw_doNothing;
}
/* SET_VTABLE_ENTRY( dctx, draw_destroyCtxt, frank_ ); */
SET_VTABLE_ENTRY( dctx->vtable, draw_boardBegin, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_drawCell, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_invertCell, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_boardFinished, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_trayBegin, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_drawTile, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_drawTileBack, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_drawTrayDivider, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_clearRect, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_drawBoardArrow, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_scoreBegin, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_measureRemText, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_drawRemText, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_measureScoreText, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_score_drawPlayer, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_score_pendingScore, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_scoreFinished, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_drawTimer, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_getMiniWText, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_measureMiniWText, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_drawMiniWindow, frank );
SET_VTABLE_ENTRY( dctx->vtable, draw_eraseMiniWindow, frank );
dctx->window = window;
dctx->valFont = GUI_GetFont( 9, CTRL_NORMAL );
dctx->scoreFnt = GUI_GetFont( 12, CTRL_NORMAL );
dctx->scoreFntBold = GUI_GetFont( 12, CTRL_BOLD );
dctx->trayFont = GUI_GetFont( 16, CTRL_NORMAL );
IMAGE downcursor = { 9, 9, 2,
COLOR_MODE_MONO, 0, (const COLOR *) 0,
(U8*)downcursor_bits };
XP_MEMCPY( (IMAGE*)&dctx->downcursor, &downcursor,
sizeof(dctx->downcursor) );
IMAGE rightcursor = { 9, 9, 2,
COLOR_MODE_MONO, 0, (const COLOR *) 0,
(U8*)rightcursor_bits };
XP_MEMCPY( (IMAGE*)&dctx->rightcursor, &rightcursor,
sizeof(dctx->rightcursor) );
IMAGE startMark = { 9, 9, 2,
COLOR_MODE_MONO, 0, (const COLOR *) 0,
(U8*)startMark_bits };
XP_MEMCPY( (IMAGE*)&dctx->startMark, &startMark,
sizeof(dctx->startMark) );
#ifdef USE_PATTERNS
for ( i = 0; i < BONUS_LAST; ++i ) {
IMAGE bonus = { 8, 4, 1,
COLOR_MODE_MONO, 0, (const COLOR *) 0,
(U8*)bonus_bits[i] };
XP_MEMCPY( (IMAGE*)&dctx->bonusImages[i], &bonus,
sizeof(dctx->bonusImages[i]) );
}
#endif
return (DrawCtx*)dctx;
} /* frank_drawctxt_make */

View file

@ -1,31 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 1999-2001 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 <stdlib.h>
extern "C" {
#include "frankmain.h"
#include "draw.h"
#include "board.h"
} /* extern "C" */
DrawCtx* frank_drawctxt_make( MPFORMAL CWindow* win );

View file

@ -1,313 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
/*
* Copyright 2001 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 <ebm_object.h>
#include <string.h>
#include "frankgamesdb.h"
#include "frankids.h"
extern "C" {
# include "xptypes.h"
}
CGamesDB::CGamesDB(MPFORMAL const XP_UCHAR* fileName)
{
this->nRecordsUsed = 0;
this->nRecordsAllocated = 0;
this->lockedIndex = -1;
MPASSIGN( this->mpool, mpool );
fRecords = (DBRecord*)NULL;
// create or load file
memset( &this->xwfile, 0, sizeof(xwfile) );
strcpy( (char*)this->xwfile.name, (char*)fileName );
strcpy( this->xwfile.publisher, PUB_ERICHOUSE );
strcpy( this->xwfile.extension, EXT_XWORDSGAMES );
size_t size = EBO_BLK_SIZE;
int result = ebo_new( &this->xwfile, size, FALSE );
BOOL exists = result < 0;
XP_DEBUGF( "exists=%d", exists );
if ( exists ) {
readFromFile( &xwfile );
}
} // CGamesDBn
CGamesDB::~CGamesDB()
{
this->writeToFile();
U16 nRecords = this->nRecordsUsed;
for ( U16 i = 0; i < nRecords; ++i ) {
DBRecord* record = &fRecords[i];
XP_FREE( mpool, record->datum );
if ( !!record->name ) {
XP_FREE( mpool, record->name );
}
}
XP_FREE( mpool, fRecords );
} // ~CGamesDB
void*
CGamesDB::getNthRecord( U16 index, U16* recordLen )
{
XP_ASSERT( index < this->nRecordsUsed );
XP_ASSERT( this->lockedIndex < 0 );
this->lockedIndex = index;
*recordLen = fRecords[index].length;
XP_DEBUGF( "getNthRecord(%d) returning len=%d", index, *recordLen );
return fRecords[index].datum;
} // getNthRecord
XP_UCHAR*
CGamesDB::getNthName( U16 index )
{
XP_ASSERT( index < this->nRecordsUsed );
XP_DEBUGF( "returning %dth name: %s", index, fRecords[index].name );
return fRecords[index].name;
} /* getNthName */
void
CGamesDB::recordRelease( U16 index )
{
XP_ASSERT( this->lockedIndex == index );
this->lockedIndex = -1;
} // recordRelease
void
CGamesDB::putNthRecord( U16 index, void* ptr, U16 len )
{
XP_DEBUGF( "putNthRecord(%d,ptr,%d)", index, len );
XP_ASSERT( index <= nRecordsUsed );
if ( index == nRecordsAllocated ) { /* need a new one */
ensureSpace( nRecordsUsed+1 );
} else if ( !!fRecords[index].datum ) {
XP_FREE(mpool, fRecords[index].datum );
}
void* datap = XP_MALLOC( mpool, len );
XP_MEMCPY( datap, ptr, len );
fRecords[index].datum = datap;
fRecords[index].length = len;
if ( index == this->nRecordsUsed ) {
++this->nRecordsUsed;
}
} // putNthRecord
void
CGamesDB::putNthName( U16 index, XP_UCHAR* name )
{
XP_ASSERT( index <= this->nRecordsUsed );
if ( index == nRecordsAllocated ) { /* need a new one */
ensureSpace( nRecordsUsed+1 );
} else if ( !!fRecords[index].name ) {
XP_FREE( mpool, fRecords[index].name );
}
fRecords[index].name = frankCopyStr( MPPARM(mpool) name);
if ( index == this->nRecordsUsed ) {
++this->nRecordsUsed;
}
} /* putNthName */
void
CGamesDB::removeNthRecord( U16 index )
{
XP_ASSERT( index < this->nRecordsUsed );
if ( !!fRecords[index].datum ) {
XP_FREE( mpool, fRecords[index].datum );
if ( !!fRecords[index].name ) {
XP_FREE( mpool, fRecords[index].name );
}
}
U16 nRecords = --this->nRecordsUsed;
for ( U16 i = index; i < nRecords; ++i ) {
fRecords[i] = fRecords[i+1];
}
fRecords[nRecords].datum = NULL;
fRecords[nRecords].length = 0;
} // removeNthRecord
U16
CGamesDB::duplicateNthRecord( U16 index )
{
XP_ASSERT( index < this->nRecordsUsed );
ensureSpace( nRecordsUsed + 1 );
U16 newIndex = index + 1;
for ( U16 i = this->nRecordsUsed; i > newIndex; --i ) {
fRecords[i] = fRecords[i-1];
}
++this->nRecordsUsed;
U16 len = fRecords[newIndex].length = fRecords[index].length;
void* data = XP_MALLOC( mpool, len );
XP_MEMCPY( data, fRecords[index].datum, len );
fRecords[newIndex].datum = data;
fRecords[newIndex].name =
frankCopyStr( MPPARM(mpool) fRecords[index].name );
XP_DEBUGF( "done with duplicateNthRecord; returning %d", newIndex );
return newIndex;
} /* duplicateNthRecord */
U16
CGamesDB::countRecords()
{
return this->nRecordsUsed;
} // countRecords
void
CGamesDB::readFromFile( const ebo_name_t* xwfile )
{
size_t size = EBO_BLK_SIZE;
void* vmbase = (void*)ebo_roundup(OS_availaddr+GAMES_DB_OFFSET);
#ifdef DEBUG
int result = ebo_mapin( xwfile, 0, vmbase, &size, 1 );
XP_ASSERT( result >= 0 );
#else
(void)ebo_mapin( xwfile, 0, vmbase, &size, 1 );
#endif
XP_ASSERT( ((unsigned long)vmbase & 0x01) == 0 );
U16 nRecords;
unsigned char* ptr = (unsigned char*)vmbase;
nRecords = *((U16*)ptr)++;
XP_DEBUGF( "nRecords = %d", nRecords );
this->nRecordsUsed = this->nRecordsAllocated = nRecords;
fRecords = (DBRecord*)XP_MALLOC( mpool, nRecords * sizeof(fRecords[0]) );
for ( U16 i = 0; i < nRecords; ++i ) {
DBRecord* record = &fRecords[i];
U8 nameLen = *ptr++;
XP_UCHAR* name = (XP_UCHAR*)NULL;
if ( nameLen > 0 ) {
name = (XP_UCHAR*)XP_MALLOC(mpool, nameLen+1);
XP_MEMCPY( name, ptr, nameLen );
name[nameLen] = '\0';
ptr += nameLen;
}
record->name = name;
/* fix alignment */
while ( ((unsigned long)ptr & 0x00000001) != 0 ) {
++ptr;
}
U16 len = record->length = *((U16*)ptr)++;
XP_DEBUGF( "read len %d from offset %ld", len,
(unsigned long)ptr - (unsigned long)vmbase - 2 );
record->datum = XP_MALLOC( mpool, len );
XP_MEMCPY( record->datum, ptr, len );
ptr += len;
XP_DEBUGF( "Read %dth record", i );
XP_ASSERT( ((unsigned char*)vmbase) + size >= ptr );
}
(void)ebo_unmap( vmbase, size );
XP_DEBUGF( "read %d records from file", nRecords );
} // readFromFile
void
CGamesDB::writeToFile()
{
size_t size = EBO_BLK_SIZE;
void* vmbase = (void*)ebo_roundup(OS_availaddr+GAMES_DB_OFFSET);
#ifdef DEBUG
int result = ebo_mapin( &this->xwfile, 0, vmbase, &size, 1 );
XP_ASSERT( result >= 0 );
#else
(void)ebo_mapin( &this->xwfile, 0, vmbase, &size, 1 );
#endif
XP_ASSERT( ((unsigned long)vmbase & 0x01) == 0 );
U16 nRecords = this->nRecordsUsed;
unsigned char* ptr = (unsigned char*)vmbase;
*(U16*)ptr = nRecords;
ptr += sizeof(U16);
for ( U16 i = 0; i < nRecords; ++i ) {
XP_UCHAR* name = fRecords[i].name;
U16 slen = !!name? XP_STRLEN( name ): 0;
*ptr++ = slen;
if ( slen > 0 ) {
XP_ASSERT( slen < 0x00FF );
XP_MEMCPY( ptr, name, slen );
ptr += slen;
}
/* fix alignment */
while ( ((unsigned long)ptr & 0x00000001) != 0 ) {
++ptr;
}
U16 len = fRecords[i].length;
XP_DEBUGF( "writing len %d at offset %ld", len,
(unsigned long)ptr - (unsigned long)vmbase );
*((U16*)ptr)++ = len;
XP_MEMCPY( ptr, fRecords[i].datum, len );
ptr += len;
}
ebo_unmap( vmbase, size );
XP_WARNF( "finished writing %d recs to file", nRecords );
} // writeToFile
void
CGamesDB::ensureSpace( U16 nNeeded )
{
if ( this->nRecordsAllocated < nNeeded ) {
U16 newLen = nNeeded * sizeof(fRecords[0]);
if ( !!fRecords ) {
fRecords = (DBRecord*)XP_REALLOC( mpool, fRecords, newLen );
} else {
fRecords = (DBRecord*)XP_MALLOC( mpool, newLen );
}
U16 sizeAdded = (nNeeded - this->nRecordsAllocated) * sizeof(*fRecords);
XP_MEMSET( fRecords + this->nRecordsAllocated, 0x00, sizeAdded );
this->nRecordsAllocated = nNeeded;
XP_DEBUGF( "ensureSpace: increasing nRecordsAllocated to %d (len=%d)",
nRecordsAllocated, newLen );
}
} /* ensureSpace */

View file

@ -1,81 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 2001 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 _FRANKGAMESDB_H_
#define _FRANKGAMESDB_H_
#include <assert.h>
#include <ctype.h>
#include "sys.h"
#include "gui.h"
#include "comtypes.h"
#include "mempool.h"
/* #include "ebm_object.h" */
struct DBRecord {
U16 length;
void* datum;
XP_UCHAR* name;
};
class CGamesDB {
private:
U16 nRecordsUsed;
U16 nRecordsAllocated;
DBRecord* fRecords;
S16 lockedIndex;
ebo_name_t xwfile;
void readFromFile( const ebo_name_t* xwfile );
void writeToFile();
void ensureSpace( U16 nNeeded );
MPSLOT
public:
/* create or open if already exists */
CGamesDB(MPFORMAL const XP_UCHAR* fileName);
/* commit optimized in-memory representation to a flat "file" */
~CGamesDB();
/* Return a ptr (read-only by convention!!) to the beginning of the
record's data. The ptr's valid until recordRelease is called. */
void* getNthRecord( U16 index, U16* recordLen );
void recordRelease( U16 index );
XP_UCHAR* getNthName( U16 index );
/* put data into a record, adding a new one, replacing or appending to an
existing one */
void putNthRecord( U16 index, void* ptr, U16 len );
void appendNthRecord( U16 index, void* ptr, U16 len );
void putNthName( U16 index, XP_UCHAR* name );
U16 duplicateNthRecord( U16 index );
void removeNthRecord( U16 index );
/* how many records do I have. indices passed by getter methods that are
>= this number are illegal. setters can pass a number = to this, in
which case we create a new record. */
U16 countRecords();
};
#endif

View file

@ -1,91 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 1999-2000 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 "comtypes.h"
#include "mempool.h"
#ifndef _FRANKIDS_H_
#define _FRANKIDS_H_
#define MAIN_FLIP_BUTTON_ID 101
#define MAIN_VALUE_BUTTON_ID 102
#define MAIN_HINT_BUTTON_ID 103
#define MAIN_UNDO_BUTTON_ID 104
#define MAIN_COMMIT_BUTTON_ID 105
#define MAIN_TRADE_BUTTON_ID 106
#define MAIN_JUGGLE_BUTTON_ID 107
#define MAIN_HIDE_BUTTON_ID 108
#define MAIN_WINDOW_ID 1000
#define ASK_WINDOW_ID 1001
#define ASKLETTER_WINDOW_ID 1002
#define PLAYERS_WINDOW_ID 1003
#define PASSWORD_WINDOW_ID 1004
#define SAVEDGAMES_WINDOW_ID 1005
#define FILEMENU_BUTTON_ID 1020
#define FILEMENU_NEWGAME 1021
#define FILEMENU_SAVEDGAMES 1022
#define FILEMENU_PREFS 1023
#define FILEMENU_ABOUT 1024
#define GAMEMENU_BUTTON_ID 1025
#define GAMEMENU_TVALUES 1026
#define GAMEMENU_FINALSCORES 1041
#define GAMEMENU_GAMEINFO 1027
#define GAMEMENU_HISTORY 1028
#define MOVEMENU_BUTTON_ID 1029
#define MOVEMENU_HINT 1030
#define MOVEMENU_NEXTHINT 1031
#define MOVEMENU_REVERT 1032
#define MOVEMENU_UNDO 1033
#define MOVEMENU_DONE 1034
#define MOVEMENU_JUGGLE 1035
#define MOVEMENU_TRADE 1036
#define MOVEMENU_HIDETRAY 1037
#ifdef MEM_DEBUG
# define DEBUGMENU_BUTTON_ID 1050
# define DEBUGMENU_HEAPDUMP 1051
#endif
#define FILEMENU_WINDOW_ID 1038
#define GAMEMENU_WINDOW_ID 1039
#define MOVEMENU_WINDOW_ID 1040
#define MENUBAR_WINDOW_ID 1041
const char* PUB_ERICHOUSE = "Eric_House";
const char* EXT_XWORDSDICT = "xwd";
const char* EXT_XWORDSGAMES = "xwg";
#define DICT_OFFSET 0x00000000
#define GAMES_DB_OFFSET 0x00800000
#define FLAGS_CHECK_OFFSET 0x00900000
#define MAX_NAME_LENGTH 31 /* not including null byte */
extern "C" {
XP_UCHAR* frankCopyStr( MPFORMAL const XP_UCHAR* );
}
#endif

View file

@ -1,119 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 1999-2000 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 <assert.h>
#include <ctype.h>
#include "sys.h"
#include "gui.h"
#include "ebm_object.h"
extern "C" {
#include "xptypes.h"
}
#include "frankletter.h"
#include "frankids.h"
#include "frankask.h"
#define LETTER_HEIGHT 12
#define LETTERS_ROW_HEIGHT LETTER_HEIGHT
#define LETTERS_ROW_WIDTH 30
#define LETTERS_NUM_VISROWS 16
class LettersList : public CList {
private:
const XP_UCHAR4* fTexts;
public:
LettersList( const XP_UCHAR4* texts, U16 numRows );
U16 GetRowHeight( S32 row ) { return LETTER_HEIGHT; }
void DrawRow( RECT *rect, S32 row );
};
LettersList::LettersList( const XP_UCHAR4* texts, U16 numRows )
: CList( 1001, LETTERS_ROW_WIDTH,
LETTERS_ROW_HEIGHT * LETTERS_NUM_VISROWS,
numRows, LISTOPTION_ALWAYS_HIGHLIGHT )
{
fTexts = texts;
this->SetCurrentRow(0); // Select the first item so there's a default
}
void LettersList::DrawRow( RECT *rect, S32 row )
{
CWindow* window = this->GetWindow();
window->DrawText( (char*)fTexts[row], rect->x, rect->y );
} /* LettersList::DrawRow */
CAskLetterWindow::CAskLetterWindow( const PickInfo* pi, XP_U16 playerNum,
const XP_UCHAR4* texts, XP_U16 nTiles,
XP_S16* resultP )
: CWindow( ASKLETTER_WINDOW_ID, 55, 15, 80, 220, "Blank", TRUE )
{
fTexts = texts;
fNTiles = nTiles;
fResultP = resultP;
this->list = new LettersList( texts, nTiles );
this->AddChild( this->list, 5, 5 );
CButton* okbutton = new CButton( 1000, 0, 0, "Ok" );
this->AddChild( okbutton, 40, 70 );
} // CAskWindow
S32
CAskLetterWindow::MsgHandler( MSG_TYPE type, CViewable *object, S32 data )
{
S32 result = 0;
switch (type) {
case MSG_BUTTON_SELECT: // there's only one button....
*fResultP = this->list->GetCurrentRow();
this->Close();
result = 1;
break;
case MSG_KEY: // allow keys to select the matching letter in the list
if ( isalpha( data ) ) {
XP_UCHAR ch = toupper(data);
for ( U16 i = 0; i < fNTiles; ++i ) {
if ( ch == fTexts[i][0] ) {
this->list->SetCurrentRow( i );
result = 1;
break;
}
}
}
default:
break;
}
if ( result == 0 ) {
result = CWindow::MsgHandler( type, object, data );
}
return result;
} // CAskLetterWindow::MsgHandler

View file

@ -1,35 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001 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.
*/
extern "C" {
#include "dictnry.h"
#include "util.h"
}
class CAskLetterWindow : public CWindow {
private:
const XP_UCHAR4* fTexts;
XP_S16* fResultP;
XP_U16 fNTiles;
CList* list; /* my own subclass, of course */
public:
CAskLetterWindow( const PickInfo* pi, XP_U16 playerNum,
const XP_UCHAR4* texts, XP_U16 nTiles, XP_S16* result );
S32 MsgHandler( MSG_TYPE type, CViewable *object, S32 data );
};

File diff suppressed because it is too large Load diff

View file

@ -1,77 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 1999-2000 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 _FRANKMAIN_H_
#define _FRANKMAIN_H_
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include "sys.h"
#include "gui.h"
#include "OpenDatabases.h"
/* #include "FieldMgr.h" */
#include "ebm_object.h"
#define SCREEN_WIDTH 200
#define BOARD_LEFT 2
#define SCORE_LEFT BOARD_LEFT
#define SCORE_TOP 3
#define SCORE_WIDTH SCREEN_WIDTH
#define SCORE_HEIGHT 13
#define TIMER_WIDTH 36
#define TIMER_HEIGHT SCORE_HEIGHT
#define BOARD_TOP SCORE_HEIGHT+SCORE_TOP
#define BOARD_SCALE 12
#define TRAY_LEFT BOARD_LEFT
#define MIN_TRAY_SCALE 23
#define FRANK_DIVIDER_WIDTH 5
#define VERSION_STRING "4.0.7a1"
extern "C" {
typedef struct FrankDrawCtx {
DrawCtxVTable* vtable;
CWindow* window;
const FONT* scoreFnt;
const FONT* scoreFntBold;
const FONT* trayFont;
const FONT* valFont;
const IMAGE rightcursor;
const IMAGE downcursor;
const IMAGE startMark;
#ifdef USE_PATTERNS
const IMAGE bonusImages[BONUS_LAST];
#endif
} FrankDrawCtx;
void debugf( char* format, ... );
} /* extern "C" */
#endif

View file

@ -1,112 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001 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 <assert.h>
#include <ctype.h>
#include "sys.h"
#include "gui.h"
#include "ebm_object.h"
extern "C" {
#include "xptypes.h"
}
#include "frankpasswd.h"
#include "frankids.h"
#define TEXT_ID 2000
#define PASSWD_WIDTH 105
#define PASSWD_HEIGHT 12
#define LABEL_X 10
#define LABEL_Y 10
#define PASSWD_X LABEL_X
#define PASSWD_Y (LABEL_Y+15)
#define BUTTON_Y (PASSWD_Y+20)
#define OK_BUTTON_X 30
#define CANCEL_BUTTON_X 100
#define PASS_CANCEL_ID 2001
#define PASS_OK_ID 2002
#define LABEL_ID 2003
CAskPasswdWindow::CAskPasswdWindow( const XP_UCHAR* name, XP_UCHAR* buf,
XP_U16* len, XP_Bool* result )
: CWindow( PASSWORD_WINDOW_ID, 10, 120, 180, 85, "Password", TRUE )
{
fName = name;
fBuf = buf;
this->lenp = len;
this->okP = result;
snprintf( fLabelBuf, sizeof(fLabelBuf), "Password for %s:", name );
CLabel* label = new CLabel( LABEL_ID, fLabelBuf );
this->AddChild( label, LABEL_X, LABEL_Y );
this->entry = new CTextEdit( TEXT_ID, PASSWD_WIDTH, PASSWD_HEIGHT,
TEXTOPTION_PASSWORD
| TEXTOPTION_ONELINE
| TEXTOPTION_HAS_FOCUS);
this->AddChild( this->entry, PASSWD_X, PASSWD_Y );
this->SetFocus( this->entry );
CButton* button = new CButton( PASS_CANCEL_ID, 0, 0, "Cancel" );
this->AddChild( button, CANCEL_BUTTON_X, BUTTON_Y );
button = new CButton( PASS_OK_ID, 0, 0, "Ok" );
this->AddChild( button, OK_BUTTON_X, BUTTON_Y );
} // CAskWindow
S32
CAskPasswdWindow::MsgHandler( MSG_TYPE type, CViewable *object, S32 data )
{
S32 result = 0;
char* text;
XP_U16 len;
switch (type) {
case MSG_BUTTON_SELECT: // there's only one button....
switch ( object->GetID() ) {
case PASS_OK_ID:
text = this->entry->GetText();
len = this->entry->TextLength();
strncpy( (char*)fBuf, text, XP_MIN(len,*this->lenp) );
fBuf[len] = '\0';
*this->lenp = len;
*this->okP = XP_TRUE;
break;
case PASS_CANCEL_ID:
*this->okP = XP_FALSE;
break;
default:
return 0;
}
result = 1;
this->Close();
break;
default:
break;
}
return result;
} // CAskLetterWindow::MsgHandler

View file

@ -1,40 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001 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 _FRANKPASSWD_H_
#define _FRANKPASSWD_H_
#include "comtypes.h"
class CAskPasswdWindow : public CWindow {
private:
const XP_UCHAR* fName;
XP_UCHAR* fBuf;
XP_U16* lenp;
XP_Bool* okP;
CTextEdit* entry;
char fLabelBuf[64];
public:
CAskPasswdWindow( const XP_UCHAR* name, XP_UCHAR* buf, XP_U16* len,
XP_Bool* result );
S32 MsgHandler( MSG_TYPE type, CViewable *object, S32 data );
};
#endif /* _FRANKPASSWD_H_ */

View file

@ -1,466 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 1999-2001 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 <assert.h>
#include <ctype.h>
#include "sys.h"
#include "gui.h"
#include "ebm_object.h"
extern "C" {
#include "xptypes.h"
#include "strutils.h"
#include "mempool.h"
}
#include "frankids.h"
#include "frankplayer.h"
#include "frankdict.h"
#define PLAYERCOUNT_MENU_ID 2000
#define NUMPLAYERS_POPUP_ID 2001
#define NAME_LABEL_ID 2002
#define ROBOT_LABEL_ID 2003
#define PASSWORD_LABEL_ID 2004
#define OK_BUTTON_ID 2005
#define CANCEL_BUTTON_ID 2006
#define REVERT_BUTTON_ID 2007
#define COUNT_LABEL_ID 2008
#define PLAYERDICT_MENU_ID 2009
#define DICTNAMES_POPUP_ID 2010
#define DICT_LABEL_ID 2011
#define SIZE_LABEL_ID 2012
#define BOARDSIZE_MENU_ID 2013
#define BOARDSIZE_POPUP_ID 2014
#define TIMER_CHECKBOX_ID 2015
#define TIMER_FIELD_ID 2016
#define PHONIES_MENU_ID 2017
#define PHONIES_POPUP_ID 2018
#define OK_BUTTON_COL 35
#define CANCEL_BUTTON_COL 95
#define REVERT_BUTTON_COL 125
/* These must be far enough apart that derivitaves will remain unique; make it
10 for now. Also, there can't be any overlap between their ranges and
other ids!!!!*/
#define NAME_BASE 2060
#define ROBOT_BASE 2070
#define PASSWORD_BASE 2080
#define COUNTER_ROW 5
#define LABEL_ROW 20
#define FIRST_ROW (LABEL_ROW+20)
#define ROW_OFFSET 18
#define DICTMENU_ROW (FIRST_ROW + (ROW_OFFSET * MAX_NUM_PLAYERS) + 2)
#define SIZEMENU_ROW (DICTMENU_ROW + ROW_OFFSET + 1)
#define PHONIESMENU_ROW (SIZEMENU_ROW + ROW_OFFSET + 1)
#define TIMER_ROW (PHONIESMENU_ROW + ROW_OFFSET + 1)
#define BUTTON_ROW (TIMER_ROW + ROW_OFFSET + 3)
#define NAME_COL 5
#define NAME_WIDTH 105
#define NAME_HEIGHT 12
#define ROBOT_COL (NAME_COL + NAME_WIDTH + 10)
#define PASSWD_WIDTH 20
#define TIME_WIDTH 20
#define PASSWD_HEIGHT NAME_HEIGHT
#define PASSWORD_COL (ROBOT_COL + PASSWD_WIDTH + 10)
#define TIMER_FIELD_COL 120
/* Put up a window with a list for each player giving name and robotness,
* and allowing for setting/changing a password.
*/
CPlayersWindow::CPlayersWindow( MPFORMAL CurGameInfo* gi, FrankDictList* dlist,
BOOL isNew, BOOL allowCancel, BOOL* cancelledP )
: CWindow( PLAYERS_WINDOW_ID, 2, 12, 196, 226, "Game setup", !isNew,
FALSE, FALSE )
{
fLocalGI = *gi;
fGIRef = gi;
fDList = dlist;
this->resultP = cancelledP;
fIsNew = isNew;
MPASSIGN( this->mpool, mpool );
/* numplayers counter */
CLabel* label = new CLabel( COUNT_LABEL_ID, "Number of players:" );
this->AddChild( label, NAME_COL, COUNTER_ROW );
this->countMenu = new CMenu(PLAYERCOUNT_MENU_ID, 0, 0, 0, 0, 0 );
this->countMenu->SetNumRows( MAX_NUM_PLAYERS );
char* base = (char*)fNumsBuf;
for ( U16 i = 0 ; i < MAX_NUM_PLAYERS; ++i ) {
snprintf( base, 2, "%d", i+1 );
this->countMenu->SetRow( i, 2000+i, base );
base += 2;
}
CPopupTrigger *trigger = new CPopupTrigger( NUMPLAYERS_POPUP_ID, 0, 0,
this->countMenu, 0 );
trigger->SetCurrentRow( fLocalGI.nPlayers-1 );
this->AddChild( trigger, NAME_COL+130, COUNTER_ROW );
if ( !isNew ) {
DisOrEnable( NUMPLAYERS_POPUP_ID, FALSE );
}
/* Column labels */
label = new CLabel( NAME_LABEL_ID, "Name" );
this->AddChild( label, NAME_COL, LABEL_ROW );
label = new CLabel( ROBOT_LABEL_ID, "Rbt" );
this->AddChild( label, ROBOT_COL, LABEL_ROW );
label = new CLabel( PASSWORD_LABEL_ID, "Pwd" );
this->AddChild( label, PASSWORD_COL, LABEL_ROW );
/* build a row of controls for each potential player. Disable those below
the point determined by the number of players we have. */
for ( U16 i = 0; i < MAX_NUM_PLAYERS; ++i ) {
LocalPlayer* fp = &fLocalGI.players[i];
CTextEdit* name = new CTextEdit( NAME_BASE + i, NAME_WIDTH,
NAME_HEIGHT, TEXTOPTION_ONELINE );
name->SetText( (char*)fp->name );
this->AddChild( name, NAME_COL, FIRST_ROW + (ROW_OFFSET*i) );
CCheckbox *robot_check = new CCheckbox( ROBOT_BASE + i, 0, 0, "" );
robot_check->SetDownStatus( fp->isRobot );
this->AddChild( robot_check, ROBOT_COL, FIRST_ROW + (ROW_OFFSET*i) );
CTextEdit* passwd = new CTextEdit( PASSWORD_BASE + i,
PASSWD_WIDTH, PASSWD_HEIGHT,
TEXTOPTION_PASSWORD
| TEXTOPTION_ONELINE);
this->AddChild( passwd, PASSWORD_COL, FIRST_ROW + (ROW_OFFSET*i) );
const char* password = (const char*)fp->password;
if ( !!password && !!password[0] ) {
passwd->SetText( password );
}
}
this->makeDictMenu();
this->makeSizeMenu();
this->makePhoniesMenu();
/* the timer checkbox */
fTimerEnabled = new CCheckbox( TIMER_CHECKBOX_ID, 0, 0,
"Timer enabled" );
fTimerEnabled->SetDownStatus( fLocalGI.timerEnabled );
AddChild( fTimerEnabled, NAME_COL, TIMER_ROW );
if ( !isNew ) {
fTimerEnabled->Disable();
}
/* the timer field (hidden if checkbox not checked) */
fTimerField = new CTextEdit( TIMER_FIELD_ID, TIME_WIDTH,
PASSWD_HEIGHT, TEXTOPTION_ONELINE );
char buf[10];
sprintf( buf, "%d", fLocalGI.gameSeconds / 60 );
fTimerField->SetText( buf );
AddChild( fTimerField, TIMER_FIELD_COL, TIMER_ROW );
if ( !fLocalGI.timerEnabled || !isNew ) {
fTimerField->Disable();
}
/* the buttons at the bottom */
U16 okCol = OK_BUTTON_COL;
CButton* button = new CButton( OK_BUTTON_ID, 0, 0, "Ok" );
if ( !(isNew && allowCancel) ) {
U16 buttonWidth = button->GetWidth();
U16 windowWidth = this->GetWidth();
okCol = (windowWidth - buttonWidth) / 2;
}
this->AddChild( button, okCol, BUTTON_ROW );
if ( isNew && allowCancel ) {
button = new CButton( CANCEL_BUTTON_ID, 0, 0, "Cancel" );
this->AddChild( button, CANCEL_BUTTON_COL, BUTTON_ROW );
}
adjustVisibility();
XP_DEBUGF( "CPlayersWindow done" );
} // CPlayersWindow
CPlayersWindow::~CPlayersWindow()
{
delete( this->countMenu );
delete( this->dictMenu );
delete( this->sizeMenu );
} /* ~CPlayersWindow */
void
CPlayersWindow::DisOrEnable( U16 id, BOOL enable )
{
CViewable* child = this->GetChildID( id );
if ( enable ) {
XP_DEBUGF( "enabling child id=%d\n", id );
child->Enable();
} else {
XP_DEBUGF( "disabling child id=%d\n", id );
child->Disable();
}
} /* DisOrEnable */
static BOOL
checkAllDigits( CTextEdit* te )
{
char* text = te->GetText();
char ch;
while ( (ch=*text++) != '\0' ) {
if ( !isdigit(ch) ) {
return false;
}
}
return true;
} /* checkAllDigits */
S32
CPlayersWindow::MsgHandler( MSG_TYPE type, CViewable *from, S32 data )
{
S32 result = 0;
S32 id;
U16 row;
switch ( type ) {
case MSG_MENU_SELECT: /* the num-players trigger */
XP_DEBUGF( "MSG_MENU_SELECT: data=%ld\n", data );
switch ( from->GetID()) {
case NUMPLAYERS_POPUP_ID:
row = this->countMenu->GetCurrentRow();
fLocalGI.nPlayers = row + 1; /* GetCurrentRow is 0-based */
adjustVisibility();
GUI_NeedUpdate();
result = 1;
break;
/* case DICTNAMES_POPUP_ID: */
/* row = this->dictMenu->GetCurrentRow(); */
/* break; */
}
break;
case MSG_TEXT_CHANGED:
if ( (from->GetID() == TIMER_FIELD_ID)
&& !checkAllDigits( (CTextEdit*)from ) ) {
result = TEXTEDIT_PLEASE_UNDO;
}
break;
case MSG_BUTTON_SELECT:
result = 1;
id = from->GetID();
switch ( id ) {
case TIMER_CHECKBOX_ID:
DisOrEnable( TIMER_FIELD_ID, fTimerEnabled->GetDownStatus() );
break;
case OK_BUTTON_ID:
for ( U16 i = 0; i < fLocalGI.nPlayers; ++i ) {
copyIDString( NAME_BASE+i, &fLocalGI.players[i].name );
copyIDString( PASSWORD_BASE+i,
&fLocalGI.players[i].password );
}
if ( !!dictMenu ) {
fLocalGI.dictName =
copyString( MPPARM(mpool)
fDList->GetNthName(dictMenu->GetCurrentRow()));
} else {
fLocalGI.dictName = (XP_UCHAR*)NULL;
}
if ( fIsNew ) {
fLocalGI.boardSize = 15 - this->sizeMenu->GetCurrentRow();
fLocalGI.phoniesAction = fPhoniesMenu->GetCurrentRow();
}
fLocalGI.timerEnabled = fTimerEnabled->GetDownStatus();
if ( fLocalGI.timerEnabled ) {
char* text = fTimerField->GetText();
fLocalGI.gameSeconds = atoi(text) * 60;
}
*fGIRef = fLocalGI; /* copy changes to caller */
case CANCEL_BUTTON_ID:
*this->resultP = id == CANCEL_BUTTON_ID;
this->Close();
result = 1;
break;
default: /* probably one of our synthetic IDs */
if ( id >= ROBOT_BASE && id < ROBOT_BASE+MAX_NUM_PLAYERS ) {
U16 playerNum = id - ROBOT_BASE;
BOOL isRobot = ((CButton*)from)->GetDownStatus();
fLocalGI.players[playerNum].isRobot = isRobot;
adjustVisibility();
} else if (id >= NAME_BASE && id < NAME_BASE + MAX_NUM_PLAYERS ){
} else {
result = 0;
}
}
default:
break;
}
if ( result == 0 ) {
result = CWindow::MsgHandler( type, from, data );
}
return result;
} // CPlayersWindow::MsgHandler
/* This will create a dictionary of the dict listed first in the initial.mom
* file
*/
void
CPlayersWindow::makeDictMenu()
{
XP_U16 nDicts = fDList->GetDictCount();
U16 startRow;
if ( !!fLocalGI.dictName ) {
startRow = fDList->IndexForName( fLocalGI.dictName);
} else {
startRow = 0;
}
XP_ASSERT( nDicts > 0 );
CMenu* menu = new CMenu( PLAYERDICT_MENU_ID, 0, 0, 0, 0, 0 );
menu->SetNumRows( nDicts );
for ( U16 i = 0; i < nDicts; ++i ) {
menu->SetRow( i, 3000+i, (char*)fDList->GetNthName(i) );
}
CPopupTrigger *trigger = new CPopupTrigger( DICTNAMES_POPUP_ID, 0, 0,
menu, 0 );
trigger->SetCurrentRow(startRow);
menu->SetCurrentRow(startRow);
CLabel* label = new CLabel( DICT_LABEL_ID, "Dictnry:" );
this->AddChild( label, NAME_COL, DICTMENU_ROW );
U16 labelWidth = label->GetWidth();
this->AddChild( trigger, NAME_COL+labelWidth+10, DICTMENU_ROW );
if ( !fIsNew ) {
DisOrEnable( DICTNAMES_POPUP_ID, FALSE );
}
this->dictMenu = menu;
} /* CPlayersWindow::makeDictMenu */
void
CPlayersWindow::makeSizeMenu()
{
CMenu* menu = new CMenu( BOARDSIZE_MENU_ID, 0, 0, 0, 0, 0 );
menu->SetNumRows( NUM_SIZES );
for ( U16 i = 0; i < NUM_SIZES; ++i ) {
U16 siz = 15-i;
snprintf( (char*)this->sizeNames[i], sizeof(this->sizeNames[i]),
"%dx%d", siz, siz );
menu->SetRow( i, 4000+i, (char*)this->sizeNames[i] );
}
CPopupTrigger* trigger = new CPopupTrigger( BOARDSIZE_POPUP_ID, 0, 0,
menu, 0 );
U16 curSize = 15-fLocalGI.boardSize;
trigger->SetCurrentRow(curSize);
menu->SetCurrentRow(curSize);
CLabel* label = new CLabel( SIZE_LABEL_ID, "Board size:" );
this->AddChild( label, NAME_COL, SIZEMENU_ROW );
U16 labelWidth = label->GetWidth();
this->AddChild( trigger, NAME_COL+labelWidth+10, SIZEMENU_ROW );
if ( !fIsNew ) {
DisOrEnable( BOARDSIZE_POPUP_ID, FALSE );
}
this->sizeMenu = menu;
} /* CPlayersWindow::makeSizeMenu */
void
CPlayersWindow::adjustVisibility()
{
/* disable everything greater than the number of players. Before that,
disable passwords if robot */
U16 nPlayers = fLocalGI.nPlayers;
for ( U16 i = 0; i < MAX_NUM_PLAYERS; ++i ) {
XP_Bool disableAll = i >= nPlayers;
BOOL enable;
/* name */
enable = !disableAll;
DisOrEnable( NAME_BASE + i, enable );
/* robot check */
/* enable's the same as above */
DisOrEnable( ROBOT_BASE + i, enable );
/* passwd */
enable = !disableAll && !fLocalGI.players[i].isRobot;
DisOrEnable( PASSWORD_BASE + i, enable );
}
} /* adjustVisibility */
void
CPlayersWindow::makePhoniesMenu()
{
CMenu* menu = new CMenu( PHONIES_MENU_ID, 0, 0, 0, 0, 0 );
menu->SetNumRows( 3 );
menu->SetRow( 0, 5000, "Ignore" );
menu->SetRow( 1, 5001, "Warn" );
menu->SetRow( 2, 5002, "Disallow" );
CPopupTrigger* trigger = new CPopupTrigger( PHONIES_POPUP_ID, 0, 0,
menu, 0 );
XWPhoniesChoice phoniesAction = fLocalGI.phoniesAction;
trigger->SetCurrentRow(phoniesAction);
menu->SetCurrentRow(phoniesAction);
CLabel* label = new CLabel( SIZE_LABEL_ID, "Phonies:" );
this->AddChild( label, NAME_COL, PHONIESMENU_ROW );
U16 labelWidth = label->GetWidth();
this->AddChild( trigger, NAME_COL+labelWidth+10, PHONIESMENU_ROW );
fPhoniesMenu = menu;
} /* CPlayersWindow::makePhoniesMenu */
void
CPlayersWindow::copyIDString( U16 id, XP_UCHAR** where )
{
if ( *where ) {
XP_DEBUGF( "freeing string " );
XP_DEBUGF( "%s\n", *where );
XP_FREE( mpool, *where );
XP_DEBUGF( "done freeing string\n" );
}
XP_UCHAR* str = (XP_UCHAR*)NULL;
CTextEdit* te = (CTextEdit*)this->GetChildID( id );
XP_UCHAR* name = (XP_UCHAR*)te->GetText();
U16 len = te->TextLength();
if ( len > 0 ) {
str = (XP_UCHAR*)XP_MALLOC( mpool, len + 1 );
memcpy( str, name, len );
str[len] = '\0';
}
*where = str;
} /* CPlayersWindow::copyIDString */

View file

@ -1,66 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001-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 _FRANKPLAYER_H_
#define _FRANKPLAYER_H_
extern "C" {
#include "comtypes.h"
#include "game.h"
}
#include "frankdict.h"
#include "frankdlist.h"
#define NUM_SIZES 6
class CPlayersWindow : public CWindow {
private:
CurGameInfo fLocalGI; /* local copy; discard if cancel */
BOOL* resultP; /* where to write ok-or-cancel */
CurGameInfo* fGIRef; /* copy local to here if not cancel */
CMenu* countMenu; /* need to preserve in order to delete */
CMenu* dictMenu; /* need to preserve in order to delete */
CMenu* sizeMenu;
CMenu* fPhoniesMenu;
CCheckbox* fTimerEnabled;
CTextEdit* fTimerField;
XP_UCHAR sizeNames[10][NUM_SIZES];
FrankDictList* fDList;
BOOL fIsNew;
XP_UCHAR fNumsBuf[10]; /* saves allocs and frees for menu strings */
public:
MPSLOT
public:
CPlayersWindow( MPFORMAL CurGameInfo* pi, FrankDictList* dlist, BOOL isNew,
BOOL allowCancel, BOOL* cancelledP );
~CPlayersWindow();
S32 MsgHandler( MSG_TYPE type, CViewable *object, S32 data );
private:
void DisOrEnable( U16 id, BOOL enable );
void makeDictMenu();
void makeSizeMenu();
void makePhoniesMenu();
void copyIDString( U16 id, XP_UCHAR** where );
void adjustVisibility();
};
#endif

View file

@ -1,231 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 1999-2001 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 <assert.h>
#include <ctype.h>
#include "sys.h"
#include "gui.h"
#include "ebm_object.h"
extern "C" {
#include "comtypes.h"
}
#include "franksavedgames.h"
#include "frankids.h"
#define RENAME_BUTTON_ID 1000
#define DUP_BUTTON_ID 1001
#define DELETE_BUTTON_ID 1002
#define DONE_BUTTON_ID 1003
#define OPEN_BUTTON_ID 1004
#define NAME_FIELD_ID 1005
#define ROW_HEIGHT 12
#define GAMES_NUM_VISROWS 6
#define GAMES_ROW_WIDTH 150
#define LIST_TOP 5
#define LIST_HEIGHT (GAMES_NUM_VISROWS*ROW_HEIGHT)
#define FIELD_TOP (LIST_TOP+LIST_HEIGHT+8)
#define LIST_LEFT 5
#define FIELD_HEIGHT 15
#define FIELD_WIDTH 100
#define BUTTON_TOP (FIELD_TOP+FIELD_HEIGHT+8)
class GamesList : public CList {
private:
CGamesDB* gamesDB;
public:
GamesList( CGamesDB* gamesDB, U16 numRows, U16 startRow );
U16 GetRowHeight( S32 row ) { return ROW_HEIGHT; }
void DrawRow( RECT *rect, S32 row );
};
GamesList::GamesList( CGamesDB* gamesDB, U16 numRows, U16 startRow )
: CList( 1001, GAMES_ROW_WIDTH, LIST_HEIGHT,
numRows, LISTOPTION_ALWAYS_HIGHLIGHT )
{
this->gamesDB = gamesDB;
this->SetCurrentRow(startRow);
}
void GamesList::DrawRow( RECT *rect, S32 row )
{
XP_UCHAR* name = this->gamesDB->getNthName( row+1 );
if ( !name ) {
name = (XP_UCHAR*)"untitled";
}
CWindow* window = this->GetWindow();
window->DrawText( (char*)name, rect->x, rect->y );
} /* GamesList::DrawRow */
/*****************************************************************************
* The class itself
****************************************************************************/
CSavedGamesWindow::CSavedGamesWindow( CGamesDB* gamesDB, U16* toOpen,
U16* curIndex )
: CWindow( SAVEDGAMES_WINDOW_ID, 2, 90, 196, 148, "Saved games", TRUE,
FALSE, FALSE /* no closebox */ )
{
this->gamesDB = gamesDB;
this->toOpenP = toOpen; /* what we'll say to open */
this->curIndexP = curIndex; /* where we'll say current's moved to */
this->curIndex = *curIndex; /* save current (move when delete/dup) */
this->displayIndex = this->curIndex; /* start display at current */
this->gamesList = (GamesList*)NULL;
CTextEdit* field = new CTextEdit( NAME_FIELD_ID, FIELD_WIDTH,
FIELD_HEIGHT, TEXTOPTION_HAS_FOCUS
| TEXTOPTION_ONELINE );
this->nameField = field;
field->SetText( (char*)gamesDB->getNthName( this->displayIndex ) );
this->AddChild( field, LIST_LEFT, FIELD_TOP );
CButton* button = new CButton( RENAME_BUTTON_ID, 0, 0, "Rename" );
U16 result = this->AddChild( button, 130, FIELD_TOP );
button = new CButton( DUP_BUTTON_ID, 0, 0, "Dup" );
result = this->AddChild( button, 5, BUTTON_TOP );
button = new CButton( DELETE_BUTTON_ID, 0, 0, "Delete" );
result = this->AddChild( button, 40, BUTTON_TOP );
this->deleteButton = button;
checkDisableDelete();
button = new CButton( OPEN_BUTTON_ID, 0, 0, "Open" );
result = this->AddChild( button, 90, BUTTON_TOP );
button = new CButton( DONE_BUTTON_ID, 0, 0, "Done" );
result = this->AddChild( button, 130, BUTTON_TOP );
reBuildGamesList();
} // CSavedGamesWindow
void
CSavedGamesWindow::reBuildGamesList()
{
if ( !!this->gamesList ) {
this->DeleteChild( this->gamesList );
delete this->gamesList;
}
U16 numRows = this->gamesDB->countRecords() - 1; /* skip prefs */
GamesList* list = new GamesList( gamesDB, numRows, this->curIndex-1 );
this->gamesList = list;
this->AddChild( list, LIST_LEFT, LIST_TOP );
list->SetCurrentRow( this->displayIndex-1 );
} /* reBuildGamesList */
void
CSavedGamesWindow::checkDisableDelete()
{
BOOL disable = this->displayIndex == this->curIndex;
CButton* button = this->deleteButton;
if ( disable != button->IsDisabled() ) {
if ( disable ) {
button->Disable();
} else {
button->Enable();
}
}
} /* checkDisableDelete */
S32
CSavedGamesWindow::MsgHandler( MSG_TYPE type, CViewable *object, S32 data )
{
S32 result = 0;
XP_UCHAR* name;
U16 newID;
switch (type) {
case MSG_BUTTON_SELECT: // there's only one button....
switch (object->GetID()) {
case RENAME_BUTTON_ID:
name = (XP_UCHAR*)this->nameField->GetText();
this->gamesDB->putNthName( this->displayIndex, name );
this->gamesList->Draw();
break;
case DUP_BUTTON_ID:
newID = this->gamesDB->duplicateNthRecord( this->displayIndex );
this->displayIndex = newID;
reBuildGamesList();
this->gamesList->Draw();
checkDisableDelete();
break;
case DELETE_BUTTON_ID:
/* disable button instead of checking here */
XP_ASSERT( this->displayIndex != this->curIndex );
if ( 1 == GUI_Alert( ALERT_OK,
"Are you sure you want to delete"
" the selected game?" ) ) {
this->gamesDB->removeNthRecord( this->displayIndex );
if ( this->displayIndex < this->curIndex ) {
--this->curIndex;
}
if ( this->displayIndex == this->gamesDB->countRecords() ) {
--this->displayIndex;
}
reBuildGamesList();
this->gamesList->Draw();
checkDisableDelete();
}
break;
case DONE_BUTTON_ID:
this->displayIndex = this->curIndex; /* restore to saved so next
line's does nothing */
/* FALLTHRU */
case OPEN_BUTTON_ID:
*this->curIndexP = this->curIndex;
*this->toOpenP = this->displayIndex;
this->Close();
break;
}
result = 1;
break;
case MSG_ROW_SELECT:
this->displayIndex = (U16)data + 1;
nameField->SetText( (char*)gamesDB->getNthName( this->displayIndex ) );
checkDisableDelete();
result = 1;
break;
default:
break;
}
if ( result == 0 ) {
result = CWindow::MsgHandler( type, object, data );
}
return result;
} // MsgHandler

View file

@ -1,47 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001 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 _FRANKSAVEDGAMES_H_
#define _FRANKSAVEDGAMES_H_
#include "frankgamesdb.h"
extern "C" {
}
class CSavedGamesWindow : public CWindow {
private:
CGamesDB* gamesDB;
class GamesList* gamesList;
CTextEdit* nameField;
CButton* deleteButton;
U16* toOpenP;
U16* curIndexP;
U16 curIndex;
U16 displayIndex;
void reBuildGamesList();
void checkDisableDelete();
public:
CSavedGamesWindow( CGamesDB* gamesDB, U16* toOpen, U16* curIndex );
S32 MsgHandler( MSG_TYPE type, CViewable *object, S32 data );
};
#endif

View file

@ -1,154 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 2001 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 <assert.h>
#include <ctype.h>
#include "sys.h"
#include "gui.h"
#include "ebm_object.h"
extern "C" {
#include "xptypes.h"
#include "xwstream.h"
}
#include "frankshowtext.h"
#include "frankids.h"
#define MAX_DLG_HT 200
#define SHOWTEXT_WINDOW_ID 2000
#define SHOW_TEXT_ID 2001
#define TEXT_X 5
#define TEXT_PADDING_ABOVE 5
#define TEXT_PADDING_BELOW 5
#define TEXT_Y TEXT_PADDING_ABOVE
#define TEXT_WIDTH 180
#define TEXT_HEIGHT 40
#define TEXT_PADDING (TEXT_PADDING_ABOVE+TEXT_PADDING_BELOW)
#define TITLE_BAR_HT 15
#define OK_BUTTON_ID 1000
#define CANCEL_BUTTON_ID 1001
#define OK_BUTTON_X 40
#define CANCEL_BUTTON_X 100
#define BUTTON_HEIGHT 12
#define BUTTON_PADDING 3 /* below buttons */
CShowTextWindow::CShowTextWindow( MPFORMAL XWStreamCtxt* stream,
const char* title,
XP_Bool killStream, XP_Bool showCancel,
XP_U16* resultLoc )
: CWindow( SHOWTEXT_WINDOW_ID, 5, 170, 190,
TEXT_HEIGHT + TEXT_PADDING + TITLE_BAR_HT,
title, TRUE, FALSE, !showCancel )
{
MPASSIGN( this->mpool, mpool );
CButton* okButton = (CButton*)NULL;
CButton* cancelButton = (CButton*)NULL;
fResultLoc = resultLoc;
CTextEdit* entry = new CTextEdit( SHOW_TEXT_ID, TEXT_WIDTH, TEXT_HEIGHT,
TEXTOPTION_NOEDIT |
TEXTOPTION_NOUNDERLINE);
/* copy the stream's text into the texteditor */
stream_putU8( stream, '\0' );
XP_U16 len = stream_getSize( stream );
char* textPtr = (char*)XP_MALLOC( mpool, len );
stream_getBytes( stream, textPtr, len );
XP_ASSERT( textPtr[len-1] == '\0' );
entry->SetText(textPtr);
XP_FREE( mpool, textPtr );
if ( killStream ) {
stream_destroy( stream );
}
RECT rect;
GetUsableRect( &rect );
U16 titleBarHt = rect.y - GetY();
U16 maxTextHeight = MAX_DLG_HT - TEXT_PADDING - titleBarHt;
U16 buttonHeight;
if ( showCancel ) {
okButton = new CButton( OK_BUTTON_ID, 0, 0, "Ok" );
cancelButton = new CButton( CANCEL_BUTTON_ID, 0, 0, "Cancel" );
buttonHeight = okButton->GetHeight() + BUTTON_PADDING;
maxTextHeight -= buttonHeight;
} else {
buttonHeight = 0;
}
/* FIND out how big the text wants to be. Make the window as big as
necessary, growing it upward. */
U16 curTextHeight = entry->GetMaxHeight();
if ( curTextHeight > maxTextHeight ) {
curTextHeight = maxTextHeight;
}
entry->SetHeight( curTextHeight );
U16 newDlgHeight = curTextHeight + buttonHeight + TEXT_PADDING
+ titleBarHt;
S16 diff = newDlgHeight - GetHeight();
SetY( GetY() - diff );
SetHeight( newDlgHeight );
this->AddChild( entry, TEXT_X, TEXT_Y );
if ( showCancel ) {
U16 buttonY = TEXT_Y + curTextHeight + TEXT_PADDING_BELOW;
AddChild( okButton, OK_BUTTON_X, buttonY );
AddChild( cancelButton, CANCEL_BUTTON_X, buttonY );
}
} /* CShowTextWindow */
S32
CShowTextWindow::MsgHandler( MSG_TYPE type, CViewable *object, S32 data )
{
S32 result = 0;
switch ( type ) {
case MSG_BUTTON_SELECT: /* there's only one button */
result = 1;
switch ( object->GetID() ) {
case OK_BUTTON_ID:
*fResultLoc = 1;
break;
case CANCEL_BUTTON_ID:
*fResultLoc = 0;
break;
}
break;
default:
break;
}
if ( result == 1 ) {
this->Close();
}
return result;
} /* MsgHandler */

View file

@ -1,42 +0,0 @@
// -*-mode: C; fill-column: 78; c-basic-offset: 4; -*-
/*
* Copyright 2001 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 _SHOWTEXT_H_
#define _SHOWTEXT_H_
extern "C" {
#include "comtypes.h"
#include "mempool.h"
}
class CShowTextWindow : public CWindow {
private:
XP_U16* fResultLoc;
public:
MPSLOT
public:
CShowTextWindow( MPFORMAL XWStreamCtxt* stream, const char* title,
XP_Bool killStream, XP_Bool showCancel,
XP_U16* resultLoc );
S32 MsgHandler( MSG_TYPE type, CViewable *object, S32 data );
};
#endif /* _SHOWTEXT_H_ */

View file

@ -1,10 +0,0 @@
object Franklin _GUI pkg _GUI.pkg
object Franklin _Default fnt _Default.fnt
object Franklin _System fnt _System.fnt
object Franklin _jingles piezo _jingles.dat
sobject Franklin _alarms timer _alarms.dat
sobject Franklin _SysSet_ dat _settings.dat
object Eric_House xwords4 fxe xwords4.fxe
icon xwords4.icn Cross- words 4
attribute _LFLAGS S
object Eric_House BasEnglish2to8 xwd BasEnglish2to8.xwd

View file

@ -1,124 +0,0 @@
#!/usr/bin/perl
# Copyright 2001 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.
# write a pbitm out in franklin "format"
#
# usage: pbitm2frank.pl infile outName
use strict;
my $infile = $ARGV[0];
my $outname = $ARGV[1];
my @lines;
my $width = -1;
my $height = 0;
open (INFILE, $infile) or die "can't find file $infile\n";
print qq (
/* This file generated from $infile; do not edit!!! */
);
while ( <INFILE> ) {
++$height;
s/\s//; # get rid of whitespace
push( @lines, $_ );
my $len = length($_);
if ( $width == -1 ) {
$width = $len;
} elsif ( $len != $width ) {
die "line $height width differs";
}
}
my $rowbytes = ($width + 7) >> 3;
my $structName = "${outname}_struct" ;
print qq( typedef struct $structName {
IMAGE img;
U8 data[$height * $rowbytes];
} $structName;
);
printStruct(0);
print "#ifdef USE_INVERTED\n";
printStruct(1);
print "#endif /* USE_INVERTED */\n";
sub printStruct() {
my ($invert) = @_;
my $thisName = $outname;
if ( $invert ) {
$thisName .= "_inverted";
}
print qq(
$structName $thisName = {
{ $width, $height, $rowbytes,
COLOR_MODE_MONO, 0, (const COLOR *) 0, (U8*)NULL },
{
);
foreach my $line (@lines) {
printLine( $width, $line, $invert );
}
print " }\n};\n";
} # printStruct
sub printLine() {
my ($len, $line, $invert) = @_;
$line .= '-------'; # pad with 7 0s
if ( $invert ) {
$line =~ s/#/h/g;
$line =~ s/\-/#/g;
$line =~ s/h/\-/g;
}
for ( my $i = 0; $len > 0; ++$i ) {
my $byte = 0;
my $subline = substr($line, $i*8, 8 );
for ( my $j = 0; $j < 8; ++$j ) {
my $ch = substr( $subline, $j, 1 );
if ( $ch eq '-' ) {
} elsif ( $ch eq '#' ) {
$byte |= 1 << (7-$j);
} else {
print STDERR ("unexpected char $ch at offset ",
($i*8)+$j, " in line $height\n");
die;
}
}
printf( "\t0x%x, ", $byte );
$len -= 8;
}
print "\t/* ", substr($line, 0, -7), " */\n";
} # printLine

View file

@ -1,112 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 1999-2000 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _XPTYPES_H_
#define _XPTYPES_H_
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gui_types.h>
#include <assert.h>
#ifdef CPLUS
extern "C" {
#endif
#define XP_TRUE ((XP_Bool)(1==1))
#define XP_FALSE ((XP_Bool)(1==0))
typedef U8 XP_U8;
typedef S8 XP_S8;
typedef unsigned char XP_UCHAR;
typedef U16 XP_U16;
typedef S16 XP_S16;
typedef U32 XP_U32;
/* typedef S32 XP_A32; */
typedef S32 XP_S32;
typedef signed short XP_FontCode; /* not sure how I'm using this yet */
typedef BOOL XP_Bool;
typedef U32 XP_Time;
#define XP_CR "\n"
void frank_insetRect( RECT* r, short byWhat );
void frank_debugf(char*, ...);
void p_ignore(char*, ...);
int frank_snprintf( XP_UCHAR* buf, XP_U16 len, XP_UCHAR* format, ... );
unsigned long frank_flipLong( unsigned long l );
unsigned short frank_flipShort(unsigned short s);
#define XP_RANDOM() rand()
#ifdef MEM_DEBUG
# define XP_PLATMALLOC(nbytes) malloc(nbytes)
# define XP_PLATREALLOC(p,s) realloc((p), (s))
# define XP_PLATFREE(p) free(p)
#else
# define XP_MALLOC(pool, nbytes) malloc(nbytes)
# define XP_REALLOC(pool, p, bytes) realloc((p), (bytes))
# define XP_FREE(pool, p) free(p)
#endif
#define XP_MEMSET(src, val, nbytes) memset( (src), (val), (nbytes) )
#define XP_MEMCPY(d,s,l) memcpy((d),(s),(l))
#define XP_MEMCMP( a1, a2, l ) memcmp((a1),(a2),(l))
#define XP_STRLEN(s) strlen((char*)(s))
#define XP_STRCMP(s1,s2) strcmp((char*)(s1),(char*)(s2))
#define XP_STRNCMP(s1,s2,l) strncmp((char*)(s1),(char*)(s2),(l))
#define XP_STRCAT(d,s) strcat((d),(s))
#define XP_SNPRINTF frank_snprintf
#define XP_MIN(a,b) ((a)<(b)?(a):(b))
#define XP_MAX(a,b) ((a)>(b)?(a):(b))
#ifdef DEBUG
#define XP_ASSERT(b) assert(b)
#else
#define XP_ASSERT(b)
#endif
#define XP_STATUSF XP_DEBUGF
#define XP_WARNF XP_DEBUGF
#ifdef DEBUG
#define XP_LOGF frank_debugf
#define XP_DEBUGF frank_debugf
#else
#define XP_LOGF if(0)p_ignore
#define XP_DEBUGF if(0)p_ignore
#endif
#define XP_NTOHL(l) frank_flipLong(l)
#define XP_NTOHS(s) frank_flipShort(s)
#define XP_HTONL(l) frank_flipLong(l)
#define XP_HTONS(s) frank_flipShort(s)
#ifdef CPLUS
}
#endif
#endif

View file

@ -1,36 +0,0 @@
#
# This file contains attributes common to all things.
#
# Format is: NAME|permissions|VALUE
# Set these attributes to your desired MOM object name
#
_PUB|global+read-only|"Eric_House"
_NAME|global+read-only|"xwords4"
# If your object has an icon, this attribute sets the icon label text
# Restrictions: two rows of 9 characters, spaces break to the next line.
# This example "GUI Test App" will appear as two lines: "GUI Test" and "App"
_ITXT|global|"Cross- words 4"
# Launcher flag characters:
# S = launch after sync
# B = launch on boot
# If this attribute is omitted, the app is never launched automatically.
#_LFLAGS|global+read-only|"SB"
#
# The attributes below should rarely have to change
#
# Launcher category setting
_LCAT|nosign+global|"PROGRAMS"
# file extension
_EXT|global+read-only|"fxe"
# system permissions, apps are read-only, take off the "read-only"
# for read/write permission
_PERM|global+read-only|x"00000000"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

View file

@ -1,12 +0,0 @@
*.out
*.bin
LocalizedStrIncludes.h
app.gdb
gdbload
palm
fnavgen
pace_gen.h
pace_gen.c
PNOC_bin.pre
PALM_PNO
_dirList

View file

@ -1,356 +0,0 @@
# -*- mode: Makefile; compile-command: "make ARCH=68K_ONLY MEMDEBUG=TRUE"; -*-
# Copyright 2002-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.
PLATFORM=obj_palm
SVNREV = $(shell svnversion -n .. | tr ':' '_')
ifeq ($(MEMDEBUG),TRUE)
DEBUG = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING
PLATFORM := $(PLATFORM)_memdebug
CFLAGS += $(DEBUG) -g -O0
CSFLAGS += -O0 -g
NAME = "CrossDbg"
ICONTEXT = "CrossDbg"
APPID ?= Xwdb
else
PLATFORM := $(PLATFORM)_rel
CFLAGS += -O2 -fomit-frame-pointer
# The -Os flag breaks multilink, at least as I'm using it
CSFLAGS += -OS -fomit-frame-pointer
NAME = "Crosswords"
ICONTEXT = "Crosswords"
APPID ?= Xwr4
endif
RELAY_NAME_DEFAULT="eehouse.org"
LANG=en_US
ROOTNAME = $(NAME)
BITMAPS = ./bmps
TYPE = appl
MLPREFIX = /usr
DICT = $(shell echo $$BASENG_PATH)
ARCH ?= ARM_ONLY
ifeq ($(ARCH),ARM_ONLY)
PLATFORM := $(PLATFORM)_armonly
BUILD_AS_PNOLET = 1
TARGET=$(PLATFORM)/xw4_ARM_$(SVNREV).prc
else
ifeq ($(ARCH),68K_ONLY)
PLATFORM := $(PLATFORM)_68konly
TARGET=$(PLATFORM)/xw4_68K_$(SVNREV).prc
else
ifeq ($(ARCH),SONY)
# No highres in sony build case
PLATFORM := $(PLATFORM)_sony
BUILD_AS_PNOLET = 1
FEATURE_PNOAND68K = -DFEATURE_PNOAND68K
TARGET=$(PLATFORM)/xw4_SONY_$(SVNREV).prc
else
ifeq ($(ARCH),COMBINED)
PLATFORM := $(PLATFORM)_combined
BUILD_AS_PNOLET = 1
FEATURE_PNOAND68K = -DFEATURE_PNOAND68K
TARGET=$(PLATFORM)/xw4_COMB_$(SVNREV).prc
endif
endif
endif
endif
PLATFORM := $(PLATFORM)_$(shell echo $(LANG) | tr [A-Z] [a-z])
APPNAME = "$(NAME)"
PALM_TOOLS_PREFIX = $(shell echo $$PALM_TOOLS_PREFIX)
ifeq (x$(PALM_TOOLS_PREFIX)x, xx)
PALM_TOOLS_PREFIX = m68k-palmos-
endif
#PALM_TOOLS_PREFIX=m68k-palmos-coff-
CC = $(PALM_TOOLS_PREFIX)gcc
AR = $(PALM_TOOLS_PREFIX)ar
MULTILINK = $(PALM_TOOLS_PREFIX)multilink
###############################################################################
# par is a utility for manipulating .prc and .pdb files. See
# http://djw.org/product/palm/par/index.html to download source.
###############################################################################
PAR = par
PILRC = pilrc
BUILD-PRC = build-prc
OBJ-RES = m68k-palmos-obj-res
MULTILINK_OPTIONS = -basename $(ROOTNAME) -segmentsize 27k -g \
-deadstrip -verbose -gdb-script app.gdb
MYDEFS_COMMON = $(PASSTHRU) -DXW_FEATURE_UTILS -DPOINTER_SUPPORT \
-DKEY_SUPPORT -DOVERRIDE_EDGE_FOR_INDEX -DCOLOR_SUPPORT \
-DSHOW_PROGRESS $(HASHDEF) -DNO_REG_REQUIRED -DPERIMETER_FOCUS
# turn on letting users pick tiles "face-up"
MYDEFS_COMMON += -DFEATURE_TRAY_EDIT
# turn on limits to searches on board and in tray (number of tiles to
# use)
MYDEFS_COMMON += -DXWFEATURE_SEARCHLIMIT
#MYDEFS_COMMON += -DXWFEATURE_HINT_CONFIG
ifdef XWFEATURE_STANDALONE_ONLY
MYDEFS_COMMON += -DXWFEATURE_STANDALONE_ONLY
else
# Turn on network play over IP via cellular modem. Very much
# experimental at this point!
RELAY = -DXWFEATURE_RELAY
MYDEFS_COMMON += $(RELAY)
# turn on bluetooth comms option for 68K and ARM
BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_L2CAP
# -DCOMMS_HEARTBEAT
#BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_RFCOMM
MYDEFS_COMMON += $(BLUETOOTH)
MYDEFS_COMMON += -DXWFEATURE_IR
endif # ifdef XWFEATURE_STANDALONE_ONLY
# Add menu allowing to choose to run 68K or ARM
ifeq ($(ARCH),COMBINED)
MYDEFS_COMMON += -DFEATURE_DUALCHOOSE
endif
# For Danish and perhaps other languages, custom-measure glyph height
# so that overtall letters have a chance of fitting.
MYDEFS_COMMON += -DTALL_FONTS
# Turn on ability to handle 4-byte-node DAWG files. These are of type
# Xwr4, not Xwr3 like the old ones. Currently this option means the
# binary won't be able to read or even find the old dictionaries.
# Don't release with this on until there's a UI decision and code on
# how to help users transition.
MYDEFS_COMMON += -DNODE_CAN_4
MYDEFS_COMMON += -DSVN_REV=\"$(shell svnversion -n .)\"
MYDEFS_ARM = -D__LITTLE_ENDIAN -DXW_TARGET_PNO $(MYDEFS_COMMON)
MYDEFS_68K = -DPLATFORM_PALM -D__BIG_ENDIAN $(MYDEFS_COMMON) \
-DAPPNAME=\"$(APPNAME)\" \
-DRELAY_NAME_DEFAULT=\"$(RELAY_NAME_DEFAULT)\" \
$(BLUETOOTH)
BITMAP_RSRCS = \
$(BITMAPS)/rightarrow.pbitm \
$(BITMAPS)/downarrow.pbitm \
$(BITMAPS)/flipbutton.pbitm \
$(BITMAPS)/valuebutton.pbitm \
$(BITMAPS)/lightbulb.pbitm \
$(BITMAPS)/traybuttons.pbitm \
$(BITMAPS)/showtray.pbitm \
$(BITMAPS)/xwords4.pbitm
ifdef BLUETOOTH
BITMAP_RSRCS += \
$(BITMAPS)/bts_conn.bmp \
$(BITMAPS)/bts_listen.bmp \
$(BITMAPS)/bts_off.bmp \
$(BITMAPS)/bts_seek.bmp
endif
ifdef RELAY
BITMAP_RSRCS += \
$(BITMAPS)/rls_allconn.bmp \
$(BITMAPS)/rls_off.bmp \
$(BITMAPS)/rls_pending.bmp
endif
# INCLUDES += -I/usr/local/share/palmdev/sdk-5r3/Extensions/ExpansionMgr
ifdef BLUETOOTH
INCLUDES += -I/usr/local/share/palmdev/sdk-5r3/include/Extensions/Bluetooth
endif
XWFEATURE_FIVEWAY = -DXWFEATURE_FIVEWAY -DKEYBOARD_NAV
XWFEATURE_FIVEWAY += -DDO_TUNGSTEN_FIVEWAY
ifneq (x$(XWFEATURE_FIVEWAY)x, xx)
INCLUDES += -I/usr/local/share/palmdev/Handspring5
INCLUDES += -I/usr/local/share/palmdev/Handspring5/68K
# INCLUDES += -I/usr/local/share/palmdev/duoIncs
# INCLUDES += -I/usr/local/share/palmdev/duoIncs/68K
# INCLUDES += -I/usr/local/share/palmdev/duoIncs/68K/System
# INCLUDES += -I/usr/local/share/palmdev/duoIncs/Common/System
MYDEFS_68K += $(XWFEATURE_FIVEWAY)
MYDEFS_ARM += $(XWFEATURE_FIVEWAY)
endif
INCLUDES += -I/usr/local/share/palmdev/sdk-5r3/include/SonyIncs
INCLUDES += -I/usr/local/share/palmdev/sdk-5r3/include/SonyIncs/System
INCLUDES += -I/usr/local/share/palmdev/sdk-5r3/include/SonyIncs/Libraries
MYDEFS_68K += -DCPU_TYPE=CPU_68K
include ../common/config.mk
OBJS_68K = $(PLATFORM)/palmmain.o \
$(PLATFORM)/palmsavg.o \
$(PLATFORM)/gameutil.o \
$(PLATFORM)/newgame.o \
$(PLATFORM)/palmdict.o \
$(PLATFORM)/palmdraw.o \
$(PLATFORM)/palmutil.o \
$(PLATFORM)/dictui.o \
$(PLATFORM)/dictlist.o \
$(PLATFORM)/palmir.o \
$(PLATFORM)/palmip.o \
$(PLATFORM)/palmbt.o \
$(PLATFORM)/prefsdlg.o \
$(PLATFORM)/connsdlg.o \
$(PLATFORM)/palmblnk.o \
$(PLATFORM)/palmdbg.o \
$(COMMONOBJ)
# if BUILD_AS_PNOLET is defined and FEATURE_PNOAND68K isn't, exclude
# all but enter68k.o from the 68K part of the binary (code resources).
ifdef BUILD_AS_PNOLET
OBJS = $(PLATFORM)/enter68k.o
PNOLET = pnolet
endif
ifndef BUILD_AS_PNOLET
OBJS += $(OBJS_68K)
else
ifdef FEATURE_PNOAND68K
OBJS += $(OBJS_68K)
endif
endif
MYDEFS_68K += $(FEATURE_PNOAND68K)
MYDEFS_ARM += $(FEATURE_PNOAND68K)
include ../common/rules.mk
CSFLAGS += -S -Wall -DAPPID=\'$(APPID)\' $(MYDEFS_68K) $(INCLUDES)
CFLAGS += -Wall -DAPPID=\'$(APPID)\' $(MYDEFS_68K) $(INCLUDES)
# In the non-debug mode (for which DONT_OMIT is undefined) build without
# the frame pointer.
$(TARGET): $(PLATFORM)/objs.prc $(PLATFORM)/res.prc
$(PAR) -c -a 'resource|backup' -v 4 $@ $(NAME) $(TYPE) $(APPID) $^
ifdef XW_UPLOAD_SCRIPT
$(XW_UPLOAD_SCRIPT) $@
endif
solo:
$(MAKE) XWFEATURE_STANDALONE_ONLY=1
gremlins:
$(MAKE) PASSTHRU="-DDEBUG -DMEM_DEBUG -DFOR_GREMLINS" DONT_OMIT=true
#
REL=405
REL_PATH=public_html/xwords/4.0.5
ship-all:
make clean; make; \
make; (cd xwconfig && make); \
for l in fr_FR en_US es_ES es_CT sv_SE de_DE ; do \
make clean; \
make LANG=$$l; \
zip -j xw$(REL)_$$l.zip xwconfig/xwconfig.prc $(TARGET); \
done
.S.o:
$(CC) $(TARGETFLAGS) -c $<
.c.s:
$(CC) $(CSFLAGS) $<
$(BITMAPS)/%.pbitm: $(BITMAPS)/%.bmp
bmtoa $< > $@
$(PLATFORM)/objs.prc: $(PLATFORM)/LocalizedStrIncludes.h $(OBJS) gdbload
@rm -f *.grc *.bin
ifeq ($(ARCH),ARM_ONLY)
$(CC) $(OBJS) -o tmp.o
$(OBJ-RES) tmp.o
rm -f tmp.o
else
$(MULTILINK) $(MULTILINK_OPTIONS) $(OBJS)
endif
$(PAR) -c -a resource $(PLATFORM)/objs.prc Code rsrc rsrc *.grc
@rm -f *.grc *.bin
$(PLATFORM)/res.prc: xwords4.rcp $(HEADERS) StrL03e8.bin $(FNAVS) $(PNOLET)
$(PILRC) $< >/dev/null
$(PAR) -c -a 'resource' $@ Rsrc rsrc rsrc *.bin
rm -f $< *.bin
xwords4.rcp: l10n/xwords4_$(LANG).rcp.pre xwords4defines.h $(BITMAP_RSRCS)
gcc -x c -E -P $(INCLUDES) $(MYDEFS_68K) $(DEBUG) \
-DICONTEXT=\"$(ICONTEXT)\" $< > $@
# LocalizedStrIncludes.h: SVN_REV can change, but I don't have a way
# to express a dependency on it. If it does change, strings can wind
# up with offsets out of sync with the .h file. Not sure what to do
# about this.... Clean builds are probably a safe fallback.
$(PLATFORM)/LocalizedStrIncludes.h StrL03e8.bin: \
./l10n/StrRes_$(LANG).pre ./l10n/mkstrsres.c
gcc $(CFLAGS) $(FORMATDEFINES) \
-DLANGSTRFILE=\"$<\" ./l10n/mkstrsres.c \
-o mkstrsres
mkdir -p $(PLATFORM)
./mkstrsres StrL03e8.bin $(PLATFORM)/LocalizedStrIncludes.h
rm -f mkstrsres
ifneq (x$(BUILD_AS_PNOLET)x, xx)
.PHONY : pnolet
pnolet: $(PLATFORM)/LocalizedStrIncludes.h
$(MAKE) -f Makefile.PNO MEMDEBUG=$(MEMDEBUG) PLATFORM=$(PLATFORM) \
MYDEFS="$(MYDEFS_ARM) -DAPPID=\'$(APPID)\' -DAPPNAME=\\\"$(APPNAME)\\\" -DRELAY_NAME_DEFAULT=\\\"$(RELAY_NAME_DEFAULT)\\\""
endif
# GDB seems confused by relative paths these days. So generate the
# file rather than trying to keep in in cvs.
gdbload:
echo "source app.gdb" > $@
echo "load-segments" >> $@
echo "dir $(shell pwd)" >> $@
echo "dir $(shell pwd)/../common" >> $@
clean:
cd ../common && $(MAKE) PLATFORM=$(PLATFORM) $@
rm -rf $(PLATFORM)/*.[oa] xwords4 *.bin *.stamp *.[pg]rc \
xwords4.rcp *.btxt $(PLATFORM)/* $(PLATFORM)/LocalizedStrIncludes.h \
gdbload
ifneq (x$(BUILD_AS_PNOLET)x, xx)
$(MAKE) -f Makefile.PNO PLATFORM=$(PLATFORM) clean
endif
#cmod03E8.bin: palmdraw.c Makefile
# $(CC) -O2 -nostartfiles $(INCLUDES) $(MYDEFS) -o tmp $<
# $(OBJRES) tmp
# mv code0001.tmp.grc $@ ; rm *.tmp.grc
help:
@echo "make [ARCH=(ARM_ONLY|68K_ONLY|SONY|COMBINED)] [MEMDEBUG=TRUE] [LANG=fr_FR|en_US|es_ES|es_CT|sv_SE|de_DE] [clean]"
@echo OR
@echo "make ship-all"
@echo OR
@echo "make gremlins"

View file

@ -1,128 +0,0 @@
# -*- mode: Makefile; compile-command: "make ARCH=ARM_ONLY"; -*-
PALMDIR = /usr/local/share/palmdev/sdk-5r3/include
# Which arm suite to use? Well, the suite in prc-tools-arm is broken
# on debian at the moment: builds code that doesn't work. But older
# versions, e.g. on current debian stable, are ok. For current debian
# the workaround is to build your own crosscompilation toolchain,
# which should put arm-elf-gcc in your path. We'll use that if we
# find it. Otherwise we fall back to the prc-tools-arm chain.
WHICH = $(shell if which arm-elf-gcc > /dev/null ; then echo elf; else echo palmos; fi)
CC_ARM = arm-$(WHICH)-gcc
OC_ARM= arm-$(WHICH)-objcopy
OD_ARM = arm-$(WHICH)-objdump
OPT = -Os
MINUS_G = -g
ifeq ($(MEMDEBUG),TRUE)
DEBUG = -DMEM_DEBUG -DDEBUG
endif
INCLUDES += \
-I$(PALMDIR) \
-I$(PALMDIR)/Libraries \
-I$(PALMDIR)/Dynamic \
-I$(PALMDIR)/Core \
-I$(PALMDIR)/Extensions/ExpansionMgr \
-I$(PALMDIR)/Core/UI \
-I$(PALMDIR)/Core/System \
-I$(PALMDIR)/Core/System/Unix \
-I$(PALMDIR)/Core/Hardware \
-I$(PALMDIR)/Extensions/Bluetooth \
ifneq (, $(findstring XWFEATURE_FIVEWAY,$(MYDEFS)))
INCLUDES += -I/usr/local/share/palmdev/Handspring5
INCLUDES += -I/usr/local/share/palmdev/Handspring5/68K
GENDEFS += -DXWFEATURE_FIVEWAY
endif
ifneq (, $(findstring XWFEATURE_BLUETOOTH,$(MYDEFS)))
GENDEFS += -DXWFEATURE_BLUETOOTH
endif
# NOTE!!!! Added the -w flag to supress all warnings since arm-elf-gcc
# does so much bitching about the Palm headers. Need to fix that, or
# use the arm-palmos-gcc, or something. But for now, -w....
CCFLAGS = $(OPT) $(MINUS_G) -Wall -Wunused-parameter -D__PALMOS__ -D__palmos__ -Asystem=palmos
ARMCCFS = $(CCFLAGS) -DNATIVE $(DEBUG) \
-nostartfiles -mshort-load-bytes -nodefaultlibs -ffixed-r9 \
-mpic-register=r10 -msingle-pic-base -fpic \
-Wno-multichar \
$(INCLUDES)
ARMLDFS = -Xlinker --script=./ldscript.arm -lgcc
# ARM-specific
ARM_DEFINES = $(MYDEFS) -DXW_TARGET_PNO -D__LITTLE_ENDIAN -include undef_hack.h
# turn show progress off for now
# ARM_DEFINES += -USHOW_PROGRESS
include ../common/config.mk
OBJS = $(PLATFORM)/pnolet.o \
$(PLATFORM)/palmmain.o \
$(PLATFORM)/palmsavg.o \
$(PLATFORM)/gameutil.o \
$(PLATFORM)/newgame.o \
$(PLATFORM)/palmdict.o \
$(PLATFORM)/palmdraw.o \
$(PLATFORM)/palmutil.o \
$(PLATFORM)/palmblnk.o \
$(PLATFORM)/dictui.o \
$(PLATFORM)/dictlist.o \
$(PLATFORM)/palmir.o \
$(PLATFORM)/palmip.o \
$(PLATFORM)/palmbt.o \
$(PLATFORM)/prefsdlg.o \
$(PLATFORM)/connsdlg.o \
$(PLATFORM)/palmdbg.o \
$(PLATFORM)/pace_gen.o \
$(PLATFORM)/pace_man.o \
$(COMMONOBJ)
# The target of this makefile is the .bin files that comprise the
# pnolet. There will be more than just PNOC0000.bin, but the others
# get made as a matter of course and as long as they all get included
# in the .prc we're fine.
all: Pnoc0000.bin Pnog0000.bin
$(PLATFORM)/%.o : %.c $(MAKEFILE)
mkdir -p $(PLATFORM)
$(CC_ARM) -o $@ -c $(ARM_DEFINES) -DHERE $(ARMCCFS) $<
$(COMMONOBJDIR)/%.o : $(COMMONDIR)/%.c $(MAKEFILE)
mkdir -p $(COMMONOBJDIR)
$(CC_ARM) -o $@ -c $(ARM_DEFINES) -DHERE $(ARMCCFS) $<
Pnoc_bin.pre Pnog0000.bin: pace_gen.h $(OBJS)
$(CC_ARM) $(OBJS) $(ARMCCFS) $(ARMLDFS) -Wl,-Map,Pnoc_bin.map -o tmp.out
# @$(OD_ARM) --disassemble-all tmp.out
$(OC_ARM) -j .text -O binary tmp.out Pnoc_bin.pre
$(OC_ARM) -j .got -O binary tmp.out Pnog0000.bin
# @rm -f tmp.out
# create not only Pnoc0000.bin but any others required to fit the
# pnolet into 50K chunks (for hotsyncing...)
Pnoc0000.bin: Pnoc_bin.pre
rm -f Pnoc????.bin
split -a 4 -b 50k -d $< Pnoc
for f in $$(ls Pnoc????); do mv $$f $$f.bin; done
pace_gen.c pace_gen.h: ./gen_pace.pl funcfile.txt
rm -f $@ _dirList
./gen_pace.pl -func funcfile.txt \
-file $(PALMDIR)/Core/UI \
-file $(PALMDIR)/Core/System \
-file $(PALMDIR)/Extensions/ExpansionMgr \
-file $(PALMDIR)/Extensions/Bluetooth \
-file /usr/local/share/palmdev/Handspring5/68K/System \
-oc pace_gen.c -oh pace_gen.h $(GENDEFS)
rm -f _dirList
clean:
rm -rf $(OBJS) pace_gen.c pace_gen.h *.bin Pnoc_bin.pre

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

View file

@ -1,7 +0,0 @@
###-####
##--####
#------#
########
#------#
####--##
####-###

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

View file

@ -1,7 +0,0 @@
###-####
##--####
#------#
########
########
########
########

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

View file

@ -1,7 +0,0 @@
########
##-##-##
##-##-##
###--###
##-##-##
##-##-##
########

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

View file

@ -1,7 +0,0 @@
########
########
########
########
#------#
####--##
####-###

View file

@ -1,9 +0,0 @@
---------
----#----
----#----
----#----
-#######-
--#####--
---###---
----#----
---------

View file

@ -1,18 +0,0 @@
------------------
------------------
--------##--------
--------##--------
--------##--------
--------##--------
--------##--------
--------##--------
-################-
--##############--
---############---
----##########----
-----########-----
------######------
-------####-------
--------##--------
------------------
------------------

View file

@ -1,8 +0,0 @@
########
#-######
#--#####
#---####
#----###
#-----##
#------#
########

View file

@ -1,16 +0,0 @@
################
#-##############
#--#############
#---############
#----###########
#-----##########
#------#########
#-------########
#--------#######
#---------######
#----------#####
#-----------####
#------------###
#-------------##
#--------------#
################

View file

@ -1,11 +0,0 @@
-######-
###--###
##-##-##
#-####-#
#-####-#
##-##-##
##-##-##
###--###
###--###
###--###
-######-

View file

@ -1,23 +0,0 @@
--############--
-##############-
######----######
#####--##--#####
####--####--####
###--######--###
##--##-#####--##
##--###-####--##
##--##-#####--##
##--########--##
###--######--###
####--####--####
####--####--####
####--####--####
#####------#####
######-#--######
######--#-######
######----######
######-#--######
######--#-######
-######--######-
--############--

View file

@ -1,9 +0,0 @@
---------
----#----
----##---
----###--
-#######-
----###--
----##---
----#----
---------

View file

@ -1,18 +0,0 @@
------------------
--------#---------
--------##--------
--------###-------
--------####------
--------#####-----
--------######----
--------#######---
--##############--
--##############--
--------#######---
--------######----
--------#####-----
--------####------
--------###-------
--------##--------
--------#---------
------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

View file

@ -1,12 +0,0 @@
-######-
########
#------#
#------#
###--###
###--###
###--###
###--###
###--###
###--###
########
-######-

View file

@ -1,8 +0,0 @@
--------
-##---##
-###-###
--#####-
---###--
--#####-
-###-###
-##---##

View file

@ -1,16 +0,0 @@
----------------
----------------
--###--------###
--####------####
--#####----#####
---#####--#####-
----##########--
-----########---
------######----
------######----
-----########---
----##########--
---#####--#####-
--#####----#####
--####------####
--###--------###

View file

@ -1,20 +0,0 @@
------------------
---#############--
-#################
-##-###-#######-##
-##-###-#######-##
-##-###-#######-##
-##-----#######-##
-##-###-###-###-##
-##-###-###-###-##
-##-###-####---###
-#################
-##-----###----###
-####-#####-###-##
-####-#####-###-##
-####-#####-###-##
-####-#####-###-##
-####-#####-###-##
-####-#####----###
-#################
---#############--

View file

@ -1,32 +0,0 @@
----------------------------------
-################################-
##################################
####--######--##############--####
####--######--##############--####
####--######--##############--####
####--######--##############--####
####--######--##############--####
####--######--##############--####
####----------##############--####
####--######--##############--####
####--######--######--######--####
####--######--######--######--####
####--######--######--######--####
####--######--#######--####--#####
####--######--########------######
##################################
##################################
####----------######--------######
########--##########--#####--#####
########--##########--######--####
########--##########--######--####
########--##########--######--####
########--##########--######--####
########--##########--######--####
########--##########--######--####
########--##########--######--####
########--##########--######--####
########--##########--#####--#####
########--##########--------######
##################################
-###############################-

View file

@ -1,10 +0,0 @@
########
#--###-#
##-##-##
#---#-##
####-###
###-#-##
##-#-#-#
##-#---#
#-##-#-#
########

View file

@ -1,21 +0,0 @@
################
##############-#
####-#########-#
###--########-##
####-########-##
####-#######-###
####-######-####
####-#####-#####
####-####-######
###---##-#######
#######-##--####
######-##-##-###
#####-##-####-##
####-###-####-##
###-####------##
##-#####-####-##
##-#####-####-##
#-######-####-##
#-##############
################

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

View file

@ -1,22 +0,0 @@
-############---------
#------------#--------
#-#----#-----#--------
#-#----#-----#--------
#--#--#------#--------
#--#--#------#--------
#---##-------#--------
#--#--#------#--------
#--#--#--############-
#-#----##------------#
#-#----##-#-----#----#
#-------#-#-----#----#
#-------#-#-----#----#
-########-#--#--#----#
--------#-#--#--#----#
--------#-#--#--#----#
--------#--#-#-#--#--#
--------#---#-#--##--#
--------#-------#-#--#
--------#-------####-#
--------#---------#--#
---------############-

View file

@ -1,9 +0,0 @@
---#########---
---#-------#---
---#--###--#---
---#-#-----#---
---#-#-----#---
---#-#-----#---
---#--###--#---
---#-------#---
---#########---

View file

@ -1,27 +0,0 @@
/* copied from _Palm Programming_ p. 79*/
#ifndef __CALLBACK__
#define __CALLBACK__
#if defined MW_COMPILER
/* these are no-ops for MW as I understand it */
# define CALLBACK_PROLOGUE()
# define CALLBACK_EPILOGUE()
#elif defined XW_TARGET_PNO || defined XW_TARGET_X86
#define CALLBACK_PROLOGUE()
#define CALLBACK_EPILOGUE()
#else
register void *reg_a4 asm("%a4");
#define CALLBACK_PROLOGUE() \
{ void* __save_a4 = reg_a4; asm("move.l %%a5,%%a4; sub.l #edata,%%a4" : :);
#define CALLBACK_EPILOGUE() reg_a4 = __save_a4;}
#endif /* MW_COMPILER */
#endif

View file

@ -1,270 +0,0 @@
/* -*-mode: c; fill-column: 78; compile-command: "make ARCH=68K_ONLY MEMDEBUG=TRUE"; -*- */
/*****************************************************************************
* Copyright 1999 - 2001 by Eric House. 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.
*
* These resources are shared among all localized verions of XW4; no
* localization required.
****************************************************************************/
#ifdef COLOR_SUPPORT
/* colors */
HEX "Clrs" ID 1000
0x00 0x00 0x00 /* black */
0xFF 0xFF 0xFF /* white */
0x00 0x00 0x00 /* player 1 */
0xFF 0x00 0x00
0x00 0x00 0xFF
0x00 0xFF 0x00
0xAF 0xAF 0x00 /* bonus 1 */
0x00 0xAF 0xAF
0xAF 0x00 0xAF
0xAF 0xAF 0xAF
0xFF 0xFF 0xFF /* empty cells */
0xFF 0xFF 0x99 /* tile background */
#endif
ICONFAMILY "./bmps/xwbandwicon.bmp" "" "" "./bmps/xwcoloricon.bmp" TRANSPARENT 255 255 255
SMALLICONFAMILY "bmps/xwbandwicon_sm.bmp" "" "" "./bmps/xwcoloricon_sm.bmp" TRANSPARENT 255 255 255
BITMAP ID SHOWTRAY_BUTTON_BMP_RES_ID "bmps/showtray.pbitm" AUTOCOMPRESS
BITMAP ID DOWN_ARROW_RESID AUTOCOMPRESS
BEGIN
BITMAP "bmps/downarrow.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/downarrowhd.pbitm" BPP 1 DENSITY 144
END
BITMAP ID RIGHT_ARROW_RESID AUTOCOMPRESS
BEGIN
BITMAP "bmps/rightarrow.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/rightarrowhd.pbitm" BPP 1 DENSITY 144
END
/* bitmap family for inclding highres version */
BITMAP ID TRAY_BUTTONS_BMP_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/traybuttons.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/traybuttonshd.pbitm" BPP 1 DENSITY 144
END
BITMAP ID STAR_BMP_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/startmark.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/startmarkhd.pbitm" BPP 1 DENSITY 144
END
BITMAP ID FLIP_BUTTON_BMP_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/flipbutton.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/flipbuttonhd.pbitm" BPP 1 DENSITY 144
END
BITMAP ID HINT_BUTTON_BMP_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/lightbulb.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/lightbulbhd.pbitm" BPP 1 DENSITY 144
END
BITMAP ID VALUE_BUTTON_BMP_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/valuebutton.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/valuebuttonhd.pbitm" BPP 1 DENSITY 144
END
#ifdef XWFEATURE_BLUETOOTH
BITMAP ID BTSTATUS_NONE_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/bts_off.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/bts_off.bmp" BPP 8 DENSITY 144
END
BITMAP ID BTSTATUS_LISTENING_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/bts_listen.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/bts_listen.bmp" BPP 8 DENSITY 144
END
BITMAP ID BTSTATUS_SEEKING_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/bts_seek.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/bts_seek.bmp" BPP 8 DENSITY 144
END
BITMAP ID BTSTATUS_CONNECTED_RES_ID AUTOCOMPRESS
BEGIN
BITMAP "bmps/bts_conn.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/bts_conn.bmp" BPP 8 DENSITY 144
END
#endif /* XWFEATURE_BLUETOOTH */
#ifdef XWFEATURE_RELAY
BITMAP ID RELAYSTATUS_NONE_RESID AUTOCOMPRESS
BEGIN
BITMAP "bmps/bts_off.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/rls_off.bmp" BPP 8 DENSITY 144
END
BITMAP ID RELAYSTATUS_PENDING_RESID AUTOCOMPRESS
BEGIN
BITMAP "bmps/bts_listen.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/rls_pending.bmp" BPP 8 DENSITY 144
END
BITMAP ID RELAYSTATUS_CONN_RESID AUTOCOMPRESS
BEGIN
BITMAP "bmps/bts_seek.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/rls_meconn.bmp" BPP 8 DENSITY 144
END
BITMAP ID RELAYSTATUS_ALLCONN_RESID AUTOCOMPRESS
BEGIN
BITMAP "bmps/bts_conn.pbitm" BPP 1 DENSITY 72
BITMAP "bmps/rls_allconn.bmp" BPP 8 DENSITY 144
END
#endif
#define TBH TRAY_BUTTON_HEIGHT_HR
#define TBY TRAY_BUTTONS_Y_HR
FORM ID XW_MAIN_FORM AT (0 0 160 160)
USABLE
NOFRAME
MENUID XW_MAIN_MENU_ID
BEGIN
#ifdef XWFEATURE_FIVEWAY
GADGET ID XW_SCOREBOARD_GADGET_ID AT (0 0 1 1) USABLE
GADGET ID XW_BOARD_GADGET_ID AT (0 0 1 1) USABLE
GADGET ID XW_TRAY_GADGET_ID AT (0 0 1 1) USABLE
#endif
BUTTON "" XW_MAIN_FLIP_BUTTON_ID
AT (PALM_FLIP_LEFT PALM_BOARD_TOP FLIP_BUTTON_WIDTH
FLIP_BUTTON_HEIGHT) NOFRAME
BUTTON "" XW_MAIN_VALUE_BUTTON_ID
AT (PALM_FLIP_LEFT PREVBOTTOM+2
FLIP_BUTTON_WIDTH FLIP_BUTTON_HEIGHT+2) NOFRAME
BUTTON "" XW_MAIN_HINT_BUTTON_ID
AT (PALM_FLIP_LEFT PREVBOTTOM+2 FLIP_BUTTON_WIDTH
FLIP_BUTTON_HEIGHT+3) NOFRAME
SCROLLBAR ID XW_MAIN_SCROLLBAR_ID
AT ( PREVLEFT PREVBOTTOM+5 RECOMMENDED_SBAR_WIDTH
160-TRAY_HEIGHT_HR-PREVBOTTOM-IR_STATUS_HEIGHT-5)
USABLE VALUE SBAR_START_VALUE MIN SBAR_MIN MAX SBAR_MIN
PAGESIZE SBAR_PAGESIZE
#if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY
GADGET ID XW_NETSTATUS_GADGET_ID AT (PALM_FLIP_LEFT PREVBOTTOM+4 16 15)
NONUSABLE
#endif
BUTTON "" XW_MAIN_SHOWTRAY_BUTTON_ID
AT (PALM_FLIP_LEFT SHOWTRAY_BUTTON_Y
FLIP_BUTTON_WIDTH FLIP_BUTTON_WIDTH+4) NOFRAME
#ifndef EIGHT_TILES
BUTTON "" XW_MAIN_HIDE_BUTTON_ID
AT(PALM_TRAY_BUTTON_LEFT TBY TRAY_BUTTON_WIDTH TBH) NOFRAME
BUTTON "" XW_MAIN_JUGGLE_BUTTON_ID
AT(PREVRIGHT PREVTOP TRAY_BUTTON_WIDTH TBH) NOFRAME
BUTTON "" XW_MAIN_TRADE_BUTTON_ID
AT(PALM_TRAY_BUTTON_LEFT PREVBOTTOM TRAY_BUTTON_WIDTH
TBH) NOFRAME
BUTTON "" XW_MAIN_DONE_BUTTON_ID
AT(PREVRIGHT PREVTOP TRAY_BUTTON_WIDTH TBH) NOFRAME
#endif
#ifdef FOR_GREMLINS
GADGET GREMLIN_BOARD_GADGET_IDAUTOID AT ( 0 5 152 135 )
GADGET GREMLIN_TRAY_GADGET_IDAUTOID AT ( 0 140 145 20 )
#endif
END /* XW_MAIN_FORM */
#ifdef XWFEATURE_FIVEWAY
NAVIGATION ID XW_MAIN_FORM
INITIALSTATE kFrmNavHeaderFlagsObjectFocusStartState
/* INITIALOBJECTID: the OS arbitrarily sends a focusTake event for some button
* on opening the form if this isn't set, otherwise it sends for this. That's
* easier to test for and drop, so set it is. */
INITIALOBJECTID XW_SCOREBOARD_GADGET_ID
NAVIGATIONMAP
ROW XW_SCOREBOARD_GADGET_ID
ROW XW_BOARD_GADGET_ID
XW_MAIN_FLIP_BUTTON_ID
XW_MAIN_VALUE_BUTTON_ID
XW_MAIN_HINT_BUTTON_ID
ROW XW_TRAY_GADGET_ID
XW_MAIN_SHOWTRAY_BUTTON_ID
XW_MAIN_HIDE_BUTTON_ID
XW_MAIN_JUGGLE_BUTTON_ID
XW_MAIN_TRADE_BUTTON_ID
XW_MAIN_DONE_BUTTON_ID
END
NAVIGATION ID XW_PASSWORD_DIALOG_ID
INITIALSTATE kFrmNavHeaderFlagsObjectFocusStartState
INITIALOBJECTID XW_PASSWORD_PASS_FIELD
NAVIGATIONMAP
ROW XW_PASSWORD_PASS_FIELD
ROW XW_PASSWORD_OK_BUTTON XW_PASSWORD_CANCEL_BUTTON
END
#endif
STRING ID 1000 "/palm/programs/Crosswords/"
APPLICATIONICONNAME ID 1000 ICONTEXT
/* force hotsync into games category */
LAUNCHERCATEGORY ID 1000 "Games"
HEX "Xbrd" ID 1000
#if 1 /* the "scrabble" pattern */
0x40 0x01 0x00 0x04
0x02 0x00 0x03 0x00
0x00 0x20 0x00 0x10
0x10 0x02 0x00 0x01
0x00 0x00 0x20 0x00
0x03 0x00 0x03 0x00
0x00 0x10 0x00 0x10
0x40 0x01 0x00 0x02
#else
0x04 0x00 0x10 0x04
0x40 0x00 0x03 0x00
0x00 0x00 0x20 0x10
0x00 0x03 0x00 0x01
0x10 0x20 0x00 0x30
0x03 0x00 0x01 0x00
0x00 0x10 0x30 0x00
0x40 0x01 0x00 0x02
#endif
/* for 13x13 board */
HEX "Xbrd" ID 1001 /* This is 7x7, so one line is two rows */
0x20 0x03 0x00 0x30 0x40 0x00 0x10
0x00 0x10 0x00 0x03 0x00 0x30 0x00
0x00 0x00 0x10 0x00 0x10 0x00 0x30
0x30 0x00 0x00 0x20
/* for 11x11 board */
HEX "Xbrd" ID 1002 /* This is 6x6 */
0x04 0x00 0x03
0x40 0x03 0x00
0x00 0x10 0x01
0x03 0x01 0x00
0x00 0x00 0x30
0x30 0x10 0x02
VERSION ID 1000 XW_PALM_VERSION_STRING

View file

@ -1,397 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; compile-command: "make ARCH=ARM_ONLY MEMDEBUG=TRUE"; -*- */
/*
* Copyright 2003-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.
*/
#if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY
#include <NetMgr.h>
#include "callback.h"
#include "connsdlg.h"
#include "strutils.h"
#include "palmmain.h"
#include "palmutil.h"
#include "palmir.h"
#include "palmbt.h"
#include "LocalizedStrIncludes.h"
/* When user pops up via Host gadget, we want to get the port to listen on.
* When pops up via the Guest gadget, we want to get the port and IP address
* of the host AS WELL AS the local port that we'll tell it we're listening
* on. We need local state for both, since user can switch between them and
* expect state to live as long as the parent dialog isn't exited.
*/
typedef struct XportEntry {
XP_U16 resID;
CommsConnType conType;
} XportEntry;
#define MAX_XPORTS 3
typedef struct ConnsDlgState {
ListPtr connTypesList;
ListData sLd;
XportEntry xports[MAX_XPORTS];
XP_U16 nXports;
XP_U16 serverRole;
XP_Bool isNewGame;
CommsConnType conType;
CommsAddrRec* addr;
XP_BtAddr btAddr; /* since there's no field, save it here */
#ifdef XWFEATURE_BLUETOOTH
char hostName[PALM_BT_NAME_LEN];
#endif
} ConnsDlgState;
static void
ctlsFromState( PalmAppGlobals* globals )
{
ConnsDlgState* state = globals->connState;
CommsAddrRec* addr = state->addr;
XP_Bool isNewGame = state->isNewGame;
state->conType = addr->conType;
if ( 0 ) {
#ifdef XWFEATURE_RELAY
} else if ( addr->conType == COMMS_CONN_RELAY ) {
XP_UCHAR buf[16];
setFieldStr( XW_CONNS_RELAY_FIELD_ID, addr->u.ip_relay.hostName );
setFieldEditable( XW_CONNS_RELAY_FIELD_ID, isNewGame );
StrPrintF( buf, "%d", addr->u.ip_relay.port );
setFieldStr( XW_CONNS_PORT_FIELD_ID, buf );
setFieldEditable( XW_CONNS_PORT_FIELD_ID, isNewGame );
setFieldStr( XW_CONNS_INVITE_FIELD_ID, addr->u.ip_relay.invite );
setFieldEditable( XW_CONNS_INVITE_FIELD_ID, isNewGame );
#endif
#ifdef XWFEATURE_BLUETOOTH
} else if ( addr->conType == COMMS_CONN_BT
/* It's ok to load the controls even if we won't use them */
/* && state->serverRole == SERVER_ISCLIENT */ ) {
ControlPtr ctrl = getActiveObjectPtr( XW_CONNS_BT_HOSTTRIGGER_ID );
XP_MEMCPY( &state->btAddr, &state->addr->u.bt.btAddr,
sizeof(state->btAddr) );
XP_MEMCPY( &state->hostName, &state->addr->u.bt.hostName,
sizeof(state->hostName) );
if ( '\0' != addr->u.bt.hostName[0] ) {
CtlSetLabel( ctrl, state->hostName );
}
CtlSetEnabled( ctrl, isNewGame );
#endif
}
#ifdef XWFEATURE_BLUETOOTH
/* Set up any controls that are not based on union fields regardless of
conType, as user may change and we want the defaults to be right.
This is a case where using a union breaks down: it'd be better to have
access to all the defaults, but they may be corrupt if conType is
wrong. */
XP_ASSERT( !!globals->prefsDlgState );
setBooleanCtrl( XW_CONNS_BTCONFIRM_CHECKBOX_ID,
globals->prefsDlgState->confirmBTConnect );
#endif
} /* ctlsFromState */
static XP_Bool
stateFromCtls( PalmAppGlobals* globals, XP_Bool* prefsChanged )
{
ConnsDlgState* state = globals->connState;
CommsAddrRec addr;
XP_Bool addrOk;
*prefsChanged = XP_FALSE;
XP_MEMCPY( &addr, state->addr, sizeof(addr) );
addr.conType = state->conType;
if ( 0 ) {
#ifdef XWFEATURE_RELAY
} else if ( addr.conType == COMMS_CONN_RELAY ) {
XP_UCHAR buf[16];
getFieldStr( XW_CONNS_RELAY_FIELD_ID, addr.u.ip_relay.hostName,
sizeof(addr.u.ip_relay.hostName) );
getFieldStr( XW_CONNS_PORT_FIELD_ID, buf, sizeof(buf) );
addr.u.ip_relay.port = StrAToI( buf );
getFieldStr( XW_CONNS_INVITE_FIELD_ID, addr.u.ip_relay.invite,
sizeof(addr.u.ip_relay.invite) );
#endif
#ifdef XWFEATURE_BLUETOOTH
} else if ( addr.conType == COMMS_CONN_BT
&& state->serverRole == SERVER_ISCLIENT ) {
XP_Bool confirmBTConnect;
/* Not exactly from a control... */
/* POSE is flagging this as reading from a bad address, but it
looks ok inside the debugger */
XP_MEMCPY( addr.u.bt.hostName, state->hostName,
sizeof(addr.u.bt.hostName) );
XP_MEMCPY( &addr.u.bt.btAddr, &state->btAddr,
sizeof(addr.u.bt.btAddr) );
LOG_HEX( &addr.u.bt.btAddr, sizeof(addr.u.bt.btAddr), __func__ );
confirmBTConnect = getBooleanCtrl( XW_CONNS_BTCONFIRM_CHECKBOX_ID );
XP_ASSERT( !!globals->prefsDlgState );
if ( confirmBTConnect != globals->prefsDlgState->confirmBTConnect ) {
globals->prefsDlgState->confirmBTConnect = confirmBTConnect;
*prefsChanged = XP_TRUE;
}
#endif
}
addrOk = comms_checkAddr( state->serverRole, &addr, &globals->util );
if ( addrOk ) {
XP_MEMCPY( state->addr, &addr, sizeof( *state->addr) );
}
return addrOk;
} /* stateFromCtls */
static void
updateFormCtls( FormPtr form, ConnsDlgState* state )
{
const XP_U16 relayCtls[] = {
#ifdef XWFEATURE_RELAY
XW_CONNS_RELAY_LABEL_ID,
XW_CONNS_RELAY_FIELD_ID,
XW_CONNS_PORT_LABEL_ID,
XW_CONNS_PORT_FIELD_ID,
XW_CONNS_INVITE_LABEL_ID,
XW_CONNS_INVITE_FIELD_ID,
#endif
0
};
const XP_U16 btGuestCtls[] = {
#ifdef XWFEATURE_BLUETOOTH
XW_CONNS_BT_HOSTNAME_LABEL_ID,
XW_CONNS_BT_HOSTTRIGGER_ID,
XW_CONNS_BTCONFIRM_CHECKBOX_ID,
#endif
0
};
const XP_U16* allCtls[] = {
relayCtls, btGuestCtls
};
const XP_U16* on;
XP_U16 i;
if ( state->conType == COMMS_CONN_RELAY ) {
on = relayCtls;
} else if ( state->conType == COMMS_CONN_BT
#ifdef XWFEATURE_BLUETOOTH
&& state->serverRole == SERVER_ISCLIENT
#endif
) {
on = btGuestCtls;
} else {
on = NULL;
}
for ( i = 0; i < VSIZE(allCtls); ++i ) {
const XP_U16* cur = allCtls[i];
if ( cur != on ) {
disOrEnableSet( form, cur, XP_FALSE );
}
}
if ( on != NULL ) {
disOrEnableSet( form, on, XP_TRUE );
}
} /* updateFormCtls */
static CommsConnType
selToConType( const ConnsDlgState* state, XP_U16 sel )
{
XP_ASSERT( sel < state->nXports );
return state->xports[sel].conType;
} /* selToConType */
#ifdef XWFEATURE_BLUETOOTH
static void
browseForDeviceName( PalmAppGlobals* globals )
{
ConnsDlgState* state = globals->connState;
XP_BtAddr btAddr;
if ( palm_bt_browse_device( globals, &btAddr,
state->hostName, sizeof(state->hostName) ) ) {
CtlSetLabel( getActiveObjectPtr( XW_CONNS_BT_HOSTTRIGGER_ID ),
state->hostName );
XP_MEMCPY( &state->btAddr, &btAddr, sizeof(state->btAddr) );
LOG_HEX( &state->btAddr, sizeof(state->btAddr), __func__ );
}
} /* browseForDeviceName */
#endif
static void
setupXportList( PalmAppGlobals* globals )
{
ConnsDlgState* state = globals->connState;
ListData* sLd = &state->sLd;
XP_U16 ii;
XP_S16 selSel = -1;
const XP_UCHAR* selName = NULL;
XP_ASSERT( state->nXports >= 1 );
state->connTypesList = getActiveObjectPtr( XW_CONNS_TYPE_LIST_ID );
initListData( MPPARM(globals->mpool) sLd, state->nXports );
for ( ii = 0; ii < state->nXports; ++ii ) {
XportEntry* xports = &state->xports[ii];
const XP_UCHAR* xname = getResString( globals, xports->resID );
addListTextItem( MPPARM(globals->mpool) sLd, xname );
if ( state->conType == xports->conType ) {
selName = xname;
selSel = ii;
}
}
XP_ASSERT( !!selName );
setListSelection( sLd, selName );
setListChoices( sLd, state->connTypesList, NULL );
setSelectorFromList( XW_CONNS_TYPE_TRIGGER_ID, state->connTypesList,
selSel );
} /* setupXportList */
static void
buildXportData( ConnsDlgState* state )
{
XportEntry* xports = state->xports;
XP_ASSERT( 0 == state->nXports );
#ifdef XWFEATURE_IR
xports->conType = COMMS_CONN_IR;
xports->resID = STR_IR_XPORTNAME;
++xports;
#endif
#ifdef XWFEATURE_BLUETOOTH
xports->conType = COMMS_CONN_BT;
xports->resID = STR_BT_XPORTNAME;
++xports;
#endif
#ifdef XWFEATURE_RELAY
xports->conType = COMMS_CONN_RELAY;
xports->resID = STR_RELAY_XPORTNAME;
++xports;
#endif
state->nXports = xports - state->xports;
} /* buildXportData */
Boolean
ConnsFormHandleEvent( EventPtr event )
{
Boolean result;
PalmAppGlobals* globals;
ConnsDlgState* state;
FormPtr form;
XP_S16 chosen;
CALLBACK_PROLOGUE();
globals = getFormRefcon();
state = globals->connState;
if ( !state ) {
state = globals->connState = XP_MALLOC( globals->mpool,
sizeof(*state) );
XP_MEMSET( state, 0, sizeof(*state) );
}
form = FrmGetActiveForm();
switch ( event->eType ) {
case frmOpenEvent:
state->serverRole =
(DeviceRole)globals->dlgParams[CONNS_PARAM_ROLE_INDEX];
state->addr =
(CommsAddrRec*)globals->dlgParams[CONNS_PARAM_ADDR_INDEX];
state->isNewGame = globals->isNewGame;
ctlsFromState( globals );
/* setup connection popup */
buildXportData( state );
setupXportList( globals );
updateFormCtls( form, state );
case frmUpdateEvent:
FrmDrawForm( form );
result = true;
break;
case ctlSelectEvent:
result = true;
switch ( event->data.ctlSelect.controlID ) {
#ifdef XWFEATURE_BLUETOOTH
case XW_CONNS_BT_HOSTTRIGGER_ID:
if ( state->isNewGame ) {
browseForDeviceName( globals );
}
break;
#endif
case XW_CONNS_TYPE_TRIGGER_ID:
if ( state->isNewGame ) {
chosen = LstPopupList( state->connTypesList );
if ( chosen >= 0 ) {
setSelectorFromList( XW_CONNS_TYPE_TRIGGER_ID,
state->connTypesList, chosen );
state->conType = selToConType( state, chosen );
updateFormCtls( form, state );
}
}
break;
case XW_CONNS_OK_BUTTON_ID:
if ( !state->isNewGame ) {
/* do nothing; same as cancel */
} else {
XP_Bool prefsChanged;
if ( !stateFromCtls( globals, &prefsChanged ) ) {
break; /* refuse to exit */
}
if ( prefsChanged ) {
postEmptyEvent( prefsChangedEvent );
}
}
/* FALLTHRU */
case XW_CONNS_CANCEL_BUTTON_ID:
freeListData( MPPARM(globals->mpool) &globals->connState->sLd );
XP_FREE( globals->mpool, globals->connState );
globals->connState = NULL;
FrmReturnToForm( 0 );
break;
}
break;
default:
result = false;
}
CALLBACK_EPILOGUE();
return result;
} /* ConnsFormHandleEvent */
#endif /* #if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY */

View file

@ -1,37 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/*
* Copyright 2003 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 _CONNSDLG_H_
#define _CONNSDLG_H_
#include <Event.h>
Boolean ConnsFormHandleEvent( EventPtr event );
#define CONNS_PARAM_ROLE_INDEX 0
#define CONNS_PARAM_ADDR_INDEX 1
#define PopupConnsForm( g, h, addrP ) { \
(g)->dlgParams[CONNS_PARAM_ROLE_INDEX] = (XP_U32)(h); \
(g)->dlgParams[CONNS_PARAM_ADDR_INDEX] = (XP_U32)(addrP); \
FrmPopupForm( XW_CONNS_FORM ); \
}
#endif

View file

@ -1,600 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/****************************************************************************
*
* Copyright 1999 - 2003 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 <PalmTypes.h>
#include <Form.h>
#include <VFSMgr.h>
#include <FeatureMgr.h>
#include "callback.h"
#include "dictlist.h"
#include "palmmain.h"
#include "palmutil.h"
#include "palmdict.h"
#include "strutils.h"
#include "xwords4defines.h"
#include "LocalizedStrIncludes.h"
#define TYPE_DAWG 'DAWG'
#ifdef NODE_CAN_4
# define TYPE_XWRDICT 'XwrD'
#else
# define TYPE_XWRDICT 'Xwr3'
#endif
//////////////////////////////////////////////////////////////////////////////
// typedef and #defines
//////////////////////////////////////////////////////////////////////////////
struct PalmDictList {
XP_U16 nDicts;
DictListEntry dictArray[1];
};
//////////////////////////////////////////////////////////////////////////////
// Prototypes
//////////////////////////////////////////////////////////////////////////////
static PalmDictList* dictListMakePriv( MPFORMAL XP_U32 creatorSought,
XP_U16 versSought );
XP_Bool
getNthDict( const PalmDictList* dl, short n, DictListEntry** dle )
{
XP_Bool exists = !!dl && (dl->nDicts > n);
if ( exists ) {
*dle = (DictListEntry*)&dl->dictArray[n];
}
return exists;
} /* getNthDict */
XP_Bool
getDictWithName( const PalmDictList* dl, const XP_UCHAR* name,
DictListEntry** dlep )
{
XP_Bool result = XP_FALSE;
if ( !!dl ) {
XP_U16 i;
XP_UCHAR* extName;
XP_UCHAR oldChName = '\0'; /* shut compiler up */
DictListEntry* dle = (DictListEntry*)dl->dictArray;
extName = (XP_UCHAR*)StrStr((const char*)name,
(const char*)".pdb" );
if ( !!extName ) {
oldChName = *extName;
*extName = '\0';
}
for ( i = 0; !result && i < dl->nDicts; ++i ) {
XP_UCHAR* extCand;
XP_UCHAR oldChCand = '\0';
extCand = (XP_UCHAR*)StrStr((const char*)dle->baseName, ".pdb" );
if ( !!extCand ) {
oldChCand = *extCand;
*extCand = '\0';
}
if ( 0 == XP_STRCMP( (const char*)name,
(const char*)dle->baseName ) ) {
*dlep = dle;
result = XP_TRUE;
}
if ( !!extCand ) {
*extCand = oldChCand;
}
++dle;
}
if ( !!extName ) {
*extName = oldChName;
}
}
return result;
} /* getDictWithName */
void
cacheDictForName( PalmDictList* dl, const XP_UCHAR* dictName,
DictionaryCtxt* dict )
{
DictListEntry* dle;
(void)getDictWithName(dl, dictName, &dle );
XP_ASSERT( getDictWithName(dl, dictName, &dle ) );
XP_ASSERT( !dle->dict );
dle->dict = dict;
} /* cacheDictForName */
void
removeFromDictCache( PalmDictList* dl, XP_UCHAR* dictName )
{
DictListEntry* dle;
(void)getDictWithName( dl, dictName, &dle );
XP_ASSERT( getDictWithName( dl, dictName, &dle ) );
XP_ASSERT( !!dle->dict );
dle->dict = NULL;
} /* removeFromDictCache */
static XP_Bool
addEntry( MPFORMAL PalmDictList** dlp, DictListEntry* dle )
{
XP_Bool isNew;
PalmDictList* dl = *dlp;
DictListEntry* ignore;
if ( !dl ) {
dl = (PalmDictList*)XP_MALLOC( mpool, sizeof(*dl) );
XP_MEMSET( dl, 0, sizeof(*dl) );
}
isNew = !getDictWithName( dl, dle->baseName, &ignore );
if ( isNew ) {
XP_U16 size = sizeof(*dl);
size += dl->nDicts * sizeof( dl->dictArray[0] );
dl = (PalmDictList*)XP_REALLOC( mpool, (XP_U8*)dl, size );
dle->dict = NULL;
XP_MEMCPY( &dl->dictArray[dl->nDicts++], dle,
sizeof( dl->dictArray[0] ) );
}
*dlp = dl;
return isNew;
} /* addEntry */
static void
searchDir( MPFORMAL PalmDictList** dlp, UInt16 volNum,
unsigned char XP_UNUSED(separator),
unsigned char* path, XP_U16 pathSize, XP_U32 creatorSought,
XP_U16 versSought )
{
Err err;
FileRef dirRef;
XP_U16 pathLen = XP_STRLEN( (const char*)path );
err = VFSFileOpen( volNum, (const char*)path, vfsModeRead, &dirRef );
if ( err == errNone ) {
UInt32 dEnum = vfsIteratorStart;
FileInfoType fit;
fit.nameP = (char*)path + pathLen;
while ( dEnum != vfsIteratorStop ) {
XP_UCHAR* ext;
fit.nameBufLen = pathSize - pathLen;
err = VFSDirEntryEnumerate( dirRef, &dEnum, &fit );
if ( err != errNone ) {
break;
}
if ( (fit.attributes & vfsFileAttrDirectory) != 0 ) {
#ifdef RECURSIVE_VFS_SEARCH
XP_U16 len = XP_STRLEN((const char*)path);
path[len] = separator;
path[len+1] = '\0';
searchDir( MPPARM(mpool) dlp, volNum, separator,
path, pathSize, creatorSought, versSought );
#endif
} else if ( (ext = (XP_UCHAR*)StrStr( (const char*)path, ".pdb" ))
!= NULL ) {
/* find out if it's a crosswords dict. */
FileRef fileRef;
UInt32 type, creator;
err = VFSFileOpen( volNum, (const char*)path, vfsModeRead,
&fileRef );
if ( err == errNone ) {
XP_U16 vers;
err = VFSFileDBInfo( fileRef, NULL, /* name */
NULL, /* attributes */
&vers, /* versionP */
NULL, /* crDateP */
NULL, NULL, /*UInt32 *modDateP, UInt32 *bckUpDateP,*/
NULL, NULL, /*UInt32 *modNumP, MemHandle *appInfoHP,*/
NULL, /*MemHandle *sortInfoHP, */
&type, &creator,
NULL ); /* nRecords */
VFSFileClose( fileRef );
if ( (err == errNone) && (type == TYPE_DAWG) &&
(creator == creatorSought) && (vers == versSought) ) {
DictListEntry dl;
dl.path = copyString( mpool, path );
dl.location = DL_VFS;
dl.u.vfsData.volNum = volNum;
dl.baseName = dl.path + pathLen;
if ( !addEntry( MPPARM(mpool) dlp, &dl ) ) {
XP_FREE( mpool, dl.path );
}
}
}
}
}
path[pathLen] = '\0';
VFSFileClose( dirRef );
}
} /* searchDir */
static void
tryVFSSearch( MPFORMAL PalmDictList** dlp, XP_U32 creatorSought,
XP_U16 versSought )
{
Err err;
UInt16 volNum;
UInt32 vEnum;
vEnum = vfsIteratorStart;
while ( vEnum != vfsIteratorStop ) {
unsigned char pathStr[265];
MemHandle h;
UInt16 bufLen;
err = VFSVolumeEnumerate( &volNum, &vEnum );
if ( err != errNone ) {
break;
}
/* Search from the default (/palm/Launcher, normally) */
bufLen = sizeof(pathStr);
err = VFSGetDefaultDirectory( volNum, ".pdb", (char*)pathStr,
&bufLen );
if ( err == errNone ) {
searchDir( MPPARM(mpool) dlp, volNum, pathStr[0],
pathStr, sizeof(pathStr), creatorSought, versSought );
}
h = DmGetResource( 'tSTR', 1000 );
if ( !!h ) {
pathStr[0] = '\0';
XP_STRCAT( pathStr, MemHandleLock(h) );
MemHandleUnlock( h );
DmReleaseResource( h );
searchDir( MPPARM(mpool) dlp, volNum, pathStr[0],
pathStr, sizeof(pathStr), creatorSought, versSought );
}
}
} /* tryVFSSearch */
/* if we've allocated extra space in the array as an optimization now's when
* we pull back */
static void
cleanList( PalmDictList** XP_UNUSED(dl) )
{
} /* cleanList */
PalmDictList*
DictListMake( MPFORMAL_NOCOMMA )
{
return dictListMakePriv( MPPARM(mpool) TYPE_XWRDICT, 1 );
}
static PalmDictList*
dictListMakePriv( MPFORMAL XP_U32 creatorSought, XP_U16 versSought )
{
Err err;
DmSearchStateType stateType;
UInt32 vers;
PalmDictList* dl = NULL;
UInt16 cardNo;
LocalID dbID;
Boolean newSearch = true;
XP_Bool found = false;
/* first the DM case */
while ( !found ) {
err = DmGetNextDatabaseByTypeCreator( newSearch, &stateType, TYPE_DAWG,
creatorSought,
false,// onlyLatestVers,
&cardNo, &dbID );
if ( err != errNone ) {
break;
} else {
XP_UCHAR nameBuf[33];
XP_U16 nameLen;
DictListEntry dle;
XP_U16 vers;
err = DmDatabaseInfo( cardNo, dbID, (char*)nameBuf, NULL, &vers,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL );
if ( (err == errNone) && (vers == versSought) ) {
nameLen = XP_STRLEN( (const char*)nameBuf ) + 1;
dle.location = DL_STORAGE;
dle.u.dmData.cardNo = cardNo;
dle.u.dmData.dbID = dbID;
dle.path = dle.baseName = XP_MALLOC( mpool, nameLen );
XP_MEMCPY( dle.path, nameBuf, nameLen );
addEntry( MPPARM(mpool) &dl, &dle );
}
}
newSearch = false;
}
/* then the VFS case */
err = FtrGet( sysFileCVFSMgr, vfsFtrIDVersion, &vers );
if ( err == errNone ) {
tryVFSSearch( MPPARM(mpool) &dl, creatorSought, versSought );
}
cleanList( &dl );
return dl;
} /* dictListMakePriv */
void
DictListFree( MPFORMAL PalmDictList* dl )
{
if ( !!dl ) {
DictListEntry* dle = dl->dictArray;
XP_U16 i;
for ( i = 0; i < dl->nDicts; ++i, ++dle ) {
XP_FREE( mpool, dle->path );
}
XP_FREE( mpool, dl );
}
} /* dictListFree */
XP_U16
DictListCount( PalmDictList* dl )
{
XP_U16 result;
if ( !dl ) {
result = 0;
} else {
result = dl->nDicts;
}
return result;
} /* dictListCount */
#ifdef NODE_CAN_4
/*****************************************************************************
* Conversion from old Crosswords DAWG format to new. It should be possible
* for this to go away once the new format's been out for a while.
*****************************************************************************/
static XP_Bool
convertOneRecord( DmOpenRef ref, XP_U16 index )
{
XP_Bool success = XP_FALSE;
MemHandle h = DmGetRecord( ref, index );
XP_U16 siz = MemHandleSize( h );
XP_U8* recPtr;
XP_U16 i;
Err err;
XP_U16 nRecs = siz / 3;
XP_U8* tmp = MemPtrNew( siz );
XP_ASSERT( !!tmp );
XP_ASSERT( (siz % 3) == 0 );
recPtr = MemHandleLock(h);
XP_MEMCPY( tmp, recPtr, siz );
for ( i = 0; i < nRecs; ++i ) {
array_edge_old* edge = (array_edge_old*)&tmp[i * 3];
XP_U8 oldBits = edge->bits;
XP_U8 newBits = 0;
XP_ASSERT( LETTERMASK_OLD == LETTERMASK_NEW_3 );
XP_ASSERT( LASTEDGEMASK_OLD == LASTEDGEMASK_NEW );
newBits |= (oldBits & (LETTERMASK_OLD | LASTEDGEMASK_OLD) );
if ( (oldBits & ACCEPTINGMASK_OLD) != 0 ) {
newBits |= ACCEPTINGMASK_NEW;
}
if ( (oldBits & EXTRABITMASK_OLD) != 0 ) {
newBits |= EXTRABITMASK_NEW;
}
edge->bits = newBits;
}
err = DmWrite( recPtr, 0, tmp, siz );
XP_ASSERT( err == errNone );
success = err == errNone;
MemPtrFree( tmp );
MemHandleUnlock( h );
DmReleaseRecord( ref, index, true );
return success;
} /* convertOneRecord */
static XP_Bool
convertOneDict( UInt16 cardNo, LocalID dbID )
{
Err err;
UInt32 creator;
DmOpenRef ref;
MemHandle h;
dawg_header* header;
dawg_header tmp;
XP_U16 siz;
unsigned char charTableRecNum, firstEdgeRecNum;
XP_U16 nChars;
/* now modify the flags */
ref = DmOpenDatabase( cardNo, dbID, dmModeReadWrite );
XP_ASSERT( ref != 0 );
h = DmGetRecord( ref, 0 );
siz = MemHandleSize( h );
if ( siz < sizeof(*header) ) {
MemHandleResize( h, sizeof(*header) );
}
tmp.flags = XP_HTONS(0x0002);
XP_ASSERT( sizeof(tmp.flags) == 2 );
header = (dawg_header*)MemHandleLock(h);
charTableRecNum = header->charTableRecNum;
firstEdgeRecNum = header->firstEdgeRecNum;
DmWrite( header, OFFSET_OF(dawg_header,flags), &tmp.flags,
sizeof(tmp.flags) );
MemHandleUnlock(h);
DmReleaseRecord( ref, 0, true );
/* Now convert to 16-bit psuedo-unicode */
h = DmGetRecord( ref, charTableRecNum );
XP_ASSERT( !!h );
nChars = MemHandleSize( h );
err = MemHandleResize( h, nChars * 2 );
XP_ASSERT( err == errNone );
if ( err == errNone ) {
XP_U8 buf[(MAX_UNIQUE_TILES+1)*2];
XP_S16 i;
XP_U8* ptr = (XP_U8*)MemHandleLock( h );
XP_MEMSET( buf, 0, sizeof(buf) );
for ( i = 0; i < nChars; ++i ) {
buf[(i*2)+1] = ptr[i];
}
DmWrite( ptr, 0, buf, nChars * 2 );
MemHandleUnlock(h);
}
err = DmReleaseRecord( ref, charTableRecNum, true );
XP_ASSERT( err == errNone );
/* Now transpose the accepting and extra bits for every node. */
if ( err == errNone ) {
XP_U32 nRecords = DmNumRecords(ref);
XP_U16 i;
for ( i = firstEdgeRecNum; i < nRecords; ++i ) {
convertOneRecord( ref, i );
}
}
err = DmCloseDatabase( ref );
XP_ASSERT( err == errNone );
if ( err == errNone ) {
XP_U16 newVers = 1;
creator = TYPE_XWRDICT;
err = DmSetDatabaseInfo( cardNo, dbID, NULL,
NULL, &newVers, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
&creator );
XP_ASSERT( err == errNone );
}
return err == errNone;
} /* convertOneDict */
static XP_Bool
confirmDictConvert( PalmAppGlobals* globals, const XP_UCHAR* name )
{
XP_UCHAR buf[128];
const XP_UCHAR *fmt = getResString( globals, STRS_CONFIRM_ONEDICT );
XP_ASSERT( !!fmt );
XP_SNPRINTF( buf, sizeof(buf), fmt, name );
return palmask( globals, buf, NULL, -1 );
} /* confirmDictConvert */
void
offerConvertOldDicts( PalmAppGlobals* globals )
{
PalmDictList* dl = dictListMakePriv( MPPARM(globals->mpool) 'Xwr3', 0 );
XP_U16 count = DictListCount(dl);
Err err;
if ( count > 0 && palmaskFromStrId( globals, STR_CONFIRM_CONVERTDICT,
-1 ) ) {
XP_U16 i;
for ( i = 0; i < count; ++i ) {
DictListEntry* dle;
if ( getNthDict( dl, i, &dle ) ) {
if ( dle->location == DL_STORAGE ) {
if ( confirmDictConvert( globals, dle->baseName ) ) {
convertOneDict( dle->u.dmData.cardNo,
dle->u.dmData.dbID );
}
} else {
if ( confirmDictConvert( globals, dle->baseName ) ) {
UInt16 cardNo;
LocalID dbID;
UInt16 volRefNum = dle->u.vfsData.volNum;
XP_ASSERT( dle->location == DL_VFS );
XP_LOGF( "trying %s", dle->path );
/* copy from SD card to storage, convert, copy back */
err = VFSImportDatabaseFromFile( volRefNum,
(const char*)dle->path,
&cardNo, &dbID );
XP_LOGF( "VFSImportDatabaseFromFile => %d", err );
if ( err == errNone && convertOneDict( cardNo, dbID ) ) {
err = VFSFileDelete( volRefNum, dle->path );
XP_LOGF( "VFSFileDelete=>%d", err );
if ( err == errNone ) {
err = VFSExportDatabaseToFile( volRefNum,
(const char*)dle->path,
cardNo, dbID );
XP_LOGF( "VFSExportDatabaseToFile => %d", err );
XP_ASSERT( err == errNone );
err = DmDeleteDatabase( cardNo, dbID );
XP_ASSERT( err == errNone );
}
}
}
}
}
}
}
DictListFree( MPPARM(globals->mpool) dl );
} /* offerConvertOldDicts */
#endif

View file

@ -1,55 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/*
* Copyright 1999 - 2001 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 _DICTLIST_H_
#define _DICTLIST_H_
#include "palmmain.h"
#include "palmdict.h"
enum { DL_STORAGE, DL_VFS };
typedef struct DictListEntry {
XP_UCHAR* path;
XP_UCHAR* baseName; /* points into, or ==, path */
DictionaryCtxt* dict; /* cache so can refcount */
XP_UCHAR location; /* Storage RAM or VFS */
union {
struct {
UInt16 cardNo;
LocalID dbID;
} dmData;
struct {
UInt16 volNum;
} vfsData;
} u;
} DictListEntry;
PalmDictList* DictListMake( MPFORMAL_NOCOMMA );
void DictListFree( MPFORMAL PalmDictList* dl );
XP_U16 DictListCount( PalmDictList* dl );
XP_Bool getDictWithName( const PalmDictList* dl, const unsigned char* name,
DictListEntry** dle );
void cacheDictForName( PalmDictList* dl, const XP_UCHAR* dictName,
DictionaryCtxt* ctxt );
void removeFromDictCache( PalmDictList* dl, XP_UCHAR* dictName );
XP_Bool getNthDict( const PalmDictList* dl, short n, DictListEntry** dle );
#endif

View file

@ -1,286 +0,0 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/****************************************************************************
*
* Copyright 1999 - 2003 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 <PalmTypes.h>
#include <Form.h>
#include <VFSMgr.h>
#include <FeatureMgr.h>
#include "callback.h"
#include "dictui.h"
#include "palmmain.h"
#include "palmutil.h"
#include "palmdict.h"
#include "dictlist.h"
#include "strutils.h"
#include "xwords4defines.h"
#define TYPE_DAWG 'DAWG'
#define TYPE_XWR3 'Xwr3'
//////////////////////////////////////////////////////////////////////////////
// Prototypes
//////////////////////////////////////////////////////////////////////////////
static XP_U16 populateDictionaryList( MPFORMAL ListData* sLd,
const XP_UCHAR* curDictName,
ListPtr list, Int16 triggerID,
PalmDictList* dl );
static Boolean beamDict( const PalmDictList* dl, XP_UCHAR* dictName );
/*****************************************************************************
* Handler for dictionary info form.
****************************************************************************/
#define USE_POPULATE 1
Boolean
dictFormHandleEvent( EventPtr event )
{
FormPtr form;
Boolean result;
Int16 chosen;
DictionaryCtxt* dict;
PalmAppGlobals* globals;
XP_UCHAR* dictName;
CALLBACK_PROLOGUE();
result = false;
globals = getFormRefcon();
switch ( event->eType ) {
case frmOpenEvent: {
const XP_UCHAR* curName;
XP_U16 width;
RectangleType rect;
form = FrmGetActiveForm();
/* we're either a beam dlg or a dict picker; disable a button here. */
disOrEnable( form,
globals->dictuiForBeaming ?
XW_DICTINFO_DONE_BUTTON_ID:XW_DICTINFO_BEAM_BUTTON_ID,
false );
/* dictionary list setup */
globals->dictState.dictList =
getActiveObjectPtr( XW_DICTINFO_LIST_ID );
dict = !!globals->game.model?
model_getDictionary(globals->game.model) : NULL;
if ( dict ) {
curName = dict_getName( dict );
} else {
curName = NULL;
}
width = populateDictionaryList( MPPARM(globals->mpool)
&globals->dictState.sLd,
curName, globals->dictState.dictList,
XW_DICTINFO_TRIGGER_ID,
globals->dictList );
getObjectBounds( XW_DICTINFO_LIST_ID, &rect );
rect.extent.x = width;
setObjectBounds( XW_DICTINFO_LIST_ID, &rect );
FrmDrawForm( form );
break;
}
case ctlSelectEvent:
switch ( event->data.ctlEnter.controlID ) {
case XW_DICTINFO_TRIGGER_ID:
// don't let change dict except first time
if ( globals->dictuiForBeaming || globals->isNewGame ) {
chosen = LstPopupList( globals->dictState.dictList );
if ( chosen >= 0 ) {
setSelectorFromList( XW_DICTINFO_TRIGGER_ID,
globals->dictState.dictList,
chosen );
}
}
result = true;
break;
/* case XW_PHONIES_TRIGGER_ID: */
/* chosen = LstPopupList( sPhoniesList ); */
/* if ( chosen >= 0 ) { */
/* setTriggerFromList( XW_PHONIES_TRIGGER_ID, sPhoniesList, */
/* chosen ); */
/* } */
/* result = true; */
/* break; */
case XW_DICTINFO_DONE_BUTTON_ID:
case XW_DICTINFO_BEAM_BUTTON_ID:
/* discard the const */
dictName = (XP_UCHAR*)CtlGetLabel(
getActiveObjectPtr( XW_DICTINFO_TRIGGER_ID) );
if ( globals->dictuiForBeaming ) {
if ( !beamDict( globals->dictList, dictName ) ) {
break; /* don't cancel dialog yet */
}
} else {
EventType eventToPost;
XP_ASSERT( dictName != NULL );
eventToPost.eType = dictSelectedEvent;
((DictSelectedData*)&eventToPost.data.generic)->dictName
= copyString( globals->mpool, dictName );
EvtAddEventToQueue( &eventToPost );
}
case XW_DICTINFO_CANCEL_BUTTON_ID:
result = true;
freeListData( MPPARM(globals->mpool) &globals->dictState.sLd );
FrmReturnToForm( 0 );
break;
} // switch ( event->data.ctlEnter.controlID )
break;
default:
break;
} // switch
CALLBACK_EPILOGUE();
return result;
} /* dictFormHandleEvent */
/*****************************************************************************
*
****************************************************************************/
static XP_U16
populateDictionaryList( MPFORMAL ListData* sLd, const XP_UCHAR* curDictName,
ListPtr list, Int16 triggerID, PalmDictList* dl )
{
XP_U16 i;
XP_U16 maxWidth = 0;
XP_U16 nDicts;
initListData( MPPARM(mpool) sLd, 16 ); /* PENDING: MAX_DICTS or count */
nDicts = DictListCount( dl );
for ( i = 0; i < nDicts; ++i ) {
DictListEntry* dle;
XP_UCHAR* name;
XP_U16 width;
getNthDict( dl, i, &dle );
name = dle->baseName;
addListTextItem( MPPARM(mpool) sLd, name );
width = FntCharsWidth( (const char*)name, XP_STRLEN((const char*)name) );
if ( width > maxWidth ) {
maxWidth = width;
}
}
sortList( sLd );
setListSelection( sLd, (char*)curDictName );
setListChoices( sLd, list, NULL );
setSelectorFromList( triggerID, list, LstGetSelection(list) );
return maxWidth + 3; /* 3: for white space */
} /* populateDictionaryList */
/***********************************************************************
* The rest of this file mostly stolen from palmos.com. I've only modified
* beamDict
************************************************************************/
static Err
WriteDBData(const void* dataP, UInt32* sizeP, void* userDataP)
{
Err err;
/* Try to send as many bytes as were requested by the caller */
*sizeP = ExgSend((ExgSocketPtr)userDataP, (void*)dataP, *sizeP, &err);
return err;
} /* WriteDBData */
Err
sendDatabase( UInt16 cardNo, LocalID dbID, XP_UCHAR* nameP,
XP_UCHAR* descriptionP )
{
ExgSocketType exgSocket;
Err err;
/* Create exgSocket structure */
XP_MEMSET( &exgSocket, 0, sizeof(exgSocket) );
exgSocket.description = (char*)descriptionP;
exgSocket.name = (char*)nameP;
/* Start an exchange put operation */
err = ExgPut(&exgSocket);
if ( !err ) {
err = ExgDBWrite( WriteDBData, &exgSocket, NULL, dbID, cardNo );
/* Disconnect Exg and pass error */
err = ExgDisconnect(&exgSocket, err);
}
return err;
} /* sendDatabase */
static Boolean
beamDict( const PalmDictList* dl, XP_UCHAR* dictName )
{
Err err;
UInt16 cardNo;
LocalID dbID;
Boolean found;
XP_Bool shouldDispose = XP_FALSE;
DictListEntry* dle;
found = getDictWithName( dl, dictName, &dle );
/* Find our app using its internal name */
XP_ASSERT( found );
if ( found ) {
if ( dle->location == DL_VFS ) {
err = VFSImportDatabaseFromFile( dle->u.vfsData.volNum,
(const char*)dle->path,
&cardNo, &dbID );
if ( err == dmErrAlreadyExists ) {
} else if ( err == errNone ) {
shouldDispose = XP_TRUE;
} else {
found = XP_FALSE;
}
} else {
cardNo = dle->u.dmData.cardNo;
dbID = dle->u.dmData.dbID;
}
}
if ( found ) { /* send it giving external name and description */
XP_UCHAR prcName[40];
XP_SNPRINTF( prcName, sizeof(prcName), (XP_UCHAR*)"%s.pdb", dictName );
err = sendDatabase( cardNo, dbID, prcName, dictName );
found = err == 0;
if ( shouldDispose ) {
DmDeleteDatabase( cardNo, dbID );
}
}
return found;
} /* beamDict */

View file

@ -1,34 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/*
* Copyright 1999 - 2001 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 _DICTUI_H_
#define _DICTUI_H_
#include "palmmain.h"
#include "palmdict.h"
typedef struct DictSelectedData {
MemPtr dictName;
} DictSelectedData;
Boolean dictFormHandleEvent( EventPtr event );
/* export for beamBoard */
Err sendDatabase( UInt16 cardNo, LocalID dbID, XP_UCHAR* nameP,
XP_UCHAR* descriptionP );
#endif

View file

@ -1,250 +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.
*/
#include <PalmTypes.h>
#include <SystemMgr.h>
#include <PceNativeCall.h>
#include <FeatureMgr.h>
#include <StringMgr.h>
#include <Form.h>
#include <DataMgr.h>
#include "pnostate.h"
#include "palmmain.h" /* for Ftr enum */
static void
write_byte32( void* dest, UInt32 val )
{
MemMove( dest, &val, sizeof(val) );
}
static UInt32
byte_swap32( UInt32 in )
{
UInt32 tmp = 0L;
tmp |= (in & 0x000000FF) << 24;
tmp |= (in & 0x0000FF00) << 8;
tmp |= (in & 0x00FF0000) >> 8;
tmp |= (in & 0xFF000000) >> 24;
return tmp;
}
static void
alertUser( char* str )
{
(void)FrmCustomAlert( XW_ERROR_ALERT_ID,
str, " ", " " );
}
typedef struct PNOFtrHeader {
UInt32* gotTable;
} PNOFtrHeader;
void
storageCallback( void/*PnoletUserData*/* _dataP )
{
PnoletUserData* dataP = (PnoletUserData*)_dataP;
UInt32 offset;
PNOFtrHeader* ftrBase;
if ( dataP->recursive ) {
WinDrawChars( "ERROR: overwriting", 13, 5, 60 );
#ifdef DEBUG
for ( ; ; ); /* make sure we see it. :-) */
#endif
}
ftrBase = (PNOFtrHeader*)dataP->pnoletEntry;
--ftrBase; /* back up over header */
offset = (char*)dataP->stateDest - (char*)ftrBase;
DmWrite( ftrBase, offset, dataP->stateSrc, sizeof(PNOState) );
}
static void
countOrLoadPNOCs( UInt32* pnoSizeP, UInt8* base, UInt32 offset )
{
DmResID id;
for ( id = 0; ; ++id ) {
UInt32 size;
MemHandle h = DmGetResource( 'Pnoc', id );
if ( !h ) {
break;
}
size = MemHandleSize( h );
if ( !!base ) {
Err err = DmWrite( base, offset, MemHandleLock(h), size );
if ( err != errNone ) {
alertUser( "error from DmWrite" );
}
MemHandleUnlock(h);
}
DmReleaseResource(h);
offset += size;
}
if ( !!pnoSizeP ) {
*pnoSizeP = offset;
}
} /* countOrLoadPNOCs */
/* Return true if we had to load the pnolet. If we didn't, then we're being
* called recursively (probably because of ExgMgr activity); in that case the
* caller better not unload!
*/
static Boolean
setupPnolet( UInt32** entryP, UInt32** gotTableP )
{
PNOFtrHeader* ftrBase;
Err err = FtrGet( APPID, PNOLET_STORE_FEATURE, (UInt32*)&ftrBase );
XP_Bool mustLoad = err != errNone;
if ( mustLoad ) {
UInt32* gotTable;
UInt32 pnoSize, gotSize, pad;
UInt32 ftrSize = sizeof( PNOFtrHeader );
UInt32* pnoCode;
PNOFtrHeader header;
// LOAD: GOT table
MemHandle h = DmGetResource( 'Pnog', 0 );
if ( !h ) {
gotSize = 0;
gotTable = NULL;
} else {
gotSize = MemHandleSize( h );
gotTable = (UInt32*)MemPtrNew( gotSize );
MemMove( gotTable, MemHandleLock(h), gotSize );
MemHandleUnlock( h );
DmReleaseResource( h );
}
ftrSize += gotSize;
countOrLoadPNOCs( &pnoSize, NULL, 0 );
ftrSize += pnoSize;
pad = (4 - (pnoSize & 3)) & 3;
ftrSize += pad;
FtrPtrNew( APPID, PNOLET_STORE_FEATURE, ftrSize, (void**)&ftrBase );
pnoCode = (UInt32*)&ftrBase[1];
countOrLoadPNOCs( NULL, (UInt8*)ftrBase, sizeof(PNOFtrHeader) );
if ( gotSize > 0 ) {
UInt32 cnt = gotSize >> 2;
UInt32 i;
for ( i = 0; i < cnt; ++i ) {
write_byte32(&gotTable[i],
byte_swap32(byte_swap32(gotTable[i])
+ (UInt32)pnoCode));
}
DmWrite( ftrBase, sizeof(PNOFtrHeader) + pnoSize + pad,
gotTable, gotSize );
MemPtrFree( gotTable );
header.gotTable = (UInt32*)(((char*)pnoCode) + pnoSize + pad);
DmWrite( ftrBase, 0, &header, sizeof(header) );
}
}
*gotTableP = ftrBase->gotTable;
*entryP = (UInt32*)&ftrBase[1];
return mustLoad;
} /* setupPnolet */
static Boolean
shouldRunPnolet()
{
UInt32 value;
Boolean runArm = false;
Err err = FtrGet( sysFtrCreator, sysFtrNumProcessorID, &value );
if ( ( err == errNone ) && sysFtrNumProcessorIsARM( value ) ) {
runArm = true;
}
#ifdef FEATURE_DUALCHOOSE
if ( runArm ) {
err = FtrGet( APPID, FEATURE_WANTS_68K, &value );
if ( (err == errNone) && (value == WANTS_68K) ) {
runArm = false;
}
}
#endif
return runArm;
} /* shouldRunPnolet */
UInt32
PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
UInt32 result = 0;
if ( ( cmd == sysAppLaunchCmdNormalLaunch )
#ifdef XWFEATURE_IR
|| ( cmd == sysAppLaunchCmdExgAskUser )
|| ( cmd == sysAppLaunchCmdSyncNotify )
|| ( cmd == sysAppLaunchCmdExgReceiveData )
#endif
) {
/* This is the entry point for both an ARM-only app and one capable
of doing both. If the latter, and ARM's an option, we want to use
it unless the user's said not to. */
if ( shouldRunPnolet() ) {
UInt32* gotTable;
PnoletUserData* dataP;
UInt32* pnoCode;
UInt32 result;
Boolean loaded;
#ifdef DEBUG
WinDrawChars( "Loading ARM code...", 19, 5, 25 );
#endif
loaded = setupPnolet( &pnoCode, &gotTable );
dataP = (PnoletUserData*)MemPtrNew( sizeof(PnoletUserData) );
dataP->recursive = !loaded;
dataP->pnoletEntry = pnoCode;
dataP->gotTable = gotTable;
dataP->storageCallback = storageCallback;
dataP->cmdPBP = cmdPBP;
dataP->cmd = cmd;
dataP->launchFlags = launchFlags;
result = PceNativeCall((NativeFuncType*)pnoCode, (void*)dataP );
MemPtrFree( dataP );
if ( loaded ) {
FtrPtrFree( APPID, PNOLET_STORE_FEATURE );
}
} else {
#ifdef FEATURE_PNOAND68K
result = PM2(PilotMain)( cmd, cmdPBP, launchFlags);
#else
alertUser( "This copy of Crosswords runs only on ARM-based Palms. "
"Get the right version at xwords.sf.net." );
#endif
}
}
return result;
} /* PilotMain */

View file

@ -1,186 +0,0 @@
/* -*- mode: c; -*- */
#include <stdio.h>
#include <assert.h>
#include "xwords4defines.h"
typedef struct fnavElem {
unsigned short objectID;
unsigned short objectFlags;
unsigned short objectAbove;
unsigned short objectBelow;
} fnavElem;
typedef struct fnavHeader {
unsigned short formID; /* not part of resource!!!! */
unsigned short version; /* always 1 */
unsigned short objcount;
unsigned short headerSizeInBytes; /* always 20 */
unsigned short listSizeInBytes; /* always 8 */
unsigned short navflags;
unsigned short initialHint;
unsigned short jumpToHint;
unsigned short bottomLeftHint;
} fnavHeader;
fnavHeader gamesHeader = {
XW_NEWGAMES_FORM,
0, /* fill this in */
0, /* fill this in */
0, /* fill this in */
0, /* fill this in */
0x0001, /* force obj focus mode */
0,
0,
0,
};
fnavElem gamesElems[] = {
{ XW_ROBOT_1_CHECKBOX_ID, 0, 0, XW_ROBOT_2_CHECKBOX_ID },
{ XW_ROBOT_2_CHECKBOX_ID, 0, XW_ROBOT_1_CHECKBOX_ID, XW_ROBOT_3_CHECKBOX_ID },
{ XW_ROBOT_3_CHECKBOX_ID, 0, XW_ROBOT_2_CHECKBOX_ID, XW_ROBOT_4_CHECKBOX_ID },
{ XW_ROBOT_4_CHECKBOX_ID, 0, XW_ROBOT_3_CHECKBOX_ID, XW_SOLO_GADGET_ID },
{ XW_SOLO_GADGET_ID, 0, XW_ROBOT_4_CHECKBOX_ID, XW_SERVER_GADGET_ID },
{ XW_SERVER_GADGET_ID, 0, XW_SOLO_GADGET_ID, XW_CLIENT_GADGET_ID },
{ XW_CLIENT_GADGET_ID, 0, XW_SERVER_GADGET_ID, 0 }
};
unsigned short gamesElemsShort[] = {
#ifndef XWFEATURE_STANDALONE_ONLY
XW_SOLO_GADGET_ID,
XW_SERVER_GADGET_ID,
XW_CLIENT_GADGET_ID,
#endif
XW_NPLAYERS_SELECTOR_ID,
XW_PREFS_BUTTON_ID,
XW_REMOTE_1_CHECKBOX_ID,
XW_PLAYERNAME_1_FIELD_ID,
XW_ROBOT_1_CHECKBOX_ID,
XW_PLAYERPASSWD_1_TRIGGER_ID,
XW_REMOTE_2_CHECKBOX_ID,
XW_PLAYERNAME_2_FIELD_ID,
XW_ROBOT_2_CHECKBOX_ID,
XW_PLAYERPASSWD_2_TRIGGER_ID,
XW_REMOTE_3_CHECKBOX_ID,
XW_PLAYERNAME_3_FIELD_ID,
XW_ROBOT_3_CHECKBOX_ID,
XW_PLAYERPASSWD_3_TRIGGER_ID,
XW_REMOTE_4_CHECKBOX_ID,
XW_PLAYERNAME_4_FIELD_ID,
XW_ROBOT_4_CHECKBOX_ID,
XW_PLAYERPASSWD_4_TRIGGER_ID,
XW_DICT_SELECTOR_ID,
XW_CANCEL_BUTTON_ID,
XW_OK_BUTTON_ID
};
static void
usage( char* name )
{
fprintf( stderr, "usage: %s outfile\n", name );
exit( 1 );
} /* */
static void
write_network_short( FILE* fil, unsigned short s )
{
unsigned short tmp = htons( s );
fwrite( &tmp, sizeof(tmp), 1, fil );
} /* write_network_short */
write_fnav( fnavHeader* header, unsigned short* idArray,
fnavElem* elems, int count )
{
char nameBuf[32];
FILE* fil;
int i;
assert( !idArray || !elems );
sprintf( nameBuf, "fnav%.4x.bin", header->formID );
fil = fopen( nameBuf, "w" );
fprintf( stderr, "created file %s\n", nameBuf );
write_network_short( fil, 1 );
write_network_short( fil, count );
write_network_short( fil, 20 );
write_network_short( fil, 8 );
write_network_short( fil, header->navflags );
write_network_short( fil, header->initialHint );
write_network_short( fil, header->jumpToHint );
write_network_short( fil, header->bottomLeftHint );
/* Two words of padding. Docs disagree, but Blazer's resources have
'em */
write_network_short( fil, 0 );
write_network_short( fil, 0 );
if ( !!elems ) {
for ( i = 0; i < count; ++i ) {
write_network_short( fil, elems->objectID );
write_network_short( fil, elems->objectFlags );
write_network_short( fil, elems->objectAbove );
write_network_short( fil, elems->objectBelow );
++elems;
}
} else {
unsigned short prevID = 0;
unsigned short id = *idArray++;
while ( count-- ) {
unsigned short nextID;
if ( count == 0 ) {
nextID = 0;
} else {
nextID = *idArray++;
}
write_network_short( fil, id );
write_network_short( fil, 0 );
write_network_short( fil, prevID );
write_network_short( fil, nextID );
if ( !nextID ) {
break;
}
prevID = id;
id = nextID;
}
}
fclose(fil);
} /* write_fnav */
int
main( int argc, char** argv )
{
int i;
char* outFName;
if ( argc != 1 ) {
usage( argv[0] );
}
write_fnav( &gamesHeader, gamesElemsShort, NULL,
VSIZE(gamesElemsShort) );
/* sizeof(gamesElems)/sizeof(gamesElems[0]) ); */
} /* main */

View file

@ -1,254 +0,0 @@
# PalmOS functions listed here will have PACE-interface bodies
# generated for them. For most, that's enough. Some will require
# manual work beyond that.
#
# Just to have a record, list the ones that must be hand-coded here.
# StrVPrintF
# StrPrintF
# SysHandleEvent
# FrmSetEventHandler
# LstSetListChoices
# SysNotifyRegister
# LstSetDrawFunction
# ExgDBWrite
#
#################################################################
CtlEnabled
CtlGetLabel
CtlGetValue
CtlSetEnabled
CtlSetLabel
CtlSetValue
DateToAscii
DmCloseDatabase
DmCreateDatabase
DmDatabaseInfo
DmDeleteDatabase
DmFindDatabase
DmFindResource
DmFindResourceType
DmGetNextDatabaseByTypeCreator
DmGetRecord
DmGetResource
DmGetResourceIndex
DmNewRecord
DmNewResource
DmNumRecords
DmOpenDatabase
DmQueryRecord
DmReleaseRecord
DmReleaseResource
DmRemoveRecord
DmWrite
DmWriteCheck
EvtSysEventAvail
ExgAccept
ExgDisconnect
ExgPut
ExgReceive
ExgRegisterData
ExgSend
FldCalcFieldHeight
FldCopy
FldDrawField
FldGetAttributes
FldGetScrollValues
FldGetTextLength
FldGetTextPtr
FldInsert
FldRecalculateField
FldScrollField
FldScrollable
FldSetAttributes
FldSetSelection
FldSetTextPtr
FntCharsWidth
FntGetFont
FntLineHeight
FntSetFont
FrmCloseAllForms
FrmCustomAlert
FrmDeleteForm
FrmDoDialog
FrmDrawForm
FrmGetActiveForm
FrmGetActiveFormID
FrmGetFirstForm
FrmGetFocus
FrmGetFormBounds
FrmGetFormPtr
FrmGetGadgetData
FrmGetNumberOfObjects
FrmGetObjectBounds
FrmGetObjectId
FrmGetObjectIndex
FrmGetObjectPosition
FrmGetObjectPtr
FrmGetObjectType
FrmGetWindowHandle
FrmGotoForm
FrmHideObject
FrmInitForm
FrmPopupForm
FrmReturnToForm
FrmSetActiveForm
FrmSetFocus
FrmSetGadgetData
FrmSetObjectBounds
FrmSetObjectPosition
FrmSetTitle
FrmShowObject
FrmUpdateForm
FtrGet
FtrSet
FtrUnregister
GrfSetState
LstDrawList
LstEraseList
LstGetNumberOfItems
LstGetSelection
LstGetSelectionText
LstMakeItemVisible
LstPopupList
LstSetHeight
LstSetSelection
MemChunkFree
MemHandleLock
MemHandleLockCount
MemHandleResize
MemHandleSize
MemHandleUnlock
MemMove
MemPtrNew
MemPtrRecoverHandle
MemPtrSize
MemPtrUnlock
MemSet
MenuEraseStatus
PrefGetAppPreferences
PrefGetAppPreferencesV10
PrefSetAppPreferences
RctGetIntersection
RctPtInRectangle
SclSetScrollBar
SndPlaySystemSound
StrAToI
StrCat
StrCompare
StrCopy
StrIToA
StrLen
StrNCompare
StrStr
SysLibFind
SysLibLoad
SysNotifyUnregister
SysRandom
SysTicksPerSecond
TimGetSeconds
TimGetTicks
TimeToAscii
VFSDirEntryEnumerate
VFSFileClose
VFSFileDBInfo
VFSFileOpen
VFSGetDefaultDirectory
VFSImportDatabaseFromFile
VFSVolumeEnumerate
WinDeleteWindow
WinDrawBitmap
WinDrawChars
WinDrawLine
WinDrawPixel
WinDrawRectangle
WinDrawRectangleFrame
WinEraseRectangle
WinEraseRectangleFrame
WinEraseWindow
WinFillRectangle
WinGetClip
WinGetDrawWindowBounds
WinInvertRectangle
WinPopDrawState
WinPushDrawState
WinRGBToIndex
WinRestoreBits
WinSaveBits
WinScreenMode
WinScrollRectangle
WinSetBackColor
WinSetBounds
WinSetClip
WinSetDrawWindow
WinSetForeColor
WinSetPattern
WinSetTextColor
WinEraseLine
SclDrawScrollBar
DmNumRecordsInCategory
DmSeekRecordInCategory
DmResizeRecord
VFSExportDatabaseToFile
VFSFileDelete
DmSetDatabaseInfo
DmGetLastErr
WinRestoreBits
WinSetCoordinateSystem
WinGetDisplayExtent
WinScreenGetAttribute
TimSecondsToDateTime
EvtGetEvent
FrmDispatchEvent
MenuHandleEvent
EvtAddEventToQueue
FtrPtrFree
SysUIAppSwitch
FntBaseLine
WinSetScalingMode
WinGetDrawWindow
############ These only needed if XWFEATURE_RELAY defined
NetLibOpen
NetLibSocketOpen
NetLibClose
NetLibSocketClose
NetLibSend
NetLibReceive
NetLibSelect
NetLibSocketConnect
NetLibSocketOptionSet
#
# These are currently needed only when TALL_FONTS is #defined
#
BmpCreate
BmpDelete
WinCreateBitmapWindow
WinSetDrawMode
WinGetPixel
#
# Needed for five-way navigation
#
UIColorGetTableEntryIndex
#HsNavDrawFocusRing
#ifdef XWFEATURE_BLUETOOTH
BtLibOpen
BtLibAddrBtdToA
BtLibSocketSend
BtLibSocketClose
BtLibLinkConnect
BtLibDiscoverSingleDevice
BtLibLinkDisconnect
BtLibSocketRespondToConnection
BtLibClose
BtLibSocketConnect
BtLibSocketListen
#BtLibRegisterManagementNotification
#BtLibUnregisterManagementNotification
#BtLibSocketCreate
BtLibGetRemoteDeviceName
BtLibSdpServiceRecordCreate
BtLibSdpServiceRecordStopAdvertising
BtLibSdpGetPsmByUuid
BtLibSdpServiceRecordSetAttributesForSocket
BtLibSdpServiceRecordStartAdvertising
BtLibSdpServiceRecordDestroy
#endif

View file

@ -1,206 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/*
* Copyright 1999 - 2001 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 <DataMgr.h>
#include <TimeMgr.h>
#include "comtypes.h"
#include "comms.h"
#include "strutils.h"
#include "gameutil.h"
#include "xwords4defines.h"
#include "xwstream.h"
#include "palmmain.h"
XP_U16
countGameRecords( PalmAppGlobals* globals )
{
LocalID id;
DmOpenRef dbP;
UInt16 numRecs;
id = DMFINDDATABASE( globals, CARD_0, XW_GAMES_DBNAME );
dbP = DMOPENDATABASE( globals, CARD_0, id, dmModeWrite );
numRecs = DmNumRecords( dbP );
DMCLOSEDATABASE( dbP );
return numRecs;
}
void
deleteGameRecord( PalmAppGlobals* globals, XP_S16 index )
{
LocalID id;
DmOpenRef dbP;
id = DMFINDDATABASE( globals, CARD_0, XW_GAMES_DBNAME );
dbP = DMOPENDATABASE( globals, CARD_0, id, dmModeWrite );
DmRemoveRecord( dbP, index );
DMCLOSEDATABASE( dbP );
} /* deleteGameRecord */
XP_S16
duplicateGameRecord( PalmAppGlobals* globals, XP_S16 fromIndex )
{
LocalID id;
DmOpenRef dbP;
MemHandle newRecord, curRecord;
XP_U16 size;
XP_S16 newIndex = fromIndex + 1;
id = DMFINDDATABASE( globals, CARD_0, XW_GAMES_DBNAME );
dbP = DMOPENDATABASE( globals, CARD_0, id, dmModeWrite );
XP_ASSERT( fromIndex < countGameRecords(globals) );
curRecord = DmQueryRecord( dbP, fromIndex );
size = MemHandleSize( curRecord );
newRecord = DmNewRecord( dbP, (XP_U16*)&newIndex, size );
DmWrite( MemHandleLock(newRecord), 0, MemHandleLock(curRecord), size );
MemHandleUnlock( curRecord );
MemHandleUnlock( newRecord );
DmReleaseRecord( dbP, newIndex, true );
DMCLOSEDATABASE( dbP );
return newIndex;
} /* duplicateGameRecord */
void
streamToGameRecord( PalmAppGlobals* globals, XWStreamCtxt* stream,
XP_S16 index )
{
LocalID id;
DmOpenRef dbP;
MemHandle handle;
MemPtr tmpPtr, ptr;
Err err;
XP_U32 size = stream_getSize( stream );
id = DMFINDDATABASE( globals, CARD_0, XW_GAMES_DBNAME );
dbP = DMOPENDATABASE( globals, CARD_0, id, dmModeWrite );
XP_ASSERT( !!dbP );
if ( index == DmNumRecords(dbP) ) {
handle = DmNewRecord( dbP, (XP_U16*)&index, size );
} else {
XP_ASSERT( index < countGameRecords(globals) );
handle = DmGetRecord( dbP, index );
MemHandleResize( handle, size );
}
tmpPtr = MemPtrNew(size);
stream_getBytes( stream, tmpPtr, size );
ptr = MemHandleLock( handle );
err = DmWrite( ptr, 0, tmpPtr, size );
XP_ASSERT( err == 0 );
MemPtrFree( tmpPtr );
MemHandleUnlock(handle);
err = DmReleaseRecord( dbP, index, true );
XP_ASSERT( err == 0 );
DMCLOSEDATABASE( dbP );
} /* streamToGameRecord */
void
writeNameToGameRecord( PalmAppGlobals* globals, XP_S16 index,
char* newName, XP_U16 len )
{
LocalID id;
DmOpenRef dbP;
MemHandle handle;
char name[MAX_GAMENAME_LENGTH];
XP_ASSERT( len == XP_STRLEN(newName) );
XP_ASSERT( len > 0 );
XP_MEMSET( name, 0, sizeof(name) );
if ( len >= MAX_GAMENAME_LENGTH ) {
len = MAX_GAMENAME_LENGTH - 1;
}
XP_MEMCPY( name, newName, len+1 );
id = DMFINDDATABASE( globals, CARD_0, XW_GAMES_DBNAME );
dbP = DMOPENDATABASE( globals, CARD_0, id, dmModeWrite );
if ( index == DmNumRecords(dbP) ) {
handle = DmNewRecord(dbP, (XP_U16*)&index, MAX_GAMENAME_LENGTH);
} else {
XP_ASSERT( index < DmNumRecords(dbP) );
handle = DmGetRecord( dbP, index );
}
XP_ASSERT( !!handle );
DmWrite( MemHandleLock(handle), 0, name, MAX_GAMENAME_LENGTH );
MemHandleUnlock( handle );
(void)DmReleaseRecord( dbP, index, true );
DMCLOSEDATABASE( dbP );
} /* writeNameToGameRecord */
void
nameFromRecord( PalmAppGlobals* globals, XP_S16 index, char* buf )
{
LocalID id;
DmOpenRef dbP;
MemHandle handle;
buf[0] = '\0'; /* init to empty string */
if ( index < countGameRecords(globals) ) {
id = DMFINDDATABASE( globals, CARD_0, XW_GAMES_DBNAME );
if ( id != 0 ) {
dbP = DMOPENDATABASE( globals, CARD_0, id, dmModeWrite );
if ( dbP != 0 ) {
handle = DmQueryRecord( dbP, index );
XP_MEMCPY( buf, MemHandleLock(handle), MAX_GAMENAME_LENGTH );
buf[MAX_GAMENAME_LENGTH-1] = '\0';
MemHandleUnlock( handle );
DMCLOSEDATABASE( dbP );
}
}
}
} /* nameFromRecord */
/*****************************************************************************
* Later this will provide a default name based on a timestamp.
*****************************************************************************/
#ifndef TIME_FORMAT
#define TIME_FORMAT tfColonAMPM
#endif
#ifndef DATE_FORMAT
#define DATE_FORMAT dfMDYLongWithComma
#endif
void
makeDefaultGameName( char* buf )
{
char timeBuf[timeStringLength+1]; /* add 1 to be safe */
char dateBuf[longDateStrLength+1];
DateTimeType timeType;
TimSecondsToDateTime( TimGetSeconds(), &timeType );
TimeToAscii( timeType.hour, timeType.minute, TIME_FORMAT, timeBuf );
DateToAscii( timeType.month, timeType.day, timeType.year,
DATE_FORMAT, dateBuf );
StrPrintF( buf, "%s, %s", dateBuf, timeBuf );
} /* makeDefaultGameName */

View file

@ -1,35 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/*
* Copyright 1999 - 2001 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 _GAMEUTIL_H_
#define _GAMEUTIL_H_
#include "comtypes.h"
#include "memstream.h"
#include "palmmain.h"
XP_U16 countGameRecords( PalmAppGlobals* globals );
void deleteGameRecord( PalmAppGlobals* globals, XP_S16 index );
XP_S16 duplicateGameRecord( PalmAppGlobals* globals, XP_S16 fromIndex );
void nameFromRecord( PalmAppGlobals* globals, XP_S16 index, char* buf );
void streamToGameRecord( PalmAppGlobals* globals, XWStreamCtxt* stream,
XP_S16 index );
void makeDefaultGameName( char* buf );
#endif

View file

@ -1,715 +0,0 @@
#!/usr/bin/perl
# Copyright 2004-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.
use strict;
use File::Basename;
my %funcInfo;
my %fileNames;
my %contents;
my @ifdefs;
my @minusDs;
sub usage() {
print STDERR "$0 \\\n" .
"\t[-oh out.h] \\\n" .
"\t[-oc out.c] \\\n" .
"\t[-os out.s] \\\n" .
"\t[-D<define0> ... -D<defineN>] \\\n" .
"\t[-file palmheader.h|palm_header_dir] (can repeat) \\\n" .
"\t[-func func_name_or_list_file] (can repeat)\n";
exit 1;
}
# Given the name of a palm function, or of a file containing a list of
# such, return a list of function names. In the first case it'll be a
# singleton.
sub makeFuncList($) {
my ( $nameOrPath ) = @_;
my @result;
if ( open LIST, "< $nameOrPath" ) {
while ( <LIST> ) {
chomp;
# ifdef/endif pairs
if ( m/^\#\s*ifdef\s+(\w+)\s*$/ ) {
# print STDERR "looking for $1 in ", join( ",", @minusDs), "\n";
if ( 0 == grep( {$1 eq $_} @minusDs ) ) {
# print STDERR "adding $1 to skippers\n";
push( @ifdefs, $1 );
} else {
# print STDERR "NOT adding $1 to skippers\n";
}
next;
} elsif ( m/^\#\s*endif\s+(\w+)\s*$/ ) {
if ( 0 == grep( {$1 eq $_} @minusDs ) ) {
die "$1 not most recently defined" if $1 ne pop(@ifdefs);
}
next;
}
next if @ifdefs > 0;
# comments?
s/\#.*$//;
# white space
s/^\s*//;
s/\s*$//;
if ( m,^(\w+)\s+(-?\d+)\s+(0x\w+)$, ) {
push( @result, [ $1, $2, $3 ] );
} elsif ( m,^(\w+)$, ) {
push( @result, [ $1 ] );
} else {
next;
}
}
close LIST;
} else {
# must be a simple function name
push( @result, $nameOrPath );
}
return @result;
} # makeFuncList
sub makeFileList($) {
my ( $fileOrDir ) = @_;
my @result;
push @result, $fileOrDir;
return @result;
} # makeFileList
my @funcList;
my @pathList;
my $dot_c;
my $dot_s;
my $dot_h;
# A list of types seen in the header files. The idea is to use these
# to determine the size of a type and whether it's returned in d0 or
# a0. The user function should print out types it doesn't find here
# and they should be added manually;
my %typeInfo = (
"UInt32" => { "size" => 4, "a0" => 0 },
"UInt16" => { "size" => 2, "a0" => 0 },
"void*" => { "size" => 4, "a0" => 1 },
"void**" => { "size" => 4, "a0" => 1, "autoSwap" => 4 },
"void" => { "size" => 0, "a0" => 0 },
"BitmapPtr" => { "size" => 4, "a0" => 1 },
"Boolean" => { "size" => 1, "a0" => 0 },
"Boolean*" => { "size" => 4, "a0" => 0, "autoSwap" => 1 },
"Char const*" => { "size" => 4, "a0" => 1 },
"Char*" => { "size" => 4, "a0" => 1 },
"Char**" => { "size" => 4, "a0" => 1 },
"ControlType*" => { "size" => 4, "a0" => 1 },
"Coord" => { "size" => 2, "a0" => 0 }, # ???
"Coord*" => { "size" => 4, "a0" => 0, "autoSwap" => 2 },
"DateFormatType" => { "size" => 1, "a0" => 0 }, # enum
"DateTimeType*" => { "size" => 4, "a0" => 0, "autoSwap" => -1 },
"DmOpenRef" => { "size" => 4, "a0" => 1 },
"DmResID" => { "size" => 2, "a0" => 0 },
"DmResType" => { "size" => 4, "a0" => 0 },
"DmSearchStatePtr" => { "size" => 4, "a0" => 0 },
"Err" => { "size" => 2, "a0" => 0 },
"Err*" => { "size" => 4, "a0" => 1 },
"EventPtr" => { "size" => 4, "a0" => 1 },
"EventType*" => { "size" => 4, "a0" => 1, "autoSwap" => -1 },
"ExgDBWriteProcPtr" => { "size" => 4, "a0" => 1 },
"ExgSocketType*" => { "size" => 4, "a0" => 1, "autoSwap" => -1 },
"FieldAttrPtr" => { "size" => 4, "a0" => 1 },
"FieldType*" => { "size" => 4, "a0" => 1 },
"FileInfoType*" => { "size" => 4, "a0" => 1, "autoSwap" => -1 },
"FileRef" => { "size" => 4, "a0" => 0 }, # UInt32
"FileRef*" => { "size" => 4, "a0" => 1, "autoSwap" => 4 },
"FontID" => { "size" => 1, "a0" => 0 }, # enum
"FormEventHandlerType*" => { "size" => 4, "a0" => 1 },
"FormType*" => { "size" => 4, "a0" => 1 },
"FrameType" => { "size" => 2, "a0" => 0 },
"IndexedColorType" => { "size" => 1, "a0" => 0 }, # UInt8
"Int16" => { "size" => 2, "a0" => 0 },
"Int32" => { "size" => 4, "a0" => 0 },
"Int8" => { "size" => 1, "a0" => 0 },
"ListDrawDataFuncPtr" => { "size" => 4, "a0" => 1 },
"ListType*" => { "size" => 4, "a0" => 1 },
"LocalID" => { "size" => 4, "a0" => 0 },
"LocalID*" => { "size" => 4, "a0" => 1, "autoSwap" => 4 },
"MemHandle" => { "size" => 4, "a0" => 1 },
"MemHandle*" => { "size" => 4, "a0" => 1 },
"MemPtr" => { "size" => 4, "a0" => 1 },
"MenuBarType*" => { "size" => 4, "a0" => 1 },
"RectangleType*" => { "size" => 4, "a0" => 1,
"autoSwap" => -1 },
"ScrollBarType*" => { "size" => 4, "a0" => 1 },
"SndSysBeepType" => { "size" => 1, "a0" => 0 },
"SysNotifyProcPtr" => { "size" => 4, "a0" => 1 },
"TimeFormatType" => { "size" => 1, "a0" => 0 }, # enum
"UInt16*" => { "size" => 4, "a0" => 1, "autoSwap" => 2 },
"UInt32*" => { "size" => 4, "a0" => 1, "autoSwap" => 4 },
"UInt8" => { "size" => 1, "a0" => 0 },
"UInt8*" => { "size" => 4, "a0" => 1 },
"WinDirectionType" => { "size" => 1, "a0" => 0 }, # enum
"WinDrawOperation" => { "size" => 1, "a0" => 0 }, # enum
"WinHandle" => { "size" => 4, "a0" => 1 },
"WinScreenModeOperation" => { "size" => 1, "a0" => 0 }, # enum
"WindowFormatType" => { "size" => 1, "a0" => 0 }, # enum
"char*" => { "size" => 4, "a0" => 1 },
"const Char*" => { "size" => 4, "a0" => 1 },
"const ControlType*" => { "size" => 4, "a0" => 1 },
# CustomPatternType is UInt8[8]; no need to translate
"const CustomPatternType*" => { "size" => 4, "a0" => 1 },
"const EventType*" => { "size" => 4, "a0" => 1,
"autoSwap" => -1 },
"const FieldAttrType*" => { "size" => 4, "a0" => 1 },
"const FieldType*" => { "size" => 4, "a0" => 1 },
"const FormType*" => { "size" => 4, "a0" => 1 },
"const ListType*" => { "size" => 4, "a0" => 1 },
"const RGBColorType*" => { "size" => 4, "a0" => 1 },
"const RectangleType*" => { "size" => 4, "a0" => 1,
"autoSwap" => -1 },
"const char*" => { "size" => 4, "a0" => 1 },
"const void*" => { "size" => 4, "a0" => 1 },
"FormObjectKind" => { "size" => 1, "a0" => 0 }, # enum
# it's a char*, likely never returned
"_Palm_va_list" => { "size" => 4, "a0" => 1 },
"WinScreenAttrType" => { "size" => 1, "a0" => 0 }, # enum
"NetSocketRef" => { "size" => 2, "a0" => 0 },
"NetSocketAddrType*" => { "size" => 4, "a0" => 1 },
"NetFDSetType*" => { "size" => 4, "a0" => 1, "autoSwap" => 4 },
"NetSocketAddrEnum" => { "size" => 1, "a0" => 0 },
"NetSocketTypeEnum" => { "size" => 1, "a0" => 0 },
"BitmapType*" => { "size" => 4, "a0" => 1 },
"ColorTableType*" => { "size" => 4, "a0" => 1 },
"UIColorTableEntries" => { "size" => 1, "a0" => 0 }, # enum
"BtLibClassOfDeviceType*" => { "size" => 4, "a0" => 1,
"autoSwap" => 4}, # uint32
"BtLibDeviceAddressType*" => { "size" => 4, "a0" => 1 },
"BtLibDeviceAddressTypePtr" => { "size" => 4, "a0" => 1 },
"BtLibSocketRef" => { "size" => 2, "a0" => 0 },
"BtLibSocketRef*" => { "size" => 4, "a0" => 1,
"autoSwap" => 2 },
"BtLibProtocolEnum" => { "size" => 1, "a0" => 0 }, # enum
"BtLibSocketConnectInfoType*" => { "size" => 4, "a0" => 1,
"autoSwap" => -1 },
"BtLibSocketListenInfoType*" => { "size" => 4, "a0" => 1,
"autoSwap" => -1 },
"BtLibSdpRecordHandle" => { "size" => 4, "a0" => 1 },
"BtLibSdpRecordHandle*"=> { "size" => 4, "a0" => 1,
"autoSwap" => 4 },
"BtLibSdpUuidType*" => { "size" => 4, "a0" => 1,
"autoSwap" => -1 },
"BtLibFriendlyNameType*" => { "size" => 4, "a0" => 1,
"autoSwap" => -1 },
"BtLibGetNameEnum" => { "size" => 1, "a0" => 0 }, # enum
);
sub name_compact($) {
my ( $name ) = @_;
$name =~ s/^\s*//;
$name =~ s/\s*$//;
return $name;
}
sub type_compact($) {
my ( $type ) = @_;
#print STDERR "1. $type\n";
$type = name_compact( $type );
$type =~ s/\s*(\*+)$/$1/; # remove spaces before any trailing *
#print STDERR "2. $type\n";
return $type;
}
# Split a string like "( type foo, type* bar, type *bazz, const type
# buzz )" into a list of hashes each with "type" and "name"
sub params_parse($) {
my ( $params ) = @_;
my @plist;
# strip leading and training ws and params
$params =~ s/^\s*\(//;
$params =~ s/\)\s*$//;
$params =~ s/^void$//; # if just (void), nuke it
#split based on commas
my @params = split ",", $params;
@params = map {
s/^\s*//; # leading ws
s/\s*$//; # trailing ws
m|^([\w\s]+[\s\*]+)(\w+)$|; # split on space-or-star
{ "type" => type_compact($1), "name" => name_compact($2) };
} @params;
return \@params;
}
sub clean_type($) {
my ( $type ) = @_;
# trip white space off the type
$type =~ s/\s*\*/\*/;
$type =~ s/^\s*//;
$type =~ s/\s*$//;
$type =~ s/^\s*(\S*)\s*$/$1/;
my @out;
my @terms = split( '\s+', $type );
foreach my $term (@terms) {
if ( defined( $typeInfo{$term} ) ) {
} elsif ( "const" eq $term ) {
} elsif ( "extern" eq $term ) {
} else {
next;
}
push( @out, $term );
}
$type = join( " ", @out );
# print STDERR "clean_type => $type\n";
return $type;
}
sub searchOneFile($$) {
my ( $file, $function ) = @_;
# print STDERR "searching $file for $function\n";
my $base = basename($file);
my $contents = $contents{$base};
if ( ! $contents ) {
# read the file into a single long line, stripping
# (imperfectly) comments.
open FILE, "< $file";
# print STDERR "looking at file $file\n";
while( <FILE> ) {
chomp;
# remove // to eol comments
s|//.*$||;
$contents .= "$_ ";
}
close FILE;
# strip /*....*/ comments
$contents =~ s|/\*[^*]*\*+([^/*][^*]*\*+)*/||g;
$contents{$base} = $contents;
# print STDERR "$contents\n";
}
# a word-token, followed by at least ' ' or *, and another token.
# This one strips 'const' in 'const type func(params)'
# $contents =~ m/(\w+)([\s\*]+)$function\s*(\([^)]*\))/;
if ( $contents =~ m/([\w\s]+)([\s\*]+)$function\s*(\([^)]*\))[^V]*(VFSMGR_TRAP)\(([\w]+)\);/
|| $contents =~ m/([\w\s]+)([\s\*]+)$function\s*(\([^)]*\))[^S]*(SYS_TRAP)\s*\(([\w]+)\);/
|| $contents =~ m/([\w\s]+)([\s\*]+)$function\s*(\([^)]*\))[^B]*(BTLIB_TRAP)\s*\(([\w]+)\);/
|| $contents =~ m/([\w\s]+)([\s\*]+)$function\s*(\([^)]*\))[^S]*(SYS_SEL_TRAP)\s*\(([\w]+)\s*,\s*([\w]+)\);/
|| $contents =~ m/([\w\s]+)([\s\*]+)$function\s*(\([^)]*\))[^H]*(HIGH_DENSITY_TRAP)\(([\w]+)\);/
|| $contents =~ m/([\w\s]+)([\s\*]+)$function\s*(\([^)]*\))[^G]*(GRF_TRAP)\(([\w]+)\);/ ) {
# print STDERR "found something\n";
my ( $type, $params, $trapType, $trapSel, $trapSubSel ) = ( "$1$2", $3, $4, $5, $6 );
if ( $type && $params ) {
$type = clean_type($type);
# my $found = "type: $type\nfunction: $function\nparams: $params\n"
# . " trapSel: $trapSel\ntrapType: $trapType\ntrapSubSel: $trapSubSel\n";
# print STDERR "$found";
$params = params_parse($params);
$funcInfo{$function} = { 'type' => $type,
'params' => $params,
'file' => $base,
'sel' => $trapSel,
'trapType' => $trapType,
};
$fileNames{$base} = 1;
return 1;
}
}
return 0;
} # searchOneFile
sub searchOneDir($$) {
my ( $dir, $function ) = @_;
my $found = 0;
opendir(DIR, $dir) || die "can't opendir $dir: $!";
my @files = readdir(DIR);
closedir DIR;
foreach my $file (@files) {
if ( $file =~ m|^\.| ) {
# skip if starts with .
} elsif ( -d "$dir/$file" ) {
$found = searchOneDir( "$dir/$file", $function );
last if $found;
} elsif ( $file =~ m|\.h$| ) {
$found = searchOneFile( "$dir/$file", $function );
last if $found;
}
}
return $found;
} # searchOneDir
sub print_params_list($$) {
my ( $params, $startLen ) = @_;
my $result = "(";
foreach my $param ( @$params ) {
my $p = " " . $$param{"type"} . " " . $$param{'name'} . ",";
if ( length($p) + $startLen >= 80 ) {
$p = "\n $p";
$startLen = length($p);
}
$result .= $p;
$startLen += length($p);
}
$result =~ s/,$//;
$result .= " )";
return $result;
}
sub nameToBytes($) {
my ( $nam ) = @_;
# Any way to insert a '\n' in this?
my $str = "\"'" . join( "','", split( //, $nam ) ) . "'\"";
return $str;
}
sub makeSwapStuff($$$$$) {
my ( $params, $varDecls, $swapIns, $pushes, $swapOuts ) = @_;
my $sizeSum = 0;
my $vcount = 0;
$$varDecls .= " /* var decls */\n";
$$pushes .= " /* pushes */\n";
$$swapOuts .= " /* swapOuts */\n";
$$swapIns .= " /* swapIns */\n";
foreach my $param ( @$params ) {
# each param has "type" and "name" fields
my $type = $param->{"type"};
my $info = $typeInfo{$type};
my $size = $info->{'size'};
my $name = $param->{'name'};
my $pushName = $name;
# If type requires swapping, just swap in and out. If it's
# RECT (or later, other things) declare a tmp var and swap in
# and out. If it's const, only swap in.
my $swapInfo = $info->{"autoSwap"};
if ( defined $swapInfo ) {
if ( $swapInfo == -1 ) {
my $typeNoStar = $type;
$typeNoStar =~ s/\*$//;
# Does anything bad happen if there's no *?
# die "no star found" if $typeNoStar eq $type;
my $isConst = $typeNoStar =~ m|^const|;
$typeNoStar =~ s/^const\s+//;
my $vName = "${typeNoStar}_68K${vcount}";
$pushName = "&$vName";
$$varDecls .= " $typeNoStar $vName;\n";
$typeNoStar = uc($typeNoStar);
$$swapIns .= " SWAP_${typeNoStar}_ARM_TO_68K( &$vName, $name );\n";
if ( ! $isConst ) {
$$swapOuts .= " SWAP_${typeNoStar}_68K_TO_ARM( $name, &$vName );\n";
}
} else {
if ( $swapInfo >= 1 && $swapInfo <= 4 ) {
$$swapIns .= " SWAP${swapInfo}_NON_NULL_IN($name);\n";
$$swapOuts .= " SWAP${swapInfo}_NON_NULL_OUT($name);\n";
} else {
die "unknown swapInfo $swapInfo\n";
}
}
}
$$pushes .= " ADD_TO_STACK$size(stack, $pushName, $sizeSum);\n";
$sizeSum += $size;
if ( $size == 1 ) {
++$sizeSum;
}
++$vcount;
}
return $sizeSum;
} # makeSwapStuff
sub print_body($$$$$) {
my ( $name, $returnType, $params, $trapSel, $trapType ) = @_;
my $result;
my $offset = 0;
my $notVoid = $returnType !~ m|void$|;
$result .= "{\n";
if ( $notVoid ) {
$result .= " $returnType result;\n";
}
$result .= " FUNC_HEADER($name);\n";
my ( $varDecls, $swapIns, $pushes, $swapOuts );
$offset = makeSwapStuff( $params, \$varDecls,
\$swapIns, \$pushes, \$swapOuts );
$result .= $varDecls . $swapIns;
$result .= " {\n";
$result .= " PNOState* sp = GET_CALLBACK_STATE();\n";
$result .= " STACK_START(unsigned char, stack, $offset);\n"
. $pushes
. " STACK_END(stack);\n";
my $info = $typeInfo{$returnType};
if ( $info->{'a0'} ) {
$offset = "kPceNativeWantA0 | $offset";
}
if ( $trapType eq "VFSMGR_TRAP" ) {
$result .= " SET_SEL_REG($trapSel, sp);\n";
$trapSel = "sysTrapFileSystemDispatch";
} elsif ( $trapType eq "HIGH_DENSITY_TRAP" ) {
$result .= " SET_SEL_REG($trapSel, sp);\n";
$trapSel = "sysTrapHighDensityDispatch";
} elsif( $trapType eq "GRF_TRAP" || $trapType eq "SYS_TRAP"
|| $trapType eq "BTLIB_TRAP" ) {
# they're the same according to Graffiti.h
} elsif ( $trapType eq "SYS_SEL_TRAP" ) {
print( STDERR "name = $name\n" );
print( STDERR "returnType = $returnType\n" );
print( STDERR "params = $params\n" );
print( STDERR "trapSel = $trapSel\n" );
print( STDERR "trapType = $trapType\n" );
die "can't emit for SYS_SEL_TRAP yet";
} else {
die "unknown dispatch type: \"$trapType\"";
}
$result .= " ";
if ( $notVoid ) {
$result .= "result = ($returnType)";
}
$result .= "(*sp->call68KFuncP)( sp->emulStateP, \n"
. " PceNativeTrapNo($trapSel),\n"
. " stack, $offset );\n";
$result .= $swapOuts;
$result .= " }\n FUNC_TAIL($name);\n";
$result .= " EMIT_NAME(\"$name\"," . nameToBytes($name) . ");\n";
if ( $notVoid ) {
$result .= " return result;\n";
}
$result .= "} /* $name */\n";
return $result;
}
sub print_func_impl($$$$$$) {
my ( $returnType, $name,
$params, # ref-to-list created by params_parse above
$file, $trapSel, $trapType ) = @_;
my $result;
$result .= "\n/* from file $file */\n";
$result .= "$returnType\n";
my $lenToName = length( $result );
$result .= "$name";
$result .= print_params_list($params, length($result)-$lenToName) . "\n";
$result .= print_body( $name, $returnType, $params, $trapSel, $trapType );
return $result;
} # print_func_impl
# create a signature for each function. We'll see how many match up.
sub funcId($$) {
my ( $retType, $parms ) = @_;
my $id = "${retType}_";
foreach my $param ( @$parms ) {
$id .= $$param{"type"};
}
return $id;
} # funcId
sub genStub($$$) {
my( $func, $r9off, $off ) = @_;
my $result;
if ( $func && $r9off && $off ) {
$result .= "\t\t.type $func, %function\n";
$result .= "\t\t.globl $func\n";
$result .= "$func:\n";
$result .= "\tldr ip, [r9, #$r9off]\n";
my $intoff = 4 * hex($off);
$result .= "\tldr pc, [ip, #$intoff]\n";
}
return $result;
}
###########################################################################
# Main
###########################################################################
my @paths;
my @funcs;
while ( my $arg = shift(@ARGV) ) {
if ( $arg eq "-oh" ) {
$dot_h = shift(@ARGV);
} elsif ( $arg eq "-oc" ) {
$dot_c = shift(@ARGV);
} elsif ( $arg eq "-os" ) {
$dot_s = shift(@ARGV);
} elsif ( $arg eq "-file" ) {
push( @paths, shift(@ARGV));
} elsif ( $arg eq "-func" ) {
push( @funcs, shift(@ARGV));
} elsif ( $arg =~ m|^-D(\w+)$| ) {
push( @minusDs, $1 );
} else {
usage();
}
}
map { push( @pathList, makeFileList($_) ); } @paths;
map { push( @funcList, makeFuncList($_) ); } @funcs;
my $dot_s_out = "\t.text\n";
foreach my $fref (@funcList) {
if ( $dot_s ) {
$dot_s_out .= genStub( $$fref[0], $$fref[1], $$fref[2] );
}
if ( $dot_c ) {
my $func = $$fref[0];
my $found = 0;
my $path;
foreach my $path (@pathList) {
if ( -d $path ) {
$found = searchOneDir( $path, $func );
last if $found;
} elsif ( -e $path ) {
$found = searchOneFile( $path, $func );
last if $found;
}
}
die "unable to find declaration of $func\n" if ! $found;
}
# close PATHS;
}
my $outRef;
if ( $dot_s ) {
if ( $dot_s eq "-" ) {
$outRef = *STDOUT{IO};
} else {
open DOT, "> $dot_s";
$outRef = *DOT{IO};
}
print $outRef $dot_s_out;
if ( $dot_c ne "-" ) {
close DOT;
}
}
if ( $dot_c ) {
if ( $dot_c eq "-" ) {
$outRef = *STDOUT{IO};
} else {
open DOT, "> $dot_c";
$outRef = *DOT{IO};
}
print $outRef "/********** this file is autogenerated by $0 "
. "***************/\n\n";
print $outRef "\n";
print $outRef <<EOF;
\#include "pnostate.h"
\#include "pace_gen.h"
\#include "pace_man.h"
EOF
foreach my $key (keys %funcInfo) {
my $ref = $funcInfo{$key};
my $type = $${ref}{"type"};
$type =~ s/extern\s*//; # "extern" doesn't belong in implementation
$type =~ s/(\S+)\s*$/$1/; # trailing whitespace
$type =~ s/^\s*(.*)/$1/; # leading ws
my $funcstr = print_func_impl( $type,
$key,
$$ref{'params'},
$$ref{'file'},
$$ref{'sel'},
$$ref{'trapType'});
print $outRef $funcstr;
# print STDERR "funcID: ", funcId( $type, $$ref{'params'} ), "\n";
}
if ( $dot_c ne "-" ) {
close DOT;
}
}
if ( $dot_h ) {
open DOT, "> $dot_h";
print DOT "/********** this file is autogenerated by $0 "
. "***************/\n\n";
my $def = "_" . uc($dot_h) . "_";
$def =~ s/\./_/;
print DOT "#ifndef $def\n";
print DOT "#define $def\n";
map { print DOT "#include <$_>\n"; } keys(%fileNames);
foreach my $key (keys %funcInfo) {
my $ref = $funcInfo{$key};
print DOT $${ref}{"type"}, " "
. $key . print_params_list($$ref{'params'}, 0) . ";\n";
}
print DOT "\n#include \"pace_man.h\"\n";
print DOT "#endif /* $def */\n";
close DOT;
}
exit 0;

View file

@ -1,183 +0,0 @@
/* -*- mode: c; compile-command: "cd .. && make ARCH=68K_ONLY MEMDEBUG=TRUE"; -*- */
/*
* Copyright 1997 - 2009 by Eric House (xwords@eehouse.org) and others. 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 table is where English user-visible strings come from (all
* strings meant to wind up in a str# resource, actually. Each entry
* is a pair of strings, first the constant name and then the string
* itself. The build system creats a str# resource with the latter
* and generates a .h file of #defines using the former. */
{ "STR_COMMIT_CONFIRM", "Commit the current move?\n" },
{ "STR_NOT_YOUR_TURN", "You can't do that; it's not your turn!" },
{ "STR_NO_PEEK_ROBOT_TILES", "No peeking at the robot's tiles!" },
#ifndef XWFEATURE_STANDALONE_ONLY
{ "STR_NO_PEEK_REMOTE_TILES", "No peeking at remote player's tiles!" },
{ "STR_SERVER_DICT_WINS",
"Conflict between Host and Guest dictionaries; Host wins." },
{ "STR_REG_UNEXPECTED_USER", "Attempt to register unexpected user refused" },
{ "STR_REG_NEED_REMOTE", "Please make one or more players Remote when "
"playing as Host." },
{ "STR_REG_BT_NEED_HOST", "Please locate the device where Crosswords is "
"running as Host." },
{ "STR_RESEND_STANDALONE", "This is a standalone game. There is nothing "
"to resend." },
#endif
{ "STR_TOO_FEW_TILES", "Too few tiles left to trade." },
{ "STR_CANT_UNDO_TILEASSIGN", "Nothing to undo. (Initial tile picking "
"cannot be undone.)" },
{ "STR_CANT_HINT_WHILE_DISABLED", "The hint feature is disabled for this "
"game. Enable it for a new game using the "
"Preferences dialog." },
{ "STR_VALUES_TITLE", "Counts and Values" },
{ "STR_REMAINS_TITLE","Remaining tiles" },
{ "STRS_VALUES_HEADER", "%s counts/values:\n" },
{ "STR_DOUBLE_LETTER", "Double letter" },
{ "STR_DOUBLE_WORD", "Double word" },
{ "STR_TRIPLE_LETTER", "Triple letter" },
{ "STR_TRIPLE_WORD", "Triple word" },
{ "STR_REMTILES", "rem:%d" },
{ "STR_CANT_TRADE_MIDTURN", "Remove played tiles before trading."},
{ "STR_ASK_REPLACE_GAME", "Do you want to overwrite the current game?" },
{ "STR_OK", "Ok" },
{ "STR_ABOUT_TITLE", "About Crosswords" },
{ "STR_DEFAULT_NAME", "Player %d" },
{ "STR_CONFIRM_END_GAME", "Are you sure you want to end the game now?"},
{ "STR_CONFIRM_TRADE", "Are you sure you want to use your " \
"turn trading tiles?" },
{ "STR_TRADING_REMINDER", "Click D when done." },
{ "STR_LOCAL_NAME", "%s" },
{ "STR_NONLOCAL_NAME", "%s (remote)" },
{ "STRSD_SUMMARYSCORED", "%s:%d" },
{ "STRD_TRADED", "Traded %d" },
{ "STR_PASSED", "Passed" },
{ "STR_LOSTTURN", "Lost turn" },
{ "STR_HISTORY_TITLE", "Game history" },
{ "STRD_REMAINING_TILES_ADD", "+ %d [all remaining tiles]" },
{ "STRD_UNUSED_TILES_SUB", "- %d [unused tiles]" },
{ "STR_BONUS_ALL", "Bonus for using all tiles: 50\n" },
{ "STRD_TURN_SCORE", "Score for turn: %d\n" },
{ "STR_ALL_IN_LINE_ERR", "All tiles played must be in a line." },
{ "STR_NO_EMPTIES_ERR", "Empty squares cannot separate pieces played." },
{ "STR_FIRST_MOVE_ERR", "Must play two or more pieces on " \
"the first move." },
/* phony comment to get diff back in sync */
{ "STR_MUST_CONTACT_ERR", "New tiles must contact others already " \
"in place (or the middle square on the " \
"first move)." },
{ "STR_PTS", "Pts:" },
{ "STR_CONFIRM_DEL_GAME", "Really delete the selected game?" },
{ "STRD_TIME_PENALTY_SUB", " - %d [time]" },
{ "STR_NO_DICT_INSTALLED", "Crosswords 4 requires at least one dictionary." \
"Download one or more from xwords.sf.net." },
{ "STR_ILLEGAL_WORD", "Word[s] %s not found in dictionary. Allow anyway?" },
{ "STR_FINAL_SCORES_TITLE", "Final scores"},
/* another phony comment to get diff back in sync */
{ "STRD_CUMULATIVE_SCORE", "Cumulative score: %d\n" },
{ "STRS_TRAY_AT_START", "Tray at start: %s\n" },
{ "STRS_MOVE_ACROSS", "move (from %s across)\n" },
{ "STRS_MOVE_DOWN", "move (from %s down)\n" },
{ "STRS_NEW_TILES", "New tiles: %s\n" },
{ "STRSS_TRADED_FOR", "Traded %s for %s." },
{ "STR_PASS", "pass\n" },
{ "STR_PHONY_REJECTED", "Turn lost: illegal word in move." },
{ "STR_ROBOT_MOVED", "The robot made this move:\n" },
{ "STR_REMOTE_MOVED", "Remote player made this move:\n" },
{ "STRD_ROBOT_TRADED", "%d tiles traded this turn." },
{ "STR_ROBOT_TITLE", "Remote/robot score" },
/* The end of 4.0.5's strings */
{ "STR_PICK_BLANK", "Select the letter for your blank." },
#ifdef FEATURE_TRAY_EDIT
{ "STRS_PICK_TILE", "Choose a new tile for %s." },
{ "STR_PICK_TILE_CUR", "Cur" },
#endif
#ifdef NODE_CAN_4
{ "STR_CONFIRM_CONVERTDICT", "Do you want to convert any existing Crosswords " \
"dictionaries to the new format? " \
"The change is not reversible." },
{ "STRS_CONFIRM_ONEDICT", "Convert dictionary %s?" },
#endif
{ "STRS_CANNOT_FIND_DICT", "%s dictionary not found." },
{ "STR_DICT_COPY_EXPL", "Copying dictionary from card..." },
{ "STR_LOCALPLAYERS", "Local players" },
{ "STR_TOTALPLAYERS", "Total players" },
#ifdef XWFEATURE_RELAY
{ "STR_RELAY_XPORTNAME", "Internet" },
{ "STR_RELAY_TIMEOUT", "Relay error: Other devices failed to "
"connect." },
{ "STR_RELAY_LOST_OTHER", "Relay error: another device has lost its "
"connection." },
{ "STR_RELAY_GENERIC", "Relay error: something's wrong." },
#endif
#ifdef XWFEATURE_IR
{ "STR_IR_XPORTNAME", "Beaming" },
#endif
#ifdef XWFEATURE_BLUETOOTH
{ "STR_BT_XPORTNAME", "Bluetooth" },
{ "STR_BT_NOINIT", "Bluetooth appears to be off. Please turn it "
"on if you want Crosswords to use it." },
{ "STRS_BT_CONFIRM", "Is Crosswords running on %s and "
"ready to accept a connection? (If you "
"choose \"No\" Crosswords will not try to "
"connect until you restart it "
"or choose the \"Resend\" menu item.)" },
#endif
{ "STR_ABOUT_CONTENT",
/* #ifdef XWFEATURE_BLUETOOTH */
/* "THANKS FOR DOWNLOADING this beta version of " */
/* "Crosswords. Please see the notes and caveats at " */
/* "xwords.sf.net/bt_palm.php. Please report bugs to " */
/* "xwords@eehouse.org. Enjoy!\n\n" */
/* #endif */
"Crosswords " XW_PALM_VERSION_STRING " (rev. " SVN_REV ").\n" \
"Copyright 1998-2009 by Eric House. "\
"Released under the GNU Public License.\n\n"\
"See the manual at xwords.sf.net or "
"eehouse.org/xwords/.\n\n" \
"This program is postcardware. If you like it " \
"please mail a postcard to:\n" \
"The Houses\n" \
"1610 NW 14th Place\n" \
"Corvallis, OR 97330 USA\n\n"
"Thanks to Debian GNU/Linux for the development "\
"tools and to KT for the time." \
},

View file

@ -1,140 +0,0 @@
/* -*- mode: c; -*- */
/*
* Copyright 1997 - 2002 by Eric House (xwords@eehouse.org) and others. 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 table is where English user-visible strings come from (all
* strings meant to wind up in a str# resource, actually. Each entry
* is a pair of strings, first the constant name and then the string
* itself. The build system creats a str# resource with the latter
* and generates a .h file of #defines using the former. */
{ "STR_COMMIT_CONFIRM", "Acceptes la jugada?\n\n" },
{ "STR_NOT_YOUR_TURN", "No ho pots fer; no és el teu torn!" },
{ "STR_NO_PEEK_ROBOT_TILES", "No miris les fitxes de la màquina!" },
#ifndef XWFEATURE_STANDALONE_ONLY
{ "STR_NO_PEEK_REMOTE_TILES", "No miris les fitxes dels altres!" },
{ "STR_SERVER_DICT_WINS",
"Conflicte de diccionaris: mana el del servidor." },
{ "STR_REG_UNEXPECTED_USER", "Jugador inesperat: no s'accepta" },
{ "STR_RESEND_IR", "Error enviant el missatge; ¿reenviar?" },
#endif
{ "STR_TOO_FEW_TILES", "No hi ha prou fitxes." },
{ "STR_CANT_UNDO_TILEASSIGN", "El repartiment de fitxes no pot desfer-se." },
{ "STR_VALUES_TITLE", "Counts and Values" }, /* translate */
{ "STR_REMAINS_TITLE","Remaining tiles" }, /* translate */
{ "STRS_VALUES_HEADER", "%s counts/values:\n" }, /* translate */
{ "STR_DOUBLE_LETTER", "Doble de lletra" },
{ "STR_DOUBLE_WORD", "Doble de paraula" },
{ "STR_TRIPLE_LETTER", "Triple de lletra" },
{ "STR_TRIPLE_WORD", "Triple de paraula" },
{ "STR_REMTILES", "Hi ha:%d" },
{ "STR_CANT_TRADE_MIDTURN", "Encara tens fitxes al tauler."},
{ "STR_ASK_REPLACE_GAME", "Vols sobreescriure la partida?" },
{ "STR_OK", "Ok" }, /* translate */
{ "STR_ABOUT_TITLE", "Sobre Crosswords" },
{ "STR_DEFAULT_NAME", "Jugador %d" },
{ "STR_ABOUT_CONTENT",
"Crosswords " XW_PALM_VERSION_STRING " (rev. " SVN_REV ").\n" \
"Copyright 1998-2004 by Eric House. "\
"Tots els drets reservats.\n\n"\
"El manual és a xwords.sourceforge.net\n\n" \
"Aquest programa és postalware.\nSi el fas servir, " \
"envia una postal a:\n" \
"The Houses\n" \
"1610 NW 14th Place\n" \
"Corvallis, OR 97330 USA\n\n"
"Escrit sobre Debian GNU/Linux usant les prc-tools.\n\n" \
"Versió catalana de F. Xavier Gil\n(setimig@wanadooadsl.net)." \
},
{ "STR_CONFIRM_END_GAME", "Segur que vols acabar la partida?"},
{ "STR_CONFIRM_TRADE", "Segur que vols usar el teu torn " \
"per canviar fitxes?" },
{ "STR_TRADING_REMINDER", "Prem D per acabar." },
#ifndef NO_REG_REQUIRED
{ "STR_NOT_UNREG_VERS", "Només funciona a la versió registrada." },
#endif
{ "STR_LOCAL_NAME", "%s" },
{ "STR_NONLOCAL_NAME", "%s (remot)" },
{ "STRSD_SUMMARYSCORED", "%s: %d" },
{ "STRD_TRADED", "Canviades: %d" },
{ "STR_PASSED", "Ha passat" },
{ "STR_LOSTTURN", "Torn perdut" },
{ "STR_HISTORY_TITLE", "Jugades" },
{ "STRD_REMAINING_TILES_ADD", "+ %d [fitxes sobreres]" },
{ "STRD_UNUSED_TILES_SUB", "- %d [fitxes no usades]" },
{ "STR_BONUS_ALL", "Per usar les set fitxes: 50\n" },
{ "STRD_TURN_SCORE", "Parcial de la jugada: %d\n" },
{ "STR_ALL_IN_LINE_ERR", "Les fitxes no estan en línia." },
{ "STR_NO_EMPTIES_ERR", "Les fitxes s'han de tocar." },
{ "STR_FIRST_MOVE_ERR", "Has de posar dues o mes fitxes a " \
"la primera jugada." },
/* phony comment to get diff back in sync */
{ "STR_MUST_CONTACT_ERR", "Les fitxes n'han de tocar d'altres (o " \
"el quadre central a la primera jugada)." },
{ "STR_PTS", "Punts:" },
{ "STR_CONFIRM_DEL_GAME", "Segur que la vols esborrar?" },
{ "STRD_TIME_PENALTY_SUB", " - %d [per temps]" },
{ "STR_NO_DICT_INSTALLED", "Crosswords necessita algun diccionari." },
{ "STR_ILLEGAL_WORD", "Ep!, %s no està al diccionari." },
{ "STR_FINAL_SCORES_TITLE", "Puntuació final"},
/* another phony comment to get diff back in sync */
{ "STRD_CUMULATIVE_SCORE", "Acumulat: %d\n" },
{ "STRS_TRAY_AT_START", "Faristol inicial: %s\n" },
{ "STRS_MOVE_ACROSS", "jugada (%s, horitzontal)\n" },
{ "STRS_MOVE_DOWN", "jugada (%s, vertical)\n" },
{ "STRS_NEW_TILES", "Noves fitxes: %s\n" },
{ "STRSS_TRADED_FOR", "Canvi de %s per %s." },
{ "STR_PASS", "passa\n" },
{ "STR_PHONY_REJECTED", "Mot incorrecte; torn perdut!\n" },
{ "STR_ROBOT_MOVED", "El robot ha jugat:\n" },
{ "STR_REMOTE_MOVED", "Un jugador remot ha jugat:\n" },
{ "STRD_ROBOT_TRADED", "s'han canviat %d fitxes." },
{ "STR_ROBOT_TITLE", "Punts del robot" },
/* The end of 4.0.5's strings */
{ "STR_PICK_BLANK", "Tria la fitxa per l'escarràs." },
#ifdef FEATURE_TRAY_EDIT
{ "STRS_PICK_TILE", "Tria una nova fitxa per %s." },
#endif
#ifdef NODE_CAN_4
{ "STR_CONFIRM_CONVERTDICT", "Vols convertir els diccionaris de Crosswords " \
"al nou format? " \
"El canvi no és reversible." },
{ "STRS_CONFIRM_ONEDICT", "Convertir el diccionari %s?" },
#endif
{ "STRS_CANNOT_FIND_DICT", "%s dictionary not found." }, /* translate */
{ "STR_DICT_COPY_EXPL", "Copying dictionary from card..." },/* translate */

View file

@ -1,138 +0,0 @@
/* -*- mode: c; -*- */
/*
* Copyright 1997 - 2002 by Eric House (xwords@eehouse.org) and others. 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 table is where English user-visible strings come from (all
* strings meant to wind up in a str# resource, actually. Each entry
* is a pair of strings, first the constant name and then the string
* itself. The build system creats a str# resource with the latter
* and generates a .h file of #defines using the former. */
{ "STR_COMMIT_CONFIRM", "¿Aceptas la jugada?\n\n" },
{ "STR_NOT_YOUR_TURN", "¡No puedes hacer eso; no es tu turno!" },
{ "STR_NO_PEEK_ROBOT_TILES", "¡No mires las fichas de la máquina!" },
#ifndef XWFEATURE_STANDALONE_ONLY
{ "STR_NO_PEEK_REMOTE_TILES", "¡No mires las fichas de los demás!" },
{ "STR_SERVER_DICT_WINS", "Conflicto entre diccionarios: manda el del servidor." },
{ "STR_REG_UNEXPECTED_USER", "Jugador inesperado: no se acepta" },
{ "STR_RESEND_IR", "Error enviando el mensaje; ¿reenviar" },
#endif
{ "STR_TOO_FEW_TILES", "Ho quedan tantas fichas." },
{ "STR_CANT_UNDO_TILEASSIGN", "El reparto de fichas no puede deshacerse." },
{ "STR_VALUES_TITLE", "Counts and Values" }, /* translate */
{ "STR_REMAINS_TITLE","Remaining tiles" }, /* translate */
{ "STRS_VALUES_HEADER", "%s counts/values:\n" }, /* translate */
{ "STR_DOUBLE_LETTER", "Doble de letra" },
{ "STR_DOUBLE_WORD", "Doble de palabra" },
{ "STR_TRIPLE_LETTER", "Triple de letra" },
{ "STR_TRIPLE_WORD", "Triple de palabra" },
{ "STR_REMTILES", "Hay:%d" },
{ "STR_CANT_TRADE_MIDTURN", "Aún tienes fichas en el tablero."},
{ "STR_ASK_REPLACE_GAME", "¿Quieres sobreescribir la partida?" },
{ "STR_OK", "Ok" }, /* translate */
{ "STR_ABOUT_TITLE", "Acerca de Crosswords" },
{ "STR_DEFAULT_NAME", "Jugador %d" },
{ "STR_ABOUT_CONTENT",
"Crosswords " XW_PALM_VERSION_STRING " (rev. " SVN_REV ").\n" \
"Copyright 1998-2004 by Eric House. "\
"Todos los derechos reservados.\n\n"\
"El manual está en xwords.sourceforge.net\n\n" \
"Este programa es postalware.\nSi lo usas " \
"manda una postal a:\n" \
"The Houses\n" \
"1610 NW 14th Place\n" \
"Corvallis, OR 97330 USA\n\n"
"Escrito sobre Debian GNU/Linux usando las prc-tools.\n\n"\
"Versión española por F. Xavier Gil\n(setimig@wanadooadsl.net)." \
},
{ "STR_CONFIRM_END_GAME", "¿Seguro que quieres terminar la partida?"},
{ "STR_CONFIRM_TRADE", "¿Seguro que quieres usar tu turno " \
"para cambiar fichas?" },
{ "STR_TRADING_REMINDER", "Pulsa D para terminar." },
#ifndef NO_REG_REQUIRED
{ "STR_NOT_UNREG_VERS", "Sólo funciona en la versión registrada." },
#endif
{ "STR_LOCAL_NAME", "%s" },
{ "STR_NONLOCAL_NAME", "%s (remoto)" },
{ "STRSD_SUMMARYSCORED", "%s: %d" },
{ "STRD_TRADED", "Cambiadas: %d" },
{ "STR_PASSED", "Ha pasado" },
{ "STR_LOSTTURN", "Turno perdido" },
{ "STR_HISTORY_TITLE", "Jugadas" },
{ "STRD_REMAINING_TILES_ADD", "+ %d [fichas sobrantes]" },
{ "STRD_UNUSED_TILES_SUB", "- %d [fichas no usadas]" },
{ "STR_BONUS_ALL", "Por usar las siete fichas: 50\n" },
{ "STRD_TURN_SCORE", "Parcial de la jugada: %d\n" },
{ "STR_ALL_IN_LINE_ERR", "Las fichas no están en línea." },
{ "STR_NO_EMPTIES_ERR", "Las fichas deben tocarse." },
{ "STR_FIRST_MOVE_ERR", "Debes usar dos o más fichas en " \
"la primera jugada." },
/* phony comment to get diff back in sync */
{ "STR_MUST_CONTACT_ERR", "Las fichas deben tocar otras (o el " \
"cuadrado central en la primera jugada)." },
{ "STR_PTS", "Puntos:" },
{ "STR_CONFIRM_DEL_GAME", "¿Seguro que quieres borrarla?" },
{ "STRD_TIME_PENALTY_SUB", " - %d [por tiempo]" },
{ "STR_NO_DICT_INSTALLED", "Crosswords necesita algún diccionario." },
{ "STR_ILLEGAL_WORD", "¡Ei!, %s no está en el diccionario." },
{ "STR_FINAL_SCORES_TITLE", "Puntuación final"},
/* another phony comment to get diff back in sync */
{ "STRD_CUMULATIVE_SCORE", "Acumulado: %d\n" },
{ "STRS_TRAY_AT_START", "Atril inicial: %s\n" },
{ "STRS_MOVE_ACROSS", "jugada (%s, horizontal)\n" },
{ "STRS_MOVE_DOWN", "jugada (%s, vertical)\n" },
{ "STRS_NEW_TILES", "Nuevas fichas: %s\n" },
{ "STRSS_TRADED_FOR", "Cambio de %s por %s." },
{ "STR_PASS", "pasa\n" },
{ "STR_PHONY_REJECTED", "Palabra incorrecta; ¡turno perdido!\n" },
{ "STR_ROBOT_MOVED", "El robot ha jugado:\n" },
{ "STR_REMOTE_MOVED", "Un jugador remoto ha jugado:\n" },
{ "STRD_ROBOT_TRADED", "%d fichas canviadas." },
{ "STR_ROBOT_TITLE", "Puntos del robot" },
/* The end of 4.0.5's strings */
{ "STR_PICK_BLANK", "Escoge una ficha para el comodín." },
#ifdef FEATURE_TRAY_EDIT
{ "STRS_PICK_TILE", "Escoge una nueva ficha para %s." },
#endif
#ifdef NODE_CAN_4
{ "STR_CONFIRM_CONVERTDICT", "¿Quieres convertir los diccionarios de Crosswords " \
"al nuevo formato? " \
"El cambio no es reversible." },
{ "STRS_CONFIRM_ONEDICT", "¿Convertir el diccionario %s?" },
#endif
{ "STRS_CANNOT_FIND_DICT", "%s dictionary not found." }, /* translate */
{ "STR_DICT_COPY_EXPL", "Copying dictionary from card..." },/* translate */

View file

@ -1,185 +0,0 @@
/* -*- mode: c; compile-command: "cd .. && make ARCH=68K_ONLY MEMDEBUG=TRUE LANG=fr_FR"; -*- */
/*
* Copyright 1997 - 2008 by Eric House (xwords@eehouse.org) and
* others. All rights reserved. Traduction en français par Francis H.
*
* Ce programm est libre de droits ; Vous pouvez le distribuer et/ou
* le modifier en respectant les termes de la licence GNU General
* Public ainsi qu'elle est publiée par la Free Software Foundation;
* que ce soit la version 2 de la Licence, ou (selon votre option),
* toute version ultérieure.
*
* Ce programme est distribué avec l'intention qu'il soit utilisé,
* mais SANS AUCUNE GARANTIE; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Voir la
* Licence GNU General Public pour plus de détails.
*
* Vous devriez avoir reçu une copie de la Licence GNU General Public
* avec ce programme ; si ce n'est pas le cas, écrivez à "Free
* Software Foundation", Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
/* This table is where French user-visible strings come from (all
* strings meant to wind up in a str# resource, actually.) Each entry
* is a pair of strings, first the constant name and then the string
* itself. The build system creats a str# resource with the latter
* and generates a .h file of #defines using the former. */
{ "STR_COMMIT_CONFIRM", "Confirmez-vous le coup actuel ?\n" },
{ "STR_NOT_YOUR_TURN", "Impossible ; ce n'est pas votre tour !" },
{ "STR_NO_PEEK_ROBOT_TILES", "Ne cherchez pas à voir les lettres du robot !" },
#ifndef XWFEATURE_STANDALONE_ONLY
{ "STR_NO_PEEK_REMOTE_TILES", "Ne cherchez pas à voir les lettres des autres !" },
{ "STR_SERVER_DICT_WINS",
"Conflit entre les dictionnaires Hôte et Invité ; l'hôte gagne." },
{ "STR_REG_UNEXPECTED_USER", "Essai refusé de l'enregistrement de l'utilisateur" },
{ "STR_REG_NEED_REMOTE", "Svp contactez un ou plusieurs joueurs qd vous "
"jouez comme Hôte." },
{ "STR_REG_BT_NEED_HOST", "Svp, localisez l'organiseur qd Crossxords joue "
"comme Hôte." },
{ "STR_RESEND_STANDALONE", "C'est une partie en solo. Il n'y a rien "
"à renvoyer." },
#endif
{ "STR_TOO_FEW_TILES", "Pas assez de lettres pour échanger." },
{ "STR_CANT_UNDO_TILEASSIGN", "Impossible d'annuler. (Le tirage initial ne peut être annulé.)" },
/* translate me */
{ "STR_CANT_HINT_WHILE_DISABLED", "The hint feature is disabled for this "
"game. Enable it for a new game using the "
"Preferences dialog." },
{ "STR_VALUES_TITLE", "Nombres et Valeurs" },
{ "STR_REMAINS_TITLE","Lettres restantes" },
{ "STRS_VALUES_HEADER", "%s nombres/valeurs :\n" },
{ "STR_DOUBLE_LETTER", "Double lettre" },
{ "STR_DOUBLE_WORD", "Double mot" },
{ "STR_TRIPLE_LETTER", "Triple lettre" },
{ "STR_TRIPLE_WORD", "Triple mot" },
{ "STR_REMTILES", "rst:%d" },
{ "STR_CANT_TRADE_MIDTURN", "Enlevez les lettres jouées avant d'échanger."},
{ "STR_ASK_REPLACE_GAME", "Voulez-vous remplacer la partie en cours ?" },
{ "STR_OK", "Ok" },
{ "STR_ABOUT_TITLE", "Au sujet de Crosswords" },
{ "STR_DEFAULT_NAME", "Joueur %d" },
{ "STR_CONFIRM_END_GAME", "Etes-vous sûr de vouloir arrêter la partie maintenant ?"},
{ "STR_CONFIRM_TRADE", "Etes-vous sûr de de vouloir échanger " \
"vos lettres ?" },
{ "STR_TRADING_REMINDER", "Cliquez D une fois fini." },
{ "STR_LOCAL_NAME", "%s" },
{ "STR_NONLOCAL_NAME", "%s (autre)" },
{ "STRSD_SUMMARYSCORED", "%s:%d" },
{ "STRD_TRADED", "Echangé %d" },
{ "STR_PASSED", "Passé" },
{ "STR_LOSTTURN", "Tour perdu" },
{ "STR_HISTORY_TITLE", "Historique de la partie" },
{ "STRD_REMAINING_TILES_ADD", "+ %d [toutes lettres restantes]" },
{ "STRD_UNUSED_TILES_SUB", "- %d [lettres inutilisées]" },
{ "STR_BONUS_ALL", "Bonus pour placement toutes les lettres : 50\n" },
{ "STRD_TURN_SCORE", "Score après ce tour : %d\n" },
{ "STR_ALL_IN_LINE_ERR", "Toutes les lettres doivent être placées sur une même ligne." },
{ "STR_NO_EMPTIES_ERR", "Des cases vides ne peuvent séparer les lettres jouées." },
{ "STR_FIRST_MOVE_ERR", "Vous devez placer au moins deux lettres " \
"lors du 1er coup." },
/* phony comment to get diff back in sync */
{ "STR_MUST_CONTACT_ERR", "Les nouvelles lettres doivent être au contact de celles " \
"déjà en place (ou sur la case centrale lors du " \
"premier coup)." },
{ "STR_PTS", "Pts :" },
{ "STR_CONFIRM_DEL_GAME", "Supprimer vraiment la partie sélectionnée ?" },
{ "STRD_TIME_PENALTY_SUB", " - %d [temps]" },
{ "STR_NO_DICT_INSTALLED", "Crosswords 4 nécessite au minimum un dictionnaire." \
"Téléchargez-en un ou plus sur xwords.sf.net." },
{ "STR_ILLEGAL_WORD", "Mot[s] %s non trouvé(s) dans le dictionnaire. L'utiliser quand même ?" },
{ "STR_FINAL_SCORES_TITLE", "Score final"},
/* another phony comment to get diff back in sync */
{ "STRD_CUMULATIVE_SCORE", "Score cumulé : %d\n" },
{ "STRS_TRAY_AT_START", "tableau au départ : %s\n" },
{ "STRS_MOVE_ACROSS", "coup (depuis %s horizontal)\n" },
{ "STRS_MOVE_DOWN", "coup (depuis %s vertical)\n" },
{ "STRS_NEW_TILES", "Nouvelles lettres : %s\n" },
{ "STRSS_TRADED_FOR", "Echange %s pour %s." },
{ "STR_PASS", "passé\n" },
{ "STR_PHONY_REJECTED", "Mot incorrect ; tour perdu !\n" },
{ "STR_ROBOT_MOVED", "Le robot a joué ce coup :\n" },
{ "STR_REMOTE_MOVED", "Le joueur Remote player a joué ce coup :\n" },
{ "STRD_ROBOT_TRADED", "%d lettres changées ce coup." },
{ "STR_ROBOT_TITLE", "Score du robot" },
/* The end of 4.0.5's strings */
{ "STR_PICK_BLANK", "Choisir la lettre en échange de la case blanche." },
#ifdef FEATURE_TRAY_EDIT
{ "STRS_PICK_TILE", "Choisir une nouvelle lettre pour %s." },
{ "STR_PICK_TILE_CUR", "En cours" },
#endif
#ifdef NODE_CAN_4
{ "STR_CONFIRM_CONVERTDICT", "Voulez-vous convertir les dictionnaires Crosswords " \
"existants au nouveau format? " \
"Le changement est irréversible." },
{ "STRS_CONFIRM_ONEDICT", "Convertir dictionnaire %s?" },
#endif
{ "STRS_CANNOT_FIND_DICT", "%s dictionnaire non trouvé." },
{ "STR_DICT_COPY_EXPL", "Copier dictionnaire depuis la carte..." },
{ "STR_LOCALPLAYERS", "Joueurs loc." },
{ "STR_TOTALPLAYERS", "Total joueurs" },
#ifdef XWFEATURE_RELAY
{ "STR_RELAY_XPORTNAME", "Internet" },
{ "STR_RELAY_TIMEOUT", "Erreur réseau : les autres joueurs n'ont pu "
"se connecter." },
{ "STR_RELAY_LOST_OTHER", "Erreur réseau : la connexion d'un autre joueur "
"s'est arrêtée." },
{ "STR_RELAY_GENERIC", "Erreur réseau : quelque chose ne fonctionne pas." },
#endif
#ifdef XWFEATURE_BLUETOOTH
{ "STR_BT_XPORTNAME", "Bluetooth" },
{ "STR_BT_NOINIT", "Impossible initialiser Bluetooth. "
"Est-il connecté ?" },
{ "STRS_BT_CONFIRM", "Crosswords est-il en marche sur %s "
"et est-il prêt à recevoir une connexion ? "
"(Si vous choisissez \"Non\", Crosswords "
"n'essayera pas de se connecter jusqu'à ce "
"que vous le redémarriez ou choisissiez "
"\"Renvoyer\" dans le menu.)" },
#endif
#ifdef XWFEATURE_IR
{ "STR_IR_XPORTNAME", "Transmission" },
#endif
{ "STR_ABOUT_CONTENT",
/* #ifdef XWFEATURE_BLUETOOTH */
/* "MERCI DE VOTRE ATTENTION pour cette version beta de " */
/* "Crosswords. Svp, regardez les notes et avertissements sur " */
/* "xwords.sf.net/bt_palm.php. Svp, signalez les bugs à " */
/* "xwords@eehouse.org. Au plaisir !\n\n" */
/* #endif */
"Crosswords " XW_PALM_VERSION_STRING " (rev. " SVN_REV ").\n" \
"Copyright 1998-2008 par Eric House. "\
"Réalisé sous GNU Public License.\n\n"\
"Voir le manuel sur xwords.sf.net ou eehouse.org/xwords/.\n\n" \
"Ce programme est 'postcardware'. Si vous l'appréciez, " \
"svp, envoyez une carte postale à :\n" \
"The Houses\n" \
"1610 NW 14th Place\n" \
"Corvallis, OR 97330 USA\n\n"
"Developpé sur Debian GNU/Linux avec the prc-tools "\
"suite.\n\n"\
"Traduction par Francis H."
},

View file

@ -1,78 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/****************************************************************************
* *
* Copyright 1998-2000 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.
****************************************************************************/
/*
* Turn a table of string pairs into a resource file of back-to-back strings
* and an includable .h file of constants giving indices into the res file.
*
* Expects the name of the former in argv[1] and of the latter in argv[2].
*/
#include <stdio.h>
#include <string.h>
#include "xwords4defines.h"
#define FIRST_STR_INDEX 2000
typedef struct StringPair {
char* constName;
char* theString;
} StringPair;
static StringPair table[] = {
// I'm expecting this as a -D option
#include LANGSTRFILE
{ (char*)0L, (char*)0L }
};
int
main( int argc, char** argv )
{
FILE* stringResFile = fopen( argv[1], "wb" );
FILE* stringConstFile = fopen( argv[2], "w" );
StringPair* sp = table;
short count;
fprintf( stringConstFile,
"/***********************************************************\n"
"* This file is machine generated.\n"
"* Don't edit: your changes will be lost.\n"
"************************************************************/\n");
fprintf( stringConstFile, "\n#define FIRST_STR_INDEX %d\n\n",
FIRST_STR_INDEX );
count = 0;
for ( ; sp->constName != NULL && sp->theString != NULL; ++sp ) {
short strBytes;
strBytes = strlen(sp->theString)+1;
fwrite( sp->theString, strBytes, 1, stringResFile );
fprintf( stringConstFile, "#define %s %d\n", sp->constName, count );
count += strBytes;
}
fprintf( stringConstFile, "#define %s %d\n", "STR_LAST_STRING", count );
fclose( stringResFile );
fclose( stringConstFile );
return 0;
} // main

View file

@ -1,621 +0,0 @@
/* -*-mode: c; fill-column: 78; compile-command: "cd ../ && make ARCH=68K_ONLY MEMDEBUG=TRUE"; -*- */
/*****************************************************************************
* Copyright 1999 - 2006 by Eric House (xwords@eehouse.org) and others. 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.
****************************************************************************/
#define DEFINES_ONLY 1
#include "xwords4defines.h"
#define LEFTMARGIN 5
MENU XW_MAIN_MENU_ID
BEGIN
PULLDOWN "File"
BEGIN
MENUITEM "New game..." XW_NEWGAME_PULLDOWN_ID "N"
MENUITEM "Saved games..." XW_SAVEDGAMES_PULLDOWN_ID "S"
MENUITEM "Preferences..." XW_PREFS_PULLDOWN_ID "P"
MENUITEM SEPARATOR
MENUITEM "Beam dictionary" XW_BEAMDICT_PULLDOWN_ID
MENUITEM "Beam boards and colors" XW_BEAMBOARD_PULLDOWN_ID
#ifdef FEATURE_DUALCHOOSE
MENUITEM SEPARATOR
MENUITEM "Launch 68K vers." XW_RUN68K_PULLDOWN_ID
MENUITEM "Launch ARM vers." XW_RUNARM_PULLDOWN_ID
#endif
MENUITEM SEPARATOR
MENUITEM "About Crosswords..." XW_ABOUT_PULLDOWN_ID "A"
END
PULLDOWN "Game"
BEGIN
MENUITEM "Tile values" XW_TILEVALUES_PULLDOWN_ID "V"
MENUITEM "Remaining tiles" XW_TILESLEFT_PULLDOWN_ID "R"
MENUITEM "Current game info..." XW_PASSWORDS_PULLDOWN_ID "G"
MENUITEM "History" XW_HISTORY_PULLDOWN_ID "Y"
MENUITEM "Final scores" XW_FINISH_PULLDOWN_ID "F"
#ifndef XWFEATURE_STANDALONE_ONLY
MENUITEM SEPARATOR
MENUITEM "Resend" XW_RESENDIR_PULLDOWN_ID
#endif
END
PULLDOWN "Move"
BEGIN
MENUITEM "Hint" XW_HINT_PULLDOWN_ID "I"
#ifdef XWFEATURE_SEARCHLIMIT
MENUITEM "Limited hint" XW_HINTCONFIG_PULLDOWN_ID "C"
MENUITEM SEPARATOR
#endif
MENUITEM "Next hint" XW_NEXTHINT_PULLDOWN_ID "M"
MENUITEM SEPARATOR
MENUITEM "Undo current" XW_UNDOCUR_PULLDOWN_ID "U"
MENUITEM "Undo last" XW_UNDOLAST_PULLDOWN_ID "Z"
MENUITEM SEPARATOR
MENUITEM "Done" XW_DONE_PULLDOWN_ID "D"
MENUITEM "Juggle" XW_JUGGLE_PULLDOWN_ID "J"
MENUITEM "Trade tiles" XW_TRADEIN_PULLDOWN_ID "T"
MENUITEM "[un]Hide tray" XW_HIDESHOWTRAY_PULLDOWN_ID "H"
END
#ifdef FOR_GREMLINS
PULLDOWN "Grem"
BEGIN
MENUITEM "divider right" XW_GREMLIN_DIVIDER_RIGHT
MENUITEM "divider left" XW_GREMLIN_DIVIDER_LEFT
END
#endif
#ifndef FOR_GREMLINS
#ifdef DEBUG
PULLDOWN "DBG"
BEGIN
MENUITEM "Log to file" XW_LOGFILE_PULLDOWN_ID
MENUITEM "Log to memo" XW_LOGMEMO_PULLDOWN_ID
MENUITEM "Clear logs" XW_CLEARLOGS_PULLDOWN_ID
MENUITEM "Network stats..." XW_NETSTATS_PULLDOWN_ID
#ifdef DEBUG
MENUITEM "BT stats..." XW_BTSTATS_PULLDOWN_ID
#endif
#ifdef MEM_DEBUG
MENUITEM "Mem stats..." XW_MEMSTATS_PULLDOWN_ID
#endif
END
#endif
#endif /* FOR_GREMLINS */
END
MENU XW_ASK_MENU_ID
BEGIN
PULLDOWN "Edit"
BEGIN
MENUITEM "Copy" ASK_COPY_PULLDOWN_ID
MENUITEM "Select all" ASK_SELECTALL_PULLDOWN_ID
END
END
#include "common.rcp.pre" /* these don't need localization */
#ifdef XWFEATURE_STANDALONE_ONLY
# define NPLAYERS_TOP 15
# define FORM_TOP 34
# define FORM_HEIGHT 124
#else
# define SERVER_TOP 15
# define NPLAYERS_TOP (SERVER_TOP+18)
# define FORM_TOP 16
# define FORM_HEIGHT 142
#endif
#define LABEL_TOP (NPLAYERS_TOP+18)
#define LEFTCOL 4
#define REMOTE_COL LEFTCOL
#define NAME_COL 50
#define ROBOT_COL 98
#define PASSWD_COL RIGHT@156
#ifndef XWFEATURE_STANDALONE_ONLY
#define PLAYER_REMOTECHECK( num, offset ) \
CHECKBOX "" ID XW_REMOTE_##num##_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+offset AUTO AUTO) USABLE
#else
#define PLAYER_REMOTECHECK( num, offset )
#endif
#ifndef XWFEATURE_STANDALONE_ONLY
#define PLAYER_NAMEFIELD( num, offset ) \
FIELD XW_PLAYERNAME_##num##_FIELD_ID \
AT (PREVRIGHT PREVTOP 100 AUTO ) \
UNDERLINED EDITABLE SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
#else
#define PLAYER_NAMEFIELD( num, offset ) \
FIELD XW_PLAYERNAME_##num##_FIELD_ID \
AT (LEFTCOL+10 PREVBOTTOM+offset 100 AUTO ) \
UNDERLINED EDITABLE SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
#endif
#define PLAYER_ROBCHECK( num, offset ) \
CHECKBOX "" ID XW_ROBOT_##num##_CHECKBOX_ID \
AT (PREVRIGHT PREVTOP AUTO AUTO) USABLE RIGHTANCHOR
#define PLAYER_PASSFIELD( num, offset ) \
SELECTORTRIGGER "" XW_PLAYERPASSWD_##num##_TRIGGER_ID \
AT (PREVRIGHT PREVTOP 12 11)
/* FIELD XW_PLAYERPASSWD_##num##_FIELD_ID PREVRIGHT PREVTOP 20 \ */
/* AUTO UNDERLINED EDITABLE SINGLELINE MAXCHARS 4 */
#define PLAYER_ROW( num, offset ) \
PLAYER_REMOTECHECK( num, offset ) \
PLAYER_NAMEFIELD( num, offset ) \
PLAYER_ROBCHECK( num, offset ) \
PLAYER_PASSFIELD( num, offset )
#define PLAYER_ROW_ID( num ) \
ID XW_REMOTE_##num##_CHECKBOX_ID \
ID XW_PLAYERNAME_##num##_FIELD_ID \
ID XW_ROBOT_##num##_CHECKBOX_ID \
ID XW_PLAYERPASSWD_##num##_TRIGGER_ID \
#define PLAYER_ROW_NAV( num ) \
ROW XW_REMOTE_##num##_CHECKBOX_ID \
ROW XW_PLAYERNAME_##num##_FIELD_ID \
XW_ROBOT_##num##_CHECKBOX_ID \
XW_PLAYERPASSWD_##num##_TRIGGER_ID \
//#define SERVER_GROUP_ID 2000
#define SERVER_HEIGHT 12
FORM ID XW_NEWGAMES_FORM AT (2 FORM_TOP 156 FORM_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_CANCEL_BUTTON_ID
BEGIN
TITLE "Game options"
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Connect:" AUTOID AT (LEFTCOL SERVER_TOP)
GADGET ID XW_SOLO_GADGET_ID
AT (PREVRIGHT+2 SERVER_TOP 55 SERVER_HEIGHT) USABLE
GADGET ID XW_SERVER_GADGET_ID
AT (PREVRIGHT+1 SERVER_TOP 24 SERVER_HEIGHT) USABLE
GADGET ID XW_CLIENT_GADGET_ID
AT (PREVRIGHT+1 SERVER_TOP 30 SERVER_HEIGHT) USABLE
LIST "Stand-alone" "Host" "Guest" XW_SERVERTYPES_LIST_ID
AT (0 0 1 1) VISIBLEITEMS 3 NONUSABLE
#endif
/* Pick number of players here */
FIELD XW_TOTALP_FIELD_ID LEFTCOL NPLAYERS_TOP 58 AUTO \
SINGLELINE NONEDITABLE MAXCHARS 16
SELECTORTRIGGER "" XW_NPLAYERS_SELECTOR_ID \
AT (PREVRIGHT NPLAYERS_TOP AUTO AUTO) USABLE LEFTANCHOR
LIST "1" "2" "3" "4" XW_NPLAYERS_LIST_ID AT (PREVLEFT PREVTOP 10 1) \
VISIBLEITEMS 4 NONUSABLE
BUTTON "J" XW_GINFO_JUGGLE_ID PREVRIGHT+3 PREVTOP 10 AUTO
BUTTON "Other prefs..." XW_PREFS_BUTTON_ID PREVRIGHT+5 PREVTOP 63 AUTO
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Remote" XW_LOCAL_LABEL_ID REMOTE_COL LABEL_TOP FONT 1
#endif
LABEL "Name" AUTOID NAME_COL LABEL_TOP FONT 1
LABEL "Robot" AUTOID ROBOT_COL LABEL_TOP FONT 1
LABEL "Pwd" AUTOID PASSWD_COL LABEL_TOP FONT 1
PLAYER_ROW( 1, 2 )
PLAYER_ROW( 2, 2 )
PLAYER_ROW( 3, 2 )
PLAYER_ROW( 4, 2 )
GRAFFITISTATEINDICATOR 2 PREVBOTTOM+10
SELECTORTRIGGER "Dictionary..." XW_DICT_SELECTOR_ID \
AT (PREVRIGHT+8 PREVTOP AUTO AUTO) USABLE LEFTANCHOR
BUTTON "Ok" XW_OK_BUTTON_ID RIGHT@154 PREVTOP AUTO AUTO
BUTTON "Cancel" XW_CANCEL_BUTTON_ID RIGHT@PREVLEFT-5 PREVTOP 30 AUTO
END /* XW_NEWGAMES_FORM */
#ifdef XWFEATURE_FIVEWAY
NAVIGATION ID XW_NEWGAMES_FORM
INITIALSTATE kFrmNavHeaderFlagsObjectFocusStartState
#if 0
BEGIN
ID XW_SOLO_GADGET_ID
ID XW_SERVER_GADGET_ID
ID XW_CLIENT_GADGET_ID
ID XW_NPLAYERS_SELECTOR_ID
ID XW_GINFO_JUGGLE_ID
ID XW_PREFS_BUTTON_ID
PLAYER_ROW_ID( 1 )
PLAYER_ROW_ID( 2 )
PLAYER_ROW_ID( 3 )
PLAYER_ROW_ID( 4 )
ID XW_DICT_SELECTOR_ID
ID XW_CANCEL_BUTTON_ID
ID XW_OK_BUTTON_ID
#else
NAVIGATIONMAP
#ifndef XWFEATURE_STANDALONE_ONLY
ROW XW_SOLO_GADGET_ID
XW_SERVER_GADGET_ID
XW_CLIENT_GADGET_ID
#endif
ROW XW_NPLAYERS_SELECTOR_ID
XW_GINFO_JUGGLE_ID
XW_PREFS_BUTTON_ID
PLAYER_ROW_NAV( 1 )
PLAYER_ROW_NAV( 2 )
PLAYER_ROW_NAV( 3 )
PLAYER_ROW_NAV( 4 )
ROW XW_DICT_SELECTOR_ID
XW_CANCEL_BUTTON_ID
XW_OK_BUTTON_ID
#endif
END /* NAVIGATION ID XW_NEWGAMES_FORM */
#endif
#ifdef XWFEATURE_BLUETOOTH
/* Let's define this in one place so it stays the same */
# define BT_CONF_STRING "Ask before connecting Bluetooth"
#endif
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH || defined XWFEATURE_IR
#define LEFTCOL 4
#define CONNS_FIELD_LEFT 70
#define LOCALIP_TOP 30
FORM ID XW_CONNS_FORM AT (2 66 156 93)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_CONNS_CANCEL_BUTTON_ID
BEGIN
TITLE "Connections"
LABEL "Connect via:" AUTOID LEFTCOL 15 FONT 1
POPUPTRIGGER "" ID XW_CONNS_TYPE_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LIST
"" ID XW_CONNS_TYPE_LIST_ID
PREVLEFT PREVTOP 72 12 VISIBLEITEMS 2
NONUSABLE POPUPLIST XW_CONNS_TYPE_TRIGGER_ID XW_CONNS_TYPE_LIST_ID
#ifdef XWFEATURE_BLUETOOTH
LABEL "Host device:" XW_CONNS_BT_HOSTNAME_LABEL_ID
AT ( LEFTCOL LOCALIP_TOP+5 ) NONUSABLE
SELECTORTRIGGER "Find host..." XW_CONNS_BT_HOSTTRIGGER_ID \
AT (CONNS_FIELD_LEFT PREVTOP 70 AUTO) NONUSABLE LEFTANCHOR
CHECKBOX BT_CONF_STRING ID XW_CONNS_BTCONFIRM_CHECKBOX_ID \
AT ( LEFTCOL LOCALIP_TOP+21 AUTO AUTO ) NONUSABLE
#endif
/* Relay... */
#ifdef XWFEATURE_RELAY
LABEL "Room:" XW_CONNS_INVITE_LABEL_ID
AT ( LEFTCOL LOCALIP_TOP )
FIELD XW_CONNS_INVITE_FIELD_ID CONNS_FIELD_LEFT PREVTOP 70 AUTO \
SINGLELINE EDITABLE UNDERLINED MAXCHARS 32
LABEL "Relay name:" XW_CONNS_RELAY_LABEL_ID
AT ( LEFTCOL+10 PREVBOTTOM + 2 )
FIELD XW_CONNS_RELAY_FIELD_ID CONNS_FIELD_LEFT PREVTOP 70 AUTO \
SINGLELINE EDITABLE UNDERLINED MAXCHARS 32
LABEL "Relay port:" XW_CONNS_PORT_LABEL_ID
AT (LEFTCOL+10 PREVBOTTOM + 2)
FIELD XW_CONNS_PORT_FIELD_ID CONNS_FIELD_LEFT PREVTOP 30 AUTO \
EDITABLE SINGLELINE UNDERLINED NUMERIC MAXCHARS 5
#endif
BUTTON "Cancel" XW_CONNS_CANCEL_BUTTON_ID 42 75 AUTO AUTO
BUTTON "Ok" XW_CONNS_OK_BUTTON_ID PREVRIGHT+10 PREVTOP AUTO AUTO
END /* XW_CONNS_FORM */
#endif
#ifdef FEATURE_TRAY_EDIT
# define TRAY_EDIT_ADJUST 15
#else
# define TRAY_EDIT_ADJUST 0
#endif
#ifdef XWFEATURE_SEARCHLIMIT
# define SEARCHLIMIT_ADJUST 15
#else
# define SEARCHLIMIT_ADJUST 0
#endif
#ifdef XWFEATURE_BLUETOOTH
# define BTCONF_ADJUST PREFS_SPACING
#else
# define BTCONF_ADJUST 0
#endif
#define PREFS_MODE_TOP 15
#define PREFS_ROW1 30
#define PREFS_SPACING 15
/* #define DLG_TOP (52-TRAY_EDIT_ADJUST-SEARCHLIMIT_ADJUST) */
#define DLG_HEIGHT (112+TRAY_EDIT_ADJUST+SEARCHLIMIT_ADJUST+BTCONF_ADJUST)
#define DLG_TOP (160 - DLG_HEIGHT - 2)
#define TIMER_TOP (74+SEARCHLIMIT_ADJUST)
#define BTCONF_TOP (TIMER_TOP+18+TRAY_EDIT_ADJUST)
#define BUTTON_TOP (BTCONF_TOP + PREFS_SPACING)
#define PREFS_LNHT 4
FORM ID XW_PREFS_FORM AT (2 DLG_TOP 156 DLG_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_PREFS_CANCEL_BUTTON_ID
BEGIN
TITLE "Preferences"
GADGET ID XW_PREFS_ALLGAMES_GADGET_ID
AT (LEFTCOL+8 PREFS_MODE_TOP 60 SERVER_HEIGHT) USABLE
GADGET ID XW_PREFS_ONEGAME_GADGET_ID
AT (PREVRIGHT+1 PREVTOP 60 SERVER_HEIGHT) USABLE
LIST "All games" "This game" XW_PREFS_TYPES_LIST_ID
AT (0 0 1 1) VISIBLEITEMS 2 NONUSABLE
/* global prefs */
CHECKBOX "Color played tiles" ID XW_PREFS_PLAYERCOLORS_CHECKBOX_ID \
AT (LEFTCOL PREFS_ROW1 AUTO AUTO) NONUSABLE
CHECKBOX "Show progress bar" ID XW_PREFS_PROGRESSBAR_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Larger board" ID XW_PREFS_SHOWGRID_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Enable arrow cursor" ID XW_PREFS_SHOWARROW_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Explain robot/remote scores" ID XW_PREFS_ROBOTSCORE_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Hide tile values" ID XW_PREFS_HIDETRAYVAL_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
/* single-game prefs */
CHECKBOX "Smart robot" ID XW_PREFS_ROBOTSMART_CHECKBOX_ID \
AT (LEFTCOL PREFS_ROW1 AUTO AUTO) NONUSABLE
#ifdef XWFEATURE_SEARCHLIMIT
CHECKBOX "Disallow hints" ID XW_PREFS_NOHINTS_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Local hints" ID XW_PREFS_HINTRECT_CHECKBOX_ID \
AT (PREVRIGHT+3 PREVTOP AUTO AUTO) NONUSABLE
#else
CHECKBOX "Disallow hints" ID XW_PREFS_NOHINTS_CHECKBOX_ID \
AT (PREVRIGHT+3 PREFS_ROW1 AUTO AUTO) NONUSABLE
#endif
LABEL "Phonies:" XW_PREFS_PHONIES_LABEL_ID
AT (LEFTCOL PREVTOP+PREFS_SPACING)
POPUPTRIGGER "" ID XW_PREFS_PHONIES_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LABEL "Board size: " XW_PREFS_BDSIZE_LABEL_ID
AT (LEFTCOL PREVTOP+PREFS_SPACING)
SELECTORTRIGGER "" XW_PREFS_BDSIZE_SELECTOR_ID \
AT (PREVRIGHT PREVTOP AUTO AUTO) USABLE LEFTANCHOR
LIST "Ignore" "Warn" "Disallow" ID XW_PREFS_PHONIES_LIST_ID
AT (PREVLEFT PREVTOP 72 12) NONUSABLE VISIBLEITEMS 3
POPUPLIST XW_PREFS_PHONIES_TRIGGER_ID XW_PREFS_PHONIES_LIST_ID
LIST "15x15" "13x13" "11x11" \
XW_PREFS_BDSIZE_LIST_ID AT (PREVLEFT PREVTOP 30 1) \
NONUSABLE VISIBLEITEMS NUM_BOARD_SIZES
CHECKBOX "Enable timer (minutes:)" ID XW_PREFS_TIMERON_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
FIELD XW_PREFS_TIMER_FIELD_ID PREVRIGHT+5 PREVTOP 15 AUTO UNDERLINED \
EDITABLE SINGLELINE NUMERIC MAXCHARS 3
#ifdef FEATURE_TRAY_EDIT
CHECKBOX "Pick tiles face-up" ID XW_PREFS_PICKTILES_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
#endif
#ifdef XWFEATURE_BLUETOOTH
CHECKBOX BT_CONF_STRING ID XW_PREFS_BTCONFIRM_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
#endif
/* buttons at the bottom */
BUTTON "Cancel" XW_PREFS_CANCEL_BUTTON_ID 42 BUTTON_TOP AUTO AUTO
BUTTON "Ok" XW_PREFS_OK_BUTTON_ID PREVRIGHT+10 PREVTOP AUTO AUTO
END /* XW_PREFS_FORM */
NAVIGATION ID XW_PREFS_FORM
INITIALSTATE kFrmNavHeaderFlagsObjectFocusStartState
INITIALOBJECTID XW_PREFS_ONEGAME_GADGET_ID
NAVIGATIONMAP
ROW XW_PREFS_ALLGAMES_GADGET_ID
XW_PREFS_ONEGAME_GADGET_ID
/* global prefs */
ROW XW_PREFS_PLAYERCOLORS_CHECKBOX_ID
ROW XW_PREFS_PROGRESSBAR_CHECKBOX_ID
ROW XW_PREFS_SHOWGRID_CHECKBOX_ID
ROW XW_PREFS_SHOWARROW_CHECKBOX_ID
ROW XW_PREFS_ROBOTSCORE_CHECKBOX_ID
ROW XW_PREFS_HIDETRAYVAL_CHECKBOX_ID
/* Per-game prefs */
ROW XW_PREFS_ROBOTSMART_CHECKBOX_ID
ROW XW_PREFS_NOHINTS_CHECKBOX_ID
#ifdef XWFEATURE_SEARCHLIMIT
XW_PREFS_HINTRECT_CHECKBOX_ID
#endif
ROW XW_PREFS_PHONIES_TRIGGER_ID
ROW XW_PREFS_BDSIZE_SELECTOR_ID
ROW XW_PREFS_TIMERON_CHECKBOX_ID
XW_PREFS_TIMER_FIELD_ID
#ifdef FEATURE_TRAY_EDIT
ROW XW_PREFS_PICKTILES_CHECKBOX_ID
#endif
#ifdef XWFEATURE_BLUETOOTH
ROW XW_PREFS_BTCONFIRM_CHECKBOX_ID
#endif
/* cmd buttons */
ROW XW_PREFS_CANCEL_BUTTON_ID
XW_PREFS_OK_BUTTON_ID
END
#define LEFT_EDGE 10
FORM ID XW_DICTINFO_FORM AT (2 111 156 47)
USABLE MODAL DEFAULTBTNID XW_DICTINFO_CANCEL_BUTTON_ID
BEGIN
TITLE "Dictionaries"
LABEL "Dict:" AUTOID AT (LEFT_EDGE 15)
POPUPTRIGGER "" ID XW_DICTINFO_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LIST "" ID XW_DICTINFO_LIST_ID AT (PREVLEFT PREVTOP 72 1)
NONUSABLE VISIBLEITEMS 4
POPUPLIST XW_DICTINFO_TRIGGER_ID XW_DICTINFO_LIST_ID
BUTTON "Ok" XW_DICTINFO_DONE_BUTTON_ID 25 31 AUTO AUTO
BUTTON "Beam" XW_DICTINFO_BEAM_BUTTON_ID 22 PREVTOP AUTO AUTO
BUTTON "Cancel" XW_DICTINFO_CANCEL_BUTTON_ID PREVRIGHT+20 PREVTOP
AUTO AUTO
END
FORM ID XW_ASK_FORM_ID AT (2 70 156 88)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_ASK_NO_BUTTON_ID
MENUID XW_ASK_MENU_ID
BEGIN
TITLE "Query"
/* This has to be non-editable because the field is set via a ptr */
FIELD XW_ASK_TXT_FIELD_ID LEFT_EDGE-5 16 135 52 \
NONEDITABLE MULTIPLELINES
SCROLLBAR ID XW_ASK_SCROLLBAR_ID
AT ( PREVRIGHT+2 PREVTOP RECOMMENDED_SBAR_WIDTH
PREVBOTTOM - PREVTOP) USABLE
BUTTON "Yes" XW_ASK_YES_BUTTON_ID RIGHT@(156/2)-20 PREVBOTTOM+5 AUTO AUTO
BUTTON "No" XW_ASK_NO_BUTTON_ID 156/2+20 PREVTOP AUTO AUTO
END
FORM ID XW_PASSWORD_DIALOG_ID AT ( 2 88 156 70 )
MODAL SAVEBEHIND DEFAULTBTNID XW_PASSWORD_CANCEL_BUTTON
BEGIN
TITLE "Password"
LABEL "Enter password for:" XW_PASSWORD_NAME_LABEL 10 18 FONT 1 NONUSABLE
LABEL "Enter new password for:" XW_PASSWORD_NEWNAME_LABEL 10 18 FONT 1
NONUSABLE
FIELD XW_PASSWORD_NAME_FIELD AT (PREVLEFT PREVBOTTOM+3 90 12) NONEDITABLE
SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
FIELD XW_PASSWORD_PASS_FIELD \
AT (PREVRIGHT+10 PREVTOP MAX_PASSWORD_LENGTH*6 12) \
EDITABLE SINGLELINE UNDERLINED MAXCHARS MAX_PASSWORD_LENGTH
GRAFFITISTATEINDICATOR 2 PREVBOTTOM+8
BUTTON "Ok" XW_PASSWORD_OK_BUTTON 45 PREVTOP AUTO AUTO
BUTTON "Cancel" XW_PASSWORD_CANCEL_BUTTON PREVRIGHT+10 PREVTOP AUTO AUTO
END
#define BLANK_PICK_TOP 15
FORM ID XW_BLANK_DIALOG_ID AT ( 2 74 156 83 ) USABLE
MODAL SAVEBEHIND
#ifdef FEATURE_TRAY_EDIT
DEFAULTBTNID XW_BLANK_PICK_BUTTON_ID
#endif
BEGIN
TITLE "Tile picker"
FIELD XW_BLANK_LABEL_FIELD_ID AT (10 BLANK_PICK_TOP 110 39)
NONEDITABLE MULTIPLELINES
LIST "" ID XW_BLANK_LIST_ID AT (PREVRIGHT+2 BLANK_PICK_TOP 28 72)
USABLE VISIBLEITEMS 6
BUTTON "Ok" XW_BLANK_OK_BUTTON_ID RIGHT@PREVLEFT-8 65 AUTO AUTO
#ifdef FEATURE_TRAY_EDIT
BUTTON "Pick all!" XW_BLANK_PICK_BUTTON_ID 5 65 AUTO AUTO
BUTTON "Del" XW_BLANK_BACKUP_BUTTON_ID PREVRIGHT+5 PREVTOP 22 AUTO
#endif
END
#ifdef XWFEATURE_SEARCHLIMIT
# define NTILES_TOP 17
# define NTILES_BUTTON_TOP 60
FORM ID XW_HINTCONFIG_FORM_ID AT ( 2 75 156 82 ) USABLE MODAL SAVEBEHIND
BEGIN
TITLE "Hint parameters"
LABEL "At least this many tiles:" AUTOID 10 NTILES_TOP FONT 1 USABLE
SELECTORTRIGGER "" XW_HINTCONFIG_MINSELECTOR_ID \
AT (PREVRIGHT+3 NTILES_TOP AUTO AUTO) USABLE LEFTANCHOR
LIST "1" "2" "3" "4" "5" "6" "7" ID XW_HINTCONFIG_MINLIST_ID
AT (PREVRIGHT PREVTOP AUTO AUTO) VISIBLEITEMS 7 NONUSABLE
LABEL "No more than this many:" AUTOID 10 PREVTOP+15 FONT 1 USABLE
SELECTORTRIGGER "" XW_HINTCONFIG_MAXSELECTOR_ID \
AT (PREVRIGHT+3 PREVTOP AUTO AUTO) USABLE LEFTANCHOR
LIST "1" "2" "3" "4" "5" "6" "7" ID XW_HINTCONFIG_MAXLIST_ID
AT (PREVRIGHT PREVTOP AUTO AUTO) VISIBLEITEMS 7 NONUSABLE
BUTTON "Ok" XW_HINTCONFIG_OK_ID RIGHT@156-10 NTILES_BUTTON_TOP AUTO 12
BUTTON "Cancel" XW_HINTCONFIG_CANCEL_ID RIGHT@PREVLEFT-10 PREVTOP AUTO 12
END
#endif
#if defined OWNER_HASH || defined NO_REG_REQUIRED
FORM ID XW_SAVEDGAMES_DIALOG_ID AT ( 2 2 156 156 )
USABLE MODAL DEFAULTBTNID XW_SAVEDGAMES_DONE_BUTTON
BEGIN
TITLE "Saved games"
LIST "" ID XW_SAVEDGAMES_LIST_ID AT (2 15 140 60) \
USABLE ENABLED VISIBLEITEMS 1
GRAFFITISTATEINDICATOR 2 120
FIELD XW_SAVEDGAMES_NAME_FIELD AT (PREVRIGHT+10 PREVTOP 100 AUTO)
EDITABLE SINGLELINE UNDERLINED MAXCHARS MAX_GAMENAME_LENGTH
BUTTON "Mod." XW_SAVEDGAMES_USE_BUTTON RIGHT@154 PREVTOP 30 AUTO
BUTTON "Dup." XW_SAVEDGAMES_DUPE_BUTTON 2 PREVBOTTOM+5 31 AUTO
BUTTON "Delete" XW_SAVEDGAMES_DELETE_BUTTON PREVRIGHT+5 PREVTOP 39 AUTO
BUTTON "Open" XW_SAVEDGAMES_OPEN_BUTTON PREVRIGHT+5 PREVTOP 33 AUTO
BUTTON "Done" XW_SAVEDGAMES_DONE_BUTTON PREVRIGHT+5 PREVTOP 33 AUTO
END /* XW_SAVEDGAMES_DIALOG_ID */
#endif
ALERT XW_ERROR_ALERT_ID
ERROR
BEGIN
TITLE "Oops"
MESSAGE "^1"
BUTTONS "Ok"
END
#ifdef FOR_GREMLINS
FORM ID XW_GREMLIN_WARN_FORM_ID AT ( 2 60 156 98 )
USABLE MODAL
BEGIN
TITLE "Gremlin Oops"
FIELD XW_GREMLIN_WARN_FIELD_ID AT (2 15 150 75)
NONEDITABLE MULTIPLELINES
END
#endif

View file

@ -1,414 +0,0 @@
/* -*-mode: c; fill-column: 78; -*- */
/*****************************************************************************
* Copyright 1999 - 2002 by Eric House (xwords@eehouse.org) and others. 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.
****************************************************************************/
#define DEFINES_ONLY 1
#include "xwords4defines.h"
#define LEFTMARGIN 5
MENU XW_MAIN_MENU_ID
BEGIN
PULLDOWN "Fitxer"
BEGIN
MENUITEM "Nova partida..." XW_NEWGAME_PULLDOWN_ID "N"
MENUITEM "Partides..." XW_SAVEDGAMES_PULLDOWN_ID "S"
MENUITEM "Preferències..." XW_PREFS_PULLDOWN_ID "P"
MENUITEM SEPARATOR
MENUITEM "Enviar diccionari" XW_BEAMDICT_PULLDOWN_ID
MENUITEM "Enviar tauler i colors" XW_BEAMBOARD_PULLDOWN_ID
MENUITEM SEPARATOR
MENUITEM "Sobre Crosswords..." XW_ABOUT_PULLDOWN_ID "A"
END
PULLDOWN "Partida"
BEGIN
MENUITEM "Bossa de fitxes" XW_TILEVALUES_PULLDOWN_ID "V"
MENUITEM "Opcions..." XW_PASSWORDS_PULLDOWN_ID "G"
MENUITEM "Jugades" XW_HISTORY_PULLDOWN_ID "Y"
MENUITEM "Puntuació" XW_FINISH_PULLDOWN_ID "F"
#ifndef XWFEATURE_STANDALONE_ONLY
MENUITEM SEPARATOR
MENUITEM "Reenviar missatge" XW_RESENDIR_PULLDOWN_ID
#endif
END
PULLDOWN "Jugada"
BEGIN
MENUITEM "Pista" XW_HINT_PULLDOWN_ID "I"
MENUITEM "Més pistes" XW_NEXTHINT_PULLDOWN_ID "M"
#ifdef XWFEATURE_SEARCHLIMIT
MENUITEM "Configurat pistes..." XW_HINTCONFIG_PULLDOWN_ID "C"
#endif
MENUITEM SEPARATOR
MENUITEM "Descartar l'actual" XW_UNDOCUR_PULLDOWN_ID "U"
MENUITEM "Descartar la prèvia" XW_UNDOLAST_PULLDOWN_ID "Z"
MENUITEM SEPARATOR
MENUITEM "D'acord" XW_DONE_PULLDOWN_ID "D"
MENUITEM "Remenar el faristol" XW_JUGGLE_PULLDOWN_ID "J"
MENUITEM "Canviar fitxes" XW_TRADEIN_PULLDOWN_ID "T"
MENUITEM "Amagar el faristol" XW_HIDESHOWTRAY_PULLDOWN_ID "H"
END
#ifdef FOR_GREMLINS
PULLDOWN "Grem"
BEGIN
MENUITEM "divider right" XW_GREMLIN_DIVIDER_RIGHT
MENUITEM "divider left" XW_GREMLIN_DIVIDER_LEFT
END
#endif
#ifndef FOR_GREMLINS
#ifdef DEBUG
PULLDOWN "DBG"
BEGIN
MENUITEM "Show debugstrs" XW_DEBUGSHOW_PULLDOWN_ID
MENUITEM "Hide debugstrs" XW_DEBUGHIDE_PULLDOWN_ID
/* MENUITEM "Reset game" XW_RESET_PULLDOWN_ID */
MENUITEM "Network stats..." XW_NETSTATS_PULLDOWN_ID
#ifdef MEM_DEBUG
MENUITEM "Mem stats..." XW_MEMSTATS_PULLDOWN_ID
#endif
END
#endif
#endif /* FOR_GREMLINS */
// <EEH> NO NEED TO TRANSLATE GREMLINS or DEBUG stuff
#ifdef FOR_GREMLINS
/* PULLDOWN "Gremlins" */
/* BEGIN */
/* MENUITEM "Divider left" GREMLIN_DIVIDER_LEFT */
/* MENUITEM "Divider right" GREMLIN_DIVIDER_RIGHT */
/* END */
#endif
END
MENU XW_ASK_MENU_ID
BEGIN
PULLDOWN "Editar"
BEGIN
MENUITEM "Copiar" ASK_COPY_PULLDOWN_ID
MENUITEM "Seleccionar tot" ASK_SELECTALL_PULLDOWN_ID
END
END
#include "common.rcp.pre" /* these don't need localization */
#ifdef XWFEATURE_STANDALONE_ONLY
# define NPLAYERS_TOP 15
# define FORM_TOP 34
# define FORM_HEIGHT 124
#else
# define SERVER_TOP 15
# define NPLAYERS_TOP (SERVER_TOP+18)
# define FORM_TOP 16
# define FORM_HEIGHT 142
#endif
#define LABEL_TOP (NPLAYERS_TOP+18)
#define LEFTCOL 4
#define REMOTE_COL LEFTCOL
#define NAME_COL 50
#define ROBOT_COL 98
#define PASSWD_COL RIGHT@156
#ifndef XWFEATURE_STANDALONE_ONLY
#define PLAYER_REMOTECHECK( num, offset ) \
CHECKBOX "" ID XW_REMOTE_##num##_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+offset AUTO AUTO) USABLE
#else
#define PLAYER_REMOTECHECK( num, offset )
#endif
#ifndef XWFEATURE_STANDALONE_ONLY
#define PLAYER_NAMEFIELD( num, offset ) \
FIELD XW_PLAYERNAME_##num##_FIELD_ID \
AT (PREVRIGHT PREVTOP 100 AUTO ) \
UNDERLINED EDITABLE SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
#else
#define PLAYER_NAMEFIELD( num, offset ) \
FIELD XW_PLAYERNAME_##num##_FIELD_ID \
AT (LEFTCOL+10 PREVBOTTOM+offset 100 AUTO ) \
UNDERLINED EDITABLE SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
#endif
#define PLAYER_ROBCHECK( num, offset ) \
CHECKBOX "" ID XW_ROBOT_##num##_CHECKBOX_ID \
AT (PREVRIGHT PREVTOP AUTO AUTO) USABLE RIGHTANCHOR
#define PLAYER_PASSFIELD( num, offset ) \
SELECTORTRIGGER "" XW_PLAYERPASSWD_##num##_TRIGGER_ID \
AT (PREVRIGHT PREVTOP 12 11)
/* FIELD XW_PLAYERPASSWD_##num##_FIELD_ID PREVRIGHT PREVTOP 20 \ */
/* AUTO UNDERLINED EDITABLE SINGLELINE MAXCHARS 4 */
#define PLAYER_ROW( num, offset ) \
PLAYER_REMOTECHECK( num, offset ) \
PLAYER_NAMEFIELD( num, offset ) \
PLAYER_ROBCHECK( num, offset ) \
PLAYER_PASSFIELD( num, offset )
//#define SERVER_GROUP_ID 2000
#define SERVER_HEIGHT 12
#define PLAYER_SEL_LEFT 64
FORM ID XW_NEWGAMES_FORM AT (2 FORM_TOP 156 FORM_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_OK_BUTTON_ID
BEGIN
TITLE "Opcions"
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Connexió:" AUTOID AT (LEFTCOL SERVER_TOP)
GADGET ID XW_SOLO_GADGET_ID AT (PREVRIGHT+2 SERVER_TOP 53 SERVER_HEIGHT)
USABLE
GADGET ID XW_SERVER_GADGET_ID
AT (PREVRIGHT+1 SERVER_TOP 22 SERVER_HEIGHT) USABLE
GADGET ID XW_CLIENT_GADGET_ID
AT (PREVRIGHT+1 SERVER_TOP 28 SERVER_HEIGHT) USABLE
LIST "Sense" "Servidor" "Client" XW_SERVERTYPES_LIST_ID
AT (0 0 1 1) VISIBLEITEMS 3 NONUSABLE
#endif
/* Pick number of players here */
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Locals: " XW_LOCALP_LABEL_ID AT (LEFTCOL NPLAYERS_TOP)
LABEL "Jugadors: " XW_TOTALP_LABEL_ID AT (LEFTCOL NPLAYERS_TOP)
#else
LABEL "Jugadors: " AUTOID AT (LEFTCOL NPLAYERS_TOP)
#endif
SELECTORTRIGGER "" XW_NPLAYERS_SELECTOR_ID \
AT (PLAYER_SEL_LEFT NPLAYERS_TOP AUTO AUTO) USABLE LEFTANCHOR
LIST "1" "2" "3" "4" XW_NPLAYERS_LIST_ID AT (PREVLEFT PREVTOP 10 1) \
VISIBLEITEMS 4 NONUSABLE
BUTTON "Més opcions..." XW_PREFS_BUTTON_ID RIGHT@154 NPLAYERS_TOP AUTO AUTO
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Client" XW_LOCAL_LABEL_ID REMOTE_COL LABEL_TOP FONT 1
#endif
LABEL "Nom" AUTOID NAME_COL LABEL_TOP FONT 1
LABEL "Robot" AUTOID ROBOT_COL LABEL_TOP FONT 1
LABEL "Pwd" AUTOID PASSWD_COL LABEL_TOP FONT 1
PLAYER_ROW( 1, 2 )
PLAYER_ROW( 2, 2 )
PLAYER_ROW( 3, 2 )
PLAYER_ROW( 4, 2 )
GRAFFITISTATEINDICATOR 2 PREVBOTTOM+10
SELECTORTRIGGER "Diccionari..." XW_DICT_SELECTOR_ID \
AT (PREVRIGHT+12 PREVTOP AUTO AUTO) USABLE LEFTANCHOR
BUTTON "D'acord" XW_OK_BUTTON_ID RIGHT@154 PREVTOP 36 AUTO
BUTTON "Sortir" XW_CANCEL_BUTTON_ID RIGHT@PREVLEFT-3 PREVTOP 39 AUTO
END /* FORM XW_PLAYERINFO_FORM */
#ifdef FEATURE_TRAY_EDIT
# define TRAY_EDIT_ADJUST 15
#else
# define TRAY_EDIT_ADJUST 0
#endif
#define PREFS_MODE_TOP 15
#define PREFS_TOP 30
#define DLG_TOP 41-TRAY_EDIT_ADJUST
#define DLG_HEIGHT 118+TRAY_EDIT_ADJUST
#define TIMER_TOP 87
#define BUTTON_TOP TIMER_TOP+16+TRAY_EDIT_ADJUST
/* FORM ID XW_PREFS_FORM AT (2 29 156 130) */
FORM ID XW_PREFS_FORM AT (2 DLG_TOP 156 DLG_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_PREFS_CANCEL_BUTTON_ID
BEGIN
TITLE "Preferències"
GADGET ID XW_PREFS_APPWIDE_CHECKBX_ID
AT (LEFTCOL+8 PREFS_MODE_TOP 75 SERVER_HEIGHT) USABLE
GADGET ID XW_PREFS_ONEGAME_CHECKBX_ID
AT (PREVRIGHT+1 PREVTOP 50 SERVER_HEIGHT) USABLE
LIST "Del programa" "De la partida" XW_PREFS_TYPES_LIST_ID
AT (0 0 1 1) VISIBLEITEMS 2 NONUSABLE
/* global prefs */
CHECKBOX "Acolorir fitxes segons el jugador" ID XW_PREFS_PLAYERCOLORS_CHECKBOX_ID \
AT (LEFTCOL PREFS_TOP AUTO AUTO) NONUSABLE
CHECKBOX "Mostrar la barra de progrés" ID XW_PREFS_PROGRESSBAR_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+2 AUTO AUTO) NONUSABLE
CHECKBOX "Dibuixar el tauler gran" ID XW_PREFS_SHOWGRID_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+2 AUTO AUTO) NONUSABLE
CHECKBOX "Activar el cursor" ID XW_PREFS_SHOWARROW_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+2 AUTO AUTO) NONUSABLE
CHECKBOX "Veure jugada del robot" ID XW_PREFS_ROBOTSCORE_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+2 AUTO AUTO) NONUSABLE
/* single-game prefs */
CHECKBOX "El robot mai no falla" ID XW_PREFS_ROBOTSMART_CHECKBOX_ID \
AT (LEFTCOL PREFS_TOP AUTO AUTO) NONUSABLE
CHECKBOX "Desactivar pistes" ID XW_PREFS_NOHINTS_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
LABEL "Si no troba:" XW_PREFS_PHONIES_LABEL_ID AT (LEFTCOL PREVBOTTOM+2)
POPUPTRIGGER "" ID XW_PREFS_PHONIES_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LABEL "Tauler de: " XW_PREFS_BDSIZE_LABEL_ID
AT (LEFTCOL PREVBOTTOM+2)
SELECTORTRIGGER "" XW_PREFS_BDSIZE_SELECTOR_ID \
AT (PREVRIGHT PREVTOP AUTO AUTO) USABLE LEFTANCHOR
LIST "Ignora" "Avisa" "No permet" ID XW_PREFS_PHONIES_LIST_ID
AT (PREVLEFT PREVTOP 72 12) NONUSABLE VISIBLEITEMS 3
POPUPLIST XW_PREFS_PHONIES_TRIGGER_ID XW_PREFS_PHONIES_LIST_ID
LIST "15x15" "13x13" "11x11" \
XW_PREFS_BDSIZE_LIST_ID AT (PREVLEFT PREVTOP 30 1) \
NONUSABLE VISIBLEITEMS NUM_BOARD_SIZES
CHECKBOX "Activar rellotge (minuts): " ID XW_PREFS_TIMERON_CHECKBOX_ID \
AT (LEFTCOL TIMER_TOP AUTO AUTO) NONUSABLE
FIELD XW_PREFS_TIMER_FIELD_ID PREVRIGHT+5 PREVTOP 15 AUTO UNDERLINED \
EDITABLE SINGLELINE NUMERIC MAXCHARS 3
#ifdef FEATURE_TRAY_EDIT
CHECKBOX "Faristol editable" ID XW_PREFS_PICKTILES_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
#endif
/* buttons at the bottom */
BUTTON "Sortir" XW_PREFS_CANCEL_BUTTON_ID 35 BUTTON_TOP AUTO AUTO
BUTTON "D'acord" XW_PREFS_OK_BUTTON_ID PREVRIGHT+10 PREVTOP AUTO AUTO
END
#define LEFT_EDGE 10
FORM ID XW_DICTINFO_FORM AT (2 111 156 47)
USABLE MODAL DEFAULTBTNID XW_DICTINFO_CANCEL_BUTTON_ID
BEGIN
TITLE "Diccionaris"
LABEL "Nom:" AUTOID AT (LEFT_EDGE 15)
POPUPTRIGGER "" ID XW_DICTINFO_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LIST "" ID XW_DICTINFO_LIST_ID AT (PREVLEFT PREVTOP 72 1)
NONUSABLE VISIBLEITEMS 4
POPUPLIST XW_DICTINFO_TRIGGER_ID XW_DICTINFO_LIST_ID
BUTTON "D'acord" XW_DICTINFO_DONE_BUTTON_ID 25 31 AUTO AUTO
BUTTON "Enviar" XW_DICTINFO_BEAM_BUTTON_ID 22 PREVTOP AUTO AUTO
BUTTON "Sortir" XW_DICTINFO_CANCEL_BUTTON_ID PREVRIGHT+20 PREVTOP
AUTO AUTO
END
FORM ID XW_ASK_FORM_ID AT (2 70 156 88)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_ASK_NO_BUTTON_ID
MENUID XW_ASK_MENU_ID
BEGIN
TITLE "Pregunta"
FIELD XW_ASK_TXT_FIELD_ID LEFT_EDGE-5 15 135 52 \
NONEDITABLE MULTIPLELINES
SCROLLBAR ID XW_ASK_SCROLLBAR_ID
AT ( PREVRIGHT+2 PREVTOP RECOMMENDED_SBAR_WIDTH
PREVBOTTOM - PREVTOP) USABLE
BUTTON "D'acord" XW_ASK_YES_BUTTON_ID RIGHT@(156/2)-10 PREVBOTTOM+2 AUTO AUTO
BUTTON "Sortir" XW_ASK_NO_BUTTON_ID 156/2+10 PREVTOP
AUTO AUTO
END
FORM ID XW_PASSWORD_DIALOG_ID AT ( 2 88 156 70 )
MODAL SAVEBEHIND DEFAULTBTNID XW_PASSWORD_CANCEL_BUTTON
BEGIN
TITLE "Password"
LABEL "Entra el password per:" XW_PASSWORD_NAME_LABEL 10 18 FONT 1 NONUSABLE
LABEL "Entra el nou password per:" XW_PASSWORD_NEWNAME_LABEL 10 18 FONT 1
NONUSABLE
FIELD XW_PASSWORD_NAME_FIELD AT (PREVLEFT PREVBOTTOM+3 90 12) NONEDITABLE
SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
FIELD XW_PASSWORD_PASS_FIELD \
AT (PREVRIGHT+10 PREVTOP MAX_PASSWORD_LENGTH*6 12) \
EDITABLE SINGLELINE UNDERLINED MAXCHARS MAX_PASSWORD_LENGTH
GRAFFITISTATEINDICATOR 2 PREVBOTTOM+8
BUTTON "D'acord" XW_PASSWORD_OK_BUTTON 45 PREVTOP AUTO AUTO
BUTTON "Sortir" XW_PASSWORD_CANCEL_BUTTON PREVRIGHT+10 PREVTOP AUTO AUTO
END
#define BLANK_PICK_TOP 15
FORM ID XW_BLANK_DIALOG_ID AT ( 2 74 156 83 ) USABLE
MODAL SAVEBEHIND
#ifdef FEATURE_TRAY_EDIT
DEFAULTBTNID XW_BLANK_PICK_BUTTON_ID
#endif
BEGIN
TITLE "Editar el faristol"
FIELD XW_BLANK_LABEL_FIELD_ID AT (10 BLANK_PICK_TOP 110 39)
NONEDITABLE MULTIPLELINES
LIST "" ID XW_BLANK_LIST_ID AT (PREVRIGHT+2 BLANK_PICK_TOP 28 72)
USABLE VISIBLEITEMS 6
BUTTON "D'acord" XW_BLANK_OK_BUTTON_ID RIGHT@PREVLEFT-10 65 42 AUTO
#ifdef FEATURE_TRAY_EDIT
BUTTON "Tot!" XW_BLANK_PICK_BUTTON_ID 5 65 32 AUTO
BUTTON "Esb." XW_BLANK_BACKUP_BUTTON_ID PREVRIGHT+3 PREVTOP 23 AUTO
#endif
END
#if defined OWNER_HASH || defined NO_REG_REQUIRED
FORM ID XW_SAVEDGAMES_DIALOG_ID AT ( 2 2 156 156 )
USABLE MODAL DEFAULTBTNID XW_SAVEDGAMES_DONE_BUTTON
BEGIN
TITLE "Partides"
LIST "" ID XW_SAVEDGAMES_LIST_ID AT (2 15 140 60) \
USABLE ENABLED VISIBLEITEMS 1
GRAFFITISTATEINDICATOR 2 120
FIELD XW_SAVEDGAMES_NAME_FIELD AT (PREVRIGHT+10 PREVTOP 108 AUTO)
EDITABLE SINGLELINE UNDERLINED MAXCHARS MAX_GAMENAME_LENGTH
BUTTON "Modif." XW_SAVEDGAMES_USE_BUTTON RIGHT@154 PREVTOP 30 AUTO
BUTTON "Duplic." XW_SAVEDGAMES_DUPE_BUTTON 2 PREVBOTTOM+5 33 AUTO
BUTTON "Esborrar" XW_SAVEDGAMES_DELETE_BUTTON PREVRIGHT+5 PREVTOP 41 AUTO
BUTTON "Triar" XW_SAVEDGAMES_OPEN_BUTTON PREVRIGHT+5 PREVTOP 28 AUTO
BUTTON "Tancar" XW_SAVEDGAMES_DONE_BUTTON PREVRIGHT+5 PREVTOP 33 AUTO
END
#endif
ALERT XW_ERROR_ALERT_ID
ERROR
BEGIN
TITLE "Alerta!"
MESSAGE "^1"
BUTTONS "D'acord"
END
#ifdef FOR_GREMLINS
FORM ID XW_GREMLIN_WARN_FORM_ID AT ( 2 60 156 98 )
USABLE MODAL
BEGIN
TITLE "Gremlin Oops"
FIELD XW_GREMLIN_WARN_FIELD_ID AT (2 15 150 75)
NONEDITABLE MULTIPLELINES
END
#endif

View file

@ -1,413 +0,0 @@
/* -*-mode: c; fill-column: 78; -*- */
/*****************************************************************************
* Copyright 1999 - 2002 by Eric House (xwords@eehouse.org) and others. 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.
****************************************************************************/
#define DEFINES_ONLY 1
#include "xwords4defines.h"
#define LEFTMARGIN 5
MENU XW_MAIN_MENU_ID
BEGIN
PULLDOWN "Fichero"
BEGIN
MENUITEM "Nueva partida..." XW_NEWGAME_PULLDOWN_ID "N"
MENUITEM "Partidas..." XW_SAVEDGAMES_PULLDOWN_ID "S"
MENUITEM "Preferencias..." XW_PREFS_PULLDOWN_ID "P"
MENUITEM SEPARATOR
MENUITEM "Enviar diccionario" XW_BEAMDICT_PULLDOWN_ID
MENUITEM "Enviar tablero y colores" XW_BEAMBOARD_PULLDOWN_ID
MENUITEM SEPARATOR
MENUITEM "Acerca de Crosswords..." XW_ABOUT_PULLDOWN_ID "A"
END
PULLDOWN "Partida"
BEGIN
MENUITEM "Bolsa de fichas" XW_TILEVALUES_PULLDOWN_ID "V"
MENUITEM "Opciones..." XW_PASSWORDS_PULLDOWN_ID "G"
MENUITEM "Jugadas" XW_HISTORY_PULLDOWN_ID "Y"
MENUITEM "Puntuación" XW_FINISH_PULLDOWN_ID "F"
#ifndef XWFEATURE_STANDALONE_ONLY
MENUITEM SEPARATOR
MENUITEM "Reenviar mensajes" XW_RESENDIR_PULLDOWN_ID
#endif
END
PULLDOWN "Jugada"
BEGIN
MENUITEM "Pista" XW_HINT_PULLDOWN_ID "I"
MENUITEM "Más pistas" XW_NEXTHINT_PULLDOWN_ID "M"
#ifdef XWFEATURE_SEARCHLIMIT
MENUITEM "Configurar pistas..." XW_HINTCONFIG_PULLDOWN_ID "C"
#endif
MENUITEM SEPARATOR
MENUITEM "Descartar la actual" XW_UNDOCUR_PULLDOWN_ID "U"
MENUITEM "Descartar la previa" XW_UNDOLAST_PULLDOWN_ID "Z"
MENUITEM SEPARATOR
MENUITEM "Aceptar" XW_DONE_PULLDOWN_ID "D"
MENUITEM "Remover el atril" XW_JUGGLE_PULLDOWN_ID "J"
MENUITEM "Cambiar fichas" XW_TRADEIN_PULLDOWN_ID "T"
MENUITEM "Ocultar el atril" XW_HIDESHOWTRAY_PULLDOWN_ID "H"
END
#ifdef FOR_GREMLINS
PULLDOWN "Grem"
BEGIN
MENUITEM "divider right" XW_GREMLIN_DIVIDER_RIGHT
MENUITEM "divider left" XW_GREMLIN_DIVIDER_LEFT
END
#endif
#ifndef FOR_GREMLINS
#ifdef DEBUG
PULLDOWN "DBG"
BEGIN
MENUITEM "Show debugstrs" XW_DEBUGSHOW_PULLDOWN_ID
MENUITEM "Hide debugstrs" XW_DEBUGHIDE_PULLDOWN_ID
MENUITEM "Network stats..." XW_NETSTATS_PULLDOWN_ID
#ifdef MEM_DEBUG
MENUITEM "Mem stats..." XW_MEMSTATS_PULLDOWN_ID
#endif
END
#endif
#endif /* FOR_GREMLINS */
// <EEH> NO NEED TO TRANSLATE GREMLINS or DEBUG stuff
#ifdef FOR_GREMLINS
/* PULLDOWN "Gremlins" */
/* BEGIN */
/* MENUITEM "Divider left" GREMLIN_DIVIDER_LEFT */
/* MENUITEM "Divider right" GREMLIN_DIVIDER_RIGHT */
/* END */
#endif
END
MENU XW_ASK_MENU_ID
BEGIN
PULLDOWN "Editar"
BEGIN
MENUITEM "Copiar" ASK_COPY_PULLDOWN_ID
MENUITEM "Seleccionar todo" ASK_SELECTALL_PULLDOWN_ID
END
END
#include "common.rcp.pre" /* these don't need localization */
#ifdef XWFEATURE_STANDALONE_ONLY
# define NPLAYERS_TOP 15
# define FORM_TOP 34
# define FORM_HEIGHT 124
#else
# define SERVER_TOP 15
# define NPLAYERS_TOP (SERVER_TOP+18)
# define FORM_TOP 16
# define FORM_HEIGHT 142
#endif
#define LABEL_TOP (NPLAYERS_TOP+18)
#define LEFTCOL 4
#define REMOTE_COL LEFTCOL
#define NAME_COL 50
#define ROBOT_COL 98
#define PASSWD_COL RIGHT@156
#ifndef XWFEATURE_STANDALONE_ONLY
#define PLAYER_REMOTECHECK( num, offset ) \
CHECKBOX "" ID XW_REMOTE_##num##_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+offset AUTO AUTO) USABLE
#else
#define PLAYER_REMOTECHECK( num, offset )
#endif
#ifndef XWFEATURE_STANDALONE_ONLY
#define PLAYER_NAMEFIELD( num, offset ) \
FIELD XW_PLAYERNAME_##num##_FIELD_ID \
AT (PREVRIGHT PREVTOP 100 AUTO ) \
UNDERLINED EDITABLE SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
#else
#define PLAYER_NAMEFIELD( num, offset ) \
FIELD XW_PLAYERNAME_##num##_FIELD_ID \
AT (LEFTCOL+10 PREVBOTTOM+offset 100 AUTO ) \
UNDERLINED EDITABLE SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
#endif
#define PLAYER_ROBCHECK( num, offset ) \
CHECKBOX "" ID XW_ROBOT_##num##_CHECKBOX_ID \
AT (PREVRIGHT PREVTOP AUTO AUTO) USABLE RIGHTANCHOR
#define PLAYER_PASSFIELD( num, offset ) \
SELECTORTRIGGER "" XW_PLAYERPASSWD_##num##_TRIGGER_ID \
AT (PREVRIGHT PREVTOP 12 11)
/* FIELD XW_PLAYERPASSWD_##num##_FIELD_ID PREVRIGHT PREVTOP 20 \ */
/* AUTO UNDERLINED EDITABLE SINGLELINE MAXCHARS 4 */
#define PLAYER_ROW( num, offset ) \
PLAYER_REMOTECHECK( num, offset ) \
PLAYER_NAMEFIELD( num, offset ) \
PLAYER_ROBCHECK( num, offset ) \
PLAYER_PASSFIELD( num, offset )
//#define SERVER_GROUP_ID 2000
#define SERVER_HEIGHT 12
#define PLAYER_SEL_LEFT 64
FORM ID XW_NEWGAMES_FORM AT (2 FORM_TOP 156 FORM_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_OK_BUTTON_ID
BEGIN
TITLE "Opciones"
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Conexión:" AUTOID AT (LEFTCOL SERVER_TOP)
GADGET ID XW_SOLO_GADGET_ID AT (PREVRIGHT+2 SERVER_TOP 53 SERVER_HEIGHT)
USABLE
GADGET ID XW_SERVER_GADGET_ID
AT (PREVRIGHT+1 SERVER_TOP 22 SERVER_HEIGHT) USABLE
GADGET ID XW_CLIENT_GADGET_ID
AT (PREVRIGHT+1 SERVER_TOP 28 SERVER_HEIGHT) USABLE
LIST "Sin" "Servidor" "Cliente" XW_SERVERTYPES_LIST_ID
AT (0 0 1 1) VISIBLEITEMS 3 NONUSABLE
#endif
/* Pick number of players here */
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Locales: " XW_LOCALP_LABEL_ID AT (LEFTCOL NPLAYERS_TOP)
LABEL "Jugadores: " XW_TOTALP_LABEL_ID AT (LEFTCOL NPLAYERS_TOP)
#else
LABEL "Jugadores: " AUTOID AT (LEFTCOL NPLAYERS_TOP)
#endif
SELECTORTRIGGER "" XW_NPLAYERS_SELECTOR_ID \
AT (PLAYER_SEL_LEFT NPLAYERS_TOP AUTO AUTO) USABLE LEFTANCHOR
LIST "1" "2" "3" "4" XW_NPLAYERS_LIST_ID AT (PREVLEFT PREVTOP 10 1) \
VISIBLEITEMS 4 NONUSABLE
BUTTON "Más opciones..." XW_PREFS_BUTTON_ID RIGHT@154 NPLAYERS_TOP AUTO AUTO
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Cliente" XW_LOCAL_LABEL_ID REMOTE_COL LABEL_TOP FONT 1
#endif
LABEL "Nombre" AUTOID NAME_COL LABEL_TOP FONT 1
LABEL "Robot" AUTOID ROBOT_COL LABEL_TOP FONT 1
LABEL "Pwd" AUTOID PASSWD_COL LABEL_TOP FONT 1
PLAYER_ROW( 1, 2 )
PLAYER_ROW( 2, 2 )
PLAYER_ROW( 3, 2 )
PLAYER_ROW( 4, 2 )
GRAFFITISTATEINDICATOR 2 PREVBOTTOM+10
SELECTORTRIGGER "Diccionario..." XW_DICT_SELECTOR_ID \
AT (PREVRIGHT+12 PREVTOP AUTO AUTO) USABLE LEFTANCHOR
BUTTON "Aceptar" XW_OK_BUTTON_ID RIGHT@154 PREVTOP 36 AUTO
BUTTON "Cancelar" XW_CANCEL_BUTTON_ID RIGHT@PREVLEFT-3 PREVTOP 37 AUTO
END /* FORM XW_PLAYERINFO_FORM */
#ifdef FEATURE_TRAY_EDIT
# define TRAY_EDIT_ADJUST 15
#else
# define TRAY_EDIT_ADJUST 0
#endif
#define PREFS_MODE_TOP 15
#define PREFS_TOP 30
#define DLG_TOP 39-TRAY_EDIT_ADJUST
#define DLG_HEIGHT 120+TRAY_EDIT_ADJUST
#define TIMER_TOP 85
#define BUTTON_TOP 104+TRAY_EDIT_ADJUST
FORM ID XW_PREFS_FORM AT (2 DLG_TOP 156 DLG_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_PREFS_CANCEL_BUTTON_ID
BEGIN
TITLE "Preferencias"
GADGET ID XW_PREFS_APPWIDE_CHECKBX_ID
AT (LEFTCOL+8 PREFS_MODE_TOP 75 SERVER_HEIGHT) USABLE
GADGET ID XW_PREFS_ONEGAME_CHECKBX_ID
AT (PREVRIGHT+1 PREVTOP 50 SERVER_HEIGHT) USABLE
LIST "Del programa" "De la partida" XW_PREFS_TYPES_LIST_ID
AT (0 0 1 1) VISIBLEITEMS 2 NONUSABLE
/* global prefs */
CHECKBOX "Colorear fichas según el jugador" \
ID XW_PREFS_PLAYERCOLORS_CHECKBOX_ID \
AT (LEFTCOL PREFS_TOP AUTO AUTO) NONUSABLE
CHECKBOX "Mostrar la barra de progreso" \
ID XW_PREFS_PROGRESSBAR_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+2 AUTO AUTO) NONUSABLE
CHECKBOX "Dibujar el tablero grande" ID XW_PREFS_SHOWGRID_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+2 AUTO AUTO) NONUSABLE
CHECKBOX "Activar cursor" ID XW_PREFS_SHOWARROW_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+2 AUTO AUTO) NONUSABLE
CHECKBOX "Ver jugada del robot" ID XW_PREFS_ROBOTSCORE_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+2 AUTO AUTO) NONUSABLE
/* single-game prefs */
CHECKBOX "El robot nunca falla" ID XW_PREFS_ROBOTSMART_CHECKBOX_ID \
AT (LEFTCOL PREFS_TOP AUTO AUTO) NONUSABLE
CHECKBOX "Desactivar pistas" ID XW_PREFS_NOHINTS_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
LABEL "Si no encuentra:" XW_PREFS_PHONIES_LABEL_ID AT (LEFTCOL PREVBOTTOM+2)
POPUPTRIGGER "" ID XW_PREFS_PHONIES_TRIGGER_ID \
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LABEL "Tablero de: " XW_PREFS_BDSIZE_LABEL_ID \
AT (LEFTCOL PREVBOTTOM+2)
SELECTORTRIGGER "" XW_PREFS_BDSIZE_SELECTOR_ID \
AT (PREVRIGHT PREVTOP AUTO AUTO) USABLE LEFTANCHOR
LIST "Ignora" "Avisa" "No permite" ID XW_PREFS_PHONIES_LIST_ID \
AT (PREVLEFT PREVTOP 72 12) NONUSABLE VISIBLEITEMS 3
POPUPLIST XW_PREFS_PHONIES_TRIGGER_ID XW_PREFS_PHONIES_LIST_ID
LIST "15x15" "13x13" "11x11" \
XW_PREFS_BDSIZE_LIST_ID AT (PREVLEFT PREVTOP 30 1) \
NONUSABLE VISIBLEITEMS NUM_BOARD_SIZES
CHECKBOX "Activar reloj (minutos): " ID XW_PREFS_TIMERON_CHECKBOX_ID \
AT (LEFTCOL TIMER_TOP AUTO AUTO) NONUSABLE
FIELD XW_PREFS_TIMER_FIELD_ID PREVRIGHT+5 PREVTOP 15 AUTO UNDERLINED \
EDITABLE SINGLELINE NUMERIC MAXCHARS 3
#ifdef FEATURE_TRAY_EDIT
CHECKBOX "Atril editable" ID XW_PREFS_PICKTILES_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
#endif
/* buttons at the bottom */
BUTTON "Cancelar" XW_PREFS_CANCEL_BUTTON_ID 30 BUTTON_TOP AUTO AUTO
BUTTON "Aceptar" XW_PREFS_OK_BUTTON_ID PREVRIGHT+10 PREVTOP AUTO AUTO
END
#define LEFT_EDGE 10
FORM ID XW_DICTINFO_FORM AT (2 111 156 47)
USABLE MODAL DEFAULTBTNID XW_DICTINFO_CANCEL_BUTTON_ID
BEGIN
TITLE "Diccionarios"
LABEL "Nombre:" AUTOID AT (LEFT_EDGE 15)
POPUPTRIGGER "" ID XW_DICTINFO_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LIST "" ID XW_DICTINFO_LIST_ID AT (PREVLEFT PREVTOP 72 1)
NONUSABLE VISIBLEITEMS 4
POPUPLIST XW_DICTINFO_TRIGGER_ID XW_DICTINFO_LIST_ID
BUTTON "Aceptar" XW_DICTINFO_DONE_BUTTON_ID 25 31 AUTO AUTO
BUTTON "Enviar" XW_DICTINFO_BEAM_BUTTON_ID 22 PREVTOP AUTO AUTO
BUTTON "Cancelar" XW_DICTINFO_CANCEL_BUTTON_ID PREVRIGHT+20 PREVTOP
AUTO AUTO
END
FORM ID XW_ASK_FORM_ID AT (2 70 156 88)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_ASK_NO_BUTTON_ID
MENUID XW_ASK_MENU_ID
BEGIN
TITLE "Pregunta"
FIELD XW_ASK_TXT_FIELD_ID LEFT_EDGE-5 16 135 52 \
NONEDITABLE MULTIPLELINES
SCROLLBAR ID XW_ASK_SCROLLBAR_ID
AT ( PREVRIGHT+2 PREVTOP RECOMMENDED_SBAR_WIDTH
PREVBOTTOM - PREVTOP) USABLE
BUTTON "Aceptar" XW_ASK_YES_BUTTON_ID
RIGHT@(156/2)-10 PREVBOTTOM+5 AUTO AUTO
BUTTON "Cancelar" XW_ASK_NO_BUTTON_ID 156/2+10 PREVTOP
AUTO AUTO
END
FORM ID XW_PASSWORD_DIALOG_ID AT ( 2 88 156 70 )
MODAL SAVEBEHIND DEFAULTBTNID XW_PASSWORD_CANCEL_BUTTON
BEGIN
TITLE "Password"
LABEL "Entra el password para:" XW_PASSWORD_NAME_LABEL 10 18 FONT 1 NONUSABLE
LABEL "Entra el nuevo password para:" XW_PASSWORD_NEWNAME_LABEL 10 18 FONT 1
NONUSABLE
FIELD XW_PASSWORD_NAME_FIELD AT (PREVLEFT PREVBOTTOM+3 90 12) NONEDITABLE
SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
FIELD XW_PASSWORD_PASS_FIELD \
AT (PREVRIGHT+10 PREVTOP MAX_PASSWORD_LENGTH*6 12) \
EDITABLE SINGLELINE UNDERLINED MAXCHARS MAX_PASSWORD_LENGTH
GRAFFITISTATEINDICATOR 2 PREVBOTTOM+8
BUTTON "Aceptar" XW_PASSWORD_OK_BUTTON 45 PREVTOP AUTO AUTO
BUTTON "Cancelar" XW_PASSWORD_CANCEL_BUTTON PREVRIGHT+10 PREVTOP AUTO AUTO
END
#define BLANK_PICK_TOP 15
FORM ID XW_BLANK_DIALOG_ID AT ( 2 74 156 83 ) USABLE
MODAL SAVEBEHIND
#ifdef FEATURE_TRAY_EDIT
DEFAULTBTNID XW_BLANK_PICK_BUTTON_ID
#endif
BEGIN
TITLE "Editar el atril"
FIELD XW_BLANK_LABEL_FIELD_ID AT (10 BLANK_PICK_TOP 110 39)
NONEDITABLE MULTIPLELINES
LIST "" ID XW_BLANK_LIST_ID AT (PREVRIGHT+2 BLANK_PICK_TOP 28 72)
USABLE VISIBLEITEMS 6
BUTTON "Aceptar" XW_BLANK_OK_BUTTON_ID RIGHT@PREVLEFT-5 65 40 AUTO
#ifdef FEATURE_TRAY_EDIT
BUTTON "¡Todo!" XW_BLANK_PICK_BUTTON_ID 3 65 34 AUTO
BUTTON "Borr." XW_BLANK_BACKUP_BUTTON_ID PREVRIGHT+3 PREVTOP 29 AUTO
#endif
END
#if defined OWNER_HASH || defined NO_REG_REQUIRED
FORM ID XW_SAVEDGAMES_DIALOG_ID AT ( 2 2 156 156 )
USABLE MODAL DEFAULTBTNID XW_SAVEDGAMES_DONE_BUTTON
BEGIN
TITLE "Partidas"
LIST "" ID XW_SAVEDGAMES_LIST_ID AT (2 15 140 60) \
USABLE ENABLED VISIBLEITEMS 1
GRAFFITISTATEINDICATOR 2 120
FIELD XW_SAVEDGAMES_NAME_FIELD AT (PREVRIGHT+10 PREVTOP 108 AUTO)
EDITABLE SINGLELINE UNDERLINED MAXCHARS MAX_GAMENAME_LENGTH
BUTTON "Modif." XW_SAVEDGAMES_USE_BUTTON RIGHT@154 PREVTOP 30 AUTO
BUTTON "Duplic." XW_SAVEDGAMES_DUPE_BUTTON 2 PREVBOTTOM+5 33 AUTO
BUTTON "Borrar" XW_SAVEDGAMES_DELETE_BUTTON PREVRIGHT+5 PREVTOP 33 AUTO
BUTTON "Escoger" XW_SAVEDGAMES_OPEN_BUTTON PREVRIGHT+5 PREVTOP 37 AUTO
BUTTON "Cerrar" XW_SAVEDGAMES_DONE_BUTTON PREVRIGHT+5 PREVTOP 33 AUTO
END
#endif
ALERT XW_ERROR_ALERT_ID
ERROR
BEGIN
TITLE "¡Atención!"
MESSAGE "^1"
BUTTONS "De acuerdo"
END
#ifdef FOR_GREMLINS
FORM ID XW_GREMLIN_WARN_FORM_ID AT ( 2 60 156 98 )
USABLE MODAL
BEGIN
TITLE "Gremlin Oops"
FIELD XW_GREMLIN_WARN_FIELD_ID AT (2 15 150 75)
NONEDITABLE MULTIPLELINES
END
#endif

View file

@ -1,621 +0,0 @@
/* -*-mode: c; fill-column: 78; compile-command: "cd ../ && make ARCH=68K_ONLY MEMDEBUG=TRUE LANG=fr_FR"; -*- */
/*****************************************************************************
* Copyright 1999 - 2007 par Eric House (xwords@eehouse.org) et autres. Tous
* droits réservés. Tradtion en français par Francis H.
*
* Ce programm est libre de droits ; Vous pouvez le distribuer et/ou
* le modifier en respectant les termes de la licence GNU General Public
* ainsi qu'elle est publiée par la Free Software Foundation ; que ce soit la version 2
* de la Licence, ou (selon votre option), toute version ultérieure.
*
* Ce programme est distribué avec l'intention qu'il soit utilisé,
* mais SANS AUCUNE GARANTIE ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Voir la
* Licence GNU General Public pour plus de détails.
*
* Vous devriez avoir reçu une copie de la Licence GNU General Public
* avec ce programme ; si ce n'est pas le cas, écrivez à "Free Software
* Foundation", Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
****************************************************************************/
#define DEFINES_ONLY 1
#include "xwords4defines.h"
#define LEFTMARGIN 5
MENU XW_MAIN_MENU_ID
BEGIN
PULLDOWN "Fichier"
BEGIN
MENUITEM "Nouvelle partie..." XW_NEWGAME_PULLDOWN_ID "N"
MENUITEM "Parties sauvegardées..." XW_SAVEDGAMES_PULLDOWN_ID "S"
MENUITEM "Préférences..." XW_PREFS_PULLDOWN_ID "P"
MENUITEM SEPARATOR
MENUITEM "Transm. dictionnaire" XW_BEAMDICT_PULLDOWN_ID
MENUITEM "Transm. grilles et couleurs" XW_BEAMBOARD_PULLDOWN_ID
#ifdef FEATURE_DUALCHOOSE
MENUITEM SEPARATOR
MENUITEM "Ouvrir vers. 68K" XW_RUN68K_PULLDOWN_ID
MENUITEM "Ouvrir vers. ARM" XW_RUNARM_PULLDOWN_ID
#endif
MENUITEM SEPARATOR
MENUITEM "Au sujet de Crosswords..." XW_ABOUT_PULLDOWN_ID "A"
END
PULLDOWN "Partie"
BEGIN
MENUITEM "Valeur des lettres" XW_TILEVALUES_PULLDOWN_ID "V"
MENUITEM "Lettres restantes" XW_TILESLEFT_PULLDOWN_ID "R"
MENUITEM "Info partie courante..." XW_PASSWORDS_PULLDOWN_ID "G"
MENUITEM "Historique" XW_HISTORY_PULLDOWN_ID "Y"
MENUITEM "Score final" XW_FINISH_PULLDOWN_ID "F"
#ifndef XWFEATURE_STANDALONE_ONLY
MENUITEM SEPARATOR
MENUITEM "Renvoyer" XW_RESENDIR_PULLDOWN_ID
#endif
END
PULLDOWN "Coup"
BEGIN
MENUITEM "Indice" XW_HINT_PULLDOWN_ID "I"
#ifdef XWFEATURE_SEARCHLIMIT
MENUITEM "Indice restreint" XW_HINTCONFIG_PULLDOWN_ID "C"
MENUITEM SEPARATOR
#endif
MENUITEM "Indice suivant" XW_NEXTHINT_PULLDOWN_ID "M"
MENUITEM SEPARATOR
MENUITEM "Annuler actuel" XW_UNDOCUR_PULLDOWN_ID "U"
MENUITEM "Annuler dernier" XW_UNDOLAST_PULLDOWN_ID "Z"
MENUITEM SEPARATOR
MENUITEM "Fait" XW_DONE_PULLDOWN_ID "D"
MENUITEM "Mélanger" XW_JUGGLE_PULLDOWN_ID "J"
MENUITEM "Echanger lettres" XW_TRADEIN_PULLDOWN_ID "T"
MENUITEM "[dé]Cacher tableau" XW_HIDESHOWTRAY_PULLDOWN_ID "H"
END
#ifdef FOR_GREMLINS
PULLDOWN "Grem"
BEGIN
MENUITEM "divider right" XW_GREMLIN_DIVIDER_RIGHT
MENUITEM "divider left" XW_GREMLIN_DIVIDER_LEFT
END
#endif
#ifndef FOR_GREMLINS
#ifdef DEBUG
PULLDOWN "DBG"
BEGIN
MENUITEM "Log to file" XW_LOGFILE_PULLDOWN_ID
MENUITEM "Log to memo" XW_LOGMEMO_PULLDOWN_ID
MENUITEM "Clear logs" XW_CLEARLOGS_PULLDOWN_ID
MENUITEM "Network stats..." XW_NETSTATS_PULLDOWN_ID
#ifdef DEBUG
MENUITEM "BT stats..." XW_BTSTATS_PULLDOWN_ID
#endif
#ifdef MEM_DEBUG
MENUITEM "Mem stats..." XW_MEMSTATS_PULLDOWN_ID
#endif
END
#endif
#endif /* FOR_GREMLINS */
END
MENU XW_ASK_MENU_ID
BEGIN
PULLDOWN "Editer"
BEGIN
MENUITEM "Copier" ASK_COPY_PULLDOWN_ID
MENUITEM "Tout sélectionner" ASK_SELECTALL_PULLDOWN_ID
END
END
#include "common.rcp.pre" /* these don't need localization */
#ifdef XWFEATURE_STANDALONE_ONLY
# define NPLAYERS_TOP 15
# define FORM_TOP 34
# define FORM_HEIGHT 124
#else
# define SERVER_TOP 15
# define NPLAYERS_TOP (SERVER_TOP+18)
# define FORM_TOP 16
# define FORM_HEIGHT 142
#endif
#define LABEL_TOP (NPLAYERS_TOP+18)
#define LEFTCOL 4
#define REMOTE_COL LEFTCOL
#define NAME_COL 50
#define ROBOT_COL 98
#define PASSWD_COL RIGHT@156
#ifndef XWFEATURE_STANDALONE_ONLY
#define PLAYER_REMOTECHECK( num, offset ) \
CHECKBOX "" ID XW_REMOTE_##num##_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+offset AUTO AUTO) USABLE
#else
#define PLAYER_REMOTECHECK( num, offset )
#endif
#ifndef XWFEATURE_STANDALONE_ONLY
#define PLAYER_NAMEFIELD( num, offset ) \
FIELD XW_PLAYERNAME_##num##_FIELD_ID \
AT (PREVRIGHT PREVTOP 100 AUTO ) \
UNDERLINED EDITABLE SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
#else
#define PLAYER_NAMEFIELD( num, offset ) \
FIELD XW_PLAYERNAME_##num##_FIELD_ID \
AT (LEFTCOL+10 PREVBOTTOM+offset 100 AUTO ) \
UNDERLINED EDITABLE SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
#endif
#define PLAYER_ROBCHECK( num, offset ) \
CHECKBOX "" ID XW_ROBOT_##num##_CHECKBOX_ID \
AT (PREVRIGHT PREVTOP AUTO AUTO) USABLE RIGHTANCHOR
#define PLAYER_PASSFIELD( num, offset ) \
SELECTORTRIGGER "" XW_PLAYERPASSWD_##num##_TRIGGER_ID \
AT (PREVRIGHT PREVTOP 12 11)
/* FIELD XW_PLAYERPASSWD_##num##_FIELD_ID PREVRIGHT PREVTOP 20 \ */
/* AUTO UNDERLINED EDITABLE SINGLELINE MAXCHARS 4 */
#define PLAYER_ROW( num, offset ) \
PLAYER_REMOTECHECK( num, offset ) \
PLAYER_NAMEFIELD( num, offset ) \
PLAYER_ROBCHECK( num, offset ) \
PLAYER_PASSFIELD( num, offset )
#define PLAYER_ROW_ID( num ) \
ID XW_REMOTE_##num##_CHECKBOX_ID \
ID XW_PLAYERNAME_##num##_FIELD_ID \
ID XW_ROBOT_##num##_CHECKBOX_ID \
ID XW_PLAYERPASSWD_##num##_TRIGGER_ID \
#define PLAYER_ROW_NAV( num ) \
ROW XW_REMOTE_##num##_CHECKBOX_ID \
ROW XW_PLAYERNAME_##num##_FIELD_ID \
XW_ROBOT_##num##_CHECKBOX_ID \
XW_PLAYERPASSWD_##num##_TRIGGER_ID \
//#define SERVER_GROUP_ID 2000
#define SERVER_HEIGHT 12
FORM ID XW_NEWGAMES_FORM AT (2 FORM_TOP 156 FORM_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_OK_BUTTON_ID
BEGIN
TITLE "Options de la partie"
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "En jeu :" AUTOID AT (LEFTCOL SERVER_TOP)
GADGET ID XW_SOLO_GADGET_ID
AT (PREVRIGHT+5 SERVER_TOP 36 SERVER_HEIGHT) USABLE
GADGET ID XW_SERVER_GADGET_ID
AT (PREVRIGHT+1 SERVER_TOP 31 SERVER_HEIGHT) USABLE
GADGET ID XW_CLIENT_GADGET_ID
AT (PREVRIGHT+1 SERVER_TOP 36 SERVER_HEIGHT) USABLE
LIST "Locale" "Hôte" "Invité" XW_SERVERTYPES_LIST_ID
AT (0 0 1 1) VISIBLEITEMS 3 NONUSABLE
#endif
/* Pick number of players here */
FIELD XW_TOTALP_FIELD_ID LEFTCOL NPLAYERS_TOP 58 AUTO \
SINGLELINE NONEDITABLE MAXCHARS 16
SELECTORTRIGGER "" XW_NPLAYERS_SELECTOR_ID \
AT (PREVRIGHT NPLAYERS_TOP AUTO AUTO) USABLE LEFTANCHOR
LIST "1" "2" "3" "4" XW_NPLAYERS_LIST_ID AT (PREVLEFT PREVTOP 10 1) \
VISIBLEITEMS 4 NONUSABLE
BUTTON "J" XW_GINFO_JUGGLE_ID PREVRIGHT+3 PREVTOP 10 AUTO
BUTTON "Autres préfs..." XW_PREFS_BUTTON_ID PREVRIGHT+5 PREVTOP 63 AUTO
#ifndef XWFEATURE_STANDALONE_ONLY
LABEL "Effacer" XW_LOCAL_LABEL_ID REMOTE_COL LABEL_TOP FONT 1
#endif
LABEL "Nom" AUTOID NAME_COL LABEL_TOP FONT 1
LABEL "Robot" AUTOID ROBOT_COL LABEL_TOP FONT 1
LABEL "MdP" AUTOID PASSWD_COL LABEL_TOP FONT 1
PLAYER_ROW( 1, 2 )
PLAYER_ROW( 2, 2 )
PLAYER_ROW( 3, 2 )
PLAYER_ROW( 4, 2 )
GRAFFITISTATEINDICATOR 2 PREVBOTTOM+10
SELECTORTRIGGER "Dictionnaire..." XW_DICT_SELECTOR_ID \
AT (PREVRIGHT+8 PREVTOP AUTO AUTO) USABLE LEFTANCHOR
BUTTON "Ok" XW_OK_BUTTON_ID RIGHT@154 PREVTOP 18 AUTO
BUTTON "Annuler" XW_CANCEL_BUTTON_ID RIGHT@PREVLEFT-5 PREVTOP 36 AUTO
END /* XW_NEWGAMES_FORM */
#ifdef XWFEATURE_FIVEWAY
NAVIGATION ID XW_NEWGAMES_FORM
INITIALSTATE kFrmNavHeaderFlagsObjectFocusStartState
#if 0
BEGIN
ID XW_SOLO_GADGET_ID
ID XW_SERVER_GADGET_ID
ID XW_CLIENT_GADGET_ID
ID XW_NPLAYERS_SELECTOR_ID
ID XW_GINFO_JUGGLE_ID
ID XW_PREFS_BUTTON_ID
PLAYER_ROW_ID( 1 )
PLAYER_ROW_ID( 2 )
PLAYER_ROW_ID( 3 )
PLAYER_ROW_ID( 4 )
ID XW_DICT_SELECTOR_ID
ID XW_CANCEL_BUTTON_ID
ID XW_OK_BUTTON_ID
#else
NAVIGATIONMAP
#ifndef XWFEATURE_STANDALONE_ONLY
ROW XW_SOLO_GADGET_ID
XW_SERVER_GADGET_ID
XW_CLIENT_GADGET_ID
#endif
ROW XW_NPLAYERS_SELECTOR_ID
XW_GINFO_JUGGLE_ID
XW_PREFS_BUTTON_ID
PLAYER_ROW_NAV( 1 )
PLAYER_ROW_NAV( 2 )
PLAYER_ROW_NAV( 3 )
PLAYER_ROW_NAV( 4 )
ROW XW_DICT_SELECTOR_ID
XW_CANCEL_BUTTON_ID
XW_OK_BUTTON_ID
#endif
END /* NAVIGATION ID XW_NEWGAMES_FORM */
#endif
#ifdef XWFEATURE_BLUETOOTH
/* Let's define this in one place so it stays the same */
# define BT_CONF_STRING "Demander avant Bluetooth"
#endif
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH || defined XWFEATURE_IR
#define LEFTCOL 4
#define CONNS_FIELD_LEFT 73
#define LOCALIP_TOP 30
FORM ID XW_CONNS_FORM AT (2 66 156 93)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_CONNS_CANCEL_BUTTON_ID
BEGIN
TITLE "Connexions"
LABEL "Connecter via:" AUTOID LEFTCOL 15 FONT 1
POPUPTRIGGER "" ID XW_CONNS_TYPE_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LIST
"" ID XW_CONNS_TYPE_LIST_ID
PREVLEFT PREVTOP 72 12 VISIBLEITEMS 2
NONUSABLE POPUPLIST XW_CONNS_TYPE_TRIGGER_ID XW_CONNS_TYPE_LIST_ID
/* Bluetooth stuff must be here even if XWFEATURE_BLUETOOTH is not defined
since, e.g. ARM and 68K share these resources yet may not both support
BT */
#ifdef XWFEATURE_BLUETOOTH
LABEL "Nom de l'hôte :" XW_CONNS_BT_HOSTNAME_LABEL_ID
AT ( LEFTCOL LOCALIP_TOP+5 ) NONUSABLE
SELECTORTRIGGER "Trouver l'hôte..." XW_CONNS_BT_HOSTTRIGGER_ID \
AT (CONNS_FIELD_LEFT PREVTOP 70 AUTO) NONUSABLE LEFTANCHOR
CHECKBOX BT_CONF_STRING ID XW_CONNS_BTCONFIRM_CHECKBOX_ID \
AT ( LEFTCOL LOCALIP_TOP+21 AUTO AUTO ) NONUSABLE
#endif
/* Relay... */
#ifdef XWFEATURE_RELAY
LABEL "Nom du réseau :" XW_CONNS_RELAY_LABEL_ID
AT ( LEFTCOL+10 LOCALIP_TOP )
FIELD XW_CONNS_RELAY_FIELD_ID CONNS_FIELD_LEFT PREVTOP 70 AUTO \
SINGLELINE EDITABLE UNDERLINED MAXCHARS 32
LABEL "Port du réseau :" XW_CONNS_PORT_LABEL_ID
AT (LEFTCOL PREVBOTTOM + 2)
FIELD XW_CONNS_PORT_FIELD_ID CONNS_FIELD_LEFT PREVTOP 30 AUTO \
EDITABLE SINGLELINE UNDERLINED NUMERIC MAXCHARS 5
LABEL "Invite:" XW_CONNS_INVITE_LABEL_ID
AT ( LEFTCOL+10 PREVBOTTOM + 2 )
FIELD XW_CONNS_INVITE_FIELD_ID CONNS_FIELD_LEFT PREVTOP 70 AUTO \
SINGLELINE EDITABLE UNDERLINED MAXCHARS 32
#endif
BUTTON "Annuler" XW_CONNS_CANCEL_BUTTON_ID 42 75 AUTO AUTO
BUTTON "Ok" XW_CONNS_OK_BUTTON_ID PREVRIGHT+10 PREVTOP AUTO AUTO
END /* XW_CONNS_FORM */
#endif
#ifdef FEATURE_TRAY_EDIT
# define TRAY_EDIT_ADJUST 15
#else
# define TRAY_EDIT_ADJUST 0
#endif
#ifdef XWFEATURE_SEARCHLIMIT
# define SEARCHLIMIT_ADJUST 15
#else
# define SEARCHLIMIT_ADJUST 0
#endif
#ifdef XWFEATURE_BLUETOOTH
# define BTCONF_ADJUST PREFS_SPACING
#else
# define BTCONF_ADJUST 0
#endif
#define PREFS_MODE_TOP 15
#define PREFS_ROW1 30
#define PREFS_SPACING 15
/* #define DLG_TOP (52-TRAY_EDIT_ADJUST-SEARCHLIMIT_ADJUST) */
#define DLG_HEIGHT (112+TRAY_EDIT_ADJUST+SEARCHLIMIT_ADJUST+BTCONF_ADJUST)
#define DLG_TOP (160 - DLG_HEIGHT - 2)
#define TIMER_TOP (74+SEARCHLIMIT_ADJUST)
#define BTCONF_TOP (TIMER_TOP+18+TRAY_EDIT_ADJUST)
#define BUTTON_TOP (BTCONF_TOP + PREFS_SPACING)
#define PREFS_LNHT 4
FORM ID XW_PREFS_FORM AT (2 DLG_TOP 156 DLG_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_PREFS_CANCEL_BUTTON_ID
BEGIN
TITLE "Préférences"
GADGET ID XW_PREFS_ALLGAMES_GADGET_ID
AT (LEFTCOL+8 PREFS_MODE_TOP 76 SERVER_HEIGHT) USABLE
GADGET ID XW_PREFS_ONEGAME_GADGET_ID
AT (PREVRIGHT+1 PREVTOP 54 SERVER_HEIGHT) USABLE
LIST "Toutes les parties" "Cette partie" XW_PREFS_TYPES_LIST_ID
AT (0 0 1 1) VISIBLEITEMS 2 NONUSABLE
/* global prefs */
CHECKBOX "Lettres jouées en couleurs" ID XW_PREFS_PLAYERCOLORS_CHECKBOX_ID \
AT (LEFTCOL PREFS_ROW1 AUTO AUTO) NONUSABLE
CHECKBOX "Montrer barre défilement" ID XW_PREFS_PROGRESSBAR_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Grande grille" ID XW_PREFS_SHOWGRID_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Activer curseur" ID XW_PREFS_SHOWARROW_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Expliquer robot/effacer scores" ID XW_PREFS_ROBOTSCORE_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "Cacher valeurs des lettres" ID XW_PREFS_HIDETRAYVAL_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
/* single-game prefs */
CHECKBOX "Robot commence" ID XW_PREFS_ROBOTSMART_CHECKBOX_ID \
AT (LEFTCOL PREFS_ROW1 AUTO AUTO) NONUSABLE
#ifdef XWFEATURE_SEARCHLIMIT
CHECKBOX "Désactiver indices" ID XW_PREFS_NOHINTS_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
CHECKBOX "En local" ID XW_PREFS_HINTRECT_CHECKBOX_ID \
AT (PREVRIGHT+3 PREVTOP AUTO AUTO) NONUSABLE
#else
CHECKBOX "Désactiver indices" ID XW_PREFS_NOHINTS_CHECKBOX_ID \
AT (PREVRIGHT+3 PREFS_ROW1 AUTO AUTO) NONUSABLE
#endif
LABEL "Inconnus :" XW_PREFS_PHONIES_LABEL_ID
AT (LEFTCOL PREVTOP+PREFS_SPACING)
POPUPTRIGGER "" ID XW_PREFS_PHONIES_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LABEL "Dimensions grille : " XW_PREFS_BDSIZE_LABEL_ID
AT (LEFTCOL PREVTOP+PREFS_SPACING)
SELECTORTRIGGER "" XW_PREFS_BDSIZE_SELECTOR_ID \
AT (PREVRIGHT PREVTOP AUTO AUTO) USABLE LEFTANCHOR
LIST "Ignorer" "Avertir" "Désactiver" ID XW_PREFS_PHONIES_LIST_ID
AT (PREVLEFT PREVTOP 72 12) NONUSABLE VISIBLEITEMS 3
POPUPLIST XW_PREFS_PHONIES_TRIGGER_ID XW_PREFS_PHONIES_LIST_ID
LIST "15x15" "13x13" "11x11" \
XW_PREFS_BDSIZE_LIST_ID AT (PREVLEFT PREVTOP 30 1) \
NONUSABLE VISIBLEITEMS NUM_BOARD_SIZES
CHECKBOX "Activer minuteur (minutes :)" ID XW_PREFS_TIMERON_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
FIELD XW_PREFS_TIMER_FIELD_ID PREVRIGHT+2 PREVTOP 12 AUTO UNDERLINED \
EDITABLE SINGLELINE NUMERIC MAXCHARS 3
#ifdef FEATURE_TRAY_EDIT
CHECKBOX "Choisir lettres à découvert" ID XW_PREFS_PICKTILES_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
#endif
#ifdef XWFEATURE_BLUETOOTH
CHECKBOX BT_CONF_STRING ID XW_PREFS_BTCONFIRM_CHECKBOX_ID \
AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE
#endif
/* buttons at the bottom */
BUTTON "Annuler" XW_PREFS_CANCEL_BUTTON_ID 42 BUTTON_TOP AUTO AUTO
BUTTON "Ok" XW_PREFS_OK_BUTTON_ID PREVRIGHT+10 PREVTOP AUTO AUTO
END /* XW_PREFS_FORM */
NAVIGATION ID XW_PREFS_FORM
INITIALSTATE kFrmNavHeaderFlagsObjectFocusStartState
INITIALOBJECTID XW_PREFS_ONEGAME_GADGET_ID
NAVIGATIONMAP
ROW XW_PREFS_ALLGAMES_GADGET_ID
XW_PREFS_ONEGAME_GADGET_ID
/* global prefs */
ROW XW_PREFS_PLAYERCOLORS_CHECKBOX_ID
ROW XW_PREFS_PROGRESSBAR_CHECKBOX_ID
ROW XW_PREFS_SHOWGRID_CHECKBOX_ID
ROW XW_PREFS_SHOWARROW_CHECKBOX_ID
ROW XW_PREFS_ROBOTSCORE_CHECKBOX_ID
ROW XW_PREFS_HIDETRAYVAL_CHECKBOX_ID
/* Per-game prefs */
ROW XW_PREFS_ROBOTSMART_CHECKBOX_ID
ROW XW_PREFS_NOHINTS_CHECKBOX_ID
#ifdef XWFEATURE_SEARCHLIMIT
XW_PREFS_HINTRECT_CHECKBOX_ID
#endif
ROW XW_PREFS_PHONIES_TRIGGER_ID
ROW XW_PREFS_BDSIZE_SELECTOR_ID
ROW XW_PREFS_TIMERON_CHECKBOX_ID
XW_PREFS_TIMER_FIELD_ID
#ifdef FEATURE_TRAY_EDIT
ROW XW_PREFS_PICKTILES_CHECKBOX_ID
#endif
ROW XW_PREFS_BTCONFIRM_CHECKBOX_ID
/* cmd buttons */
ROW XW_PREFS_CANCEL_BUTTON_ID
XW_PREFS_OK_BUTTON_ID
END
#define LEFT_EDGE 10
FORM ID XW_DICTINFO_FORM AT (2 111 156 47)
USABLE MODAL DEFAULTBTNID XW_DICTINFO_CANCEL_BUTTON_ID
BEGIN
TITLE "Dictionnaires"
LABEL "Dict. :" AUTOID AT (LEFT_EDGE 15)
POPUPTRIGGER "" ID XW_DICTINFO_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LIST "" ID XW_DICTINFO_LIST_ID AT (PREVLEFT PREVTOP 72 1)
NONUSABLE VISIBLEITEMS 4
POPUPLIST XW_DICTINFO_TRIGGER_ID XW_DICTINFO_LIST_ID
BUTTON "Ok" XW_DICTINFO_DONE_BUTTON_ID 25 31 AUTO AUTO
BUTTON "Transm." XW_DICTINFO_BEAM_BUTTON_ID 22 PREVTOP AUTO AUTO
BUTTON "Annuler" XW_DICTINFO_CANCEL_BUTTON_ID PREVRIGHT+20 PREVTOP
AUTO AUTO
END
FORM ID XW_ASK_FORM_ID AT (2 70 156 88)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_ASK_NO_BUTTON_ID
MENUID XW_ASK_MENU_ID
BEGIN
TITLE "Requête"
/* This has to be non-editable because the field is set via a ptr */
FIELD XW_ASK_TXT_FIELD_ID LEFT_EDGE-5 16 135 52 \
NONEDITABLE MULTIPLELINES
SCROLLBAR ID XW_ASK_SCROLLBAR_ID
AT ( PREVRIGHT+2 PREVTOP RECOMMENDED_SBAR_WIDTH
PREVBOTTOM - PREVTOP) USABLE
BUTTON "Oui" XW_ASK_YES_BUTTON_ID RIGHT@(156/2)-20 PREVBOTTOM+5 AUTO AUTO
BUTTON "Non" XW_ASK_NO_BUTTON_ID 156/2+20 PREVTOP AUTO AUTO
END
FORM ID XW_PASSWORD_DIALOG_ID AT ( 2 88 156 70 )
MODAL SAVEBEHIND DEFAULTBTNID XW_PASSWORD_CANCEL_BUTTON
BEGIN
TITLE "Mot de Passe"
LABEL "Entrer mot de passe pour :" XW_PASSWORD_NAME_LABEL 10 18 FONT 1 NONUSABLE
LABEL "Entrer nouveau mot de passe pour :" XW_PASSWORD_NEWNAME_LABEL 10 18 FONT 1
NONUSABLE
FIELD XW_PASSWORD_NAME_FIELD AT (PREVLEFT PREVBOTTOM+3 90 12) NONEDITABLE
SINGLELINE MAXCHARS MAX_PLAYERNAME_LENGTH
FIELD XW_PASSWORD_PASS_FIELD \
AT (PREVRIGHT+10 PREVTOP MAX_PASSWORD_LENGTH*6 12) \
EDITABLE SINGLELINE UNDERLINED MAXCHARS MAX_PASSWORD_LENGTH
GRAFFITISTATEINDICATOR 2 PREVBOTTOM+8
BUTTON "Ok" XW_PASSWORD_OK_BUTTON 45 PREVTOP AUTO AUTO
BUTTON "Annuler" XW_PASSWORD_CANCEL_BUTTON PREVRIGHT+10 PREVTOP AUTO AUTO
END
#define BLANK_PICK_TOP 15
FORM ID XW_BLANK_DIALOG_ID AT ( 2 74 156 83 ) USABLE
MODAL SAVEBEHIND
#ifdef FEATURE_TRAY_EDIT
DEFAULTBTNID XW_BLANK_PICK_BUTTON_ID
#endif
BEGIN
TITLE "Tirage des lettres"
FIELD XW_BLANK_LABEL_FIELD_ID AT (10 BLANK_PICK_TOP 110 39)
NONEDITABLE MULTIPLELINES
LIST "" ID XW_BLANK_LIST_ID AT (PREVRIGHT+2 BLANK_PICK_TOP 28 72)
USABLE VISIBLEITEMS 6
BUTTON "Ok" XW_BLANK_OK_BUTTON_ID RIGHT@PREVLEFT-4 65 16 AUTO
#ifdef FEATURE_TRAY_EDIT
BUTTON "Choisir toutes !" XW_BLANK_PICK_BUTTON_ID 5 65 62 AUTO
BUTTON "Suppr." XW_BLANK_BACKUP_BUTTON_ID PREVRIGHT+4 PREVTOP 28 AUTO
#endif
END
#ifdef XWFEATURE_SEARCHLIMIT
# define NTILES_TOP 17
# define NTILES_BUTTON_TOP 60
FORM ID XW_HINTCONFIG_FORM_ID AT ( 2 75 156 82 ) USABLE MODAL SAVEBEHIND
BEGIN
TITLE "Paramètres de l'aide"
LABEL "Au moins ce nb de lettres :" AUTOID 10 NTILES_TOP FONT 1 USABLE
SELECTORTRIGGER "" XW_HINTCONFIG_MINSELECTOR_ID \
AT (PREVRIGHT+3 NTILES_TOP AUTO AUTO) USABLE LEFTANCHOR
LIST "1" "2" "3" "4" "5" "6" "7" ID XW_HINTCONFIG_MINLIST_ID
AT (PREVRIGHT PREVTOP AUTO AUTO) VISIBLEITEMS 7 NONUSABLE
LABEL "Pas plus que ce nombre :" AUTOID 10 PREVTOP+15 FONT 1 USABLE
SELECTORTRIGGER "" XW_HINTCONFIG_MAXSELECTOR_ID \
AT (PREVRIGHT+3 PREVTOP AUTO AUTO) USABLE LEFTANCHOR
LIST "1" "2" "3" "4" "5" "6" "7" ID XW_HINTCONFIG_MAXLIST_ID
AT (PREVRIGHT PREVTOP AUTO AUTO) VISIBLEITEMS 7 NONUSABLE
BUTTON "Ok" XW_HINTCONFIG_OK_ID RIGHT@156-10 NTILES_BUTTON_TOP AUTO 12
BUTTON "Annuler" XW_HINTCONFIG_CANCEL_ID RIGHT@PREVLEFT-10 PREVTOP AUTO 12
END
#endif
#if defined OWNER_HASH || defined NO_REG_REQUIRED
FORM ID XW_SAVEDGAMES_DIALOG_ID AT ( 2 2 156 156 )
USABLE MODAL DEFAULTBTNID XW_SAVEDGAMES_DONE_BUTTON
BEGIN
TITLE "Parties sauvegardées"
LIST "" ID XW_SAVEDGAMES_LIST_ID AT (2 15 140 60) \
USABLE ENABLED VISIBLEITEMS 1
GRAFFITISTATEINDICATOR 2 120
FIELD XW_SAVEDGAMES_NAME_FIELD AT (PREVRIGHT+10 PREVTOP 100 AUTO)
EDITABLE SINGLELINE UNDERLINED MAXCHARS MAX_GAMENAME_LENGTH
BUTTON "Modif." XW_SAVEDGAMES_USE_BUTTON RIGHT@154 PREVTOP 30 AUTO
BUTTON "Dupl." XW_SAVEDGAMES_DUPE_BUTTON 2 PREVBOTTOM+5 31 AUTO
BUTTON "Suppr." XW_SAVEDGAMES_DELETE_BUTTON PREVRIGHT+5 PREVTOP 39 AUTO
BUTTON "Ouvrir" XW_SAVEDGAMES_OPEN_BUTTON PREVRIGHT+5 PREVTOP 33 AUTO
BUTTON "Fait" XW_SAVEDGAMES_DONE_BUTTON PREVRIGHT+5 PREVTOP 33 AUTO
END /* XW_SAVEDGAMES_DIALOG_ID */
#endif
ALERT XW_ERROR_ALERT_ID
ERROR
BEGIN
TITLE "Erreur"
MESSAGE "^1"
BUTTONS "Ok"
END
#ifdef FOR_GREMLINS
FORM ID XW_GREMLIN_WARN_FORM_ID AT ( 2 60 156 98 )
USABLE MODAL
BEGIN
TITLE "Gremlin Oops"
FIELD XW_GREMLIN_WARN_FIELD_ID AT (2 15 150 75)
NONEDITABLE MULTIPLELINES
END
#endif

View file

@ -1,8 +0,0 @@
OUTPUT_FORMAT("elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(ArmletEntryPoint)
SEARCH_DIR(/usr/local/arm-elf/lib);
SECTIONS
{
.text 0x00000000 : { *(.text) *(.rodata) *(.rodata.str1.4) }
}

View file

@ -1,721 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/*
* Copyright 1999 - 2009 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <PalmTypes.h>
#include <Form.h>
#include <List.h>
#include <Chars.h> /* for nextFieldChr */
#include <Graffiti.h> /* for GrfSetState */
#include <Event.h>
#ifdef XWFEATURE_FIVEWAY
# include <Hs.h>
#endif
#include "callback.h"
#include "comtypes.h"
#include "palmmain.h"
#include "comms.h"
#include "strutils.h"
#include "newgame.h"
#include "xwords4defines.h"
#include "dictui.h"
#include "palmdict.h"
#include "palmutil.h"
#include "palmir.h"
#include "prefsdlg.h"
#include "connsdlg.h"
#include "LocalizedStrIncludes.h"
static void handlePasswordTrigger( PalmAppGlobals* globals,
UInt16 controlID );
static XP_Bool updatePlayerInfo( PalmAppGlobals* globals );
static void loadNewGameState( PalmAppGlobals* globals );
static void unloadNewGameState( PalmAppGlobals* globals );
static void setNameThatFits( PalmNewGameState* state );
static void palmEnableColProc( void* closure, XP_U16 player,
NewGameColumn col, XP_TriEnable enable );
static void palmEnableAttrProc( void* closure, NewGameAttr attr,
XP_TriEnable enable );
static void palmGetColProc( void* closure, XP_U16 player, NewGameColumn col,
NgCpCallbk cpcb, const void* cbClosure );
static void palmSetColProc( void* closure, XP_U16 player, NewGameColumn col,
const NGValue value );
static void palmSetAttrProc( void* closure, NewGameAttr attr,
const NGValue value );
static void handleRobotChanged( PalmNewGameState* state, XP_U16 controlID,
XP_Bool on );
#ifndef XWFEATURE_STANDALONE_ONLY
static void handleRemoteChanged( PalmNewGameState* state, XP_U16 controlID,
XP_Bool on );
static Boolean checkHiliteGadget(PalmAppGlobals* globals,
const EventType* event,
PalmNewGameState* state );
static void drawConnectGadgets( PalmAppGlobals* globals );
static void changeGadgetHilite( PalmAppGlobals* globals, UInt16 hiliteID );
#else
# define checkHiliteGadget(globals, event, state) XP_FALSE
# define drawConnectGadgets( globals )
#endif
/*****************************************************************************
*
****************************************************************************/
Boolean
newGameHandleEvent( EventPtr event )
{
Boolean result = false;
PalmAppGlobals* globals;
FormPtr form;
CurGameInfo* gi;
PalmNewGameState* state;
Int16 chosen;
XP_S16 itemId;
Boolean on;
CALLBACK_PROLOGUE();
globals = getFormRefcon();
gi = &globals->gameInfo;
state = &globals->newGameState;
switch ( event->eType ) {
case frmOpenEvent:
GlobalPrefsToLocal( globals );
form = FrmGetActiveForm();
XP_ASSERT( !state->ngc );
XP_MEMSET( state, 0, sizeof(*state) );
state->form = form;
loadNewGameState( globals );
if ( !globals->isNewGame ) {
disOrEnableTri( form, XW_DICT_SELECTOR_ID, TRI_ENAB_DISABLED );
}
XP_ASSERT( !!state->dictName );
setNameThatFits( state );
XP_ASSERT( !!globals->game.server );
case frmUpdateEvent:
GrfSetState( false, false, false );
FrmDrawForm( FrmGetActiveForm() );
drawConnectGadgets( globals );
result = true;
break;
#ifdef XWFEATURE_FIVEWAY
/* docs say to return HANDLED for both take and lost if the right
object */
case frmObjectFocusTakeEvent:
case frmObjectFocusLostEvent:
result = considerGadgetFocus( globals, event, XW_SOLO_GADGET_ID,
XW_CLIENT_GADGET_ID );
break;
#endif
case penDownEvent:
result = checkHiliteGadget( globals, event, state );
break;
#ifdef XWFEATURE_FIVEWAY
case keyDownEvent:
itemId = getFocusOwner();
if ( itemId >= 0 ) {
result = tryRockerKey( event->data.keyDown.chr, itemId,
XW_SOLO_GADGET_ID, XW_CLIENT_GADGET_ID );
if ( result ) {
changeGadgetHilite( globals, itemId );
}
}
break;
#endif
case prefsChangedEvent:
state->forwardChange = true;
break;
case ctlSelectEvent:
result = true;
itemId = event->data.ctlSelect.controlID;
on = event->data.ctlSelect.on;
switch ( itemId ) {
case XW_ROBOT_1_CHECKBOX_ID:
case XW_ROBOT_2_CHECKBOX_ID:
case XW_ROBOT_3_CHECKBOX_ID:
case XW_ROBOT_4_CHECKBOX_ID:
handleRobotChanged( state, itemId, on );
break;
#ifndef XWFEATURE_STANDALONE_ONLY
case XW_REMOTE_1_CHECKBOX_ID:
case XW_REMOTE_2_CHECKBOX_ID:
case XW_REMOTE_3_CHECKBOX_ID:
case XW_REMOTE_4_CHECKBOX_ID:
handleRemoteChanged( state, itemId, on );
break;
#endif
case XW_NPLAYERS_SELECTOR_ID:
XP_ASSERT( globals->isNewGame );
chosen = LstPopupList( state->playerNumList );
if ( chosen >= 0 ) {
NGValue value;
setSelectorFromList( XW_NPLAYERS_SELECTOR_ID,
state->playerNumList,
chosen );
value.ng_u16 = chosen + 1;
newg_attrChanged( state->ngc, NG_ATTR_NPLAYERS, value );
}
break;
case XW_DICT_SELECTOR_ID:
XP_ASSERT( globals->isNewGame );
globals->dictuiForBeaming = false;
FrmPopupForm( XW_DICTINFO_FORM );
/* popup dict selection dialog -- or maybe just a list if there
are no preferences to set. The results should all be
cancellable, so don't delete the existing dictionary (if
any) until OK is chosen */
break;
case XW_GINFO_JUGGLE_ID:
while ( !newg_juggle( state->ngc ) ) {
}
(void)newg_juggle( state->ngc );
break;
case XW_OK_BUTTON_ID:
if ( updatePlayerInfo( globals ) ) {
/* if we put up the prefs form from within this one and the user
clicked ok, we need to make sure the main form gets the
notification so it can make use of any changes. This event
needs to arrive before the newGame event so any changes will
be incorporated. */
if ( state->forwardChange ) {
postEmptyEvent( prefsChangedEvent );
state->forwardChange = false;
}
if ( globals->isNewGame ) {
postEmptyEvent( newGameOkEvent );
globals->postponeDraw = true;
}
unloadNewGameState( globals );
FrmReturnToForm( 0 );
}
break;
case XW_CANCEL_BUTTON_ID:
unloadNewGameState( globals );
postEmptyEvent( newGameCancelEvent );
FrmReturnToForm( 0 );
break;
case XW_PREFS_BUTTON_ID:
/* bring up with the this-game tab selected */
XP_ASSERT( !!globals->prefsDlgState );
globals->prefsDlgState->stateTypeIsGlobal = false;
FrmPopupForm( XW_PREFS_FORM );
break;
case XW_PLAYERPASSWD_1_TRIGGER_ID:
case XW_PLAYERPASSWD_2_TRIGGER_ID:
case XW_PLAYERPASSWD_3_TRIGGER_ID:
case XW_PLAYERPASSWD_4_TRIGGER_ID:
handlePasswordTrigger( globals, itemId );
break;
default: /* one of the password selectors? */
result = false;
}
break;
case dictSelectedEvent:
/* posted by the form we raise when user clicks Dictionary selector
above. */
if ( state->dictName != NULL ) {
XP_FREE( globals->mpool, state->dictName );
}
state->dictName =
((DictSelectedData*)&event->data.generic)->dictName;
setNameThatFits( state );
break;
case appStopEvent: /* I get these on older palms */
unloadNewGameState( globals );
result = false;
default:
break;
}
CALLBACK_EPILOGUE();
return result;
} /* newGameHandleEvent */
static void
setNameThatFits( PalmNewGameState* state )
{
RectangleType rect;
XP_U16 width;
XP_U16 len = XP_STRLEN( (const char*)state->dictName );
XP_MEMCPY( state->shortDictName, state->dictName, len + 1 );
/* The width available is the cancel button's left minus ours */
getObjectBounds( XW_CANCEL_BUTTON_ID, &rect );
width = rect.topLeft.x;
getObjectBounds( XW_DICT_SELECTOR_ID, &rect );
width -= (rect.topLeft.x + 6);
for ( ; FntCharsWidth( (const char*)state->dictName, len ) > width; --len ) {
/* do nothing */
}
state->shortDictName[len] = '\0';
CtlSetLabel( getActiveObjectPtr( XW_DICT_SELECTOR_ID ),
(const char*)state->shortDictName );
} /* setNameThatFits */
/*
* Copy the local state into global state.
*/
static XP_Bool
updatePlayerInfo( PalmAppGlobals* globals )
{
CurGameInfo* gi;
PalmNewGameState* state = &globals->newGameState;
XP_Bool success;
gi = &globals->gameInfo;
success = newg_store( state->ngc, gi, XP_TRUE );
if ( success ) {
gi->boardSize = globals->prefsDlgState->curBdSize;
replaceStringIfDifferent( globals->mpool, &gi->dictName,
globals->newGameState.dictName );
}
return success;
} /* updatePlayerInfo */
/* Frame 'em, draw their text, and highlight the one that's selected
*/
#ifndef XWFEATURE_STANDALONE_ONLY
static void
drawConnectGadgets( PalmAppGlobals* globals )
{
XP_U16 hiliteItem = globals->newGameState.curServerHilite
+ XW_SOLO_GADGET_ID ;
ListPtr list = getActiveObjectPtr( XW_SERVERTYPES_LIST_ID );
XP_ASSERT( !!list );
drawGadgetsFromList( list, XW_SOLO_GADGET_ID, XW_CLIENT_GADGET_ID,
hiliteItem );
#ifdef XWFEATURE_FIVEWAY
drawFocusRingOnGadget( globals, XW_SOLO_GADGET_ID, XW_CLIENT_GADGET_ID );
#endif
} /* drawConnectGadgets */
static void
changeGadgetHilite( PalmAppGlobals* globals, UInt16 hiliteID )
{
PalmNewGameState* state = &globals->newGameState;
XP_Bool isNewGame = globals->isNewGame;
hiliteID -= XW_SOLO_GADGET_ID;
if ( hiliteID != state->curServerHilite ) {
/* if it's not a new game, don't recognize the change */
if ( isNewGame ) {
NGValue value;
state->curServerHilite = hiliteID;
drawConnectGadgets( globals );
value.ng_role = hiliteID;
newg_attrChanged( state->ngc, NG_ATTR_ROLE, value );
} else {
beep();
}
}
#if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY
/* Even if it didn't change, pop the connections form. It's only
informational in the non-new-game case; nothing can be changed. */
if ( hiliteID != SERVER_STANDALONE ) {
if ( isNewGame || (hiliteID==globals->newGameState.curServerHilite) ) {
PopupConnsForm( globals, hiliteID, &state->addr );
}
}
#endif
} /* changeGadgetHilite */
static Boolean
checkHiliteGadget( PalmAppGlobals* globals, const EventType* event,
PalmNewGameState* XP_UNUSED_DBG(state) )
{
Boolean result = false;
UInt16 selGadget;
XP_ASSERT( &globals->newGameState == state );
result = penInGadget( event, &selGadget );
if ( result ) {
changeGadgetHilite( globals, selGadget );
}
return result;
} /* checkHiliteGadget */
#endif
static void
showMaskedPwd( XP_U16 objectID, XP_Bool set )
{
const char* label = set? "*" : " ";
/* control owns the string passed in */
CtlSetLabel( getActiveObjectPtr( objectID ), label );
}
/* If there's currently no password set, just let 'em set one. If there is
* one set, they need to know the old before setting the new.
*/
static void
handlePasswordTrigger( PalmAppGlobals* globals, UInt16 controlID )
{
UInt16 playerNum;
PalmNewGameState* state = &globals->newGameState;
XP_UCHAR* name;
FieldPtr nameField;
XP_U16 len;
playerNum = (controlID - XW_PLAYERPASSWD_1_TRIGGER_ID) / NUM_PLAYER_COLS;
XP_ASSERT( playerNum < MAX_NUM_PLAYERS );
nameField = getActiveObjectPtr( XW_PLAYERNAME_1_FIELD_ID +
(NUM_PLAYER_COLS * playerNum) );
name = (XP_UCHAR*)FldGetTextPtr( nameField );
len = sizeof(state->passwds[playerNum]);
if ( askPassword( globals, name, true, state->passwds[playerNum], &len )) {
showMaskedPwd( controlID, len > 0 );
}
} /* handlePasswordTrigger */
static void
unloadNewGameState( PalmAppGlobals* globals )
{
PalmNewGameState* state = &globals->newGameState;
XP_FREE( globals->mpool, state->dictName );
state->dictName = NULL;
newg_destroy( state->ngc );
state->ngc = NULL;
} /* unloadNewGameState */
static XP_U16
getBaseForCol( NewGameColumn col )
{
XP_U16 resID = 0;
switch ( col ) {
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_COL_REMOTE:
resID = XW_REMOTE_1_CHECKBOX_ID;
break;
#endif
case NG_COL_NAME:
resID = XW_PLAYERNAME_1_FIELD_ID;
break;
case NG_COL_ROBOT:
resID = XW_ROBOT_1_CHECKBOX_ID;
break;
case NG_COL_PASSWD:
resID = XW_PLAYERPASSWD_1_TRIGGER_ID;
break;
default:
XP_ASSERT( XP_FALSE );
}
XP_ASSERT( !!resID );
return resID;
} /* getBaseForCol */
static XP_U16
objIDForCol( XP_U16 player, NewGameColumn col )
{
XP_U16 base = getBaseForCol( col );
return base + (NUM_PLAYER_COLS * player);
}
static ControlPtr
getControlForCol( XP_U16 player, NewGameColumn col )
{
XP_U16 objID = objIDForCol( player, col );
ControlPtr ctrl = getActiveObjectPtr( objID );
return ctrl;
}
static void
palmEnableColProc( void* closure, XP_U16 player, NewGameColumn col,
XP_TriEnable enable )
{
PalmAppGlobals* globals = (PalmAppGlobals*)closure;
PalmNewGameState* state = &globals->newGameState;
XP_U16 objID;
/* If it's a field, there need to be three states */
objID = objIDForCol( player, col );
disOrEnableTri( state->form, objID, enable );
}
/* Palm doesn't really do "disabled." Things are visible or not. But we
* want the player count dropdown in particular visible since it give
* information. So different objects get treated differently. The code
* handling ctlEnterEvent can disable for non-newgame dialogs even if a
* control is technically enabled.
*/
static void
palmEnableAttrProc(void* closure, NewGameAttr attr, XP_TriEnable ngEnable )
{
PalmAppGlobals* globals = (PalmAppGlobals*)closure;
PalmNewGameState* state = &globals->newGameState;
XP_U16 objID = 0;
switch ( attr ) {
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_ATTR_ROLE:
/* always enabled */
break;
case NG_ATTR_REMHEADER:
objID = XW_LOCAL_LABEL_ID;
break;
case NG_ATTR_CANCONFIG: /* not needed on palm */
break;
#endif
case NG_ATTR_NPLAYERS:
objID = XW_NPLAYERS_SELECTOR_ID;
break;
case NG_ATTR_NPLAYHEADER:
break;
case NG_ATTR_CANJUGGLE:
objID = XW_GINFO_JUGGLE_ID;
break;
}
if ( objID != 0 ) {
disOrEnableTri( state->form, objID, ngEnable );
}
} /* palmEnableAttrProc */
static void
palmGetColProc( void* closure, XP_U16 player, NewGameColumn col,
NgCpCallbk cpcb, const void* cbClosure )
{
PalmAppGlobals* globals;
PalmNewGameState* state;
NGValue value;
XP_U16 objID = objIDForCol( player, col );
switch ( col ) {
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_COL_REMOTE:
#endif
case NG_COL_ROBOT:
value.ng_bool = getBooleanCtrl( objID );
break;
case NG_COL_NAME:
value.ng_cp = FldGetTextPtr( getActiveObjectPtr( objID ) );
break;
case NG_COL_PASSWD:
globals = (PalmAppGlobals*)closure;
state = &globals->newGameState;
value.ng_cp = state->passwds[player];
break;
default:
XP_ASSERT(0);
}
(*cpcb)( value, cbClosure );
}
static void
palmSetColProc( void* closure, XP_U16 player, NewGameColumn col,
const NGValue value )
{
PalmAppGlobals* globals = (PalmAppGlobals*)closure;
PalmNewGameState* state = &globals->newGameState;
ControlPtr ctrl;
XP_U16 objID = objIDForCol( player, col );
switch ( col ) {
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_COL_REMOTE:
#endif
case NG_COL_ROBOT:
ctrl = getControlForCol( player, col );
CtlSetValue( ctrl, value.ng_bool );
break;
case NG_COL_NAME:
setFieldStr( objID, value.ng_cp );
break;
case NG_COL_PASSWD:
if ( !!value.ng_cp ) {
XP_SNPRINTF( state->passwds[player], sizeof(state->passwds[player]),
"%s", value.ng_cp );
showMaskedPwd( objID, *value.ng_cp != '\0' );
}
default: /* shut up compiler */
break;
}
} /* palmSetColProc */
static void
palmSetAttrProc( void* closure, NewGameAttr attr, const NGValue value )
{
PalmAppGlobals* globals = (PalmAppGlobals*)closure;
PalmNewGameState* state = &globals->newGameState;
switch ( attr ) {
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_ATTR_ROLE:
state->curServerHilite = value.ng_role;
break;
case NG_ATTR_REMHEADER:
break;
#endif
case NG_ATTR_NPLAYERS:
setSelectorFromList( XW_NPLAYERS_SELECTOR_ID,
state->playerNumList, value.ng_u16 - 1 );
break;
case NG_ATTR_NPLAYHEADER: {
FieldPtr field = getActiveObjectPtr( XW_TOTALP_FIELD_ID );
char* cur = FldGetTextPtr( field );
/* Need to update to get it drawn and that flashes the whole dialog.
So avoid if possible. */
if ( !cur || (0 != StrCompare( cur, value.ng_cp ) ) ) {
FldSetTextPtr( field, (char*)value.ng_cp );
FrmUpdateForm( 0, frmRedrawUpdateCode );
}
}
break;
case NG_ATTR_CANJUGGLE:
XP_ASSERT(0); /* doesn't make sense */
case NG_ATTR_CANCONFIG: /* not needed on palm */
break;
}
} /* palmSetAttrProc */
static XP_U16
palmPlayerFromID( XP_U16 id, XP_U16 base )
{
XP_U16 player;
player = (id - base) / NUM_PLAYER_COLS;
return player;
} /* palmPlayerFromID */
static void
handleRobotChanged( PalmNewGameState* state, XP_U16 controlID, XP_Bool on )
{
XP_U16 player;
NGValue value;
player = palmPlayerFromID( controlID, XW_ROBOT_1_CHECKBOX_ID );
value.ng_bool = on;
newg_colChanged( state->ngc, player );
}
#ifndef XWFEATURE_STANDALONE_ONLY
static void
handleRemoteChanged( PalmNewGameState* state, XP_U16 controlID, XP_Bool on )
{
XP_U16 player;
NGValue value;
XP_LOGF( "%s: controlID=%d", __func__, controlID );
player = palmPlayerFromID( controlID, XW_REMOTE_1_CHECKBOX_ID );
value.ng_bool = on;
newg_colChanged( state->ngc, player );
}
#endif
XP_U16
countXPorts( const PalmAppGlobals* globals )
{
XP_U16 xports = 0;
#ifdef XWFEATURE_IR
++xports;
#endif
#ifdef XWFEATURE_BLUETOOTH
if ( globals->hasBTLib ) {
++xports;
}
#endif
#ifdef XWFEATURE_RELAY
++xports;
#endif
return xports;
}
static void
loadNewGameState( PalmAppGlobals* globals )
{
CurGameInfo* gi = &globals->gameInfo;
PalmNewGameState* state = &globals->newGameState;
state->dictName = copyString( globals->mpool, gi->dictName );
state->playerNumList = getActiveObjectPtr( XW_NPLAYERS_LIST_ID );
state->nXPorts = countXPorts( globals );
XP_ASSERT( !state->ngc );
state->ngc = newg_make( MPPARM(globals->mpool)
globals->isNewGame,
&globals->util,
palmEnableColProc,
palmEnableAttrProc,
palmGetColProc,
palmSetColProc,
palmSetAttrProc,
globals );
newg_load( state->ngc, gi );
#if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY
if ( globals->game.comms ) {
comms_getAddr( globals->game.comms, &state->addr );
} else {
comms_getInitialAddr( &state->addr );
}
#elif defined XWFEATURE_IR
state->addr.conType = COMMS_CONN_IR;
#endif
} /* loadNewGameState */

View file

@ -1,30 +0,0 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/*
* Copyright 2001-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 NEWGAME_H
#define NEWGAME_H
#include <Event.h>
#include "palmmain.h"
Boolean newGameHandleEvent( EventPtr event );
#endif

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more