OSDN Git Service

add win/C# diff files
[handbrake-jp/handbrake-jp.git] / win / C# / Controls / PictureSettings.cs.diff
diff --git a/win/C#/Controls/PictureSettings.cs.diff b/win/C#/Controls/PictureSettings.cs.diff
new file mode 100644 (file)
index 0000000..a7221be
--- /dev/null
@@ -0,0 +1,650 @@
+diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs
+index 11db136..b6f51f5 100644
+--- a/win/C#/Controls/PictureSettings.cs
++++ b/win/C#/Controls/PictureSettings.cs
+@@ -1,30 +1,36 @@
+-\r
+-/*\r
+- * This file come from HandBrake source code by http://handbrake.fr/ , \r
+- * and modified by hylom <hylomm@gmail.com> for HandBrake Japanese version.\r
+- * It may be used under the terms of the GNU General Public License.\r
+- * last modified date: $Format:%cd$\r
+- */\r
+-\r
+-using System;\r
+-using System.ComponentModel;\r
+-using System.Drawing;\r
+-using System.Globalization;\r
+-using System.Windows.Forms;\r
+-using Handbrake.Parsing;\r
++/*  PictureSetting.cs $\r
++    This file is part of the HandBrake source code.\r
++    Homepage: <http://handbrake.fr>.\r
++    It may be used under the terms of the GNU General Public License. */\r
\r
+ namespace Handbrake.Controls\r
+ {\r
++    using System;\r
++    using System.Drawing;\r
++    using System.Globalization;\r
++    using System.Windows.Forms;\r
++\r
++    using HandBrake.ApplicationServices.Parsing;\r
++\r
++    using Presets;\r
++\r
++    /// <summary>\r
++    /// The Picture Settings Panel\r
++    /// </summary>\r
+     public partial class PictureSettings : UserControl\r
+     {\r
+-        private readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
+-        public event EventHandler PictureSettingsChanged;\r
+-\r
+-        private Boolean _preventChangingWidth, _preventChangingHeight, _preventChangingCustom, _preventChangingDisplayWidth;\r
+-        private int _presetMaximumWidth, _presetMaximumHeight;\r
+-        private double _cachedDar = 1.0;\r
+-        private Title _sourceTitle;\r
++        private readonly CultureInfo culture = new CultureInfo("en-US", false);\r
++        private bool preventChangingWidth;\r
++        private bool preventChangingHeight;\r
++        private bool preventChangingCustom;\r
++        private bool preventChangingDisplayWidth;\r
++        private double cachedDar;\r
++        private Title sourceTitle;\r
\r
++        /// <summary>\r
++        /// Initializes a new instance of the <see cref="PictureSettings"/> class. \r
++        /// Creates a new instance of the Picture Settings Class\r
++        /// </summary>\r
+         public PictureSettings()\r
+         {\r
+             InitializeComponent();\r
+@@ -34,91 +40,119 @@ namespace Handbrake.Controls
+         }\r
\r
+         /// <summary>\r
++        /// Picture Settings Changed Event Handler\r
++        /// </summary>\r
++        public event EventHandler PictureSettingsChanged;\r
++\r
++        /// <summary>\r
+         /// Gets or sets the source media used by this control.\r
+         /// </summary>\r
+-        [Browsable(false)]\r
+-        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
+         public Title Source\r
+         {\r
+-            private get { return _sourceTitle; }\r
+-            set\r
++            private get\r
+             {\r
+-                _sourceTitle = value;\r
+-                Enabled = _sourceTitle != null;\r
+-\r
+-                // Set the Aspect Ratio\r
+-                lbl_Aspect.Text = _sourceTitle.AspectRatio.ToString(Culture);\r
+-                lbl_src_res.Text = _sourceTitle.Resolution.Width + " x " + _sourceTitle.Resolution.Height;\r
+-\r
+-                // Set the Recommended Cropping values\r
+-                crop_top.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[0]);\r
+-                crop_bottom.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[1]);\r
+-                crop_left.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[2]);\r
+-                crop_right.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[3]);\r
+-\r
+-                // Set the Resolution Boxes\r
+-                if (drp_anamorphic.SelectedIndex == 0)\r
+-                {\r
+-                    if (text_width.Value == 0) // Only update the values if the fields don't already have values.\r
+-                        text_width.Value = _sourceTitle.Resolution.Width;\r
+-\r
+-                    check_KeepAR.Checked = true; // Forces Resolution to be correct.\r
+-                }\r
+-                else\r
+-                {\r
+-                    if (text_width.Value == 0 && text_height.Value == 0)// Only update the values if the fields don't already have values.\r
+-                    {\r
+-                        text_width.Value = _sourceTitle.Resolution.Width;\r
+-                        text_height.Value = _sourceTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
+-                    }\r
++                return sourceTitle;\r
++            }\r
\r
+-                    labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height;\r
+-                }\r
++            set\r
++            {\r
++                sourceTitle = value;\r
++                Enabled = sourceTitle != null;\r
++                NewSourceSet();\r
++            }\r
++        }\r
\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
++        /// <summary>\r
++        /// Gets or sets the currently selected preset.\r
++        /// </summary>\r
++        public Preset CurrentlySelectedPreset { get; set; }\r
\r
++        /// <summary>\r
++        /// Gets or sets the maximum allowable size for the encoded resolution. Set a value to\r
++        /// "0" if the maximum does not matter.\r
++        /// </summary>\r
++        public Size PresetMaximumResolution { get; set; }\r
\r
+-                Size croppedDar = CalculateAnamorphicSizes();\r
+-                _cachedDar = (double) croppedDar.Width/croppedDar.Height;\r
+-                updownDisplayWidth.Value = croppedDar.Width;\r
++        /// <summary>\r
++        /// Set the Preset Crop Warning Label\r
++        /// </summary>\r
++        /// <param name="selectedPreset">\r
++        /// The Selected preset\r
++        /// </param>\r
++        public void SetPresetCropWarningLabel(Preset selectedPreset)\r
++        {\r
++            if (this.check_customCrop.Checked)\r
++            {\r
++                lbl_presetCropWarning.Visible = true;\r
++                if (selectedPreset != null && selectedPreset.CropSettings == false) lbl_presetCropWarning.Visible = false;\r
++                else if (selectedPreset == null) lbl_presetCropWarning.Visible = false;\r
++            }\r
++            else\r
++            {\r
++                lbl_presetCropWarning.Visible = false;\r
+             }\r
+         }\r
\r
+         /// <summary>\r
+-        /// Gets or sets the maximum allowable size for the encoded resolution. Set a value to\r
+-        /// "0" if the maximum does not matter.\r
++        /// Setup the UI. The Source has just changed.\r
+         /// </summary>\r
+-        [Browsable(false)]\r
+-        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
+-        public Size PresetMaximumResolution\r
++        private void NewSourceSet()\r
+         {\r
+-            get { return new Size(_presetMaximumWidth, _presetMaximumHeight); }\r
+-            set\r
++            // Set the Aspect Ratio\r
++            lbl_src_res.Text = sourceTitle.Resolution.Width + " x " + sourceTitle.Resolution.Height;\r
++\r
++            // Set the Recommended Cropping values, but only if a preset doesn't have hard set picture settings.\r
++            if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.CropSettings == false) || CurrentlySelectedPreset == null)\r
++            {\r
++                crop_top.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Top);\r
++                crop_bottom.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Bottom);\r
++                crop_left.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Left);\r
++                crop_right.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Right);\r
++            }\r
++\r
++            SetPresetCropWarningLabel(CurrentlySelectedPreset);\r
++\r
++            // Set the Resolution Boxes\r
++            if (drp_anamorphic.SelectedIndex == 0)\r
++            {\r
++                int width = sourceTitle.Resolution.Width;\r
++\r
++                if (width > PresetMaximumResolution.Width && PresetMaximumResolution.Width != 0) // If the preset has a Max width set, don't use a width larger than it.\r
++                    width = PresetMaximumResolution.Width;\r
++\r
++                if (text_width.Value == 0 || (text_width.Value > PresetMaximumResolution.Width && PresetMaximumResolution.Width != 0)) // Only update the values if the fields don't already have values.\r
++                    text_width.Value = width;\r
++\r
++                check_KeepAR.Checked = true; // Forces Resolution to be correct.\r
++            }\r
++            else\r
+             {\r
+-                _presetMaximumWidth = value.Width;\r
+-                _presetMaximumHeight = value.Height;\r
+-\r
+-                if (value.Width != 0 && value.Height != 0)\r
+-                    lbl_max.Text = "\8dÅ\91å\95\9d/\8d\82\82³\8ew\92è";\r
+-                else if (value.Width != 0)\r
+-                    lbl_max.Text = "\8dÅ\91å\95\9d\8ew\92è";\r
+-                else if (value.Height != 0)\r
+-                    lbl_max.Text = "\8dÅ\91å\8d\82\82³\8ew\92è";\r
+-                else\r
+-                    lbl_max.Text = "";\r
++                int width = sourceTitle.Resolution.Width;\r
++                if (width > PresetMaximumResolution.Width && PresetMaximumResolution.Width != 0) // If the preset has a Max width set, don't use a width larger than it.\r
++                    width = PresetMaximumResolution.Width;\r
++\r
++                int height = sourceTitle.Resolution.Height;\r
++                if (height > PresetMaximumResolution.Height && PresetMaximumResolution.Height != 0) // If the preset has a Max height set, don't use a width larger than it.\r
++                    height = PresetMaximumResolution.Height;\r
++\r
++                text_width.Value = width;\r
++                text_height.Value = height - (int)crop_top.Value - (int)crop_bottom.Value;\r
++\r
++                labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height;\r
+             }\r
++\r
++            updownParWidth.Value = sourceTitle.ParVal.Width;\r
++            updownParHeight.Value = sourceTitle.ParVal.Height;\r
++\r
++            Size croppedDar = CalculateAnamorphicSizes();\r
++            cachedDar = (double)croppedDar.Width / croppedDar.Height;\r
++            updownDisplayWidth.Value = croppedDar.Width;\r
+         }\r
\r
+         // Picture Controls\r
+-        private void text_width_ValueChanged(object sender, EventArgs e)\r
++        private void TextWidthValueChanged(object sender, EventArgs e)\r
+         {\r
+-            if (Properties.Settings.Default.disableResCalc)\r
+-                return;\r
+-\r
+-            if (_preventChangingWidth)\r
++            if (preventChangingWidth)\r
+                 return;\r
\r
+             // Make sure the new value doesn't exceed the maximum\r
+@@ -131,7 +165,7 @@ namespace Handbrake.Controls
+                 case 0:\r
+                     if (check_KeepAR.Checked && Source != null)\r
+                     {\r
+-                        _preventChangingHeight = true;\r
++                        preventChangingHeight = true;\r
\r
+                         int width = (int)text_width.Value;\r
\r
+@@ -145,44 +179,39 @@ namespace Handbrake.Controls
+                                            (Source.Resolution.Height * SourceAspect.Width * crop_width);\r
+                         text_height.Value = (decimal)GetModulusValue(newHeight);\r
\r
+-                        _preventChangingHeight = false;\r
++                        preventChangingHeight = false;\r
+                     }\r
+                     break;\r
+                 case 3:\r
+                     if (check_KeepAR.CheckState == CheckState.Unchecked && Source != null)\r
+                     {\r
+-                        if (_preventChangingCustom)\r
++                        if (preventChangingCustom)\r
+                             break;\r
\r
+-                        _preventChangingDisplayWidth = true;\r
++                        preventChangingDisplayWidth = true;\r
+                         updownDisplayWidth.Value = text_width.Value * updownParWidth.Value / updownParHeight.Value;\r
+-                        _preventChangingDisplayWidth = false;\r
++                        preventChangingDisplayWidth = false;\r
\r
+                         labelDisplaySize.Text = Math.Truncate(updownDisplayWidth.Value) + "x" + text_height.Value;\r
+                     }\r
\r
+                     if (check_KeepAR.CheckState == CheckState.Checked && Source != null)\r
+                     {\r
+-                        _preventChangingWidth = true;\r
+                         updownParWidth.Value = updownDisplayWidth.Value;\r
+                         updownParHeight.Value = text_width.Value;\r
+-                        _preventChangingWidth = false;\r
+                     }\r
+-                    labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height;\r
+                     break;\r
+                 default:\r
+                     labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height;\r
+                     break;\r
+             }\r
\r
+-            _preventChangingWidth = false;\r
++            preventChangingWidth = false;\r
+         }\r
+-        private void text_height_ValueChanged(object sender, EventArgs e)\r
+-        {\r
+-            if (Properties.Settings.Default.disableResCalc)\r
+-                return;\r
\r
+-            if (_preventChangingHeight)\r
++        private void TextHeightValueChanged(object sender, EventArgs e)\r
++        {\r
++            if (preventChangingHeight)\r
+                 return;\r
\r
+             if (Source != null)\r
+@@ -194,17 +223,18 @@ namespace Handbrake.Controls
+                 case 0:\r
+                     if (check_KeepAR.Checked && Source != null)\r
+                     {\r
+-                        _preventChangingWidth = true;\r
++                        preventChangingWidth = true;\r
\r
+                         double crop_width = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value;\r
+                         double crop_height = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
\r
+-                        double new_width = ((double)text_height.Value * Source.Resolution.Height * SourceAspect.Width * crop_width) /\r
+-                                            (Source.Resolution.Width * SourceAspect.Height * crop_height);\r
++                        double new_width = ((double)text_height.Value * Source.Resolution.Height * SourceAspect.Width *\r
++                                            crop_width) /\r
++                                           (Source.Resolution.Width * SourceAspect.Height * crop_height);\r
\r
+                         text_width.Value = (decimal)GetModulusValue(new_width);\r
\r
+-                        _preventChangingWidth = false;\r
++                        preventChangingWidth = false;\r
+                     }\r
+                     break;\r
+                 case 3:\r
+@@ -217,17 +247,17 @@ namespace Handbrake.Controls
+                         // - Changes PIXEL HEIGHT to STORAGE WIDTH\r
+                         // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)\r
\r
+-                        double rawCalculatedDisplayWidth = (double)text_height.Value * _cachedDar;\r
++                        double rawCalculatedDisplayWidth = (double)text_height.Value * cachedDar;\r
\r
+-                        _preventChangingDisplayWidth = true; // Start Guards\r
+-                        _preventChangingWidth = true;\r
++                        preventChangingDisplayWidth = true; // Start Guards\r
++                        preventChangingWidth = true;\r
\r
+                         updownDisplayWidth.Value = (decimal)rawCalculatedDisplayWidth;\r
+                         updownParWidth.Value = updownDisplayWidth.Value;\r
+                         updownParHeight.Value = text_width.Value;\r
\r
+-                        _preventChangingWidth = false; // Reset Guards\r
+-                        _preventChangingDisplayWidth = false;\r
++                        preventChangingWidth = false; // Reset Guards\r
++                        preventChangingDisplayWidth = false;\r
+                     }\r
\r
+                     break;\r
+@@ -236,16 +266,14 @@ namespace Handbrake.Controls
+                     break;\r
+             }\r
\r
+-            _preventChangingHeight = false;\r
++            preventChangingHeight = false;\r
+         }\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
++        private void CheckKeepArCheckedChanged(object sender, EventArgs e)\r
++        {\r
++            // Force TextWidth to recalc height\r
+             if (check_KeepAR.Checked)\r
+-                text_width_ValueChanged(this, new EventArgs());\r
++                TextWidthValueChanged(this, new EventArgs());\r
\r
+             // Disable the Custom Anamorphic Par Controls if checked.\r
+             if (drp_anamorphic.SelectedIndex == 3)\r
+@@ -258,20 +286,18 @@ namespace Handbrake.Controls
+             if (PictureSettingsChanged != null)\r
+                 PictureSettingsChanged(this, new EventArgs());\r
+         }\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
++        private void UpdownDisplayWidthValueChanged(object sender, EventArgs e)\r
++        {\r
++            if (preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Unchecked)\r
+             {\r
+-                _preventChangingCustom = true;\r
++                preventChangingCustom = true;\r
+                 updownParWidth.Value = updownDisplayWidth.Value;\r
+                 updownParHeight.Value = text_width.Value;\r
+-                _preventChangingCustom = false;\r
++                preventChangingCustom = false;\r
+             }\r
\r
+-            if (_preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Checked)\r
++            if (preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Checked)\r
+             {\r
+                 // - Changes HEIGHT to keep DAR\r
+                 // - Changes PIXEL WIDTH to new DISPLAY WIDTH\r
+@@ -280,28 +306,27 @@ namespace Handbrake.Controls
\r
+                 // Calculate new Height Value\r
+                 int modulus;\r
+-                if(!int.TryParse(drp_modulus.SelectedItem.ToString(), out 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 rawCalculatedHeight = (int)((int)updownDisplayWidth.Value / cachedDar);\r
+                 int modulusHeight = rawCalculatedHeight - (rawCalculatedHeight % modulus);\r
\r
+                 // Update value\r
+-                _preventChangingHeight = true;\r
++                preventChangingHeight = true;\r
+                 text_height.Value = (decimal)modulusHeight;\r
+                 updownParWidth.Value = updownDisplayWidth.Value;\r
+                 updownParHeight.Value = text_width.Value;\r
+-                _preventChangingHeight = false;\r
++                preventChangingHeight = false;\r
+             }\r
+-            labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height;\r
+         }\r
\r
+         // Anamorphic Controls\r
+-        private void drp_anamorphic_SelectedIndexChanged(object sender, EventArgs e)\r
++        private void DrpAnamorphicSelectedIndexChanged(object sender, EventArgs e)\r
+         {\r
+             switch (drp_anamorphic.SelectedIndex)\r
+             {\r
+-                case 0:\r
++                case 0: // None\r
+                     text_width.Enabled = true;\r
+                     text_height.Enabled = true;\r
+                     check_KeepAR.Enabled = true;\r
+@@ -309,15 +334,16 @@ namespace Handbrake.Controls
+                     SetCustomAnamorphicOptionsVisible(false);\r
+                     labelStaticDisplaySize.Visible = false;\r
+                     labelDisplaySize.Visible = false;\r
++                    drp_modulus.Visible = true;\r
++                    lbl_modulus.Visible = true;\r
\r
+-                    check_KeepAR.Checked = true;\r
+-                    drp_modulus.SelectedIndex = 0;\r
++                    // check_KeepAR.Checked = true;\r
\r
+                     if (check_KeepAR.Checked)\r
+-                        text_width_ValueChanged(this, new EventArgs());\r
++                        TextWidthValueChanged(this, new EventArgs());\r
+                     // Don't update display size if we're not using anamorphic\r
+                     return;\r
+-                case 1:\r
++                case 1: // Strict\r
+                     text_width.Enabled = false;\r
+                     text_height.Enabled = false;\r
+                     check_KeepAR.Enabled = false;\r
+@@ -325,11 +351,10 @@ namespace Handbrake.Controls
+                     SetCustomAnamorphicOptionsVisible(false);\r
+                     labelStaticDisplaySize.Visible = true;\r
+                     labelDisplaySize.Visible = true;\r
+-                    drp_modulus.SelectedIndex = 0;\r
\r
+                     check_KeepAR.Checked = true;\r
+                     break;\r
+-                case 2:\r
++                case 2: // Loose\r
+                     text_width.Enabled = true;\r
+                     text_height.Enabled = false;\r
+                     check_KeepAR.Enabled = false;\r
+@@ -337,11 +362,12 @@ namespace Handbrake.Controls
+                     SetCustomAnamorphicOptionsVisible(false);\r
+                     labelStaticDisplaySize.Visible = true;\r
+                     labelDisplaySize.Visible = true;\r
+-                    drp_modulus.SelectedIndex = 0;\r
++                    drp_modulus.Visible = true;\r
++                    lbl_modulus.Visible = true;\r
\r
+                     check_KeepAR.Checked = true;\r
+                     break;\r
+-                case 3:\r
++                case 3: // Custom\r
+                     text_width.Enabled = true;\r
+                     text_height.Enabled = true;\r
+                     check_KeepAR.Enabled = true;\r
+@@ -354,27 +380,27 @@ namespace Handbrake.Controls
+                     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
\r
+             if (check_KeepAR.Checked)\r
+-                text_width_ValueChanged(this, new EventArgs());\r
++                TextWidthValueChanged(this, new EventArgs());\r
\r
+             if (PictureSettingsChanged != null)\r
+                 PictureSettingsChanged(this, new EventArgs());\r
+         }\r
+-        private void drp_modulus_SelectedIndexChanged(object sender, EventArgs e)\r
++\r
++        private void DrpModulusSelectedIndexChanged(object sender, EventArgs e)\r
+         {\r
+-            _preventChangingWidth = true;\r
+-            _preventChangingHeight = true;\r
++            preventChangingWidth = true;\r
++            preventChangingHeight = true;\r
\r
+             text_width.Value = (decimal)GetModulusValue((double)text_width.Value);\r
+             text_height.Value = (decimal)GetModulusValue((double)text_height.Value);\r
\r
+-            _preventChangingWidth = false;\r
+-            _preventChangingHeight = false;\r
++            preventChangingWidth = false;\r
++            preventChangingHeight = false;\r
\r
+             text_width.Increment = int.Parse(drp_modulus.SelectedItem.ToString());\r
+             text_height.Increment = int.Parse(drp_modulus.SelectedItem.ToString());\r
+@@ -384,7 +410,7 @@ namespace Handbrake.Controls
+         }\r
\r
+         // Cropping Controls\r
+-        private void check_autoCrop_CheckedChanged(object sender, EventArgs e)\r
++        private void CheckAutoCropCheckedChanged(object sender, EventArgs e)\r
+         {\r
+             crop_top.Enabled = check_customCrop.Checked;\r
+             crop_bottom.Enabled = check_customCrop.Checked;\r
+@@ -393,15 +419,16 @@ namespace Handbrake.Controls
\r
+             if (Source != null)\r
+             {\r
+-                crop_top.Value = Source.AutoCropDimensions[0];\r
+-                crop_bottom.Value = Source.AutoCropDimensions[1];\r
+-                crop_left.Value = Source.AutoCropDimensions[2];\r
+-                crop_right.Value = Source.AutoCropDimensions[3];\r
++                crop_top.Value = Source.AutoCropDimensions.Top;\r
++                crop_bottom.Value = Source.AutoCropDimensions.Bottom;\r
++                crop_left.Value = Source.AutoCropDimensions.Left;\r
++                crop_right.Value = Source.AutoCropDimensions.Right;\r
+             }\r
+         }\r
+-        private void crop_ValueChanged(object sender, EventArgs e)\r
++\r
++        private void CropValueChanged(object sender, EventArgs e)\r
+         {\r
+-            text_width_ValueChanged(this, new EventArgs());\r
++            TextWidthValueChanged(this, new EventArgs());\r
+         }\r
\r
+         // GUI Functions\r
+@@ -424,22 +451,24 @@ namespace Handbrake.Controls
+             get\r
+             {\r
+                 if (Source != null) // display aspect = (width * par_width) / (height * par_height)\r
+-                    return new Size((Source.ParVal.Width * Source.Resolution.Width), (Source.ParVal.Height * Source.Resolution.Height));\r
++                    return new Size((Source.ParVal.Width * Source.Resolution.Width),\r
++                                    (Source.ParVal.Height * Source.Resolution.Height));\r
\r
+                 return new Size(0, 0); // Fall over to 16:9 and hope for the best\r
+             }\r
+         }\r
++\r
+         private Size CalculateAnamorphicSizes()\r
+         {\r
+             if (Source != null)\r
+             {\r
+                 /* Set up some variables to make the math easier to follow. */\r
+-                int cropped_width = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value;\r
+-                int cropped_height = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
+-                double storage_aspect = (double)cropped_width / cropped_height;\r
++                int croppedWidth = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value;\r
++                int croppedHeight = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
++                double storageAspect = (double)croppedWidth / croppedHeight;\r
\r
+                 /* Figure out what width the source would display at. */\r
+-                double source_display_width = (double)cropped_width * Source.ParVal.Width / Source.ParVal.Height;\r
++                double sourceDisplayWidth = (double)croppedWidth * Source.ParVal.Width / Source.ParVal.Height;\r
\r
+                 /*\r
+                      3 different ways of deciding output dimensions:\r
+@@ -453,28 +482,28 @@ namespace Handbrake.Controls
+                     default:\r
+                     case 1:\r
+                         /* Strict anamorphic */\r
+-                        double displayWidth = ((double)cropped_width * Source.ParVal.Width / Source.ParVal.Height);\r
++                        double displayWidth = ((double)croppedWidth * Source.ParVal.Width / Source.ParVal.Height);\r
+                         displayWidth = Math.Round(displayWidth, 0);\r
+-                        Size output = new Size((int)displayWidth, cropped_height);\r
++                        Size output = new Size((int)displayWidth, croppedHeight);\r
+                         return output;\r
+                     case 2:\r
+                         /* "Loose" anamorphic.\r
+                             - Uses mod16-compliant dimensions,\r
+                             - Allows users to set the width\r
+                         */\r
+-                        width = (int) text_width.Value;\r
++                        width = (int)text_width.Value;\r
+                         width = GetModulusValue(width); /* Time to get picture width that divide cleanly.*/\r
\r
+-                        height = (width / storage_aspect) + 0.5;\r
++                        height = (width / storageAspect) + 0.5;\r
+                         height = GetModulusValue(height); /* Time to get picture height that divide cleanly.*/\r
\r
+                         /* The film AR is the source's display width / cropped source height.\r
+                            The output display width is the output height * film AR.\r
+                            The output PAR is the output display width / output storage width. */\r
+-                        double pixel_aspect_width = height * source_display_width / cropped_height;\r
+-                        double pixel_aspect_height = width;\r
++                        double pixelAspectWidth = height * sourceDisplayWidth / croppedHeight;\r
++                        double pixelAspectHeight = width;\r
\r
+-                        double disWidthLoose = (width * pixel_aspect_width / pixel_aspect_height);\r
++                        double disWidthLoose = (width * pixelAspectWidth / pixelAspectHeight);\r
+                         if (double.IsNaN(disWidthLoose))\r
+                             disWidthLoose = 0;\r
+                         return new Size((int)disWidthLoose, (int)height);\r
+@@ -497,6 +526,7 @@ namespace Handbrake.Controls
+             // Return a default value of 0,0 to indicate failure\r
+             return new Size(0, 0);\r
+         }\r
++\r
+         private double GetModulusValue(double value)\r
+         {\r
+             int mod = int.Parse(drp_modulus.SelectedItem.ToString());\r
+@@ -507,19 +537,12 @@ namespace Handbrake.Controls
\r
+             return remainder >= ((double)mod / 2) ? value + (mod - remainder) : value - remainder;\r
+         }\r
++\r
+         private static int GetCropMod2Clean(int value)\r
+         {\r
+             int remainder = value % 2;\r
+             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