GARbro-mirror/GUI/SettingsWindow.xaml

191 lines
12 KiB
Plaintext
Raw Normal View History

2018-01-10 02:44:21 +04:00
<!-- Game Resource browser
Copyright (C) 2018 by morkt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
<Window x:Class="GARbro.GUI.SettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:GARbro.GUI.Strings"
xmlns:local="clr-namespace:GARbro.GUI"
Title="{x:Static s:guiStrings.TextPreferences}" ShowInTaskbar="False" ResizeMode="NoResize"
2018-01-10 02:44:21 +04:00
FocusManager.FocusedElement="{Binding ElementName=SectionsPane}"
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
Height="400" Width="500" WindowStartupLocation="CenterOwner">
2018-01-10 02:44:21 +04:00
<Window.Resources>
<LinearGradientBrush x:Key="SectionTitleBackground" StartPoint="0,0" EndPoint="1,0">
<GradientStop Color="#FFA0A0FF" Offset="0"/>
<GradientStop Color="#FFE0E0FF" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="ItemSelectedBackground" StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#FF6AA2DC" Offset="0"/>
<GradientStop Color="#FF226EBC" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="ItemInactiveBackground" StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#FFA4B0DB" Offset="0"/>
<GradientStop Color="#FF91A2C4" Offset="1"/>
</LinearGradientBrush>
<ControlTemplate x:Key="BoundCheckBox" TargetType="CheckBox">
<CheckBox DataContext="{TemplateBinding DataContext}" IsChecked="{Binding Value}"
Content="{Binding Text}" ToolTip="{Binding Description}" Margin="2"/>
</ControlTemplate>
<ControlTemplate x:Key="BoundSlider" TargetType="Slider">
<StackPanel Orientation="Vertical" Margin="2" DataContext="{TemplateBinding DataContext}">
<TextBlock Text="{Binding Text}" ToolTip="{Binding Description}" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0" VerticalAlignment="Center">
<Slider Orientation="Horizontal" IsSnapToTickEnabled="True" Width="120" x:Name="GaugeSlider"
TickPlacement="BottomRight" Ticks="{TemplateBinding Ticks}"
Minimum="{Binding Path=Source.Min}" Maximum="{Binding Path=Source.Max}"
Value="{Binding Value}"/>
<TextBlock Text="{Binding ElementName=GaugeSlider,Path=Value}" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="2,0,0,0"/>
</StackPanel>
</StackPanel>
</ControlTemplate>
2018-01-10 02:44:21 +04:00
<Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Padding="5" Background="#00FFFFFF" Width="16" Height="16">
<Path Fill="#FF595959" Stroke="#FF262626" x:Name="ExpandPath">
<Path.Data>
<PathGeometry Figures="M0,0L0,6L6,0z" />
</Path.Data>
<Path.RenderTransform>
<RotateTransform Angle="135" CenterX="3" CenterY="3" />
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ExpandPath" Property="Stroke" Value="#FF1BBBFF" />
<Setter TargetName="ExpandPath" Property="Fill" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="ExpandPath" Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="180" CenterX="3" CenterY="3" />
</Setter.Value>
</Setter>
<Setter TargetName="ExpandPath" Property="Fill" Value="#FF595959" />
<Setter TargetName="ExpandPath" Property="Stroke" Value="#FF262626" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Type TreeViewItem}" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
<Setter Property="IsExpanded" Value="True"/>
<Setter Property="HorizontalContentAlignment" Value="Left" />
<!-- Force right-click to select TreeViewItem -->
<EventSetter Event="MouseRightButtonDown" Handler="tvi_MouseRightButtonDown" />
<!-- Select the whole TreeViewItem row, not only Header region -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<ControlTemplate.Resources>
<local:LeftMarginMultiplierConverter Length="19" x:Key="lengthConverter" />
</ControlTemplate.Resources>
<StackPanel>
<Border x:Name="Bd" HorizontalAlignment="Stretch" Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True" Grid.Column="1">
<Grid Margin="{Binding Converter={StaticResource lengthConverter}, RelativeSource={RelativeSource TemplatedParent}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="19" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ToggleButton IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleStyle}"
ClickMode="Press" Name="Expander"/>
<ContentPresenter x:Name="PART_Header" Grid.Column="1" ContentSource="Header"
Content="{TemplateBinding HeaderedContentControl.Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentStringFormat="{TemplateBinding HeaderStringFormat}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</Border>
<ItemsPresenter x:Name="ItemsHost"/>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="False">
<Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="HasItems" Value="False">
<Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{StaticResource ItemSelectedBackground}"/>
<Setter Property="Foreground" Value="White" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True" />
<Condition Property="IsSelectionActive" Value="False" />
<Condition Property="IsFocused" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="Bd" Property="Background" Value="{StaticResource ItemInactiveBackground}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<DockPanel Margin="8">
<StackPanel DockPanel.Dock="Bottom" Margin="0,10,0,0" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
<Button Width="75" Height="25" Margin="0,0,10,0" Content="{x:Static s:guiStrings.ButtonOK}" IsDefault="True" Click="Button_ClickOk"/>
<Button Width="75" Height="25" Margin="0,0,10,0" Content="{x:Static s:guiStrings.ButtonCancel}" IsCancel="True"/>
<Button Width="75" Height="25" Margin="0" Content="{x:Static s:guiStrings.ButtonApply}" Click="Button_ClickApply" IsEnabled="{Binding HasChanges}"/>
2018-01-10 02:44:21 +04:00
</StackPanel>
<TreeView x:Name="SectionsPane" DockPanel.Dock="Left" Padding="4" ItemsSource="{Binding Root}"
TreeViewItem.Selected="OnSectionChanged">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<TextBlock Text="{Binding Label}" Padding="0,0,4,0"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<Border DockPanel.Dock="Right" BorderThickness="1" BorderBrush="Black" Margin="4,0,0,0" SnapsToDevicePixels="True">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Padding="3"
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
<StackPanel Orientation="Vertical" DataContext="{Binding ElementName=SectionsPane,Path=SelectedItem}">
<TextBlock Text="{Binding SectionTitle}" Background="{StaticResource SectionTitleBackground}"
FontWeight="Bold" FontSize="14" Padding="2,0,2,0" Margin="0,0,0,4"/>
2018-01-11 18:45:23 +04:00
<Decorator x:Name="SettingsPane"/>
2018-01-10 02:44:21 +04:00
</StackPanel>
</ScrollViewer>
</Border>
</DockPanel>
</Window>