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 898d0bf9ed
commit bb291f1e75
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,
XP_Bool canCycle );
static XP_Bool setArrowVisible( BoardCtxt* board, XP_Bool visible );
static XP_Bool setArrowVisibleFor( BoardCtxt* board, XP_U16 player,
XP_Bool visible );
static XP_Bool moveKeyTileToBoard( BoardCtxt* board, XP_Key cursorKey );
@ -2723,8 +2722,6 @@ board_moveCursor( BoardCtxt* board, XP_Key cursorKey )
loc.col = col;
loc.row = row;
board->bdCursor[board->selPlayer] = loc;
XP_LOGF( "moved cursor to %d,%d", col, row );
}
return changed;
} /* board_moveCursor */
@ -2889,7 +2886,7 @@ getArrow( BoardCtxt* board, XP_U16* col, XP_U16* row )
return getArrowFor( board, board->selPlayer, col, row );
} /* getArrow */
static XP_Bool
XP_Bool
setArrowVisible( BoardCtxt* board, XP_Bool 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 );
void invalTilesUnderRect( BoardCtxt* board, XP_Rect* rect );
XP_Bool rectsIntersect( XP_Rect* rect1, XP_Rect* rect2 );
XP_Bool setArrowVisible( BoardCtxt* board, XP_Bool visible );
#ifdef KEYBOARD_NAV
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 );
return handleActionInTray( board, index, onDivider, XP_TRUE );
} /* handleActionInTray */
} /* handlePenDownInTray */
XP_Bool
handlePenUpTray( BoardCtxt* board, XP_U16 x, XP_U16 y )
static XP_Bool
handlePenUpTrayInt( BoardCtxt* board, XP_S16 index )
{
XP_Bool result = XP_FALSE;
XP_Bool ignore;
XP_S16 index = pointToTileIndex( board, x, y, &ignore );
if ( index >= 0 ) {
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 */
/* it better be true */
(void)board_replaceTiles( board );
(void)setArrowVisible( board, XP_FALSE );
result = XP_TRUE;
}
return result;
} /* 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
startTileDrag( BoardCtxt* board, TileBit startBit/* , XP_U16 x, XP_U16 y */ )
{
@ -666,13 +673,14 @@ tray_keyAction( BoardCtxt* board )
XP_Bool result;
if ( !!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 {
result = XP_FALSE;
}
return result;
} /* tray_selectCurTile */
} /* tray_keyAction */
#endif
#if defined FOR_GREMLINS || defined KEYBOARD_NAV
@ -689,7 +697,7 @@ board_moveDivider( BoardCtxt* board, XP_Bool right )
dividerMoved( board, loc );
}
return result;
} /* dividerMovedOne */
} /* board_moveDivider */
#endif
#ifdef CPLUS