add checkbox for hint rect

This commit is contained in:
ehouse 2004-06-22 06:30:58 +00:00
parent 59ac0e42ef
commit 004ec05a64
4 changed files with 55 additions and 10 deletions

View file

@ -314,13 +314,18 @@ END /* XW_CONNS_FORM */
#else
# define TRAY_EDIT_ADJUST 0
#endif
#ifdef XWFEATURE_SEARCHLIMIT
# define SEARCHLIMIT_ADJUST 15
#else
# define SEARCHLIMIT_ADJUST 0
#endif
#define PREFS_MODE_TOP 15
#define PREFS_TOP 30
#define DLG_TOP 52-TRAY_EDIT_ADJUST
#define DLG_HEIGHT 107+TRAY_EDIT_ADJUST
#define TIMER_TOP 74
#define BUTTON_TOP TIMER_TOP+16+TRAY_EDIT_ADJUST
#define DLG_TOP (52-TRAY_EDIT_ADJUST-SEARCHLIMIT_ADJUST)
#define DLG_HEIGHT (107+TRAY_EDIT_ADJUST+SEARCHLIMIT_ADJUST)
#define TIMER_TOP (74+SEARCHLIMIT_ADJUST)
#define BUTTON_TOP (TIMER_TOP+16+TRAY_EDIT_ADJUST)
FORM ID XW_PREFS_FORM AT (2 DLG_TOP 156 DLG_HEIGHT)
USABLE MODAL SAVEBEHIND DEFAULTBTNID XW_PREFS_CANCEL_BUTTON_ID
@ -338,23 +343,31 @@ BEGIN
CHECKBOX "Color played tiles" ID XW_PREFS_PLAYERCOLORS_CHECKBOX_ID \
AT (LEFTCOL PREFS_TOP AUTO AUTO) NONUSABLE
CHECKBOX "Show progress bar" ID XW_PREFS_PROGRESSBAR_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
AT (LEFTCOL PREVBOTTOM+3 AUTO AUTO) NONUSABLE
CHECKBOX "Larger board" ID XW_PREFS_SHOWGRID_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
AT (LEFTCOL PREVBOTTOM+3 AUTO AUTO) NONUSABLE
CHECKBOX "Enable arrow cursor" ID XW_PREFS_SHOWARROW_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
AT (LEFTCOL PREVBOTTOM+3 AUTO AUTO) NONUSABLE
CHECKBOX "Show robot scores" ID XW_PREFS_ROBOTSCORE_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM AUTO AUTO) NONUSABLE
AT (LEFTCOL PREVBOTTOM+3 AUTO AUTO) NONUSABLE
/* single-game prefs */
CHECKBOX "Smart robot" ID XW_PREFS_ROBOTSMART_CHECKBOX_ID \
AT (LEFTCOL PREFS_TOP AUTO AUTO) NONUSABLE
#ifdef XWFEATURE_SEARCHLIMIT
CHECKBOX "Disallow hints" ID XW_PREFS_NOHINTS_CHECKBOX_ID \
AT (LEFTCOL PREVBOTTOM+3 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 PREVTOP AUTO AUTO) NONUSABLE
#endif
LABEL "Phonies:" XW_PREFS_PHONIES_LABEL_ID AT (LEFTCOL PREVBOTTOM+3)
POPUPTRIGGER "" ID XW_PREFS_PHONIES_TRIGGER_ID
AT (PREVRIGHT+5 PREVTOP 72 12) LEFTANCHOR
LABEL "Board size: " XW_PREFS_BDSIZE_LABEL_ID
AT (LEFTCOL PREVBOTTOM+2)
SELECTORTRIGGER "" XW_PREFS_BDSIZE_SELECTOR_ID \

View file

