Added jumpTo in songscreen

This commit is contained in:
Stephan Sundermann committed 2012-03-16 12:49:42 +01:00
1 parent f08e72bd70
commit 72a6c415ae
1 file changed
+48 -25
+48 -25
View File
@@ -65,6 +65,12 @@ namespace Vocaluxe.Screens
if (KeyEvent.Handled) if (KeyEvent.Handled)
return true; return true;
if (!Char.IsControl(KeyEvent.Unicode))
{
JumpTo(KeyEvent.Unicode);
return true;
}
switch (KeyEvent.Key) switch (KeyEvent.Key)
{ {
case Keys.Escape: case Keys.Escape:
@@ -101,34 +107,34 @@ namespace Vocaluxe.Screens
} }
break; break;
case Keys.A: //case Keys.A:
if (!_SearchActive && KeyEvent.Mod == Modifier.None) // if (!_SearchActive && KeyEvent.Mod == Modifier.None)
{ // {
StartRandomAllSongs(); // StartRandomAllSongs();
} // }
if (KeyEvent.Mod == Modifier.Ctrl) // if (KeyEvent.Mod == Modifier.Ctrl)
{ // {
StartRandomVisibleSongs(); // StartRandomVisibleSongs();
} // }
break; // break;
case Keys.F: //case Keys.F:
if (KeyEvent.Mod == Modifier.Ctrl){ // if (KeyEvent.Mod == Modifier.Ctrl){
if (_SearchActive) // if (_SearchActive)
{ // {
_SearchActive = false; // _SearchActive = false;
_SearchText = String.Empty; // _SearchText = String.Empty;
ApplyNewSearchFilter(_SearchText); // ApplyNewSearchFilter(_SearchText);
} // }
else // else
{ // {
_SearchActive = true; // _SearchActive = true;
} // }
} // }
break; // break;
case Keys.R: case Keys.R:
if (CSongs.Category != -1) if (CSongs.Category != -1 && KeyEvent.Mod == Modifier.Ctrl)
{ {
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
} }
@@ -288,6 +294,23 @@ namespace Vocaluxe.Screens
CGraphics.FadeTo(EScreens.ScreenNames); CGraphics.FadeTo(EScreens.ScreenNames);
} }
private void JumpTo(char Letter)
{
int song = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();
int id = -1;
if (song > -1 && song < CSongs.NumVisibleSongs)
{
id = CSongs.VisibleSongs[song].ID;
}
Vocaluxe.Lib.Song.CSong s = Array.Find<Vocaluxe.Lib.Song.CSong>(CSongs.VisibleSongs, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (s != null && s.ID > -1)
{
id = s.ID;
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(id);
}
}
private void ApplyNewSearchFilter(string NewFilterString) private void ApplyNewSearchFilter(string NewFilterString)
{ {
int song = SongMenus[htSongMenus(SongMenu)].GetSelectedSong(); int song = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();