OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 11 Jun 2009 16:55:17 +0000 (16:55 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 11 Jun 2009 16:55:17 +0000 (16:55 +0000)
- Fixed Keep AR disabled leaded to Aspect ratio being kept for width.
- Fixed Max Width / Height display and issues in Query Generator.
- Fixed some issues in the Preset Loader.
- Crop values are always mod 2 now.

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

win/C#/Controls/PictureSettings.Designer.cs
win/C#/Controls/PictureSettings.cs
win/C#/Functions/PresetLoader.cs
win/C#/Functions/QueryGenerator.cs
win/C#/frmMain.cs

index f3250f9..609633a 100644 (file)
@@ -135,7 +135,7 @@ namespace Handbrake.Controls
             // lbl_max\r
             // \r
             this.lbl_max.AutoSize = true;\r
-            this.lbl_max.Location = new System.Drawing.Point(273, 80);\r
+            this.lbl_max.Location = new System.Drawing.Point(279, 61);\r
             this.lbl_max.Name = "lbl_max";\r
             this.lbl_max.Size = new System.Drawing.Size(34, 13);\r
             this.lbl_max.TabIndex = 47;\r
@@ -167,7 +167,7 @@ namespace Handbrake.Controls
             this.label6.AutoSize = true;\r
             this.label6.BackColor = System.Drawing.Color.Transparent;\r
             this.label6.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label6.Location = new System.Drawing.Point(13, 91);\r
+            this.label6.Location = new System.Drawing.Point(14, 120);\r
             this.label6.Name = "label6";\r
             this.label6.Size = new System.Drawing.Size(80, 13);\r
             this.label6.TabIndex = 45;\r
@@ -183,7 +183,7 @@ namespace Handbrake.Controls
             "Strict",\r
             "Loose",\r
             "Custom"});\r
-            this.drp_anamorphic.Location = new System.Drawing.Point(109, 88);\r
+            this.drp_anamorphic.Location = new System.Drawing.Point(110, 117);\r
             this.drp_anamorphic.Name = "drp_anamorphic";\r
             this.drp_anamorphic.Size = new System.Drawing.Size(110, 21);\r
             this.drp_anamorphic.TabIndex = 46;\r
@@ -239,7 +239,7 @@ namespace Handbrake.Controls
             this.lbl_modulus.AutoSize = true;\r
             this.lbl_modulus.BackColor = System.Drawing.Color.Transparent;\r
             this.lbl_modulus.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.lbl_modulus.Location = new System.Drawing.Point(13, 118);\r
+            this.lbl_modulus.Location = new System.Drawing.Point(14, 147);\r
             this.lbl_modulus.Name = "lbl_modulus";\r
             this.lbl_modulus.Size = new System.Drawing.Size(58, 13);\r
             this.lbl_modulus.TabIndex = 51;\r
@@ -255,14 +255,14 @@ namespace Handbrake.Controls
             "8",\r
             "4",\r
             "2"});\r
-            this.drop_modulus.Location = new System.Drawing.Point(109, 115);\r
+            this.drop_modulus.Location = new System.Drawing.Point(110, 144);\r
             this.drop_modulus.Name = "drop_modulus";\r
             this.drop_modulus.Size = new System.Drawing.Size(110, 21);\r
             this.drop_modulus.TabIndex = 52;\r
             // \r
             // txt_displayWidth\r
             // \r
-            this.txt_displayWidth.Location = new System.Drawing.Point(109, 142);\r
+            this.txt_displayWidth.Location = new System.Drawing.Point(110, 171);\r
             this.txt_displayWidth.Name = "txt_displayWidth";\r
             this.txt_displayWidth.Size = new System.Drawing.Size(100, 20);\r
             this.txt_displayWidth.TabIndex = 53;\r
@@ -274,7 +274,7 @@ namespace Handbrake.Controls
             this.lbl_displayWidth.AutoSize = true;\r
             this.lbl_displayWidth.BackColor = System.Drawing.Color.Transparent;\r
             this.lbl_displayWidth.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.lbl_displayWidth.Location = new System.Drawing.Point(13, 145);\r
