Add UI to support turning on/off picking tiles

This commit is contained in:
ehouse 2003-11-19 04:09:15 +00:00
parent 6a30f1c7c1
commit 11347ef641
4 changed files with 49 additions and 2 deletions

View file

@ -310,7 +310,7 @@ END /* XW_CONNS_FORM */
#define PREFS_MODE_TOP 15
#define PREFS_TOP 30
#define TIMER_TOP 72
#define BUTTON_TOP 98
#define BUTTON_TOP 99
FORM ID XW_PREFS_FORM AT (2 44 156 115)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_PREFS_CANCEL_BUTTON_ID
@ -362,6 +362,13 @@ BEGIN
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_SEETILES_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
CHECKBOX "Robots too" ID XW_PREFS_SEETILESROBOT_CHECKBOX_ID \
AT (PREVRIGHT+5 PREVTOP 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

View file

@ -160,6 +160,10 @@ typedef struct PrefsDlgState {
XP_Bool showGrid;
XP_Bool hintsNotAllowed;
XP_Bool timerEnabled;
#ifdef FEATURE_TRAY_EDIT
XP_Bool allowPickTiles;
XP_Bool allowPickTilesRobot;
#endif
} PrefsDlgState;
typedef struct DictState {

View file

@ -117,6 +117,9 @@ PrefsFormHandleEvent( EventPtr event )
case XW_PREFS_TIMERON_CHECKBOX_ID:
XP_ASSERT( globals->isNewGame );
#ifdef FEATURE_TRAY_EDIT
case XW_PREFS_SEETILES_CHECKBOX_ID:
#endif
form = FrmGetActiveForm();
showHidePrefsWidgets( globals, form );
break;
@ -190,6 +193,10 @@ GlobalPrefsToLocal( PalmAppGlobals* globals )
state->hintsNotAllowed = globals->gameInfo.hintsNotAllowed;
state->timerEnabled = globals->util.gameInfo->timerEnabled;
state->gameSeconds = globals->util.gameInfo->gameSeconds;
#ifdef FEATURE_TRAY_EDIT
state->allowPickTiles = globals->util.gameInfo->allowPickTiles;
state->allowPickTilesRobot = globals->util.gameInfo->allowPickTilesRobot;
#endif
state->stateTypeIsGlobal = globals->stateTypeIsGlobal;
} /* GlobalPrefsToLocal */
@ -220,6 +227,12 @@ LocalPrefsToGlobal( PalmAppGlobals* globals )
globals->util.gameInfo->timerEnabled = state->timerEnabled;
globals->util.gameInfo->gameSeconds = state->gameSeconds;
#ifdef FEATURE_TRAY_EDIT
globals->util.gameInfo->allowPickTiles = state->allowPickTiles;
globals->util.gameInfo->allowPickTilesRobot = state->allowPickTilesRobot;
#endif
return erase;
} /* LocalPrefsToGlobal */
@ -254,6 +267,12 @@ localPrefsToControls( PalmAppGlobals* globals, PrefsDlgState* state )
state->cp.showRobotScores );
setBooleanCtrl( XW_PREFS_TIMERON_CHECKBOX_ID, state->timerEnabled );
#ifdef FEATURE_TRAY_EDIT
setBooleanCtrl( XW_PREFS_SEETILES_CHECKBOX_ID, state->allowPickTiles );
setBooleanCtrl( XW_PREFS_SEETILESROBOT_CHECKBOX_ID,
state->allowPickTilesRobot );
#endif
numToField( XW_PREFS_TIMER_FIELD_ID, state->gameSeconds/60 );
} /* localPrefsToControls */
@ -289,6 +308,12 @@ controlsToLocalPrefs( PalmAppGlobals* globals, PrefsDlgState* state )
state->timerEnabled = getBooleanCtrl( XW_PREFS_TIMERON_CHECKBOX_ID );
state->gameSeconds = fieldToNum( XW_PREFS_TIMER_FIELD_ID ) * 60;
#ifdef FEATURE_TRAY_EDIT
state->allowPickTiles = getBooleanCtrl( XW_PREFS_SEETILES_CHECKBOX_ID );
state->allowPickTilesRobot =
getBooleanCtrl( XW_PREFS_SEETILESROBOT_CHECKBOX_ID );
#endif
} /* controlsToLocalPrefs */
static void
@ -344,6 +369,9 @@ showHidePrefsWidgets( PalmAppGlobals* globals, FormPtr form )
if ( !global ) {
Boolean on = getBooleanCtrl( XW_PREFS_TIMERON_CHECKBOX_ID );
disOrEnable( form, XW_PREFS_TIMER_FIELD_ID, on );
on = getBooleanCtrl( XW_PREFS_SEETILES_CHECKBOX_ID );
disOrEnable( form, XW_PREFS_SEETILESROBOT_CHECKBOX_ID, on );
}
} /* showHidePrefsWidgets */

View file

@ -250,6 +250,10 @@
#define XW_PREFS_NOHINTS_CHECKBOX_ID 2720
#define XW_PREFS_TIMERON_CHECKBOX_ID 2721
#define XW_PREFS_TIMER_FIELD_ID 2722
#ifdef FEATURE_TRAY_EDIT
# define XW_PREFS_SEETILES_CHECKBOX_ID 2723
# define XW_PREFS_SEETILESROBOT_CHECKBOX_ID 2724
#endif
/* These aren't part of the hide/show thing as they're displayed only
* explicitly byother controls */
@ -260,7 +264,11 @@
#define XW_PREFS_FIRST_GLOBAL_ID XW_PREFS_PLAYERCOLORS_CHECKBOX_ID
#define XW_PREFS_LAST_GLOBAL_ID XW_PREFS_ROBOTSCORE_CHECKBOX_ID
#define XW_PREFS_FIRST_PERGAME_ID XW_PREFS_ROBOTSMART_CHECKBOX_ID
#define XW_PREFS_LAST_PERGAME_ID XW_PREFS_TIMER_FIELD_ID
#ifdef FEATURE_TRAY_EDIT
# define XW_PREFS_LAST_PERGAME_ID XW_PREFS_SEETILESROBOT_CHECKBOX_ID
#else
# define XW_PREFS_LAST_PERGAME_ID XW_PREFS_TIMER_FIELD_ID
#endif
#define XW_PREFS_CANCEL_BUTTON_ID 2725
#define XW_PREFS_OK_BUTTON_ID 2726