diff options
author | sr55 <[email protected]> | 2021-01-14 18:51:03 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2021-01-14 18:51:03 +0000 |
commit | 1e75e508a7d626acf35281c19ac4dba7438b6887 (patch) | |
tree | c0c51198514cf820c9ad4ee465947f4e78f03bf4 /win/CS | |
parent | 1e73815438bf317d196966bf7f906129eab42bc5 (diff) |
WinGui: Add optional crop controls to the preview window similar to the mac UI.
Diffstat (limited to 'win/CS')
11 files changed, 250 insertions, 121 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 5a76da7e3..3a44a9fe8 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -156,6 +156,9 @@ <Page Update="Themes\Controls\ToolbarDark.xaml">
<SubType>Designer</SubType>
</Page>
+ <Page Update="Views\Standalone\CropPanelView.xaml">
+ <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
+ </Page>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 59fab79ae..ec98e4386 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -5694,6 +5694,15 @@ namespace HandBrakeWPF.Properties { } /// <summary> + /// Looks up a localized string similar to Fine Tune Picture Settings. + /// </summary> + public static string StaticPreviewView_FineTuning { + get { + return ResourceManager.GetString("StaticPreviewView_FineTuning", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to Live Preview. /// </summary> public static string StaticPreviewView_LivePreview { @@ -5721,6 +5730,15 @@ namespace HandBrakeWPF.Properties { } /// <summary> + /// Looks up a localized string similar to Show crop adjustment controls.. + /// </summary> + public static string StaticPreviewView_ShowPictureSettingsAdjustment { + get { + return ResourceManager.GetString("StaticPreviewView_ShowPictureSettingsAdjustment", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to Preview ({0}% actual size). /// </summary> public static string StaticPreviewView_Title { diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 0afe6bdab..d4432a4b1 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -2396,4 +2396,10 @@ Fields are limited to: <data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
+ <data name="StaticPreviewView_FineTuning" xml:space="preserve">
+ <value>Fine Tune Picture Settings</value>
+ </data>
+ <data name="StaticPreviewView_ShowPictureSettingsAdjustment" xml:space="preserve">
+ <value>Show crop adjustment controls.</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs index 7e297a5fe..7d121bdf6 100644 --- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs +++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs @@ -329,7 +329,7 @@ namespace HandBrakeWPF.Services defaults.Add(UserSettingConstants.DefaultPlayer, false);
// Experimental
- defaults.Add(UserSettingConstants.ProcessIsolationEnabled, SystemInfo.IsWindows10() ? true : false);
+ defaults.Add(UserSettingConstants.ProcessIsolationEnabled, SystemInfo.IsWindows10());
defaults.Add(UserSettingConstants.ProcessIsolationPort, 8037);
defaults.Add(UserSettingConstants.SimultaneousEncodes, 1);
@@ -337,7 +337,7 @@ namespace HandBrakeWPF.Services defaults.Add(UserSettingConstants.ScalingMode, 0);
defaults.Add(UserSettingConstants.ForcePresetReset, 3);
defaults.Add(UserSettingConstants.MetadataPassthru, true);
-
+ defaults.Add(UserSettingConstants.PreviewShowPictureSettingsOverlay, false);
return defaults;
}
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs index 9d5afd3d9..8ecb34ee6 100644 --- a/win/CS/HandBrakeWPF/UserSettingConstants.cs +++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs @@ -78,5 +78,6 @@ namespace HandBrakeWPF public const string EnableQuickSyncLowPower = "EnableQuickSyncLowPower";
public const string SimultaneousEncodes = "SimultaneousEncodes";
public const string MetadataPassthru = "MetadataPassthru";
+ public const string PreviewShowPictureSettingsOverlay = "PreviewShowPictureSettingsOverlay";
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs index 9605537c9..5b3037ba6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs @@ -13,32 +13,23 @@ namespace HandBrakeWPF.ViewModels.Interfaces using HandBrakeWPF.Services.Scan.Model;
- using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
+ using EncodeTask = Services.Encode.Model.EncodeTask;
/// <summary>
/// The Static Preview View Model Interface
/// </summary>
public interface IStaticPreviewViewModel
{
- /// <summary>
- /// The preview frame.
- /// </summary>
- /// <param name="task">
- /// The task.
- /// </param>
- /// <param name="scannedSource">
- /// The scanned Source.
- /// </param>
- void UpdatePreviewFrame(EncodeTask task, Source scannedSource);
-
- /// <summary>
- /// Gets or sets a value indicating whether is open.
- /// </summary>
bool IsOpen { get; set; }
BitmapSource PreviewImage { get; }
+ void UpdatePreviewFrame(EncodeTask task, Source scannedSource);
+
void PreviousPreview();
+
void NextPreview();
+
+ void SetPictureSettingsInstance(IPictureSettingsViewModel pictureSettingsViewModel);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index e8a889357..53493faea 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -52,6 +52,7 @@ namespace HandBrakeWPF.ViewModels public PictureSettingsViewModel(IStaticPreviewViewModel staticPreviewViewModel)
{
this.StaticPreviewViewModel = staticPreviewViewModel;
+ this.StaticPreviewViewModel.SetPictureSettingsInstance(this);
this.sourceResolution = new Size(0, 0);
this.Task = new EncodeTask();
this.PaddingFilter = new PadFilter(this.Task, () => this.OnTabStatusChanged(null));
@@ -260,6 +261,11 @@ namespace HandBrakeWPF.ViewModels set
{
+ if (!ValidCropTB(value, this.CropTop))
+ {
+ return; // Don't accept user input.
+ }
+
this.Task.Cropping.Bottom = value;
this.NotifyOfPropertyChange(() => this.CropBottom);
this.RecaulcatePictureSettingsProperties(ChangedPictureField.Crop);
@@ -272,6 +278,11 @@ namespace HandBrakeWPF.ViewModels set
{
+ if (!ValidCropLR(value, this.CropRight))
+ {
+ return; // Don't accept user input.
+ }
+
this.Task.Cropping.Left = value;
this.NotifyOfPropertyChange(() => this.CropLeft);
this.RecaulcatePictureSettingsProperties(ChangedPictureField.Crop);
@@ -284,6 +295,11 @@ namespace HandBrakeWPF.ViewModels set
{
+ if (!ValidCropLR(value, this.CropLeft))
+ {
+ return; // Don't accept user input.
+ }
+
this.Task.Cropping.Right = value;
this.NotifyOfPropertyChange(() => this.CropRight);
this.RecaulcatePictureSettingsProperties(ChangedPictureField.Crop);
@@ -296,12 +312,21 @@ namespace HandBrakeWPF.ViewModels set
{
+ if (!ValidCropTB(value, this.CropBottom))
+ {
+ return; // Don't accept user input.
+ }
+
this.Task.Cropping.Top = value;
this.NotifyOfPropertyChange(() => this.CropTop);
this.RecaulcatePictureSettingsProperties(ChangedPictureField.Crop);
}
}
+ public int MaxCropLR => currentTitle?.Resolution.Width - 8 ?? 0;
+
+ public int MaxCropTB => currentTitle?.Resolution.Height - 8 ?? 0;
+
public bool IsCustomCrop
{
get => this.Task.HasCropping;
@@ -868,6 +893,28 @@ namespace HandBrakeWPF.ViewModels this.SelectedPictureSettingsResLimitMode = PictureSettingsResLimitModes.Custom;
}
}
+
+ private bool ValidCropTB(int value, int value2)
+ {
+ int totalCrop = value + value2;
+ if (totalCrop >= this.currentTitle.Resolution.Height)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private bool ValidCropLR(int value, int value2)
+ {
+ int totalCrop = value + value2;
+ if (totalCrop >= this.currentTitle.Resolution.Width)
+ {
+ return false;
+ }
+
+ return true;
+ }
}
public enum ChangedPictureField
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index 8828032c5..79ca95447 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -61,6 +61,8 @@ namespace HandBrakeWPF.ViewModels private bool useSystemDefaultPlayer;
private bool previewRotateFlip;
+ private bool showPictureSettingControls;
+
public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService, IErrorService errorService, ILog logService, ILogInstanceManager logInstanceManager, IPortService portService)
{
this.scanService = scanService;
@@ -82,14 +84,14 @@ namespace HandBrakeWPF.ViewModels this.CanPlay = true;
this.useSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);
+ this.showPictureSettingControls = userSettingService.GetUserSetting<bool>(UserSettingConstants.PreviewShowPictureSettingsOverlay);
this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration);
this.previewRotateFlip = userSettingService.GetUserSetting<bool>(UserSettingConstants.PreviewRotationFlip);
this.NotifyOfPropertyChange(() => this.previewRotateFlip); // Don't want to trigger an Update, so setting the backing variable.
}
- /// <summary>
- /// Gets or sets the height.
- /// </summary>
+ public IPictureSettingsViewModel PictureSettingsViewModel { get; private set; }
+
public int Height
{
get
@@ -107,9 +109,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets the preview image.
- /// </summary>
public BitmapSource PreviewImage
{
get
@@ -128,9 +127,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets the selected preview image.
- /// </summary>
public int SelectedPreviewImage
{
get
@@ -168,19 +164,10 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets the task.
- /// </summary>
public EncodeTask Task { get; set; }
- /// <summary>
- /// Gets or sets the scanned source.
- /// </summary>
- public Source ScannedSource { get; set; }
+ public Source ScannedSource { get; set; }
- /// <summary>
- /// Gets the total previews.
- /// </summary>
public int TotalPreviews
{
get
@@ -189,9 +176,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets the width.
- /// </summary>
public int Width
{
get
@@ -209,9 +193,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets a value indicating whether preview not available.
- /// </summary>
public bool PreviewNotAvailable
{
get
@@ -229,9 +210,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets AvailableDurations.
- /// </summary>
public IEnumerable<int> AvailableDurations
{
get
@@ -240,14 +218,8 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets Duration.
- /// </summary>
public int Duration { get; set; }
- /// <summary>
- /// Gets or sets Percentage.
- /// </summary>
public string Percentage
{
get
@@ -262,9 +234,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets PercentageValue.
- /// </summary>
public double PercentageValue
{
get
@@ -279,9 +248,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets StartPoints.
- /// </summary>
public IEnumerable<int> StartPoints
{
get
@@ -298,9 +264,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets a value indicating whether UseSystemDefaultPlayer.
- /// </summary>
public bool UseSystemDefaultPlayer
{
get
@@ -315,15 +278,13 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets a value indicating whether IsEncoding.
- /// </summary>
public bool IsEncoding
{
get
{
return this.isEncoding;
}
+
set
{
this.isEncoding = value;
@@ -333,27 +294,23 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Gets or sets the Currently Playing / Encoding Filename.
- /// </summary>
public string CurrentlyPlaying { get; set; }
- /// <summary>
- /// Gets or sets a value indicating whether can play.
- /// </summary>
public bool CanPlay { get; set; }
public bool IsOpen { get; set; }
- /// <summary>
- /// The update preview frame.
- /// </summary>
- /// <param name="task">
- /// The task.
- /// </param>
- /// <param name="scannedSource">
- /// The scanned Source.
- /// </param>
+ public bool ShowPictureSettingControls
+ {
+ get => this.showPictureSettingControls;
+ set
+ {
+ this.showPictureSettingControls = value;
+ this.NotifyOfPropertyChange(() => this.ShowPictureSettingControls);
+ this.userSettingService.SetUserSetting(UserSettingConstants.PreviewShowPictureSettingsOverlay, value);
+ }
+ }
+
public void UpdatePreviewFrame(EncodeTask task, Source scannedSource)
{
this.Task = task;
@@ -384,9 +341,6 @@ namespace HandBrakeWPF.ViewModels this.SelectedPreviewImage = this.SelectedPreviewImage - 1;
}
- /// <summary>
- /// The update preview frame.
- /// </summary>
[HandleProcessCorruptedStateExceptions]
public void UpdatePreviewFrame()
{
@@ -450,24 +404,20 @@ namespace HandBrakeWPF.ViewModels return height;
}
- /// <summary>
- /// Close this window.
- /// </summary>
public void Close()
{
this.IsOpen = false;
}
- /// <summary>
- /// Handle The Initialisation
- /// </summary>
+ public void SetPictureSettingsInstance(IPictureSettingsViewModel pictureSettingsViewModel)
+ {
+ this.PictureSettingsViewModel = pictureSettingsViewModel;
+ }
+
public override void OnLoad()
{
}
- /// <summary>
- /// Encode and play a sample
- /// </summary>
public void Play()
{
try
@@ -563,10 +513,6 @@ namespace HandBrakeWPF.ViewModels }
}
-
- /// <summary>
- /// Play the Encoded file
- /// </summary>
private void PlayFile()
{
// Launch VLC and Play video.
@@ -603,12 +549,6 @@ namespace HandBrakeWPF.ViewModels }
}
- /// <summary>
- /// Create the Preview.
- /// </summary>
- /// <param name="state">
- /// The state.
- /// </param>
private void CreatePreview(object state)
{
// Make sure we are not already encoding and if we are then display an error.
@@ -627,30 +567,12 @@ namespace HandBrakeWPF.ViewModels this.userSettingService.SetUserSetting(UserSettingConstants.LastPreviewDuration, this.Duration);
}
- /// <summary>
- /// Handle Encode Progress Events
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The EncodeProgressEventArgs.
- /// </param>
private void encodeService_EncodeStatusChanged(object sender, EncodeProgressEventArgs e)
{
this.Percentage = string.Format("{0} %", Math.Round(e.PercentComplete, 2).ToString(CultureInfo.InvariantCulture));
this.PercentageValue = e.PercentComplete;
}
- /// <summary>
- /// Handle the Encode Completed Event
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The EncodeCompletedEventArgs.
- /// </param>
private void encodeService_EncodeCompleted(object sender, EncodeCompletedEventArgs e)
{
this.Percentage = "0.00%";
diff --git a/win/CS/HandBrakeWPF/Views/Standalone/CropPanelView.xaml b/win/CS/HandBrakeWPF/Views/Standalone/CropPanelView.xaml new file mode 100644 index 000000000..ecb9b1208 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Standalone/CropPanelView.xaml @@ -0,0 +1,107 @@ + <UserControl x:Class="HandBrakeWPF.Views.Standalone.CropPanelView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" + xmlns:controls="clr-namespace:HandBrakeWPF.Controls" + xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"> + + <UserControl.Resources> + <Converters:BooleanConverter x:Key="boolConverter" /> + <Style TargetType="controls:NumberBox"> + <Setter Property="Height" Value="24" /> + </Style> + </UserControl.Resources> + + <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <!-- Crop Panel --> + <TextBlock Text="{x:Static Properties:Resources.StaticPreviewView_FineTuning}" FontSize="12" FontWeight="Bold" Margin="0,5,0,10" Foreground="White" /> + <Grid Name="CropPanel" Margin="0,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <!--<TextBlock Text="{x:Static Properties:Resources.FiltersView_Rotate}" Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" Foreground="White" /> + <ComboBox Width="120" ItemsSource="{Binding RotateFlipFilter.RotationOptions}" Grid.Row="0" Grid.Column="1" + SelectedItem="{Binding RotateFlipFilter.SelectedRotation}" ToolTip="{x:Static Properties:ResourcesTooltips.FilterView_Rotate}" + AutomationProperties.Name="{x:Static Properties:Resources.FiltersView_Rotate}" HorizontalAlignment="Left" VerticalAlignment="Center" /> + <CheckBox Content="{x:Static Properties:Resources.FiltersView_FlipVideo}" Margin="5,0,0,0" VerticalAlignment="Center" IsChecked="{Binding RotateFlipFilter.FlipVideo, UpdateSourceTrigger=PropertyChanged}" + ToolTip="{x:Static Properties:ResourcesTooltips.FilterView_Flip}" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" />--> + + + <TextBlock Text="{x:Static Properties:Resources.PictureSettingsView_Cropping}" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="0,0,0,0" Foreground="White" /> + + <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" > + <RadioButton Content="{x:Static Properties:Resources.PictureSettingsView_Automatic}" IsChecked="{Binding IsCustomCrop, Converter={StaticResource boolConverter}, ConverterParameter=true}" + ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_AutoCrop}" Margin="0,0,0,0" Foreground="White" /> + <RadioButton Content="{x:Static Properties:Resources.PictureSettingsView_Custom}" IsChecked="{Binding IsCustomCrop}" Margin="10,0,0,0" + ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_ManualCrop}" Foreground="White" /> + </StackPanel> + + + <Grid Margin="0,5,0,0" Grid.Row="2" Grid.ColumnSpan="3" HorizontalAlignment="Right"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <Label Content="{x:Static Properties:Resources.PictureSettingsView_Top}" Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" Foreground="White" /> + <Label Content="{x:Static Properties:Resources.PictureSettingsView_Bottom}" Grid.Row="4" Grid.Column="2" VerticalAlignment="Center" Foreground="White" /> + <Label Content="{x:Static Properties:Resources.PictureSettingsView_Left}" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" Foreground="White" /> + <Label Content="{x:Static Properties:Resources.PictureSettingsView_Right}" Grid.Row="2" Grid.Column="4" HorizontalAlignment="Center" Foreground="White" /> + + <controls:NumberBox Width="60" HorizontalAlignment="Left" Margin="0,0,0,5" IsEnabled="{Binding IsCustomCrop}" Grid.Row="1" Grid.Column="2" + Minimum="0" Maximum="{Binding MaxCropTB}" Modulus="2" Number="{Binding CropTop, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False" + ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_CropTop}" + AutomationProperties.Name="{x:Static Properties:Resources.PictureSettingsView_Top}" /> + + <controls:NumberBox Width="60" HorizontalAlignment="Left" Margin="0,0,0,5" IsEnabled="{Binding IsCustomCrop}" Grid.Row="3" Grid.Column="2" + Minimum="0" Maximum="{Binding MaxCropTB}" Modulus="2" Number="{Binding CropBottom, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False" + ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_CropBottom}" + AutomationProperties.Name="{x:Static Properties:Resources.PictureSettingsView_Bottom}" /> + + <controls:NumberBox Width="60" HorizontalAlignment="Left" Margin="0,0,0,5" IsEnabled="{Binding IsCustomCrop}" Grid.Row="2" Grid.Column="1" + Minimum="0" Maximum="{Binding MaxCropLR}" Modulus="2" Number="{Binding CropLeft, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False" + ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_CropLeft}" + AutomationProperties.Name="{x:Static Properties:Resources.PictureSettingsView_Left}"/> + + <controls:NumberBox Width="60" HorizontalAlignment="Left" Margin="0,0,0,5" IsEnabled="{Binding IsCustomCrop}" Grid.Row="2" Grid.Column="3" + Minimum="0" Maximum="{Binding MaxCropLR}" Modulus="2" Number="{Binding CropRight, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False" + ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_CropRight}" + AutomationProperties.Name="{x:Static Properties:Resources.PictureSettingsView_Right}"/> + + </Grid> + + </Grid> + + </Grid> + +</UserControl> diff --git a/win/CS/HandBrakeWPF/Views/Standalone/CropPanelView.xaml.cs b/win/CS/HandBrakeWPF/Views/Standalone/CropPanelView.xaml.cs new file mode 100644 index 000000000..2fcdf919c --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Standalone/CropPanelView.xaml.cs @@ -0,0 +1,18 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="CropPanelView.xaml.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Views.Standalone +{ + using System.Windows.Controls; + + public partial class CropPanelView : UserControl + { + public CropPanelView() + { + this.InitializeComponent(); + } + } +} diff --git a/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml b/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml index 584270569..699f802cb 100644 --- a/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml +++ b/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml @@ -6,14 +6,19 @@ xmlns:cal="http://www.caliburnproject.org"
xmlns:converters="clr-namespace:HandBrakeWPF.Converters"
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
+ xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
+ xmlns:standalone="clr-namespace:HandBrakeWPF.Views.Standalone"
mc:Ignorable="d" SizeToContent="WidthAndHeight"
TextOptions.TextFormattingMode="Display"
WindowStartupLocation="CenterScreen"
cal:Message.Attach="[Event Closing] = [Action Close]"
- Title="{Binding Title}">
+ Title="{Binding Title}"
+ MinHeight="550">
<Window.Resources>
<converters:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
+ <converters:BooleanConverter x:Key="boolConverter" />
+
</Window.Resources>
<Grid>
@@ -24,8 +29,14 @@ <Image x:Name="previewImage" Source="{Binding PreviewImage}" MaxWidth="{Binding Width}" MaxHeight="{Binding Height}" MouseWheel="PreviewImage_OnMouseWheel" />
+ <Border BorderBrush="WhiteSmoke" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Padding="8" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20" MinWidth="200" Background="Black" Opacity="0.8"
+ Visibility="{Binding ShowPictureSettingControls, Converter={StaticResource booleanToVisibilityConverter}}">
+
+ <standalone:CropPanelView DataContext="{Binding PictureSettingsViewModel}" />
+ </Border>
+
<Border BorderBrush="WhiteSmoke" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Padding="8"
- VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="20" MinWidth="400" Background="Black" Opacity="0.70">
+ VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="20" MinWidth="450" Background="Black" Opacity="0.8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -40,7 +51,11 @@ HorizontalAlignment="Stretch"
Background="Transparent" TickPlacement="TopLeft" Margin="0,0,0,5" />
- <CheckBox IsChecked="{Binding PreviewRotateFlip}" Content="{x:Static Properties:Resources.StaticPreviewView_PreviewRotationFlip}" Foreground="White" Grid.Row="1" Margin="0,0,0,10" />
+ <StackPanel Orientation="Horizontal" Grid.Row="1">
+ <CheckBox IsChecked="{Binding PreviewRotateFlip}" Content="{x:Static Properties:Resources.StaticPreviewView_PreviewRotationFlip}" Foreground="White" Margin="0,0,0,10" />
+ <CheckBox IsChecked="{Binding ShowPictureSettingControls}" Content="{x:Static Properties:Resources.StaticPreviewView_ShowPictureSettingsAdjustment}" Foreground="White" Margin="10,0,0,10" />
+
+ </StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Left">
<Button Content="{x:Static Properties:Resources.StaticPreviewView_LivePreview}" Padding="8,2" cal:Message.Attach="[Event Click] = [Action Play]" Visibility="{Binding IsEncoding, Converter={StaticResource booleanToVisibilityConverter}, ConverterParameter=true}" />
@@ -52,6 +67,7 @@ SelectedItem="{Binding Duration}" />
<CheckBox VerticalAlignment="Center" Content="{x:Static Properties:Resources.StaticPreviewView_UseSystemDefault}" Foreground="White" Margin="10,0,0,0" IsChecked="{Binding UseSystemDefaultPlayer}" />
+
</StackPanel>
<Grid Margin="0,10,10,0" Grid.Row="3" Visibility="{Binding IsEncoding, Converter={StaticResource booleanToVisibilityConverter}}">
|