OSDN Git Service

LinGui: enable libdvdnav by default
[handbrake-jp/handbrake-jp-git.git] / win / C# / Controls / PictureSettings.cs
index 1d54c98..4f87c33 100644 (file)
@@ -67,10 +67,15 @@ namespace Handbrake.Controls
                     labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height;\r
                 }\r
 \r
-                updownDisplayWidth.Value = CalculateAnamorphicSizes().Width;\r
+                //updownDisplayWidth.Value = CalculateAnamorphicSizes().Width;\r
                 updownParWidth.Value = _sourceTitle.ParVal.Width;\r
                 updownParHeight.Value = _sourceTitle.ParVal.Height;\r
-                _cachedDar = (double)updownDisplayWidth.Value / (double)text_height.Value;\r
+                //_cachedDar = (double)updownDisplayWidth.Value / (double)text_height.Value;\r
+\r
+\r
+                Size croppedDar = CalculateAnamorphicSizes();\r
+                _cachedDar = (double) croppedDar.Width/croppedDar.Height;\r
+                updownDisplayWidth.Value = croppedDar.Width;\r
             }\r
         }\r
 \r
@@ -263,8 +268,9 @@ namespace Handbrake.Controls
                 // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)\r
 \r
                 // Calculate new Height Value\r
-                int modulus = 16;\r
-                int.TryParse(drp_modulus.SelectedItem.ToString(), out modulus);\r
+                int modulus;\r
+                if(!int.TryParse(drp_modulus.SelectedItem.ToString(), out modulus))\r
+                    modulus = 16;\r
 \r
                 int rawCalculatedHeight = (int)((int)updownDisplayWidth.Value / _cachedDar);\r
                 int modulusHeight = rawCalculatedHeight - (rawCalculatedHeight % modulus);\r
@@ -334,7 +340,10 @@ namespace Handbrake.Controls
                     labelDisplaySize.Visible = true;\r
 \r
                     check_KeepAR.Checked = true;\r
+                    updownParWidth.Enabled = !check_KeepAR.Checked;\r
+                    updownParHeight.Enabled = !check_KeepAR.Checked;\r
                     break;\r
+\r
             }\r
 \r
             labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height;\r
@@ -447,6 +456,8 @@ namespace Handbrake.Controls
                         double pixel_aspect_height = width;\r
 \r
                         double disWidthLoose = (width * pixel_aspect_width / pixel_aspect_height);\r
+                        if (double.IsNaN(disWidthLoose))\r
+                            disWidthLoose = 0;\r
                         return new Size((int)disWidthLoose, (int)height);\r
                     case 3:\r
 \r
@@ -483,5 +494,13 @@ namespace Handbrake.Controls
             if (remainder == 0) return value;\r
             return (value + remainder);\r
         }\r
+\r
+        // Hidden UI feature to drop the MaxWidth / Height with the MaxWidth/Height label is double clicked\r
+        private void lbl_max_DoubleClick(object sender, EventArgs e)\r
+        {\r
+            PresetMaximumResolution = new Size(0,0);\r
+            if (PictureSettingsChanged != null)\r
+                PictureSettingsChanged(this, new EventArgs());\r
+        }\r
     }\r
 }
\ No newline at end of file