OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 14 Jul 2009 23:11:09 +0000 (23:11 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 14 Jul 2009 23:11:09 +0000 (23:11 +0000)
- Updates Picture Settings code. A mix/match of old/new/libhb code.
- Custom anamorphic mode widgets are not hooked up yet, but if the user sets them manually, they will work just fine.
- Some of the logic has been simplified so that it works better however it's not bullet proof in terms of allowing users to misbehave.

git-svn-id: svn://localhost/HandBrake/trunk@2692 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Controls/PictureSettings.Designer.cs
win/C#/Controls/PictureSettings.cs
win/C#/Functions/PresetLoader.cs
win/C#/Functions/QueryGenerator.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs

index 9036eb5..51dd32c 100644 (file)
@@ -28,28 +28,28 @@ namespace Handbrake.Controls
         /// </summary>\r
         private void InitializeComponent()\r
         {\r
-            this.check_customCrop = new System.Windows.Forms.RadioButton();\r
-            this.check_autoCrop = new System.Windows.Forms.RadioButton();\r
-            this.crop_bottom = new System.Windows.Forms.NumericUpDown();\r
-            this.crop_top = new System.Windows.Forms.NumericUpDown();\r
+            this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();\r
+            this.Label15 = new System.Windows.Forms.Label();\r
             this.crop_left = new System.Windows.Forms.NumericUpDown();\r
             this.crop_right = new System.Windows.Forms.NumericUpDown();\r
-            this.label8 = new System.Windows.Forms.Label();\r
+            this.check_autoCrop = new System.Windows.Forms.RadioButton();\r
+            this.Label51 = new System.Windows.Forms.Label();\r
+            this.crop_top = new System.Windows.Forms.NumericUpDown();\r
             this.Label53 = new System.Windows.Forms.Label();\r
             this.Label52 = new System.Windows.Forms.Label();\r
-            this.Label51 = new System.Windows.Forms.Label();\r
-            this.Label15 = new System.Windows.Forms.Label();\r
-            this.check_KeepAR = new System.Windows.Forms.CheckBox();\r
-            this.text_height = new System.Windows.Forms.NumericUpDown();\r
-            this.text_width = new System.Windows.Forms.NumericUpDown();\r
-            this.label4 = new System.Windows.Forms.Label();\r
-            this.lbl_max = new System.Windows.Forms.Label();\r
-            this.lbl_src_res = new System.Windows.Forms.Label();\r
+            this.crop_bottom = new System.Windows.Forms.NumericUpDown();\r
+            this.check_customCrop = new System.Windows.Forms.RadioButton();\r
+            this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();\r
             this.label7 = new System.Windows.Forms.Label();\r
-            this.label26 = new System.Windows.Forms.Label();\r
-            this.lbl_Aspect = 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
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();\r
             this.updownParHeight = new System.Windows.Forms.NumericUpDown();\r
             this.label6 = new System.Windows.Forms.Label();\r
@@ -63,80 +63,66 @@ namespace Handbrake.Controls
             this.lbl_modulus = new System.Windows.Forms.Label();\r
             this.lbl_displayWidth = new System.Windows.Forms.Label();\r
             this.drp_modulus = new System.Windows.Forms.ComboBox();\r
-            ((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).BeginInit();\r
-            ((System.ComponentModel.ISupportInitialize)(this.crop_top)).BeginInit();\r
+            this.label8 = new System.Windows.Forms.Label();\r
+            this.label26 = new System.Windows.Forms.Label();\r
+            this.tableLayoutPanel3.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.crop_left)).BeginInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.crop_right)).BeginInit();\r
-            ((System.ComponentModel.ISupportInitialize)(this.text_height)).BeginInit();\r
+            ((System.ComponentModel.ISupportInitialize)(this.crop_top)).BeginInit();\r
+            ((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).BeginInit();\r
+            this.tableLayoutPanel2.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_width)).BeginInit();\r
+            ((System.ComponentModel.ISupportInitialize)(this.text_height)).BeginInit();\r
             this.tableLayoutPanel1.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.updownParHeight)).BeginInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.updownParWidth)).BeginInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.updownDisplayWidth)).BeginInit();\r
             this.SuspendLayout();\r
             // \r
-            // check_customCrop\r
-            // \r
-            this.check_customCrop.AutoSize = true;\r
-            this.check_customCrop.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.check_customCrop.Location = new System.Drawing.Point(399, 57);\r
-            this.check_customCrop.Name = "check_customCrop";\r
-            this.check_customCrop.Size = new System.Drawing.Size(65, 17);\r
-            this.check_customCrop.TabIndex = 106;\r
-            this.check_customCrop.Text = "Custom:";\r
-            this.check_customCrop.UseVisualStyleBackColor = true;\r
-            // \r
-            // check_autoCrop\r
-            // \r
-            this.check_autoCrop.AutoSize = true;\r
-            this.check_autoCrop.Checked = true;\r
-            this.check_autoCrop.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.check_autoCrop.Location = new System.Drawing.Point(399, 33);\r
-            this.check_autoCrop.Name = "check_autoCrop";\r
-            this.check_autoCrop.Size = new System.Drawing.Size(73, 17);\r
-            this.check_autoCrop.TabIndex = 105;\r
-            this.check_autoCrop.TabStop = true;\r
-            this.check_autoCrop.Text = "Automatic";\r
-            this.check_autoCrop.UseVisualStyleBackColor = true;\r
-            this.check_autoCrop.CheckedChanged += new System.EventHandler(this.check_autoCrop_CheckedChanged);\r
-            // \r
-            // crop_bottom\r
-            // \r
-            this.crop_bottom.Enabled = false;\r
-            this.crop_bottom.Increment = new decimal(new int[] {\r
-            2,\r
-            0,\r
-            0,\r
-            0});\r
-            this.crop_bottom.Location = new System.Drawing.Point(479, 146);\r
-            this.crop_bottom.Maximum = new decimal(new int[] {\r
-            1080,\r
-            0,\r
-            0,\r
-            0});\r
-            this.crop_bottom.Name = "crop_bottom";\r
-            this.crop_bottom.Size = new System.Drawing.Size(44, 21);\r
-            this.crop_bottom.TabIndex = 103;\r
-            this.crop_bottom.ValueChanged += new System.EventHandler(this.crop_ValueChanged);\r
+            // tableLayoutPanel3\r
+            // \r
+            this.tableLayoutPanel3.AutoSize = true;\r
+            this.tableLayoutPanel3.ColumnCount = 5;\r
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            this.tableLayoutPanel3.Controls.Add(this.Label15, 0, 4);\r
+            this.tableLayoutPanel3.Controls.Add(this.crop_left, 1, 4);\r
+            this.tableLayoutPanel3.Controls.Add(this.crop_right, 3, 4);\r
+            this.tableLayoutPanel3.Controls.Add(this.check_autoCrop, 0, 0);\r
+            this.tableLayoutPanel3.Controls.Add(this.Label51, 4, 4);\r
+            this.tableLayoutPanel3.Controls.Add(this.crop_top, 2, 3);\r
+            this.tableLayoutPanel3.Controls.Add(this.Label53, 2, 6);\r
+            this.tableLayoutPanel3.Controls.Add(this.Label52, 2, 2);\r
+            this.tableLayoutPanel3.Controls.Add(this.crop_bottom, 2, 5);\r
+            this.tableLayoutPanel3.Controls.Add(this.check_customCrop, 0, 1);\r
+            this.tableLayoutPanel3.Location = new System.Drawing.Point(419, 35);\r
+            this.tableLayoutPanel3.Name = "tableLayoutPanel3";\r
+            this.tableLayoutPanel3.RowCount = 7;\r
+            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel3.Size = new System.Drawing.Size(217, 165);\r
+            this.tableLayoutPanel3.TabIndex = 117;\r
             // \r
-            // crop_top\r
+            // Label15\r
             // \r
