diff options
author | sr55 <[email protected]> | 2017-12-15 21:33:57 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2017-12-15 21:33:57 +0000 |
commit | add6e2ac430652a96ff6fd1a72824796064e259f (patch) | |
tree | 9e4e40fc78df59bac9f9b36c33c24db33c37dd93 /win/CS/HandBrakeWPF | |
parent | 5283a0a7e3200218b7074574f65d2f849a052edb (diff) |
WinGui: Mouse Wheel can scroll previews.
Diffstat (limited to 'win/CS/HandBrakeWPF')
8 files changed, 71 insertions, 6 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs index 919a62170..06a22ae01 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs @@ -33,5 +33,8 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// Gets or sets a value indicating whether is open.
/// </summary>
bool IsOpen { get; set; }
+
+ void PreviousPreview();
+ void NextPreview();
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs index 8ed5deb78..67d51a823 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs @@ -19,5 +19,8 @@ namespace HandBrakeWPF.ViewModels.Interfaces event EventHandler<OutputFormatChangedEventArgs> OutputFormatChanged; void SetContainer(OutputFormat container); void UpdateDisplayedInfo(); + + void PreviousPreview(); + void NextPreview(); } }
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index 7359d2fd6..6f5fc6e5d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -426,6 +426,27 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public bool IsOpen { get; set; }
+ public void NextPreview()
+ {
+ int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
+ if ((this.SelectedPreviewImage + 1) == maxPreview)
+ {
+ return;
+ }
+
+ this.SelectedPreviewImage = this.SelectedPreviewImage + 1;
+ }
+
+ public void PreviousPreview()
+ {
+ if (this.SelectedPreviewImage < 1)
+ {
+ return;
+ }
+
+ this.SelectedPreviewImage = this.SelectedPreviewImage - 1;
+ }
+
/// <summary>
/// The update preview frame.
/// </summary>
@@ -667,6 +688,7 @@ namespace HandBrakeWPF.ViewModels this.encodeService.Start(((QueueTask)state).Task, ((QueueTask)state).Configuration);
this.userSettingService.SetUserSetting(UserSettingConstants.LastPreviewDuration, this.Duration);
}
+
#endregion
#region Event Handlers
diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs index a0e4b2a78..90676cc0e 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs @@ -358,6 +358,11 @@ namespace HandBrakeWPF.ViewModels public void NextPreview() { int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount); + if (this.selectedPreview == maxPreview) + { + return; + } + this.selectedPreview = this.selectedPreview + 1; this.UpdatePreviewFrame(); this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, maxPreview); @@ -369,6 +374,11 @@ namespace HandBrakeWPF.ViewModels public void PreviousPreview() { int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount); + if (this.selectedPreview <= 1) + { + return; + } + this.selectedPreview = this.selectedPreview - 1; this.UpdatePreviewFrame(); this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, maxPreview); diff --git a/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml b/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml index 517ae13f9..c7eb5fb09 100644 --- a/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml +++ b/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml @@ -21,7 +21,7 @@ <TextBlock Text="No Preview Available" VerticalAlignment="Center" Padding="60,60,60,60" FontWeight="Bold" FontSize="25" Foreground="DarkGray" />
</StackPanel>
- <Image Source="{Binding PreviewImage}" MaxWidth="{Binding Width}" MaxHeight="{Binding Height}" />
+ <Image 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"
@@ -63,10 +63,6 @@ <ProgressBar MinHeight="5" Maximum="100" Minimum="0" Value="{Binding PercentageValue}" Grid.Column="0" Grid.ColumnSpan="2" />
<TextBlock Margin="5,0,0,0" Text="{Binding Percentage}" Grid.Column="2" HorizontalAlignment="Right" Foreground="White" />
</Grid>
-
-
-
-
</Grid>
</Border>
diff --git a/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml.cs b/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml.cs index 8c2c55991..17ef64928 100644 --- a/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/StaticPreviewView.xaml.cs @@ -10,6 +10,9 @@ namespace HandBrakeWPF.Views
{
using System.Windows;
+ using System.Windows.Input;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
/// Interaction logic for StaticPreviewView.xaml
@@ -23,5 +26,17 @@ namespace HandBrakeWPF.Views {
InitializeComponent();
}
+
+ private void PreviewImage_OnMouseWheel(object sender, MouseWheelEventArgs e)
+ {
+ if (e.Delta > 1)
+ {
+ ((IStaticPreviewViewModel)this.DataContext).NextPreview();
+ }
+ else
+ {
+ ((IStaticPreviewViewModel)this.DataContext).PreviousPreview();
+ }
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml b/win/CS/HandBrakeWPF/Views/SummaryView.xaml index e2d638554..cb3ed220b 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml @@ -118,7 +118,7 @@ </Grid.ColumnDefinitions> <Image Source="{Binding PreviewImage}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,5,10,0" x:Name="previewImage" Panel.ZIndex="0" Grid.ColumnSpan="2" - MaxWidth="{Binding MaxWidth}" MaxHeight="{Binding MaxHeight}" /> + MaxWidth="{Binding MaxWidth}" MaxHeight="{Binding MaxHeight}" MouseWheel="PreviewImage_OnMouseWheel" /> <Border Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Background="Transparent" Margin="0,5,0,5"> <TextBlock Text="{Binding PreviewInfo}" TextAlignment="Center" Visibility="{Binding IsPreviewInfoVisible, Converter={StaticResource boolToVisConverter}}" /> @@ -129,6 +129,7 @@ <ColumnDefinition Width="42" /> <ColumnDefinition Width="42" /> </Grid.ColumnDefinitions> + <Border BorderThickness="1,1,1,1" CornerRadius="4,0,0,4" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" cal:Message.Attach="[Event MouseDown] = [Action PreviousPreview]" Visibility="{Binding IsPreviousPreviewControlVisible,Converter={StaticResource boolToVisConverter}}" Background="Black" Opacity="0.5" Margin="0,0,0,0" > diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs index e3c35b48e..8c21fc3da 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs @@ -10,6 +10,9 @@ namespace HandBrakeWPF.Views { using System.Windows.Controls; + using System.Windows.Input; + + using HandBrakeWPF.ViewModels.Interfaces; /// <summary> /// Interaction logic for SummaryView.xaml @@ -20,5 +23,17 @@ namespace HandBrakeWPF.Views { this.InitializeComponent(); } + + private void PreviewImage_OnMouseWheel(object sender, MouseWheelEventArgs e) + { + if (e.Delta > 1) + { + ((ISummaryViewModel)this.DataContext).NextPreview(); + } + else + { + ((ISummaryViewModel)this.DataContext).PreviousPreview(); + } + } } } |