diff options
author | sr55 <[email protected]> | 2012-06-30 18:03:33 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-06-30 18:03:33 +0000 |
commit | b4354b70b73a8bd6bbd0dbf3c4ea8867d110b11d (patch) | |
tree | 86c070a13211fb83bff21110e0b58f9af5049c66 | |
parent | 1ef2204a14628484f9ce70bfcccabb15a2973e88 (diff) |
WinGui: Fix Add Preset not honouring custom source width / height.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4802 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs | 42 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs | 61 |
3 files changed, 58 insertions, 46 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs index bf39d859a..5c4e83cb1 100644 --- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs @@ -40,7 +40,6 @@ namespace HandBrakeWPF.Helpers /// </returns>
public static string AutoName(EncodeTask task, string sourceOrLabelName)
{
-
IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
if (task.Destination == null)
{
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index 5a5bd0034..45f98a1bb 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -118,26 +118,6 @@ namespace HandBrakeWPF.ViewModels {
this.selectedPictureSettingMode = value;
this.ShowCustomInputs = value == PresetPictureSettingsMode.Custom;
-
- if (SelectedPictureSettingMode == PresetPictureSettingsMode.Custom)
- {
- this.Preset.Task.MaxHeight = null;
- this.Preset.Task.MaxWidth = null;
- }
-
- if (SelectedPictureSettingMode == PresetPictureSettingsMode.Custom)
- {
- this.Preset.Task.Width = this.CustomWidth;
- this.Preset.Task.Height = this.CustomHeight;
- this.Preset.Task.MaxHeight = null;
- this.Preset.Task.MaxWidth = null;
- }
-
- if (SelectedPictureSettingMode == PresetPictureSettingsMode.SourceMaximum)
- {
- this.Preset.Task.MaxWidth = this.Preset.Task.Width;
- this.Preset.Task.MaxHeight = this.Preset.Task.Height;
- }
}
}
@@ -175,6 +155,28 @@ namespace HandBrakeWPF.ViewModels this.Preset.UsePictureFilters = this.Preset.UsePictureFilters;
this.Preset.PictureSettingsMode = this.SelectedPictureSettingMode;
+ // Setting W, H, MW and MH
+ if (SelectedPictureSettingMode == PresetPictureSettingsMode.None)
+ {
+ this.Preset.Task.MaxHeight = null;
+ this.Preset.Task.MaxWidth = null;
+ }
+
+ if (SelectedPictureSettingMode == PresetPictureSettingsMode.Custom)
+ {
+ this.Preset.Task.MaxWidth = this.CustomWidth;
+ this.Preset.Task.MaxHeight = this.CustomHeight;
+ this.Preset.Task.Width = null;
+ this.Preset.Task.Height = null;
+ }
+
+ if (SelectedPictureSettingMode == PresetPictureSettingsMode.SourceMaximum)
+ {
+ this.Preset.Task.MaxWidth = this.Preset.Task.Width;
+ this.Preset.Task.MaxHeight = this.Preset.Task.Height;
+ }
+
+ // Add the Preset
bool added = this.presetService.Add(this.Preset);
if (!added)
{
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index d68db870b..b052a4ba7 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -546,7 +546,7 @@ namespace HandBrakeWPF.ViewModels {
// display aspect = (width * par_width) / (height * par_height)
return new Size(
- (this.sourceParValues.Width * this.sourceResolution.Width),
+ (this.sourceParValues.Width * this.sourceResolution.Width),
(this.sourceParValues.Height * this.sourceResolution.Height));
}
}
@@ -569,7 +569,7 @@ namespace HandBrakeWPF.ViewModels public void SetPreset(Preset preset, EncodeTask task)
{
this.Task = task;
-
+
// TODO: These all need to be handled correctly.
this.SelectedAnamorphicMode = preset.Task.Anamorphic;
@@ -584,12 +584,12 @@ namespace HandBrakeWPF.ViewModels if (this.Width > preset.Task.MaxWidth)
{
this.Width = preset.Task.MaxWidth.Value;
- }
+ }
else
{
this.Width = preset.Task.Width ?? this.getRes((sourceResolution.Width - this.CropLeft - this.CropRight), preset.Task.MaxWidth.Value);
}
- }
+ }
else
{
this.Width = preset.Task.Width ?? (sourceResolution.Width - this.CropLeft - this.CropRight);
@@ -605,7 +605,7 @@ namespace HandBrakeWPF.ViewModels {
this.Height = preset.Task.Height ?? this.getRes((sourceResolution.Height - this.CropTop - this.CropBottom), preset.Task.MaxHeight.Value);
}
- }
+ }
// Anamorphic
if (preset.Task.Anamorphic == Anamorphic.Custom)
@@ -616,14 +616,7 @@ namespace HandBrakeWPF.ViewModels }
// Default this to On.
- if (preset.Task.Anamorphic == Anamorphic.None)
- {
- this.MaintainAspectRatio = true;
- }
- else
- {
- this.MaintainAspectRatio = preset.Task.KeepDisplayAspect;
- }
+ this.MaintainAspectRatio = preset.Task.Anamorphic == Anamorphic.None || preset.Task.KeepDisplayAspect;
if (preset.Task.Modulus.HasValue)
{
@@ -632,11 +625,16 @@ namespace HandBrakeWPF.ViewModels if (preset.Task.HasCropping)
{
+ this.IsCustomCrop = true;
this.CropLeft = preset.Task.Cropping.Left;
this.CropRight = preset.Task.Cropping.Right;
this.CropTop = preset.Task.Cropping.Top;
this.CropBottom = preset.Task.Cropping.Bottom;
}
+ else
+ {
+ this.IsCustomCrop = false;
+ }
this.NotifyOfPropertyChange(() => this.Task);
}
@@ -668,7 +666,7 @@ namespace HandBrakeWPF.ViewModels if (sourceResolution.Width < this.MaxWidth)
{
this.MaxWidth = sourceResolution.Width;
- }
+ }
else if (sourceResolution.Width > this.MaxWidth)
{
this.MaxWidth = preset.Task.MaxWidth ?? sourceResolution.Width;
@@ -685,14 +683,27 @@ namespace HandBrakeWPF.ViewModels // Set Screen Controls
this.SourceInfo = string.Format(
- "{0}x{1}, Aspect Ratio: {2:0.00}",
- title.Resolution.Width,
- title.Resolution.Height,
+ "{0}x{1}, Aspect Ratio: {2:0.00}",
+ title.Resolution.Width,
+ title.Resolution.Height,
title.AspectRatio);
- this.CropTop = title.AutoCropDimensions.Top;
- this.CropBottom = title.AutoCropDimensions.Bottom;
- this.CropLeft = title.AutoCropDimensions.Left;
- this.CropRight = title.AutoCropDimensions.Right;
+
+ 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;
+ }
// TODO handle preset max width / height
this.Width = title.Resolution.Width;
@@ -717,8 +728,8 @@ namespace HandBrakeWPF.ViewModels this.DisplaySize = this.sourceResolution.IsEmpty
? "No Title Selected"
: string.Format(
- "{0}x{1}",
- this.CalculateAnamorphicSizes().Width,
+ "{0}x{1}",
+ this.CalculateAnamorphicSizes().Width,
this.CalculateAnamorphicSizes().Height);
this.ShowDisplaySize = true;
@@ -974,8 +985,8 @@ namespace HandBrakeWPF.ViewModels this.DisplaySize = this.sourceResolution.IsEmpty
? "No Title Selected"
: string.Format(
- "{0}x{1}",
- this.CalculateAnamorphicSizes().Width,
+ "{0}x{1}",
+ this.CalculateAnamorphicSizes().Width,
this.CalculateAnamorphicSizes().Height);
}
|