diff --git a/MusicPlayer/MusicPlayer/MainForm.Designer.cs b/MusicPlayer/MusicPlayer/MainForm.Designer.cs index 6fc508d..e1c007d 100644 --- a/MusicPlayer/MusicPlayer/MainForm.Designer.cs +++ b/MusicPlayer/MusicPlayer/MainForm.Designer.cs @@ -129,6 +129,9 @@ namespace MusicPlayer this.SongsTableView.Size = new System.Drawing.Size(760, 174); this.SongsTableView.TabIndex = 0; this.SongsTableView.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.SongsTableView_CellDoubleClick); + this.SongsTableView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SongsTableView_MouseDown); + this.SongsTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SongsTableView_MouseMove); + this.SongsTableView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SongsTableView_MouseUp); // // GenreListBox // @@ -136,7 +139,7 @@ namespace MusicPlayer | System.Windows.Forms.AnchorStyles.Left))); this.GenreListBox.BackColor = System.Drawing.SystemColors.Control; this.GenreListBox.FormattingEnabled = true; - this.GenreListBox.Location = new System.Drawing.Point(3, 3); + this.GenreListBox.Location = new System.Drawing.Point(148, 3); this.GenreListBox.Name = "GenreListBox"; this.GenreListBox.Size = new System.Drawing.Size(150, 121); this.GenreListBox.Sorted = true; @@ -149,10 +152,10 @@ namespace MusicPlayer | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.AlbumListView.BackColor = System.Drawing.SystemColors.Control; - this.AlbumListView.Location = new System.Drawing.Point(309, 3); + this.AlbumListView.Location = new System.Drawing.Point(460, 3); this.AlbumListView.MultiSelect = false; this.AlbumListView.Name = "AlbumListView"; - this.AlbumListView.Size = new System.Drawing.Size(451, 121); + this.AlbumListView.Size = new System.Drawing.Size(286, 121); this.AlbumListView.Sorting = System.Windows.Forms.SortOrder.Ascending; this.AlbumListView.TabIndex = 2; this.AlbumListView.TileSize = new System.Drawing.Size(140, 30); @@ -166,7 +169,7 @@ namespace MusicPlayer | System.Windows.Forms.AnchorStyles.Left))); this.ArtistListBox.BackColor = System.Drawing.SystemColors.Control; this.ArtistListBox.FormattingEnabled = true; - this.ArtistListBox.Location = new System.Drawing.Point(156, 3); + this.ArtistListBox.Location = new System.Drawing.Point(304, 3); this.ArtistListBox.Name = "ArtistListBox"; this.ArtistListBox.Size = new System.Drawing.Size(150, 121); this.ArtistListBox.Sorted = true; @@ -200,10 +203,10 @@ namespace MusicPlayer // // SplitContainer.Panel1 // + this.SplitContainer.Panel1.Controls.Add(this.PlaylistBox); this.SplitContainer.Panel1.Controls.Add(this.AlbumListView); this.SplitContainer.Panel1.Controls.Add(this.ArtistListBox); this.SplitContainer.Panel1.Controls.Add(this.GenreListBox); - this.SplitContainer.Panel1.Controls.Add(this.PlaylistBox); // // SplitContainer.Panel2 // @@ -215,29 +218,28 @@ namespace MusicPlayer // // PlaylistBox // - this.PlaylistBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.PlaylistBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); this.PlaylistBox.FormattingEnabled = true; - this.PlaylistBox.Location = new System.Drawing.Point(0, 0); + this.PlaylistBox.Location = new System.Drawing.Point(3, 3); this.PlaylistBox.Name = "PlaylistBox"; - this.PlaylistBox.Size = new System.Drawing.Size(760, 131); + this.PlaylistBox.Size = new System.Drawing.Size(139, 121); this.PlaylistBox.TabIndex = 4; - this.PlaylistBox.Visible = false; this.PlaylistBox.SelectedIndexChanged += new System.EventHandler(this.PlaylistBox_SelectedIndexChanged); // // PlaylistListLabel // this.PlaylistListLabel.AutoSize = true; - this.PlaylistListLabel.Location = new System.Drawing.Point(12, 8); + this.PlaylistListLabel.Location = new System.Drawing.Point(12, 9); this.PlaylistListLabel.Name = "PlaylistListLabel"; this.PlaylistListLabel.Size = new System.Drawing.Size(39, 13); this.PlaylistListLabel.TabIndex = 7; this.PlaylistListLabel.Text = "Playlist"; - this.PlaylistListLabel.Visible = false; // // AlbumListLabel // this.AlbumListLabel.AutoSize = true; - this.AlbumListLabel.Location = new System.Drawing.Point(321, 9); + this.AlbumListLabel.Location = new System.Drawing.Point(483, 8); this.AlbumListLabel.Name = "AlbumListLabel"; this.AlbumListLabel.Size = new System.Drawing.Size(36, 13); this.AlbumListLabel.TabIndex = 6; @@ -246,7 +248,7 @@ namespace MusicPlayer // ArtistListLabel // this.ArtistListLabel.AutoSize = true; - this.ArtistListLabel.Location = new System.Drawing.Point(165, 9); + this.ArtistListLabel.Location = new System.Drawing.Point(327, 8); this.ArtistListLabel.Name = "ArtistListLabel"; this.ArtistListLabel.Size = new System.Drawing.Size(30, 13); this.ArtistListLabel.TabIndex = 5; @@ -255,7 +257,7 @@ namespace MusicPlayer // GenreListLabel // this.GenreListLabel.AutoSize = true; - this.GenreListLabel.Location = new System.Drawing.Point(12, 9); + this.GenreListLabel.Location = new System.Drawing.Point(174, 8); this.GenreListLabel.Name = "GenreListLabel"; this.GenreListLabel.Size = new System.Drawing.Size(36, 13); this.GenreListLabel.TabIndex = 4; diff --git a/MusicPlayer/MusicPlayer/MainForm.cs b/MusicPlayer/MusicPlayer/MainForm.cs index 46e0a45..15f017a 100644 --- a/MusicPlayer/MusicPlayer/MainForm.cs +++ b/MusicPlayer/MusicPlayer/MainForm.cs @@ -19,6 +19,7 @@ namespace MusicPlayer public partial class MainForm : Form { bool songFinished; + bool draggedstarted; public Main main { @@ -442,5 +443,45 @@ namespace MusicPlayer int selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong); SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0]; } + + + private void SongsTableView_MouseDown(object sender, MouseEventArgs e) + { + draggedstarted = true; + Cursor.Current = Cursors.Hand; + } + + private void SongsTableView_MouseUp(object sender, MouseEventArgs e) + { + if (draggedstarted) + { + Cursor.Current = Cursors.Default; + Point point = PlaylistBox.PointToClient(Cursor.Position); + int index = PlaylistBox.IndexFromPoint(point); + if (index < 0) //nope, niet op een playlist gesleept + { + draggedstarted = false; + return; + } + Playlist currentPlaylist = main.pl.GetPlaylistByName(PlaylistBox.Items[index].ToString()); + SongsTable s = new SongsTable(); + if (SongsTableView.SelectedRows.Count > 0) + { + var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView; + var row = drv.Row as DataRow; + s.ImportRow(row); + currentPlaylist.AddSong((s.Rows[0][5] as Song)); + currentPlaylist.WriteToFile(); + } + } + } + + private void SongsTableView_MouseMove(object sender, MouseEventArgs e) + { + if (draggedstarted) + { + Cursor.Current = Cursors.Hand; + } + } } } diff --git a/MusicPlayer/MusicPlayer/Properties/Resources.Designer.cs b/MusicPlayer/MusicPlayer/Properties/Resources.Designer.cs index e3ad06c..ebc59d9 100755 --- a/MusicPlayer/MusicPlayer/Properties/Resources.Designer.cs +++ b/MusicPlayer/MusicPlayer/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace MusicPlayer.Properties -{ - - +namespace MusicPlayer.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -22,48 +22,40 @@ namespace MusicPlayer.Properties [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MusicPlayer.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/MusicPlayer/MusicPlayer/Properties/Resources.resx b/MusicPlayer/MusicPlayer/Properties/Resources.resx old mode 100755 new mode 100644 index af7dbeb..1af7de1 --- a/MusicPlayer/MusicPlayer/Properties/Resources.resx +++ b/MusicPlayer/MusicPlayer/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file