-            this.crop_top.Enabled = false;\r
-            this.crop_top.Increment = new decimal(new int[] {\r
-            2,\r
-            0,\r
-            0,\r
-            0});\r
-            this.crop_top.Location = new System.Drawing.Point(479, 100);\r
-            this.crop_top.Maximum = new decimal(new int[] {\r
-            1080,\r
-            0,\r
-            0,\r
-            0});\r
-            this.crop_top.Name = "crop_top";\r
-            this.crop_top.Size = new System.Drawing.Size(44, 21);\r
-            this.crop_top.TabIndex = 100;\r
-            this.crop_top.ValueChanged += new System.EventHandler(this.crop_ValueChanged);\r
+            this.Label15.Anchor = System.Windows.Forms.AnchorStyles.Right;\r
+            this.Label15.AutoSize = true;\r
+            this.Label15.BackColor = System.Drawing.Color.Transparent;\r
+            this.Label15.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.Label15.Location = new System.Drawing.Point(0, 99);\r
+            this.Label15.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);\r
+            this.Label15.Name = "Label15";\r
+            this.Label15.Size = new System.Drawing.Size(26, 13);\r
+            this.Label15.TabIndex = 97;\r
+            this.Label15.Text = "Left";\r
             // \r
             // crop_left\r
             // \r
@@ -146,7 +132,7 @@ namespace Handbrake.Controls
             0,\r
             0,\r
             0});\r
-            this.crop_left.Location = new System.Drawing.Point(428, 122);\r
+            this.crop_left.Location = new System.Drawing.Point(32, 95);\r
             this.crop_left.Maximum = new decimal(new int[] {\r
             1920,\r
             0,\r
@@ -165,7 +151,7 @@ namespace Handbrake.Controls
             0,\r
             0,\r
             0});\r
