From 4c080537fc46cacff72533f74f783355b37443d0 Mon Sep 17 00:00:00 2001 From: sr55 Date: Tue, 9 Jun 2009 15:29:19 +0000 Subject: WinGui: - A number of fixes to the new picture settings panel. Should be mostly working bar an issue with Custom with KeepAR enabled. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2506 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/PictureSettings.Designer.cs | 6 +++++ win/C#/Controls/PictureSettings.cs | 37 ++++++++++++++++++----------- win/C#/Controls/PictureSettings.resx | 3 +++ win/C#/Functions/PresetLoader.cs | 3 --- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/win/C#/Controls/PictureSettings.Designer.cs b/win/C#/Controls/PictureSettings.Designer.cs index c033f7445..f3250f901 100644 --- a/win/C#/Controls/PictureSettings.Designer.cs +++ b/win/C#/Controls/PictureSettings.Designer.cs @@ -30,6 +30,7 @@ namespace Handbrake.Controls /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.text_height = new System.Windows.Forms.NumericUpDown(); this.text_width = new System.Windows.Forms.NumericUpDown(); this.label4 = new System.Windows.Forms.Label(); @@ -64,6 +65,7 @@ namespace Handbrake.Controls this.Label15 = new System.Windows.Forms.Label(); this.lbl_anamorphic = new System.Windows.Forms.Label(); this.lbl_anamprohicLbl = new System.Windows.Forms.Label(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); ((System.ComponentModel.ISupportInitialize)(this.text_height)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.text_width)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).BeginInit(); @@ -264,6 +266,7 @@ namespace Handbrake.Controls this.txt_displayWidth.Name = "txt_displayWidth"; this.txt_displayWidth.Size = new System.Drawing.Size(100, 20); this.txt_displayWidth.TabIndex = 53; + this.toolTip.SetToolTip(this.txt_displayWidth, "Display Width - Press \"Enter\" after entering a new value."); this.txt_displayWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_displayWidth_Keyup); // // lbl_displayWidth @@ -294,6 +297,7 @@ namespace Handbrake.Controls this.txt_parWidth.Name = "txt_parWidth"; this.txt_parWidth.Size = new System.Drawing.Size(100, 20); this.txt_parWidth.TabIndex = 55; + this.toolTip.SetToolTip(this.txt_parWidth, "PAR Width - Press \"Enter\" after entering a new value.\r\n"); this.txt_parWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_parWidth_Keyup); // // lbl_parHeight @@ -313,6 +317,7 @@ namespace Handbrake.Controls this.txt_parHeight.Name = "txt_parHeight"; this.txt_parHeight.Size = new System.Drawing.Size(100, 20); this.txt_parHeight.TabIndex = 57; + this.toolTip.SetToolTip(this.txt_parHeight, "PAR Height - Press \"Enter\" after entering a new value.\r\n"); this.txt_parHeight.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txt_parHeight_Keyup); // // check_KeepAR @@ -564,6 +569,7 @@ namespace Handbrake.Controls internal System.Windows.Forms.CheckBox check_KeepAR; internal System.Windows.Forms.Label lbl_anamorphic; internal System.Windows.Forms.Label lbl_anamprohicLbl; + private ToolTip toolTip; } } diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs index b9626f1d6..49ab799dd 100644 --- a/win/C#/Controls/PictureSettings.cs +++ b/win/C#/Controls/PictureSettings.cs @@ -49,6 +49,7 @@ namespace Handbrake.Controls public Title selectedTitle { get; set; } private Boolean heightChangeGuard; private Boolean looseAnamorphicHeightGuard; + private Boolean heightModJumpGaurd = false; // Window Setup public PictureSettings() @@ -130,7 +131,7 @@ namespace Handbrake.Controls int.TryParse(drop_modulus.SelectedItem.ToString(), out mod); // Increase or decrease value by the correct mod. - if (drp_anamorphic.SelectedIndex != 2) + if (drp_anamorphic.SelectedIndex != 2 && !heightModJumpGaurd) { decimal val = heightChangeMod(mod); heightChangeGuard = true; @@ -165,6 +166,7 @@ namespace Handbrake.Controls } heightChangeGuard = false; looseAnamorphicHeightGuard = false; + heightModJumpGaurd = false; } private void check_KeepAR_CheckedChanged(object sender, EventArgs e) { @@ -205,8 +207,12 @@ namespace Handbrake.Controls case 1: // Strict text_height.BackColor = Color.LightGray; text_width.BackColor = Color.LightGray; - text_height.Text = ""; - text_width.Text = ""; + if (selectedTitle != null) + { + heightModJumpGaurd = true; + text_width.Value = selectedTitle.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value; + text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; + } text_height.Enabled = false; text_width.Enabled = false; check_KeepAR.CheckState = CheckState.Unchecked; @@ -216,17 +222,18 @@ namespace Handbrake.Controls lbl_anamprohicLbl.Visible = true; break; case 2: // Loose + disableCustomAnaControls(); storageAspect = 0; + text_height.Enabled = false; + text_height.BackColor = Color.LightGray; + text_width.Enabled = true; + text_width.BackColor = Color.White; if (selectedTitle != null) { + heightModJumpGaurd = true; text_width.Value = selectedTitle.Resolution.Width - (int) crop_left.Value - (int) crop_right.Value; 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(); lbl_anamprohicLbl.Visible = true; break; @@ -242,9 +249,10 @@ namespace Handbrake.Controls // Actual Work if (selectedTitle != null) { + heightModJumpGaurd = true; widthVal = selectedTitle.Resolution.Width; - text_width.Text = widthVal.ToString(); - text_height.Text = cacluateHeight(widthVal).ToString(); + text_width.Value = selectedTitle.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value; + text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; txt_parWidth.Text = selectedTitle.ParVal.Width.ToString(); txt_parHeight.Text = selectedTitle.ParVal.Height.ToString(); txt_displayWidth.Text = displayWidth().ToString(); @@ -334,22 +342,25 @@ namespace Handbrake.Controls */ if (!check_KeepAR.Checked) { - switch (control.Name) // TODO Check if CroppedWidth or just Width + switch (control.Name) { case "text_width": double dw = (double)cropped_width * parW / parH; + dw = Math.Round(dw, 2); txt_displayWidth.Text = dw.ToString(); break; case "txt_parWidth": double dwpw = (double)cropped_width * parW / parH; + dwpw = Math.Round(dwpw, 2); txt_displayWidth.Text = dwpw.ToString(); break; case "txt_parHeight": double dwph = (double)cropped_width * parW / parH; + dwph = Math.Round(dwph, 2); txt_displayWidth.Text = dwph.ToString(); break; case "txt_displayWidth": - txt_parWidth.Text = txt_displayWidth.Text; + txt_parWidth.Text = Math.Round(displayWidth, 0).ToString(); txt_parHeight.Text = text_width.Text; break; } @@ -668,8 +679,6 @@ namespace Handbrake.Controls // 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); diff --git a/win/C#/Controls/PictureSettings.resx b/win/C#/Controls/PictureSettings.resx index ff31a6db5..a5979aadf 100644 --- a/win/C#/Controls/PictureSettings.resx +++ b/win/C#/Controls/PictureSettings.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index dd5fa7c7d..f0c522348 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -72,9 +72,6 @@ namespace Handbrake.Functions if (presetQuery.CropLeft == "0" && presetQuery.CropRight == "0") mainWindow.pictureSettings.check_customCrop.Checked = true; - mainWindow.pictureSettings.text_width.Text = ""; - mainWindow.pictureSettings.text_height.Text = ""; - if (pictureSettings) { if (presetQuery.CropTop != null) -- cgit v1.2.3