OSDN Git Service

remove crf flag and all uses of it
[handbrake-jp/handbrake-jp-git.git] / win / C# / Controls / PictureSettings.cs
index f9d322b..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
@@ -102,6 +107,9 @@ namespace Handbrake.Controls
         // Picture Controls\r
         private void text_width_ValueChanged(object sender, EventArgs e)\r
         {\r
+            if (Properties.Settings.Default.disableResCalc)\r
+                return;\r
+\r
             if (_preventChangingWidth)\r
                 return;\r
 \r
@@ -160,6 +168,9 @@ namespace Handbrake.Controls
         }\r
         private void text_height_ValueChanged(object sender, EventArgs e)\r
         {\r
+            if (Properties.Settings.Default.disableResCalc)\r
+                return;\r
+\r
             if (_preventChangingHeight)\r
                 return;\r
 \r
@@ -218,6 +229,9 @@ namespace Handbrake.Controls
         }\r
         private void check_KeepAR_CheckedChanged(object sender, EventArgs e)\r
         {\r
+            if (Properties.Settings.Default.disableResCalc)\r
+                return;\r
+\r
             //Force TextWidth to recalc height\r
             if (check_KeepAR.Checked)\r
                 text_width_ValueChanged(this, new EventArgs());\r
@@ -235,6 +249,9 @@ namespace Handbrake.Controls
         }\r
         private void updownDisplayWidth_ValueChanged(object sender, EventArgs e)\r
         {\r
+            if (Properties.Settings.Default.disableResCalc)\r
+                return;\r
+\r
             if (_preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Unchecked)\r
             {\r
                 _preventChangingCustom = true;\r
@@ -251,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
@@ -322,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
@@ -435,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
@@ -471,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