From ca1b640f1fa06a4f6e69e205bee697e80a4c236f Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 2 Feb 2020 15:17:46 +0100 Subject: [PATCH] Key shortcut to show only songs of the current playlist CTRL+L while a playlist is open. It's a toggle key, just press again to return to normal list. While filtered to a playlist, you can also use CTRL+L while the playlist is not open to switch back to the normal view. My initial plans included also a button on the playlist pane, to the left of the playlist save button. I was able to add this button and set events on it. But I don't know how to filter and refresh the song screen, while I'm in the CPlaylist class of the VocaluxeLib namespace. After playing around for hours I stopped trying this and added just this key shortcut. --- Vocaluxe/Screens/CScreenSong.cs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 730f52f8..5ddcd5c5 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -363,6 +363,13 @@ namespace Vocaluxe.Screens _ShowHighscore(); } break; + + case Keys.L: + if (keyEvent.Mod == EModifier.Ctrl) + { + _TogglePlaylistFilter(); + } + break; } if (!_SearchActive) { @@ -869,9 +876,6 @@ namespace Vocaluxe.Screens CParty.OnSongChange(_SelectedSongID, ref _Sso); } - _Sso = CParty.GetSongSelectionOptions(); - - if (_Sso.Selection.PartyMode) { CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, _Sso.Sorting.SearchString, _Sso.Sorting.DuetOptions, _Sso.Sorting.FilterPlaylistID); @@ -1253,6 +1257,22 @@ namespace Vocaluxe.Screens _JumpTo_lastSearchString = searchString; } + public void _TogglePlaylistFilter() + { + if (_Sso.Sorting.FilterPlaylistID == _Playlist.ActivePlaylistID) + { + if (_Playlist.ActivePlaylistID == -1) + return; + + _Sso.Sorting.FilterPlaylistID = -1; + } + else + _Sso.Sorting.FilterPlaylistID = _Playlist.ActivePlaylistID; + + CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, _Sso.Sorting.SearchString, _Sso.Sorting.DuetOptions, _Sso.Sorting.FilterPlaylistID); + _SongMenu.OnShow(); + } + private void _ApplyNewSearchFilter(string newFilterString) { CParty.SetSearchString(newFilterString, _SearchActive);