summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-05-29 20:32:25 +0000
committersr55 <[email protected]>2013-05-29 20:32:25 +0000
commitbf0fe59e97a4fc22b0800191407cdeb758ed20fa (patch)
treee2eccf1f2f5b21270c5c5c29e287276ed71625ae /win/CS/HandBrakeWPF
parentbffc8a4ab97bcd4630496c62be4720e0c590f1fa (diff)
WinGui: Picture Settings Tab and Preset Behaviours changed to be consistent with the macgui.
- None: Nothing will happen to the W/H/KeepAR when changing preset. Changing Title or source will change the Width to the source width and turn Keep AR on. - Custom Changing preset will change the resolution to be no more than what the Max W and H were set to. Keep AR flag will be honour'd, so if it's turned off, the output AR could be incorrect. Set the W/H to a large number for the equiv of No Limit. - Source Max Same idea as custom, but limited to the resolution of the current source instead of a custom W/H This now means that importing a mac or linux preset provides consistent behaviour. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5525 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs158
1 files changed, 81 insertions, 77 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
index 268418692..972af2910 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
@@ -601,18 +601,6 @@ namespace HandBrakeWPF.ViewModels
{
this.Task = task;
- // Anamorphic Mode
- this.SelectedAnamorphicMode = preset.Task.Anamorphic;
-
- // Modulus
- if (preset.Task.Modulus.HasValue)
- {
- this.SelectedModulus = preset.Task.Modulus;
- }
-
- // Set the Maintain Aspect ratio.
- this.MaintainAspectRatio = preset.Task.Anamorphic == Anamorphic.None && preset.Task.KeepDisplayAspect;
-
// Handle built-in presets.
if (preset.IsBuildIn)
{
@@ -625,7 +613,18 @@ namespace HandBrakeWPF.ViewModels
default:
case PresetPictureSettingsMode.Custom:
case PresetPictureSettingsMode.SourceMaximum:
- this.MaintainAspectRatio = true;
+
+ // Anamorphic Mode
+ this.SelectedAnamorphicMode = preset.Task.Anamorphic;
+
+ // Modulus
+ if (preset.Task.Modulus.HasValue)
+ {
+ this.SelectedModulus = preset.Task.Modulus;
+ }
+
+ // Set the Maintain Aspect ratio.
+ this.MaintainAspectRatio = preset.Task.KeepDisplayAspect;
// 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));
@@ -641,25 +640,8 @@ namespace HandBrakeWPF.ViewModels
this.MaxWidth = width;
this.MaxHeight = height;
break;
- case PresetPictureSettingsMode.NoLimit:
- this.MaintainAspectRatio = true;
- this.Width = this.GetModulusValue(this.sourceResolution.Width - this.CropLeft - this.CropRight);
-
- this.MaxWidth = this.sourceResolution.Width;
- this.MaxHeight = this.sourceResolution.Height;
- break;
case PresetPictureSettingsMode.None:
-
- if (preset.Task.Width.HasValue)
- {
- this.Width = this.GetModulusValue(preset.Task.Width.Value - this.CropLeft - this.CropRight);
- }
-
- if (!this.MaintainAspectRatio && preset.Task.Height.HasValue)
- {
- this.Height = this.GetModulusValue(preset.Task.Height.Value - this.CropTop - this.CropBottom);
- }
-
+ // Do Nothing except reset the Max Width/Height
this.MaxWidth = this.sourceResolution.Width;
this.MaxHeight = this.sourceResolution.Height;
break;
@@ -727,23 +709,64 @@ namespace HandBrakeWPF.ViewModels
this.sourceParValues = title.ParVal;
this.sourceResolution = title.Resolution;
- // Set the Max Width / Height available to the user controls
- if (this.sourceResolution.Width < this.MaxWidth)
+ if (preset.PictureSettingsMode == PresetPictureSettingsMode.None)
{
- this.MaxWidth = this.sourceResolution.Width;
+ // We have no instructions, so simply set it to the source.
+ this.Width = this.GetModulusValue(this.sourceResolution.Width - this.CropLeft - this.CropRight);
+ this.MaintainAspectRatio = true;
}
- else if (this.sourceResolution.Width > this.MaxWidth)
+ else
{
- this.MaxWidth = preset.Task.MaxWidth ?? this.sourceResolution.Width;
- }
+ // Set the Max Width / Height available to the user controls
+ if (this.sourceResolution.Width < this.MaxWidth)
+ {
+ this.MaxWidth = this.sourceResolution.Width;
+ }
+ else if (this.sourceResolution.Width > this.MaxWidth)
+ {
+ this.MaxWidth = preset.Task.MaxWidth ?? this.sourceResolution.Width;
+ }
- if (this.sourceResolution.Height < this.MaxHeight)
- {
- this.MaxHeight = this.sourceResolution.Height;
- }
- else if (this.sourceResolution.Height > this.MaxHeight)
- {
- this.MaxHeight = preset.Task.MaxHeight ?? this.sourceResolution.Height;
+ if (this.sourceResolution.Height < this.MaxHeight)
+ {
+ this.MaxHeight = this.sourceResolution.Height;
+ }
+ else if (this.sourceResolution.Height > this.MaxHeight)
+ {
+ this.MaxHeight = preset.Task.MaxHeight ?? this.sourceResolution.Height;
+ }
+
+ // Update the cropping values, preffering those in the presets.
+ if (!preset.Task.HasCropping)
+ {
+ this.CropTop = title.AutoCropDimensions.Top;
+ this.CropBottom = title.AutoCropDimensions.Bottom;
+ this.CropLeft = title.AutoCropDimensions.Left;
+ this.CropRight = title.AutoCropDimensions.Right;
+ this.IsCustomCrop = false;
+ }
+ else
+ {
+ this.CropLeft = preset.Task.Cropping.Left;
+ this.CropRight = preset.Task.Cropping.Right;
+ this.CropTop = preset.Task.Cropping.Top;
+ this.CropBottom = preset.Task.Cropping.Bottom;
+ this.IsCustomCrop = true;
+ }
+
+ // Set the Width, and Maintain Aspect ratio. That should calc the Height for us.
+ this.Width = preset.Task.Width ?? this.MaxWidth; // Note: This will be auto-corrected in the property if it's too large.
+
+ // If our height is too large, let it downscale the width for us by setting the height to the lower value.
+ if (!this.MaintainAspectRatio && this.Height > this.MaxHeight)
+ {
+ this.Height = this.MaxHeight;
+ }
+
+ if (this.SelectedAnamorphicMode == Anamorphic.Custom)
+ {
+ this.AnamorphicAdjust(); // Refresh the values
+ }
}
// Set Screen Controls
@@ -752,37 +775,6 @@ namespace HandBrakeWPF.ViewModels
title.Resolution.Width,
title.Resolution.Height,
title.AspectRatio);
-
- if (!preset.Task.HasCropping)
- {
- this.CropTop = title.AutoCropDimensions.Top;
- this.CropBottom = title.AutoCropDimensions.Bottom;
- this.CropLeft = title.AutoCropDimensions.Left;
- this.CropRight = title.AutoCropDimensions.Right;
- this.IsCustomCrop = false;
- }
- else
- {
- this.CropLeft = preset.Task.Cropping.Left;
- this.CropRight = preset.Task.Cropping.Right;
- this.CropTop = preset.Task.Cropping.Top;
- this.CropBottom = preset.Task.Cropping.Bottom;
- this.IsCustomCrop = true;
- }
-
- // Set the Width, and Maintain Aspect ratio. That should calc the Height for us.
- this.Width = preset.Task.Width ?? this.MaxWidth;
-
- // If our height is too large, let it downscale the width for us by setting the height to the lower value.
- if (this.Height > this.MaxHeight)
- {
- this.Height = this.MaxHeight;
- }
-
- if (this.SelectedAnamorphicMode == Anamorphic.Custom)
- {
- this.AnamorphicAdjust(); // Refresh the values
- }
}
this.NotifyOfPropertyChange(() => this.Task);
@@ -818,7 +810,16 @@ namespace HandBrakeWPF.ViewModels
this.ShowDisplaySize = false;
this.ShowKeepAR = true;
this.SelectedModulus = 16; // Reset
- this.Width = this.sourceResolution.Width;
+ if (this.Width == 0)
+ {
+ this.Width = this.GetModulusValue(this.sourceResolution.Width - this.CropLeft - this.CropRight);
+ }
+
+ if (!this.MaintainAspectRatio && this.Height == 0)
+ {
+ this.Height = this.GetModulusValue(this.sourceResolution.Height - this.CropTop - this.CropBottom);
+ }
+
this.SetDisplaySize();
break;
case Anamorphic.Strict:
@@ -839,7 +840,10 @@ namespace HandBrakeWPF.ViewModels
this.HeightControlEnabled = false;
this.ShowCustomAnamorphicControls = false;
this.ShowModulus = true;
- this.Width = this.sourceResolution.Width;
+ if (this.Width == 0)
+ {
+ this.Width = this.sourceResolution.Width;
+ }
this.Height = 0;
this.ShowKeepAR = false;