+            this.lbl_displayWidth.Location = new System.Drawing.Point(14, 174);\r
             this.lbl_displayWidth.Name = "lbl_displayWidth";\r
             this.lbl_displayWidth.Size = new System.Drawing.Size(90, 13);\r
             this.lbl_displayWidth.TabIndex = 54;\r
@@ -285,7 +285,7 @@ namespace Handbrake.Controls
             this.lbl_parWidth.AutoSize = true;\r
             this.lbl_parWidth.BackColor = System.Drawing.Color.Transparent;\r
             this.lbl_parWidth.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.lbl_parWidth.Location = new System.Drawing.Point(13, 171);\r
+            this.lbl_parWidth.Location = new System.Drawing.Point(14, 200);\r
             this.lbl_parWidth.Name = "lbl_parWidth";\r
             this.lbl_parWidth.Size = new System.Drawing.Size(71, 13);\r
             this.lbl_parWidth.TabIndex = 56;\r
@@ -293,7 +293,7 @@ namespace Handbrake.Controls
             // \r
             // txt_parWidth\r
             // \r
-            this.txt_parWidth.Location = new System.Drawing.Point(109, 168);\r
+            this.txt_parWidth.Location = new System.Drawing.Point(110, 197);\r
             this.txt_parWidth.Name = "txt_parWidth";\r
             this.txt_parWidth.Size = new System.Drawing.Size(100, 20);\r
             this.txt_parWidth.TabIndex = 55;\r
@@ -305,7 +305,7 @@ namespace Handbrake.Controls
             this.lbl_parHeight.AutoSize = true;\r
             this.lbl_parHeight.BackColor = System.Drawing.Color.Transparent;\r
             this.lbl_parHeight.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.lbl_parHeight.Location = new System.Drawing.Point(13, 197);\r
+            this.lbl_parHeight.Location = new System.Drawing.Point(14, 226);\r
             this.lbl_parHeight.Name = "lbl_parHeight";\r
             this.lbl_parHeight.Size = new System.Drawing.Size(75, 13);\r
             this.lbl_parHeight.TabIndex = 58;\r
@@ -313,7 +313,7 @@ namespace Handbrake.Controls
             // \r
             // txt_parHeight\r
             // \r
-            this.txt_parHeight.Location = new System.Drawing.Point(109, 194);\r
+            this.txt_parHeight.Location = new System.Drawing.Point(110, 223);\r
             this.txt_parHeight.Name = "txt_parHeight";\r
             this.txt_parHeight.Size = new System.Drawing.Size(100, 20);\r
             this.txt_parHeight.TabIndex = 57;\r
@@ -323,11 +323,11 @@ namespace Handbrake.Controls
             // check_KeepAR\r
             // \r
             this.check_KeepAR.AutoSize = true;\r
-            this.check_KeepAR.Location = new System.Drawing.Point(276, 60);\r
+            this.check_KeepAR.Location = new System.Drawing.Point(68, 85);\r
             this.check_KeepAR.Name = "check_KeepAR";\r
-            this.check_KeepAR.Size = new System.Drawing.Size(69, 17);\r
+            this.check_KeepAR.Size = new System.Drawing.Size(115, 17);\r
             this.check_KeepAR.TabIndex = 59;\r
-            this.check_KeepAR.Text = "Keep AR";\r
+            this.check_KeepAR.Text = "Keep Aspect Ratio";\r
             this.check_KeepAR.UseVisualStyleBackColor = true;\r
             this.check_KeepAR.CheckedChanged += new System.EventHandler(this.check_KeepAR_CheckedChanged);\r
             // \r
@@ -358,6 +358,11 @@ namespace Handbrake.Controls
             // crop_bottom\r
             // \r
             this.crop_bottom.Enabled = false;\r
