Don't return tile to tray on a simple tap when drag-drop is available; move

function between files.
This commit is contained in:
ehouse 2008-03-11 12:22:10 +00:00
parent 355cfa9fcc
commit 4a6f07d1fa
3 changed files with 29 additions and 23 deletions

View file

@ -2520,8 +2520,10 @@ holdsPendingTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
&& isPending;
} /* holdsPendingTile */
#ifndef POINTER_SUPPORT
/* Did I tap on a tile on the board that I have not yet committed? If so,
* return it to the tray.
* return it to the tray. But don't do this in drag-and-drop case since it's
* too easy to accidentally tap and there are better ways.
*/
XP_Bool
tryReplaceTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
@ -2540,13 +2542,17 @@ tryReplaceTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
}
return result;
} /* tryReplaceTile */
#endif
static XP_Bool
handleActionInCell( BoardCtxt* board, XP_U16 col, XP_U16 row )
{
return moveSelTileToBoardXY( board, col, row )
|| tryMoveArrow( board, col, row )
|| tryReplaceTile( board, col, row );
#ifndef POINTER_SUPPORT
|| tryReplaceTile( board, col, row )
#endif
;
} /* handleActionInCell */
#endif /* POINTER_SUPPORT || KEYBOARD_NAV */
@ -3478,25 +3484,6 @@ invalDragObj( BoardCtxt* board, const DragObjInfo* di )
}
} /* invalCurObj */
void
invalDragObjRange( BoardCtxt* board, const DragObjInfo* from,
const DragObjInfo* to )
{
invalDragObj( board, from );
if ( NULL != to ) {
invalDragObj( board, to );
if ( (OBJ_TRAY == from->obj) && (OBJ_TRAY == to->obj) ) {
invalTrayTilesBetween( board, from->u.tray.index,
to->u.tray.index );
} else if ( OBJ_TRAY == from->obj ) {
invalTrayTilesAbove( board, from->u.tray.index );
} else if ( OBJ_TRAY == to->obj ) {
invalTrayTilesAbove( board, to->u.tray.index );
}
}
}
#ifdef CPLUS
}
#endif

View file

@ -216,8 +216,6 @@ XP_Bool moveTileToBoard( BoardCtxt* board, XP_U16 col, XP_U16 row,
void invalTilesUnderRect( BoardCtxt* board, XP_Rect* rect );
void invalDragObj( BoardCtxt* board, const DragObjInfo* di );
void invalDragObjRange( BoardCtxt* board, const DragObjInfo* from,
const DragObjInfo* to );
void invalTrayTilesAbove( BoardCtxt* board, XP_U16 tileIndex );
void invalTrayTilesBetween( BoardCtxt* board, XP_U16 tileIndex1,
XP_U16 tileIndex2 );

View file

@ -26,6 +26,8 @@ extern "C" {
static XP_Bool dragDropContinueImpl( BoardCtxt* board, XP_U16 xx, XP_U16 yy,
BoardObjectType* onWhichP );
static void invalDragObjRange( BoardCtxt* board, const DragObjInfo* from,
const DragObjInfo* to );
XP_Bool
dragDropInProgress( const BoardCtxt* board )
@ -344,6 +346,25 @@ dragDropContinueImpl( BoardCtxt* board, XP_U16 xx, XP_U16 yy,
return moving;
} /* dragDropContinueImpl */
static void
invalDragObjRange( BoardCtxt* board, const DragObjInfo* from,
const DragObjInfo* to )
{
invalDragObj( board, from );
if ( NULL != to ) {
invalDragObj( board, to );
if ( (OBJ_TRAY == from->obj) && (OBJ_TRAY == to->obj) ) {
invalTrayTilesBetween( board, from->u.tray.index,
to->u.tray.index );
} else if ( OBJ_TRAY == from->obj ) {
invalTrayTilesAbove( board, from->u.tray.index );
} else if ( OBJ_TRAY == to->obj ) {
invalTrayTilesAbove( board, to->u.tray.index );
}
}
}
#ifdef CPLUS
}
#endif