-            this.crop_right.Location = new System.Drawing.Point(530, 122);\r
+            this.crop_right.Location = new System.Drawing.Point(132, 95);\r
             this.crop_right.Maximum = new decimal(new int[] {\r
             1920,\r
             0,\r
@@ -176,24 +162,62 @@ namespace Handbrake.Controls
             this.crop_right.TabIndex = 101;\r
             this.crop_right.ValueChanged += new System.EventHandler(this.crop_ValueChanged);\r
             // \r
-            // label8\r
+            // check_autoCrop\r
             // \r
-            this.label8.AutoSize = true;\r
-            this.label8.BackColor = System.Drawing.Color.Transparent;\r
-            this.label8.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label8.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.label8.Location = new System.Drawing.Point(396, 13);\r
-            this.label8.Name = "label8";\r
-            this.label8.Size = new System.Drawing.Size(33, 13);\r
-            this.label8.TabIndex = 96;\r
-            this.label8.Text = "Crop";\r
+            this.check_autoCrop.AutoSize = true;\r
+            this.check_autoCrop.Checked = true;\r
+            this.tableLayoutPanel3.SetColumnSpan(this.check_autoCrop, 5);\r
+            this.check_autoCrop.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.check_autoCrop.Location = new System.Drawing.Point(0, 3);\r
+            this.check_autoCrop.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);\r
+            this.check_autoCrop.Name = "check_autoCrop";\r
+            this.check_autoCrop.Size = new System.Drawing.Size(73, 17);\r
+            this.check_autoCrop.TabIndex = 105;\r
+            this.check_autoCrop.TabStop = true;\r
+            this.check_autoCrop.Text = "Automatic";\r
+            this.check_autoCrop.UseVisualStyleBackColor = true;\r
+            this.check_autoCrop.CheckedChanged += new System.EventHandler(this.check_autoCrop_CheckedChanged);\r
+            // \r
+            // Label51\r
+            // \r
+            this.Label51.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
+            this.Label51.AutoSize = true;\r
+            this.Label51.BackColor = System.Drawing.Color.Transparent;\r
+            this.Label51.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.Label51.Location = new System.Drawing.Point(182, 99);\r
+            this.Label51.Margin = new System.Windows.Forms.Padding(3);\r
+            this.Label51.Name = "Label51";\r
+            this.Label51.Size = new System.Drawing.Size(32, 13);\r
+            this.Label51.TabIndex = 102;\r
+            this.Label51.Text = "Right";\r
+            // \r
+            // crop_top\r
+            // \r
+            this.crop_top.Enabled = false;\r
+            this.crop_top.Increment = new decimal(new int[] {\r
+            2,\r
+            0,\r
+            0,\r
+            0});\r
+            this.crop_top.Location = new System.Drawing.Point(82, 68);\r
+            this.crop_top.Maximum = new decimal(new int[] {\r
+            1080,\r
+            0,\r
+            0,\r
+            0});\r
+            this.crop_top.Name = "crop_top";\r
+            this.crop_top.Size = new System.Drawing.Size(44, 21);\r
+            this.crop_top.TabIndex = 100;\r
+            this.crop_top.ValueChanged += new System.EventHandler(this.crop_ValueChanged);\r
             // \r
             // Label53\r
             // \r
+            this.Label53.Anchor = System.Windows.Forms.AnchorStyles.Top;\r
             this.Label53.AutoSize = true;\r
             this.Label53.BackColor = System.Drawing.Color.Transparent;\r
             this.Label53.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.Label53.Location = new System.Drawing.Point(477, 170);\r
+            this.Label53.Location = new System.Drawing.Point(83, 149);\r
+            this.Label53.Margin = new System.Windows.Forms.Padding(3);\r
             this.Label53.Name = "Label53";\r
             this.Label53.Size = new System.Drawing.Size(41, 13);\r
             this.Label53.TabIndex = 104;\r
@@ -201,165 +225,210 @@ namespace Handbrake.Controls
             // \r
             // Label52\r
             // \r
+            this.Label52.Anchor = System.Windows.Forms.AnchorStyles.Bottom;\r
             this.Label52.AutoSize = true;\r
             this.Label52.BackColor = System.Drawing.Color.Transparent;\r
             this.Label52.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.Label52.Location = new System.Drawing.Point(486, 85);\r
+            this.Label52.Location = new System.Drawing.Point(91, 49);\r
+            this.Label52.Margin = new System.Windows.Forms.Padding(3);\r
             this.Label52.Name = "Label52";\r
             this.Label52.Size = new System.Drawing.Size(25, 13);\r
             this.Label52.TabIndex = 99;\r
             this.Label52.Text = "Top";\r
             // \r
-            // Label51\r
-            // \r
-            this.Label51.AutoSize = true;\r
-            this.Label51.BackColor = System.Drawing.Color.Transparent;\r
-            this.Label51.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.Label51.Location = new System.Drawing.Point(580, 124);\r
-            this.Label51.Name = "Label51";\r
-            this.Label51.Size = new System.Drawing.Size(32, 13);\r
-            this.Label51.TabIndex = 102;\r
-            this.Label51.Text = "Right";\r
-            // \r
-            // Label15\r
-            // \r
-            this.Label15.AutoSize = true;\r
-            this.Label15.BackColor = System.Drawing.Color.Transparent;\r
-            this.Label15.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.Label15.Location = new System.Drawing.Point(396, 124);\r
-            this.Label15.Name = "Label15";\r
-            this.Label15.Size = new System.Drawing.Size(26, 13);\r
-            this.Label15.TabIndex = 97;\r
-            this.Label15.Text = "Left";\r
-            // \r
-            // check_KeepAR\r
-            // \r
-            this.check_KeepAR.AutoSize = true;\r
-            this.check_KeepAR.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.check_KeepAR.Location = new System.Drawing.Point(68, 85);\r
-            this.check_KeepAR.Name = "check_KeepAR";\r
-            this.check_KeepAR.Size = new System.Drawing.Size(114, 17);\r
-            this.check_KeepAR.TabIndex = 95;\r
-            this.check_KeepAR.Text = "Keep Aspect Ratio";\r
-            this.check_KeepAR.UseVisualStyleBackColor = true;\r
-            this.check_KeepAR.CheckedChanged += new System.EventHandler(this.check_KeepAR_CheckedChanged);\r
-            // \r
-            // text_height\r
+            // crop_bottom\r
             // \r
-            this.text_height.Location = new System.Drawing.Point(206, 59);\r
-            this.text_height.Maximum = new decimal(new int[] {\r
-            2560,\r
+            this.crop_bottom.Enabled = false;\r
+            this.crop_bottom.Increment = new decimal(new int[] {\r
+            2,\r
             0,\r
             0,\r
             0});\r
-            this.text_height.Name = "text_height";\r
-            this.text_height.Size = new System.Drawing.Size(64, 21);\r
-            this.text_height.TabIndex = 86;\r
-            this.text_height.ValueChanged += new System.EventHandler(this.text_height_ValueChanged);\r
-            // \r
-            // text_width\r
-            // \r
-            this.text_width.Location = new System.Drawing.Point(68, 59);\r
-            this.text_width.Maximum = new decimal(new int[] {\r
-            2560,\r
+            this.crop_bottom.Location = new System.Drawing.Point(82, 122);\r
+            this.crop_bottom.Maximum = new decimal(new int[] {\r
+            1080,\r
             0,\r
             0,\r
             0});\r
-            this.text_width.Name = "text_width";\r
-            this.text_width.Size = new System.Drawing.Size(64, 21);\r
-            this.text_width.TabIndex = 85;\r
-            this.text_width.ValueChanged += new System.EventHandler(this.text_width_ValueChanged);\r
-            // \r
-            // label4\r
-            // \r
-            this.label4.AutoSize = true;\r
-            this.label4.BackColor = System.Drawing.Color.Transparent;\r
-            this.label4.ForeColor = System.Drawing.Color.Black;\r
-            this.label4.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.label4.Location = new System.Drawing.Point(152, 63);\r
-            this.label4.Name = "label4";\r
-            this.label4.Size = new System.Drawing.Size(42, 13);\r
-            this.label4.TabIndex = 84;\r
-            this.label4.Text = "Height:";\r
-            // \r
-            // lbl_max\r
+            this.crop_bottom.Name = "crop_bottom";\r
+            this.crop_bottom.Size = new System.Drawing.Size(44, 21);\r
+            this.crop_bottom.TabIndex = 103;\r
+            this.crop_bottom.ValueChanged += new System.EventHandler(this.crop_ValueChanged);\r
             // \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(279, 61);\r
-            this.lbl_max.Name = "lbl_max";\r
-            this.lbl_max.Size = new System.Drawing.Size(37, 13);\r
-            this.lbl_max.TabIndex = 83;\r
-            this.lbl_max.Text = "{max}";\r
+            // check_customCrop\r
             // \r
-            // lbl_src_res\r
+            this.check_customCrop.AutoSize = true;\r
+            this.tableLayoutPanel3.SetColumnSpan(this.check_customCrop, 5);\r
+            this.check_customCrop.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.check_customCrop.Location = new System.Drawing.Point(0, 26);\r
+            this.check_customCrop.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);\r
+            this.check_customCrop.Name = "check_customCrop";\r
+            this.check_customCrop.Size = new System.Drawing.Size(61, 17);\r
+            this.check_customCrop.TabIndex = 106;\r
+            this.check_customCrop.Text = "Custom";\r
+            this.check_customCrop.UseVisualStyleBackColor = true;\r
             // \r
-            this.lbl_src_res.AutoSize = true;\r
-            this.lbl_src_res.BackColor = System.Drawing.Color.Transparent;\r
-            this.lbl_src_res.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.lbl_src_res.Location = new System.Drawing.Point(66, 36);\r
-            this.lbl_src_res.Name = "lbl_src_res";\r
-            this.lbl_src_res.Size = new System.Drawing.Size(68, 13);\r
-            this.lbl_src_res.TabIndex = 77;\r
-            this.lbl_src_res.Text = "Select a Title";\r
+            // tableLayoutPanel2\r
+            // \r
+            this.tableLayoutPanel2.AutoSize = true;\r
+            this.tableLayoutPanel2.ColumnCount = 5;\r
+            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+            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
+            this.tableLayoutPanel2.Location = new System.Drawing.Point(16, 35);\r
+            this.tableLayoutPanel2.Name = "tableLayoutPanel2";\r
+            this.tableLayoutPanel2.RowCount = 3;\r
+            this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+            this.tableLayoutPanel2.Size = new System.Drawing.Size(376, 69);\r
+            this.tableLayoutPanel2.TabIndex = 116;\r
             // \r
             // label7\r
             // \r
+            this.label7.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.label7.AutoSize = true;\r
             this.label7.BackColor = System.Drawing.Color.Transparent;\r
             this.label7.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.label7.Location = new System.Drawing.Point(13, 35);\r
+            this.label7.Location = new System.Drawing.Point(0, 3);\r
+            this.label7.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);\r
             this.label7.Name = "label7";\r
             this.label7.Size = new System.Drawing.Size(44, 13);\r
             this.label7.TabIndex = 76;\r
             this.label7.Text = "Source:";\r
             // \r
-            // label26\r
-            // \r
-            this.label26.AutoSize = true;\r
-            this.label26.BackColor = System.Drawing.Color.Transparent;\r
-            this.label26.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label26.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.label26.Location = new System.Drawing.Point(13, 13);\r
-            this.label26.Name = "label26";\r
-            this.label26.Size = new System.Drawing.Size(30, 13);\r
-            this.label26.TabIndex = 75;\r
-            this.label26.Text = "Size";\r
-            // \r
-            // lbl_Aspect\r
+            // lbl_src_res\r
             // \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(241, 36);\r
-            this.lbl_Aspect.Name = "lbl_Aspect";\r
-            this.lbl_Aspect.Size = new System.Drawing.Size(68, 13);\r
-            this.lbl_Aspect.TabIndex = 79;\r
-            this.lbl_Aspect.Text = "Select a Title";\r
+            this.lbl_src_res.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
+            this.lbl_src_res.AutoSize = true;\r
+            this.lbl_src_res.BackColor = System.Drawing.Color.Transparent;\r
+            this.lbl_src_res.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.lbl_src_res.Location = new System.Drawing.Point(50, 3);\r
+            this.lbl_src_res.Margin = new System.Windows.Forms.Padding(3);\r
+            this.lbl_src_res.Name = "lbl_src_res";\r
+            this.lbl_src_res.Size = new System.Drawing.Size(15, 13);\r
+            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(152, 35);\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
             this.Label55.AutoSize = true;\r
             this.Label55.BackColor = System.Drawing.Color.Transparent;\r
             this.Label55.ForeColor = System.Drawing.Color.Black;\r
             this.Label55.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
-            this.Label55.Location = new System.Drawing.Point(13, 63);\r
+            this.Label55.Location = new System.Drawing.Point(0, 26);\r
+            this.Label55.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);\r
             this.Label55.Name = "Label55";\r
             this.Label55.Size = new System.Drawing.Size(39, 13);\r
             this.Label55.TabIndex = 80;\r
             this.Label55.Text = "Width:";\r
             // \r
+            // text_width\r
+            // \r
+            this.text_width.Location = new System.Drawing.Point(50, 22);\r
+            this.text_width.Maximum = new decimal(new int[] {\r
+            2560,\r
+            0,\r
+            0,\r
+            0});\r
+            this.text_width.Name = "text_width";\r
+            this.text_width.Size = new System.Drawing.Size(64, 21);\r
+            this.text_width.TabIndex = 85;\r
+            this.text_width.ValueChanged += new System.EventHandler(this.text_width_ValueChanged);\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
+            // \r
+            // label4\r
+            // \r
+            this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
+            this.label4.AutoSize = true;\r
+            this.label4.BackColor = System.Drawing.Color.Transparent;\r
+            this.label4.ForeColor = System.Drawing.Color.Black;\r
+            this.label4.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.label4.Location = new System.Drawing.Point(120, 26);\r
+            this.label4.Margin = new System.Windows.Forms.Padding(3);\r
+            this.label4.Name = "label4";\r
+            this.label4.Size = new System.Drawing.Size(42, 13);\r
+            this.label4.TabIndex = 84;\r
+            this.label4.Text = "Height:";\r
+            // \r
+            // text_height\r
+            // \r
+            this.text_height.Location = new System.Drawing.Point(198, 22);\r
+            this.text_height.Maximum = new decimal(new int[] {\r
+            2560,\r
+            0,\r
+            0,\r
+            0});\r
+            this.text_height.Name = "text_height";\r
+            this.text_height.Size = new System.Drawing.Size(64, 21);\r
+            this.text_height.TabIndex = 86;\r
+            this.text_height.ValueChanged += new System.EventHandler(this.text_height_ValueChanged);\r
+            // \r
+            // check_KeepAR\r
+            // \r
+            this.check_KeepAR.AutoSize = true;\r
+            this.check_KeepAR.Checked = true;\r
+            this.check_KeepAR.CheckState = System.Windows.Forms.CheckState.Checked;\r
+            this.tableLayoutPanel2.SetColumnSpan(this.check_KeepAR, 3);\r
+            this.check_KeepAR.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.check_KeepAR.Location = new System.Drawing.Point(50, 49);\r
+            this.check_KeepAR.Name = "check_KeepAR";\r
+            this.check_KeepAR.Size = new System.Drawing.Size(114, 17);\r
+            this.check_KeepAR.TabIndex = 95;\r
+            this.check_KeepAR.Text = "Keep Aspect Ratio";\r
+            this.check_KeepAR.UseVisualStyleBackColor = true;\r
+            this.check_KeepAR.CheckedChanged += new System.EventHandler(this.check_KeepAR_CheckedChanged);\r
+            // \r
             // tableLayoutPanel1\r
             // \r
             this.tableLayoutPanel1.AutoSize = true;\r
@@ -379,7 +448,7 @@ namespace Handbrake.Controls
             this.tableLayoutPanel1.Controls.Add(this.lbl_modulus, 0, 1);\r
             this.tableLayoutPanel1.Controls.Add(this.lbl_displayWidth, 0, 2);\r
             this.tableLayoutPanel1.Controls.Add(this.drp_modulus, 1, 1);\r
-            this.tableLayoutPanel1.Location = new System.Drawing.Point(16, 108);\r
+            this.tableLayoutPanel1.Location = new System.Drawing.Point(16, 110);\r
             this.tableLayoutPanel1.Name = "tableLayoutPanel1";\r
             this.tableLayoutPanel1.RowCount = 6;\r
             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
@@ -389,7 +458,7 @@ namespace Handbrake.Controls
             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
             this.tableLayoutPanel1.Size = new System.Drawing.Size(195, 154);\r
-            this.tableLayoutPanel1.TabIndex = 110;\r
+            this.tableLayoutPanel1.TabIndex = 115;\r
             // \r
             // updownParHeight\r
             // \r
@@ -402,7 +471,6 @@ namespace Handbrake.Controls
             this.updownParHeight.Name = "updownParHeight";\r
             this.updownParHeight.Size = new System.Drawing.Size(53, 21);\r
             this.updownParHeight.TabIndex = 112;\r
-            this.updownParHeight.ValueChanged += new System.EventHandler(this.text_width_ValueChanged);\r
             // \r
             // label6\r
             // \r
@@ -425,9 +493,9 @@ namespace Handbrake.Controls
             this.labelDisplaySize.Location = new System.Drawing.Point(82, 138);\r
             this.labelDisplaySize.Margin = new System.Windows.Forms.Padding(3);\r
             this.labelDisplaySize.Name = "labelDisplaySize";\r
-            this.labelDisplaySize.Size = new System.Drawing.Size(68, 13);\r
+            this.labelDisplaySize.Size = new System.Drawing.Size(15, 13);\r
             this.labelDisplaySize.TabIndex = 108;\r
-            this.labelDisplaySize.Text = "Select a Title";\r
+            this.labelDisplaySize.Text = "--";\r
             // \r
             // lbl_parHeight\r
             // \r
@@ -466,7 +534,6 @@ namespace Handbrake.Controls
             this.updownParWidth.Name = "updownParWidth";\r
             this.updownParWidth.Size = new System.Drawing.Size(53, 21);\r
             this.updownParWidth.TabIndex = 111;\r
-            this.updownParWidth.ValueChanged += new System.EventHandler(this.text_width_ValueChanged);\r
             // \r
             // drp_anamorphic\r
             // \r
@@ -507,7 +574,6 @@ namespace Handbrake.Controls
             this.updownDisplayWidth.Name = "updownDisplayWidth";\r
             this.updownDisplayWidth.Size = new System.Drawing.Size(53, 21);\r
             this.updownDisplayWidth.TabIndex = 110;\r
-            this.updownDisplayWidth.ValueChanged += new System.EventHandler(this.text_width_ValueChanged);\r
             // \r
             // lbl_modulus\r
             // \r
@@ -550,44 +616,54 @@ namespace Handbrake.Controls
             this.drp_modulus.TabIndex = 88;\r
             this.drp_modulus.SelectedIndexChanged += new System.EventHandler(this.drp_modulus_SelectedIndexChanged);\r
             // \r
+            // label8\r
+            // \r
+            this.label8.AutoSize = true;\r
+            this.label8.BackColor = System.Drawing.Color.Transparent;\r
+            this.label8.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label8.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.label8.Location = new System.Drawing.Point(416, 13);\r
+            this.label8.Name = "label8";\r
+            this.label8.Size = new System.Drawing.Size(57, 13);\r
+            this.label8.TabIndex = 114;\r
+            this.label8.Text = "Cropping";\r
+            // \r
+            // label26\r
+            // \r
+            this.label26.AutoSize = true;\r
+            this.label26.BackColor = System.Drawing.Color.Transparent;\r
+            this.label26.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label26.ImeMode = System.Windows.Forms.ImeMode.NoControl;\r
+            this.label26.Location = new System.Drawing.Point(13, 13);\r
+            this.label26.Name = "label26";\r
+            this.label26.Size = new System.Drawing.Size(30, 13);\r
+            this.label26.TabIndex = 113;\r
+            this.label26.Text = "Size";\r
+            // \r
             // PictureSettings\r
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
             this.BackColor = System.Drawing.Color.Transparent;\r
+            this.Controls.Add(this.tableLayoutPanel3);\r
+            this.Controls.Add(this.tableLayoutPanel2);\r
             this.Controls.Add(this.tableLayoutPanel1);\r
-            this.Controls.Add(this.check_customCrop);\r
-            this.Controls.Add(this.check_autoCrop);\r
-            this.Controls.Add(this.crop_bottom);\r
-            this.Controls.Add(this.crop_top);\r
-            this.Controls.Add(this.crop_left);\r
-            this.Controls.Add(this.crop_right);\r
             this.Controls.Add(this.label8);\r
-            this.Controls.Add(this.Label53);\r
-            this.Controls.Add(this.Label52);\r
-            this.Controls.Add(this.Label51);\r
-            this.Controls.Add(this.Label15);\r
-            this.Controls.Add(this.check_KeepAR);\r
-            this.Controls.Add(this.text_height);\r
-            this.Controls.Add(this.text_width);\r
-            this.Controls.Add(this.label4);\r
-            this.Controls.Add(this.lbl_max);\r
-            this.Controls.Add(this.lbl_src_res);\r
-            this.Controls.Add(this.label7);\r
             this.Controls.Add(this.label26);\r
-            this.Controls.Add(this.lbl_Aspect);\r
-            this.Controls.Add(this.Label91);\r
-            this.Controls.Add(this.Label55);\r
             this.Enabled = false;\r
             this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Name = "PictureSettings";\r
             this.Size = new System.Drawing.Size(666, 279);\r
-            ((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).EndInit();\r
-            ((System.ComponentModel.ISupportInitialize)(this.crop_top)).EndInit();\r
+            this.tableLayoutPanel3.ResumeLayout(false);\r
+            this.tableLayoutPanel3.PerformLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.crop_left)).EndInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.crop_right)).EndInit();\r
-            ((System.ComponentModel.ISupportInitialize)(this.text_height)).EndInit();\r
+            ((System.ComponentModel.ISupportInitialize)(this.crop_top)).EndInit();\r
+            ((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).EndInit();\r
+            this.tableLayoutPanel2.ResumeLayout(false);\r
+            this.tableLayoutPanel2.PerformLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_width)).EndInit();\r
+            ((System.ComponentModel.ISupportInitialize)(this.text_height)).EndInit();\r
             this.tableLayoutPanel1.ResumeLayout(false);\r
             this.tableLayoutPanel1.PerformLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.updownParHeight)).EndInit();\r
