Merge branch 'gui' into developer

Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
This commit is contained in:
2015-11-02 22:02:17 +01:00
2 changed files with 56 additions and 20 deletions
+25 -10
View File
@@ -31,7 +31,7 @@ namespace MusicPlayer
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.SongsTableView = new System.Windows.Forms.DataGridView(); this.SongsTableView = new System.Windows.Forms.DataGridView();
this.GenreListBox = new System.Windows.Forms.ListBox(); this.GenreListBox = new System.Windows.Forms.ListBox();
@@ -111,6 +111,7 @@ namespace MusicPlayer
this.NotifyMenuStripNextButton = new System.Windows.Forms.ToolStripMenuItem(); this.NotifyMenuStripNextButton = new System.Windows.Forms.ToolStripMenuItem();
this.NotifyMenuStripPreviousButton = new System.Windows.Forms.ToolStripMenuItem(); this.NotifyMenuStripPreviousButton = new System.Windows.Forms.ToolStripMenuItem();
this.resetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AddToQueueLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
this.MainPanel.SuspendLayout(); this.MainPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).BeginInit();
@@ -131,14 +132,14 @@ namespace MusicPlayer
this.SongsTableView.AllowUserToResizeRows = false; this.SongsTableView.AllowUserToResizeRows = false;
this.SongsTableView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.SongsTableView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.SongsTableView.BackgroundColor = System.Drawing.SystemColors.Control; this.SongsTableView.BackgroundColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.ControlLight; dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.ControlLight;
dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.SongsTableView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.SongsTableView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.SongsTableView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.SongsTableView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.SongsTableView.Dock = System.Windows.Forms.DockStyle.Fill; this.SongsTableView.Dock = System.Windows.Forms.DockStyle.Fill;
this.SongsTableView.Location = new System.Drawing.Point(0, 0); this.SongsTableView.Location = new System.Drawing.Point(0, 0);
@@ -204,6 +205,7 @@ namespace MusicPlayer
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.MainPanel.BackColor = System.Drawing.SystemColors.Window; this.MainPanel.BackColor = System.Drawing.SystemColors.Window;
this.MainPanel.Controls.Add(this.AddToQueueLabel);
this.MainPanel.Controls.Add(this.SplitContainer); this.MainPanel.Controls.Add(this.SplitContainer);
this.MainPanel.Controls.Add(this.AlbumListLabel); this.MainPanel.Controls.Add(this.AlbumListLabel);
this.MainPanel.Controls.Add(this.ArtistListLabel); this.MainPanel.Controls.Add(this.ArtistListLabel);
@@ -842,13 +844,25 @@ namespace MusicPlayer
this.NotifyMenuStripPreviousButton.Size = new System.Drawing.Size(119, 22); this.NotifyMenuStripPreviousButton.Size = new System.Drawing.Size(119, 22);
this.NotifyMenuStripPreviousButton.Text = "Previous"; this.NotifyMenuStripPreviousButton.Text = "Previous";
this.NotifyMenuStripPreviousButton.Click += new System.EventHandler(this.NotifyMenuStripPreviousButton_Click); this.NotifyMenuStripPreviousButton.Click += new System.EventHandler(this.NotifyMenuStripPreviousButton_Click);
// //
// resetToolStripMenuItem // resetToolStripMenuItem
// //
this.resetToolStripMenuItem.Name = "resetToolStripMenuItem"; this.resetToolStripMenuItem.Name = "resetToolStripMenuItem";
this.resetToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.resetToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.resetToolStripMenuItem.Text = "Reset"; this.resetToolStripMenuItem.Text = "Reset";
this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click); this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click);
// AddToQueueLabel
//
this.AddToQueueLabel.AutoSize = true;
this.AddToQueueLabel.BackColor = System.Drawing.SystemColors.Control;
this.AddToQueueLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.AddToQueueLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.AddToQueueLabel.Location = new System.Drawing.Point(668, 4);
this.AddToQueueLabel.Name = "AddToQueueLabel";
this.AddToQueueLabel.Size = new System.Drawing.Size(104, 18);
this.AddToQueueLabel.TabIndex = 10;
this.AddToQueueLabel.Text = "Add to Queue";
this.AddToQueueLabel.Visible = false;
// //
// MainForm // MainForm
// //
@@ -964,6 +978,7 @@ namespace MusicPlayer
private System.Windows.Forms.ToolStripMenuItem AdvancedSearchButton; private System.Windows.Forms.ToolStripMenuItem AdvancedSearchButton;
private System.Windows.Forms.ToolStripMenuItem resetToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem resetToolStripMenuItem;
private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label AddToQueueLabel;
} }
} }
+31 -10
View File
@@ -486,7 +486,7 @@ namespace MusicPlayer
{ {
main.FilterCurrentPlaying(); main.FilterCurrentPlaying();
int selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong); int selected = main.currentPlayingList.IndexOf(main.audio.CurrentSong);
if(main.currentPlayingList.Count >= 1) if(main.currentPlayingList.Count >= 1 && selected >= 0)
SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0]; SongsTableView.CurrentCell = SongsTableView.Rows[selected].Cells[0];
} }
@@ -505,23 +505,43 @@ namespace MusicPlayer
{ {
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
Point point = PlaylistBox.PointToClient(Cursor.Position); Point point = PlaylistBox.PointToClient(Cursor.Position);
Point point2 = AddToQueueLabel.PointToClient(Cursor.Position);
bool queue = AddToQueueLabel.ClientRectangle.Contains(point2);
int index = PlaylistBox.IndexFromPoint(point); int index = PlaylistBox.IndexFromPoint(point);
if (index < 0) //nope, niet op een playlist gesleept if (index < 0 && !queue) //nope, niet op een playlist gesleept
{ {
draggedstarted = false; draggedstarted = false;
draggedcompleted = false; draggedcompleted = false;
return; return;
} }
Playlist currentPlaylist = main.pl.GetPlaylistByName(PlaylistBox.Items[index].ToString());
SongsTable s = new SongsTable(); if (queue)
if (SongsTableView.SelectedRows.Count > 0)
{ {
var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView; SongsTable s = new SongsTable();
var row = drv.Row as DataRow; if (SongsTableView.SelectedRows.Count > 0)
s.ImportRow(row); {
currentPlaylist.AddSong((s.Rows[0][5] as Song)); var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView;
currentPlaylist.WriteToFile(); var row = drv.Row as DataRow;
s.ImportRow(row);
main.currentPlayingList.Add((s.Rows[0][5] as Song));
ViewCurrentPlaylistButton_Click(this, new EventArgs());
}
} }
else
{
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();
}
}
AddToQueueLabel.Visible = false;
} }
draggedcompleted = false; draggedcompleted = false;
@@ -537,6 +557,7 @@ namespace MusicPlayer
{ {
draggedcompleted = true; draggedcompleted = true;
playlistsToolStripMenuItem_Click(this, new EventArgs()); playlistsToolStripMenuItem_Click(this, new EventArgs());
AddToQueueLabel.Visible = true;
Cursor.Current = Cursors.Hand; Cursor.Current = Cursors.Hand;
} }
} }