mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
When moving focus through tray, skip empty space; when through board,
skip cells with tiles permanently played. Space char raises focus but does not move it laterally.
This commit is contained in:
parent
80adc9fb6b
commit
c91847f56f
6 changed files with 35 additions and 28 deletions
|
@ -2735,9 +2735,11 @@ board_handleKey( BoardCtxt* board, XP_Key key )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef KEYBOARD_NAV
|
#ifdef KEYBOARD_NAV
|
||||||
case XP_FOCUSCHANGE_KEY:
|
case XP_RAISEFOCUS_KEY:
|
||||||
if ( board->focussed != OBJ_NONE ) {
|
if ( board->focussed != OBJ_NONE && board->focusHasDived ) {
|
||||||
shiftFocusUp( board, XP_CURSOR_KEY_RIGHT );
|
invalFocusOwner( board );
|
||||||
|
board->focusHasDived = XP_FALSE;
|
||||||
|
invalFocusOwner( board );
|
||||||
result = XP_TRUE;
|
result = XP_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2939,7 +2941,7 @@ advanceArrow( BoardCtxt* board )
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
figureNextLoc( BoardCtxt* board, XP_Key cursorKey, XP_Bool canShiftFocus,
|
figureNextLoc( BoardCtxt* board, XP_Key cursorKey, XP_Bool canShiftFocus,
|
||||||
XP_Bool avoidOccupied, XP_U16* colP, XP_U16* rowP )
|
XP_Bool inclPending, XP_U16* colP, XP_U16* rowP )
|
||||||
{
|
{
|
||||||
XP_S16 max;
|
XP_S16 max;
|
||||||
XP_S16* useWhat;
|
XP_S16* useWhat;
|
||||||
|
@ -2997,8 +2999,7 @@ figureNextLoc( BoardCtxt* board, XP_Key cursorKey, XP_Bool canShiftFocus,
|
||||||
}
|
}
|
||||||
result = XP_TRUE;
|
result = XP_TRUE;
|
||||||
*useWhat += incr;
|
*useWhat += incr;
|
||||||
if ( !avoidOccupied
|
if ( !cellOccupied( board, *colP, *rowP, inclPending ) ) {
|
||||||
|| !cellOccupied( board, *colP, *rowP, XP_TRUE ) ) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef enum {
|
||||||
XP_CURSOR_KEY_UP,
|
XP_CURSOR_KEY_UP,
|
||||||
XP_CURSOR_KEY_LEFT,
|
XP_CURSOR_KEY_LEFT,
|
||||||
XP_CURSOR_KEY_DEL,
|
XP_CURSOR_KEY_DEL,
|
||||||
XP_FOCUSCHANGE_KEY,
|
XP_RAISEFOCUS_KEY,
|
||||||
XP_RETURN_KEY,
|
XP_RETURN_KEY,
|
||||||
|
|
||||||
XP_KEY_LAST
|
XP_KEY_LAST
|
||||||
|
|
|
@ -35,7 +35,7 @@ XP_Key_2str( XP_Key key )
|
||||||
CASESTR(XP_CURSOR_KEY_UP);
|
CASESTR(XP_CURSOR_KEY_UP);
|
||||||
CASESTR(XP_CURSOR_KEY_LEFT);
|
CASESTR(XP_CURSOR_KEY_LEFT);
|
||||||
CASESTR(XP_CURSOR_KEY_DEL);
|
CASESTR(XP_CURSOR_KEY_DEL);
|
||||||
CASESTR(XP_FOCUSCHANGE_KEY);
|
CASESTR(XP_RAISEFOCUS_KEY);
|
||||||
CASESTR(XP_RETURN_KEY);
|
CASESTR(XP_RETURN_KEY);
|
||||||
CASESTR(XP_KEY_LAST );
|
CASESTR(XP_KEY_LAST );
|
||||||
default: return FUNC(__FUNCTION__) " unknown";
|
default: return FUNC(__FUNCTION__) " unknown";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
|
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 - 2000 by Eric House (xwords@eehouse.org). All rights reserved.
|
* Copyright 1997 - 2006 by Eric House (xwords@eehouse.org). All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -628,14 +628,24 @@ tray_moveCursor( BoardCtxt* board, XP_Key cursorKey )
|
||||||
board_invalTrayTiles( board, 1 << board->trayCursorLoc[selPlayer] );
|
board_invalTrayTiles( board, 1 << board->trayCursorLoc[selPlayer] );
|
||||||
|
|
||||||
pos = board->trayCursorLoc[selPlayer];
|
pos = board->trayCursorLoc[selPlayer];
|
||||||
pos += cursorKey == XP_CURSOR_KEY_RIGHT ? 1 : -1;
|
/* Loop in order to skip all empty tile slots but one */
|
||||||
if ( pos < 0 || pos >= MAX_TRAY_TILES ) {
|
for ( ; ; ) {
|
||||||
shiftFocusUp( board, cursorKey );
|
pos += cursorKey == XP_CURSOR_KEY_RIGHT ? 1 : -1;
|
||||||
} else {
|
if ( pos < 0 || pos >= MAX_TRAY_TILES ) {
|
||||||
board->trayCursorLoc[selPlayer] = pos;
|
shiftFocusUp( board, cursorKey );
|
||||||
board_invalTrayTiles( board, 1 << pos );
|
} else {
|
||||||
|
if ( board->trayVisState == TRAY_REVEALED ) {
|
||||||
|
XP_U16 count = model_getNumTilesInTray( board->model,
|
||||||
|
selPlayer );
|
||||||
|
if ( (pos > count) && (pos < MAX_TRAY_TILES-1) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
board->trayCursorLoc[selPlayer] = pos;
|
||||||
|
board_invalTrayTiles( board, 1 << pos );
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
board_invalTrayTiles( board, 1 << board->trayCursorLoc[selPlayer] );
|
board_invalTrayTiles( board, 1 << board->trayCursorLoc[selPlayer] );
|
||||||
result = XP_TRUE;
|
result = XP_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; compile-command: "make MEMDEBUG=TRUE"; -*- */
|
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; compile-command: "make MEMDEBUG=TRUE"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2000 by Eric House (xwords@eehouse.org). All rights reserved.
|
* Copyright 2000-2006 by Eric House (xwords@eehouse.org). All rights
|
||||||
|
* reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -357,14 +358,14 @@ checkAssignFocus( BoardCtxt* board )
|
||||||
}
|
}
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
handleTab( CursesAppGlobals* globals )
|
handleSpace( CursesAppGlobals* globals )
|
||||||
{
|
{
|
||||||
checkAssignFocus( globals->cGlobals.game.board );
|
checkAssignFocus( globals->cGlobals.game.board );
|
||||||
|
|
||||||
globals->doDraw = board_handleKey( globals->cGlobals.game.board,
|
globals->doDraw = board_handleKey( globals->cGlobals.game.board,
|
||||||
XP_FOCUSCHANGE_KEY );
|
XP_RAISEFOCUS_KEY );
|
||||||
return XP_TRUE;
|
return XP_TRUE;
|
||||||
} /* handleTab */
|
} /* handleSpace */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
handleRet( CursesAppGlobals* globals )
|
handleRet( CursesAppGlobals* globals )
|
||||||
|
@ -453,7 +454,8 @@ handleReplace( CursesAppGlobals* globals )
|
||||||
|
|
||||||
MenuList sharedMenuList[] = {
|
MenuList sharedMenuList[] = {
|
||||||
{ handleQuit, "Quit", "Q", 'Q' },
|
{ handleQuit, "Quit", "Q", 'Q' },
|
||||||
{ handleTab, "Change focus", "<tab>", '\t' },
|
{ handleRight, "Tab right", "<tab>", '\t' },
|
||||||
|
{ handleSpace, "Raise focus", "<spc>", ' ' },
|
||||||
{ handleRet, "Click/tap", "<ret>", '\r' },
|
{ handleRet, "Click/tap", "<ret>", '\r' },
|
||||||
{ handleHint, "Hint", "?", '?' },
|
{ handleHint, "Hint", "?", '?' },
|
||||||
|
|
||||||
|
|
|
@ -2559,7 +2559,7 @@ mainViewHandleEvent( EventPtr event )
|
||||||
xpkey = XP_CURSOR_KEY_DOWN;
|
xpkey = XP_CURSOR_KEY_DOWN;
|
||||||
break;
|
break;
|
||||||
case chrSpace:
|
case chrSpace:
|
||||||
xpkey = XP_FOCUSCHANGE_KEY;
|
xpkey = XP_RAISEFOCUS_KEY;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
@ -2578,12 +2578,6 @@ mainViewHandleEvent( EventPtr event )
|
||||||
}
|
}
|
||||||
if ( xpkey != XP_KEY_NONE ) {
|
if ( xpkey != XP_KEY_NONE ) {
|
||||||
draw = board_handleKey( globals->game.board, xpkey );
|
draw = board_handleKey( globals->game.board, xpkey );
|
||||||
#ifdef XWFEATURE_FIVEWAY
|
|
||||||
if ( xpkey == XP_FOCUSCHANGE_KEY ) {
|
|
||||||
checkSetFocus( globals,
|
|
||||||
board_getFocusOwner( globals->game.board ) );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
handled = draw;
|
handled = draw;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue