up/down arrow keys move divider

This commit is contained in:
ehouse 2005-01-04 03:11:56 +00:00
parent b9d411c708
commit bbd8d917bc

View file

@ -103,6 +103,8 @@ drawTray( BoardCtxt* board, XP_Bool focussed )
XP_Rect tileRect; XP_Rect tileRect;
short i; short i;
XP_LOGF( "drawTray" );
if ( (board->trayInvalBits != 0) || board->dividerInvalid ) { if ( (board->trayInvalBits != 0) || board->dividerInvalid ) {
XP_S16 turn = board->selPlayer; XP_S16 turn = board->selPlayer;
@ -118,6 +120,7 @@ drawTray( BoardCtxt* board, XP_Bool focussed )
if ( (board->trayVisState != TRAY_HIDDEN) && dictionary != NULL ) { if ( (board->trayVisState != TRAY_HIDDEN) && dictionary != NULL ) {
XP_Bool showFaces = board->trayVisState == TRAY_REVEALED; XP_Bool showFaces = board->trayVisState == TRAY_REVEALED;
XP_LOGF( "turn=%d", turn );
if ( turn >= 0 ) { if ( turn >= 0 ) {
XP_U16 numInTray = showFaces? XP_U16 numInTray = showFaces?
model_getNumTilesInTray( board->model, turn ): model_getNumTilesInTray( board->model, turn ):
@ -632,6 +635,7 @@ board_juggleTray( BoardCtxt* board )
XP_Bool XP_Bool
tray_moveCursor( BoardCtxt* board, XP_Key cursorKey ) tray_moveCursor( BoardCtxt* board, XP_Key cursorKey )
{ {
XP_Bool result;
XP_U16 selPlayer = board->selPlayer; XP_U16 selPlayer = board->selPlayer;
XP_U16 numTrayTiles = model_getNumTilesInTray( board->model, XP_U16 numTrayTiles = model_getNumTilesInTray( board->model,
selPlayer ); selPlayer );
@ -641,13 +645,10 @@ tray_moveCursor( BoardCtxt* board, XP_Key cursorKey )
numTrayTiles = MAX_TRAY_TILES; numTrayTiles = MAX_TRAY_TILES;
if ( oldSel == 0 ) { if ( cursorKey == XP_CURSOR_KEY_UP ) {
if ( cursorKey == XP_CURSOR_KEY_LEFT ) { result = board_moveDivider( board, XP_FALSE );
newSel = 1 << (numTrayTiles - 1); } else if ( cursorKey == XP_CURSOR_KEY_DOWN ) {
} else { result = board_moveDivider( board, XP_TRUE );
XP_ASSERT( cursorKey == XP_CURSOR_KEY_RIGHT );
newSel = 1;
}
} else { } else {
pos = indexForBits( oldSel ); pos = indexForBits( oldSel );
@ -659,10 +660,13 @@ tray_moveCursor( BoardCtxt* board, XP_Key cursorKey )
} }
newSel = 1 << (pos % numTrayTiles); newSel = 1 << (pos % numTrayTiles);
}
board->trayCursorLoc[selPlayer] = newSel; board->trayCursorLoc[selPlayer] = newSel;
board_invalTrayTiles( board, newSel | oldSel ); board_invalTrayTiles( board, newSel | oldSel );
return XP_TRUE; result = XP_TRUE;
}
return result;
} /* tray_moveCursor */ } /* tray_moveCursor */
XP_Bool XP_Bool