Skip to content

Commit

Permalink
WinGui: Further fixes to handle the new "Automatic" anamorphic.. This…
Browse files Browse the repository at this point in the history
… 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 HandBrake#415
  • Loading branch information
sr55 committed Dec 10, 2016
1 parent 81f0ddb commit 5fad4b4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion win/CS/HandBrakeWPF/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion win/CS/HandBrakeWPF/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ The Activity log may have further information.</value>
<value>Update Failed. You can try downloading the update from https://handbrake.fr</value>
</data>
<data name="PictureSettingsViewModel_StorageDisplayLabel" xml:space="preserve">
<value>Storage: {0}x{1}, Display: {2}x{3}</value>
<value>Display Size: {0}x{1}, PAR {2}x{3}</value>
</data>
<data name="QueueSelectionViewModel_AddToQueue" xml:space="preserve">
<value>Add to Queue</value>
Expand Down
27 changes: 16 additions & 11 deletions win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public IEnumerable<Anamorphic> AnamorphicModes
{
get
{
return new List<Anamorphic> { Anamorphic.None, Anamorphic.Automatic, Anamorphic.Loose, Anamorphic.Custom };
return new List<Anamorphic> { Anamorphic.None, Anamorphic.Automatic, Anamorphic.Loose }; // , Anamorphic.Custom TODO Re-enable one the UI is re-worked.
}
}

Expand Down Expand Up @@ -643,15 +643,20 @@ public void SetPreset(Preset preset, EncodeTask task)
}

// 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
Expand Down Expand Up @@ -936,7 +941,7 @@ private void RecaulcatePictureSettingsProperties(ChangedPictureField changedFiel
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);
Expand Down Expand Up @@ -979,7 +984,7 @@ private void UpdateVisibileControls()
this.WidthControlEnabled = true;
this.HeightControlEnabled = true;
this.ShowCustomAnamorphicControls = false;
this.ShowModulus = false;
this.ShowModulus = true;
this.ShowKeepAR = false;
break;

Expand Down

0 comments on commit 5fad4b4

Please sign in to comment.