From dbb9c6355fc2b2fc0f44e0f23e0170a345b0ac26 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Wed, 27 Feb 2013 00:40:30 +0100 Subject: [PATCH] Added option to start current song/enter current category Added CSong.IsInCategory --- .gitignore | 2 + Output/Languages/English.xml | 1 + Output/Languages/German.xml | 1 + Output/Themes/Ambient/Screens/ScreenSong.xml | 20 +- Vocaluxe/Base/CGraphics.cs | 4 +- Vocaluxe/Base/CSongs.cs | 5 + Vocaluxe/Screens/CPopupScreenVolumeControl.cs | 4 +- Vocaluxe/Screens/CScreenSong.cs | 202 ++++++++---------- VocaluxeLib/Menu/CSelectSlide.cs | 5 + VocaluxeLib/Menu/SongMenu/CSongMenu.cs | 5 + .../Menu/SongMenu/CSongMenuFramework.cs | 14 +- .../Menu/SongMenu/CSongMenuTileBoard.cs | 6 +- VocaluxeLib/Menu/SongMenu/ISongMenu.cs | 2 + 13 files changed, 134 insertions(+), 137 deletions(-) diff --git a/.gitignore b/.gitignore index 1ea3fff8..7afc1fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ Output/Songs *.ipch *.log + +/Output/Playlists/*.xml diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index e6c32d03..42460ca7 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -112,6 +112,7 @@ Sing all songs Sing all visible songs Open playlist + Select Sing a random medley Sing medley-songs New Playlist diff --git a/Output/Languages/German.xml b/Output/Languages/German.xml index 52cbba63..7fe3cf73 100644 --- a/Output/Languages/German.xml +++ b/Output/Languages/German.xml @@ -112,6 +112,7 @@ Alle Songs singen Alle sichtbaren Songs singen Playlist öffnen + Auswählen Zufälliges Medley singen Medley-Songs singen Neue Playlist diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index 5135f622..e279174b 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -1,7 +1,7 @@  - 4 + 5 Video @@ -954,7 +954,7 @@ Button 40 - 135 + 225 -2,11 360 40 @@ -1003,7 +1003,7 @@ Button 40 - 180 + 270 -2,11 360 40 @@ -1045,14 +1045,14 @@ - + Button Button 40 - 270 + 135 -2,11 360 40 @@ -1085,7 +1085,7 @@ Outline - TR_SCREENSONG_BUTTON_OPENPLAYLIST + TR_SCREENSONG_BUTTON_OPEN_SELECTED_ITEM @@ -1093,7 +1093,7 @@ - + Invisible @@ -1449,19 +1449,19 @@ SelectSlide 40 - 225 + 180 -2,11 360 40 45 - 235 + 190 -2,12 30 30 365 - 235 + 190 -2,12 30 30 diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 44ed03e8..7a44178f 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -503,7 +503,7 @@ namespace Vocaluxe.Base MouseEvent InputMouseEvent = new MouseEvent(); bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && - (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1 && CConfig.Tabs ==EOffOn.TR_CONFIG_ON)) + (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && !CSongs.IsInCategory && CConfig.Tabs ==EOffOn.TR_CONFIG_ON)) && _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled; bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord; @@ -555,7 +555,7 @@ namespace Vocaluxe.Base switch (CGraphics.CurrentScreen) { case EScreens.ScreenSong: - if (CSongs.Category != -1) + if (CSongs.IsInCategory) { CConfig.PreviewMusicVolume += Diff; _Screens[(int)_CurrentScreen].ApplyVolume(); diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 7ef5a4ba..0b764fe3 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -139,6 +139,11 @@ namespace Vocaluxe.Base } } + public static bool IsInCategory + { + get { return _CatIndex >= 0; } + } + /// /// Returns the number of song in the category specified with CatIndex /// diff --git a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs index ead806c0..19ef40d9 100644 --- a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs +++ b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs @@ -110,7 +110,7 @@ namespace Vocaluxe.Screens switch (CGraphics.CurrentScreen) { case EScreens.ScreenSong: - if (CSongs.Category != -1) + if (CSongs.IsInCategory) CConfig.PreviewMusicVolume = SelectSlides[htSelectSlides(SelectSlideVolume)].Selection * 5; else { @@ -136,7 +136,7 @@ namespace Vocaluxe.Screens switch (CGraphics.CurrentScreen) { case EScreens.ScreenSong: - if(CSongs.Category != -1) + if(CSongs.IsInCategory) SelectSlides[htSelectSlides(SelectSlideVolume)].Selection = (int)(CConfig.PreviewMusicVolume / 5); else SelectSlides[htSelectSlides(SelectSlideVolume)].Selection = ((int)CConfig.BackgroundMusicVolume / 5); diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index cd060c6c..a0eea267 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -26,7 +26,7 @@ namespace Vocaluxe.Screens } // Version number for theme files. Increment it, if you've changed something on the theme files! - const int ScreenVersion = 4; + const int ScreenVersion = 5; private const string TextCategory = "TextCategory"; private const string TextSelection = "TextSelection"; @@ -42,7 +42,7 @@ namespace Vocaluxe.Screens private const string ButtonOptionsRandomCategory = "ButtonOptionsRandomCategory"; private const string ButtonOptionsSingAll = "ButtonOptionsSingAll"; private const string ButtonOptionsSingAllVisible = "ButtonOptionsSingAllVisible"; - private const string ButtonOptionsOpenPlaylist = "ButtonOptionsOpenPlaylist"; + private const string ButtonOptionsOpenSelectedItem = "ButtonOptionsOpenSelectedItem"; private const string ButtonOptionsRandomMedley = "ButtonOptionsRandomMedley"; private const string ButtonOptionsStartMedley = "ButtonOptionsStartMedley"; private const string ButtonStart = "ButtonStart"; @@ -98,7 +98,7 @@ namespace Vocaluxe.Screens blist.Add(ButtonOptionsRandomCategory); blist.Add(ButtonOptionsSingAll); blist.Add(ButtonOptionsSingAllVisible); - blist.Add(ButtonOptionsOpenPlaylist); + blist.Add(ButtonOptionsOpenSelectedItem); blist.Add(ButtonOpenOptions); blist.Add(ButtonStart); blist.Add(ButtonOptionsRandomMedley); @@ -130,22 +130,7 @@ namespace Vocaluxe.Screens public override void LoadTheme(string XmlPath) { base.LoadTheme(XmlPath); - SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Visible = false; - SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Visible = false; - SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = false; - SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Visible = false; - Buttons[htButtons(ButtonOptionsClose)].Visible = false; - Buttons[htButtons(ButtonOptionsSing)].Visible = false; - Buttons[htButtons(ButtonOptionsPlaylist)].Visible = false; - Buttons[htButtons(ButtonOptionsRandom)].Visible = false; - Buttons[htButtons(ButtonOptionsRandomCategory)].Visible = false; - Buttons[htButtons(ButtonOptionsSingAll)].Visible = false; - Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = false; - Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = false; - Buttons[htButtons(ButtonOptionsRandomMedley)].Visible = false; - Buttons[htButtons(ButtonOptionsStartMedley)].Visible = false; - Texts[htTexts(TextOptionsTitle)].Visible = false; - Statics[htStatics(StaticOptionsBG)].Visible = false; + ToggleSongOptions(ESongOptionsView.None); Playlists[htPlaylists(Playlist)].Visible = false; DragAndDropCover = GetNewStatic(); @@ -165,19 +150,7 @@ namespace Vocaluxe.Screens if (_PlaylistActive) { - if (!KeyEvent.KeyPressed && KeyEvent.Key == Keys.Tab) - { - _PlaylistActive = !_PlaylistActive; - Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; - SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); - return true; - } - Playlists[htPlaylists(Playlist)].HandleInput(KeyEvent); - - if (CPlaylists.NumPlaylists != SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues) - UpdatePlaylistNames(); - return true; } @@ -330,7 +303,6 @@ namespace Vocaluxe.Screens } } } - else { switch (KeyEvent.Key) @@ -352,7 +324,7 @@ namespace Vocaluxe.Screens } else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) { - if (CSongs.Category != -1) + if (CSongs.IsInCategory) SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); else SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); @@ -365,9 +337,12 @@ namespace Vocaluxe.Screens { StartRandomVisibleSongs(); } - else if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) + else if (Buttons[htButtons(ButtonOptionsOpenSelectedItem)].Selected) + { + _HandleSelectButton(); + } + else if (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Selected) { - ToggleSongOptions(ESongOptionsView.None); OpenPlaylistAction(); } else if (Buttons[htButtons(ButtonOptionsRandomMedley)].Selected) @@ -377,7 +352,7 @@ namespace Vocaluxe.Screens else if (Buttons[htButtons(ButtonOptionsStartMedley)].Selected) { ToggleSongOptions(ESongOptionsView.None); - StartRandomMedley(SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Selection + 1, CSongs.Category == -1); + StartRandomMedley(SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Selection + 1, !CSongs.IsInCategory); } break; @@ -440,8 +415,6 @@ namespace Vocaluxe.Screens { if (Playlists[htPlaylists(Playlist)].HandleMouse(MouseEvent)) { - if (CPlaylists.NumPlaylists != SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues) - UpdatePlaylistNames(); return true; } } @@ -477,6 +450,8 @@ namespace Vocaluxe.Screens if (MouseEvent.LD && !_sso.Selection.PartyMode) { + //TODO: Causes Bug if you select a song (e.g. with Select random song) and double click a normal button. + //E.g. clicking to fast on Select random song starts the next random song. is this OK? if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { ToggleSongOptions(ESongOptionsView.None); @@ -499,81 +474,72 @@ namespace Vocaluxe.Screens { ToggleSongOptions(ESongOptionsView.General); return true; - } - - if (Buttons[htButtons(ButtonOptionsClose)].Selected) + } else if (Buttons[htButtons(ButtonOptionsClose)].Selected) { ToggleSongOptions(ESongOptionsView.None); return true; - } - - if (Buttons[htButtons(ButtonOptionsSing)].Selected) + } else if (Buttons[htButtons(ButtonOptionsSing)].Selected) { ToggleSongOptions(ESongOptionsView.None); StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); return true; } - - if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) + else if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) { ToggleSongOptions(ESongOptionsView.None); OpenAndAddPlaylistAction(); return true; } - - if (Buttons[htButtons(ButtonOptionsRandom)].Selected) + else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) { - if (CSongs.Category != -1) + if (CSongs.IsInCategory) { SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); return true; } } - - if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected) + else if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected) { - if (CSongs.Category == -1) + if (!CSongs.IsInCategory) { SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); return true; } } - - if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) + else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) { ToggleSongOptions(ESongOptionsView.None); StartRandomAllSongs(); return true; } - - if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) + else if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) { ToggleSongOptions(ESongOptionsView.None); StartRandomVisibleSongs(); return true; } - - if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) + else if (Buttons[htButtons(ButtonOptionsOpenSelectedItem)].Selected) + { + _HandleSelectButton(); + return true; + } + else if (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].ValueSelected) { - ToggleSongOptions(ESongOptionsView.None); OpenPlaylistAction(); return true; } - - if (Buttons[htButtons(ButtonOptionsRandomMedley)].Selected) + else if (Buttons[htButtons(ButtonOptionsRandomMedley)].Selected) { ToggleSongOptions(ESongOptionsView.Medley); return true; } - - if (Buttons[htButtons(ButtonOptionsStartMedley)].Selected) + else if (Buttons[htButtons(ButtonOptionsStartMedley)].Selected) { ToggleSongOptions(ESongOptionsView.None); - StartRandomMedley(SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Selection + 1, CSongs.Category == -1); + StartRandomMedley(SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Selection + 1, !CSongs.IsInCategory); return true; } - - if (_sso.Selection.RandomOnly && _sso.Selection.NumJokers != null) + else if (_sso.Selection.RandomOnly && _sso.Selection.NumJokers != null) { if (Buttons[htButtons(ButtonStart)].Selected) { @@ -599,9 +565,7 @@ namespace Vocaluxe.Screens { if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) { - if (!_sso.Selection.PartyMode) - ToggleSongOptions(ESongOptionsView.Song); - + ToggleSongOptions(ESongOptionsView.Song); return true; } else @@ -635,6 +599,19 @@ namespace Vocaluxe.Screens return true; } + private void _HandleSelectButton() + { + if (CSongs.IsInCategory) { + if(!_sso.Selection.PartyMode) + ToggleSongOptions(ESongOptionsView.Song); + } + else if(_sso.Selection.CategoryChangeAllowed) + { + ToggleSongOptions(ESongOptionsView.None); + SongMenus[htSongMenus(SongMenu)].EnterCurrentCategory(); + } + } + public override void OnShow() { base.OnShow(); @@ -661,7 +638,6 @@ namespace Vocaluxe.Screens if (Playlists[htPlaylists(Playlist)].ActivePlaylistID != -1) Playlists[htPlaylists(Playlist)].LoadPlaylist(Playlists[htPlaylists(Playlist)].ActivePlaylistID); - UpdatePlaylistNames(); DragAndDropActive = false; Playlists[htPlaylists(Playlist)].DragAndDropSongID = -1; @@ -686,7 +662,7 @@ namespace Vocaluxe.Screens { Texts[htTexts(TextSelection)].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title; } - else if (CSongs.Category == -1 && song >= 0 && song < CSongs.Categories.Length) + else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Length) { Texts[htTexts(TextSelection)].Text = CSongs.Categories[song].Name; } @@ -750,7 +726,7 @@ namespace Vocaluxe.Screens private void UpdatePartyModeOptions() { - if (CSongs.Category == -1) + if (!CSongs.IsInCategory) SelectedSongID = -1; if (SelectedCategoryIndex != CSongs.Category) @@ -1022,7 +998,7 @@ namespace Vocaluxe.Screens private bool SelectNextRandomSong() { - if (CSongs.Category != -1) + if (CSongs.IsInCategory) { ToggleSongOptions(ESongOptionsView.None); SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); @@ -1033,7 +1009,7 @@ namespace Vocaluxe.Screens private bool SelectNextRandomCategory() { - if (CSongs.Category == -1) + if (!CSongs.IsInCategory) { ToggleSongOptions(ESongOptionsView.None); SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); @@ -1045,23 +1021,10 @@ namespace Vocaluxe.Screens private void JumpTo(char Letter) { int start = 0; - if (CSongs.Category < 0) - { - int curSelected = SongMenus[htSongMenus(SongMenu)].GetSelectedCategory(); - CCategory[] Categories = CSongs.Categories; - int ct = Categories.Length; - if (curSelected >= 0 && curSelected < ct - 1 && Categories[curSelected].Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)) - start = curSelected + 1; - int visibleID = Array.FindIndex(Categories, start, ct - start, element => element.Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)); - if (visibleID < 0 && start > 1) - visibleID = Array.FindIndex(Categories, 0, start - 1, element => element.Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)); - if (visibleID > -1) - SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(visibleID); - } - else + int curSelected = SongMenus[htSongMenus(SongMenu)].GetActualSelection(); + if (CSongs.IsInCategory) { //TODO: Check and use sorting method - int curSelected = SongMenus[htSongMenus(SongMenu)].GetSelectedSong(); CSong[] Songs = CSongs.VisibleSongs; int ct = Songs.Length; if (curSelected >= 0 && curSelected < ct - 1) @@ -1071,12 +1034,24 @@ namespace Vocaluxe.Screens start = curSelected + 1; } int visibleID = Array.FindIndex(Songs, start, ct - start, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)); - if(visibleID < 0 && start > 1) + if (visibleID < 0 && start > 1) visibleID = Array.FindIndex(Songs, 0, start - 1, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)); if (visibleID > -1) SongMenus[htSongMenus(SongMenu)].SetSelectedSong(visibleID); } + else + { + CCategory[] Categories = CSongs.Categories; + int ct = Categories.Length; + if (curSelected >= 0 && curSelected < ct - 1 && Categories[curSelected].Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)) + start = curSelected + 1; + int visibleID = Array.FindIndex(Categories, start, ct - start, element => element.Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)); + if (visibleID < 0 && start > 1) + visibleID = Array.FindIndex(Categories, 0, start - 1, element => element.Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)); + if (visibleID > -1) + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(visibleID); + } } private void ApplyNewSearchFilter(string NewFilterString) @@ -1130,7 +1105,7 @@ namespace Vocaluxe.Screens Buttons[htButtons(ButtonOptionsRandomCategory)].Visible = false; Buttons[htButtons(ButtonOptionsSingAll)].Visible = false; Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = false; - Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = false; + Buttons[htButtons(ButtonOptionsOpenSelectedItem)].Visible = false; Buttons[htButtons(ButtonOptionsRandomMedley)].Visible = false; Buttons[htButtons(ButtonOptionsStartMedley)].Visible = false; Texts[htTexts(TextOptionsTitle)].Visible = false; @@ -1141,6 +1116,9 @@ namespace Vocaluxe.Screens if (_SongOptionsActive) { + //Has to be done here otherwhise changed playlist names will not appear until OnShow is called! + UpdatePlaylistNames(); + Texts[htTexts(TextOptionsTitle)].Visible = true; Buttons[htButtons(ButtonOptionsClose)].Visible = true; Statics[htStatics(StaticOptionsBG)].Visible = true; @@ -1162,18 +1140,18 @@ namespace Vocaluxe.Screens SetInteractionToButton(Buttons[htButtons(ButtonOptionsSing)]); _AvailableGameModes.Clear(); SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Clear(); - if (!CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet) + if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet) + { + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET)); + _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_DUET); + } + else { SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_NORMAL); SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_SHORTSONG); } - if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet) - { - SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET)); - _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_DUET); - } if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].Medley.Source != EMedleySource.None) { SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY)); @@ -1194,28 +1172,20 @@ namespace Vocaluxe.Screens private void _ShowSongOptionsGeneral() { - Buttons[htButtons(ButtonOptionsRandom)].Visible = CSongs.Category != -1; - Buttons[htButtons(ButtonOptionsRandomCategory)].Visible = CSongs.Category == -1; - Buttons[htButtons(ButtonOptionsSingAll)].Visible = true; - Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = CSongs.Category != -1; - - if (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues > 0) + if (CSongs.IsInCategory) { - Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = true; - SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = true; - SetInteractionToButton(Buttons[htButtons(ButtonOptionsOpenPlaylist)]); + Buttons[htButtons(ButtonOptionsRandom)].Visible = true; + Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = true; } else - { - Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = false; - SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = false; - - if (Buttons[htButtons(ButtonOptionsRandom)].Visible) - SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandom)]); - else - SetInteractionToButton(Buttons[htButtons(ButtonOptionsSingAll)]); - } + Buttons[htButtons(ButtonOptionsRandomCategory)].Visible = true; + Buttons[htButtons(ButtonOptionsSingAll)].Visible = true; Buttons[htButtons(ButtonOptionsRandomMedley)].Visible = true; + Buttons[htButtons(ButtonOptionsOpenSelectedItem)].Visible = true; + + if (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues > 0) + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = true; + if (Buttons[htButtons(ButtonOptionsRandom)].Visible) SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandom)]); else @@ -1227,7 +1197,7 @@ namespace Vocaluxe.Screens Buttons[htButtons(ButtonOptionsStartMedley)].Visible = true; SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Visible = true; SelectSlides[htSelectSlides(SelectSlideOptionsNumMedleySongs)].Clear(); - if (CSongs.Category != -1) + if (CSongs.IsInCategory) { for (int i = 1; i <= CSongs.VisibleSongs.Length; i++) { diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index e2d2df00..2f821562 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -79,6 +79,11 @@ namespace Vocaluxe.Menu } } } + public bool ValueSelected + { + get { return _Selected && !_ArrowLeftSelected && !_ArrowRightSelected; } + } + public bool Visible = true; public bool Highlighted = false; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs index 32b2d5fa..411779b6 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs @@ -115,6 +115,11 @@ namespace Vocaluxe.Menu.SongMenu _SongMenu.SetSelectedCategory(CategoryNr); } + public bool EnterCurrentCategory() + { + return _SongMenu.EnterCurrentCategory(); + } + public int GetActualSelection() { return _SongMenu.GetActualSelection(); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index bfb77487..22302772 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -588,6 +588,16 @@ namespace Vocaluxe.Menu.SongMenu LoadTextures(); } + public bool EnterCurrentCategory() + { + if (!_Initialized) + return false; + if (CBase.Songs.GetCurrentCategoryIndex() >= 0 || _PreviewSelected < 0 || _PreviewSelected >= CBase.Songs.GetNumCategories()) + return false; + EnterCategory(_PreviewSelected); + return true; + } + protected virtual void EnterCategory(int Category) { if (!_Initialized) @@ -605,8 +615,8 @@ namespace Vocaluxe.Menu.SongMenu if (!_Initialized) return; - if (CBase.Songs.GetCurrentCategoryIndex() != -1) - Reset(); + if (CBase.Songs.GetCurrentCategoryIndex() == -1) + return; Reset(); CBase.Songs.SetCategory(-1); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 818fad51..8c881591 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -163,11 +163,7 @@ namespace Vocaluxe.Menu.SongMenu { base.HandleInput(ref KeyEvent, SongOptions); - if (KeyEvent.KeyPressed) - { - // - } - else + if (!KeyEvent.KeyPressed) { if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down || KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter || diff --git a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs index e5c3d60f..ed29efa1 100644 --- a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs @@ -29,6 +29,8 @@ namespace Vocaluxe.Menu.SongMenu void SetSelectedCategory(int CategoryNr); int GetActualSelection(); + bool EnterCurrentCategory(); + bool IsSelected(); void SetSelected(bool Selected);