From a2bf15a7eff8b1ce6e8982587ba4d81f19c131f8 Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Tue, 9 Sep 2008 22:43:16 +0000 Subject: [PATCH] Bring over CTRL+(letter) going directly to that letter in title sort from ScreenNetSelectMusic. --- stepmania/src/ScreenSelectMusic.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 754b5b160f..772d3802e7 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -27,6 +27,7 @@ #include "BannerCache.h" #include "Song.h" #include "InputEventPlus.h" +#include "RageInput.h" #include "OptionsList.h" static const char *SelectionStateNames[] = { @@ -337,6 +338,32 @@ void ScreenSelectMusic::Input( const InputEventPlus &input ) { // LOG->Trace( "ScreenSelectMusic::Input()" ); + bool bHoldingCtrl = + INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) || + INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)); + + wchar_t c = INPUTMAN->DeviceInputToChar(input.DeviceI,false); + MakeUpper( &c, 1 ); + + if ( bHoldingCtrl && ( c >= 'A' ) && ( c <= 'Z' ) ) + { + SortOrder so = GAMESTATE->m_SortOrder; + if ( ( so != SORT_TITLE ) && ( so != SORT_ARTIST ) ) + { + so = SORT_TITLE; + + GAMESTATE->m_PreferredSortOrder = so; + GAMESTATE->m_SortOrder.Set( so ); + // Odd, changing the sort order requires us to call SetOpenSection more than once + m_MusicWheel.ChangeSort( so ); + m_MusicWheel.SetOpenSection( ssprintf("%c", c ) ); + } + m_MusicWheel.SelectSection( ssprintf("%c", c ) ); + m_MusicWheel.ChangeSort( so ); + m_MusicWheel.SetOpenSection( ssprintf("%c", c ) ); + AfterMusicChange(); + return; + } // debugging? // I just like being able to see untransliterated titles occasionally. @@ -353,7 +380,6 @@ void ScreenSelectMusic::Input( const InputEventPlus &input ) if( !input.GameI.IsValid() ) return; // don't care - // Handle late joining if( m_SelectionState != SelectionState_Finalized && input.MenuI == GAME_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) ) return; // don't handle this press again below