From 26a5086fc878d2e952a622658bf186a8451ab2e4 Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Sat, 1 Dec 2012 22:05:45 +0100 Subject: [PATCH 1/3] Added function to select a random category. --- Output/Languages/Deutsch.xml | 1 + Output/Languages/English.xml | 1 + Output/Themes/Ambient/Screens/ScreenSong.xml | 49 ++++++++++++++++ .../Themes/Changelog/Changelog_ScreenSong.txt | 2 +- Vocaluxe/Base/CSongs.cs | 30 ++++++++++ Vocaluxe/Menu/SongMenu/CSongMenu.cs | 5 ++ Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs | 6 ++ Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs | 56 +++++++++++++++++++ Vocaluxe/Menu/SongMenu/ISongMenu.cs | 1 + Vocaluxe/Screens/CScreenSong.cs | 31 +++++++++- 10 files changed, 179 insertions(+), 3 deletions(-) diff --git a/Output/Languages/Deutsch.xml b/Output/Languages/Deutsch.xml index 8fe726bf..75d96131 100644 --- a/Output/Languages/Deutsch.xml +++ b/Output/Languages/Deutsch.xml @@ -123,6 +123,7 @@ Zur Playlist hinzufügen Schließen Zufälligen Song wählen + Zufällige Kategorie wählen Alle Songs singen Alle sichtbaren Song singen Playlist öffnen diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index 10b2e4fa..b3e2194f 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -123,6 +123,7 @@ Add to playlist Close Select a random song + Select a random category Sing all songs Sing all visible songs Open playlist diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index 3d744951..624cb0e6 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -473,6 +473,55 @@ + + + Button + + Button + + 40 + 90 + -2,11 + 360 + 40 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_BUTTON_RANDOMCAT + + + + + + + + Button diff --git a/Output/Themes/Changelog/Changelog_ScreenSong.txt b/Output/Themes/Changelog/Changelog_ScreenSong.txt index c1402b34..7d2e320c 100644 --- a/Output/Themes/Changelog/Changelog_ScreenSong.txt +++ b/Output/Themes/Changelog/Changelog_ScreenSong.txt @@ -6,7 +6,7 @@ Version 3: Add: -, , , , , , , +, , , , , , , , , , and as a new Screen-Element. For details, look at ScreenSong.xml diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index cc33b1ed..147e1c01 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -56,6 +56,7 @@ namespace Vocaluxe.Base private static int _CoverLoadIndex = -1; private static int _CatIndex = -1; private static List _Categories = new List(); + private static List _CategoriesForRandom = new List(); private static Stopwatch _CoverLoadTimer = new Stopwatch(); @@ -275,6 +276,35 @@ namespace Vocaluxe.Base _SongsForRandom.AddRange(VisibleSongs); } + public static int GetRandomCategory() + { + if (_CategoriesForRandom.Count == 0) + UpdateRandomCategoryList(); + + if (_CategoriesForRandom.Count == 0) + return -1; + + CCategory category = _CategoriesForRandom[CGame.Rand.Next(0, _CategoriesForRandom.Count - 1)]; + _CategoriesForRandom.Remove(category); + return GetCategoryNumber(category); + } + + public static void UpdateRandomCategoryList() + { + _CategoriesForRandom.Clear(); + _CategoriesForRandom.AddRange(Categories); + } + + private static int GetCategoryNumber(CCategory category) + { + for (int i = 0; i < Categories.Length; i++) + { + if (Categories[i] == category) + return i; + } + return -1; + } + public static CSong[] AllSongs { get { return _Songs.ToArray(); } diff --git a/Vocaluxe/Menu/SongMenu/CSongMenu.cs b/Vocaluxe/Menu/SongMenu/CSongMenu.cs index 7f437ab0..e6a2824e 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenu.cs @@ -98,6 +98,11 @@ namespace Vocaluxe.Menu.SongMenu return _SongMenu.GetSelectedCategory(); } + public void SetSelectedCategory(int CategoryNr) + { + _SongMenu.SetSelectedCategory(CategoryNr); + } + public int GetActualSelection() { return _SongMenu.GetActualSelection(); diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs index 5dbfe865..c2fc76ee 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs @@ -536,6 +536,12 @@ namespace Vocaluxe.Menu.SongMenu return; } + public virtual void SetSelectedCategory(int CategoryNr) + { + if (!_Initialized) + return; + } + public virtual void SetSmallView(bool SmallView) { if (!_Initialized) diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs index 10a86dbb..eda76a62 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs @@ -556,6 +556,62 @@ namespace Vocaluxe.Menu.SongMenu } + public override void SetSelectedCategory(int CategoryNr) + { + base.SetSelectedCategory(CategoryNr); + + if (CategoryNr < 0) + return; + + if (CSongs.Categories.Length > CategoryNr) + { + bool sel = false; + foreach (CStatic tile in _Tiles) + { + if (tile.Selected) + { + sel = true; + break; + } + } + + if (_Locked == -1 || !sel) + { + if (_PreviewSelected > -1) + { + _Locked = _PreviewSelected; + } + else + { + _Locked = 0; + _actualSelection = 0; + _PreviewSelected = 0; + SetSelectedNow(); + UpdateList(0); + } + } + + foreach (CStatic tile in _Tiles) + { + tile.Selected = false; + } + + _PreviewSelected = CategoryNr; + SetSelectedNow(); + _Locked = CategoryNr; + + UpdateList((CategoryNr / _NumW) * _NumW - (_NumW * (_NumH - 2))); + + _PreviewSelected = _Locked; + _actualSelection = _Locked; + + for (int i = 0; i < _Tiles.Count; i++) + { + _Tiles[i].Selected = _Locked == i + _Offset; + } + } + } + protected override void EnterCategory(int cat) { base.EnterCategory(cat); diff --git a/Vocaluxe/Menu/SongMenu/ISongMenu.cs b/Vocaluxe/Menu/SongMenu/ISongMenu.cs index a859e84b..dfca5dee 100644 --- a/Vocaluxe/Menu/SongMenu/ISongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/ISongMenu.cs @@ -24,6 +24,7 @@ namespace Vocaluxe.Menu.SongMenu void SetActive(bool Active); int GetSelectedCategory(); + void SetSelectedCategory(int CategoryNr); int GetActualSelection(); bool IsSelected(); diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index f5809c12..a8dbc336 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -38,6 +38,7 @@ namespace Vocaluxe.Screens private const string ButtonOptionsPlaylist = "ButtonOptionsPlaylist"; private const string ButtonOptionsClose = "ButtonOptionsClose"; private const string ButtonOptionsRandom = "ButtonOptionsRandom"; + private const string ButtonOptionsRandomCategory = "ButtonOptionsRandomCategory"; private const string ButtonOptionsSingAll = "ButtonOptionsSingAll"; private const string ButtonOptionsSingAllVisible = "ButtonOptionsSingAllVisible"; private const string ButtonOptionsOpenPlaylist = "ButtonOptionsOpenPlaylist"; @@ -73,7 +74,7 @@ namespace Vocaluxe.Screens _ScreenVersion = ScreenVersion; _ThemeStatics = new string[] { StaticSearchBar, StaticOptionsBG }; _ThemeTexts = new string[] { TextCategory, TextSelection, TextSearchBarTitle, TextSearchBar, TextOptionsTitle }; - _ThemeButtons = new string[] { ButtonOptionsClose, ButtonOptionsPlaylist, ButtonOptionsSing, ButtonOptionsRandom, ButtonOptionsSingAll, ButtonOptionsSingAllVisible, ButtonOptionsOpenPlaylist, ButtonOpenOptions }; + _ThemeButtons = new string[] { ButtonOptionsClose, ButtonOptionsPlaylist, ButtonOptionsSing, ButtonOptionsRandom, ButtonOptionsRandomCategory, ButtonOptionsSingAll, ButtonOptionsSingAllVisible, ButtonOptionsOpenPlaylist, ButtonOpenOptions }; _ThemeSelectSlides = new string[] { SelectSlideOptionsMode, SelectSlideOptionsPlaylistAdd, SelectSlideOptionsPlaylistOpen }; _ThemeSongMenus = new string[] { SongMenu }; _ThemePlaylists = new string[] { Playlist }; @@ -89,6 +90,7 @@ namespace Vocaluxe.Screens 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; @@ -223,6 +225,10 @@ namespace Vocaluxe.Screens { SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); } + else if (CSongs.Category == -1 && KeyEvent.Mod == Modifier.Ctrl) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + } break; //TODO: Delete that! @@ -259,6 +265,13 @@ namespace Vocaluxe.Screens SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); } } + else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) + { + if (CSongs.Category == -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + } + } else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) { StartRandomAllSongs(); @@ -319,6 +332,11 @@ namespace Vocaluxe.Screens Console.WriteLine("MB pressed"); SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); } + else if (MouseEvent.MB && CSongs.Category == -1) + { + Console.WriteLine("MB pressed"); + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + } else SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); @@ -362,6 +380,13 @@ namespace Vocaluxe.Screens SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); } } + else if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected) + { + if (CSongs.Category == -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + } + } else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) { ToggleSongOptions(ESongOptionsView.None); @@ -648,8 +673,9 @@ namespace Vocaluxe.Screens else if (view == ESongOptionsView.General) { Buttons[htButtons(ButtonOptionsRandom)].Visible = CSongs.Category != -1; + Buttons[htButtons(ButtonOptionsRandomCategory)].Visible = CSongs.Category == -1; Buttons[htButtons(ButtonOptionsSingAll)].Visible = true; - Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = true; + Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = CSongs.Category != -1; ; Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = true; SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = true; } @@ -666,6 +692,7 @@ namespace Vocaluxe.Screens 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; From aa68edfba99b113cd4ea8bbe51576b17ed7a45e6 Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Sat, 1 Dec 2012 23:11:54 +0100 Subject: [PATCH 2/3] Added full-video-preview. Toggle wie "V" or click on video-icon. --- Vocaluxe/Menu/SongMenu/CSongMenu.cs | 10 + Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs | 14 ++ Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs | 45 +++- Vocaluxe/Menu/SongMenu/ISongMenu.cs | 3 + Vocaluxe/Screens/CScreenSong.cs | 215 +++++++++++-------- 5 files changed, 188 insertions(+), 99 deletions(-) diff --git a/Vocaluxe/Menu/SongMenu/CSongMenu.cs b/Vocaluxe/Menu/SongMenu/CSongMenu.cs index e6a2824e..7b22e96d 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenu.cs @@ -143,6 +143,16 @@ namespace Vocaluxe.Menu.SongMenu _SongMenu.SetSmallView(SmallView); } + public void ToggleVideoFull() + { + _SongMenu.ToggleVideoFull(); + } + + public bool IsVideoFull() + { + return _SongMenu.IsVideoFull(); + } + #endregion ISongMenu #region IMenuElement diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs index c2fc76ee..4f1a9e13 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs @@ -484,6 +484,9 @@ namespace Vocaluxe.Menu.SongMenu _timer.Stop(); _timer.Reset(); _SelectedInternal = _SelectedPending; + + if (IsVideoFull()) + ToggleVideoFull(); } public virtual void HandleInput(ref KeyEvent KeyEvent) @@ -553,6 +556,17 @@ namespace Vocaluxe.Menu.SongMenu return false; } + public virtual void ToggleVideoFull() + { + if (!_Initialized) + return; + } + + public virtual bool IsVideoFull() + { + return false; + } + public virtual void UnloadTextures() { } diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs index eda76a62..1c1393b8 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs @@ -41,6 +41,7 @@ namespace Vocaluxe.Menu.SongMenu private int _actualSelection = -1; private bool _SmallView = false; + private bool _VidFull = false; public override int GetActualSelection() { @@ -359,6 +360,10 @@ namespace Vocaluxe.Menu.SongMenu } else if (_PreviewSelected != -1 && MouseEvent.LB && CSongs.Category != -1) { + if (CHelper.IsInBounds(_VideoIcon.Rect, MouseEvent)) + { + ToggleVideoFull(); + } if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent)) { _Locked = _PreviewSelected; @@ -375,6 +380,10 @@ namespace Vocaluxe.Menu.SongMenu } } } + else if (MouseEvent.LB && CHelper.IsInBounds(_VideoIcon.Rect, MouseEvent)) + { + ToggleVideoFull(); + } if (MouseEvent.Wheel > 0) { @@ -472,14 +481,26 @@ namespace Vocaluxe.Menu.SongMenu if (_vidtex.index != -1 && _Video != -1) { - RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); - RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + if (_VidFull) + { + RectangleF bounds = new RectangleF(0, 0, CSettings.iRenderW, CSettings.iRenderH); + RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height); + CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); - CDraw.DrawTexture(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z), - _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); - CDraw.DrawTextureReflection(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z), - _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); + CDraw.DrawTexture(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.zNear), + _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); + } + else + { + RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); + RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height); + CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + + CDraw.DrawTexture(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z), + _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); + CDraw.DrawTextureReflection(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z), + _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); + } } @@ -793,6 +814,16 @@ namespace Vocaluxe.Menu.SongMenu return _SmallView; } + public override void ToggleVideoFull() + { + _VidFull = !_VidFull; + } + + public override bool IsVideoFull() + { + return _VidFull; + } + public override void LoadTextures() { base.LoadTextures(); diff --git a/Vocaluxe/Menu/SongMenu/ISongMenu.cs b/Vocaluxe/Menu/SongMenu/ISongMenu.cs index dfca5dee..18251b88 100644 --- a/Vocaluxe/Menu/SongMenu/ISongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/ISongMenu.cs @@ -33,6 +33,9 @@ namespace Vocaluxe.Menu.SongMenu bool IsVisible(); void SetVisible(bool Visible); + void ToggleVideoFull(); + bool IsVideoFull(); + bool IsSmallView(); void SetSmallView(bool SmallView); diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index a8dbc336..bc1184d0 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -141,7 +141,9 @@ namespace Vocaluxe.Screens switch (KeyEvent.Key) { case Keys.Escape: - if (CSongs.Category < 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) + if (SongMenus[htSongMenus(SongMenu)].IsVideoFull()) + SongMenus[htSongMenus(SongMenu)].ToggleVideoFull(); + else if (CSongs.Category < 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) CGraphics.FadeTo(EScreens.ScreenMain); break; @@ -149,7 +151,11 @@ namespace Vocaluxe.Screens if (CSongs.NumVisibleSongs > 0) { if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) + { ToggleSongOptions(ESongOptionsView.Song); + if (SongMenus[htSongMenus(SongMenu)].IsVideoFull()) + SongMenus[htSongMenus(SongMenu)].ToggleVideoFull(); + } } break; @@ -174,6 +180,8 @@ namespace Vocaluxe.Screens break; case Keys.Space: + if (SongMenus[htSongMenus(SongMenu)].IsVideoFull()) + SongMenus[htSongMenus(SongMenu)].ToggleVideoFull(); ToggleSongOptions(ESongOptionsView.General); break; @@ -187,6 +195,8 @@ namespace Vocaluxe.Screens else { _SearchActive = true; + if (SongMenus[htSongMenus(SongMenu)].IsVideoFull()) + SongMenus[htSongMenus(SongMenu)].ToggleVideoFull(); } break; @@ -215,6 +225,8 @@ namespace Vocaluxe.Screens else { _SearchActive = true; + if (SongMenus[htSongMenus(SongMenu)].IsVideoFull()) + SongMenus[htSongMenus(SongMenu)].ToggleVideoFull(); } } break; @@ -234,13 +246,16 @@ namespace Vocaluxe.Screens //TODO: Delete that! case Keys.S: if (CSongs.NumVisibleSongs > 0) + { StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + } break; + } } } - else + else if(!SongMenus[htSongMenus(SongMenu)].IsVideoFull()) { switch (KeyEvent.Key) { @@ -294,118 +309,134 @@ namespace Vocaluxe.Screens } } + if (KeyEvent.Key == Keys.V) + { + if (CSongs.Category != -1) + { + SongMenus[htSongMenus(SongMenu)].ToggleVideoFull(); + } + } + return true; } public override bool HandleMouse(MouseEvent MouseEvent) { - base.HandleMouse(MouseEvent); - - if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].IsMouseOver(MouseEvent)) + if (!SongMenus[htSongMenus(SongMenu)].IsVideoFull()) { - _PlaylistActive = true; - Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; - SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); - } - else if (CHelper.IsInBounds(SongMenus[htSongMenus(SongMenu)].Rect, MouseEvent.X, MouseEvent.Y)) - { - _PlaylistActive = false; - Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; - SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); - } + base.HandleMouse(MouseEvent); - if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].HandleMouse(MouseEvent)) - return true; - - if (!_SongOptionsActive) - { - - if ((MouseEvent.RB) && (CSongs.Category < 0)) + if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].IsMouseOver(MouseEvent)) { - CGraphics.FadeTo(EScreens.ScreenMain); + _PlaylistActive = true; + Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; + SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); + } + else if (CHelper.IsInBounds(SongMenus[htSongMenus(SongMenu)].Rect, MouseEvent.X, MouseEvent.Y)) + { + _PlaylistActive = false; + Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; + SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); } - else if (MouseEvent.RB && _SongOptionsActive) - ToggleSongOptions(ESongOptionsView.None); - if (MouseEvent.MB && CSongs.Category != -1) + if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].HandleMouse(MouseEvent)) + return true; + + if (!_SongOptionsActive) { - Console.WriteLine("MB pressed"); - SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); - } - else if (MouseEvent.MB && CSongs.Category == -1) - { - Console.WriteLine("MB pressed"); - SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + + if ((MouseEvent.RB) && (CSongs.Category < 0)) + { + CGraphics.FadeTo(EScreens.ScreenMain); + } + else if (MouseEvent.RB && _SongOptionsActive) + ToggleSongOptions(ESongOptionsView.None); + + if (MouseEvent.MB && CSongs.Category != -1) + { + Console.WriteLine("MB pressed"); + SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + } + else if (MouseEvent.MB && CSongs.Category == -1) + { + Console.WriteLine("MB pressed"); + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + } + else + SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); + + if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) + { + if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) + { + ToggleSongOptions(ESongOptionsView.Song); + } + } + else if (MouseEvent.LB && IsMouseOver(MouseEvent)) + { + if (Buttons[htButtons(ButtonOpenOptions)].Selected) + { + ToggleSongOptions(ESongOptionsView.General); + } + } } + else - SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); - - if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { - if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) + if (MouseEvent.LB && IsMouseOver(MouseEvent)) { - ToggleSongOptions(ESongOptionsView.Song); + if (Buttons[htButtons(ButtonOptionsClose)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + } + else if (Buttons[htButtons(ButtonOptionsSing)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + } + else if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) + { + OpenAndAddPlaylistAction(); + } + else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) + { + if (CSongs.Category != -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + } + } + else if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected) + { + if (CSongs.Category == -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + } + } + else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartRandomAllSongs(); + } + else if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartRandomVisibleSongs(); + } + else if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) + { + OpenPlaylistAction(); + } } - } - else if (MouseEvent.LB && IsMouseOver(MouseEvent)) - { - if (Buttons[htButtons(ButtonOpenOptions)].Selected) + if (MouseEvent.RB) { - ToggleSongOptions(ESongOptionsView.General); + ToggleSongOptions(ESongOptionsView.None); } } } - else { - if (MouseEvent.LB && IsMouseOver(MouseEvent)) - { - if (Buttons[htButtons(ButtonOptionsClose)].Selected) - { - ToggleSongOptions(ESongOptionsView.None); - } - else if (Buttons[htButtons(ButtonOptionsSing)].Selected) - { - ToggleSongOptions(ESongOptionsView.None); - StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); - } - else if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) - { - OpenAndAddPlaylistAction(); - } - else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) - { - if (CSongs.Category != -1) - { - SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); - } - } - else if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected) - { - if (CSongs.Category == -1) - { - SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); - } - } - else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) - { - ToggleSongOptions(ESongOptionsView.None); - StartRandomAllSongs(); - } - else if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) - { - ToggleSongOptions(ESongOptionsView.None); - StartRandomVisibleSongs(); - } - else if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) - { - OpenPlaylistAction(); - } - } - if (MouseEvent.RB) - { - ToggleSongOptions(ESongOptionsView.None); - } + if(MouseEvent.RB || MouseEvent.LB) + SongMenus[htSongMenus(SongMenu)].ToggleVideoFull(); } return true; From 23ebc543549b9a740474041e00fda67d434e583b Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Sun, 2 Dec 2012 14:34:32 +0100 Subject: [PATCH 3/3] Log error when song is not found from playlist. --- Vocaluxe/Lib/Playlist/CPlaylistFile.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index 0bef3b65..e76d3de0 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -199,6 +199,10 @@ namespace Vocaluxe.Lib.Playlist song.GameMode = gm; Songs.Add(song); } + else + { + CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + PlaylistFile); + } } } else