summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-08-15 18:08:28 +0000
committersr55 <[email protected]>2012-08-15 18:08:28 +0000
commit9b7b3485646a227bbbe16a358dc9d317868565e4 (patch)
tree2e0c8a8f25b95570a6d78defc4806816e021f744 /win/CS
parent7cd3b216443482163c68e01fe48755f5763a7053 (diff)
WinGui: Fixes to the Advanced Panel (8x8t and ref) and Picture Panel (Further Max W/H fixes)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4907 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs12
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs39
-rw-r--r--win/CS/HandBrakeWPF/Views/AdvancedView.xaml10
4 files changed, 35 insertions, 28 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs b/win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs
index 68d64eca3..ffd33ae8c 100644
--- a/win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs
@@ -90,7 +90,7 @@ namespace HandBrakeWPF.Helpers
/// </summary>
static AdvancedChoicesHelper()
{
- referenceFrames = CreateNumberList(0, 16, defaultNumber: 3);
+ referenceFrames = CreateNumberList(1, 16, defaultNumber: 3);
bFrames = CreateNumberList(0, 16, defaultNumber: 3);
pyramidalBFrames = new List<AdvancedChoice>
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
index 2a0425114..ffcfc5b4b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
@@ -266,7 +266,6 @@ namespace HandBrakeWPF.ViewModels
{
this.analysis = value;
this.NotifyOfPropertyChange(() => this.Analysis);
- this.NotifyOfPropertyChange(() => this.EightByEightDctVisible);
this.UpdateOptionsString();
}
}
@@ -399,17 +398,6 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Gets a value indicating whether EightByEightDctVisible.
- /// </summary>
- public bool EightByEightDctVisible
- {
- get
- {
- return this.Analysis.Value != "none";
- }
- }
-
- /// <summary>
/// Gets or sets MotionEstimationMethod.
/// </summary>
public AdvancedChoice MotionEstimationMethod
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
index ed1b5f7f8..ab7415c66 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
@@ -579,14 +579,17 @@ namespace HandBrakeWPF.ViewModels
this.Task.MaxWidth = preset.Task.MaxWidth;
this.Task.MaxHeight = preset.Task.MaxHeight;
+ // Setup the Width
if (preset.Task.MaxWidth.HasValue)
{
if (this.Width > preset.Task.MaxWidth)
{
- this.Width = preset.Task.MaxWidth.Value;
+ // Limit the Width to the Max Width
+ this.Width = preset.Task.MaxWidth.Value;
}
else
{
+ // Figure out the best width based on the preset and source
this.Width = preset.Task.Width ?? this.getRes((sourceResolution.Width - this.CropLeft - this.CropRight), preset.Task.MaxWidth.Value);
}
}
@@ -595,15 +598,28 @@ namespace HandBrakeWPF.ViewModels
this.Width = preset.Task.Width ?? (sourceResolution.Width - this.CropLeft - this.CropRight);
}
+
+ // Set the Maintain Aspect ratio. This will calculate Height for us now.
+ this.MaintainAspectRatio = preset.Task.Anamorphic == Anamorphic.None || preset.Task.KeepDisplayAspect;
+
+ // Set Height, but only if necessary.
if (preset.Task.MaxHeight.HasValue)
{
if (this.Height > preset.Task.MaxHeight)
{
+ // Limit the Height to the Max Height of the preset. Setting this will recalculate the width.
this.Height = preset.Task.MaxHeight.Value;
}
else
{
- this.Height = preset.Task.Height ?? this.getRes((sourceResolution.Height - this.CropTop - this.CropBottom), preset.Task.MaxHeight.Value);
+ // Only calculate height if Maintain Aspect ratio is off.
+ if (!this.MaintainAspectRatio)
+ {
+ this.Height = preset.Task.Height ??
+ this.getRes(
+ (sourceResolution.Height - this.CropTop - this.CropBottom),
+ preset.Task.MaxHeight.Value);
+ }
}
}
@@ -615,14 +631,13 @@ namespace HandBrakeWPF.ViewModels
this.ParHeight = preset.Task.PixelAspectY;
}
- // Default this to On.
- this.MaintainAspectRatio = preset.Task.Anamorphic == Anamorphic.None || preset.Task.KeepDisplayAspect;
-
+ // Modulus
if (preset.Task.Modulus.HasValue)
{
this.SelectedModulus = preset.Task.Modulus;
}
+ // Cropping
if (preset.Task.HasCropping)
{
this.IsCustomCrop = true;
@@ -723,11 +738,16 @@ namespace HandBrakeWPF.ViewModels
this.IsCustomCrop = true;
}
- // TODO handle preset max width / height
+ // Set the Width, and Maintain Aspect ratio. That should calc the Height for us.
this.Width = this.MaxWidth;
- this.Height = this.MaxHeight;
this.MaintainAspectRatio = true;
+ // 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)
{
AnamorphicAdjust(); // Refresh the values
@@ -963,6 +983,11 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private void HeightAdjust()
{
+ if (this.sourceResolution == new Size(0,0))
+ {
+ return;
+ }
+
if (this.Height > this.sourceResolution.Height)
{
this.Task.Height = this.sourceResolution.Height;
diff --git a/win/CS/HandBrakeWPF/Views/AdvancedView.xaml b/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
index e30a0fcd2..674c86eca 100644
--- a/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
+++ b/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
@@ -168,17 +168,12 @@
Height="28"
Content="8x8 Transform:"
Style="{StaticResource AdvancedLabel}"
- Visibility="{Binding EightByEightDctVisible,
- Converter={StaticResource VisibilityConverter}}"
/>
<CheckBox Grid.Row="5"
Grid.Column="1"
Height="16"
IsChecked="{Binding EightByEightDct}"
- Style="{StaticResource LongToolTipHolder}"
- Visibility="{Binding EightByEightDctVisible,
- Converter={StaticResource VisibilityConverter}}"
- >
+ Style="{StaticResource LongToolTipHolder}">
<CheckBox.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_EightByEightDctToolTip}" />
</CheckBox.ToolTip>
@@ -378,8 +373,7 @@
SelectedItem="{Binding MotionEstimationRange}"
Style="{StaticResource LongToolTipHolder}"
Visibility="{Binding MotionEstimationRangeVisible,
- Converter={StaticResource VisibilityConverter}}"
- >
+ Converter={StaticResource VisibilityConverter}}" Margin="0,0,0,2" VerticalAlignment="Bottom">
<ComboBox.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_MotionEstimationRangeToolTip}" />
</ComboBox.ToolTip>