+            this.crop_bottom.Increment = new decimal(new int[] {\r
+            2,\r
+            0,\r
+            0,\r
+            0});\r
             this.crop_bottom.Location = new System.Drawing.Point(467, 146);\r
             this.crop_bottom.Maximum = new decimal(new int[] {\r
             1080,\r
@@ -367,10 +372,16 @@ namespace Handbrake.Controls
             this.crop_bottom.Name = "crop_bottom";\r
             this.crop_bottom.Size = new System.Drawing.Size(44, 20);\r
             this.crop_bottom.TabIndex = 67;\r
+            this.crop_bottom.ValueChanged += new System.EventHandler(this.crop_bottom_ValueChanged);\r
             // \r
             // crop_top\r
             // \r
             this.crop_top.Enabled = false;\r
+            this.crop_top.Increment = new decimal(new int[] {\r
+            2,\r
+            0,\r
+            0,\r
+            0});\r
             this.crop_top.Location = new System.Drawing.Point(467, 100);\r
             this.crop_top.Maximum = new decimal(new int[] {\r
             1080,\r
@@ -380,10 +391,16 @@ namespace Handbrake.Controls
             this.crop_top.Name = "crop_top";\r
             this.crop_top.Size = new System.Drawing.Size(44, 20);\r
             this.crop_top.TabIndex = 64;\r
+            this.crop_top.ValueChanged += new System.EventHandler(this.crop_top_ValueChanged);\r
             // \r
             // crop_left\r
             // \r
             this.crop_left.Enabled = false;\r
+            this.crop_left.Increment = new decimal(new int[] {\r
+            2,\r
+            0,\r
+            0,\r
+            0});\r
             this.crop_left.Location = new System.Drawing.Point(416, 122);\r
             this.crop_left.Maximum = new decimal(new int[] {\r
             1920,\r
@@ -393,10 +410,16 @@ namespace Handbrake.Controls
             this.crop_left.Name = "crop_left";\r
             this.crop_left.Size = new System.Drawing.Size(44, 20);\r
             this.crop_left.TabIndex = 62;\r
+            this.crop_left.ValueChanged += new System.EventHandler(this.crop_left_ValueChanged);\r
             // \r
             // crop_right\r
             // \r
             this.crop_right.Enabled = false;\r
+            this.crop_right.Increment = new decimal(new int[] {\r
+            2,\r
+            0,\r
+            0,\r
+            0});\r
             this.crop_right.Location = new System.Drawing.Point(518, 122);\r
             this.crop_right.Maximum = new decimal(new int[] {\r
             1920,\r
@@ -406,6 +429,7 @@ namespace Handbrake.Controls
             this.crop_right.Name = "crop_right";\r
             this.crop_right.Size = new System.Drawing.Size(44, 20);\r
             this.crop_right.TabIndex = 65;\r
+            this.crop_right.ValueChanged += new System.EventHandler(this.crop_right_ValueChanged);\r
             // \r
             // label8\r
             // \r
@@ -467,7 +491,7 @@ namespace Handbrake.Controls
             this.lbl_anamorphic.AutoSize = true;\r
             this.lbl_anamorphic.BackColor = System.Drawing.Color.Transparent;\r
             this.lbl_anamorphic.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.lbl_anamorphic.Location = new System.Drawing.Point(107, 222);\r
+            this.lbl_anamorphic.Location = new System.Drawing.Point(108, 251);\r
             this.lbl_anamorphic.Name = "lbl_anamorphic";\r
             this.lbl_anamorphic.Size = new System.Drawing.Size(72, 12);\r
             this.lbl_anamorphic.TabIndex = 74;\r
@@ -477,7 +501,7 @@ namespace Handbrake.Controls
             // \r
             this.lbl_anamprohicLbl.AutoSize = true;\r
             this.lbl_anamprohicLbl.BackColor = System.Drawing.Color.Transparent;\r
-            this.lbl_anamprohicLbl.Location = new System.Drawing.Point(13, 221);\r
+            this.lbl_anamprohicLbl.Location = new System.Drawing.Point(14, 250);\r
             this.lbl_anamprohicLbl.Name = "lbl_anamprohicLbl";\r
             this.lbl_anamprohicLbl.Size = new System.Drawing.Size(66, 13);\r
             this.lbl_anamprohicLbl.TabIndex = 73;\r
index 7704a36..88f0e8f 100644 (file)
@@ -6,18 +6,16 @@ using Handbrake.Parsing;
 namespace Handbrake.Controls\r
 {\r
     // TODO\r
-\r
-    // - Fix MAX Width / Height Code.\r
     // - Tie in the cropping controls.\r
     \r
     public partial class PictureSettings : UserControl\r
     {\r
         // Globals\r
-        int maxWidth, maxHeight;\r
+        public int maxWidth, maxHeight;\r
         int widthVal, heightVal;\r
         private double darValue;\r
-        private double storageAspect = 0; // Storage Aspect Cache for current source and title\r
-        public Title selectedTitle { get; set; }\r
+        private double storageAspect; // Storage Aspect Cache for current source and title\r
+        public Title selectedTitle { private get; set; }\r
         private Boolean heightChangeGuard;\r
         private Boolean looseAnamorphicHeightGuard;\r
         private Boolean heightModJumpGaurd;\r
@@ -61,14 +59,14 @@ namespace Handbrake.Controls
                 text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
             }\r
 \r
-\r
-\r
             if (drp_anamorphic.SelectedIndex == 3)\r
             {\r
                 txt_parWidth.Text = selectedTitle.ParVal.Width.ToString();\r
                 txt_parHeight.Text = selectedTitle.ParVal.Height.ToString();\r
                 txt_displayWidth.Text = displayWidth().ToString();\r
             }\r
+\r
+            setMax();\r
         }\r
         public void setMax()\r
         {\r
@@ -83,6 +81,9 @@ namespace Handbrake.Controls
         // Basic Picture Setting Controls\r
         private void text_width_ValueChanged(object sender, EventArgs e)\r
         {\r
+            maxWidth = 0;\r
+            setMax();\r
+            \r
             // Get the Modulus\r
             int mod;\r
             int.TryParse(drop_modulus.SelectedItem.ToString(), out mod);\r
@@ -94,7 +95,7 @@ namespace Handbrake.Controls
             switch (drp_anamorphic.SelectedIndex)\r
             {\r
                 case 0:\r
-                    if (calculateUnchangeValue(true) != -1)\r
+                    if (calculateUnchangeValue(true) != -1 && check_KeepAR.Checked)\r
                         text_height.Value = calculateUnchangeValue(true);\r
                     break;\r
                 case 1:\r
@@ -111,6 +112,9 @@ namespace Handbrake.Controls
         }\r
         private void text_height_ValueChanged(object sender, EventArgs e)\r
         {\r
+            maxHeight = 0;\r
+            setMax();\r
+\r
             // Get the Modulus\r
             int mod;\r
             int.TryParse(drop_modulus.SelectedItem.ToString(), out mod);\r
@@ -176,22 +180,21 @@ namespace Handbrake.Controls
             switch (drp_anamorphic.SelectedIndex)\r
             {\r
                 case 0: // None\r
-                    text_height.BackColor = Color.White;\r
-                    text_width.BackColor = Color.White;\r
                     text_height.Enabled = true;\r
                     text_width.Enabled = true;\r
                     check_KeepAR.CheckState = CheckState.Checked;\r
                     check_KeepAR.Enabled = true;\r
                     disableCustomAnaControls();\r
-                    text_width.Text = widthVal.ToString();\r
-                    text_height.Text = heightVal.ToString();\r
+                    if (selectedTitle != null)\r
+                    {\r
+                        text_width.Value = selectedTitle.Resolution.Width;\r
+                        text_height.Value = selectedTitle.Resolution.Height;\r
+                    }\r
                     check_KeepAR.Enabled = true;\r
                     lbl_anamorphic.Text = "";\r
                     lbl_anamprohicLbl.Visible = false;\r
                     break;\r
                 case 1: // Strict\r
-                    text_height.BackColor = Color.LightGray;\r
-                    text_width.BackColor = Color.LightGray;\r
                     if (selectedTitle != null)\r
                     {\r
                         heightModJumpGaurd = true;\r
@@ -210,13 +213,11 @@ namespace Handbrake.Controls
                     disableCustomAnaControls();\r
                     storageAspect = 0;\r
                     text_height.Enabled = false;\r
-                    text_height.BackColor = Color.LightGray;\r
                     text_width.Enabled = true;\r
-                    text_width.BackColor = Color.White;\r
                     if (selectedTitle != null)\r
                     {\r
                         heightModJumpGaurd = true;\r
-                        text_width.Value = selectedTitle.Resolution.Width - (int) crop_left.Value - (int) crop_right.Value;\r
+                        text_width.Value = selectedTitle.Resolution.Width;\r
                         text_height.Value = selectedTitle.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;\r
                     }\r
                     lbl_anamorphic.Text = looseAnamorphic();\r
@@ -226,8 +227,6 @@ namespace Handbrake.Controls
 \r
                     // Display Elements\r
                     enableCustomAnaControls();\r
-                    text_height.BackColor = Color.White;\r
-                    text_width.BackColor = Color.White;\r
                     text_height.Enabled = true;\r
                     text_width.Enabled = true;\r
 \r
@@ -270,7 +269,7 @@ namespace Handbrake.Controls
                 customAnamorphic(txt_parWidth);\r
         }\r
         \r
-        // Cropping Control\r
+        // Cropping Controls\r
         private void check_autoCrop_CheckedChanged(object sender, EventArgs e)\r
         {\r
             crop_left.Enabled = false;\r
@@ -299,6 +298,26 @@ namespace Handbrake.Controls
                 crop_bottom.Text = "0";\r
             }\r
         }\r
+        private void crop_left_ValueChanged(object sender, EventArgs e)\r
+        {\r
+            if (crop_left.Value % 2 != 0)\r
+                crop_left.Value++;\r
+        }\r
+        private void crop_right_ValueChanged(object sender, EventArgs e)\r
+        {\r
+            if (crop_right.Value % 2 != 0)\r
+                crop_right.Value++;\r
+        }\r
+        private void crop_top_ValueChanged(object sender, EventArgs e)\r
+        {\r
+            if (crop_top.Value % 2 != 0)\r
+                crop_top.Value++;\r
+        }\r
+        private void crop_bottom_ValueChanged(object sender, EventArgs e)\r
+        {\r
+            if (crop_bottom.Value % 2 != 0)\r
+                crop_bottom.Value++;\r
+        }\r
 \r
         // Custom Anamorphic Code\r
         private void customAnamorphic(Control control)\r
index f0c5223..7d5e479 100644 (file)
@@ -88,41 +88,43 @@ namespace Handbrake.Functions
                     mainWindow.pictureSettings.crop_left.Value = left;\r
                     mainWindow.pictureSettings.crop_right.Value = right;\r
                 }\r
-\r
-                if (presetQuery.Width != 0)\r
-                    mainWindow.pictureSettings.text_width.Text = presetQuery.Width.ToString();\r
-\r
-                if (presetQuery.Height != 0)\r
-                    mainWindow.pictureSettings.text_height.Text = presetQuery.Height.ToString();\r
             }\r
 \r
             // Set the anamorphic mode 0,1,2,3\r
             mainWindow.pictureSettings.drp_anamorphic.SelectedIndex = presetQuery.AnamorphicMode;\r
 \r
-\r
             // Custom Anamorphic Controls\r
             mainWindow.pictureSettings.check_KeepAR.CheckState = presetQuery.keepDisplayAsect ? CheckState.Checked : CheckState.Unchecked;\r
-\r
             mainWindow.pictureSettings.txt_displayWidth.Text = presetQuery.displayWidthValue.ToString();\r
             mainWindow.pictureSettings.txt_parWidth.Text = presetQuery.pixelAspectWidth.ToString();\r
             mainWindow.pictureSettings.txt_parHeight.Text = presetQuery.pixelAspectHeight.ToString();\r
             mainWindow.pictureSettings.drop_modulus.SelectedItem = presetQuery.AnamorphicModulus;\r
 \r
\r
-            // Set the public max width and max height varibles in frmMain\r
-            // These are used by the query generator to determine if it should use -X or -w  / -Y or -h\r
+\r
+            // Reset maxWidth and MaxHeight to 0\r
+            mainWindow.pictureSettings.maxWidth = 0;\r
+            mainWindow.pictureSettings.maxHeight = 0;\r
+\r
+            // Set the width and height\r
+            if (presetQuery.Width != 0)\r
+                mainWindow.pictureSettings.text_width.Value = presetQuery.Width;\r
+\r
+            if (presetQuery.Height != 0)\r
+                mainWindow.pictureSettings.text_height.Value = presetQuery.Height;\r
+\r
+            // Max Width/Height override Width/Height\r
             if (presetQuery.MaxWidth != 0)\r
             {\r
-                mainWindow.pictureSettings.text_width.Text = presetQuery.MaxWidth.ToString();\r
-                mainWindow.maxWidth = presetQuery.MaxWidth;\r
+                mainWindow.pictureSettings.text_width.Value = presetQuery.MaxWidth;\r
+                mainWindow.pictureSettings.maxWidth = presetQuery.MaxWidth;\r
             }\r
 \r
             if (presetQuery.MaxHeight != 0)\r
             {\r
-                mainWindow.pictureSettings.text_height.Text = presetQuery.MaxHeight.ToString();\r
-                mainWindow.maxHeight = presetQuery.MaxHeight;\r
+                mainWindow.pictureSettings.text_height.Value = presetQuery.MaxHeight;\r
+                mainWindow.pictureSettings.maxHeight = presetQuery.MaxHeight;\r
             }\r
-\r
+            mainWindow.pictureSettings.setMax();\r
 \r
             #endregion\r
 \r
index 16b2ace..595c9c1 100644 (file)
@@ -118,7 +118,7 @@ namespace Handbrake.Functions
             #region Picture Settings Tab\r
 \r
             // Use MaxWidth for built-in presets and width for user settings.\r
-            if (mainWindow.maxWidth == 0)\r
+            if (mainWindow.pictureSettings.maxWidth == 0)\r
             {\r
 \r
                 if (mainWindow.pictureSettings.text_width.Text != "")\r
@@ -132,7 +132,7 @@ namespace Handbrake.Functions
             }\r
 \r
             // Use MaxHeight for built-in presets and height for user settings.\r
-            if (mainWindow.maxHeight == 0)\r
+            if (mainWindow.pictureSettings.maxHeight == 0)\r
             {\r
                 if (mainWindow.pictureSettings.text_height.Text != "")\r
                     if (mainWindow.pictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.pictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic\r
index 4a57fe2..f62519d 100644 (file)
@@ -31,8 +31,6 @@ namespace Handbrake
         private frmQueue queueWindow;\r
         private frmPreview qtpreview;\r
         private Form splash;\r
-        public int maxWidth;\r
-        public int maxHeight;\r
 \r
         // Delegates **********************************************************\r
         private delegate void UpdateWindowHandler();\r
@@ -483,8 +481,6 @@ namespace Handbrake
                         // The x264 widgets will need updated, so do this now:\r
                         x264Panel.X264_StandardizeOptString();\r
                         x264Panel.X264_SetCurrentSettingsInPanel();\r
-\r
-                        pictureSettings.setMax();\r
                     }\r
                 }\r
             }\r