OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Controls / PictureSettings.cs
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