@ -171,6 +171,9 @@ typedef struct PrefsDlgState {
#ifdef FEATURE_TRAY_EDIT
XP_Bool allowPickTiles;
#endif
#ifdef XWFEATURE_SEARCHLIMIT
XP_Bool allowHintRect;
#endif
} PrefsDlgState;
typedef struct DictState {

View file

@ -43,6 +43,7 @@ PrefsFormHandleEvent( EventPtr event )
FormPtr form;
EventType eventToPost;
Int16 chosen;
Boolean checked;
CALLBACK_PROLOGUE();
globals = getFormRefcon();
@ -96,6 +97,12 @@ PrefsFormHandleEvent( EventPtr event )
result = true;
switch ( event->data.ctlSelect.controlID ) {
case XW_PREFS_NOHINTS_CHECKBOX_ID:
checked = getBooleanCtrl( XW_PREFS_NOHINTS_CHECKBOX_ID );
disOrEnable( FrmGetActiveForm(), XW_PREFS_HINTRECT_CHECKBOX_ID,
!checked );
break;
case XW_PREFS_PHONIES_TRIGGER_ID:
chosen = LstPopupList( state->phoniesList );
if ( chosen >= 0 ) {
@ -191,6 +198,9 @@ GlobalPrefsToLocal( PalmAppGlobals* globals )
state->phoniesAction = globals->util.gameInfo->phoniesAction;
state->hintsNotAllowed = globals->gameInfo.hintsNotAllowed;
#ifdef XWFEATURE_SEARCHLIMIT
state->allowHintRect = globals->gameInfo.allowHintRect;
#endif
state->timerEnabled = globals->util.gameInfo->timerEnabled;
state->gameSeconds = globals->util.gameInfo->gameSeconds;
#ifdef FEATURE_TRAY_EDIT
@ -223,7 +233,9 @@ LocalPrefsToGlobal( PalmAppGlobals* globals )
globals->util.gameInfo->phoniesAction = state->phoniesAction;
globals->gameInfo.hintsNotAllowed = state->hintsNotAllowed;
#ifdef XWFEATURE_SEARCHLIMIT
globals->gameInfo.allowHintRect = state->allowHintRect;
#endif
globals->util.gameInfo->timerEnabled = state->timerEnabled;
globals->util.gameInfo->gameSeconds = state->gameSeconds;
@ -258,6 +270,9 @@ localPrefsToControls( PalmAppGlobals* globals, PrefsDlgState* state )
setBooleanCtrl( XW_PREFS_PLAYERCOLORS_CHECKBOX_ID, state->showColors );
setBooleanCtrl( XW_PREFS_PROGRESSBAR_CHECKBOX_ID, state->showProgress );
setBooleanCtrl( XW_PREFS_NOHINTS_CHECKBOX_ID, state->hintsNotAllowed );
#ifdef XWFEATURE_SEARCHLIMIT
setBooleanCtrl( XW_PREFS_HINTRECT_CHECKBOX_ID, state->allowHintRect );
#endif
setBooleanCtrl( XW_PREFS_ROBOTSMART_CHECKBOX_ID, state->smartRobot );
setBooleanCtrl( XW_PREFS_SHOWGRID_CHECKBOX_ID, state->showGrid );
setBooleanCtrl( XW_PREFS_SHOWARROW_CHECKBOX_ID, state->cp.showBoardArrow );
@ -301,6 +316,9 @@ controlsToLocalPrefs( PalmAppGlobals* globals, PrefsDlgState* state )
(state->hintsNotAllowed ==
getBooleanCtrl( XW_PREFS_NOHINTS_CHECKBOX_ID) ) );
state->hintsNotAllowed = getBooleanCtrl( XW_PREFS_NOHINTS_CHECKBOX_ID );
#ifdef XWFEATURE_SEARCHLIMIT
state->allowHintRect = getBooleanCtrl( XW_PREFS_HINTRECT_CHECKBOX_ID );
#endif
state->timerEnabled = getBooleanCtrl( XW_PREFS_TIMERON_CHECKBOX_ID );
state->gameSeconds = fieldToNum( XW_PREFS_TIMER_FIELD_ID ) * 60;

View file

@ -265,8 +265,16 @@
#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_PICKTILES_CHECKBOX_ID 2723
# ifdef XWFEATURE_SEARCHLIMIT
# define XW_PREFS_HINTRECT_CHECKBOX_ID 2724
# endif
#else
# ifdef XWFEATURE_SEARCHLIMIT
# define XW_PREFS_HINTRECT_CHECKBOX_ID 2723
# endif
#endif
/* These aren't part of the hide/show thing as they're displayed only
@ -278,7 +286,10 @@
#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
#ifdef FEATURE_TRAY_EDIT
#if defined XWFEATURE_SEARCHLIMIT
# define XW_PREFS_LAST_PERGAME_ID XW_PREFS_HINTRECT_CHECKBOX_ID
#elif defined FEATURE_TRAY_EDIT
# define XW_PREFS_LAST_PERGAME_ID XW_PREFS_PICKTILES_CHECKBOX_ID
#else
# define XW_PREFS_LAST_PERGAME_ID XW_PREFS_TIMER_FIELD_ID