]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Sun, 26 Oct 2008 21:57:22 +0000 (21:57 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 26 Oct 2008 21:57:22 +0000 (21:57 +0000)
- Nested presets right click delete now works correctly if a preset wasn't selected before clicking delete.

buggy but "probably" good enough for some user feedback

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1870 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Presets/preset.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs

index 9f7eed8bdfb2d171636d86c6ba6e885d43d405c5..58d3be96611fa79d8df3ccf37c682d9743a2f28e 100644 (file)
@@ -16,10 +16,6 @@ namespace Handbrake.Presets
         private string name;\r
         private string query;\r
 \r
-        public Preset()\r
-        {\r
-        }\r
-\r
         /// <summary>\r
         /// Get or Set the preset's level. This indicated if it is a root or child node\r
         /// </summary>\r
index 32fa4ab6d86256f46d798afdcaadeca9eb36fa57..c2b660d2c3626efa863ef59e86fcad33c9176eb7 100644 (file)
@@ -237,6 +237,11 @@ namespace Handbrake
             this.btn_destBrowse = new System.Windows.Forms.Button();\r
             this.groupBox2 = new System.Windows.Forms.GroupBox();\r
             this.treeView_presets = new System.Windows.Forms.TreeView();\r
+            this.presets_menu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
+            this.pmnu_expandAll = new System.Windows.Forms.ToolStripMenuItem();\r
+            this.pmnu_collapse = new System.Windows.Forms.ToolStripMenuItem();\r
+            this.sep1 = new System.Windows.Forms.ToolStripSeparator();\r
+            this.pmnu_delete = new System.Windows.Forms.ToolStripMenuItem();\r
             this.toolStrip1 = new System.Windows.Forms.ToolStrip();\r
             this.btn_source = new System.Windows.Forms.ToolStripDropDownButton();\r
             this.btn_file_source = new System.Windows.Forms.ToolStripMenuItem();\r
@@ -254,11 +259,7 @@ namespace Handbrake
             this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);\r
             this.StatusStrip = new System.Windows.Forms.StatusStrip();\r
             this.lbl_encode = new System.Windows.Forms.ToolStripStatusLabel();\r
-            this.presets_menu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
-            this.pmnu_delete = new System.Windows.Forms.ToolStripMenuItem();\r
-            this.pmnu_expandAll = new System.Windows.Forms.ToolStripMenuItem();\r
-            this.sep1 = new System.Windows.Forms.ToolStripSeparator();\r
-            this.pmnu_collapse = new System.Windows.Forms.ToolStripMenuItem();\r
+            this.splitContainer1 = new System.Windows.Forms.SplitContainer();\r
             Label38 = new System.Windows.Forms.Label();\r
             notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
             notifyIconMenu.SuspendLayout();\r
@@ -285,9 +286,12 @@ namespace Handbrake
             this.tabPage4.SuspendLayout();\r
             this.groupBox_dest.SuspendLayout();\r
             this.groupBox2.SuspendLayout();\r
+            this.presets_menu.SuspendLayout();\r
             this.toolStrip1.SuspendLayout();\r
             this.StatusStrip.SuspendLayout();\r
-            this.presets_menu.SuspendLayout();\r
+            this.splitContainer1.Panel1.SuspendLayout();\r
+            this.splitContainer1.Panel2.SuspendLayout();\r
+            this.splitContainer1.SuspendLayout();\r
             this.SuspendLayout();\r
             // \r
             // Label38\r
@@ -307,12 +311,12 @@ namespace Handbrake
             this.btn_restore});\r
             notifyIconMenu.Name = "notifyIconMenu";\r
             notifyIconMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;\r
-            notifyIconMenu.Size = new System.Drawing.Size(153, 48);\r
+            notifyIconMenu.Size = new System.Drawing.Size(129, 26);\r
             // \r
             // btn_restore\r
             // \r
             this.btn_restore.Name = "btn_restore";\r
-            this.btn_restore.Size = new System.Drawing.Size(152, 22);\r
+            this.btn_restore.Size = new System.Drawing.Size(128, 22);\r
             this.btn_restore.Text = "Restore";\r
             this.btn_restore.Click += new System.EventHandler(this.btn_restore_Click);\r
             // \r
@@ -549,7 +553,7 @@ namespace Handbrake
             this.btn_setDefault.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
             this.btn_setDefault.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_setDefault.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.btn_setDefault.Location = new System.Drawing.Point(873, 584);\r
+            this.btn_setDefault.Location = new System.Drawing.Point(108, 8);\r
             this.btn_setDefault.Name = "btn_setDefault";\r
             this.btn_setDefault.Size = new System.Drawing.Size(72, 22);\r
             this.btn_setDefault.TabIndex = 1;\r
@@ -666,7 +670,7 @@ namespace Handbrake
             this.btn_addPreset.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
             this.btn_addPreset.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_addPreset.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.btn_addPreset.Location = new System.Drawing.Point(768, 584);\r
+            this.btn_addPreset.Location = new System.Drawing.Point(3, 8);\r
             this.btn_addPreset.Name = "btn_addPreset";\r
             this.btn_addPreset.Size = new System.Drawing.Size(35, 22);\r
             this.btn_addPreset.TabIndex = 3;\r
