Hide cursor arrow when pen in empty tray region returns tiles to tray.

This commit is contained in:
ehouse 2004-07-10 22:40:50 +00:00
parent 53f9b49b5a
commit b36124f01d
3 changed files with 18 additions and 12 deletions

View file

@ -84,7 +84,6 @@ static XP_Bool getArrow( BoardCtxt* board, XP_U16* col, XP_U16* row );
static XP_Bool board_moveArrow( BoardCtxt* board, XP_Key cursorKey, static XP_Bool board_moveArrow( BoardCtxt* board, XP_Key cursorKey,
XP_Bool canCycle ); XP_Bool canCycle );
static XP_Bool setArrowVisible( BoardCtxt* board, XP_Bool visible );
static XP_Bool setArrowVisibleFor( BoardCtxt* board, XP_U16 player, static XP_Bool setArrowVisibleFor( BoardCtxt* board, XP_U16 player,
XP_Bool visible ); XP_Bool visible );
static XP_Bool moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey ); static XP_Bool moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey );
@ -2723,8 +2722,6 @@ board_moveCursor( BoardCtxt* board, XP_Key cursorKey )
loc.col = col; loc.col = col;
loc.row = row; loc.row = row;
board->bdCursor[board->selPlayer] = loc; board->bdCursor[board->selPlayer] = loc;
XP_LOGF( "moved cursor to %d,%d", col, row );
} }
return changed; return changed;
} /* board_moveCursor */ } /* board_moveCursor */
@ -2889,7 +2886,7 @@ getArrow( BoardCtxt* board, XP_U16* col, XP_U16* row )
return getArrowFor( board, board->selPlayer, col, row ); return getArrowFor( board, board->selPlayer, col, row );
} /* getArrow */ } /* getArrow */
static XP_Bool XP_Bool
setArrowVisible( BoardCtxt* board, XP_Bool visible ) setArrowVisible( BoardCtxt* board, XP_Bool visible )
{ {
return setArrowVisibleFor( board, board->selPlayer, visible ); return setArrowVisibleFor( board, board->selPlayer, visible );

View file

@ -190,6 +190,7 @@ XP_Bool rectContainsPt( XP_Rect* rect1, XP_S16 x, XP_S16 y );
XP_Bool checkRevealTray( BoardCtxt* board ); XP_Bool checkRevealTray( BoardCtxt* board );
void invalTilesUnderRect( BoardCtxt* board, XP_Rect* rect ); void invalTilesUnderRect( BoardCtxt* board, XP_Rect* rect );
XP_Bool rectsIntersect( XP_Rect* rect1, XP_Rect* rect2 ); XP_Bool rectsIntersect( XP_Rect* rect1, XP_Rect* rect2 );
XP_Bool setArrowVisible( BoardCtxt* board, XP_Bool visible );
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
XP_Bool tray_moveCursor( BoardCtxt* board, XP_Key cursorKey ); XP_Bool tray_moveCursor( BoardCtxt* board, XP_Key cursorKey );

View file

@ -315,14 +315,12 @@ handlePenDownInTray( BoardCtxt* board, XP_U16 x, XP_U16 y )
XP_S16 index = pointToTileIndex( board, x, y, &onDivider ); XP_S16 index = pointToTileIndex( board, x, y, &onDivider );
return handleActionInTray( board, index, onDivider, XP_TRUE ); return handleActionInTray( board, index, onDivider, XP_TRUE );
} /* handleActionInTray */ } /* handlePenDownInTray */
XP_Bool static XP_Bool
handlePenUpTray( BoardCtxt* board, XP_U16 x, XP_U16 y ) handlePenUpTrayInt( BoardCtxt* board, XP_S16 index )
{ {
XP_Bool result = XP_FALSE; XP_Bool result = XP_FALSE;
XP_Bool ignore;
XP_S16 index = pointToTileIndex( board, x, y, &ignore );
if ( index >= 0 ) { if ( index >= 0 ) {
XP_U16 selPlayer = board->selPlayer; XP_U16 selPlayer = board->selPlayer;
@ -336,12 +334,21 @@ handlePenUpTray( BoardCtxt* board, XP_U16 x, XP_U16 y )
} else if ( index < 0 ) { /* other empty area */ } else if ( index < 0 ) { /* other empty area */
/* it better be true */ /* it better be true */
(void)board_replaceTiles( board ); (void)board_replaceTiles( board );
(void)setArrowVisible( board, XP_FALSE );
result = XP_TRUE; result = XP_TRUE;
} }
return result; return result;
} /* handlePenUpTray */ } /* handlePenUpTray */
XP_Bool
handlePenUpTray( BoardCtxt* board, XP_U16 x, XP_U16 y )
{
XP_Bool ignore;
XP_S16 index = pointToTileIndex( board, x, y, &ignore );
return handlePenUpTrayInt( board, index );
} /* handlePenUpTray */
static XP_Bool static XP_Bool
startTileDrag( BoardCtxt* board, TileBit startBit/* , XP_U16 x, XP_U16 y */ ) startTileDrag( BoardCtxt* board, TileBit startBit/* , XP_U16 x, XP_U16 y */ )
{ {
@ -666,13 +673,14 @@ tray_keyAction( BoardCtxt* board )
XP_Bool result; XP_Bool result;
if ( !!cursor ) { if ( !!cursor ) {
XP_S16 index = trayLocToIndex( board, indexForBits( cursor ) ); XP_S16 index = trayLocToIndex( board, indexForBits( cursor ) );
result = handleActionInTray( board, index, XP_FALSE, XP_FALSE ); result = handleActionInTray( board, index, XP_FALSE, XP_FALSE )
|| handlePenUpTrayInt( board, index );
} else { } else {
result = XP_FALSE; result = XP_FALSE;
} }
return result; return result;
} /* tray_selectCurTile */ } /* tray_keyAction */
#endif #endif
#if defined FOR_GREMLINS || defined KEYBOARD_NAV #if defined FOR_GREMLINS || defined KEYBOARD_NAV
@ -689,7 +697,7 @@ board_moveDivider( BoardCtxt* board, XP_Bool right )
dividerMoved( board, loc ); dividerMoved( board, loc );
} }
return result; return result;
} /* dividerMovedOne */ } /* board_moveDivider */
#endif #endif
#ifdef CPLUS #ifdef CPLUS