summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-09-17 16:13:31 +0100
committersr55 <[email protected]>2017-09-17 16:13:31 +0100
commit5acda54e340bb696baacd267b92f031ab7157924 (patch)
treece11320a3fa1b72cd3ccac514972c5a6204e3039 /win/CS/HandBrakeWPF/Views
parent361f4d9e6c055faa48c3ca61a97872d0216261f6 (diff)
WinGui: Experimenting with InLine vs Preset Pane designs.
Diffstat (limited to 'win/CS/HandBrakeWPF/Views')
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml208
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml.cs41
-rw-r--r--win/CS/HandBrakeWPF/Views/ShellView.xaml4
3 files changed, 250 insertions, 3 deletions
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index 57f2cb518..34a7c159a 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -6,6 +6,10 @@
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
xmlns:cal="http://www.caliburnproject.org"
xmlns:menu="clr-namespace:HandBrakeWPF.Commands.Menu"
+ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+ xmlns:commands="clr-namespace:HandBrakeWPF.Commands"
+ xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers"
+ xmlns:loc="clr-namespace:HandBrakeWPF.Services.Presets.Model"
AllowDrop="True"
FontSize="11"
cal:Message.Attach="[Event Loaded] = [Action Load]"
@@ -25,6 +29,11 @@
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
+ <Style x:Key="textBlockOrangeStyle" TargetType="TextBlock">
+ <Setter Property="FontWeight" Value="Bold" />
+ <Setter Property="Padding" Value="5,5" />
+ </Style>
+
</UserControl.Resources>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
@@ -81,6 +90,8 @@
<Separator />
<MenuItem Header="_Set Current as Default" cal:Message.Attach="[Event Click] = [Action PresetSetDefault]" />
<MenuItem Header="_Reset Built-In Presets" cal:Message.Attach="[Event Click] = [Action PresetReset]" />
+ <Separator />
+ <MenuItem IsCheckable="True" x:Name="showPresetPanelMenuItem" IsChecked="{Binding IsPresetPanelShowing}" Header="S_how Preset Panel" />
</MenuItem>
<MenuItem Header="_Queue" x:Name="queueMenu" Visibility="{Binding HasSource, Converter={StaticResource booleanConverter}, ConverterParameter=false}">
@@ -245,6 +256,10 @@
<!-- Main Body -->
<Grid Grid.Row="1">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" MinWidth="725"/>
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@@ -330,7 +345,7 @@
<!-- Presets Options -->
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="10,5,10,5">
<Label Content="Presets" FontWeight="Bold" VerticalAlignment="Center" />
- <StackPanel Orientation="Horizontal" Margin="8,0,0,0">
+ <StackPanel Orientation="Horizontal" Margin="8,0,0,0" Visibility="{Binding IsPresetPanelShowing, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
<ComboBox ItemsSource="{Binding PresetsCategories}" SelectedItem="{Binding SelectedPresetCategory}" Width="150" DisplayMemberPath="Category" Margin="5,0,0,0" VerticalAlignment="Center" />
<ComboBox ItemsSource="{Binding CategoryPresets}" SelectedItem="{Binding SelectedPreset}" Width="250" Margin="10,0,0,0" VerticalAlignment="Center">
<ComboBox.Resources>
@@ -401,6 +416,13 @@
</Button.ContextMenu>
</Button>
</StackPanel>
+ <StackPanel Margin="8,0,0,0" Orientation="Horizontal" Visibility="{Binding IsPresetPanelShowing, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">
+ <TextBlock Text="Selected Preset:" Margin="5,0,0,0" />
+ <TextBlock Text="{Binding SelectedPreset.Name}" Margin="5,0,0,0" />
+ <TextBlock Text="(Default)" Visibility="{Binding SelectedPreset.IsDefault, Converter={StaticResource boolToVisConverter}}" Margin="5,0,0,0" />
+ </StackPanel>
+
+
</StackPanel>
<!-- Tab Control -->
@@ -484,7 +506,191 @@
</Grid>
</StackPanel>
+ <!-- Presets -->
+ <GroupBox Grid.Row="0" Grid.RowSpan="4"
+ Grid.Column="1"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Header="Presets"
+ Margin="0,0,5,5"
+ IsEnabled="{Binding HasSource, Converter={StaticResource booleanConverter}, ConverterParameter=false}"
+ Visibility="{Binding IsPresetPanelShowing, Converter={StaticResource boolToVisConverter}}">
+
+
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <Grid.Resources>
+
+ <HierarchicalDataTemplate DataType="{x:Type loc:Preset}">
+ <StackPanel Orientation="Horizontal" >
+ <StackPanel.Resources>
+ <Style TargetType="TextBlock">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsDefault}" Value="True" >
+ <Setter Property="FontStyle" Value="Italic" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsDefault}" Value="False" >
+ <Setter Property="FontStyle" Value="Normal" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsSelected}" Value="True">
+ <Setter Property="FontWeight" Value="Bold"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </StackPanel.Resources>
+ <TextBlock Text="{Binding Name}"/>
+ </StackPanel>
+ </HierarchicalDataTemplate>
+
+ <HierarchicalDataTemplate DataType="{x:Type loc:PresetDisplayCategory}" ItemsSource="{Binding Presets}">
+ <StackPanel Orientation="Horizontal" >
+ <TextBlock Text="{Binding Category}" FontSize="14" />
+ </StackPanel>
+ </HierarchicalDataTemplate>
+ </Grid.Resources>
+
+ <TreeView x:Name="presetListTree" HorizontalAlignment="Stretch" AutomationProperties.Name="Presets List" ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Presets}"
+ VerticalAlignment="Stretch" BorderThickness="0,0,0,1" BorderBrush="LightGray"
+ ItemsSource="{Binding PresetsCategories}"
+ helpers:TreeViewHelper.TreeViewSelectedItem="{Binding Path=SelectedPreset, Mode=TwoWay}"
+ PreviewMouseRightButtonDown="PresetListTree_OnPreviewMouseRightButtonDown">
+
+ <TreeView.ItemContainerStyle>
+ <Style BasedOn="{StaticResource {x:Type TreeViewItem}}" TargetType="TreeViewItem">
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ <Setter Property="Padding" Value="4" />
+ <Setter Property="ToolTip" Value="{Binding Description}" />
+ <Setter Property="ToolTipService.InitialShowDelay" Value="1500"/>
+ <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
+ <EventSetter Event="TreeViewItem.Collapsed" Handler="PresetTreeviewItemCollasped" />
+ <Style.Triggers>
+ <Trigger Property="HasItems" Value="True">
+ <Setter Property="Focusable" Value="false" />
+ </Trigger>
+
+ </Style.Triggers>
+ </Style>
+ </TreeView.ItemContainerStyle>
+
+ <TreeView.ContextMenu>
+ <ContextMenu AutomationProperties.Name="Presets List Context Menu">
+ <MenuItem Header="{x:Static Properties:ResourcesUI.MainView_SetDefault}" cal:Message.Attach="[Event Click] = [Action PresetSetDefault]" />
+ <Separator />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.MainView_UpdateSelectedPreset}" cal:Message.Attach="[Event Click] = [Action PresetUpdate]" />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.MainView_PresetManage}" cal:Message.Attach="[Event Click] = [Action PresetManage]" />
+ <Separator />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Preset_Import}" cal:Message.Attach="[Event Click] = [Action PresetImport]" />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Preset_Export}" cal:Message.Attach="[Event Click] = [Action PresetExport]" />
+ <Separator />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.MainView_ResetBuiltInPresets}" cal:Message.Attach="[Event Click] = [Action PresetReset]" />
+ </ContextMenu>
+
+ </TreeView.ContextMenu>
+
+ <i:Interaction.Triggers>
+ <commands:InputBindingTrigger>
+ <commands:InputBindingTrigger.InputBinding>
+ <KeyBinding Key="Delete"/>
+ </commands:InputBindingTrigger.InputBinding>
+ <cal:ActionMessage MethodName="PresetRemove" />
+ </commands:InputBindingTrigger>
+ </i:Interaction.Triggers>
+
+ </TreeView>
+
+ <ToolBar Name="presetsToolBar"
+ Grid.Row="1"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Stretch"
+ SnapsToDevicePixels="False"
+ UseLayoutRounding="False"
+ ToolBar.OverflowMode="Never"
+ Background="Transparent"
+ ToolBarTray.IsLocked="True"
+ Loaded="ToolBarLoaded"
+ KeyboardNavigation.TabNavigation="Continue" >
+
+ <ToolBar.Resources>
+ <Style TargetType="{x:Type ToolBarPanel}">
+ <Setter Property="Orientation" Value="Vertical"/>
+ <Setter Property="VerticalAlignment" Value="Center"/>
+ </Style>
+
+ <Style BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" TargetType="{x:Type Button}" />
+ </ToolBar.Resources>
+
+ <ToolBarOverflowPanel>
+ <Button cal:Message.Attach="[Event Click] = [Action PresetAdd]" AutomationProperties.Name="Add Preset" ToolTip="{x:Static Properties:ResourcesTooltips.MainView_AddPreset}">
+ <Button.Content>
+ <StackPanel Orientation="Horizontal">
+ <Image Width="20"
+ Height="20"
+ Source="Images/add.png"
+ />
+ <TextBlock Margin="2,0,0,0"
+ VerticalAlignment="Center"
+ Style="{StaticResource textBlockOrangeStyle}"
+ Text="{x:Static Properties:ResourcesUI.Generic_Add}"
+ />
+ </StackPanel>
+ </Button.Content>
+ </Button>
+
+ <Button Background="Transparent" cal:Message.Attach="[Event Click] = [Action PresetRemove]" AutomationProperties.Name="Remove Preset" ToolTip="{x:Static Properties:ResourcesTooltips.MainView_RemovePreset}">
+ <Button.Content>
+ <StackPanel Orientation="Horizontal">
+ <Image Width="20"
+ Height="20"
+ Source="Images/remove.png"
+ SnapsToDevicePixels="True"
+ />
+ <TextBlock Margin="2,0,0,0"
+ VerticalAlignment="Center"
+ Style="{StaticResource textBlockOrangeStyle}"
+ Text="{x:Static Properties:ResourcesUI.MainView_Remove}"
+ />
+ </StackPanel>
+ </Button.Content>
+ </Button>
+
+ <Menu Background="Transparent" AutomationProperties.Name="Preset Options Dropdown" MinHeight="22" ToolTip="{x:Static Properties:ResourcesTooltips.MainView_PresetAdditionalOptions}">
+ <MenuItem ToolBar.OverflowMode="Never">
+ <MenuItem.Header>
+ <StackPanel Orientation="Horizontal">
+ <Image Width="20"
+ Height="20"
+ Source="Images/Advanced.png"
+ RenderOptions.BitmapScalingMode="HighQuality"
+ />
+ <TextBlock Margin="2,0,0,0"
+ VerticalAlignment="Center"
+ Style="{StaticResource textBlockOrangeStyle}"
+ Text="{x:Static Properties:ResourcesUI.MainView_Options}"
+ />
+ </StackPanel>
+ </MenuItem.Header>
+ <MenuItem Header="{x:Static Properties:ResourcesUI.MainView_SetDefault}" cal:Message.Attach="[Event Click] = [Action PresetSetDefault]" />
+ <Separator />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.MainView_UpdateSelectedPreset}" cal:Message.Attach="[Event Click] = [Action PresetUpdate]" />
+ <Separator />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Preset_Import}" cal:Message.Attach="[Event Click] = [Action PresetImport]" />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Preset_Export}" cal:Message.Attach="[Event Click] = [Action PresetExport]" />
+ <Separator />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.MainView_ResetBuiltInPresets}" cal:Message.Attach="[Event Click] = [Action PresetReset]" />
+ </MenuItem>
+ </Menu>
+ </ToolBarOverflowPanel>
+
+ </ToolBar>
+ </Grid>
+ </GroupBox>
</Grid>
+
+
<!-- Source Selection-->
<Controls:SourceSelection x:Name="sourceSelection"
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
index f6f1799c1..74220b160 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
@@ -86,5 +86,46 @@ namespace HandBrakeWPF.Views
button.ContextMenu.IsOpen = true;
}
}
+
+ private void ToolBarLoaded(object sender, RoutedEventArgs e)
+ {
+ ToolBar toolBar = sender as ToolBar;
+ if (toolBar != null)
+ {
+ var overflowGrid = toolBar.Template.FindName("OverflowGrid", toolBar) as FrameworkElement;
+ if (overflowGrid != null)
+ {
+ overflowGrid.Visibility = Visibility.Collapsed;
+ }
+ }
+ }
+
+ private void PresetTreeviewItemCollasped(object sender, RoutedEventArgs e)
+ {
+ if (e.Source.GetType() == typeof(TreeViewItem))
+ {
+ TreeViewItem item = e.Source as TreeViewItem;
+ if (item != null) item.IsSelected = false;
+ }
+ }
+
+ private void PresetListTree_OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
+
+ if (treeViewItem != null)
+ {
+ treeViewItem.Focus();
+ e.Handled = true;
+ }
+ }
+
+ private static TreeViewItem VisualUpwardSearch(DependencyObject source)
+ {
+ while (source != null && !(source is TreeViewItem))
+ source = VisualTreeHelper.GetParent(source);
+
+ return source as TreeViewItem;
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml b/win/CS/HandBrakeWPF/Views/ShellView.xaml
index 5e29615d3..0f31986c4 100644
--- a/win/CS/HandBrakeWPF/Views/ShellView.xaml
+++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml
@@ -6,9 +6,9 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:cal="http://www.caliburnproject.org"
Title="{Data:Binding Path=MainViewModel.WindowTitle}"
- Width="900"
+ Width="1015"
Height="675"
- MinWidth="800"
+ MinWidth="900"
MinHeight="675"
AllowDrop="True"
SnapsToDevicePixels="True"