diff options
author | sr55 <[email protected]> | 2009-03-16 18:15:29 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-03-16 18:15:29 +0000 |
commit | 7315884a151d06ee284bfebd294d151a9e59eb57 (patch) | |
tree | 2a9b04b372f4e3f75181212662e9d90ec4b98a0f | |
parent | da30360f3e7d4c953e5ff9fe8f435db7a887596e (diff) |
WinGui:
- Added right click menu to the queue with Move Up/Down and Delete options.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2262 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/C#/frmQueue.Designer.cs | 195 | ||||
-rw-r--r-- | win/C#/frmQueue.cs | 60 | ||||
-rw-r--r-- | win/C#/frmQueue.resx | 3 |
3 files changed, 164 insertions, 94 deletions
diff --git a/win/C#/frmQueue.Designer.cs b/win/C#/frmQueue.Designer.cs index 259450dab..5a82d13d0 100644 --- a/win/C#/frmQueue.Designer.cs +++ b/win/C#/frmQueue.Designer.cs @@ -50,7 +50,15 @@ namespace Handbrake this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+ this.btn_encode = new System.Windows.Forms.ToolStripButton();
+ this.btn_pause = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.drop_button_queue = new System.Windows.Forms.ToolStripDropDownButton();
+ this.mnu_batch = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnu_import = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnu_export = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
+ this.mnu_readd = new System.Windows.Forms.ToolStripMenuItem();
this.SaveFile = new System.Windows.Forms.SaveFileDialog();
this.list_queue = new System.Windows.Forms.ListView();
this.Title = new System.Windows.Forms.ColumnHeader();
@@ -66,19 +74,17 @@ namespace Handbrake this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
- this.btn_encode = new System.Windows.Forms.ToolStripButton();
- this.btn_pause = new System.Windows.Forms.ToolStripButton();
- this.drop_button_queue = new System.Windows.Forms.ToolStripDropDownButton();
- this.mnu_batch = new System.Windows.Forms.ToolStripMenuItem();
- this.mnu_import = new System.Windows.Forms.ToolStripMenuItem();
- this.mnu_export = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
- this.mnu_readd = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnu_queue = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.mnu_up = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnu_Down = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
+ this.mnu_delete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
+ this.mnu_queue.SuspendLayout();
this.SuspendLayout();
//
// btn_down
@@ -230,11 +236,86 @@ namespace Handbrake this.toolStrip1.TabIndex = 71;
this.toolStrip1.Text = "toolStrip1";
//
+ // btn_encode
+ //
+ this.btn_encode.Image = global::Handbrake.Properties.Resources.Play;
+ this.btn_encode.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+ this.btn_encode.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btn_encode.Name = "btn_encode";
+ this.btn_encode.Size = new System.Drawing.Size(84, 36);
+ this.btn_encode.Text = "Encode";
+ this.btn_encode.Click += new System.EventHandler(this.btn_encode_Click);
+ //
+ // btn_pause
+ //
+ this.btn_pause.Image = global::Handbrake.Properties.Resources.Pause;
+ this.btn_pause.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+ this.btn_pause.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btn_pause.Name = "btn_pause";
+ this.btn_pause.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
+ this.btn_pause.Size = new System.Drawing.Size(75, 36);
+ this.btn_pause.Text = "Pause";
+ this.btn_pause.Visible = false;
+ this.btn_pause.Click += new System.EventHandler(this.btn_pause_Click);
+ //
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 39);
//
+ // drop_button_queue
+ //
+ this.drop_button_queue.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnu_batch,
+ this.mnu_import,
+ this.mnu_export,
+ this.toolStripSeparator2,
+ this.mnu_readd});
+ this.drop_button_queue.Image = global::Handbrake.Properties.Resources.ActivityWindow;
+ this.drop_button_queue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+ this.drop_button_queue.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.drop_button_queue.Name = "drop_button_queue";
+ this.drop_button_queue.Size = new System.Drawing.Size(89, 36);
+ this.drop_button_queue.Text = "Queue";
+ //
+ // mnu_batch
+ //
+ this.mnu_batch.Image = global::Handbrake.Properties.Resources.Output_Small;
+ this.mnu_batch.Name = "mnu_batch";
+ this.mnu_batch.Size = new System.Drawing.Size(207, 22);
+ this.mnu_batch.Text = "Generate Batch Script";
+ this.mnu_batch.Click += new System.EventHandler(this.mnu_batch_Click);
+ //
+ // mnu_import
+ //
+ this.mnu_import.Image = global::Handbrake.Properties.Resources.folder;
+ this.mnu_import.Name = "mnu_import";
+ this.mnu_import.Size = new System.Drawing.Size(207, 22);
+ this.mnu_import.Text = "Import Queue";
+ this.mnu_import.Click += new System.EventHandler(this.mnu_import_Click);
+ //
+ // mnu_export
+ //
+ this.mnu_export.Image = global::Handbrake.Properties.Resources.save;
+ this.mnu_export.Name = "mnu_export";
+ this.mnu_export.Size = new System.Drawing.Size(207, 22);
+ this.mnu_export.Text = "Export Queue";
+ this.mnu_export.Click += new System.EventHandler(this.mnu_export_Click);
+ //
+ // toolStripSeparator2
+ //
+ this.toolStripSeparator2.Name = "toolStripSeparator2";
+ this.toolStripSeparator2.Size = new System.Drawing.Size(204, 6);
+ //
+ // mnu_readd
+ //
+ this.mnu_readd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
+ this.mnu_readd.Image = global::Handbrake.Properties.Resources.AddToQueue_small;
+ this.mnu_readd.Name = "mnu_readd";
+ this.mnu_readd.Size = new System.Drawing.Size(207, 22);
+ this.mnu_readd.Text = "Re-Add Current Job";
+ this.mnu_readd.Click += new System.EventHandler(this.mnu_readd_Click);
+ //
// SaveFile
//
this.SaveFile.Filter = "Batch|.bat";
@@ -248,6 +329,7 @@ namespace Handbrake this.Destination,
this.EncoderVideo,
this.Audio});
+ this.list_queue.ContextMenuStrip = this.mnu_queue;
this.list_queue.Dock = System.Windows.Forms.DockStyle.Fill;
this.list_queue.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.list_queue.FullRowSelect = true;
@@ -372,80 +454,41 @@ namespace Handbrake this.panel1.Size = new System.Drawing.Size(15, 234);
this.panel1.TabIndex = 75;
//
- // btn_encode
- //
- this.btn_encode.Image = global::Handbrake.Properties.Resources.Play;
- this.btn_encode.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
- this.btn_encode.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.btn_encode.Name = "btn_encode";
- this.btn_encode.Size = new System.Drawing.Size(84, 36);
- this.btn_encode.Text = "Encode";
- this.btn_encode.Click += new System.EventHandler(this.btn_encode_Click);
- //
- // btn_pause
- //
- this.btn_pause.Image = global::Handbrake.Properties.Resources.Pause;
- this.btn_pause.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
- this.btn_pause.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.btn_pause.Name = "btn_pause";
- this.btn_pause.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
- this.btn_pause.Size = new System.Drawing.Size(75, 36);
- this.btn_pause.Text = "Pause";
- this.btn_pause.Visible = false;
- this.btn_pause.Click += new System.EventHandler(this.btn_pause_Click);
- //
- // drop_button_queue
- //
- this.drop_button_queue.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.mnu_batch,
- this.mnu_import,
- this.mnu_export,
- this.toolStripSeparator2,
- this.mnu_readd});
- this.drop_button_queue.Image = global::Handbrake.Properties.Resources.ActivityWindow;
- this.drop_button_queue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
- this.drop_button_queue.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.drop_button_queue.Name = "drop_button_queue";
- this.drop_button_queue.Size = new System.Drawing.Size(89, 36);
- this.drop_button_queue.Text = "Queue";
- //
- // mnu_batch
+ // mnu_queue
//
- this.mnu_batch.Image = global::Handbrake.Properties.Resources.Output_Small;
- this.mnu_batch.Name = "mnu_batch";
- this.mnu_batch.Size = new System.Drawing.Size(207, 22);
- this.mnu_batch.Text = "Generate Batch Script";
- this.mnu_batch.Click += new System.EventHandler(this.mnu_batch_Click);
+ this.mnu_queue.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnu_up,
+ this.mnu_Down,
+ this.toolStripSeparator3,
+ this.mnu_delete});
+ this.mnu_queue.Name = "mnu_queue";
+ this.mnu_queue.Size = new System.Drawing.Size(153, 98);
//
- // mnu_import
+ // mnu_up
//
- this.mnu_import.Image = global::Handbrake.Properties.Resources.folder;
- this.mnu_import.Name = "mnu_import";
- this.mnu_import.Size = new System.Drawing.Size(207, 22);
- this.mnu_import.Text = "Import Queue";
- this.mnu_import.Click += new System.EventHandler(this.mnu_import_Click);
+ this.mnu_up.Name = "mnu_up";
+ this.mnu_up.Size = new System.Drawing.Size(152, 22);
+ this.mnu_up.Text = "Move Up";
+ this.mnu_up.Click += new System.EventHandler(this.mnu_up_Click);
//
- // mnu_export
+ // mnu_Down
//
- this.mnu_export.Image = global::Handbrake.Properties.Resources.save;
- this.mnu_export.Name = "mnu_export";
- this.mnu_export.Size = new System.Drawing.Size(207, 22);
- this.mnu_export.Text = "Export Queue";
- this.mnu_export.Click += new System.EventHandler(this.mnu_export_Click);
+ this.mnu_Down.Name = "mnu_Down";
+ this.mnu_Down.Size = new System.Drawing.Size(152, 22);
+ this.mnu_Down.Text = "Move Down";
+ this.mnu_Down.Click += new System.EventHandler(this.mnu_Down_Click);
//
- // toolStripSeparator2
+ // toolStripSeparator3
//
- this.toolStripSeparator2.Name = "toolStripSeparator2";
- this.toolStripSeparator2.Size = new System.Drawing.Size(204, 6);
+ this.toolStripSeparator3.Name = "toolStripSeparator3";
+ this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6);
//
- // mnu_readd
+ // mnu_delete
//
- this.mnu_readd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
- this.mnu_readd.Image = global::Handbrake.Properties.Resources.AddToQueue_small;
- this.mnu_readd.Name = "mnu_readd";
- this.mnu_readd.Size = new System.Drawing.Size(207, 22);
- this.mnu_readd.Text = "Re-Add Current Job";
- this.mnu_readd.Click += new System.EventHandler(this.mnu_readd_Click);
+ this.mnu_delete.Name = "mnu_delete";
+ this.mnu_delete.Size = new System.Drawing.Size(152, 22);
+ this.mnu_delete.Text = "Delete";
+ this.mnu_delete.Click += new System.EventHandler(this.mnu_delete_Click);
//
// frmQueue
//
@@ -469,6 +512,7 @@ namespace Handbrake this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
+ this.mnu_queue.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -514,5 +558,10 @@ namespace Handbrake private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem mnu_readd;
+ private System.Windows.Forms.ContextMenuStrip mnu_queue;
+ private System.Windows.Forms.ToolStripMenuItem mnu_up;
+ private System.Windows.Forms.ToolStripMenuItem mnu_Down;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
+ private System.Windows.Forms.ToolStripMenuItem mnu_delete;
}
}
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 769921691..4f8ac2c36 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -146,7 +146,7 @@ namespace Handbrake Functions.QueryParser parsed = Functions.QueryParser.Parse(q_item);
// Get the DVD Title
- string title = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString();
+ string title = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString();
// Get the DVD Chapters
string chapters;
@@ -210,7 +210,7 @@ namespace Handbrake lbl_title.Text = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString();
if (Equals(parsed.DVDChapterStart, 0))
- lbl_chapt.Text = "Auto";
+ lbl_chapt.Text = "Auto";
else
{
string chapters = parsed.DVDChapterStart.ToString();
@@ -251,7 +251,7 @@ namespace Handbrake // Reverse the list to delete the items from last to first (preserves indices)
selectedIndices.Reverse();
-
+
// Remove each selected item
foreach (int selectedIndex in selectedIndices)
queue.remove(selectedIndex);
@@ -260,7 +260,7 @@ namespace Handbrake updateUIElements();
// Select the item where the first deleted item was previously
- if (firstSelectedIndex < list_queue.Items.Count)
+ if (firstSelectedIndex < list_queue.Items.Count)
list_queue.Items[firstSelectedIndex].Selected = true;
}
@@ -268,10 +268,39 @@ namespace Handbrake }
// Queue Management
+ private void mnu_up_Click(object sender, EventArgs e)
+ {
+ moveUp();
+ }
+ private void mnu_Down_Click(object sender, EventArgs e)
+ {
+ moveDown();
+ }
+ private void mnu_delete_Click(object sender, EventArgs e)
+ {
+ deleteSelectedItems();
+ }
private void btn_up_Click(object sender, EventArgs e)
{
+ moveUp();
+ }
+ private void btn_down_Click(object sender, EventArgs e)
+ {
+ moveDown();
+ }
+ private void btn_delete_Click(object sender, EventArgs e)
+ {
+ deleteSelectedItems();
+ }
+ private void list_queue_deleteKey(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ deleteSelectedItems();
+ }
+ private void moveUp()
+ {
// If there are selected items and the first item is not selected
- if (list_queue.SelectedIndices.Count > 0 && ! list_queue.SelectedIndices.Contains(0))
+ if (list_queue.SelectedIndices.Count > 0 && !list_queue.SelectedIndices.Contains(0))
{
// Copy the selected indices to preserve them during the movement
List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);
@@ -293,11 +322,11 @@ namespace Handbrake list_queue.Select(); // Activate the control to show the selected items
}
- private void btn_down_Click(object sender, EventArgs e)
+ private void moveDown()
{
// If there are selected items and the last item is not selected
- if (list_queue.SelectedIndices.Count > 0 &&
- ! list_queue.SelectedIndices.Contains(list_queue.Items[list_queue.Items.Count-1].Index))
+ if (list_queue.SelectedIndices.Count > 0 &&
+ !list_queue.SelectedIndices.Contains(list_queue.Items[list_queue.Items.Count - 1].Index))
{
// Copy the selected indices to preserve them during the movement
List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);
@@ -310,27 +339,18 @@ namespace Handbrake // Move down each selected item
foreach (int selectedIndex in selectedIndices)
queue.moveDown(selectedIndex);
-
+
queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
updateUIElements();
// Keep the selected item(s) selected, now moved down one index
foreach (int selectedIndex in selectedIndices)
if (selectedIndex + 1 < list_queue.Items.Count) // Defensive programming: ensure index is good
- list_queue.Items[selectedIndex + 1].Selected = true;
+ list_queue.Items[selectedIndex + 1].Selected = true;
}
list_queue.Select(); // Activate the control to show the selected items
}
- private void btn_delete_Click(object sender, EventArgs e)
- {
- deleteSelectedItems();
- }
- private void list_queue_deleteKey(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Delete)
- deleteSelectedItems();
- }
// Queue Import/Export Features
private void mnu_batch_Click(object sender, EventArgs e)
@@ -375,7 +395,5 @@ namespace Handbrake base.OnClosing(e);
}
-
-
}
}
diff --git a/win/C#/frmQueue.resx b/win/C#/frmQueue.resx index 2575392e8..1e1e1ec08 100644 --- a/win/C#/frmQueue.resx +++ b/win/C#/frmQueue.resx @@ -126,6 +126,9 @@ <metadata name="SaveFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>176, 17</value>
</metadata>
+ <metadata name="mnu_queue.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>424, 17</value>
+ </metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>324, 17</value>
</metadata>
|