@@ -600,27 +676,26 @@ namespace Handbrake.Controls
 \r
         #endregion\r
 \r
-        internal System.Windows.Forms.RadioButton check_customCrop;\r
-        internal System.Windows.Forms.RadioButton check_autoCrop;\r
-        internal System.Windows.Forms.NumericUpDown crop_bottom;\r
-        internal System.Windows.Forms.NumericUpDown crop_top;\r
+        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;\r
+        internal System.Windows.Forms.Label Label15;\r
         internal System.Windows.Forms.NumericUpDown crop_left;\r
         internal System.Windows.Forms.NumericUpDown crop_right;\r
-        internal System.Windows.Forms.Label label8;\r
+        internal System.Windows.Forms.RadioButton check_autoCrop;\r
+        internal System.Windows.Forms.Label Label51;\r
+        internal System.Windows.Forms.NumericUpDown crop_top;\r
         internal System.Windows.Forms.Label Label53;\r
         internal System.Windows.Forms.Label Label52;\r
-        internal System.Windows.Forms.Label Label51;\r
-        internal System.Windows.Forms.Label Label15;\r
-        internal System.Windows.Forms.CheckBox check_KeepAR;\r
-        internal System.Windows.Forms.NumericUpDown text_height;\r
-        internal System.Windows.Forms.Label label4;\r
-        private System.Windows.Forms.Label lbl_max;\r
-        internal System.Windows.Forms.Label lbl_src_res;\r
+        internal System.Windows.Forms.NumericUpDown crop_bottom;\r
+        internal System.Windows.Forms.RadioButton check_customCrop;\r
+        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;\r
         internal System.Windows.Forms.Label label7;\r