@@ -681,7 +685,7 @@ namespace Handbrake
             this.btn_removePreset.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
             this.btn_removePreset.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_removePreset.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.btn_removePreset.Location = new System.Drawing.Point(809, 584);\r
+            this.btn_removePreset.Location = new System.Drawing.Point(44, 8);\r
             this.btn_removePreset.Name = "btn_removePreset";\r
             this.btn_removePreset.Size = new System.Drawing.Size(58, 22);\r
             this.btn_removePreset.TabIndex = 4;\r
@@ -2939,12 +2943,12 @@ namespace Handbrake
             // \r
             // groupBox2\r
             // \r
-            this.groupBox2.Controls.Add(this.treeView_presets);\r
+            this.groupBox2.Controls.Add(this.splitContainer1);\r
             this.groupBox2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.groupBox2.ForeColor = System.Drawing.Color.Black;\r
             this.groupBox2.Location = new System.Drawing.Point(728, 70);\r
             this.groupBox2.Name = "groupBox2";\r
-            this.groupBox2.Size = new System.Drawing.Size(245, 508);\r
+            this.groupBox2.Size = new System.Drawing.Size(245, 546);\r
             this.groupBox2.TabIndex = 6;\r
             this.groupBox2.TabStop = false;\r
             this.groupBox2.Text = "Presets";\r
@@ -2957,13 +2961,51 @@ namespace Handbrake
             this.treeView_presets.FullRowSelect = true;\r
             this.treeView_presets.HideSelection = false;\r
             this.treeView_presets.ItemHeight = 21;\r
-            this.treeView_presets.Location = new System.Drawing.Point(3, 17);\r
+            this.treeView_presets.Location = new System.Drawing.Point(0, 0);\r
             this.treeView_presets.Name = "treeView_presets";\r
             this.treeView_presets.ShowLines = false;\r
-            this.treeView_presets.Size = new System.Drawing.Size(239, 488);\r
+            this.treeView_presets.Size = new System.Drawing.Size(239, 485);\r
             this.treeView_presets.TabIndex = 0;\r
             this.treeView_presets.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_presets_AfterSelect);\r
             this.treeView_presets.KeyUp += new System.Windows.Forms.KeyEventHandler(this.treeView_presets_deleteKey);\r
+            this.treeView_presets.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeview_presets_mouseUp);\r
+\r
+            // \r
+            // presets_menu\r
+            // \r
+            this.presets_menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+            this.pmnu_expandAll,\r
+            this.pmnu_collapse,\r
+            this.sep1,\r
+            this.pmnu_delete});\r
+            this.presets_menu.Name = "presets_menu";\r
+            this.presets_menu.Size = new System.Drawing.Size(146, 76);\r
+            // \r
+            // pmnu_expandAll\r
+            // \r
+            this.pmnu_expandAll.Name = "pmnu_expandAll";\r
+            this.pmnu_expandAll.Size = new System.Drawing.Size(145, 22);\r
+            this.pmnu_expandAll.Text = "Expand All";\r
+            this.pmnu_expandAll.Click += new System.EventHandler(this.pmnu_expandAll_Click);\r
+            // \r
+            // pmnu_collapse\r
+            // \r
+            this.pmnu_collapse.Name = "pmnu_collapse";\r
+            this.pmnu_collapse.Size = new System.Drawing.Size(145, 22);\r
+            this.pmnu_collapse.Text = "Collapse All";\r
+            this.pmnu_collapse.Click += new System.EventHandler(this.pmnu_collapse_Click);\r
+            // \r
+            // sep1\r
+            // \r
+            this.sep1.Name = "sep1";\r
+            this.sep1.Size = new System.Drawing.Size(142, 6);\r
+            // \r
+            // pmnu_delete\r
+            // \r
+            this.pmnu_delete.Name = "pmnu_delete";\r
+            this.pmnu_delete.Size = new System.Drawing.Size(145, 22);\r
+            this.pmnu_delete.Text = "Delete";\r
+            this.pmnu_delete.Click += new System.EventHandler(this.pmnu_delete_click);\r
             // \r
             // toolStrip1\r
             // \r
@@ -3128,52 +3170,33 @@ namespace Handbrake
             this.lbl_encode.Size = new System.Drawing.Size(31, 17);\r
             this.lbl_encode.Text = "{0}";\r
             // \r
-            // presets_menu\r
+            // splitContainer1\r
             // \r
-            this.presets_menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
-            this.pmnu_expandAll,\r
-            this.pmnu_collapse,\r
-            this.sep1,\r
-            this.pmnu_delete});\r
-            this.presets_menu.Name = "presets_menu";\r
-            this.presets_menu.Size = new System.Drawing.Size(146, 76);\r
+            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;\r
+            this.splitContainer1.Location = new System.Drawing.Point(3, 17);\r
+            this.splitContainer1.Name = "splitContainer1";\r
+            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;\r
             // \r
-            // pmnu_delete\r
+            // splitContainer1.Panel1\r
             // \r
