diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/Views')
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SummaryView.xaml | 37 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs | 22 |
2 files changed, 42 insertions, 17 deletions
diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml b/win/CS/HandBrakeWPF/Views/SummaryView.xaml index 8dd6b46e9..59a0ce04b 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" xmlns:converters="clr-namespace:HandBrakeWPF.Converters" + xmlns:cal="http://www.caliburnproject.org" mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="600"> @@ -100,23 +101,25 @@ <RowDefinition Height="*" /> </Grid.RowDefinitions> - - <Image Source="{Binding PreviewImage}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,5,10,0" /> - - <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Center" HorizontalAlignment="Left" - Background="Black" Opacity="0.55" Margin="10,5,20,0" Visibility="{Binding IsPreviousPreviewControlVisible, Converter={StaticResource boolToVisConverter}}"> - <TextBlock Text="<" FontSize="30" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="8,3" Margin="0" /> - </Border> - - <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Center" HorizontalAlignment="Right" - Background="Black" Opacity="0.55" Margin="10,5,20,0" Visibility="{Binding IsNextPreviewControlVisible, Converter={StaticResource boolToVisConverter}}"> - <TextBlock Text=">" FontSize="30" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="8,3" Margin="0" /> - </Border> - - <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Bottom" HorizontalAlignment="Center" - Background="Black" Opacity="0.66" Margin="10,5,20,5"> - <TextBlock Text="Preview 2 of 10" FontSize="14" Foreground="White" Padding="8,3" Visibility="Collapsed" /> - </Border> + <Grid> + <Image Source="{Binding PreviewImage}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,5,10,0" x:Name="previewImage" MouseMove="PreviewImage_OnMouseMove" Panel.ZIndex="0" /> + + <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Center" HorizontalAlignment="Left" Panel.ZIndex="1" cal:Message.Attach="[Event MouseDown] = [Action PreviousPreview]" + Background="Black" Opacity="0.75" Margin="20,0,0,0" Visibility="{Binding IsPreviousPreviewControlVisible, Converter={StaticResource boolToVisConverter}}" > + <TextBlock Text="<" FontSize="30" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="8,3" Margin="0" /> + </Border> + + <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Center" HorizontalAlignment="Right" Panel.ZIndex="1" cal:Message.Attach="[Event MouseDown] = [Action NextPreview]" + Background="Black" Opacity="0.75" Margin="0,0,20,0" Visibility="{Binding IsNextPreviewControlVisible, Converter={StaticResource boolToVisConverter}}"> + <TextBlock Text=">" FontSize="30" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="8,3" Margin="0" /> + </Border> + + <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Bottom" HorizontalAlignment="Center" + Background="Black" Opacity="0.75" Margin="0,5,0,10"> + <TextBlock Text="{Binding PreviewInfo}" FontSize="14" Foreground="White" Padding="8,3" Visibility="{Binding IsPreviewInfoVisible, Converter={StaticResource boolToVisConverter}}" /> + </Border> + </Grid> + <Grid Margin="10,5,0,0" Grid.Row="1"> <Grid.ColumnDefinitions> diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs index e3c35b48e..744003698 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs @@ -10,6 +10,12 @@ namespace HandBrakeWPF.Views { using System.Windows.Controls; + using System.Windows.Input; + + using HandBrakeWPF.ViewModels.Interfaces; + + using Image = System.Windows.Controls.Image; + using Point = System.Windows.Point; /// <summary> /// Interaction logic for SummaryView.xaml @@ -20,5 +26,21 @@ namespace HandBrakeWPF.Views { this.InitializeComponent(); } + + private void PreviewImage_OnMouseMove(object sender, MouseEventArgs e) + { + Image image = sender as Image; + + if (image != null && image.ActualWidth > 0) + { + Point p = Mouse.GetPosition(image); + double width = image.ActualWidth / 2; + + bool leftHalf = p.X <= width; + bool rightHalf = p.X > width; + + ((ISummaryViewModel)this.DataContext).SetPreviewControlVisibility(leftHalf, rightHalf); + } + } } } |