-        internal System.Windows.Forms.Label label26;\r
-        internal System.Windows.Forms.Label lbl_Aspect;\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
         internal System.Windows.Forms.NumericUpDown updownParHeight;\r
         internal System.Windows.Forms.Label label6;\r
@@ -634,7 +709,11 @@ namespace Handbrake.Controls
         internal System.Windows.Forms.Label lbl_modulus;\r
         internal System.Windows.Forms.Label lbl_displayWidth;\r
         internal System.Windows.Forms.ComboBox drp_modulus;\r
+        internal System.Windows.Forms.Label label8;\r
+        internal System.Windows.Forms.Label label26;\r
         internal System.Windows.Forms.NumericUpDown text_width;\r
+        internal System.Windows.Forms.NumericUpDown text_height;\r
+\r
 \r
 \r
     }\r
index 096ccad..d3196ae 100644 (file)
@@ -1,6 +1,7 @@
 using System;\r
 using System.ComponentModel;\r
 using System.Drawing;\r
+using System.Globalization;\r
 using System.Windows.Forms;\r
 using Handbrake.Parsing;\r
 \r
@@ -8,13 +9,13 @@ namespace Handbrake.Controls
 {\r
     public partial class PictureSettings : UserControl\r
     {\r
-        private bool _preventChangingWidth, _preventChangingHeight;\r
-        private int _maxWidth, _maxHeight, _lastEncodeWidth, _lastEncodeHeight;\r
-        private double _anamorphicRatio, _displayRatio;\r
-        private Title _title;\r
-        private double storageAspect;\r
+        private readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
         public event EventHandler PictureSettingsChanged;\r
 \r
+        private Boolean preventChangingWidth, preventChangingHeight;\r
+        private int _PresetMaximumWidth, _PresetMaximumHeight;\r
+        private Title _SourceTitle;\r
+\r
         public PictureSettings()\r
         {\r
             InitializeComponent();\r
@@ -30,356 +31,161 @@ namespace Handbrake.Controls
         [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
         public Title Source\r
         {\r
-            get { return _title; }\r
+            get { return _SourceTitle; }\r
             set\r
             {\r
-                _title = value;\r
-                _displayRatio = ((double)_title.Resolution.Width * _title.ParVal.Width / _title.ParVal.Height) / _title.Resolution.Height;\r
-\r
-                Enabled = _title != null;\r
-\r
-                MaximumWidth = _title.Resolution.Width;\r
-                MaximumHeight = _title.Resolution.Height;\r
-\r
-                updownParWidth.Value = _title.ParVal.Width;\r
-                updownParHeight.Value = _title.ParVal.Height;\r
-\r
-                // Set the source resolution\r
-                lbl_src_res.Text = Source.Resolution.Width + " x " + Source.Resolution.Height;\r
-\r
-                // Set ratios\r
-                _anamorphicRatio = (double)Source.Resolution.Width / Source.Resolution.Height;\r
-\r
-                // Set the encode width and height\r
-                EncodeWidth = _title.Resolution.Width;\r
-                EncodeHeight = _title.Resolution.Height;\r
-\r
-                _lastEncodeWidth = _title.Resolution.Width;\r
-                _lastEncodeHeight = _title.Resolution.Height;\r
-\r
-                // Set cropping\r
-                CroppingValues = _title.AutoCropDimensions;\r
-\r
-                lbl_Aspect.Text = _title.AspectRatio.ToString();\r
-\r
-                UpdateAnamorphicValue();\r
-            }\r
-        }\r
+                _SourceTitle = value;\r
+                Enabled = _SourceTitle != null;\r
 \r
-        /// <summary>\r
-        /// Gets or sets the resolution of the displayed video.\r
-        /// </summary>\r
-        public Size DisplayResolution { get; set; }\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
-        public int EncodeWidth { get { return (int)text_width.Value; } set { text_width.Value = value; } }\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
-        public int EncodeHeight { get { return (int)text_height.Value; } set { text_height.Value = value; } }\r
+                // Set the Resolution Boxes\r
+                text_width.Value = _SourceTitle.Resolution.Width;\r
 \r
-        public int[] CroppingValues\r
-        {\r
-            get\r
-            {\r
-                return new int[4]\r
+                if (drp_anamorphic.SelectedIndex == 0)\r
                 {\r
-                    (int)crop_top.Value,\r
-                    (int)crop_bottom.Value,\r
-                    (int)crop_left.Value,\r
-                    (int)crop_right.Value\r
-                };\r
-            }\r
-            set\r
-            {\r
-                if (value.Length != 4)\r
+                    int width = _SourceTitle.Resolution.Width;\r
+\r
+                    double crop_width = _SourceTitle.Resolution.Width - (double)crop_left.Value - (double)crop_right.Value;\r
+                    double crop_height = _SourceTitle.Resolution.Height - (double)crop_top.Value - (double)crop_bottom.Value;\r
+                    double newHeight = (width * _SourceTitle.Resolution.Width * sourceAspect.Height * crop_height) / (_SourceTitle.Resolution.Height * sourceAspect.Width * crop_width);\r
+                    text_height.Value = (decimal)GetModulusValue(newHeight);\r
+                }\r
+                else\r
                 {\r
-                    throw new ArgumentException("The cropping values given must have a length of 4.");\r
+                    text_height.Value = _SourceTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
+                    labelDisplaySize.Text = calculateAnamorphicSizes().Width + "x" + calculateAnamorphicSizes().Height;\r
                 }\r
 \r
-                crop_top.Value = value[0];\r
-                crop_bottom.Value = value[1];\r
-                crop_left.Value = value[2];\r
-                crop_right.Value = value[3];\r
-            }\r
-        }\r
+                updownParWidth.Value = _SourceTitle.ParVal.Width;\r
+                updownParHeight.Value = _SourceTitle.ParVal.Height;\r
+                updownDisplayWidth.Value = calculateAnamorphicSizes().Width;\r
 \r
-        /// <summary>\r
-        /// Gets or sets the maximum allowable width of the encoded video.\r
-        /// </summary>\r
-        public int MaximumWidth\r
-        {\r
-            get { return _maxWidth; }\r
-            set\r
-            {\r
-                _maxWidth = value > 0 ? value : (Source != null ? Source.Resolution.Width : 2560);\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets the maximum allowable height of the encoded video.\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 int MaximumHeight\r
+        [Browsable(false)]\r
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
+        public Size PresetMaximumResolution\r
         {\r
-            get { return _maxHeight; }\r
+            get { return new Size(_PresetMaximumWidth, _PresetMaximumHeight); }\r
             set\r
             {\r
-                _maxHeight = value > 0 ? value : (Source != null ? Source.Resolution.Height : 2560);\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 = "";\r
             }\r
-        }      \r
-\r
-        public void setMax()\r
-        {\r
-\r
         }\r
 \r
-        /// <summary>\r
-        /// Updates the anamorphic value shown as the display width.\r
-        /// </summary>\r
-        private void UpdateAnamorphicValue()\r
+        // Picture Controls\r
+        private void text_width_ValueChanged(object sender, EventArgs e)\r
         {\r
-            if (_title == null || _title.ParVal.IsEmpty)\r
+            if (preventChangingWidth)\r
                 return;\r
 \r
-            // Set globally useful values\r
-            double width;\r
-            double par;\r
+            // Make sure the new value doesn't exceed the maximum\r
+            if (Source != null)\r
+                if (text_width.Value > Source.Resolution.Width)\r
+                    text_width.Value = Source.Resolution.Width;\r
 \r
             switch (drp_anamorphic.SelectedIndex)\r
             {\r
-                case 2:\r
-                    int actualWidth = (int)text_width.Value - (int)crop_left.Value - (int)crop_right.Value;\r
-                    int source_display_width = Source.Resolution.Width * Source.ParVal.Width / Source.ParVal.Height;\r
-                    int source_cropped_height = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
-                    par = ((double) text_height.Value*source_display_width/source_cropped_height)/actualWidth;\r
-                    width = (actualWidth * par);\r
-                    width = Math.Truncate(width);\r
-                    break;\r
-                default:\r
+                case 0:\r
+                    if (check_KeepAR.Checked && Source != null)\r
                     {\r
-                        if (drp_anamorphic.SelectedIndex == 1) // Strict\r
-                            par = (double)Source.ParVal.Width / Source.ParVal.Height;\r
-                        else // Custom\r
-                            par = (double)updownParWidth.Value / (double)updownParHeight.Value;\r
+                        preventChangingHeight = true;\r
+\r
+                        int width = (int)text_width.Value;\r
 \r
-                        // Store the latest DAR\r
-                        double rawWidth = (double)text_width.Value * par;\r
-                        _displayRatio = rawWidth / (double)text_height.Value;\r
+                        double crop_width = Source.Resolution.Width - (double)crop_left.Value - (double)crop_right.Value;\r
+                        double crop_height = Source.Resolution.Height - (double)crop_top.Value - (double)crop_bottom.Value;\r
+                        double newHeight = (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
-                        width = (int)Math.Round(rawWidth);\r
-                        break;\r
+                        preventChangingHeight = false;\r
                     }\r
+                    break;\r
+                default:\r
+                    labelDisplaySize.Text = calculateAnamorphicSizes().Width + "x" + calculateAnamorphicSizes().Height;\r
+                    break;\r
             }\r
 \r
-            labelDisplaySize.Text = width + " x " + text_height.Value;\r
-\r
-            updownDisplayWidth.Value = (decimal)width;\r
-            updownParWidth.Value = (decimal)width;\r
-            updownParHeight.Value = text_width.Value;\r
-        }\r
-\r
-        /// <summary>\r
-        /// Sets the visibility of the advanced anamorphic options.\r
-        /// </summary>\r
-        /// <param name="value">Whether or not the options should be visible.</param>\r
-        private void SetCustomAnamorphicOptionsVisible(bool visible)\r
-        {\r
-            lbl_modulus.Visible = visible;\r
-            lbl_displayWidth.Visible = visible;\r
-            lbl_parWidth.Visible = visible;\r
-            lbl_parHeight.Visible = visible;\r
-\r
-            drp_modulus.Visible = visible;\r
-            updownDisplayWidth.Visible = visible;\r
-            updownParWidth.Visible = visible;\r
-            updownParHeight.Visible = visible;\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets the normalized value from one given by the user that is divisible by the number\r
-        /// set in <see cref="_modulus"/>.\r
-        /// </summary>\r
-        /// <param name="value">The value to normalize</param>\r
-        /// <returns>A number that is divisible by <see cref="_modulus"/>.</returns>\r
-        /// <remarks>\r
-        /// The way that some video codecs, such as x264, compress video is by creating "macroblocks" \r
-        /// that are seperated into defined squares, often 16x16 pixels. Because of this, if the width \r
-        /// and height of the encoded video are not each divisible by the modulus defined, video quality\r
-        /// will suffer. This method takes the supplied value and normalizes it to the nearest mutliple\r
-        /// of <see cref="_modulus"/>.\r
-        /// </remarks>\r
-        private int GetModulusValue(int value)\r
-        {\r
-            int mod = int.Parse(drp_modulus.SelectedItem.ToString());\r
-            int remainder = value % mod;\r
-\r
-            if (remainder == 0)\r
-                return value;\r
-\r
-            return remainder >= mod / 2 ? value + (mod - remainder) : value - remainder;\r
-        }\r
-\r
-        private void ApplyStrictAnamorphic()\r
-        {\r
-            if (_anamorphicRatio == 0)\r
-                return;\r
-\r
-            _preventChangingWidth = true;\r
-            _preventChangingHeight = true;\r
-\r
-            text_width.Value = _title.Resolution.Width;\r
-            text_height.Value = _title.Resolution.Height;\r
-\r
-            _preventChangingWidth = false;\r
-            _preventChangingHeight = false;\r
-        }\r
-\r
-        /// <summary>\r
-        /// Loosely anamorphs encode width and height values.\r
-        /// </summary>\r
-        private void ApplyLooseAnamorphic()\r
-        {\r
-            // Prevents DivideByZeroExceptions\r
-            if (_anamorphicRatio == 0)\r
-                return;\r
-\r
-            int actualWidth = (int)text_width.Value - (int)crop_left.Value - (int)crop_right.Value;\r
-            int source_cropped_height = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
-\r
-            if (storageAspect == 0)\r
-                storageAspect = (double)actualWidth / source_cropped_height;\r
-            double hcalc = (actualWidth / storageAspect) + 0.5;\r
-            double newHeight = GetModulusValue((int)hcalc);\r
-\r
-            text_width.Value = GetModulusValue((int)text_width.Value);\r
-            text_height.Value = (decimal)newHeight;\r
-\r
-            UpdateAnamorphicValue();\r
-        }\r
-\r
-        /// <summary>\r
-        /// Anamorphs encode width and height based on the custom options specified.\r
-        /// </summary>\r
-        private void ApplyCustomAnamorphic(Control ctrlUpdated)\r
-        {\r
-            // Make sure the PAR values are set correctly\r
-            if (updownParWidth.Value == 0)\r
-                updownParWidth.Value = Source.ParVal.Width;\r
-            if (updownParHeight.Value == 0)\r
-                updownParHeight.Value = Source.ParVal.Height;\r
-\r
-            // Set various values\r
-            int parWidth = (int)updownParWidth.Value;\r
-            int parHeight = (int)updownParHeight.Value;\r
-\r
-            if (!check_KeepAR.Checked)\r
-            {\r
-                switch (ctrlUpdated.Name)\r
-                {\r
-                    case "text_width":\r
-                    case "updownParWidth":\r
-                    case "updownParHeight":\r
-                        updownDisplayWidth.Value = Math.Round(text_width.Value * parWidth / parHeight);\r
-                        break;\r
-                    case "updownDisplayWidth":\r
-                        updownParWidth.Value = updownDisplayWidth.Value;\r
-                        updownParHeight.Value = text_width.Value;\r
-                        break;\r
-                }\r
-            }\r
-            else\r
-            {\r
-                switch (ctrlUpdated.Name)\r
-                {\r
-                    case "updownDisplayWidth":\r
-                        _preventChangingHeight = true;\r
-\r
-                        text_height.Value = GetModulusValue((int)((double)updownDisplayWidth.Value / _displayRatio));\r
-\r
-                        _preventChangingHeight = false;\r
-                        goto case "text_width";\r
-                    case "text_height":\r
-                        updownDisplayWidth.Value = GetModulusValue((int)((double)text_width.Value * _anamorphicRatio * _displayRatio));\r
-                        goto case "text_width";\r
-                    case "text_width":\r
-                        updownParWidth.Value = updownDisplayWidth.Value;\r
-                        updownParHeight.Value = text_width.Value;\r
-                        break;\r
-                }\r
-            }\r
+            preventChangingWidth = false;\r
         }\r
-\r
-\r
-\r
-        private void text_width_ValueChanged(object sender, EventArgs e)\r
+        private void text_height_ValueChanged(object sender, EventArgs e)\r
         {\r
-            if (_preventChangingWidth)\r
+            if (preventChangingHeight)\r
                 return;\r
 \r
-            _preventChangingWidth = true;\r
-\r
-            if (text_width.Value > MaximumWidth)\r
-            {\r
-                text_width.Value = MaximumWidth;\r
-            }\r
+            if (Source != null)\r
+                if (text_height.Value > Source.Resolution.Height)\r
+                    text_height.Value = Source.Resolution.Height;\r
 \r
             switch (drp_anamorphic.SelectedIndex)\r
             {\r
                 case 0:\r
-                    if (check_KeepAR.Checked)\r
+                    if (check_KeepAR.Checked && Source != null)\r
                     {\r
-                        _preventChangingHeight = true;\r
+                        preventChangingWidth = true;\r
+\r
+                        double crop_width = Source.Resolution.Width - (double)crop_left.Value - (double)crop_right.Value;\r
+                        double crop_height = Source.Resolution.Height - (double)crop_top.Value - (double)crop_bottom.Value;\r
 \r
-                        decimal newHeight = text_width.Value / (decimal)_anamorphicRatio;\r
-                        text_height.Value = newHeight > MaximumHeight ? MaximumHeight : newHeight;\r
+                        double new_width = ((double)text_height.Value * Source.Resolution.Height * sourceAspect.Width * crop_width) /\r
+                                            (Source.Resolution.Width * sourceAspect.Height * crop_height);\r
 \r
-                        _preventChangingHeight = false;\r
+                        text_width.Value = (decimal)GetModulusValue(new_width);\r
+\r
+                        preventChangingWidth = false;\r
                     }\r
                     break;\r
-                case 1:\r
-                    ApplyStrictAnamorphic();\r
-                    break;\r
-                case 2:\r
-                    ApplyLooseAnamorphic();\r
-                    break;\r
-                case 3:\r
-                    ApplyCustomAnamorphic((Control)sender);\r
+                default:\r
+                    labelDisplaySize.Text = calculateAnamorphicSizes().Width + "x" + calculateAnamorphicSizes().Height;\r
                     break;\r
             }\r
 \r
-            _preventChangingWidth = false;\r
+            preventChangingHeight = false;\r
         }\r
-\r
-        private void text_height_ValueChanged(object sender, EventArgs e)\r
+        private void check_KeepAR_CheckedChanged(object sender, EventArgs e)\r
         {\r
-            if (_preventChangingHeight)\r
-                return;\r
-\r
-            _preventChangingHeight = true;\r
-\r
-            if (text_height.Value > MaximumHeight)\r
-            {\r
-                text_height.Value = MaximumHeight;\r
-            }\r
+            //Force TextWidth to recalc height\r
+            if (check_KeepAR.Checked)\r
+                text_width_ValueChanged(this, new EventArgs());\r
 \r
-            switch (drp_anamorphic.SelectedIndex)\r
+            // Disable the Custom Anamorphic Par Controls if checked.\r
+            if (drp_anamorphic.SelectedIndex == 3)\r
             {\r
-                case 0:\r
-                    if (check_KeepAR.Checked)\r
-                    {\r
-                        _preventChangingWidth = true;\r
-\r
-                        decimal newWidth = text_height.Value * (decimal)_anamorphicRatio;\r
-                        text_width.Value = newWidth > MaximumWidth ? MaximumWidth : newWidth;\r
-\r
-                        _preventChangingWidth = false;\r
-                    }\r
-                    break;\r
-                case 3:\r
-                    ApplyCustomAnamorphic((Control)sender);\r
-                    break;\r
+                updownParWidth.Enabled = !check_KeepAR.Checked;\r
+                updownParHeight.Enabled = !check_KeepAR.Checked;\r
             }\r
 \r
-            _preventChangingHeight = false;\r
+            // Raise the Picture Settings Changed Event\r
+            if (PictureSettingsChanged != null)\r
+                PictureSettingsChanged(this, new EventArgs());\r
         }\r
 \r
+        // Anamorphic Controls\r
         private void drp_anamorphic_SelectedIndexChanged(object sender, EventArgs e)\r
         {\r
             switch (drp_anamorphic.SelectedIndex)\r
@@ -389,20 +195,26 @@ namespace Handbrake.Controls
                     text_height.Enabled = true;\r
                     check_KeepAR.Enabled = true;\r
 \r
-                    SetCustomAnamorphicOptionsVisible(false);\r
+                    setCustomAnamorphicOptionsVisible(false);\r
                     labelStaticDisplaySize.Visible = false;\r
                     labelDisplaySize.Visible = false;\r
 \r
                     check_KeepAR.Checked = true;\r
-                    break;\r
+                    drp_modulus.SelectedIndex = 0;\r
+\r
+                    if (check_KeepAR.Checked)\r
+                        text_width_ValueChanged(this, new EventArgs());\r
+                    // Don't update display size if we're not using anamorphic\r
+                    return;\r
                 case 1:\r
                     text_width.Enabled = false;\r
                     text_height.Enabled = false;\r
                     check_KeepAR.Enabled = false;\r
 \r
-                    SetCustomAnamorphicOptionsVisible(false);\r
+                    setCustomAnamorphicOptionsVisible(false);\r
                     labelStaticDisplaySize.Visible = true;\r
                     labelDisplaySize.Visible = true;\r
+                    drp_modulus.SelectedIndex = 0;\r
 \r
                     check_KeepAR.Checked = true;\r
                     break;\r
@@ -411,9 +223,10 @@ namespace Handbrake.Controls
                     text_height.Enabled = false;\r
                     check_KeepAR.Enabled = false;\r
 \r
-                    SetCustomAnamorphicOptionsVisible(false);\r
+                    setCustomAnamorphicOptionsVisible(false);\r
                     labelStaticDisplaySize.Visible = true;\r
                     labelDisplaySize.Visible = true;\r
+                    drp_modulus.SelectedIndex = 0;\r
 \r
                     check_KeepAR.Checked = true;\r
                     break;\r
@@ -422,7 +235,7 @@ namespace Handbrake.Controls
                     text_height.Enabled = true;\r
                     check_KeepAR.Enabled = true;\r
 \r
-                    SetCustomAnamorphicOptionsVisible(true);\r
+                    setCustomAnamorphicOptionsVisible(true);\r
                     labelStaticDisplaySize.Visible = true;\r
                     labelDisplaySize.Visible = true;\r
 \r
@@ -430,30 +243,33 @@ namespace Handbrake.Controls
                     break;\r
             }\r
 \r
-            UpdateAnamorphicValue();\r
-        }\r
+            labelDisplaySize.Text = calculateAnamorphicSizes().Width + "x" + calculateAnamorphicSizes().Height;\r
 \r
-        private void check_KeepAR_CheckedChanged(object sender, EventArgs e)\r
-        {\r
-            if (drp_anamorphic.SelectedIndex != 3)\r
-            {\r
-                if (check_KeepAR.Checked)\r
-                {\r
-                    text_width_ValueChanged(this, new EventArgs());\r
-                }\r
-            }\r
-            else\r
-            {\r
-                updownParWidth.Enabled = !check_KeepAR.Checked;\r
-                updownParHeight.Enabled = !check_KeepAR.Checked;\r
-            }\r
-        }\r
+            if (check_KeepAR.Checked)\r
+                text_width_ValueChanged(this, new EventArgs());\r
 \r
-        private void crop_ValueChanged(object sender, EventArgs e)\r
+            if (PictureSettingsChanged != null)\r
+                PictureSettingsChanged(this, new EventArgs());\r
+        }\r
+        private void drp_modulus_SelectedIndexChanged(object sender, EventArgs e)\r
         {\r
-            text_width_ValueChanged(this, new EventArgs());\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
+\r
+            text_width.Increment = int.Parse(drp_modulus.SelectedItem.ToString());\r
+            text_height.Increment = int.Parse(drp_modulus.SelectedItem.ToString());\r
+\r
+            if (PictureSettingsChanged != null)\r
+                PictureSettingsChanged(this, new EventArgs());\r
         }\r
 \r
+        // Cropping Controls\r
         private void check_autoCrop_CheckedChanged(object sender, EventArgs e)\r
         {\r
             crop_top.Enabled = check_customCrop.Checked;\r
@@ -461,11 +277,120 @@ namespace Handbrake.Controls
             crop_left.Enabled = check_customCrop.Checked;\r
             crop_right.Enabled = check_customCrop.Checked;\r
         }\r
+        private void crop_ValueChanged(object sender, EventArgs e)\r
+        {\r
+            text_width_ValueChanged(this, new EventArgs());\r
+        }\r
 \r
-        private void drp_modulus_SelectedIndexChanged(object sender, EventArgs e)\r
+        // GUI Functions\r
+        private void setCustomAnamorphicOptionsVisible(bool visible)\r
         {\r
-            text_width.Increment = int.Parse(drp_modulus.SelectedItem.ToString());\r
-            text_height.Increment = int.Parse(drp_modulus.SelectedItem.ToString());\r
+            lbl_modulus.Visible = visible;\r
+            lbl_displayWidth.Visible = visible;\r
+            lbl_parWidth.Visible = visible;\r
+            lbl_parHeight.Visible = visible;\r
+\r
+            drp_modulus.Visible = visible;\r
+            updownDisplayWidth.Visible = visible;\r
+            updownParWidth.Visible = visible;\r
+            updownParHeight.Visible = visible;\r
+        }\r
+\r
+        // Calculation Functions\r
+        private Size sourceAspect\r
+        {\r
+            get\r
+            {\r
+                if (Source != null)\r
+                {\r
+                    if (Source.AspectRatio == 1.78F)\r
+                        return new Size(16, 9);\r
+                    if (Source.AspectRatio == 1.33F)\r
+                        return new Size(4, 3);\r
+                }\r
+                return new Size(0, 0);\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
+\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
+\r
+                /*\r
+                     3 different ways of deciding output dimensions:\r
+                      - 1: Strict anamorphic, preserve source dimensions\r
+                      - 2: Loose anamorphic, round to mod16 and preserve storage aspect ratio\r
+                      - 3: Power user anamorphic, specify everything\r
+                  */\r
+                double width, height;\r
+                switch (drp_anamorphic.SelectedIndex)\r
+                {\r
+                    case 1:\r
+                        /* Strict anamorphic */\r
+                        double displayWidth = ((double)cropped_width * Source.ParVal.Width / Source.ParVal.Height);\r
+                        displayWidth = Math.Round(displayWidth, 0);\r
+                        Size output = new Size((int)displayWidth, cropped_height);\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 - (int)crop_left.Value - (int)crop_right.Value;\r
+                        width = GetModulusValue(width); /* Time to get picture width that divide cleanly.*/\r
+\r
+                        height = (width / storage_aspect) + 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
+\r
+                        double disWidthLoose = (width * pixel_aspect_width / pixel_aspect_height);\r
+                        return new Size((int)disWidthLoose, (int)height);\r
+                    case 3:\r
+\r
+                        // Get the User Interface Values\r
+                        double UIdisplayWidth;\r
+                        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
+\r
+                        if (check_KeepAR.Checked)\r
+                            return new Size((int)Math.Truncate(UIdisplayWidth), (int)height);\r
+\r
+                        return new Size((int)Math.Truncate(UIdisplayWidth), (int)height);\r
+                }\r
+            }\r
+\r
+            // Return a default value of 0,0 to indicate failure\r
+            return new Size(0, 0);\r
+        }\r
+        private double GetModulusValue(double value)\r
+        {\r
+            int mod = int.Parse(drp_modulus.SelectedItem.ToString());\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
+        }\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
-}\r
+}
\ No newline at end of file
index 051f309..1366414 100644 (file)
@@ -5,6 +5,7 @@
           It may be used under the terms of the GNU General Public License. */\r
 \r
 using System;\r
+using System.Drawing;\r
 using System.Windows.Forms;\r
 \r
 namespace Handbrake.Functions\r
@@ -82,7 +83,7 @@ namespace Handbrake.Functions
                     mainWindow.PictureSettings.crop_right.Value = right;\r
                 }\r
             }\r
-\r
+            \r
             // Set the anamorphic mode 0,1,2,3\r
             mainWindow.PictureSettings.drp_anamorphic.SelectedIndex = presetQuery.AnamorphicMode;\r
 \r
@@ -98,16 +99,12 @@ namespace Handbrake.Functions
 \r
             // Max Width/Height override Width/Height\r
             if (presetQuery.MaxWidth != 0)\r
-            {\r
                 mainWindow.PictureSettings.text_width.Value = presetQuery.MaxWidth;\r
-                mainWindow.PictureSettings.MaximumWidth = presetQuery.MaxWidth;\r
-            }\r
 \r
             if (presetQuery.MaxHeight != 0)\r
-            {\r
                 mainWindow.PictureSettings.text_height.Value = presetQuery.MaxHeight;\r
-                mainWindow.PictureSettings.MaximumHeight = presetQuery.MaxHeight;\r
-            }\r
+\r
+            mainWindow.PictureSettings.PresetMaximumResolution = new Size(presetQuery.MaxWidth, presetQuery.MaxHeight);\r
 \r
             // Case where both height and max height are 0 - For built-in presets\r
             if (presetQuery.MaxHeight == 0 && presetQuery.Height == 0)\r
@@ -117,8 +114,6 @@ namespace Handbrake.Functions
                 if (mainWindow.selectedTitle != null && mainWindow.selectedTitle.Resolution.Width != 0)\r
                     mainWindow.PictureSettings.text_width.Value = mainWindow.selectedTitle.Resolution.Width;\r
 \r
-            mainWindow.PictureSettings.setMax();\r
-\r
             // Custom Anamorphic Controls\r
             mainWindow.PictureSettings.updownDisplayWidth.Text = presetQuery.displayWidthValue.ToString();\r
             mainWindow.PictureSettings.updownParHeight.Text = presetQuery.pixelAspectWidth.ToString();\r
index bb80c1e..a6c59ee 100644 (file)
@@ -119,30 +119,30 @@ namespace Handbrake.Functions
             #region Picture Settings Tab\r
 \r
             // Use MaxWidth for built-in presets and width for user settings.\r
-            if (mainWindow.PictureSettings.MaximumWidth == 0)\r
+            if (mainWindow.PictureSettings.PresetMaximumResolution.Width == 0)\r
             {\r
-                if (mainWindow.PictureSettings.text_width.Text != "")\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
             else\r
             {\r
-                if (mainWindow.PictureSettings.text_width.Text != "")\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
 \r
             // Use MaxHeight for built-in presets and height for user settings.\r
-            if (mainWindow.PictureSettings.MaximumHeight == 0)\r
+            if (mainWindow.PictureSettings.PresetMaximumResolution.Height == 0)\r
             {\r
-                if (mainWindow.PictureSettings.text_height.Text != "0")\r
+                if (mainWindow.PictureSettings.text_height.Value != 0)\r
                     if (mainWindow.PictureSettings.text_height.Text != "")\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
             else\r
             {\r
-                if (mainWindow.PictureSettings.text_height.Text != "")\r
+                if (mainWindow.PictureSettings.text_height.Value != 0)\r
                     if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3)\r
                         query += " -Y " + mainWindow.PictureSettings.text_height.Text;\r
             }\r
index 2ddc303..acd18f3 100644 (file)
@@ -896,19 +896,8 @@ namespace Handbrake
             // \r
             // PictureSettings\r
             // \r
-            this.PictureSettings.CroppingValues = new int[] {\r
-        0,\r
-        0,\r
-        0,\r
-        0};\r
-            this.PictureSettings.DisplayResolution = new System.Drawing.Size(0, 0);\r
             this.PictureSettings.Enabled = false;\r
-            this.PictureSettings.EncodeHeight = 0;\r
-            this.PictureSettings.EncodeWidth = 0;\r
             this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
-            this.PictureSettings.MaximumHeight = 2560;\r
-            this.PictureSettings.MaximumWidth = 2560;\r
             this.PictureSettings.Name = "PictureSettings";\r
             this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
             this.PictureSettings.TabIndex = 0;\r
index 428e3ae..684bd97 100644 (file)
@@ -207,7 +207,7 @@ namespace Handbrake
             check_optimiseMP4.CheckedChanged += new EventHandler(changePresetLabel);\r
 \r
             // Picture Settings\r
-            PictureSettings.PictureSettingsChanged += new EventHandler(changePresetLabel);\r
+            //PictureSettings.PictureSettingsChanged += new EventHandler(changePresetLabel);\r
 \r
             // Filter Settings\r
             Filters.FilterSettingsChanged += new EventHandler(changePresetLabel);\r
@@ -235,7 +235,7 @@ namespace Handbrake
             check_optimiseMP4.CheckedChanged -= new EventHandler(changePresetLabel);\r
 \r
             // Picture Settings\r
-            PictureSettings.PictureSettingsChanged -= new EventHandler(changePresetLabel);\r
+            //PictureSettings.PictureSettingsChanged -= new EventHandler(changePresetLabel);\r
 \r
             // Filter Settings\r
             Filters.FilterSettingsChanged -= new EventHandler(changePresetLabel);\r
@@ -629,7 +629,7 @@ namespace Handbrake
             }\r
             else\r
             {\r
-                if (encodeQueue.count() != 0 || (!string.IsNullOrEmpty(sourcePath) && string.IsNullOrEmpty(text_destination.Text)))\r
+                if (encodeQueue.count() != 0 || (!string.IsNullOrEmpty(sourcePath) && !string.IsNullOrEmpty(text_destination.Text)))\r
                 {\r
                     String query = rtf_query.Text != "" ? rtf_query.Text : queryGen.generateTheQuery(this);\r
 \r