mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
Don't return tile to tray on a simple tap when drag-drop is available; move
function between files.
This commit is contained in:
parent
355cfa9fcc
commit
4a6f07d1fa
3 changed files with 29 additions and 23 deletions
|
@ -2520,8 +2520,10 @@ holdsPendingTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
|
||||||
&& isPending;
|
&& isPending;
|
||||||
} /* holdsPendingTile */
|
} /* holdsPendingTile */
|
||||||
|
|
||||||
|
#ifndef POINTER_SUPPORT
|
||||||
/* Did I tap on a tile on the board that I have not yet committed? If so,
|
/* 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
|
XP_Bool
|
||||||
tryReplaceTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
|
tryReplaceTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
|
||||||
|
@ -2540,13 +2542,17 @@ tryReplaceTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} /* tryReplaceTile */
|
} /* tryReplaceTile */
|
||||||
|
#endif
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
handleActionInCell( BoardCtxt* board, XP_U16 col, XP_U16 row )
|
handleActionInCell( BoardCtxt* board, XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
return moveSelTileToBoardXY( board, col, row )
|
return moveSelTileToBoardXY( board, col, row )
|
||||||
|| tryMoveArrow( board, col, row )
|
|| tryMoveArrow( board, col, row )
|
||||||
|| tryReplaceTile( board, col, row );
|
#ifndef POINTER_SUPPORT
|
||||||
|
|| tryReplaceTile( board, col, row )
|
||||||
|
#endif
|
||||||
|
;
|
||||||
} /* handleActionInCell */
|
} /* handleActionInCell */
|
||||||
#endif /* POINTER_SUPPORT || KEYBOARD_NAV */
|
#endif /* POINTER_SUPPORT || KEYBOARD_NAV */
|
||||||
|
|
||||||
|
@ -3478,25 +3484,6 @@ invalDragObj( BoardCtxt* board, const DragObjInfo* di )
|
||||||
}
|
}
|
||||||
} /* invalCurObj */
|
} /* 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
|
#ifdef CPLUS
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -216,8 +216,6 @@ XP_Bool moveTileToBoard( BoardCtxt* board, XP_U16 col, XP_U16 row,
|
||||||
|
|
||||||
void invalTilesUnderRect( BoardCtxt* board, XP_Rect* rect );
|
void invalTilesUnderRect( BoardCtxt* board, XP_Rect* rect );
|
||||||
void invalDragObj( BoardCtxt* board, const DragObjInfo* di );
|
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 invalTrayTilesAbove( BoardCtxt* board, XP_U16 tileIndex );
|
||||||
void invalTrayTilesBetween( BoardCtxt* board, XP_U16 tileIndex1,
|
void invalTrayTilesBetween( BoardCtxt* board, XP_U16 tileIndex1,
|
||||||
XP_U16 tileIndex2 );
|
XP_U16 tileIndex2 );
|
||||||
|
|
|
@ -26,6 +26,8 @@ extern "C" {
|
||||||
|
|
||||||
static XP_Bool dragDropContinueImpl( BoardCtxt* board, XP_U16 xx, XP_U16 yy,
|
static XP_Bool dragDropContinueImpl( BoardCtxt* board, XP_U16 xx, XP_U16 yy,
|
||||||
BoardObjectType* onWhichP );
|
BoardObjectType* onWhichP );
|
||||||
|
static void invalDragObjRange( BoardCtxt* board, const DragObjInfo* from,
|
||||||
|
const DragObjInfo* to );
|
||||||
|
|
||||||
XP_Bool
|
XP_Bool
|
||||||
dragDropInProgress( const BoardCtxt* board )
|
dragDropInProgress( const BoardCtxt* board )
|
||||||
|
@ -344,6 +346,25 @@ dragDropContinueImpl( BoardCtxt* board, XP_U16 xx, XP_U16 yy,
|
||||||
return moving;
|
return moving;
|
||||||
} /* dragDropContinueImpl */
|
} /* 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
|
#ifdef CPLUS
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue