From 5fad4b45d7dfee9ac086ee20b08509d3d1c9f315 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 10 Dec 2016 20:57:18 +0000 Subject: [PATCH] WinGui: Further fixes to handle the new "Automatic" anamorphic.. This should fix the case where Selecting a downscaled preset, then selecting a non downscaled preset would result in the Height not being recalculated. For now I've also disabled "Custom" anamorphic as it's quite badly broken until it can be re-worked. Fixes #415 --- .../Properties/Resources.Designer.cs | 2 +- win/CS/HandBrakeWPF/Properties/Resources.resx | 2 +- .../ViewModels/PictureSettingsViewModel.cs | 27 +++++++++++-------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index b692aa83f..2fe0cec2e 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -1249,7 +1249,7 @@ namespace HandBrakeWPF.Properties { } /// - /// Looks up a localized string similar to Storage: {0}x{1}, Display: {2}x{3}. + /// Looks up a localized string similar to Display Size: {0}x{1}, PAR {2}x{3}. /// public static string PictureSettingsViewModel_StorageDisplayLabel { get { diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 6791f06e6..b1b496c7d 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -618,7 +618,7 @@ The Activity log may have further information. Update Failed. You can try downloading the update from https://handbrake.fr - Storage: {0}x{1}, Display: {2}x{3} + Display Size: {0}x{1}, PAR {2}x{3} Add to Queue diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index e44c0d9d1..35260356f 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -146,7 +146,7 @@ namespace HandBrakeWPF.ViewModels { get { - return new List { Anamorphic.None, Anamorphic.Automatic, Anamorphic.Loose, Anamorphic.Custom }; + return new List { Anamorphic.None, Anamorphic.Automatic, Anamorphic.Loose }; // , Anamorphic.Custom TODO Re-enable one the UI is re-worked. } } @@ -643,15 +643,20 @@ namespace HandBrakeWPF.ViewModels } // Set the width, then check the height doesn't breach the max height and correct if necessary. - int width = this.GetModulusValue(this.GetRes((this.sourceResolution.Width - this.CropLeft - this.CropRight), preset.Task.MaxWidth)); - this.Width = width; - - // If we have a max height, make sure we havn't breached it. + int width = this.GetModulusValue(this.GetRes((this.sourceResolution.Width - this.CropLeft - this.CropRight), preset.Task.MaxWidth)); int height = this.GetModulusValue(this.GetRes((this.sourceResolution.Height - this.CropTop - this.CropBottom), preset.Task.MaxHeight)); - if (preset.Task.MaxHeight.HasValue && this.Height > preset.Task.MaxHeight.Value) - { - this.Height = height; - } + + // Set the backing fields to avoid triggering recalulation until both are set. + this.Task.Width = width; + this.Task.Height = height; + + // Trigger a Recalc + this.RecaulcatePictureSettingsProperties(ChangedPictureField.Width); + + // Update the UI + this.NotifyOfPropertyChange(() => this.Width); + this.NotifyOfPropertyChange(() => this.Height); + break; case PresetPictureSettingsMode.None: // Do Nothing except reset the Max Width/Height @@ -936,7 +941,7 @@ namespace HandBrakeWPF.ViewModels double dispWidth = Math.Round((result.OutputWidth * result.OutputParWidth / result.OutputParHeight), 0); this.DisplaySize = this.sourceResolution == null || this.sourceResolution.IsEmpty ? string.Empty - : string.Format(Resources.PictureSettingsViewModel_StorageDisplayLabel, result.OutputWidth, result.OutputHeight, dispWidth, result.OutputHeight); + : string.Format(Resources.PictureSettingsViewModel_StorageDisplayLabel, dispWidth, result.OutputHeight, this.ParWidth, this.ParHeight); // Step 4, Force an update on all the UI elements. this.NotifyOfPropertyChange(() => this.Width); @@ -979,7 +984,7 @@ namespace HandBrakeWPF.ViewModels this.WidthControlEnabled = true; this.HeightControlEnabled = true; this.ShowCustomAnamorphicControls = false; - this.ShowModulus = false; + this.ShowModulus = true; this.ShowKeepAR = false; break; -- 2.40.0