mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
325 lines
19 KiB
XML
325 lines
19 KiB
XML
<Controls:MetroWindow x:Class="FancyZonesEditor.MainWindow"
|
|
x:Name="MainWindow1"
|
|
AutomationProperties.Name="{x:Static props:Resources.Fancy_Zones_Main_Editor}"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
|
xmlns:local="clr-namespace:FancyZonesEditor"
|
|
xmlns:Converters="clr-namespace:FancyZonesEditor.Converters"
|
|
xmlns:props="clr-namespace:FancyZonesEditor.Properties"
|
|
mc:Ignorable="d"
|
|
Title=""
|
|
Width="810"
|
|
SizeToContent="Height"
|
|
Background="White"
|
|
ResizeMode="NoResize"
|
|
WindowStartupLocation="CenterScreen"
|
|
Initialized="OnInitialized"
|
|
Closing="OnClosing">
|
|
<Window.Resources>
|
|
<Converters:BooleanToBrushConverter x:Key="BooleanToBrushConverter" />
|
|
<Converters:ModelToVisibilityConverter x:Key="ModelToVisibilityConverter" />
|
|
<Converters:BooleanToIntConverter x:Key="BooleanToIntConverter" />
|
|
|
|
<Style x:Key="titleText" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="Bold" />
|
|
<Setter Property="LineHeight" Value="24" />
|
|
<Setter Property="FontSize" Value="18"/>
|
|
<Setter Property="Margin" Value="16,20,0,0" />
|
|
</Style>
|
|
<Style x:Key="zoneCount" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="Regular" />
|
|
<Setter Property="FontSize" Value="24"/>
|
|
<Setter Property="LineHeight" Value="24" />
|
|
<Setter Property="Margin" Value="20,0,20,0" />
|
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
</Style>
|
|
<Style x:Key="tabText" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Foreground" Value="#767676"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="LineHeight" Value="20" />
|
|
<Setter Property="Margin" Value="24,20,0,0" />
|
|
<Setter Property="TextAlignment" Value="Center" />
|
|
</Style>
|
|
<Style x:Key="settingText" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="LineHeight" Value="20" />
|
|
<Setter Property="Margin" Value="7,10,0,0" />
|
|
<Setter Property="TextAlignment" Value="Left" />
|
|
</Style>
|
|
<Style x:Key="settingCheckBoxText" TargetType="CheckBox">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="Margin" Value="5,10,0,0" />
|
|
</Style>
|
|
<Style x:Key="templateTitleText" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="TextAlignment" Value="Center" />
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
</Style>
|
|
<Style x:Key="customButtonFocusVisualStyle">
|
|
<Setter Property="Control.Template">
|
|
<Setter.Value>
|
|
<ControlTemplate>
|
|
<Rectangle Margin="1" Stroke="White" StrokeDashArray="1 2" StrokeThickness="1" />
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style x:Key="secondaryButton" TargetType="Button">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Foreground" Value="White"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="Padding" Value="0,5,0,5"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="Background" Value="#767676"/>
|
|
<Setter Property="Margin" Value="16,0,0,0" />
|
|
<Setter Property="Width" Value="378"/>
|
|
<Setter Property="Height" Value="32"/>
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource customButtonFocusVisualStyle}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type Button}">
|
|
<Border Background="{TemplateBinding Background}">
|
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="#5D5D5D"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style x:Key="primaryButton" TargetType="Button">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Foreground" Value="White"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="Padding" Value="0,5,0,5"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="Background" Value="#0078D7"/>
|
|
<Setter Property="Margin" Value="16,0,16,0" />
|
|
<Setter Property="Width" Value="377"/>
|
|
<Setter Property="Height" Value="32"/>
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource customButtonFocusVisualStyle}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type Button}">
|
|
<Border Background="{TemplateBinding Background}">
|
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="#024D89"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style x:Key="spinnerButton" TargetType="Button">
|
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
<Setter Property="FontSize" Value="24"/>
|
|
<Setter Property="Padding" Value="0,0,0,5"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="Background" Value="#F2F2F2"/>
|
|
<Setter Property="Margin" Value="0,0,0,0" />
|
|
</Style>
|
|
<Style x:Key="newLayoutButton" TargetType="Button">
|
|
<Setter Property="Background" Value="#f2f2f2"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="FontFamily" Value="SegoeUI"/>
|
|
<Setter Property="FontWeight" Value="Light"/>
|
|
<Setter Property="FontSize" Value="148"/>
|
|
</Style>
|
|
<Style x:Key="textBox" TargetType="TextBox">
|
|
<Setter Property="BorderBrush" Value="#cccccc"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
<Setter Property="FontFamily" Value="SegoeUI"/>
|
|
<Setter Property="FontWeight" Value="Regular"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
<Setter Property="Margin" Value="16,6,0,0"/>
|
|
<Setter Property="Padding" Value="5,5,5,5"/>
|
|
</Style>
|
|
|
|
<Style x:Key="templateBackground" TargetType="Border">
|
|
<Setter Property="Background" Value="#F2F2F2"/>
|
|
<Setter Property="CornerRadius" Value="4"/>
|
|
<Setter Property="BorderThickness" Value="2"/>
|
|
</Style>
|
|
|
|
<ControlTemplate x:Key="myTabs">
|
|
<Grid Width="404">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="2"/>
|
|
</Grid.RowDefinitions>
|
|
<TextBlock Grid.Row="0" Name="myTabText" Text="{TemplateBinding TabItem.Header}" Style="{StaticResource tabText}" />
|
|
<Rectangle Grid.Row="1" x:Name="myTabLine" Fill="#F2F2F2" Height="1"/>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="TabItem.IsSelected" Value="True">
|
|
<Setter TargetName="myTabText" Property="Foreground" Value="#2A79D7"/>
|
|
<Setter TargetName="myTabLine" Property="Fill" Value="#2A79D7" />
|
|
<Setter TargetName="myTabLine" Property="Height" Value="2"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Window.Resources>
|
|
|
|
<StackPanel FocusManager.FocusedElement="{Binding ElementName=decrementZones}">
|
|
|
|
<TextBlock Name="DialogTitle" Text="{x:Static props:Resources.Choose_Layout}" Style="{StaticResource titleText}" />
|
|
|
|
<TabControl BorderThickness="0" x:Name="TemplateTab" AutomationProperties.LabeledBy="{Binding ElementName=DialogTitle}" SelectedIndex="{Binding IsCustomLayoutActive, Mode=OneWay, Converter={StaticResource BooleanToIntConverter}}">
|
|
<TabItem Header="{x:Static props:Resources.Templates}" Template="{StaticResource myTabs}">
|
|
<StackPanel>
|
|
<StackPanel Margin="0,15,0,8" Orientation="Horizontal" HorizontalAlignment="Center">
|
|
<Button x:Name="decrementZones" Width="40" Height="40" AutomationProperties.Name="{x:Static props:Resources.Zone_Count_Decrement}" Content="-" Style="{StaticResource spinnerButton}" Click="DecrementZones_Click"/>
|
|
<TextBlock x:Name="zoneCount" Text="{Binding ZoneCount}" Style="{StaticResource zoneCount}"/>
|
|
<Button x:Name="incrementZones" Width="40" Height="40" AutomationProperties.Name="{x:Static props:Resources.Zone_Count_Increment}" Content="+" Style="{StaticResource spinnerButton}" Click="IncrementZones_Click"/>
|
|
</StackPanel>
|
|
<ItemsControl ItemsSource="{Binding DefaultModels}" Margin="8,0,0,0">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel Orientation="Horizontal" ItemWidth="{Binding ElementName=MainWindow1, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Path=WrapPanelItemSize}" ItemHeight="{Binding ElementName=WrapPanel1, Path=ItemWidth}" x:Name="WrapPanel1" />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="8"
|
|
BorderBrush="{Binding Path=IsSelected, Converter={StaticResource BooleanToBrushConverter}}"
|
|
Style="{StaticResource templateBackground}"
|
|
MouseDown="LayoutItem_Click"
|
|
Focusable="True"
|
|
FocusManager.GotFocus="LayoutItem_Focused"
|
|
KeyDown="LayoutItem_Apply">
|
|
<DockPanel Margin="0,20,0,0"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalAlignment="Stretch"
|
|
LastChildFill="True">
|
|
<TextBlock Padding="8,0,8,0"
|
|
TextTrimming="CharacterEllipsis"
|
|
DockPanel.Dock="Top"
|
|
Text="{Binding Name}"
|
|
Style="{StaticResource templateTitleText}" />
|
|
<local:LayoutPreview Margin="16" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
|
|
</DockPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</StackPanel>
|
|
</TabItem>
|
|
|
|
|
|
<TabItem Header="{x:Static props:Resources.Custom}" Template="{StaticResource myTabs}">
|
|
<StackPanel>
|
|
<ItemsControl ItemsSource="{Binding CustomModels}" Margin="8,8,0,0">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel Orientation="Horizontal" ItemWidth="{Binding ElementName=MainWindow1, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Path=WrapPanelItemSize}" ItemHeight="{Binding ElementName=WrapPanel2, Path=ItemWidth}" x:Name="WrapPanel2" />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="8"
|
|
BorderBrush="{Binding Path=IsSelected, Converter={StaticResource BooleanToBrushConverter}}"
|
|
Style="{StaticResource templateBackground}"
|
|
MouseDown="LayoutItem_Click"
|
|
Focusable="True"
|
|
FocusManager.GotFocus="LayoutItem_Focused"
|
|
KeyDown="LayoutItem_Apply">
|
|
<DockPanel Margin="0,20,0,0"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalAlignment="Stretch"
|
|
LastChildFill="True">
|
|
<DockPanel DockPanel.Dock="Top" LastChildFill="True" >
|
|
<Button x:Name="DeleteButton" AutomationProperties.Name="{x:Static props:Resources.Custom_Layout_Delete_Button}"
|
|
Visibility="{Binding Converter={StaticResource ModelToVisibilityConverter}}"
|
|
DockPanel.Dock="Right"
|
|
MaxHeight="10"
|
|
Click="OnDelete"
|
|
Padding="8,4,8,4"
|
|
Margin="0,0,8,0"
|
|
BorderThickness="0"
|
|
Background="#f2f2f2">
|
|
<Image Source="images/Delete.png" />
|
|
</Button>
|
|
<TextBlock DockPanel.Dock="Top"
|
|
TextTrimming="CharacterEllipsis" Padding="8,0,8,0"
|
|
Text="{Binding Name}"
|
|
Style="{StaticResource templateTitleText}" />
|
|
</DockPanel>
|
|
<local:LayoutPreview Margin="16" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
|
|
</DockPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
</StackPanel>
|
|
</TabItem>
|
|
</TabControl>
|
|
|
|
<Grid Margin="10,4,10,8" >
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="1*" />
|
|
<RowDefinition Height="1*" />
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="1*" />
|
|
<ColumnDefinition Width="1*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<CheckBox x:Name="spaceAroundSetting" Content="{x:Static props:Resources.Show_Space_Zones}" Style="{StaticResource settingCheckBoxText}" IsChecked="{Binding ShowSpacing}" Grid.Row="0" Grid.Column="0"/>
|
|
|
|
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
|
|
<TextBlock x:Name="paddingValue"
|
|
Text="{x:Static props:Resources.Space_Around_Zones}"
|
|
Style="{StaticResource settingText}"
|
|
IsEnabled="{Binding ShowSpacing}"
|
|
MaxWidth="{Binding Path=SettingsTextMaxWidth, ElementName=MainWindow1}"
|
|
TextWrapping="Wrap"/>
|
|
<TextBox AutomationProperties.LabeledBy="{Binding ElementName=paddingValue}" Text="{Binding Path=Spacing,Mode=TwoWay}" Style="{StaticResource textBox}" MinWidth="32" IsEnabled="{Binding ShowSpacing}" />
|
|
</StackPanel>
|
|
|
|
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
|
|
<TextBlock x:Name="sensitivityRadiusValue"
|
|
Text="{x:Static props:Resources.Distance_adjacent_zones}"
|
|
Style="{StaticResource settingText}"
|
|
MaxWidth="{Binding Path=SettingsTextMaxWidth, ElementName=MainWindow1}"
|
|
TextWrapping="Wrap"/>
|
|
<TextBox AutomationProperties.LabeledBy="{Binding ElementName=sensitivityRadiusValue}" Text="{Binding Path=SensitivityRadius,Mode=TwoWay}" Style="{StaticResource textBox}" MinWidth="40"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
<StackPanel Orientation="Horizontal" Margin="0,10,0,16">
|
|
<Button x:Name="EditCustomButton" Content="{x:Static props:Resources.Edit_Selected_Layout}" Padding="8" Style="{StaticResource secondaryButton}" Click="EditLayout_Click"/>
|
|
<Button x:Name="ApplyCustomButton" Content="{x:Static props:Resources.Apply}" Padding="8" Style="{StaticResource primaryButton}" Click="Apply_Click"/>
|
|
</StackPanel>
|
|
|
|
</StackPanel>
|
|
</Controls:MetroWindow>
|