diff --git a/common/board.c b/common/board.c index 77093de1b..4a95a564f 100644 --- a/common/board.c +++ b/common/board.c @@ -395,14 +395,17 @@ board_getScale( BoardCtxt* board, XP_U16* hScale, XP_U16* vScale ) XP_Bool board_prefsChanged( BoardCtxt* board, CommonPrefs* cp ) { - XP_Bool changed; - XP_Bool oldVal = board->disableArrow; + XP_Bool showArrowChanged; + XP_Bool hideValChanged; + + showArrowChanged = cp->showBoardArrow == board->disableArrow; + hideValChanged = cp->hideTileValues != board->hideValsInTray; board->disableArrow = !cp->showBoardArrow; - changed = oldVal != board->disableArrow; + board->hideValsInTray = cp->hideTileValues; - if ( changed ) { - changed = setArrowVisible( board, XP_FALSE ); + if ( showArrowChanged ) { + showArrowChanged = setArrowVisible( board, XP_FALSE ); } #ifdef XWFEATURE_SEARCHLIMIT @@ -419,7 +422,7 @@ board_prefsChanged( BoardCtxt* board, CommonPrefs* cp ) } #endif - return changed; + return showArrowChanged || hideValChanged; } /* board_prefsChanged */ XP_Bool diff --git a/common/boardp.h b/common/boardp.h index d7af5c52b..f2e9c6e2c 100644 --- a/common/boardp.h +++ b/common/boardp.h @@ -109,6 +109,7 @@ struct BoardCtxt { XP_Bool badWordRejected; XP_Bool timerPending; XP_Bool disableArrow; + XP_Bool hideValsInTray; XP_Bool tradeInProgress[MAX_NUM_PLAYERS]; XP_Bool eraseTray; diff --git a/common/comtypes.h b/common/comtypes.h index ba72e72e2..8978a6209 100644 --- a/common/comtypes.h +++ b/common/comtypes.h @@ -103,8 +103,8 @@ typedef enum { typedef struct CommonPrefs { XP_Bool showBoardArrow; /* applies to all games */ XP_Bool showRobotScores; /* applies to all games */ - XP_Bool reserved1; /* get to 32-bit for ARM... */ - XP_Bool reserved2; + XP_Bool hideTileValues; + XP_Bool reserved2; /* get to 32-bit for ARM... */ } CommonPrefs; #ifdef XWFEATURE_BLUETOOTH diff --git a/common/tray.c b/common/tray.c index 60cad2d6c..4566a2597 100644 --- a/common/tray.c +++ b/common/tray.c @@ -154,8 +154,11 @@ drawTray( BoardCtxt* board, XP_Bool focussed ) dict_tilesToString( dictionary, &tile, 1, textP, sizeof(buf) ); } - value = dict_getTileValue( dictionary, tile ); - + if ( board->hideValsInTray ) { + value = -1; + } else { + value = dict_getTileValue( dictionary, tile ); + } draw_drawTile( board->draw, &tileRect, textP, bitmap, value, highlighted ); } else { diff --git a/palm/l10n/xwords4_en_US.rcp.pre b/palm/l10n/xwords4_en_US.rcp.pre index bea54a50f..610138915 100644 --- a/palm/l10n/xwords4_en_US.rcp.pre +++ b/palm/l10n/xwords4_en_US.rcp.pre @@ -353,12 +353,14 @@ END /* XW_CONNS_FORM */ #endif #define PREFS_MODE_TOP 15 -#define PREFS_TOP 30 +#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) #define DLG_TOP (160 - DLG_HEIGHT - 2) #define TIMER_TOP (74+SEARCHLIMIT_ADJUST) -#define BUTTON_TOP (TIMER_TOP+16+TRAY_EDIT_ADJUST) +#define BUTTON_TOP (TIMER_TOP+18+TRAY_EDIT_ADJUST) #define PREFS_LNHT 4 FORM ID XW_PREFS_FORM AT (2 DLG_TOP 156 DLG_HEIGHT) @@ -375,36 +377,38 @@ BEGIN /* global prefs */ CHECKBOX "Color played tiles" ID XW_PREFS_PLAYERCOLORS_CHECKBOX_ID \ - AT (LEFTCOL PREFS_TOP AUTO AUTO) NONUSABLE + AT (LEFTCOL PREFS_ROW1 AUTO AUTO) NONUSABLE CHECKBOX "Show progress bar" ID XW_PREFS_PROGRESSBAR_CHECKBOX_ID \ - AT (LEFTCOL PREVBOTTOM+PREFS_LNHT AUTO AUTO) NONUSABLE + AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE CHECKBOX "Larger board" ID XW_PREFS_SHOWGRID_CHECKBOX_ID \ - AT (LEFTCOL PREVBOTTOM+PREFS_LNHT AUTO AUTO) NONUSABLE + AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE CHECKBOX "Enable arrow cursor" ID XW_PREFS_SHOWARROW_CHECKBOX_ID \ - AT (LEFTCOL PREVBOTTOM+PREFS_LNHT AUTO AUTO) NONUSABLE + AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE CHECKBOX "Explain robot scores" ID XW_PREFS_ROBOTSCORE_CHECKBOX_ID \ - AT (LEFTCOL PREVBOTTOM+PREFS_LNHT AUTO AUTO) NONUSABLE + 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_TOP AUTO AUTO) NONUSABLE + AT (LEFTCOL PREFS_ROW1 AUTO AUTO) NONUSABLE #ifdef XWFEATURE_SEARCHLIMIT CHECKBOX "Disallow hints" ID XW_PREFS_NOHINTS_CHECKBOX_ID \ - AT (LEFTCOL PREVBOTTOM+PREFS_LNHT AUTO AUTO) NONUSABLE + 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 PREVTOP AUTO AUTO) NONUSABLE + AT (PREVRIGHT+3 PREFS_ROW1 AUTO AUTO) NONUSABLE #endif LABEL "Phonies:" XW_PREFS_PHONIES_LABEL_ID - AT (LEFTCOL PREVBOTTOM+PREFS_LNHT) + 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 PREVBOTTOM+2) + 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 @@ -416,13 +420,13 @@ BEGIN NONUSABLE VISIBLEITEMS NUM_BOARD_SIZES CHECKBOX "Enable timer (minutes:)" ID XW_PREFS_TIMERON_CHECKBOX_ID \ - AT (LEFTCOL TIMER_TOP AUTO AUTO) NONUSABLE + 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 PREVBOTTOM AUTO AUTO) NONUSABLE + AT (LEFTCOL PREVTOP+PREFS_SPACING AUTO AUTO) NONUSABLE #endif /* buttons at the bottom */ @@ -443,6 +447,7 @@ NAVIGATIONMAP 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 diff --git a/palm/newgame.c b/palm/newgame.c index f419a4d02..fc0a37374 100644 --- a/palm/newgame.c +++ b/palm/newgame.c @@ -89,7 +89,7 @@ newGameHandleEvent( EventPtr event ) CurGameInfo* gi; PalmNewGameState* state; Int16 chosen; - XP_U16 itemId; + XP_S16 itemId; Boolean on; CALLBACK_PROLOGUE(); @@ -153,10 +153,12 @@ newGameHandleEvent( EventPtr event ) #ifdef XWFEATURE_FIVEWAY case keyDownEvent: itemId = getFocusOwner(); - result = tryRockerKey( event->data.keyDown.chr, itemId, - XW_SOLO_GADGET_ID, XW_CLIENT_GADGET_ID ); - if ( result ) { - changeGadgetHilite( globals, itemId ); + 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 diff --git a/palm/palmutil.c b/palm/palmutil.c index af82764bf..ed13d7c1b 100644 --- a/palm/palmutil.c +++ b/palm/palmutil.c @@ -392,11 +392,15 @@ drawOneGadget( UInt16 id, const char* text, Boolean hilite ) } /* drawOneGadget */ #ifdef XWFEATURE_FIVEWAY -XP_U16 +XP_S16 getFocusOwner( void ) { FormPtr form = FrmGetActiveForm(); - XP_U16 ownerID = FrmGetObjectId( form, FrmGetFocus( form ) ); + XP_S16 ownerID = -1; + XP_S16 focus = FrmGetFocus( form ); + if ( focus >= 0 ) { + ownerID = FrmGetObjectId( form, focus ); + } return ownerID; } /* getFocusOwner */ diff --git a/palm/palmutil.h b/palm/palmutil.h index 3c25af5de..e57e388fd 100644 --- a/palm/palmutil.h +++ b/palm/palmutil.h @@ -76,7 +76,7 @@ void drawGadgetsFromList( ListPtr list, XP_U16 idLow, XP_U16 idHigh, XP_Bool penInGadget( const EventType* event, UInt16* whichGadget ); void drawOneGadget( UInt16 id, const char* text, Boolean hilite ); # ifdef XWFEATURE_FIVEWAY -XP_U16 getFocusOwner( void ); +XP_S16 getFocusOwner( void ); void drawFocusRingOnGadget( XP_U16 idLow, XP_U16 idHigh ); XP_Bool considerGadgetFocus( const EventType* event, XP_U16 idLow, XP_U16 idHigh ); diff --git a/palm/prefsdlg.c b/palm/prefsdlg.c index 62f20c13d..d6b4cf3f1 100644 --- a/palm/prefsdlg.c +++ b/palm/prefsdlg.c @@ -44,7 +44,7 @@ PrefsFormHandleEvent( EventPtr event ) FormPtr form; EventType eventToPost; Int16 chosen; - XP_U16 selGadget; + XP_S16 selGadget; CALLBACK_PROLOGUE(); globals = getFormRefcon(); @@ -86,14 +86,16 @@ PrefsFormHandleEvent( EventPtr event ) #ifdef XWFEATURE_FIVEWAY case keyDownEvent: selGadget = getFocusOwner(); - if ( tryRockerKey( event->data.keyDown.chr, selGadget, - XW_PREFS_ALLGAMES_GADGET_ID, - XW_PREFS_ONEGAME_GADGET_ID ) ) { - checkPrefsHiliteGadget( globals, selGadget ); - result = XP_TRUE; - } else if ( !globals->isNewGame - && vchrRockerCenter == event->data.keyDown.chr ) { - result = ignoredUnlessNewgame( selGadget ); + if ( selGadget >= 0 ) { + if ( tryRockerKey( event->data.keyDown.chr, selGadget, + XW_PREFS_ALLGAMES_GADGET_ID, + XW_PREFS_ONEGAME_GADGET_ID ) ) { + checkPrefsHiliteGadget( globals, selGadget ); + result = XP_TRUE; + } else if ( !globals->isNewGame + && vchrRockerCenter == event->data.keyDown.chr ) { + result = ignoredUnlessNewgame( selGadget ); + } } break; @@ -281,6 +283,9 @@ localPrefsToControls( PrefsDlgState* state ) setBooleanCtrl( XW_PREFS_SHOWARROW_CHECKBOX_ID, state->cp.showBoardArrow ); setBooleanCtrl( XW_PREFS_ROBOTSCORE_CHECKBOX_ID, state->cp.showRobotScores ); + setBooleanCtrl( XW_PREFS_HIDETRAYVAL_CHECKBOX_ID, + state->cp.hideTileValues ); + setBooleanCtrl( XW_PREFS_TIMERON_CHECKBOX_ID, state->timerEnabled ); #ifdef FEATURE_TRAY_EDIT @@ -311,6 +316,9 @@ controlsToLocalPrefs( PrefsDlgState* state ) getBooleanCtrl( XW_PREFS_SHOWARROW_CHECKBOX_ID ); state->cp.showRobotScores = getBooleanCtrl( XW_PREFS_ROBOTSCORE_CHECKBOX_ID ); + state->cp.hideTileValues = + getBooleanCtrl( XW_PREFS_HIDETRAYVAL_CHECKBOX_ID ); + state->showProgress = getBooleanCtrl( XW_PREFS_PROGRESSBAR_CHECKBOX_ID ); /* trapping ctlEnterEvent should mean it can't have changed, so no need diff --git a/palm/xwords4defines.h b/palm/xwords4defines.h index 6a219c6c0..9e6162c9a 100644 --- a/palm/xwords4defines.h +++ b/palm/xwords4defines.h @@ -266,6 +266,7 @@ #define XW_PREFS_SHOWGRID_CHECKBOX_ID 2710 #define XW_PREFS_SHOWARROW_CHECKBOX_ID 2711 #define XW_PREFS_ROBOTSCORE_CHECKBOX_ID 2712 +#define XW_PREFS_HIDETRAYVAL_CHECKBOX_ID 2713 /* per-game */ #define XW_PREFS_ROBOTSMART_CHECKBOX_ID 2715 @@ -295,7 +296,7 @@ /* These are used to set/clear the "pages" of the prefs dialog. */ #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_LAST_GLOBAL_ID XW_PREFS_HIDETRAYVAL_CHECKBOX_ID #define XW_PREFS_FIRST_PERGAME_ID XW_PREFS_ROBOTSMART_CHECKBOX_ID #if defined XWFEATURE_SEARCHLIMIT