]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Thu, 25 Feb 2010 20:45:44 +0000 (20:45 +0000)
committersr55 <sr55.hb@outlook.com>
Thu, 25 Feb 2010 20:45:44 +0000 (20:45 +0000)
- Make the picture settings panel work more like the macgui.
No longer uses -X Max Width but instead does all the logic in-gui so it's less confusing to the user.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3139 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Controls/PictureSettings.Designer.cs
win/C#/Controls/PictureSettings.cs
win/C#/Functions/QueryGenerator.cs
win/C#/Functions/QueryParser.cs
win/C#/Functions/Scan.cs
win/C#/HandBrakeCS.5.0.ReSharper
win/C#/frmMain.cs

index 96953ac537b4011189c265484e77f55a27e84c84..83dfc9bafb88c2fc6c897de2ce7cb48037246cf8 100644 (file)
@@ -42,11 +42,8 @@ namespace Handbrake.Controls
             this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();\r
             this.label7 = new System.Windows.Forms.Label();\r
             this.lbl_src_res = new System.Windows.Forms.Label();\r
-            this.Label91 = new System.Windows.Forms.Label();\r
-            this.lbl_Aspect = new System.Windows.Forms.Label();\r
             this.Label55 = new System.Windows.Forms.Label();\r
             this.text_width = new System.Windows.Forms.NumericUpDown();\r
-            this.lbl_max = new System.Windows.Forms.Label();\r
             this.label4 = new System.Windows.Forms.Label();\r
             this.text_height = new System.Windows.Forms.NumericUpDown();\r
             this.check_KeepAR = new System.Windows.Forms.CheckBox();\r
@@ -280,11 +277,8 @@ namespace Handbrake.Controls
             this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
             this.tableLayoutPanel2.Controls.Add(this.label7, 0, 0);\r
             this.tableLayoutPanel2.Controls.Add(this.lbl_src_res, 1, 0);\r
-            this.tableLayoutPanel2.Controls.Add(this.Label91, 2, 0);\r
-            this.tableLayoutPanel2.Controls.Add(this.lbl_Aspect, 3, 0);\r
             this.tableLayoutPanel2.Controls.Add(this.Label55, 0, 1);\r
             this.tableLayoutPanel2.Controls.Add(this.text_width, 1, 1);\r
-            this.tableLayoutPanel2.Controls.Add(this.lbl_max, 4, 1);\r
             this.tableLayoutPanel2.Controls.Add(this.label4, 2, 1);\r
             this.tableLayoutPanel2.Controls.Add(this.text_height, 3, 1);\r
             this.tableLayoutPanel2.Controls.Add(this.check_KeepAR, 1, 2);\r
@@ -323,32 +317,6 @@ namespace Handbrake.Controls
             this.lbl_src_res.TabIndex = 77;\r
             this.lbl_src_res.Text = "--";\r
             // \r
-            // Label91\r
-            // \r
-            this.Label91.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
-            this.Label91.AutoSize = true;\r
-            this.Label91.BackColor = System.Drawing.Color.Transparent;\r
-            this.Label91.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.Label91.Location = new System.Drawing.Point(120, 3);\r
-            this.Label91.Margin = new System.Windows.Forms.Padding(3);\r
-            this.Label91.Name = "Label91";\r
-            this.Label91.Size = new System.Drawing.Size(72, 13);\r
-            this.Label91.TabIndex = 78;\r
-            this.Label91.Text = "Aspect Ratio:";\r
-            // \r
-            // lbl_Aspect\r
-            // \r
-            this.lbl_Aspect.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
-            this.lbl_Aspect.AutoSize = true;\r
-            this.lbl_Aspect.BackColor = System.Drawing.Color.Transparent;\r
-            this.lbl_Aspect.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.lbl_Aspect.Location = new System.Drawing.Point(198, 3);\r
-            this.lbl_Aspect.Margin = new System.Windows.Forms.Padding(3);\r
-            this.lbl_Aspect.Name = "lbl_Aspect";\r
-            this.lbl_Aspect.Size = new System.Drawing.Size(15, 13);\r
-            this.lbl_Aspect.TabIndex = 79;\r
-            this.lbl_Aspect.Text = "--";\r
-            // \r
             // Label55\r
             // \r
             this.Label55.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
