back out 2245: having scrollbar be focusable is a better way of allowing scrolling than overloading cursor movement; scroll cursor onscreen when diving and it is off

This commit is contained in:
ehouse 2008-10-20 02:23:17 +00:00
parent afbb5ed2fe
commit c48f836fe7

View file

@ -2390,6 +2390,7 @@ invalFocusOwner( BoardCtxt* board )
if ( board->focusHasDived ) {
BdCursorLoc loc = pti->bdCursor;
invalCell( board, loc.col, loc.row );
checkScrollCell( board, loc.col, loc.row );
} else {
#ifdef PERIMETER_FOCUS
invalPerimeter( board );
@ -2606,55 +2607,19 @@ stripAlt( XP_Key key, XP_Bool* wasAlt )
return key;
} /* stripAlt */
static XP_Bool
scrollTrumpsMove( const BoardCtxt* board, XP_Key cursorKey, XP_S16* moveBy )
{
XP_Bool scroll = XP_FALSE;
if ( XP_CURSOR_KEY_DOWN == cursorKey ) {
scroll = (board->lastVisibleRow+1) < model_numRows( board->model );
if ( scroll ) {
*moveBy = -1;
}
} else if ( XP_CURSOR_KEY_UP == cursorKey ) {
scroll = board->yOffset > 0;
if ( scroll ) {
*moveBy = 1;
}
}
return scroll;
}
static XP_Bool
board_moveCursor( BoardCtxt* board, XP_Key cursorKey, XP_Bool preflightOnly,
XP_Bool* up )
{
PerTurnInfo* pti = board->selInfo;
BdCursorLoc loc;
XP_S16 moveBy;
BdCursorLoc loc = pti->bdCursor;
XP_U16 col = loc.col;
XP_U16 row = loc.row;
XP_Bool changed;
XP_Bool needMove = XP_FALSE;
XP_Bool altSet;
cursorKey = stripAlt( cursorKey, &altSet );
changed = !preflightOnly
&& scrollTrumpsMove( board, cursorKey, &moveBy );
if ( changed ) {
if ( adjustYOffset( board, moveBy ) ) {
/* need to move the cursor too? */
XP_Rect ignore;
loc = pti->bdCursor;
needMove = !getCellRect( board, loc.col, loc.row, &ignore );
}
}
/* PENDING: Is it a problem that needMove will only get set if
preflightOnly is false? */
if ( !changed || needMove ) {
XP_U16 col, row;
loc = pti->bdCursor;
col = loc.col;
row = loc.row;
changed = figureNextLoc( board, cursorKey, XP_FALSE, altSet,
&col, &row, up );
if ( changed && !preflightOnly ) {
@ -2663,7 +2628,7 @@ board_moveCursor( BoardCtxt* board, XP_Key cursorKey, XP_Bool preflightOnly,
loc.col = col;
loc.row = row;
pti->bdCursor = loc;
}
checkScrollCell( board, col, row );
}
return changed;
} /* board_moveCursor */