OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 9 Jun 2009 15:29:19 +0000 (15:29 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 9 Jun 2009 15:29:19 +0000 (15:29 +0000)
- A number of fixes to the new picture settings panel. Should be mostly working bar an issue with Custom with KeepAR enabled.

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

win/C#/Controls/PictureSettings.Designer.cs
win/C#/Controls/PictureSettings.cs
win/C#/Controls/PictureSettings.resx
win/C#/Functions/PresetLoader.cs

index c033f74..f3250f9 100644 (file)
@@ -30,6 +30,7 @@ namespace Handbrake.Controls
         /// </summary>\r
         private void InitializeComponent()\r
         {\r
+            this.components = new System.ComponentModel.Container();\r
             this.text_height = new System.Windows.Forms.NumericUpDown();\r
             this.text_width = new System.Windows.Forms.NumericUpDown();\r
             this.label4 = new System.Windows.Forms.Label();\r
@@ -64,6 +65,7 @@ namespace Handbrake.Controls
             this.Label15 = new System.Windows.Forms.Label();\r
             this.lbl_anamorphic = new System.Windows.Forms.Label();\r
             this.lbl_anamprohicLbl = new System.Windows.Forms.Label();\r
+            this.toolTip = new System.Windows.Forms.ToolTip(this.components);\r
             ((System.ComponentModel.ISupportInitialize)(this.text_height)).BeginInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_width)).BeginInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).BeginInit();\r
@@ -264,6 +266,7 @@ namespace Handbrake.Controls
             this.txt_displayWidth.Name = "txt_displayWidth";\r
             this.txt_displayWidth.Size = new System.Drawing.Size(100, 20);\r
             this.txt_displayWidth.TabIndex = 53;\r
+            this.toolTip.SetToolTip(this.txt_displayWidth, "Display Width - Press \"Enter\" after entering a new value.");\r
             this.txt_displayWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_displayWidth_Keyup);\r
             // \r
             // lbl_displayWidth\r
@@ -294,6 +297,7 @@ namespace Handbrake.Controls
             this.txt_parWidth.Name = "txt_parWidth";\r
             this.txt_parWidth.Size = new System.Drawing.Size(100, 20);\r
             this.txt_parWidth.TabIndex = 55;\r
+            this.toolTip.SetToolTip(this.txt_parWidth, "PAR Width - Press \"Enter\" after entering a new value.\r\n");\r
             this.txt_parWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_parWidth_Keyup);\r
             // \r
             // lbl_parHeight\r
@@ -313,6 +317,7 @@ namespace Handbrake.Controls
             this.txt_parHeight.Name = "txt_parHeight";\r
             this.txt_parHeight.Size = new System.Drawing.Size(100, 20);\r
             this.txt_parHeight.TabIndex = 57;\r
+            this.toolTip.SetToolTip(this.txt_parHeight, "PAR Height - Press \"Enter\" after entering a new value.\r\n");\r
             this.txt_parHeight.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_parHeight_Keyup);\r
             // \r
             // check_KeepAR\r
@@ -564,6 +569,7 @@ namespace Handbrake.Controls
         internal System.Windows.Forms.CheckBox check_KeepAR;\r
         internal System.Windows.Forms.Label lbl_anamorphic;\r
         internal System.Windows.Forms.Label lbl_anamprohicLbl;\r
+        private ToolTip toolTip;\r
 \r
     }\r
 }\r
index b9626f1..49ab799 100644 (file)
@@ -49,6 +49,7 @@ namespace Handbrake.Controls
         public Title selectedTitle { get; set; }\r
         private Boolean heightChangeGuard;\r
         private Boolean looseAnamorphicHeightGuard;\r
+        private Boolean heightModJumpGaurd = false;\r
 \r
         // Window Setup\r
         public PictureSettings()\r
@@ -130,7 +131,7 @@ namespace Handbrake.Controls
             int.TryParse(drop_modulus.SelectedItem.ToString(), out mod);\r
 \r
             // Increase or decrease value by the correct mod.\r
-            if (drp_anamorphic.SelectedIndex != 2)\r
+            if (drp_anamorphic.SelectedIndex != 2 && !heightModJumpGaurd)\r
             {\r
                 decimal val = heightChangeMod(mod);\r
                 heightChangeGuard = true;\r
@@ -165,6 +166,7 @@ namespace Handbrake.Controls
             }\r
             heightChangeGuard = false;\r
             looseAnamorphicHeightGuard = false;\r
