From 2b3ac1f2ae64e8591ffa6f3485bd131b8ff7d9ef Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 7 Jun 2009 23:04:05 +0000 Subject: WinGui: - Checkin of the new picutre settings panel (before I end up accidentally losing working code) - Modes: None, Strict and Loose work (mostly). Custom does not work (yet) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2497 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/PictureSettings.Designer.cs | 569 ++++++++++++++++++++++ win/C#/Controls/PictureSettings.cs | 729 ++++++++++++++++++++++++++++ win/C#/Controls/PictureSettings.resx | 120 +++++ win/C#/EncodeQueue/Encode.cs | 1 + win/C#/Functions/PresetLoader.cs | 32 +- win/C#/Functions/QueryGenerator.cs | 63 ++- win/C#/Functions/QueryParser.cs | 1 - win/C#/HandBrakeCS.csproj | 10 + win/C#/Installer/Installer.nsi | 6 +- win/C#/Parsing/Title.cs | 20 +- win/C#/frmMain.Designer.cs | 486 +++---------------- win/C#/frmMain.cs | 123 +---- 12 files changed, 1580 insertions(+), 580 deletions(-) create mode 100644 win/C#/Controls/PictureSettings.Designer.cs create mode 100644 win/C#/Controls/PictureSettings.cs create mode 100644 win/C#/Controls/PictureSettings.resx (limited to 'win/C#') diff --git a/win/C#/Controls/PictureSettings.Designer.cs b/win/C#/Controls/PictureSettings.Designer.cs new file mode 100644 index 000000000..a5a79d85a --- /dev/null +++ b/win/C#/Controls/PictureSettings.Designer.cs @@ -0,0 +1,569 @@ +using System.Windows.Forms; + +namespace Handbrake.Controls +{ + partial class PictureSettings + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.text_height = new System.Windows.Forms.NumericUpDown(); + this.text_width = new System.Windows.Forms.NumericUpDown(); + this.label4 = new System.Windows.Forms.Label(); + this.lbl_max = new System.Windows.Forms.Label(); + this.lbl_src_res = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.drp_anamorphic = new System.Windows.Forms.ComboBox(); + this.label26 = new System.Windows.Forms.Label(); + this.lbl_Aspect = new System.Windows.Forms.Label(); + this.Label91 = new System.Windows.Forms.Label(); + this.Label55 = new System.Windows.Forms.Label(); + this.lbl_modulus = new System.Windows.Forms.Label(); + this.drop_modulus = new System.Windows.Forms.ComboBox(); + this.txt_displayWidth = new System.Windows.Forms.TextBox(); + this.lbl_displayWidth = new System.Windows.Forms.Label(); + this.lbl_parWidth = new System.Windows.Forms.Label(); + this.txt_parWidth = new System.Windows.Forms.TextBox(); + this.lbl_parHeight = new System.Windows.Forms.Label(); + this.txt_parHeight = new System.Windows.Forms.TextBox(); + this.check_KeepAR = new System.Windows.Forms.CheckBox(); + this.check_customCrop = new System.Windows.Forms.RadioButton(); + this.check_autoCrop = new System.Windows.Forms.RadioButton(); + this.crop_bottom = new System.Windows.Forms.NumericUpDown(); + this.crop_top = new System.Windows.Forms.NumericUpDown(); + this.crop_left = new System.Windows.Forms.NumericUpDown(); + this.crop_right = new System.Windows.Forms.NumericUpDown(); + this.label8 = new System.Windows.Forms.Label(); + this.Label53 = new System.Windows.Forms.Label(); + this.Label52 = new System.Windows.Forms.Label(); + this.Label51 = new System.Windows.Forms.Label(); + this.Label15 = new System.Windows.Forms.Label(); + this.lbl_anamorphic = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.text_height)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.text_width)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.crop_top)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.crop_left)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.crop_right)).BeginInit(); + this.SuspendLayout(); + // + // text_height + // + this.text_height.Location = new System.Drawing.Point(206, 59); + this.text_height.Maximum = new decimal(new int[] { + 2560, + 0, + 0, + 0}); + this.text_height.Minimum = new decimal(new int[] { + 64, + 0, + 0, + 0}); + this.text_height.Name = "text_height"; + this.text_height.Size = new System.Drawing.Size(64, 20); + this.text_height.TabIndex = 50; + this.text_height.Value = new decimal(new int[] { + 64, + 0, + 0, + 0}); + this.text_height.ValueChanged += new System.EventHandler(this.text_height_ValueChanged); + // + // text_width + // + this.text_width.Location = new System.Drawing.Point(68, 59); + this.text_width.Maximum = new decimal(new int[] { + 2560, + 0, + 0, + 0}); + this.text_width.Minimum = new decimal(new int[] { + 64, + 0, + 0, + 0}); + this.text_width.Name = "text_width"; + this.text_width.Size = new System.Drawing.Size(64, 20); + this.text_width.TabIndex = 49; + this.text_width.Value = new decimal(new int[] { + 64, + 0, + 0, + 0}); + this.text_width.ValueChanged += new System.EventHandler(this.text_width_ValueChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.BackColor = System.Drawing.Color.Transparent; + this.label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.ForeColor = System.Drawing.Color.Black; + this.label4.Location = new System.Drawing.Point(152, 63); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(48, 13); + this.label4.TabIndex = 48; + this.label4.Text = "Height:"; + // + // lbl_max + // + this.lbl_max.AutoSize = true; + this.lbl_max.Location = new System.Drawing.Point(273, 80); + this.lbl_max.Name = "lbl_max"; + this.lbl_max.Size = new System.Drawing.Size(34, 13); + this.lbl_max.TabIndex = 47; + this.lbl_max.Text = "{max}"; + // + // lbl_src_res + // + this.lbl_src_res.AutoSize = true; + this.lbl_src_res.BackColor = System.Drawing.Color.Transparent; + this.lbl_src_res.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_src_res.Location = new System.Drawing.Point(66, 36); + this.lbl_src_res.Name = "lbl_src_res"; + this.lbl_src_res.Size = new System.Drawing.Size(72, 12); + this.lbl_src_res.TabIndex = 41; + this.lbl_src_res.Text = "Select a Title"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.BackColor = System.Drawing.Color.Transparent; + this.label7.Location = new System.Drawing.Point(13, 35); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(44, 13); + this.label7.TabIndex = 40; + this.label7.Text = "Source:"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.BackColor = System.Drawing.Color.Transparent; + this.label6.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label6.Location = new System.Drawing.Point(13, 91); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(80, 13); + this.label6.TabIndex = 45; + this.label6.Text = "Anamorphic:"; + // + // drp_anamorphic + // + this.drp_anamorphic.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.drp_anamorphic.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.drp_anamorphic.FormattingEnabled = true; + this.drp_anamorphic.Items.AddRange(new object[] { + "None", + "Strict", + "Loose", + "Custom"}); + this.drp_anamorphic.Location = new System.Drawing.Point(109, 88); + this.drp_anamorphic.Name = "drp_anamorphic"; + this.drp_anamorphic.Size = new System.Drawing.Size(110, 21); + this.drp_anamorphic.TabIndex = 46; + this.drp_anamorphic.SelectedIndexChanged += new System.EventHandler(this.drp_anamorphic_SelectedIndexChanged); + // + // label26 + // + this.label26.AutoSize = true; + this.label26.BackColor = System.Drawing.Color.Transparent; + this.label26.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label26.Location = new System.Drawing.Point(13, 13); + this.label26.Name = "label26"; + this.label26.Size = new System.Drawing.Size(34, 13); + this.label26.TabIndex = 39; + this.label26.Text = "Size"; + // + // lbl_Aspect + // + this.lbl_Aspect.AutoSize = true; + this.lbl_Aspect.BackColor = System.Drawing.Color.Transparent; + this.lbl_Aspect.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_Aspect.Location = new System.Drawing.Point(241, 36); + this.lbl_Aspect.Name = "lbl_Aspect"; + this.lbl_Aspect.Size = new System.Drawing.Size(72, 12); + this.lbl_Aspect.TabIndex = 43; + this.lbl_Aspect.Text = "Select a Title"; + // + // Label91 + // + this.Label91.AutoSize = true; + this.Label91.BackColor = System.Drawing.Color.Transparent; + this.Label91.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label91.Location = new System.Drawing.Point(152, 35); + this.Label91.Name = "Label91"; + this.Label91.Size = new System.Drawing.Size(83, 13); + this.Label91.TabIndex = 42; + this.Label91.Text = "Aspect Ratio:"; + // + // Label55 + // + this.Label55.AutoSize = true; + this.Label55.BackColor = System.Drawing.Color.Transparent; + this.Label55.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label55.ForeColor = System.Drawing.Color.Black; + this.Label55.Location = new System.Drawing.Point(13, 63); + this.Label55.Name = "Label55"; + this.Label55.Size = new System.Drawing.Size(44, 13); + this.Label55.TabIndex = 44; + this.Label55.Text = "Width:"; + // + // lbl_modulus + // + this.lbl_modulus.AutoSize = true; + this.lbl_modulus.BackColor = System.Drawing.Color.Transparent; + this.lbl_modulus.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_modulus.Location = new System.Drawing.Point(13, 118); + this.lbl_modulus.Name = "lbl_modulus"; + this.lbl_modulus.Size = new System.Drawing.Size(58, 13); + this.lbl_modulus.TabIndex = 51; + this.lbl_modulus.Text = "Modulus:"; + // + // drop_modulus + // + this.drop_modulus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.drop_modulus.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.drop_modulus.FormattingEnabled = true; + this.drop_modulus.Items.AddRange(new object[] { + "16", + "8", + "4", + "2"}); + this.drop_modulus.Location = new System.Drawing.Point(109, 115); + this.drop_modulus.Name = "drop_modulus"; + this.drop_modulus.Size = new System.Drawing.Size(110, 21); + this.drop_modulus.TabIndex = 52; + // + // txt_displayWidth + // + this.txt_displayWidth.Location = new System.Drawing.Point(109, 142); + this.txt_displayWidth.Name = "txt_displayWidth"; + this.txt_displayWidth.Size = new System.Drawing.Size(100, 20); + this.txt_displayWidth.TabIndex = 53; + this.txt_displayWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_displayWidth_Keyup); + // + // lbl_displayWidth + // + this.lbl_displayWidth.AutoSize = true; + this.lbl_displayWidth.BackColor = System.Drawing.Color.Transparent; + this.lbl_displayWidth.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_displayWidth.Location = new System.Drawing.Point(13, 145); + this.lbl_displayWidth.Name = "lbl_displayWidth"; + this.lbl_displayWidth.Size = new System.Drawing.Size(90, 13); + this.lbl_displayWidth.TabIndex = 54; + this.lbl_displayWidth.Text = "Display Width:"; + // + // lbl_parWidth + // + this.lbl_parWidth.AutoSize = true; + this.lbl_parWidth.BackColor = System.Drawing.Color.Transparent; + this.lbl_parWidth.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_parWidth.Location = new System.Drawing.Point(13, 171); + this.lbl_parWidth.Name = "lbl_parWidth"; + this.lbl_parWidth.Size = new System.Drawing.Size(71, 13); + this.lbl_parWidth.TabIndex = 56; + this.lbl_parWidth.Text = "PAR Width:"; + // + // txt_parWidth + // + this.txt_parWidth.Location = new System.Drawing.Point(109, 168); + this.txt_parWidth.Name = "txt_parWidth"; + this.txt_parWidth.Size = new System.Drawing.Size(100, 20); + this.txt_parWidth.TabIndex = 55; + this.txt_parWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_parWidth_Keyup); + // + // lbl_parHeight + // + this.lbl_parHeight.AutoSize = true; + this.lbl_parHeight.BackColor = System.Drawing.Color.Transparent; + this.lbl_parHeight.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_parHeight.Location = new System.Drawing.Point(13, 197); + this.lbl_parHeight.Name = "lbl_parHeight"; + this.lbl_parHeight.Size = new System.Drawing.Size(75, 13); + this.lbl_parHeight.TabIndex = 58; + this.lbl_parHeight.Text = "PAR Height:"; + // + // txt_parHeight + // + this.txt_parHeight.Location = new System.Drawing.Point(109, 194); + this.txt_parHeight.Name = "txt_parHeight"; + this.txt_parHeight.Size = new System.Drawing.Size(100, 20); + this.txt_parHeight.TabIndex = 57; + this.txt_parHeight.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_parHeight_Keyup); + // + // check_KeepAR + // + this.check_KeepAR.AutoSize = true; + this.check_KeepAR.Location = new System.Drawing.Point(276, 60); + this.check_KeepAR.Name = "check_KeepAR"; + this.check_KeepAR.Size = new System.Drawing.Size(69, 17); + this.check_KeepAR.TabIndex = 59; + this.check_KeepAR.Text = "Keep AR"; + this.check_KeepAR.UseVisualStyleBackColor = true; + this.check_KeepAR.CheckedChanged += new System.EventHandler(this.check_KeepAR_CheckedChanged); + // + // check_customCrop + // + this.check_customCrop.AutoSize = true; + this.check_customCrop.Location = new System.Drawing.Point(387, 57); + this.check_customCrop.Name = "check_customCrop"; + this.check_customCrop.Size = new System.Drawing.Size(63, 17); + this.check_customCrop.TabIndex = 70; + this.check_customCrop.Text = "Custom:"; + this.check_customCrop.UseVisualStyleBackColor = true; + this.check_customCrop.CheckedChanged += new System.EventHandler(this.check_customCrop_CheckedChanged); + // + // check_autoCrop + // + this.check_autoCrop.AutoSize = true; + this.check_autoCrop.Checked = true; + this.check_autoCrop.Location = new System.Drawing.Point(387, 33); + this.check_autoCrop.Name = "check_autoCrop"; + this.check_autoCrop.Size = new System.Drawing.Size(72, 17); + this.check_autoCrop.TabIndex = 69; + this.check_autoCrop.TabStop = true; + this.check_autoCrop.Text = "Automatic"; + this.check_autoCrop.UseVisualStyleBackColor = true; + this.check_autoCrop.CheckedChanged += new System.EventHandler(this.check_autoCrop_CheckedChanged); + // + // crop_bottom + // + this.crop_bottom.Enabled = false; + this.crop_bottom.Location = new System.Drawing.Point(467, 146); + this.crop_bottom.Maximum = new decimal(new int[] { + 1080, + 0, + 0, + 0}); + this.crop_bottom.Name = "crop_bottom"; + this.crop_bottom.Size = new System.Drawing.Size(44, 20); + this.crop_bottom.TabIndex = 67; + // + // crop_top + // + this.crop_top.Enabled = false; + this.crop_top.Location = new System.Drawing.Point(467, 100); + this.crop_top.Maximum = new decimal(new int[] { + 1080, + 0, + 0, + 0}); + this.crop_top.Name = "crop_top"; + this.crop_top.Size = new System.Drawing.Size(44, 20); + this.crop_top.TabIndex = 64; + // + // crop_left + // + this.crop_left.Enabled = false; + this.crop_left.Location = new System.Drawing.Point(416, 122); + this.crop_left.Maximum = new decimal(new int[] { + 1920, + 0, + 0, + 0}); + this.crop_left.Name = "crop_left"; + this.crop_left.Size = new System.Drawing.Size(44, 20); + this.crop_left.TabIndex = 62; + // + // crop_right + // + this.crop_right.Enabled = false; + this.crop_right.Location = new System.Drawing.Point(518, 122); + this.crop_right.Maximum = new decimal(new int[] { + 1920, + 0, + 0, + 0}); + this.crop_right.Name = "crop_right"; + this.crop_right.Size = new System.Drawing.Size(44, 20); + this.crop_right.TabIndex = 65; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.BackColor = System.Drawing.Color.Transparent; + this.label8.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label8.Location = new System.Drawing.Point(384, 13); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(37, 13); + this.label8.TabIndex = 60; + this.label8.Text = "Crop"; + // + // Label53 + // + this.Label53.AutoSize = true; + this.Label53.BackColor = System.Drawing.Color.Transparent; + this.Label53.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label53.Location = new System.Drawing.Point(465, 170); + this.Label53.Name = "Label53"; + this.Label53.Size = new System.Drawing.Size(48, 13); + this.Label53.TabIndex = 68; + this.Label53.Text = "Bottom"; + // + // Label52 + // + this.Label52.AutoSize = true; + this.Label52.BackColor = System.Drawing.Color.Transparent; + this.Label52.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label52.Location = new System.Drawing.Point(474, 85); + this.Label52.Name = "Label52"; + this.Label52.Size = new System.Drawing.Size(28, 13); + this.Label52.TabIndex = 63; + this.Label52.Text = "Top"; + // + // Label51 + // + this.Label51.AutoSize = true; + this.Label51.BackColor = System.Drawing.Color.Transparent; + this.Label51.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label51.Location = new System.Drawing.Point(561, 124); + this.Label51.Name = "Label51"; + this.Label51.Size = new System.Drawing.Size(36, 13); + this.Label51.TabIndex = 66; + this.Label51.Text = "Right"; + // + // Label15 + // + this.Label15.AutoSize = true; + this.Label15.BackColor = System.Drawing.Color.Transparent; + this.Label15.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label15.Location = new System.Drawing.Point(384, 124); + this.Label15.Name = "Label15"; + this.Label15.Size = new System.Drawing.Size(28, 13); + this.Label15.TabIndex = 61; + this.Label15.Text = "Left"; + // + // lbl_anamorphic + // + this.lbl_anamorphic.AutoSize = true; + this.lbl_anamorphic.BackColor = System.Drawing.Color.Transparent; + this.lbl_anamorphic.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_anamorphic.Location = new System.Drawing.Point(107, 222); + this.lbl_anamorphic.Name = "lbl_anamorphic"; + this.lbl_anamorphic.Size = new System.Drawing.Size(72, 12); + this.lbl_anamorphic.TabIndex = 74; + this.lbl_anamorphic.Text = "Select a Title"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.BackColor = System.Drawing.Color.Transparent; + this.label3.Location = new System.Drawing.Point(13, 221); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(66, 13); + this.label3.TabIndex = 73; + this.label3.Text = "Anamorphic:"; + // + // PictureSettings + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.lbl_anamorphic); + this.Controls.Add(this.label3); + this.Controls.Add(this.check_customCrop); + this.Controls.Add(this.check_autoCrop); + this.Controls.Add(this.crop_bottom); + this.Controls.Add(this.crop_top); + this.Controls.Add(this.crop_left); + this.Controls.Add(this.crop_right); + this.Controls.Add(this.label8); + this.Controls.Add(this.Label53); + this.Controls.Add(this.Label52); + this.Controls.Add(this.Label51); + this.Controls.Add(this.Label15); + this.Controls.Add(this.check_KeepAR); + this.Controls.Add(this.lbl_parHeight); + this.Controls.Add(this.txt_parHeight); + this.Controls.Add(this.lbl_parWidth); + this.Controls.Add(this.txt_parWidth); + this.Controls.Add(this.lbl_displayWidth); + this.Controls.Add(this.txt_displayWidth); + this.Controls.Add(this.lbl_modulus); + this.Controls.Add(this.drop_modulus); + this.Controls.Add(this.text_height); + this.Controls.Add(this.text_width); + this.Controls.Add(this.label4); + this.Controls.Add(this.lbl_max); + this.Controls.Add(this.lbl_src_res); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.drp_anamorphic); + this.Controls.Add(this.label26); + this.Controls.Add(this.lbl_Aspect); + this.Controls.Add(this.Label91); + this.Controls.Add(this.Label55); + this.Name = "PictureSettings"; + this.Size = new System.Drawing.Size(666, 279); + ((System.ComponentModel.ISupportInitialize)(this.text_height)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.text_width)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.crop_top)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.crop_left)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.crop_right)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + internal System.Windows.Forms.Label label4; + private System.Windows.Forms.Label lbl_max; + internal System.Windows.Forms.Label lbl_src_res; + internal System.Windows.Forms.Label label7; + internal System.Windows.Forms.Label label6; + internal System.Windows.Forms.ComboBox drp_anamorphic; + internal System.Windows.Forms.Label label26; + internal System.Windows.Forms.Label lbl_Aspect; + internal System.Windows.Forms.Label Label91; + internal System.Windows.Forms.Label Label55; + internal System.Windows.Forms.Label lbl_modulus; + internal System.Windows.Forms.ComboBox drop_modulus; + internal System.Windows.Forms.Label lbl_displayWidth; + internal System.Windows.Forms.Label lbl_parWidth; + internal System.Windows.Forms.Label lbl_parHeight; + internal System.Windows.Forms.RadioButton check_customCrop; + internal System.Windows.Forms.RadioButton check_autoCrop; + internal System.Windows.Forms.NumericUpDown crop_bottom; + internal System.Windows.Forms.NumericUpDown crop_top; + internal System.Windows.Forms.NumericUpDown crop_left; + internal System.Windows.Forms.NumericUpDown crop_right; + internal System.Windows.Forms.Label label8; + internal System.Windows.Forms.Label Label53; + internal System.Windows.Forms.Label Label52; + internal System.Windows.Forms.Label Label51; + internal System.Windows.Forms.Label Label15; + internal System.Windows.Forms.NumericUpDown text_height; + internal System.Windows.Forms.NumericUpDown text_width; + internal System.Windows.Forms.TextBox txt_displayWidth; + internal System.Windows.Forms.TextBox txt_parWidth; + internal System.Windows.Forms.TextBox txt_parHeight; + internal System.Windows.Forms.CheckBox check_KeepAR; + internal System.Windows.Forms.Label lbl_anamorphic; + internal System.Windows.Forms.Label label3; + + } +} diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs new file mode 100644 index 000000000..77be0dbc6 --- /dev/null +++ b/win/C#/Controls/PictureSettings.cs @@ -0,0 +1,729 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using Handbrake.Parsing; + +namespace Handbrake.Controls +{ + /* + * ***** WARNING ***** + * This file is incomplete. + * - Custom Anamorphic mode does not work. + * - Several Out of bound exceptions on the numeric up down width/height inputs need fixed. + * - Code needs cleaned up and a ton of bugs probably need fixed. + */ + + + + /* + * DISPLAY WIDTH STORAGE WIDTH PIXEL WIDTH + * HEIGHT KEEP ASPECT PIXEL HEIGHT + * + * --- NOT KEEPING DISPLAY ASPECT --- + * Changing STORAGE WIDTH changes DISPLAY WIDTH to STORAGE WIDTH * PIXEL WIDTH / PIXEL HEIGHT + * Changing PIXEL dimensions changes DISPLAY WIDTH to STORAGE WIDTH * PIXEL WIDTH / PIXEL HEIGHT + * Changing DISPLAY WIDTH changes PIXEL WIDTH to DISPLAY WIDTH and PIXEL HEIGHT to STORAGE WIDTH + * Changing HEIGHT just....changes the height. + * + * --- KEEPING DISPLAY ASPECT RATIO --- + * DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification) + * Disable editing: PIXEL WIDTH, PIXEL HEIGHT + * Changing DISPLAY WIDTH: + * Changes HEIGHT to keep DAR + * Changes PIXEL WIDTH to new DISPLAY WIDTH + * Changes PIXEL HEIGHT to STORAGE WIDTH + * Changing HEIGHT + * Changes DISPLAY WIDTH to keep DAR + * Changes PIXEL WIDTH to new DISPLAY WIDTH + * Changes PIXEL HEIGHT to STORAGE WIDTH + * Changing STORAGE_WIDTH: + * Changes PIXEL WIDTH to DISPLAY WIDTH + * Changes PIXEL HEIGHT to new STORAGE WIDTH + */ + + public partial class PictureSettings : UserControl + { + // Globals + int maxWidth, maxHeight; + int widthVal, heightVal; + private double darValue; + private double storageAspect = 0; // Storage Aspect Cache for current source and title + public Title selectedTitle { get; set; } + private Boolean heightChangeGuard; + private Boolean looseAnamorphicHeightGuard; + + // Window Setup + public PictureSettings() + { + InitializeComponent(); + lbl_max.Text = ""; + drop_modulus.SelectedIndex = 0; + storageAspect = 0; + } + public void setComponentsAfterScan(Title st) + { + storageAspect = 0; + selectedTitle = st; + // Set the Aspect Ratio + lbl_Aspect.Text = selectedTitle.AspectRatio.ToString(); + lbl_src_res.Text = selectedTitle.Resolution.Width + " x " + selectedTitle.Resolution.Height; + + // Set the Recommended Cropping values + crop_top.Text = selectedTitle.AutoCropDimensions[0].ToString(); + crop_bottom.Text = selectedTitle.AutoCropDimensions[1].ToString(); + crop_left.Text = selectedTitle.AutoCropDimensions[2].ToString(); + crop_right.Text = selectedTitle.AutoCropDimensions[3].ToString(); + + + // Set the Resolution Boxes + text_width.Value = selectedTitle.Resolution.Width; + text_height.Value = cacluateHeight(selectedTitle.Resolution.Width); + + if (drp_anamorphic.SelectedIndex == 3) + { + txt_parWidth.Text = selectedTitle.ParVal.Width.ToString(); + txt_parHeight.Text = selectedTitle.ParVal.Height.ToString(); + txt_displayWidth.Text = displayWidth().ToString(); + } + } + public void setMax() + { + if (maxWidth != 0 && maxHeight != 0) + lbl_max.Text = "Max Width / Height"; + else if (maxWidth != 0) + lbl_max.Text = "Max Width"; + else + lbl_max.Text = ""; + } + + // Basic Picture Setting Controls + private void text_width_ValueChanged(object sender, EventArgs e) + { + // Get the Modulus + int mod; + int.TryParse(drop_modulus.SelectedItem.ToString(), out mod); + + // Increase or decrease value by the correct mod. + text_width.Value = widthChangeMod(mod); + + // Mode Switch + switch (drp_anamorphic.SelectedIndex) + { + case 0: + if (calculateUnchangeValue(true) != -1) + text_height.Value = calculateUnchangeValue(true); + break; + case 1: + lbl_anamorphic.Text = strictAnamorphic(); + break; + case 2: + lbl_anamorphic.Text = looseAnamorphic(); + break; + case 3: + customAnamorphic(text_width); + break; + } + + } + private void text_height_ValueChanged(object sender, EventArgs e) + { + // Get the Modulus + int mod; + int.TryParse(drop_modulus.SelectedItem.ToString(), out mod); + + // Increase or decrease value by the correct mod. + if (drp_anamorphic.SelectedIndex != 2) + { + decimal val = heightChangeMod(mod); + heightChangeGuard = true; + if (text_height.Value != val) + { + heightChangeGuard = false; + text_height.Value = val; + } + } + + // Mode Switch + switch (drp_anamorphic.SelectedIndex) + { + case 0: + if (drp_anamorphic.SelectedIndex != 3) + { + if (calculateUnchangeValue(false) != -1) + text_width.Value = calculateUnchangeValue(false); + } + break; + case 1: + lbl_anamorphic.Text = strictAnamorphic(); + break; + case 2: + if (!looseAnamorphicHeightGuard) + lbl_anamorphic.Text = looseAnamorphic(); + break; + case 3: + if (!heightChangeGuard) + customAnamorphic(text_height); + break; + } + heightChangeGuard = false; + looseAnamorphicHeightGuard = false; + } + private void check_KeepAR_CheckedChanged(object sender, EventArgs e) + { + // Recalculate Height based on width when enabled + if (drp_anamorphic.SelectedIndex != 3 && check_KeepAR.Checked && selectedTitle != null) + text_height.Value = cacluateHeight(widthVal); + + // Enable Par Width/Height Check boxes if Keep AR is enabled, otherwise disable them + if (check_KeepAR.Checked) + { + txt_parWidth.Enabled = false; + txt_parHeight.Enabled = false; + } + else + { + txt_parWidth.Enabled = true; + txt_parHeight.Enabled = true; + } + } + private void drp_anamorphic_SelectedIndexChanged(object sender, EventArgs e) + { + switch (drp_anamorphic.SelectedIndex) + { + case 0: // None + text_height.BackColor = Color.White; + text_width.BackColor = Color.White; + text_height.Enabled = true; + text_width.Enabled = true; + check_KeepAR.CheckState = CheckState.Checked; + check_KeepAR.Enabled = true; + disableCustomAnaControls(); + text_width.Text = widthVal.ToString(); + text_height.Text = heightVal.ToString(); + check_KeepAR.Enabled = true; + lbl_anamorphic.Text = ""; + break; + case 1: // Strict + text_height.BackColor = Color.LightGray; + text_width.BackColor = Color.LightGray; + text_height.Text = ""; + text_width.Text = ""; + text_height.Enabled = false; + text_width.Enabled = false; + check_KeepAR.CheckState = CheckState.Unchecked; + check_KeepAR.Enabled = false; + disableCustomAnaControls(); + lbl_anamorphic.Text = strictAnamorphic(); + break; + case 2: // Loose + storageAspect = 0; + text_width.Text = widthVal.ToString(); + text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; + text_height.Enabled = false; + text_height.BackColor = Color.LightGray; + text_width.Enabled = true; + text_width.BackColor = Color.White; + disableCustomAnaControls(); + lbl_anamorphic.Text = looseAnamorphic(); + break; + case 3: // Custom + + // Display Elements + enableCustomAnaControls(); + text_height.BackColor = Color.White; + text_width.BackColor = Color.White; + text_height.Enabled = true; + text_width.Enabled = true; + + // Actual Work + text_width.Text = widthVal.ToString(); + text_height.Text = cacluateHeight(widthVal).ToString(); // Bug here + + txt_parWidth.Text = selectedTitle.ParVal.Width.ToString(); + txt_parHeight.Text = selectedTitle.ParVal.Height.ToString(); + txt_displayWidth.Text = displayWidth().ToString(); + + darValue = calculateDar(); + + check_KeepAR.CheckState = CheckState.Checked; + check_KeepAR.Enabled = true; + + + break; + } + } + + // Custom Anamorphic Controls + private void txt_displayWidth_Keyup(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + customAnamorphic(txt_displayWidth); + } + private void txt_parHeight_Keyup(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + customAnamorphic(txt_parHeight); + } + private void txt_parWidth_Keyup(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + customAnamorphic(txt_parWidth); + } + + // Cropping Control + private void check_autoCrop_CheckedChanged(object sender, EventArgs e) + { + crop_left.Enabled = false; + crop_right.Enabled = false; + crop_top.Enabled = false; + crop_bottom.Enabled = false; + } + private void check_customCrop_CheckedChanged(object sender, EventArgs e) + { + crop_left.Enabled = true; + crop_right.Enabled = true; + crop_top.Enabled = true; + crop_bottom.Enabled = true; + if (selectedTitle != null) + { + crop_top.Text = selectedTitle.AutoCropDimensions[0].ToString(); + crop_bottom.Text = selectedTitle.AutoCropDimensions[1].ToString(); + crop_left.Text = selectedTitle.AutoCropDimensions[2].ToString(); + crop_right.Text = selectedTitle.AutoCropDimensions[3].ToString(); + } + else + { + crop_left.Text = "0"; + crop_right.Text = "0"; + crop_top.Text = "0"; + crop_bottom.Text = "0"; + } + } + + // Custom Anamorphic Code + private void customAnamorphic(Control control) + { + // Get and parse all the required values + int cropLeft = (int)crop_left.Value; + int cropRight = (int)crop_right.Value; + + int width = (int)text_width.Value; + int cropped_width = width - cropLeft - cropRight; + + int mod = 16; + int.TryParse(drop_modulus.SelectedItem.ToString(), out mod); + + int parW, parH; + double displayWidth; + int.TryParse(txt_parWidth.Text, out parW); + int.TryParse(txt_parHeight.Text, out parH); + double.TryParse(txt_displayWidth.Text, out displayWidth); + + /* NOT KEEPING DISPLAY ASPECT + * Changing STORAGE WIDTH changes DISPLAY WIDTH to STORAGE WIDTH * PIXEL WIDTH / PIXEL HEIGHT + * Changing PIXEL dimensions changes DISPLAY WIDTH to STORAGE WIDTH * PIXEL WIDTH / PIXEL HEIGHT + * Changing DISPLAY WIDTH changes PIXEL WIDTH to DISPLAY WIDTH and PIXEL HEIGHT to STORAGE WIDTH + * Changing HEIGHT just....changes the height. + */ + if (!check_KeepAR.Checked) + { + switch (control.Name) // TODO Check if CroppedWidth or just Width + { + case "text_width": + double dw = (double)cropped_width * parW / parH; + txt_displayWidth.Text = dw.ToString(); + break; + case "txt_parWidth": + double dwpw = (double)cropped_width * parW / parH; + txt_displayWidth.Text = dwpw.ToString(); + break; + case "txt_parHeight": + double dwph = (double)cropped_width * parW / parH; + txt_displayWidth.Text = dwph.ToString(); + break; + case "txt_displayWidth": + txt_parWidth.Text = txt_displayWidth.Text; + txt_parHeight.Text = text_width.Text; + break; + } + } + + /* + * KEEPING DISPLAY ASPECT RATIO + * DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification) + * Disable editing: PIXEL WIDTH, PIXEL HEIGHT + * Changing DISPLAY WIDTH: + * Changes HEIGHT to keep DAR + * Changes PIXEL WIDTH to new DISPLAY WIDTH + * Changes PIXEL HEIGHT to STORAGE WIDTH + * Changing HEIGHT + * Changes DISPLAY WIDTH to keep DAR + * Changes PIXEL WIDTH to new DISPLAY WIDTH + * Changes PIXEL HEIGHT to STORAGE WIDTH + * Changing STORAGE_WIDTH: + * Changes PIXEL WIDTH to DISPLAY WIDTH + * Changes PIXEL HEIGHT to new STORAGE WIDTH + */ + + if (check_KeepAR.Checked) + { + switch (control.Name) + { + case "txt_displayWidth": + heightChangeGuard = true; + text_height.Value = (decimal)getHeightKeepDar(); //Changes HEIGHT to keep DAR + txt_parWidth.Text = txt_displayWidth.Text; + txt_parHeight.Text = cropped_width.ToString(); + break; + case "text_height": + heightChangeGuard = true; + txt_displayWidth.Text = getDisplayWidthKeepDar().ToString(); //Changes DISPLAY WIDTH to keep DAR + txt_parWidth.Text = txt_displayWidth.Text; + txt_parHeight.Text = cropped_width.ToString(); + break; + case "text_width": + txt_parWidth.Text = txt_displayWidth.Text; + txt_parHeight.Text = cropped_width.ToString(); + break; + } + } + } + private double getDisplayWidthKeepDar() + { + double displayWidth; + double.TryParse(txt_displayWidth.Text, out displayWidth); + double currentDar = calculateDar(); + double newDwValue = displayWidth; + + // Correct display width up or down to correct for dar. + if (currentDar > darValue) + { + while (currentDar > darValue) + { + displayWidth--; + newDwValue = displayWidth; + currentDar = calculateDarByVal(text_height.Value, displayWidth); + } + } + else + { + while (currentDar < darValue) + { + displayWidth++; + newDwValue = displayWidth; + currentDar = calculateDarByVal(text_height.Value, displayWidth); + } + } + + darValue = calculateDar(); // Cache the dar value + return newDwValue; + } + private double getHeightKeepDar() + { + double displayWidth; + double.TryParse(txt_displayWidth.Text, out displayWidth); + double currentDar = calculateDar(); + double newHeightVal = heightVal; + + // Correct display width up or down. + if (currentDar > darValue) + { + while (currentDar > darValue) + { + heightVal++; + newHeightVal = heightVal; + currentDar = calculateDarByVal(heightVal, displayWidth); + } + } + else + { + while (currentDar < darValue) + { + heightVal--; + newHeightVal = heightVal; + currentDar = calculateDarByVal(heightVal, displayWidth); + } + } + + darValue = calculateDar(); // Cache the dar value + return newHeightVal; + } + private double calculateDar() + { + // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification) + int cropTop = (int)crop_top.Value; + int cropBottom = (int)crop_bottom.Value; + int croppedHeight = (int)text_height.Value - cropTop - cropBottom; + + double displayWidth; + double.TryParse(txt_displayWidth.Text, out displayWidth); + + double calculatedDar = displayWidth / croppedHeight; + + return calculatedDar; + } + private double calculateDarByVal(decimal height, double displayWidth) + { + // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification) + int cropTop = (int)crop_top.Value; + int cropBottom = (int)crop_bottom.Value; + int croppedHeight = (int)height - cropTop - cropBottom; + + double calculatedDar = darValue; + if (croppedHeight > 0) + calculatedDar = displayWidth / croppedHeight; + + return calculatedDar; + } + private int displayWidth() + { + if (selectedTitle != null) + { + int actualWidth = (int)text_width.Value; + int displayWidth = 0; + int parW, parH; + + int.TryParse(txt_parWidth.Text, out parW); + int.TryParse(txt_parHeight.Text, out parH); + + if (drp_anamorphic.SelectedIndex != 3) + displayWidth = (actualWidth * selectedTitle.ParVal.Width / selectedTitle.ParVal.Height); + else if (parW > 0 && parH > 0) + displayWidth = (actualWidth * parW / parH); + + return displayWidth; + } + return -1; + } + + // Resolution calculation and controls + private decimal widthChangeMod(int mod) + { + // Increase or decrease the height based on the users input. + decimal returnVal = text_width.Value > widthVal ? getResolutionJump(mod, text_width.Value, true) : getResolutionJump(mod, text_width.Value, false); + + // Make sure we don't go above source value + if (selectedTitle != null) + if (selectedTitle.Resolution.Width < returnVal) + returnVal = selectedTitle.Resolution.Width; + + // Set the global tracker + widthVal = (int)returnVal; + + return returnVal; + } + private decimal heightChangeMod(int mod) + { + // Increase or decrease the height based on the users input. + decimal returnVal = text_height.Value > heightVal ? getResolutionJump(mod, text_height.Value, true) : getResolutionJump(mod, text_height.Value, false); + + // Make sure we don't go above source value + if (selectedTitle != null) + if (selectedTitle.Resolution.Height < returnVal) + returnVal = selectedTitle.Resolution.Height; + + // Set the global tracker + heightVal = (int)returnVal; // TODO THIS IS CAUSING PROBLEM + + return returnVal; + } + private decimal calculateUnchangeValue(Boolean widthChangeFromControl) + { + decimal newValue = -1; + if (selectedTitle != null && drp_anamorphic.SelectedIndex != 3 && drp_anamorphic.SelectedIndex != 2) + if (widthChangeFromControl) + newValue = cacluateHeight(widthVal); + else + { + if (check_KeepAR.Checked) + newValue = cacluateWidth(heightVal); + } + + return newValue; + } + private int getResolutionJump(int mod, decimal value, Boolean up) + { + if (up) + while ((value % mod) != 0) + value++; + else + while ((value % mod) != 0) + value--; + + return (int)value; + } + private double getModulusAuto(int mod, double value) + { + int modDiv2 = mod / 2; + + if ((value % mod) != 0) + { + double modVal = (int)value % mod; + if (modVal >= modDiv2) + { + modVal = 16 - modVal; + value = (int)value + (int)modVal; + } + else + { + value = (int)value - (int)modVal; + } + } + return value; + } + private int cacluateHeight(int width) + { + int aw = 0; + int ah = 0; + if (selectedTitle.AspectRatio.ToString() == "1.78") + { + aw = 16; + ah = 9; + } + else if (selectedTitle.AspectRatio.ToString() == "1.33") + { + aw = 4; + ah = 3; + } + + if (aw != 0) + { + // Crop_Width = Title->Width - crop_Left - crop_right + // Crop_Height = Title->Height - crop_top - crop_bottom + double crop_width = selectedTitle.Resolution.Width - (double)crop_left.Value - (double)crop_right.Value; + double crop_height = selectedTitle.Resolution.Height - (double)crop_top.Value - (double)crop_bottom.Value; + + double new_height = (width * selectedTitle.Resolution.Width * ah * crop_height) / + (selectedTitle.Resolution.Height * aw * crop_width); + + if (drp_anamorphic.SelectedIndex == 3) + new_height = getModulusAuto(int.Parse(drop_modulus.SelectedItem.ToString()), new_height); + else + new_height = getModulusAuto(16, new_height); + + //16 * (421 / 16) + //double z = ( 16 * (( y + 8 ) / 16 ) ); + int x = int.Parse(new_height.ToString()); + if (x < 64) + x = 64; + return x; + } + return 0; + } + private int cacluateWidth(int height) + { + int aw = 0; + int ah = 0; + if (selectedTitle.AspectRatio.ToString() == "1.78") + { + aw = 16; + ah = 9; + } + else if (selectedTitle.AspectRatio.ToString() == "1.33") + { + aw = 4; + ah = 3; + } + + if (aw != 0) + { + + double crop_width = selectedTitle.Resolution.Width - (double)crop_left.Value - (double)crop_right.Value; + double crop_height = selectedTitle.Resolution.Height - (double)crop_top.Value - (double)crop_bottom.Value; + + double new_width = (height * selectedTitle.Resolution.Height * aw * crop_width) / + (selectedTitle.Resolution.Width * ah * crop_height); + + if (drp_anamorphic.SelectedIndex == 3) + new_width = getModulusAuto(int.Parse(drop_modulus.SelectedItem.ToString()), new_width); + else + new_width = getModulusAuto(16, new_width); + + //16 * (421 / 16) + //double z = ( 16 * (( y + 8 ) / 16 ) ); + int x = int.Parse(new_width.ToString()); + return x; + } + return 0; + } + + // Calculate Resolution for Anamorphic functions + private string strictAnamorphic() + { + // TODO Make sure cropping is Mod2 + if (selectedTitle != null) + { + // Calculate the Actual Height + int actualWidth = (int)text_width.Value - (int)crop_left.Value - (int)crop_right.Value; ; + int actualHeight = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; + if (drp_anamorphic.SelectedIndex == 2) + actualHeight = (int)getModulusAuto(16, actualHeight); + + // Calculate Actual Width + double displayWidth = ((double)actualWidth * selectedTitle.ParVal.Width / selectedTitle.ParVal.Height); + return Math.Round(displayWidth, 0) + "x" + actualHeight; + } + return "Select a Title"; + } + private string looseAnamorphic() + { + if (selectedTitle != null) + { + // Get some values + int actualWidth = (int)text_width.Value - (int)crop_left.Value - (int)crop_right.Value; + + int source_display_width = selectedTitle.Resolution.Width * selectedTitle.ParVal.Width / selectedTitle.ParVal.Height; + int source_cropped_height = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; + + // Calculate storage Aspect and cache it for reuse + if (storageAspect == 0) + storageAspect = (double)actualWidth / source_cropped_height; + + // Calculate the new height based on the input cropped width + double hcalc = actualWidth / storageAspect; + double newHeight = getModulusAuto(16, hcalc); + looseAnamorphicHeightGuard = true; + text_height.Value = (decimal)newHeight; // BUG Out of Range Exception with Width too low here. + + // Calculate the anamorphic width + double parW = newHeight * source_display_width / source_cropped_height; + double parH = actualWidth; + double displayWidth = (actualWidth * parW / parH); + + // Now correct DisplayWidth to maintain Aspect ratio. ActualHeight was mod16'd and thus AR is slightly different than the worked out displayWidths + return Math.Round(displayWidth, 0) + "x" + newHeight; + } + return "Select a Title"; + + } + + // GUI + private void disableCustomAnaControls() + { + // Disable Custom Anamorphic Stuff + lbl_modulus.Visible = false; + lbl_displayWidth.Visible = false; + lbl_parWidth.Visible = false; + lbl_parHeight.Visible = false; + drop_modulus.Visible = false; + txt_displayWidth.Visible = false; + txt_parWidth.Visible = false; + txt_parHeight.Visible = false; + check_KeepAR.Enabled = false; + } + private void enableCustomAnaControls() + { + // Disable Custom Anamorphic Stuff + lbl_modulus.Visible = true; + lbl_displayWidth.Visible = true; + lbl_parWidth.Visible = true; + lbl_parHeight.Visible = true; + drop_modulus.Visible = true; + txt_displayWidth.Visible = true; + txt_parWidth.Visible = true; + txt_parHeight.Visible = true; + check_KeepAR.Enabled = true; + } + + } +} \ No newline at end of file diff --git a/win/C#/Controls/PictureSettings.resx b/win/C#/Controls/PictureSettings.resx new file mode 100644 index 000000000..ff31a6db5 --- /dev/null +++ b/win/C#/Controls/PictureSettings.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/win/C#/EncodeQueue/Encode.cs b/win/C#/EncodeQueue/Encode.cs index 8da86561a..77b2b2957 100644 --- a/win/C#/EncodeQueue/Encode.cs +++ b/win/C#/EncodeQueue/Encode.cs @@ -40,6 +40,7 @@ namespace Handbrake.EncodeQueue { cliStart.RedirectStandardOutput = true; cliStart.UseShellExecute = false; + } if (Properties.Settings.Default.cli_minimized == "Checked") cliStart.WindowStyle = ProcessWindowStyle.Minimized; diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index 9ad6375fc..2434ad42a 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -67,13 +67,13 @@ namespace Handbrake.Functions #endregion #region Picture - mainWindow.check_autoCrop.Checked = true; + mainWindow.pictureSettings.check_autoCrop.Checked = true; if (presetQuery.CropBottom == "0" && presetQuery.CropTop == "0") if (presetQuery.CropLeft == "0" && presetQuery.CropRight == "0") - mainWindow.check_customCrop.Checked = true; + mainWindow.pictureSettings.check_customCrop.Checked = true; - mainWindow.text_width.Text = ""; - mainWindow.text_height.Text = ""; + mainWindow.pictureSettings.text_width.Text = ""; + mainWindow.pictureSettings.text_height.Text = ""; if (pictureSettings) { @@ -85,41 +85,41 @@ namespace Handbrake.Functions int.TryParse(presetQuery.CropLeft, out left); int.TryParse(presetQuery.CropRight, out right); - mainWindow.check_customCrop.Checked = true; - mainWindow.text_top.Value = top; - mainWindow.text_bottom.Value = bottom; - mainWindow.text_left.Value = left; - mainWindow.text_right.Value = right; + mainWindow.pictureSettings.check_customCrop.Checked = true; + mainWindow.pictureSettings.crop_top.Value = top; + mainWindow.pictureSettings.crop_bottom.Value = bottom; + mainWindow.pictureSettings.crop_left.Value = left; + mainWindow.pictureSettings.crop_right.Value = right; } if (presetQuery.Width != 0) - mainWindow.text_width.Text = presetQuery.Width.ToString(); + mainWindow.pictureSettings.text_width.Text = presetQuery.Width.ToString(); if (presetQuery.Height != 0) - mainWindow.text_height.Text = presetQuery.Height.ToString(); + mainWindow.pictureSettings.text_height.Text = presetQuery.Height.ToString(); } - mainWindow.drp_anamorphic.SelectedIndex = presetQuery.Anamorphic ? 1 : 0; + mainWindow.pictureSettings.drp_anamorphic.SelectedIndex = presetQuery.Anamorphic ? 1 : 0; if (presetQuery.LooseAnamorphic) - mainWindow.drp_anamorphic.SelectedIndex = 2; + mainWindow.pictureSettings.drp_anamorphic.SelectedIndex = 2; else { if (presetQuery.Anamorphic != true) - mainWindow.drp_anamorphic.SelectedIndex = 0; + mainWindow.pictureSettings.drp_anamorphic.SelectedIndex = 0; } // Set the public max width and max height varibles in frmMain // These are used by the query generator to determine if it should use -X or -w / -Y or -h if (presetQuery.MaxWidth != 0) { - mainWindow.text_width.Text = presetQuery.MaxWidth.ToString(); + mainWindow.pictureSettings.text_width.Text = presetQuery.MaxWidth.ToString(); mainWindow.maxWidth = presetQuery.MaxWidth; } if (presetQuery.MaxHeight != 0) { - mainWindow.text_height.Text = presetQuery.MaxHeight.ToString(); + mainWindow.pictureSettings.text_height.Text = presetQuery.MaxHeight.ToString(); mainWindow.maxHeight = presetQuery.MaxHeight; } diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs index bab608c57..a60ad3112 100644 --- a/win/C#/Functions/QueryGenerator.cs +++ b/win/C#/Functions/QueryGenerator.cs @@ -121,55 +121,63 @@ namespace Handbrake.Functions if (mainWindow.maxWidth == 0) { - if (mainWindow.text_width.Text != "") - query += " -w " + mainWindow.text_width.Text; + if (mainWindow.pictureSettings.text_width.Text != "") + query += " -w " + mainWindow.pictureSettings.text_width.Text; } else { - if (mainWindow.text_width.Text != "") - query += " -X " + mainWindow.text_width.Text; + if (mainWindow.pictureSettings.text_width.Text != "") + query += " -X " + mainWindow.pictureSettings.text_width.Text; } // Use MaxHeight for built-in presets and height for user settings. if (mainWindow.maxHeight == 0) { - if (mainWindow.text_height.Text != "") - query += " -l " + mainWindow.text_height.Text; + if (mainWindow.pictureSettings.text_height.Text != "") + query += " -l " + mainWindow.pictureSettings.text_height.Text; } else { - if (mainWindow.text_height.Text != "") - query += " -Y " + mainWindow.text_height.Text; + if (mainWindow.pictureSettings.text_height.Text != "") + query += " -Y " + mainWindow.pictureSettings.text_height.Text; } - string cropTop = mainWindow.text_top.Text; - string cropBottom = mainWindow.text_bottom.Text; - string cropLeft = mainWindow.text_left.Text; - string cropRight = mainWindow.text_right.Text; + string cropTop = mainWindow.pictureSettings.crop_top.Text; + string cropBottom = mainWindow.pictureSettings.crop_bottom.Text; + string cropLeft = mainWindow.pictureSettings.crop_left.Text; + string cropRight = mainWindow.pictureSettings.crop_right.Text; - if (mainWindow.check_customCrop.Checked) + if (mainWindow.pictureSettings.check_customCrop.Checked) { - if (mainWindow.text_top.Text == string.Empty) + if (mainWindow.pictureSettings.crop_top.Text == string.Empty) cropTop = "0"; - if (mainWindow.text_bottom.Text == string.Empty) + if (mainWindow.pictureSettings.crop_bottom.Text == string.Empty) cropBottom = "0"; - if (mainWindow.text_left.Text == string.Empty) + if (mainWindow.pictureSettings.crop_left.Text == string.Empty) cropLeft = "0"; - if (mainWindow.text_right.Text == string.Empty) + if (mainWindow.pictureSettings.crop_right.Text == string.Empty) cropRight = "0"; query += " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight; } - if (mainWindow.drp_anamorphic.SelectedIndex == 1) - query += " -p "; - else if (mainWindow.drp_anamorphic.SelectedIndex == 2) - query += " -P "; - - if (mainWindow.slider_deblock.Value != 4) - query += " --deblock=" + mainWindow.slider_deblock.Value; - - + switch (mainWindow.pictureSettings.drp_anamorphic.SelectedIndex) + { + case 1: + query += " --strict-anamorphic "; + break; + case 2: + query += " --loose-anamorphic "; + break; + case 3: + query += " --custom-anamorphic "; + query += " --display-width " + mainWindow.pictureSettings.txt_displayWidth.Text + " "; + if (mainWindow.pictureSettings.check_KeepAR.Checked) + query += " --keep-display-aspect "; + if (mainWindow.pictureSettings.txt_parWidth.Text != "" && mainWindow.pictureSettings.txt_parHeight.Text != "") + query += " --pixel-aspect " + mainWindow.pictureSettings.txt_parWidth.Text + ":" + mainWindow.pictureSettings.txt_parHeight.Text + " "; + break; + } #endregion #region Filters @@ -177,6 +185,9 @@ namespace Handbrake.Functions query += mainWindow.ctl_decomb.getCLIQuery; query += mainWindow.ctl_deinterlace.getCLIQuery; query += mainWindow.ctl_denoise.getCLIQuery; + + if (mainWindow.slider_deblock.Value != 4) + query += " --deblock=" + mainWindow.slider_deblock.Value; #endregion #region Video Settings Tab diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index bbdb77b7e..ff621c625 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -299,7 +299,6 @@ namespace Handbrake.Functions if (videoQuality.Success) { float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture); - //qConvert = Math.Ceiling(qConvert); thisQuery.VideoQuality = qConvert; } #endregion diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index b082ce6ab..8e294d90d 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -136,6 +136,12 @@ Deinterlace.cs + + UserControl + + + PictureSettings.cs + UserControl @@ -241,6 +247,10 @@ Deinterlace.cs Designer + + PictureSettings.cs + Designer + x264Panel.cs Designer diff --git a/win/C#/Installer/Installer.nsi b/win/C#/Installer/Installer.nsi index 4b1e7dee2..f666e270f 100644 --- a/win/C#/Installer/Installer.nsi +++ b/win/C#/Installer/Installer.nsi @@ -99,9 +99,7 @@ Section "Handbrake" SEC01 File "HandBrakeCLI.exe" File "Handbrake.exe.config" File "handbrakepineapple.ico" - File "presets.xml" - File "user_presets.xml" - + SetOutPath "$INSTDIR\doc" SetOverwrite ifnewer File "doc\AUTHORS" @@ -147,8 +145,6 @@ Section Uninstall Delete "$INSTDIR\handbrakepineapple.ico" Delete "$INSTDIR\Handbrake.exe" Delete "$INSTDIR\Handbrake.exe.config" - Delete "$INSTDIR\presets.xml" - Delete "$INSTDIR\user_presets.xml" Delete "$INSTDIR\doc\AUTHORS" Delete "$INSTDIR\doc\BUILD" Delete "$INSTDIR\doc\COPYING" diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index 69afe3e90..e79dd72bd 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -28,7 +28,8 @@ namespace Handbrake.Parsing private TimeSpan m_duration; private Size m_resolution; private int m_titleNumber; - + private Size m_parVal; + /// /// The constructor for this object /// @@ -95,6 +96,14 @@ namespace Handbrake.Parsing get { return m_aspectRatio; } } + /// + /// Par Value + /// + public Size ParVal + { + get { return m_parVal; } + } + /// /// The automatically detected crop region for this Title. /// This is an int array with 4 items in it as so: @@ -163,11 +172,16 @@ namespace Handbrake.Parsing // Get resolution, aspect ratio and FPS for this title m = Regex.Match(output.ReadLine(), - @"^ \+ size: ([0-9]*)x([0-9]*), aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps"); + @"^ \+ size: ([0-9]*)x([0-9]*), pixel aspect: ([0-9]*)/([0-9]*), display aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps"); + //size: 720x576, pixel aspect: 16/15, display aspect: 1.33, 25.000 fps + + + if (m.Success) { thisTitle.m_resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value)); - thisTitle.m_aspectRatio = float.Parse(m.Groups[3].Value, Culture); + thisTitle.m_parVal = new Size(int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value)); + thisTitle.m_aspectRatio = float.Parse(m.Groups[5].Value, Culture); } // Get autocrop region for this title diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 90c6f4955..729bf142f 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -58,8 +58,6 @@ namespace Handbrake this.text_bitrate = new System.Windows.Forms.TextBox(); this.drp_subtitle = new System.Windows.Forms.ComboBox(); this.btn_setDefault = new System.Windows.Forms.Button(); - this.text_height = new System.Windows.Forms.TextBox(); - this.text_width = new System.Windows.Forms.TextBox(); this.check_optimiseMP4 = new System.Windows.Forms.CheckBox(); this.check_iPodAtom = new System.Windows.Forms.CheckBox(); this.data_chpt = new System.Windows.Forms.DataGridView(); @@ -68,14 +66,10 @@ namespace Handbrake this.btn_addPreset = new System.Windows.Forms.Button(); this.btn_removePreset = new System.Windows.Forms.Button(); this.drop_format = new System.Windows.Forms.ComboBox(); - this.check_customCrop = new System.Windows.Forms.RadioButton(); - this.check_autoCrop = new System.Windows.Forms.RadioButton(); this.text_source = new System.Windows.Forms.TextBox(); this.drop_angle = new System.Windows.Forms.ComboBox(); - this.lbl_src_res = new System.Windows.Forms.Label(); this.lbl_duration = new System.Windows.Forms.Label(); this.label_duration = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); this.DVD_Open = new System.Windows.Forms.FolderBrowserDialog(); this.File_Open = new System.Windows.Forms.OpenFileDialog(); this.ISO_Open = new System.Windows.Forms.OpenFileDialog(); @@ -116,7 +110,6 @@ namespace Handbrake this.Label47 = new System.Windows.Forms.Label(); this.Label3 = new System.Windows.Forms.Label(); this.tab_audio = new System.Windows.Forms.TabPage(); - this.audioPanel = new Handbrake.Controls.AudioPanel(); this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components); this.check_forced = new System.Windows.Forms.CheckBox(); this.Label19 = new System.Windows.Forms.Label(); @@ -132,23 +125,6 @@ namespace Handbrake this.Label46 = new System.Windows.Forms.Label(); this.check_grayscale = new System.Windows.Forms.CheckBox(); this.tab_picture = new System.Windows.Forms.TabPage(); - this.lbl_max = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.drp_anamorphic = new System.Windows.Forms.ComboBox(); - this.text_bottom = new System.Windows.Forms.NumericUpDown(); - this.text_top = new System.Windows.Forms.NumericUpDown(); - this.text_left = new System.Windows.Forms.NumericUpDown(); - this.text_right = new System.Windows.Forms.NumericUpDown(); - this.label26 = new System.Windows.Forms.Label(); - this.Label56 = new System.Windows.Forms.Label(); - this.lbl_Aspect = new System.Windows.Forms.Label(); - this.Label91 = new System.Windows.Forms.Label(); - this.Label55 = new System.Windows.Forms.Label(); - this.Label1 = new System.Windows.Forms.Label(); - this.Label53 = new System.Windows.Forms.Label(); - this.Label52 = new System.Windows.Forms.Label(); - this.Label51 = new System.Windows.Forms.Label(); - this.Label15 = new System.Windows.Forms.Label(); this.slider_deblock = new System.Windows.Forms.TrackBar(); this.label8 = new System.Windows.Forms.Label(); this.lbl_deblockVal = new System.Windows.Forms.Label(); @@ -156,15 +132,10 @@ namespace Handbrake this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox(); this.tabs_panel = new System.Windows.Forms.TabControl(); this.tab_filters = new System.Windows.Forms.TabPage(); - this.ctl_deinterlace = new Handbrake.Deinterlace(); - this.ctl_denoise = new Handbrake.Denoise(); - this.ctl_decomb = new Handbrake.Decomb(); - this.ctl_detelecine = new Handbrake.Detelecine(); this.tab_subtitles = new System.Windows.Forms.TabPage(); this.tab_chapters = new System.Windows.Forms.TabPage(); this.label31 = new System.Windows.Forms.Label(); this.tab_advanced = new System.Windows.Forms.TabPage(); - this.x264Panel = new Handbrake.Controls.x264Panel(); this.tab_query = new System.Windows.Forms.TabPage(); this.btn_clear = new System.Windows.Forms.Button(); this.label34 = new System.Windows.Forms.Label(); @@ -199,6 +170,13 @@ namespace Handbrake this.StatusStrip = new System.Windows.Forms.StatusStrip(); this.lbl_encode = new System.Windows.Forms.ToolStripStatusLabel(); this.hbproc = new System.Diagnostics.Process(); + this.pictureSettings = new Handbrake.Controls.PictureSettings(); + this.ctl_deinterlace = new Handbrake.Deinterlace(); + this.ctl_denoise = new Handbrake.Denoise(); + this.ctl_decomb = new Handbrake.Decomb(); + this.ctl_detelecine = new Handbrake.Detelecine(); + this.audioPanel = new Handbrake.Controls.AudioPanel(); + this.x264Panel = new Handbrake.Controls.x264Panel(); notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components); notifyIconMenu.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit(); @@ -209,10 +187,6 @@ namespace Handbrake this.tab_audio.SuspendLayout(); this.tab_video.SuspendLayout(); this.tab_picture.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.text_bottom)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.text_top)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.text_left)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.text_right)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.slider_deblock)).BeginInit(); this.tabs_panel.SuspendLayout(); this.tab_filters.SuspendLayout(); @@ -440,28 +414,6 @@ namespace Handbrake this.btn_setDefault.UseVisualStyleBackColor = true; this.btn_setDefault.Click += new System.EventHandler(this.btn_setDefault_Click); // - // text_height - // - this.text_height.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.text_height.ForeColor = System.Drawing.SystemColors.InfoText; - this.text_height.Location = new System.Drawing.Point(498, 81); - this.text_height.Name = "text_height"; - this.text_height.Size = new System.Drawing.Size(64, 21); - this.text_height.TabIndex = 19; - this.ToolTip.SetToolTip(this.text_height, "Video Resolution (Height)\r\nCan only be altered when Anamorphic is set to \"None\""); - this.text_height.TextChanged += new System.EventHandler(this.text_height_TextChanged); - // - // text_width - // - this.text_width.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.text_width.Location = new System.Drawing.Point(407, 81); - this.text_width.Name = "text_width"; - this.text_width.Size = new System.Drawing.Size(64, 21); - this.text_width.TabIndex = 17; - this.ToolTip.SetToolTip(this.text_width, "Video Resolution (Width)\r\nCan only be altered when Anamorphic is set to \"None\" or" + - " \"Loose\""); - this.text_width.TextChanged += new System.EventHandler(this.text_width_TextChanged); - // // check_optimiseMP4 // this.check_optimiseMP4.AutoSize = true; @@ -572,32 +524,6 @@ namespace Handbrake this.ToolTip.SetToolTip(this.drop_format, "Select the file container format."); this.drop_format.SelectedIndexChanged += new System.EventHandler(this.drop_format_SelectedIndexChanged); // - // check_customCrop - // - this.check_customCrop.AutoSize = true; - this.check_customCrop.Location = new System.Drawing.Point(16, 58); - this.check_customCrop.Name = "check_customCrop"; - this.check_customCrop.Size = new System.Drawing.Size(74, 17); - this.check_customCrop.TabIndex = 34; - this.check_customCrop.Text = "Custom:"; - this.ToolTip.SetToolTip(this.check_customCrop, "Set some custom cropping values."); - this.check_customCrop.UseVisualStyleBackColor = true; - this.check_customCrop.CheckedChanged += new System.EventHandler(this.check_customCrop_CheckedChanged); - // - // check_autoCrop - // - this.check_autoCrop.AutoSize = true; - this.check_autoCrop.Checked = true; - this.check_autoCrop.Location = new System.Drawing.Point(16, 34); - this.check_autoCrop.Name = "check_autoCrop"; - this.check_autoCrop.Size = new System.Drawing.Size(82, 17); - this.check_autoCrop.TabIndex = 33; - this.check_autoCrop.TabStop = true; - this.check_autoCrop.Text = "Automatic"; - this.ToolTip.SetToolTip(this.check_autoCrop, "Automatically set cropping values."); - this.check_autoCrop.UseVisualStyleBackColor = true; - this.check_autoCrop.CheckedChanged += new System.EventHandler(this.check_autoCrop_CheckedChanged); - // // text_source // this.text_source.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -620,17 +546,6 @@ namespace Handbrake this.drop_angle.TabIndex = 45; this.ToolTip.SetToolTip(this.drop_angle, "Select the chapter range you would like to enocde. (default: All Chapters)"); // - // lbl_src_res - // - this.lbl_src_res.AutoSize = true; - this.lbl_src_res.BackColor = System.Drawing.Color.Transparent; - this.lbl_src_res.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_src_res.Location = new System.Drawing.Point(405, 34); - this.lbl_src_res.Name = "lbl_src_res"; - this.lbl_src_res.Size = new System.Drawing.Size(72, 12); - this.lbl_src_res.TabIndex = 13; - this.lbl_src_res.Text = "Select a Title"; - // // lbl_duration // this.lbl_duration.AutoSize = true; @@ -653,16 +568,6 @@ namespace Handbrake this.label_duration.TabIndex = 42; this.label_duration.Text = "Duration:"; // - // label7 - // - this.label7.AutoSize = true; - this.label7.BackColor = System.Drawing.Color.Transparent; - this.label7.Location = new System.Drawing.Point(311, 34); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(52, 13); - this.label7.TabIndex = 12; - this.label7.Text = "Source:"; - // // DVD_Open // this.DVD_Open.Description = "Select the \"VIDEO_TS\" folder from your DVD Drive."; @@ -1027,15 +932,6 @@ namespace Handbrake this.tab_audio.TabIndex = 3; this.tab_audio.Text = "Audio"; this.tab_audio.UseVisualStyleBackColor = true; - // - // audioPanel - // - this.audioPanel.BackColor = System.Drawing.Color.Transparent; - this.audioPanel.Location = new System.Drawing.Point(0, 0); - this.audioPanel.Name = "audioPanel"; - this.audioPanel.Size = new System.Drawing.Size(715, 310); - this.audioPanel.TabIndex = 0; - // // AudioMenuRowHeightHack // @@ -1210,29 +1106,7 @@ namespace Handbrake // tab_picture // this.tab_picture.BackColor = System.Drawing.Color.Transparent; - this.tab_picture.Controls.Add(this.lbl_max); - this.tab_picture.Controls.Add(this.check_customCrop); - this.tab_picture.Controls.Add(this.check_autoCrop); - this.tab_picture.Controls.Add(this.lbl_src_res); - this.tab_picture.Controls.Add(this.label7); - this.tab_picture.Controls.Add(this.label6); - this.tab_picture.Controls.Add(this.drp_anamorphic); - this.tab_picture.Controls.Add(this.text_bottom); - this.tab_picture.Controls.Add(this.text_top); - this.tab_picture.Controls.Add(this.text_left); - this.tab_picture.Controls.Add(this.text_right); - this.tab_picture.Controls.Add(this.label26); - this.tab_picture.Controls.Add(this.Label56); - this.tab_picture.Controls.Add(this.lbl_Aspect); - this.tab_picture.Controls.Add(this.Label91); - this.tab_picture.Controls.Add(this.text_height); - this.tab_picture.Controls.Add(this.Label55); - this.tab_picture.Controls.Add(this.text_width); - this.tab_picture.Controls.Add(this.Label1); - this.tab_picture.Controls.Add(this.Label53); - this.tab_picture.Controls.Add(this.Label52); - this.tab_picture.Controls.Add(this.Label51); - this.tab_picture.Controls.Add(this.Label15); + this.tab_picture.Controls.Add(this.pictureSettings); this.tab_picture.Location = new System.Drawing.Point(4, 22); this.tab_picture.Name = "tab_picture"; this.tab_picture.Padding = new System.Windows.Forms.Padding(3); @@ -1241,205 +1115,6 @@ namespace Handbrake this.tab_picture.Text = "Picture Settings"; this.tab_picture.UseVisualStyleBackColor = true; // - // lbl_max - // - this.lbl_max.AutoSize = true; - this.lbl_max.Location = new System.Drawing.Point(568, 86); - this.lbl_max.Name = "lbl_max"; - this.lbl_max.Size = new System.Drawing.Size(46, 13); - this.lbl_max.TabIndex = 35; - this.lbl_max.Text = "{max}"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.BackColor = System.Drawing.Color.Transparent; - this.label6.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label6.Location = new System.Drawing.Point(311, 111); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(80, 13); - this.label6.TabIndex = 20; - this.label6.Text = "Anamorphic:"; - // - // drp_anamorphic - // - this.drp_anamorphic.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.drp_anamorphic.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.drp_anamorphic.FormattingEnabled = true; - this.drp_anamorphic.Items.AddRange(new object[] { - "None", - "Strict", - "Loose"}); - this.drp_anamorphic.Location = new System.Drawing.Point(407, 108); - this.drp_anamorphic.Name = "drp_anamorphic"; - this.drp_anamorphic.Size = new System.Drawing.Size(110, 21); - this.drp_anamorphic.TabIndex = 21; - this.drp_anamorphic.SelectedIndexChanged += new System.EventHandler(this.drp_anamorphic_SelectedIndexChanged); - // - // text_bottom - // - this.text_bottom.Enabled = false; - this.text_bottom.Location = new System.Drawing.Point(96, 147); - this.text_bottom.Maximum = new decimal(new int[] { - 1080, - 0, - 0, - 0}); - this.text_bottom.Name = "text_bottom"; - this.text_bottom.Size = new System.Drawing.Size(44, 21); - this.text_bottom.TabIndex = 9; - // - // text_top - // - this.text_top.Enabled = false; - this.text_top.Location = new System.Drawing.Point(96, 101); - this.text_top.Maximum = new decimal(new int[] { - 1080, - 0, - 0, - 0}); - this.text_top.Name = "text_top"; - this.text_top.Size = new System.Drawing.Size(44, 21); - this.text_top.TabIndex = 6; - // - // text_left - // - this.text_left.Enabled = false; - this.text_left.Location = new System.Drawing.Point(45, 123); - this.text_left.Maximum = new decimal(new int[] { - 1920, - 0, - 0, - 0}); - this.text_left.Name = "text_left"; - this.text_left.Size = new System.Drawing.Size(44, 21); - this.text_left.TabIndex = 4; - // - // text_right - // - this.text_right.Enabled = false; - this.text_right.Location = new System.Drawing.Point(147, 123); - this.text_right.Maximum = new decimal(new int[] { - 1920, - 0, - 0, - 0}); - this.text_right.Name = "text_right"; - this.text_right.Size = new System.Drawing.Size(44, 21); - this.text_right.TabIndex = 7; - // - // label26 - // - this.label26.AutoSize = true; - this.label26.BackColor = System.Drawing.Color.Transparent; - this.label26.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label26.Location = new System.Drawing.Point(311, 13); - this.label26.Name = "label26"; - this.label26.Size = new System.Drawing.Size(34, 13); - this.label26.TabIndex = 11; - this.label26.Text = "Size"; - // - // Label56 - // - this.Label56.AutoSize = true; - this.Label56.BackColor = System.Drawing.Color.Transparent; - this.Label56.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label56.ForeColor = System.Drawing.Color.Black; - this.Label56.Location = new System.Drawing.Point(477, 85); - this.Label56.Name = "Label56"; - this.Label56.Size = new System.Drawing.Size(15, 13); - this.Label56.TabIndex = 18; - this.Label56.Text = "x"; - // - // lbl_Aspect - // - this.lbl_Aspect.AutoSize = true; - this.lbl_Aspect.BackColor = System.Drawing.Color.Transparent; - this.lbl_Aspect.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_Aspect.Location = new System.Drawing.Point(405, 58); - this.lbl_Aspect.Name = "lbl_Aspect"; - this.lbl_Aspect.Size = new System.Drawing.Size(72, 12); - this.lbl_Aspect.TabIndex = 15; - this.lbl_Aspect.Text = "Select a Title"; - // - // Label91 - // - this.Label91.AutoSize = true; - this.Label91.BackColor = System.Drawing.Color.Transparent; - this.Label91.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label91.Location = new System.Drawing.Point(311, 57); - this.Label91.Name = "Label91"; - this.Label91.Size = new System.Drawing.Size(83, 13); - this.Label91.TabIndex = 14; - this.Label91.Text = "Aspect Ratio:"; - // - // Label55 - // - this.Label55.AutoSize = true; - this.Label55.BackColor = System.Drawing.Color.Transparent; - this.Label55.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label55.ForeColor = System.Drawing.Color.Black; - this.Label55.Location = new System.Drawing.Point(311, 84); - this.Label55.Name = "Label55"; - this.Label55.Size = new System.Drawing.Size(85, 13); - this.Label55.TabIndex = 16; - this.Label55.Text = "Width/Height:"; - // - // Label1 - // - this.Label1.AutoSize = true; - this.Label1.BackColor = System.Drawing.Color.Transparent; - this.Label1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label1.Location = new System.Drawing.Point(13, 13); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(37, 13); - this.Label1.TabIndex = 0; - this.Label1.Text = "Crop"; - // - // Label53 - // - this.Label53.AutoSize = true; - this.Label53.BackColor = System.Drawing.Color.Transparent; - this.Label53.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label53.Location = new System.Drawing.Point(94, 171); - this.Label53.Name = "Label53"; - this.Label53.Size = new System.Drawing.Size(48, 13); - this.Label53.TabIndex = 10; - this.Label53.Text = "Bottom"; - // - // Label52 - // - this.Label52.AutoSize = true; - this.Label52.BackColor = System.Drawing.Color.Transparent; - this.Label52.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label52.Location = new System.Drawing.Point(103, 86); - this.Label52.Name = "Label52"; - this.Label52.Size = new System.Drawing.Size(28, 13); - this.Label52.TabIndex = 5; - this.Label52.Text = "Top"; - // - // Label51 - // - this.Label51.AutoSize = true; - this.Label51.BackColor = System.Drawing.Color.Transparent; - this.Label51.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label51.Location = new System.Drawing.Point(190, 125); - this.Label51.Name = "Label51"; - this.Label51.Size = new System.Drawing.Size(36, 13); - this.Label51.TabIndex = 8; - this.Label51.Text = "Right"; - // - // Label15 - // - this.Label15.AutoSize = true; - this.Label15.BackColor = System.Drawing.Color.Transparent; - this.Label15.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label15.Location = new System.Drawing.Point(13, 125); - this.Label15.Name = "Label15"; - this.Label15.Size = new System.Drawing.Size(28, 13); - this.Label15.TabIndex = 3; - this.Label15.Text = "Left"; - // // slider_deblock // this.slider_deblock.Location = new System.Drawing.Point(118, 162); @@ -1533,48 +1208,6 @@ namespace Handbrake this.tab_filters.Text = "Video Filters"; this.tab_filters.UseVisualStyleBackColor = true; // - // ctl_deinterlace - // - this.ctl_deinterlace.AutoSize = true; - this.ctl_deinterlace.Location = new System.Drawing.Point(19, 95); - this.ctl_deinterlace.Margin = new System.Windows.Forms.Padding(0); - this.ctl_deinterlace.MaximumSize = new System.Drawing.Size(400, 30); - this.ctl_deinterlace.Name = "ctl_deinterlace"; - this.ctl_deinterlace.Size = new System.Drawing.Size(275, 28); - this.ctl_deinterlace.TabIndex = 41; - this.ctl_deinterlace.onChange += new System.EventHandler(this.ctl_deinterlace_changed); - // - // ctl_denoise - // - this.ctl_denoise.AutoSize = true; - this.ctl_denoise.Location = new System.Drawing.Point(19, 123); - this.ctl_denoise.Margin = new System.Windows.Forms.Padding(0); - this.ctl_denoise.MaximumSize = new System.Drawing.Size(400, 30); - this.ctl_denoise.Name = "ctl_denoise"; - this.ctl_denoise.Size = new System.Drawing.Size(275, 28); - this.ctl_denoise.TabIndex = 40; - // - // ctl_decomb - // - this.ctl_decomb.AutoSize = true; - this.ctl_decomb.Location = new System.Drawing.Point(19, 66); - this.ctl_decomb.Margin = new System.Windows.Forms.Padding(0); - this.ctl_decomb.MaximumSize = new System.Drawing.Size(400, 30); - this.ctl_decomb.Name = "ctl_decomb"; - this.ctl_decomb.Size = new System.Drawing.Size(275, 28); - this.ctl_decomb.TabIndex = 39; - this.ctl_decomb.onChange += new System.EventHandler(this.ctl_decomb_changed); - // - // ctl_detelecine - // - this.ctl_detelecine.AutoSize = true; - this.ctl_detelecine.Location = new System.Drawing.Point(19, 38); - this.ctl_detelecine.Margin = new System.Windows.Forms.Padding(0); - this.ctl_detelecine.MaximumSize = new System.Drawing.Size(400, 30); - this.ctl_detelecine.Name = "ctl_detelecine"; - this.ctl_detelecine.Size = new System.Drawing.Size(275, 28); - this.ctl_detelecine.TabIndex = 38; - // // tab_subtitles // this.tab_subtitles.Controls.Add(this.drp_subtitle); @@ -1626,14 +1259,6 @@ namespace Handbrake this.tab_advanced.Text = "Advanced"; this.tab_advanced.UseVisualStyleBackColor = true; // - // x264Panel - // - this.x264Panel.Location = new System.Drawing.Point(0, 0); - this.x264Panel.Name = "x264Panel"; - this.x264Panel.Size = new System.Drawing.Size(720, 306); - this.x264Panel.TabIndex = 0; - this.x264Panel.x264Query = ""; - // // tab_query // this.tab_query.Controls.Add(this.btn_clear); @@ -1993,6 +1618,72 @@ namespace Handbrake this.hbproc.StartInfo.UserName = ""; this.hbproc.SynchronizingObject = this; // + // pictureSettings + // + this.pictureSettings.Location = new System.Drawing.Point(-1, 0); + this.pictureSettings.Name = "pictureSettings"; + this.pictureSettings.selectedTitle = null; + this.pictureSettings.Size = new System.Drawing.Size(705, 302); + this.pictureSettings.TabIndex = 0; + // + // ctl_deinterlace + // + this.ctl_deinterlace.AutoSize = true; + this.ctl_deinterlace.Location = new System.Drawing.Point(19, 95); + this.ctl_deinterlace.Margin = new System.Windows.Forms.Padding(0); + this.ctl_deinterlace.MaximumSize = new System.Drawing.Size(400, 30); + this.ctl_deinterlace.Name = "ctl_deinterlace"; + this.ctl_deinterlace.Size = new System.Drawing.Size(275, 28); + this.ctl_deinterlace.TabIndex = 41; + this.ctl_deinterlace.onChange += new System.EventHandler(this.ctl_deinterlace_changed); + // + // ctl_denoise + // + this.ctl_denoise.AutoSize = true; + this.ctl_denoise.Location = new System.Drawing.Point(19, 123); + this.ctl_denoise.Margin = new System.Windows.Forms.Padding(0); + this.ctl_denoise.MaximumSize = new System.Drawing.Size(400, 30); + this.ctl_denoise.Name = "ctl_denoise"; + this.ctl_denoise.Size = new System.Drawing.Size(275, 28); + this.ctl_denoise.TabIndex = 40; + // + // ctl_decomb + // + this.ctl_decomb.AutoSize = true; + this.ctl_decomb.Location = new System.Drawing.Point(19, 66); + this.ctl_decomb.Margin = new System.Windows.Forms.Padding(0); + this.ctl_decomb.MaximumSize = new System.Drawing.Size(400, 30); + this.ctl_decomb.Name = "ctl_decomb"; + this.ctl_decomb.Size = new System.Drawing.Size(275, 28); + this.ctl_decomb.TabIndex = 39; + this.ctl_decomb.onChange += new System.EventHandler(this.ctl_decomb_changed); + // + // ctl_detelecine + // + this.ctl_detelecine.AutoSize = true; + this.ctl_detelecine.Location = new System.Drawing.Point(19, 38); + this.ctl_detelecine.Margin = new System.Windows.Forms.Padding(0); + this.ctl_detelecine.MaximumSize = new System.Drawing.Size(400, 30); + this.ctl_detelecine.Name = "ctl_detelecine"; + this.ctl_detelecine.Size = new System.Drawing.Size(275, 28); + this.ctl_detelecine.TabIndex = 38; + // + // audioPanel + // + this.audioPanel.BackColor = System.Drawing.Color.Transparent; + this.audioPanel.Location = new System.Drawing.Point(0, 0); + this.audioPanel.Name = "audioPanel"; + this.audioPanel.Size = new System.Drawing.Size(715, 310); + this.audioPanel.TabIndex = 0; + // + // x264Panel + // + this.x264Panel.Location = new System.Drawing.Point(0, 0); + this.x264Panel.Name = "x264Panel"; + this.x264Panel.Size = new System.Drawing.Size(720, 306); + this.x264Panel.TabIndex = 0; + this.x264Panel.x264Query = ""; + // // frmMain // this.AllowDrop = true; @@ -2026,11 +1717,6 @@ namespace Handbrake this.tab_video.ResumeLayout(false); this.tab_video.PerformLayout(); this.tab_picture.ResumeLayout(false); - this.tab_picture.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.text_bottom)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.text_top)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.text_left)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.text_right)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.slider_deblock)).EndInit(); this.tabs_panel.ResumeLayout(false); this.tab_filters.ResumeLayout(false); @@ -2101,11 +1787,6 @@ namespace Handbrake internal System.Windows.Forms.TextBox text_bitrate; internal System.Windows.Forms.TabPage tab_picture; internal System.Windows.Forms.CheckBox Check_ChapterMarkers; - internal System.Windows.Forms.Label Label1; - internal System.Windows.Forms.Label Label53; - internal System.Windows.Forms.Label Label52; - internal System.Windows.Forms.Label Label51; - internal System.Windows.Forms.Label Label15; internal System.Windows.Forms.TabControl tabs_panel; internal System.Windows.Forms.Label Label46; private System.Windows.Forms.GroupBox groupBox_dest; @@ -2123,19 +1804,8 @@ namespace Handbrake private System.Windows.Forms.OpenFileDialog File_Open; private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; internal System.Windows.Forms.CheckBox check_iPodAtom; - internal System.Windows.Forms.Label label26; - internal System.Windows.Forms.Label Label56; - internal System.Windows.Forms.Label lbl_Aspect; - internal System.Windows.Forms.Label Label91; - internal System.Windows.Forms.TextBox text_height; - internal System.Windows.Forms.Label Label55; - internal System.Windows.Forms.TextBox text_width; private System.Windows.Forms.TabPage tab_chapters; internal System.Windows.Forms.Label label31; - internal System.Windows.Forms.NumericUpDown text_right; - internal System.Windows.Forms.NumericUpDown text_bottom; - internal System.Windows.Forms.NumericUpDown text_top; - internal System.Windows.Forms.NumericUpDown text_left; internal System.Windows.Forms.CheckBox check_optimiseMP4; internal System.Windows.Forms.CheckBox check_forced; internal System.Windows.Forms.DataGridView data_chpt; @@ -2154,16 +1824,12 @@ namespace Handbrake internal System.Windows.Forms.Button btn_removePreset; internal System.Windows.Forms.Button btn_addPreset; internal System.Windows.Forms.Label label25; - internal System.Windows.Forms.Label label6; - internal System.Windows.Forms.ComboBox drp_anamorphic; internal System.Windows.Forms.TabPage tab_advanced; private System.Windows.Forms.Button btn_destBrowse; internal System.Windows.Forms.TreeView treeView_presets; internal System.Windows.Forms.RichTextBox rtf_query; private System.Windows.Forms.NotifyIcon notifyIcon; private System.Windows.Forms.ToolStripMenuItem btn_restore; - internal System.Windows.Forms.Label lbl_src_res; - internal System.Windows.Forms.Label label7; internal System.Windows.Forms.Label lbl_duration; internal System.Windows.Forms.Label label_duration; private System.Windows.Forms.ToolStripSeparator toolStripSeparator10; @@ -2180,8 +1846,6 @@ namespace Handbrake internal System.Windows.Forms.ToolStripMenuItem mnu_encodeLog; private System.Windows.Forms.StatusStrip StatusStrip; private System.Windows.Forms.ToolStripStatusLabel lbl_encode; - internal System.Windows.Forms.RadioButton check_customCrop; - internal System.Windows.Forms.RadioButton check_autoCrop; internal System.Windows.Forms.Label lbl_deblockVal; internal System.Windows.Forms.TrackBar slider_deblock; internal System.Windows.Forms.Label label8; @@ -2209,7 +1873,6 @@ namespace Handbrake internal System.Windows.Forms.RadioButton radio_targetFilesize; internal Handbrake.Controls.x264Panel x264Panel; private System.Windows.Forms.ToolStripButton tb_preview; - private System.Windows.Forms.Label lbl_max; private System.Windows.Forms.DataGridViewTextBoxColumn number; private System.Windows.Forms.DataGridViewTextBoxColumn name; internal TextBox text_source; @@ -2218,6 +1881,7 @@ namespace Handbrake internal Label lbl_angle; private TabPage tab_subtitles; internal Handbrake.Controls.AudioPanel audioPanel; + internal Handbrake.Controls.PictureSettings pictureSettings; } diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 15c3e5588..02582923b 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -77,7 +77,6 @@ namespace Handbrake loadPresetPanel(); // Load the Preset Panel treeView_presets.ExpandAll(); lbl_encode.Text = ""; - lbl_max.Text = ""; queueWindow = new frmQueue(encodeQueue); // Prepare the Queue if (Properties.Settings.Default.QueryEditorTab != "Checked") tabs_panel.TabPages.RemoveAt(7); // Remove the query editor tab if the user does not want it enabled. @@ -485,12 +484,7 @@ namespace Handbrake x264Panel.X264_StandardizeOptString(); x264Panel.X264_SetCurrentSettingsInPanel(); - if (maxWidth != 0 && maxHeight != 0) - lbl_max.Text = "Max Width / Height"; - else if (maxWidth != 0) - lbl_max.Text = "Max Width"; - else - lbl_max.Text = ""; + pictureSettings.setMax(); } } } @@ -810,7 +804,7 @@ namespace Handbrake private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e) { // Reset some values on the form - lbl_Aspect.Text = "Select a Title"; + pictureSettings.lbl_Aspect.Text = "Select a Title"; //lbl_RecomendedCrop.Text = "Select a Title"; drop_chapterStart.Items.Clear(); drop_chapterFinish.Items.Clear(); @@ -820,17 +814,8 @@ namespace Handbrake if (drp_dvdtitle.Text != "Automatic") { selectedTitle = drp_dvdtitle.SelectedItem as Parsing.Title; - - // Set the Aspect Ratio - lbl_Aspect.Text = selectedTitle.AspectRatio.ToString(); - lbl_src_res.Text = selectedTitle.Resolution.Width + " x " + selectedTitle.Resolution.Height; lbl_duration.Text = selectedTitle.Duration.ToString(); - - // Set the Recommended Cropping values - text_top.Text = selectedTitle.AutoCropDimensions[0].ToString(); - text_bottom.Text = selectedTitle.AutoCropDimensions[1].ToString(); - text_left.Text = selectedTitle.AutoCropDimensions[2].ToString(); - text_right.Text = selectedTitle.AutoCropDimensions[3].ToString(); + pictureSettings.setComponentsAfterScan(selectedTitle); // Setup Picture Settings Tab Control // Populate the Angles dropdown drop_angle.Items.Clear(); @@ -1249,104 +1234,6 @@ namespace Handbrake } } - //Picture Tab - private void text_width_TextChanged(object sender, EventArgs e) - { - if (text_width.Text == "") - text_width.BackColor = Color.White; - - maxWidth = 0; maxHeight = 0; // Reset max width so that it's not using the MaxWidth -X. Quick hack to allow -X for preset usage. - lbl_max.Text = ""; - - int width; - Boolean parsed = int.TryParse(text_width.Text, out width); - if (parsed) - { - text_width.BackColor = (width % 16) != 0 ? Color.LightCoral : Color.LightGreen; - - if (lbl_Aspect.Text != "Select a Title" && maxWidth == 0 && maxHeight == 0) - { - if (drp_anamorphic.Text == "None") - { - int height = Main.cacluateNonAnamorphicHeight(width, text_top.Value, text_bottom.Value, text_left.Value, text_right.Value, selectedTitle); - if (height != 0) - text_height.Text = height.ToString(); - } - } - } - } - private void text_height_TextChanged(object sender, EventArgs e) - { - if (text_height.Text == "") - text_height.BackColor = Color.White; - - maxHeight = 0; // Reset max height so that it's not using the MaxHeight -Y. Quick hack to allow -Y for preset usage. - lbl_max.Text = maxWidth != 0 ? "Max Width" : ""; - - int height; - Boolean parsed = int.TryParse(text_height.Text, out height); - if (parsed) - text_height.BackColor = (height % 16) != 0 ? Color.LightCoral : Color.LightGreen; - } - private void check_customCrop_CheckedChanged(object sender, EventArgs e) - { - text_left.Enabled = true; - text_right.Enabled = true; - text_top.Enabled = true; - text_bottom.Enabled = true; - if (selectedTitle != null) - { - text_top.Text = selectedTitle.AutoCropDimensions[0].ToString(); - text_bottom.Text = selectedTitle.AutoCropDimensions[1].ToString(); - text_left.Text = selectedTitle.AutoCropDimensions[2].ToString(); - text_right.Text = selectedTitle.AutoCropDimensions[3].ToString(); - } - else - { - text_left.Text = "0"; - text_right.Text = "0"; - text_top.Text = "0"; - text_bottom.Text = "0"; - } - } - private void check_autoCrop_CheckedChanged(object sender, EventArgs e) - { - text_left.Enabled = false; - text_right.Enabled = false; - text_top.Enabled = false; - text_bottom.Enabled = false; - } - private void drp_anamorphic_SelectedIndexChanged(object sender, EventArgs e) - { - if (drp_anamorphic.SelectedIndex == 1) - { - text_height.BackColor = Color.LightGray; - text_width.BackColor = Color.LightGray; - text_height.Text = ""; - text_width.Text = ""; - text_height.Enabled = false; - text_width.Enabled = false; - } - - if (drp_anamorphic.SelectedIndex == 2) - { - text_height.Text = ""; - text_height.Enabled = false; - text_height.BackColor = Color.LightGray; - - text_width.Enabled = true; - text_width.BackColor = Color.White; - } - - if (drp_anamorphic.SelectedIndex == 0) - { - text_height.BackColor = Color.White; - text_width.BackColor = Color.White; - text_height.Enabled = true; - text_width.Enabled = true; - } - } - // Filter Tab private void ctl_decomb_changed(object sender, EventArgs e) { @@ -1600,8 +1487,8 @@ namespace Handbrake drop_chapterFinish.Items.Clear(); drop_chapterFinish.Text = "Auto"; lbl_duration.Text = "Select a Title"; - lbl_src_res.Text = "Select a Title"; - lbl_Aspect.Text = "Select a Title"; + pictureSettings.lbl_src_res.Text = "Select a Title"; + pictureSettings.lbl_Aspect.Text = "Select a Title"; text_source.Text = "Click 'Source' to continue"; text_destination.Text = ""; thisDVD = null; -- cgit v1.2.3