@@ -376,19 +344,6 @@ namespace Handbrake.Controls
             this.text_width.TabIndex = 85;\r
             this.text_width.ValueChanged += new System.EventHandler(this.TextWidthValueChanged);\r
             // \r
-            // lbl_max\r
-            // \r
-            this.lbl_max.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
-            this.lbl_max.AutoSize = true;\r
-            this.lbl_max.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.lbl_max.Location = new System.Drawing.Point(268, 26);\r
-            this.lbl_max.Margin = new System.Windows.Forms.Padding(3);\r
-            this.lbl_max.Name = "lbl_max";\r
-            this.lbl_max.Size = new System.Drawing.Size(15, 13);\r
-            this.lbl_max.TabIndex = 83;\r
-            this.lbl_max.Text = "--";\r
-            this.lbl_max.DoubleClick += new System.EventHandler(this.LblMaxDoubleClick);\r
-            // \r
             // label4\r
             // \r
             this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
@@ -405,7 +360,7 @@ namespace Handbrake.Controls
             // \r
             // text_height\r
             // \r
-            this.text_height.Location = new System.Drawing.Point(198, 22);\r
+            this.text_height.Location = new System.Drawing.Point(168, 22);\r
             this.text_height.Maximum = new decimal(new int[] {\r
             2560,\r
             0,\r
@@ -705,10 +660,7 @@ namespace Handbrake.Controls
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;\r
         internal System.Windows.Forms.Label label7;\r
         internal System.Windows.Forms.Label lbl_src_res;\r
-        internal System.Windows.Forms.Label Label91;\r
-        internal System.Windows.Forms.Label lbl_Aspect;\r
         internal System.Windows.Forms.Label Label55;\r
-        private System.Windows.Forms.Label lbl_max;\r
         internal System.Windows.Forms.Label label4;\r
         internal System.Windows.Forms.CheckBox check_KeepAR;\r
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;\r
index 44de200389275a49ed620d83aff4570f7a0cb5aa..b9a0bf040435c79e7add08adb3d1353a1c9f2f42 100644 (file)
@@ -1,8 +1,7 @@
 /*  PictureSetting.cs $\r
-       \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
+    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
@@ -13,17 +12,16 @@ namespace Handbrake.Controls
     using Parsing;\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 bool preventChangingWidth;\r
         private bool preventChangingHeight;\r
         private bool preventChangingCustom;\r
         private bool preventChangingDisplayWidth;\r
-        private int presetMaximumWidth;\r
-        private int presetMaximumHeight;\r
         private double cachedDar;\r
         private Title sourceTitle;\r
 \r
@@ -39,12 +37,21 @@ namespace Handbrake.Controls
             drp_modulus.SelectedIndex = 0;\r
         }\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
         public Title Source\r
         {\r
-            private get { return sourceTitle; }\r
+            private get\r
+            {\r
+                return sourceTitle;\r
+            }\r
+\r
             set\r
             {\r
                 sourceTitle = value;\r
@@ -54,7 +61,7 @@ namespace Handbrake.Controls
         }\r
 \r
         /// <summary>\r
-        /// Which preset is currently selected by the user.\r
+        /// Gets or sets the currently selected preset.\r
         /// </summary>\r
         public Preset CurrentlySelectedPreset { get; set; }\r
 \r
@@ -62,29 +69,14 @@ namespace Handbrake.Controls
         /// 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\r
-        {\r
-            get { return new Size(presetMaximumWidth, presetMaximumHeight); }\r
-            set\r
-            {\r
-                presetMaximumWidth = value.Width;\r
-                presetMaximumHeight = value.Height;\r
-\r
-                if (value.Width != 0 && value.Height != 0)\r
-                    lbl_max.Text = "Max Width / Height";\r
-                else if (value.Width != 0)\r
-                    lbl_max.Text = "Max Width";\r
-                else if (value.Height != 0)\r
-                    lbl_max.Text = "Max Height";\r
-                else\r
-                    lbl_max.Text = string.Empty;\r
-            }\r
-        }\r
+        public Size PresetMaximumResolution { get; set; }\r
 \r
         /// <summary>\r
         /// Set the Preset Crop Warning Label\r
         /// </summary>\r
-        /// <param name="selectedPreset"></param>\r
+        /// <param name="selectedPreset">\r
+        /// The Selected preset\r
+        /// </param>\r
         public void SetPresetCropWarningLabel(Preset selectedPreset)\r
         {\r
             lbl_presetCropWarning.Visible = true;\r
@@ -100,12 +92,10 @@ namespace Handbrake.Controls
         private void NewSourceSet()\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, but only if a preset doesn't have hard set picture settings.\r
-            if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false) ||\r
-                CurrentlySelectedPreset == null)\r
+            if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false) || CurrentlySelectedPreset == null)\r
             {\r
                 crop_top.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[0]);\r
                 crop_bottom.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[1]);\r
@@ -118,19 +108,28 @@ namespace Handbrake.Controls
             // 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
+                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
-                if (text_width.Value == 0 && text_height.Value == 0)\r
-                    // 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
+                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
@@ -139,7 +138,7 @@ namespace Handbrake.Controls
             updownParHeight.Value = sourceTitle.ParVal.Height;\r
 \r
             Size croppedDar = CalculateAnamorphicSizes();\r
-            cachedDar = (double) croppedDar.Width/croppedDar.Height;\r
+            cachedDar = (double)croppedDar.Width / croppedDar.Height;\r
             updownDisplayWidth.Value = croppedDar.Width;\r
         }\r
 \r
@@ -164,17 +163,17 @@ namespace Handbrake.Controls
                     {\r
                         preventChangingHeight = true;\r
 \r
-                        int width = (int) text_width.Value;\r
+                        int width = (int)text_width.Value;\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
+                        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
                         if (SourceAspect.Width == 0 && SourceAspect.Height == 0)\r
                             break;\r
 \r
-                        double newHeight = ((double) width*Source.Resolution.Width*SourceAspect.Height*crop_height)/\r
-                                           (Source.Resolution.Height*SourceAspect.Width*crop_width);\r
-                        text_height.Value = (decimal) GetModulusValue(newHeight);\r
+                        double newHeight = ((double)width * Source.Resolution.Width * SourceAspect.Height * crop_height) /\r
+                                           (Source.Resolution.Height * SourceAspect.Width * crop_width);\r
+                        text_height.Value = (decimal)GetModulusValue(newHeight);\r
 \r
                         preventChangingHeight = false;\r
                     }\r
@@ -186,7 +185,7 @@ namespace Handbrake.Controls
                             break;\r
 \r
                         preventChangingDisplayWidth = true;\r
-                        updownDisplayWidth.Value = text_width.Value*updownParWidth.Value/updownParHeight.Value;\r
+                        updownDisplayWidth.Value = text_width.Value * updownParWidth.Value / updownParHeight.Value;\r
                         preventChangingDisplayWidth = false;\r
 \r
                         labelDisplaySize.Text = Math.Truncate(updownDisplayWidth.Value) + "x" + text_height.Value;\r
@@ -225,14 +224,14 @@ namespace Handbrake.Controls
                     {\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
+                        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*\r
-                                            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
+                        text_width.Value = (decimal)GetModulusValue(new_width);\r
 \r
                         preventChangingWidth = false;\r
                     }\r
@@ -247,12 +246,12 @@ 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
 \r
-                        updownDisplayWidth.Value = (decimal) rawCalculatedDisplayWidth;\r
+                        updownDisplayWidth.Value = (decimal)rawCalculatedDisplayWidth;\r
                         updownParWidth.Value = updownDisplayWidth.Value;\r
                         updownParHeight.Value = text_width.Value;\r
 \r
@@ -315,12 +314,12 @@ namespace Handbrake.Controls
                 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
+                int rawCalculatedHeight = (int)((int)updownDisplayWidth.Value / cachedDar);\r
+                int modulusHeight = rawCalculatedHeight - (rawCalculatedHeight % modulus);\r
 \r
                 // Update value\r
                 preventChangingHeight = true;\r
-                text_height.Value = (decimal) modulusHeight;\r
+                text_height.Value = (decimal)modulusHeight;\r
                 updownParWidth.Value = updownDisplayWidth.Value;\r
                 updownParHeight.Value = text_width.Value;\r
                 preventChangingHeight = false;\r
@@ -339,8 +338,9 @@ namespace Handbrake.Controls
 \r
                     SetCustomAnamorphicOptionsVisible(false);\r
                     labelStaticDisplaySize.Visible = false;\r
-                    labelDisplaySize.Visible = true;\r
+                    labelDisplaySize.Visible = false;\r
                     drp_modulus.Visible = true;\r
+                    lbl_modulus.Visible = true;\r
 \r
                     // check_KeepAR.Checked = true;\r
 \r
@@ -401,8 +401,8 @@ namespace Handbrake.Controls
             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
+            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
@@ -456,8 +456,8 @@ 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), \r
-                                    (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
@@ -468,12 +468,12 @@ namespace Handbrake.Controls
             if (Source != null)\r
             {\r
                 /* Set up some variables to make the math easier to follow. */\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
+                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 sourceDisplayWidth = (double) croppedWidth*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
@@ -487,31 +487,31 @@ namespace Handbrake.Controls
                     default:\r
                     case 1:\r
                         /* Strict anamorphic */\r
-                        double displayWidth = ((double) croppedWidth*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, croppedHeight);\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/storageAspect) + 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 pixelAspectWidth = height*sourceDisplayWidth/croppedHeight;\r
+                        double pixelAspectWidth = height * sourceDisplayWidth / croppedHeight;\r
                         double pixelAspectHeight = width;\r
 \r
-                        double disWidthLoose = (width*pixelAspectWidth/pixelAspectHeight);\r
+                        double disWidthLoose = (width * pixelAspectWidth / pixelAspectHeight);\r
                         if (double.IsNaN(disWidthLoose))\r
                             disWidthLoose = 0;\r
-                        return new Size((int) disWidthLoose, (int) height);\r
+                        return new Size((int)disWidthLoose, (int)height);\r
                     case 3:\r
 \r
                         // Get the User Interface Values\r
@@ -519,12 +519,12 @@ namespace Handbrake.Controls
                         double.TryParse(updownDisplayWidth.Text, out UIdisplayWidth);\r
 \r
                         /* Anamorphic 3: Power User Jamboree - Set everything based on specified values */\r
-                        height = GetModulusValue((double) text_height.Value);\r
+                        height = GetModulusValue((double)text_height.Value);\r
 \r
                         if (check_KeepAR.Checked)\r
-                            return new Size((int) Math.Truncate(UIdisplayWidth), (int) height);\r
+                            return new Size((int)Math.Truncate(UIdisplayWidth), (int)height);\r
 \r
-                        return new Size((int) Math.Truncate(UIdisplayWidth), (int) height);\r
+                        return new Size((int)Math.Truncate(UIdisplayWidth), (int)height);\r
                 }\r
             }\r
 \r
