From bb291f1e75fc57254e835140ca20cc013a73ac0e Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 10 Jul 2004 22:40:50 +0000 Subject: [PATCH] Hide cursor arrow when pen in empty tray region returns tiles to tray. --- xwords4/common/board.c | 5 +---- xwords4/common/boardp.h | 1 + xwords4/common/tray.c | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/xwords4/common/board.c b/xwords4/common/board.c index 038281865..d87a91ec1 100644 --- a/xwords4/common/board.c +++ b/xwords4/common/board.c @@ -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 ); diff --git a/xwords4/common/boardp.h b/xwords4/common/boardp.h index 7ab868852..fe6e4f34c 100644 --- a/xwords4/common/boardp.h +++ b/xwords4/common/boardp.h @@ -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 ); diff --git a/xwords4/common/tray.c b/xwords4/common/tray.c index b1ed92700..9d0e761e6 100644 --- a/xwords4/common/tray.c +++ b/xwords4/common/tray.c @@ -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