move NAV_TOGGLE_FIVE_KEY focus handling into AfterChangeRow

This commit is contained in:
Glenn Maynard
2006-02-03 06:02:17 +00:00
parent 35408c5ed6
commit afa74ef150
+13 -12
View File
@@ -1172,8 +1172,17 @@ bool ScreenOptions::MoveRowRelative( PlayerNumber pn, int iDir, bool Repeat )
m_iCurrentRow[p] = r; m_iCurrentRow[p] = r;
ASSERT( r >= 0 && r < (int)m_pRows.size() ); ASSERT( r >= 0 && r < (int)m_pRows.size() );
AfterChangeRow( p );
bChanged = true;
}
return bChanged;
}
void ScreenOptions::AfterChangeRow( PlayerNumber pn )
{
// //
// We've moved vertically. In FIVE_KEY, keep the selection in the row near the focus. // In FIVE_KEY, keep the selection in the row near the focus.
// //
OptionRow &row = *m_pRows[r]; OptionRow &row = *m_pRows[r];
switch( m_OptionsNavigation ) switch( m_OptionsNavigation )
@@ -1185,27 +1194,19 @@ bool ScreenOptions::MoveRowRelative( PlayerNumber pn, int iDir, bool Repeat )
for( unsigned i = 0; i < row.GetTextItemsSize(); ++i ) for( unsigned i = 0; i < row.GetTextItemsSize(); ++i )
{ {
int iWidth, iX, iY; int iWidth, iX, iY;
GetWidthXY( p, m_iCurrentRow[p], i, iWidth, iX, iY ); GetWidthXY( pn, m_iCurrentRow[pn], i, iWidth, iX, iY );
const int iDist = abs( iX-m_iFocusX[p] ); const int iDist = abs( iX-m_iFocusX[pn] );
if( iSelectionDist == -1 || iDist < iSelectionDist ) if( iSelectionDist == -1 || iDist < iSelectionDist )
{ {
iSelectionDist = iDist; iSelectionDist = iDist;
row.SetChoiceInRowWithFocus( p, i ); row.SetChoiceInRowWithFocus( pn, i );
} }
} }
} }
break; break;
} }
AfterChangeRow( p );
bChanged = true;
}
return bChanged;
}
void ScreenOptions::AfterChangeRow( PlayerNumber pn )
{
AfterChangeValueOrRow( pn ); AfterChangeValueOrRow( pn );
} }