From 07cf939278bbd430717b32bd35b2f275e0d7e67f Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Mon, 3 Dec 2012 21:37:12 +0100 Subject: [PATCH] some code cleanup in song screen and some small bugfixes --- Vocaluxe/Base/CSettings.cs | 2 +- Vocaluxe/Menu/CGraphics.cs | 4 +- Vocaluxe/Screens/CScreenSong.cs | 178 ++++++++++++++++++++------------ 3 files changed, 115 insertions(+), 69 deletions(-) diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 71b851c2..4bfb32ef 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -164,7 +164,7 @@ namespace Vocaluxe.Base return (float)iRenderW / (float)iRenderH; } - public static void MouseInacive() + public static void MouseInactive() { MouseMoveDiffMin = 15; } diff --git a/Vocaluxe/Menu/CGraphics.cs b/Vocaluxe/Menu/CGraphics.cs index 8a2dab5c..b309938a 100644 --- a/Vocaluxe/Menu/CGraphics.cs +++ b/Vocaluxe/Menu/CGraphics.cs @@ -459,7 +459,7 @@ namespace Vocaluxe.Menu { if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down) { - CSettings.MouseInacive(); + CSettings.MouseInactive(); _Cursor.FadeOut(); } @@ -521,7 +521,7 @@ namespace Vocaluxe.Menu if (_CurrentPopupScreen != EPopupScreens.NoPopup) handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent); - if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB)) + if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB)) Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent); } return Resume; diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 5cf3cebe..e11d1c01 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -340,103 +340,149 @@ namespace Vocaluxe.Screens SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); } - if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].HandleMouse(MouseEvent)) - return true; - if ((MouseEvent.RB) && (CSongs.Category < 0) && !_SongOptionsActive) + if (Playlists[htPlaylists(Playlist)].Visible && _PlaylistActive) { - CGraphics.FadeTo(EScreens.ScreenMain); + if (Playlists[htPlaylists(Playlist)].HandleMouse(MouseEvent)) + return true; } - else if (MouseEvent.RB && _SongOptionsActive) - ToggleSongOptions(ESongOptionsView.None); - if (MouseEvent.MB && CSongs.Category != -1) - { - ToggleSongOptions(ESongOptionsView.None); - SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); - } - else if (MouseEvent.MB && CSongs.Category == -1) - { - ToggleSongOptions(ESongOptionsView.None); - SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); - } - else - SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); - if (MouseEvent.LBH && !DragAndDropActive && Playlists[htPlaylists(Playlist)].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) + if (MouseEvent.RB) { - DragAndDropCover = SongMenus[htSongMenus(SongMenu)].GetSelectedSongCover(); - DragAndDropCover.Rect.Z = CSettings.zNear; - Playlists[htPlaylists(Playlist)].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetActualSelection()].ID; - DragAndDropActive = true; - ToggleSongOptions(ESongOptionsView.None); - } - else if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) - { - if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) - { - ToggleSongOptions(ESongOptionsView.Song); - } - else - ToggleSongOptions(ESongOptionsView.None); - } - else if (MouseEvent.LB && IsMouseOver(MouseEvent)) - { - if (Buttons[htButtons(ButtonOpenOptions)].Selected) - { - ToggleSongOptions(ESongOptionsView.General); - }else if (Buttons[htButtons(ButtonOptionsClose)].Selected) + if (_SongOptionsActive) { ToggleSongOptions(ESongOptionsView.None); + return true; } - else if (Buttons[htButtons(ButtonOptionsSing)].Selected) + + if (CSongs.Category < 0) + { + CGraphics.FadeTo(EScreens.ScreenMain); + return true; + } + } + + if (MouseEvent.MB) + { + if (CSongs.Category != -1) { ToggleSongOptions(ESongOptionsView.None); - StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + return true; } - else if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) + + if (CSongs.Category == -1) { - OpenAndAddPlaylistAction(); + ToggleSongOptions(ESongOptionsView.None); + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + return true; } - else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) + } + + SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); + + if (MouseEvent.LB) + { + if (IsMouseOver(MouseEvent)) { - if (CSongs.Category != -1) + if (Buttons[htButtons(ButtonOpenOptions)].Selected) { - SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + ToggleSongOptions(ESongOptionsView.General); + return true; + } + + if (Buttons[htButtons(ButtonOptionsClose)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + return true; + } + + if (Buttons[htButtons(ButtonOptionsSing)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + return true; + } + + if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) + { + OpenAndAddPlaylistAction(); + return true; + } + + if (Buttons[htButtons(ButtonOptionsRandom)].Selected) + { + if (CSongs.Category != -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + return true; + } + } + + if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected) + { + if (CSongs.Category == -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + return true; + } + } + + if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartRandomAllSongs(); + return true; + } + + if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartRandomVisibleSongs(); + return true; + } + + if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) + { + OpenPlaylistAction(); + return true; } } - else if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected) + + if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { - if (CSongs.Category == -1) + if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) { - SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); + ToggleSongOptions(ESongOptionsView.Song); + return true; + } + else + { + ToggleSongOptions(ESongOptionsView.None); + return true; } } - else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) + } + + if (MouseEvent.LBH) + { + if (!DragAndDropActive && Playlists[htPlaylists(Playlist)].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { - ToggleSongOptions(ESongOptionsView.None); - StartRandomAllSongs(); - } - else if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) - { - ToggleSongOptions(ESongOptionsView.None); - StartRandomVisibleSongs(); - } - else if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) - { - OpenPlaylistAction(); + DragAndDropCover = SongMenus[htSongMenus(SongMenu)].GetSelectedSongCover(); + DragAndDropCover.Rect.Z = CSettings.zNear; + Playlists[htPlaylists(Playlist)].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetActualSelection()].ID; + DragAndDropActive = true; + return true; } } - if (MouseEvent.RB && _SongOptionsActive) - { - ToggleSongOptions(ESongOptionsView.None); - } if (!MouseEvent.LBH && DragAndDropActive) { DragAndDropActive = false; Playlists[htPlaylists(Playlist)].DragAndDropSongID = -1; + return true; } return true;