From 6bdfb49cbbd6c1638221dc6f6f46fafb45a9ea09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 26 May 2013 14:46:01 +0200 Subject: [PATCH] Fixed double-click-bug on screen-song. --- Vocaluxe/Screens/CScreenSong.cs | 4 +--- VocaluxeLib/Menu/SongMenu/CSongMenu.cs | 5 +++++ VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs | 2 ++ VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs | 9 +++++++++ VocaluxeLib/Menu/SongMenu/ISongMenu.cs | 2 ++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index ba5216e7..5cccfc67 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -449,9 +449,7 @@ 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.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1) + if (CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1 && _SongMenus[_SongMenu].IsMouseOverActualSelection(mouseEvent)) { _ToggleSongOptions(ESongOptionsView.None); _StartVisibleSong(_SongMenus[_SongMenu].GetActualSelection()); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs index b4c3f32a..b66013b4 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs @@ -98,6 +98,11 @@ namespace VocaluxeLib.Menu.SongMenu _SongMenu.SetActive(active); } + public bool IsMouseOverActualSelection(SMouseEvent mEvent) + { + return _SongMenu.IsMouseOverActualSelection(mEvent); + } + public int GetSelectedSong() { return _SongMenu.GetSelectedSong(); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index aabb9749..b2353579 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -518,6 +518,8 @@ namespace VocaluxeLib.Menu.SongMenu _Active = active; } + public virtual bool IsMouseOverActualSelection(SMouseEvent mEvent) { return false; } + public virtual int GetSelectedSong() { return -1; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 7cdc4dec..d263fe92 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -485,6 +485,15 @@ namespace VocaluxeLib.Menu.SongMenu return _Locked; } + public override bool IsMouseOverActualSelection(SMouseEvent mEvent) + { + CStatic selCov = GetSelectedSongCover(); + if (selCov.Texture == null) + return false; + SRectF rect = new SRectF(selCov.Rect.X - selCov.Rect.W*0.2f, selCov.Rect.Y - selCov.Rect.H*0.2f, selCov.Rect.W*1.2f, selCov.Rect.H*1.2f, selCov.Rect.Z); + return CHelper.IsInBounds(rect, mEvent); + } + public override CStatic GetSelectedSongCover() { foreach (CStatic tile in _Tiles) diff --git a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs index 060a8cf4..7f2cd6ec 100644 --- a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs @@ -40,6 +40,8 @@ namespace VocaluxeLib.Menu.SongMenu bool IsActive(); void SetActive(bool active); + bool IsMouseOverActualSelection(SMouseEvent mEvent); + int GetSelectedCategory(); void SetSelectedCategory(int categoryNr); int GetActualSelection();