new form for picking nTiles used in hint

This commit is contained in:
ehouse 2003-11-30 22:03:02 +00:00
parent 4bd5a4675b
commit 6cb0f359ad
4 changed files with 51 additions and 3 deletions

View file

@ -454,6 +454,19 @@ BEGIN
#endif
END
FORM ID XW_ASKNTILES_FORM_ID AT ( 2 60 156 97 ) USABLE MODAL SAVEBEHIND
BEGIN
TITLE "Number of tiles"
LABEL "Use how many tiles" AUTOID 10 18 FONT 1 USABLE
LABEL "for this hint?" AUTOID 10 PREVBOTTOM FONT 1 USABLE
LIST "1" "2" "3" "4" "5" "6" "7" ID XW_ASKNTILES_LIST_ID
AT ( 156-20 16 AUTO AUTO) USABLE VISIBLEITEMS 7
BUTTON "Ok" AUTOID RIGHT@PREVLEFT-10 PREVBOTTOM-12 AUTO 12
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

View file

@ -610,6 +610,7 @@ palmInitPrefs( PalmAppGlobals* globals )
#ifdef SHOW_PROGRESS
globals->gState.showProgress = true;
#endif
globals->gState.lastNTiles = MAX_TRAY_TILES;
} /* palmInitPrefs */
static void
@ -1358,6 +1359,31 @@ handleHideTray( PalmAppGlobals* globals )
return draw;
} /* handleHideTray */
static XP_U16
palmAskNTiles( PalmAppGlobals* globals, XP_U16 defaultChoice )
{
FormPtr form, prevForm;
UInt16 buttonHit;
ListPtr list;
prevForm = FrmGetActiveForm();
form = FrmInitForm( XW_ASKNTILES_FORM_ID );
FrmSetActiveForm( form );
list = getActiveObjectPtr( XW_ASKNTILES_LIST_ID );
XP_ASSERT( defaultChoice > 0 && defaultChoice <= MAX_TRAY_TILES );
LstSetSelection( list, defaultChoice-1 );
buttonHit = FrmDoDialog( form );
defaultChoice = LstGetSelection( list ) + 1;
FrmDeleteForm( form );
FrmSetActiveForm( prevForm );
return defaultChoice;
} /* palmAskNTiles */
static Boolean
handleHintRequest( PalmAppGlobals* globals, XP_Bool askNTiles )
{
@ -1368,7 +1394,8 @@ handleHintRequest( PalmAppGlobals* globals, XP_Bool askNTiles )
XP_ASSERT( !!globals->game.board );
if ( askNTiles ) {
nTiles = 3;
nTiles = palmAskNTiles( globals, globals->gState.lastNTiles );
globals->gState.lastNTiles = nTiles;
} else {
nTiles = MAX_TRAY_TILES;
}

View file

@ -113,6 +113,8 @@ typedef struct XWords4PreferenceType {
#endif
/* New for 0x0405 */
CommonPrefs cp;
/* New for 0x0406 */
XP_U8 lastNTiles;
} XWords4PreferenceType;

View file

@ -51,9 +51,10 @@
#define XW_COLORPREF_DIALOG_ID 1007
#define XW_PREFS_FORM 1008
#define XW_SAVEDGAMES_DIALOG_ID 1009
#define XW_CONNS_FORM 1010
#define XW_ASKNTILES_FORM_ID 1010
#define XW_CONNS_FORM 1011
#ifdef FOR_GREMLINS
# define XW_GREMLIN_WARN_FORM_ID 1011
# define XW_GREMLIN_WARN_FORM_ID 1012
#endif
#define XW_ASK_MENU_ID 1001
@ -302,6 +303,11 @@
#define XW_CONNS_HOSTIP_LABEL_ID 2910
#define XW_CONNS_HOSTIP_FIELD_ID 2911
/*
* selector for number of tiles during hint
*/
#define XW_ASKNTILES_LIST_ID 2950
#define PALM_BOARD_TOP 8
#define PALM_GRIDLESS_BOARD_TOP 2