OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 16 Mar 2009 18:15:29 +0000 (18:15 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 16 Mar 2009 18:15:29 +0000 (18:15 +0000)
- Added right click menu to the queue with Move Up/Down and Delete options.

git-svn-id: svn://localhost/HandBrake/trunk@2262 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/frmQueue.Designer.cs
win/C#/frmQueue.cs
win/C#/frmQueue.resx

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