@@ -535,27 +535,19 @@ namespace Handbrake.Controls
         private double GetModulusValue(double value)\r
         {\r
             int mod = int.Parse(drp_modulus.SelectedItem.ToString());\r
-            double remainder = value%mod;\r
+            double remainder = value % mod;\r
 \r
             if (remainder == 0)\r
                 return value;\r
 \r
-            return remainder >= ((double) mod/2) ? value + (mod - remainder) : value - remainder;\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
+            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 LblMaxDoubleClick(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
index c1cadfd710d60ecd1989b5fc65e9b0388ab53cfd..7775b8cdf29c3fe385d7954965cde8bf60d8533d 100644 (file)
@@ -60,7 +60,7 @@ namespace Handbrake.Functions
                         query += string.Format(" -c {0}", mainWindow.drop_chapterStart.Text);\r
                     else if (mainWindow.drop_chapterStart.Text != string.Empty &&\r
                              mainWindow.drop_chapterFinish.Text != string.Empty)\r
-                        query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text, \r
+                        query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text,\r
                                                mainWindow.drop_chapterFinish.Text);\r
                     break;\r
                 case 1: // Seconds\r
@@ -69,7 +69,7 @@ namespace Handbrake.Functions
                     int.TryParse(mainWindow.drop_chapterFinish.Text, out end);\r
                     int calculatedDuration = end - start;\r
 \r
-                    query += string.Format(" --start-at duration:{0} --stop-at duration:{1}", \r
+                    query += string.Format(" --start-at duration:{0} --stop-at duration:{1}",\r
                                            mainWindow.drop_chapterStart.Text, calculatedDuration);\r
                     break;\r
                 case 2: // Frames\r
@@ -77,7 +77,7 @@ namespace Handbrake.Functions
                     int.TryParse(mainWindow.drop_chapterFinish.Text, out end);\r
                     calculatedDuration = end - start;\r
 \r
-                    query += string.Format(" --start-at frame:{0} --stop-at frame:{1}", \r
+                    query += string.Format(" --start-at frame:{0} --stop-at frame:{1}",\r
                                            mainWindow.drop_chapterStart.Text, calculatedDuration);\r
                     break;\r
                 case 3: // Preview\r
@@ -86,7 +86,7 @@ namespace Handbrake.Functions
                     query += " --stop-at duration:" + duration + " ";\r
 \r
                     if (mainWindow.text_destination.Text != string.Empty)\r
-                        query += string.Format(" -o \"{0}\" ", \r
+                        query += string.Format(" -o \"{0}\" ",\r
                                                mainWindow.text_destination.Text.Replace(".m", "_sample.m"));\r
                     break;\r
                 default:\r
@@ -127,38 +127,13 @@ namespace Handbrake.Functions
 \r
             #region Picture Settings Tab\r
 \r
-            // Use MaxWidth for built-in presets and width for user settings.\r
-            if (mainWindow.PictureSettings.PresetMaximumResolution.Width == 0)\r
-            {\r
-                if (mainWindow.PictureSettings.text_width.Value != 0)\r
-                    if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1)\r
-                        // Prevent usage for strict anamorphic\r
-                        query += " -w " + mainWindow.PictureSettings.text_width.Text;\r
-            }\r
-            else\r
-            {\r
-                if (mainWindow.PictureSettings.text_width.Value != 0)\r
-                    if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1)\r
-                        query += " -X " + mainWindow.PictureSettings.text_width.Text;\r
-            }\r
+            if (mainWindow.PictureSettings.text_width.Value != 0)\r
+                if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1) // Prevent usage for strict anamorphic\r
+                    query += " -w " + mainWindow.PictureSettings.text_width.Text;\r
 \r
-            // Use MaxHeight for built-in presets and height for user settings.\r
-            if (mainWindow.PictureSettings.PresetMaximumResolution.Height == 0)\r
-            {\r
-                if (mainWindow.PictureSettings.text_height.Value != 0)\r
-                    if (mainWindow.PictureSettings.text_height.Text != string.Empty)\r
-                        if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 ||\r
-                            mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3)\r
-                            // Prevent usage for strict anamorphic\r
-                            query += " -l " + mainWindow.PictureSettings.text_height.Text;\r
-            }\r
-            else\r
-            {\r
-                if (mainWindow.PictureSettings.text_height.Value != 0)\r
-                    if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 ||\r
-                        mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3)\r
-                        query += " -Y " + mainWindow.PictureSettings.text_height.Text;\r
-            }\r
+            if (mainWindow.PictureSettings.text_height.Value != 0 && mainWindow.PictureSettings.text_height.Text != string.Empty)\r
+                    if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic\r
+                        query += " -l " + mainWindow.PictureSettings.text_height.Text;\r
 \r
             string cropTop = mainWindow.PictureSettings.crop_top.Text;\r
             string cropBottom = mainWindow.PictureSettings.crop_bottom.Text;\r