+            heightModJumpGaurd = false;\r
         }\r
         private void check_KeepAR_CheckedChanged(object sender, EventArgs e)\r
         {\r
@@ -205,8 +207,12 @@ namespace Handbrake.Controls
                 case 1: // Strict\r
                     text_height.BackColor = Color.LightGray;\r
                     text_width.BackColor = Color.LightGray;\r
-                    text_height.Text = "";\r
-                    text_width.Text = "";\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_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
+                    }\r
                     text_height.Enabled = false;\r
                     text_width.Enabled = false;\r
                     check_KeepAR.CheckState = CheckState.Unchecked;\r
@@ -216,17 +222,18 @@ namespace Handbrake.Controls
                     lbl_anamprohicLbl.Visible = true;\r
                     break;\r
                 case 2: // Loose\r
+                    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_height.Value = selectedTitle.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;\r
                     }\r
-                    text_height.Enabled = false;\r
-                    text_height.BackColor = Color.LightGray;\r
-                    text_width.Enabled = true;\r
-                    text_width.BackColor = Color.White;\r
-                    disableCustomAnaControls();\r
                     lbl_anamorphic.Text = looseAnamorphic();\r
                     lbl_anamprohicLbl.Visible = true;\r
                     break;\r
@@ -242,9 +249,10 @@ namespace Handbrake.Controls
                     // Actual Work  \r
                     if (selectedTitle != null)\r
                     {\r
+                        heightModJumpGaurd = true;\r
                         widthVal = selectedTitle.Resolution.Width;\r
-                        text_width.Text = widthVal.ToString();\r
-                        text_height.Text = cacluateHeight(widthVal).ToString();\r
+                        text_width.Value = selectedTitle.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value;\r
+                        text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
                         txt_parWidth.Text = selectedTitle.ParVal.Width.ToString();\r
                         txt_parHeight.Text = selectedTitle.ParVal.Height.ToString();\r
                         txt_displayWidth.Text = displayWidth().ToString();\r
@@ -334,22 +342,25 @@ namespace Handbrake.Controls
              */\r
             if (!check_KeepAR.Checked)\r
             {\r
-                switch (control.Name) // TODO Check if CroppedWidth or just Width\r
+                switch (control.Name)\r
                 {\r
                     case "text_width":\r
                         double dw = (double)cropped_width * parW / parH;\r
+                        dw = Math.Round(dw, 2);\r
                         txt_displayWidth.Text = dw.ToString();\r
                         break;\r
                     case "txt_parWidth":\r
                         double dwpw = (double)cropped_width * parW / parH;\r
+                        dwpw = Math.Round(dwpw, 2);\r
                         txt_displayWidth.Text = dwpw.ToString();\r
                         break;\r
                     case "txt_parHeight":\r
                         double dwph = (double)cropped_width * parW / parH;\r
+                        dwph = Math.Round(dwph, 2);\r
                         txt_displayWidth.Text = dwph.ToString();\r
                         break;\r
                     case "txt_displayWidth":\r
-                        txt_parWidth.Text = txt_displayWidth.Text;\r
+                        txt_parWidth.Text = Math.Round(displayWidth, 0).ToString();\r
                         txt_parHeight.Text = text_width.Text;\r
                         break;\r
                 }\r
@@ -668,8 +679,6 @@ namespace Handbrake.Controls
                 // Calculate the Actual Height\r
                 int actualWidth = (int)text_width.Value - (int)crop_left.Value - (int)crop_right.Value; ;\r
                 int actualHeight = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
-                if (drp_anamorphic.SelectedIndex == 2)\r
-                    actualHeight = (int)getModulusAuto(16, actualHeight);\r
 \r
                 // Calculate Actual Width\r
                 double displayWidth = ((double)actualWidth * selectedTitle.ParVal.Width / selectedTitle.ParVal.Height);\r
index ff31a6d..a5979aa 100644 (file)
   <resheader name="writer">\r
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
   </resheader>\r
+  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+    <value>17, 17</value>\r
+  </metadata>\r
 </root>
\ No newline at end of file
index dd5fa7c..f0c5223 100644 (file)
@@ -72,9 +72,6 @@ namespace Handbrake.Functions
                 if (presetQuery.CropLeft == "0" && presetQuery.CropRight == "0")\r
                     mainWindow.pictureSettings.check_customCrop.Checked = true;\r
 \r
-            mainWindow.pictureSettings.text_width.Text = "";\r
-            mainWindow.pictureSettings.text_height.Text = "";\r
-\r
             if (pictureSettings)\r
             {\r
                 if (presetQuery.CropTop != null)\r