From afa74ef1506987b91174f40de996b74ad297e9bb Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 3 Feb 2006 06:02:17 +0000 Subject: [PATCH] move NAV_TOGGLE_FIVE_KEY focus handling into AfterChangeRow --- stepmania/src/ScreenOptions.cpp | 51 +++++++++++++++++---------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index d92a0c4f6d..db1c537d95 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -1172,31 +1172,6 @@ bool ScreenOptions::MoveRowRelative( PlayerNumber pn, int iDir, bool Repeat ) m_iCurrentRow[p] = r; ASSERT( r >= 0 && r < (int)m_pRows.size() ); - // - // We've moved vertically. In FIVE_KEY, keep the selection in the row near the focus. - // - OptionRow &row = *m_pRows[r]; - switch( m_OptionsNavigation ) - { - case NAV_TOGGLE_FIVE_KEY: - if( row.GetRowDef().m_layoutType != LAYOUT_SHOW_ONE_IN_ROW ) - { - int iSelectionDist = -1; - for( unsigned i = 0; i < row.GetTextItemsSize(); ++i ) - { - int iWidth, iX, iY; - GetWidthXY( p, m_iCurrentRow[p], i, iWidth, iX, iY ); - const int iDist = abs( iX-m_iFocusX[p] ); - if( iSelectionDist == -1 || iDist < iSelectionDist ) - { - iSelectionDist = iDist; - row.SetChoiceInRowWithFocus( p, i ); - } - } - } - break; - } - AfterChangeRow( p ); bChanged = true; } @@ -1206,6 +1181,32 @@ bool ScreenOptions::MoveRowRelative( PlayerNumber pn, int iDir, bool Repeat ) void ScreenOptions::AfterChangeRow( PlayerNumber pn ) { + // + // In FIVE_KEY, keep the selection in the row near the focus. + // + OptionRow &row = *m_pRows[r]; + switch( m_OptionsNavigation ) + { + case NAV_TOGGLE_FIVE_KEY: + if( row.GetRowDef().m_layoutType != LAYOUT_SHOW_ONE_IN_ROW ) + { + int iSelectionDist = -1; + for( unsigned i = 0; i < row.GetTextItemsSize(); ++i ) + { + int iWidth, iX, iY; + GetWidthXY( pn, m_iCurrentRow[pn], i, iWidth, iX, iY ); + const int iDist = abs( iX-m_iFocusX[pn] ); + if( iSelectionDist == -1 || iDist < iSelectionDist ) + { + iSelectionDist = iDist; + row.SetChoiceInRowWithFocus( pn, i ); + } + } + } + break; + } + + AfterChangeValueOrRow( pn ); }