@@ -256,7 +231,7 @@ namespace Handbrake.Functions
                         break;\r
                     case "H.264 (x264)":\r
                         CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
-                        value = 51 - mainWindow.slider_videoQuality.Value*cqStep;\r
+                        value = 51 - mainWindow.slider_videoQuality.Value * cqStep;\r
                         value = Math.Round(value, 2);\r
                         query += " -q " + value.ToString(culture);\r
                         break;\r
index 9d5b9a9e5a4aad4133cac841c15507c68cd4309a..95b153aa39c64c2b0c4285b1ba1a4f1ff1030328 100644 (file)
@@ -1,8 +1,7 @@
 /*  QueryParser.cs $\r
-       \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
+    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.Functions\r
 {\r
@@ -13,8 +12,14 @@ namespace Handbrake.Functions
     using System.Windows.Forms;\r
     using Model;\r
 \r
+    /// <summary>\r
+    /// Parse a CLI Query\r
+    /// </summary>\r
     public class QueryParser\r
     {\r
+        /// <summary>\r
+        /// The Culture\r
+        /// </summary>\r
         private static readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
 \r
         #region Varibles\r
@@ -433,9 +438,7 @@ namespace Handbrake.Functions
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show(\r
-                    "An error has occured in the Query Parser.\n\n" +\r
-                    exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                MessageBox.Show("An error has occured in the Query Parser.\n\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
             }\r
 \r
             #endregion\r
@@ -446,8 +449,8 @@ namespace Handbrake.Functions
         /// <summary>\r
         /// Get the GUI equiv to a CLI mixdown\r
         /// </summary>\r
-        /// <param name="mixdown"></param>\r
-        /// <returns></returns>\r
+        /// <param name="mixdown">The Audio Mixdown</param>\r
+        /// <returns>The GUI representation of the mixdown</returns>\r
         private static string GetMixDown(string mixdown)\r
         {\r
             switch (mixdown.Trim())\r
@@ -470,8 +473,8 @@ namespace Handbrake.Functions
         /// <summary>\r
         /// Get the GUI equiv to a CLI audio encoder\r
         /// </summary>\r
-        /// <param name="audioEnc"></param>\r
-        /// <returns></returns>\r
+        /// <param name="audioEnc">The Audio Encoder</param>\r
+        /// <returns>The GUI representation of that audio encoder</returns>\r
         private static string GetAudioEncoder(string audioEnc)\r
         {\r
             switch (audioEnc)\r
index 78d158564ce1c8a0469184509075e9bb276c8279..8532b353c62906e8d238da49832fdfc1f0192ae1 100644 (file)
@@ -52,6 +52,11 @@ namespace Handbrake.Functions
         /// </summary>\r
         public event EventHandler ScanStatusChanged;\r
 \r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether IsScanning.\r
+        /// </summary>\r
+        public bool IsScanning { get; set; }\r
+\r
         /// <summary>\r
         /// Scan a Source Path.\r
         /// Title 0: scan all\r
@@ -109,6 +114,7 @@ namespace Handbrake.Functions
         {\r
             try\r
             {\r
+                IsScanning = true;\r
                 if (this.ScanStared != null)\r
                     this.ScanStared(this, new EventArgs());\r
 \r
@@ -152,6 +158,7 @@ namespace Handbrake.Functions
 \r
                 if (this.ScanCompleted != null)\r
                     this.ScanCompleted(this, new EventArgs());\r
+                IsScanning = false;\r
             }\r
             catch (Exception exc)\r
             {\r
index 780744878bd6cd46a1758edc3f987192f0143b42..ede9d3f579f61d3a88b38eac3309bfff4b28b8da 100644 (file)
       <Abbreviation Text="CLI" />\r
       <Abbreviation Text="DRC" />\r
       <Abbreviation Text="ID" />\r
+      <Abbreviation Text="MP" />\r
+      <Abbreviation Text="DVD" />\r
     </Naming2>\r
   </CodeStyleSettings>\r
 </Configuration>
\ No newline at end of file
index 8dd436c9b0a65fd38bf3be2cb4abb1e18efb7d3f..8e7e31db2d87342d4c9e2dcc2d5a3406f81c39ee 100644 (file)
@@ -1037,7 +1037,6 @@ namespace Handbrake
             UnRegisterPresetEventHandler();\r
             drop_mode.SelectedIndex = 0;\r
 \r
-            PictureSettings.lbl_Aspect.Text = "Select a Title"; // Reset some values on the form\r
             drop_chapterStart.Items.Clear();\r
             drop_chapterFinish.Items.Clear();\r
 \r
@@ -1791,7 +1790,6 @@ namespace Handbrake
             drop_chapterFinish.Items.Clear();\r
             lbl_duration.Text = "Select a Title";\r
             PictureSettings.lbl_src_res.Text = "Select a Title";\r
-            PictureSettings.lbl_Aspect.Text = "Select a Title";\r
             sourcePath = String.Empty;\r
             text_destination.Text = String.Empty;\r
             selectedTitle = null;\r