From ec39b72f8001d4b3da37be30837afcc1950787a3 Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Sun, 2 Dec 2012 19:38:18 +0100 Subject: [PATCH] added possibility to drop the playlist elements on first and last position even if the mouse is out of range of the other playlist elements --- Vocaluxe/Lib/Playlist/CPlaylistFile.cs | 9 ++++++++ Vocaluxe/Menu/CPlaylist.cs | 29 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index 2a7d607d..2d2d959b 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -265,5 +265,14 @@ namespace Vocaluxe.Lib.Playlist Songs.RemoveAt(SourceNr); Songs.Insert(DestNr, ps); } + + public void SongInsert(int DestNr, int SongID, EGameMode gm) + { + if (DestNr < 0 || DestNr > Songs.Count - 1) + return; + + CPlaylistSong ps = new CPlaylistSong(SongID, gm); + Songs.Insert(DestNr, ps); + } } } diff --git a/Vocaluxe/Menu/CPlaylist.cs b/Vocaluxe/Menu/CPlaylist.cs index d257b397..f08574be 100644 --- a/Vocaluxe/Menu/CPlaylist.cs +++ b/Vocaluxe/Menu/CPlaylist.cs @@ -974,6 +974,35 @@ namespace Vocaluxe.Menu CPlaylists.Playlists[ActivePlaylistID].SongMove(ChangeOrderSource, CurrentPlaylistElement + Offset); UpdatePlaylist(); } + else if (CurrentPlaylistElement == -1) + { + if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0) + { + CPlaylists.Playlists[ActivePlaylistID].SongMove(ChangeOrderSource, 0); + } + else + { + if (PlaylistElements.Count + Offset >= PlaylistElementContents.Count) + { + float min = 0f; + for (int i = PlaylistElements.Count - 1; i >= 0; i--) + { + if (PlaylistElements[i].SelectSlide.Visible) + { + min = PlaylistElements[i].SelectSlide.Rect.Y + PlaylistElements[i].SelectSlide.Rect.H; + break; + } + } + + if (MouseEvent.Y > min) + { + CPlaylists.Playlists[ActivePlaylistID].SongMove(ChangeOrderSource, PlaylistElementContents.Count - 1); + } + } + } + + UpdatePlaylist(); + } _EditMode = EEditMode.None; } break;