-            this.pmnu_delete.Name = "pmnu_delete";\r
-            this.pmnu_delete.Size = new System.Drawing.Size(145, 22);\r
-            this.pmnu_delete.Text = "Delete";\r
-            this.pmnu_delete.Click += new System.EventHandler(this.pmnu_delete_Click);\r
+            this.splitContainer1.Panel1.Controls.Add(this.treeView_presets);\r
             // \r
-            // pmnu_expandAll\r
-            // \r
-            this.pmnu_expandAll.Name = "pmnu_expandAll";\r
-            this.pmnu_expandAll.Size = new System.Drawing.Size(145, 22);\r
-            this.pmnu_expandAll.Text = "Expand All";\r
-            this.pmnu_expandAll.Click += new System.EventHandler(this.pmnu_expandAll_Click);\r
-            // \r
-            // sep1\r
+            // splitContainer1.Panel2\r
             // \r
-            this.sep1.Name = "sep1";\r
-            this.sep1.Size = new System.Drawing.Size(142, 6);\r
-            // \r
-            // pmnu_collapse\r
-            // \r
-            this.pmnu_collapse.Name = "pmnu_collapse";\r
-            this.pmnu_collapse.Size = new System.Drawing.Size(145, 22);\r
-            this.pmnu_collapse.Text = "Collapse All";\r
-            this.pmnu_collapse.Click += new System.EventHandler(this.pmnu_collapse_Click);\r
+            this.splitContainer1.Panel2.Controls.Add(this.btn_addPreset);\r
+            this.splitContainer1.Panel2.Controls.Add(this.btn_removePreset);\r
+            this.splitContainer1.Panel2.Controls.Add(this.btn_setDefault);\r
+            this.splitContainer1.Size = new System.Drawing.Size(239, 526);\r
+            this.splitContainer1.SplitterDistance = 485;\r
+            this.splitContainer1.TabIndex = 1;\r
             // \r
             // frmMain\r
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
             this.ClientSize = new System.Drawing.Size(985, 651);\r
-            this.Controls.Add(this.btn_setDefault);\r
             this.Controls.Add(this.GroupBox1);\r
-            this.Controls.Add(this.btn_removePreset);\r
             this.Controls.Add(this.groupBox_dest);\r
-            this.Controls.Add(this.btn_addPreset);\r
             this.Controls.Add(this.groupBox_output);\r
             this.Controls.Add(this.groupBox2);\r
             this.Controls.Add(this.toolStrip1);\r
@@ -3220,11 +3243,14 @@ namespace Handbrake
             this.groupBox_dest.ResumeLayout(false);\r
             this.groupBox_dest.PerformLayout();\r
             this.groupBox2.ResumeLayout(false);\r
+            this.presets_menu.ResumeLayout(false);\r
             this.toolStrip1.ResumeLayout(false);\r
             this.toolStrip1.PerformLayout();\r
             this.StatusStrip.ResumeLayout(false);\r
             this.StatusStrip.PerformLayout();\r
-            this.presets_menu.ResumeLayout(false);\r
+            this.splitContainer1.Panel1.ResumeLayout(false);\r
+            this.splitContainer1.Panel2.ResumeLayout(false);\r
+            this.splitContainer1.ResumeLayout(false);\r
             this.ResumeLayout(false);\r
             this.PerformLayout();\r
 \r
@@ -3452,6 +3478,7 @@ namespace Handbrake
         private System.Windows.Forms.ToolStripMenuItem pmnu_collapse;\r
         private System.Windows.Forms.ToolStripSeparator sep1;\r
         private System.Windows.Forms.ToolStripMenuItem pmnu_delete;\r
+        private System.Windows.Forms.SplitContainer splitContainer1;\r
 \r
     }\r
 }
\ No newline at end of file
index d07120af44631c4514bf9b92eeeb1fafa9f337f8..957fa217d9aab12f84ec5c387cf10f4ed6d77b22 100644 (file)
@@ -308,14 +308,17 @@ namespace Handbrake
         {\r
             treeView_presets.CollapseAll();\r
         }\r
-        private void pmnu_delete_Click(object sender, EventArgs e)\r
+        private void treeview_presets_mouseUp(object sender, MouseEventArgs e)\r
         {\r
-            DialogResult result = MessageBox.Show("Are you sure you wish to delete the selected preset?", "Preset", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
-            if (result == DialogResult.Yes)\r
+            if (e.Button == MouseButtons.Right)\r
+                treeView_presets.SelectedNode = treeView_presets.GetNodeAt(e.Location);\r
+            treeView_presets.Select();\r
+        }\r
+        private void pmnu_delete_click(object sender, EventArgs e)\r
+        {\r
+            if (treeView_presets.SelectedNode != null)\r
             {\r
-                if (treeView_presets.SelectedNode != null)\r
-                    presetHandler.remove(treeView_presets.SelectedNode.Text);\r
-                // Now reload the preset panel\r
+                presetHandler.remove(treeView_presets.SelectedNode.Text);\r
                 loadPresetPanel();\r
             }\r
             treeView_presets.Select();\r