From be861eb1e625b3e903d76bf60cdfb4bae8f8b1df Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 18 Feb 2012 20:46:50 +0000 Subject: [PATCH] WinGui: Quick hack to force width to update when changing preset for HD sources. (High Profile preset) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4455 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/Controls/PictureSettings.cs | 19 ++++++++++++++++++- win/CS/Functions/PresetLoader.cs | 6 ++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/win/CS/Controls/PictureSettings.cs b/win/CS/Controls/PictureSettings.cs index 7684c9ad6..8e45b9778 100644 --- a/win/CS/Controls/PictureSettings.cs +++ b/win/CS/Controls/PictureSettings.cs @@ -26,6 +26,7 @@ namespace Handbrake.Controls private bool preventChangingDisplayWidth; private double cachedDar; private Title sourceTitle; + private Size presetMaximumResolution; /// /// Initializes a new instance of the class. @@ -67,11 +68,27 @@ namespace Handbrake.Controls /// public Preset CurrentlySelectedPreset { get; set; } + public bool SizeSet { get; set; } + /// /// Gets or sets the maximum allowable size for the encoded resolution. Set a value to /// "0" if the maximum does not matter. /// - public Size PresetMaximumResolution { get; set; } + public Size PresetMaximumResolution + { + get + { + return this.presetMaximumResolution; + } + set + { + this.presetMaximumResolution = value; + if (presetMaximumResolution == new Size(0, 0) && !SizeSet && this.sourceTitle != null) + { + text_width.Value = this.sourceTitle.Resolution.Width; + } + } + } /// /// Set the Preset Crop Warning Label diff --git a/win/CS/Functions/PresetLoader.cs b/win/CS/Functions/PresetLoader.cs index 47029c935..6aacfd9c5 100644 --- a/win/CS/Functions/PresetLoader.cs +++ b/win/CS/Functions/PresetLoader.cs @@ -147,28 +147,34 @@ namespace Handbrake.Functions ? CheckState.Checked : CheckState.Unchecked; + bool sizeSet = false; // Set the Width and height as Required. if (presetQuery.Width.HasValue) { mainWindow.PictureSettings.text_width.Value = presetQuery.Width.Value; + sizeSet = true; } if (presetQuery.Height.HasValue) { mainWindow.PictureSettings.text_height.Value = presetQuery.Height.Value; + sizeSet = true; } // Max Width/Height override Width/Height if (presetQuery.MaxWidth.HasValue) { mainWindow.PictureSettings.text_width.Value = presetQuery.MaxWidth.Value; + sizeSet = true; } if (presetQuery.MaxHeight.HasValue) { mainWindow.PictureSettings.text_height.Value = presetQuery.MaxHeight.Value; + sizeSet = true; } + mainWindow.PictureSettings.SizeSet = sizeSet; mainWindow.PictureSettings.PresetMaximumResolution = new Size( presetQuery.MaxWidth.HasValue ? presetQuery.MaxWidth.Value : 0, presetQuery.MaxHeight.HasValue ? presetQuery.MaxHeight.Value : 0); -- 2.40.0