Category editor redesign, English as default language
- Category editor: icon tile per category opens an icon + color picker (no clipped mini combo boxes), placeholders explained, live preview - Header glyph removed; dialog follows the shared styles - Dialogs opened from Settings are owned by the active window (category editor could open behind the settings window) - Default language is English; German via Settings > Language Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,55 +2,66 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
Title="{Binding [Categories]}"
|
Title="{Binding [Categories]}"
|
||||||
Width="780" SizeToContent="Height" MaxHeight="720"
|
Width="760" SizeToContent="Height" MaxHeight="760"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False"
|
||||||
ResizeMode="NoResize"
|
WindowStyle="None" AllowsTransparency="True" Background="Transparent"
|
||||||
ShowInTaskbar="False"
|
FontFamily="{StaticResource UiFont}" FontSize="13" Foreground="{DynamicResource TextPrimaryBrush}"
|
||||||
WindowStyle="None"
|
UseLayoutRounding="True"
|
||||||
AllowsTransparency="True"
|
MouseLeftButtonDown="Window_MouseLeftButtonDown" KeyDown="Window_KeyDown">
|
||||||
Background="Transparent"
|
|
||||||
MouseLeftButtonDown="Window_MouseLeftButtonDown">
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
|
|
||||||
<SolidColorBrush x:Key="DangerBrush" Color="#EF4444"/>
|
|
||||||
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1E293B"/>
|
|
||||||
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#64748B"/>
|
|
||||||
<SolidColorBrush x:Key="BorderBrush" Color="#CBD5E1"/>
|
|
||||||
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
|
|
||||||
<SolidColorBrush x:Key="InputBackgroundBrush" Color="#F1F5F9"/>
|
|
||||||
<SolidColorBrush x:Key="HoverBrush" Color="#E2E8F0"/>
|
|
||||||
|
|
||||||
<Style x:Key="Input" TargetType="TextBox">
|
<Style x:Key="Input" TargetType="TextBox">
|
||||||
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
|
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
|
||||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||||
<Setter Property="CaretBrush" Value="{DynamicResource TextPrimaryBrush}"/>
|
<Setter Property="CaretBrush" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
|
||||||
<Setter Property="BorderThickness" Value="1"/>
|
|
||||||
<Setter Property="Padding" Value="8,5"/>
|
|
||||||
<Setter Property="FontSize" Value="13"/>
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
<Setter Property="Height" Value="34"/>
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="TextBox">
|
||||||
|
<Border x:Name="Bd" CornerRadius="6" BorderThickness="1" Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" Padding="9,0">
|
||||||
|
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource TextTertiaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||||
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="DialogButton" TargetType="Button">
|
<Style x:Key="ColHead" TargetType="TextBlock">
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="FontSize" Value="11.5"/>
|
||||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
|
||||||
<Setter Property="BorderThickness" Value="1"/>
|
</Style>
|
||||||
<Setter Property="Padding" Value="18,8"/>
|
|
||||||
|
<Style x:Key="Code" TargetType="Border">
|
||||||
|
<Setter Property="CornerRadius" Value="4"/>
|
||||||
|
<Setter Property="Padding" Value="5,0"/>
|
||||||
|
<Setter Property="Margin" Value="0,0,5,0"/>
|
||||||
|
<Setter Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- one glyph / color choice inside the picker popup -->
|
||||||
|
<Style x:Key="PickButton" TargetType="Button">
|
||||||
<Setter Property="Cursor" Value="Hand"/>
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Margin" Value="2"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
<Border x:Name="Bd" Width="32" Height="32" CornerRadius="6" Background="Transparent">
|
||||||
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
|
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter TargetName="bd" Property="Opacity" Value="0.85"/>
|
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||||
</Trigger>
|
|
||||||
<Trigger Property="IsEnabled" Value="False">
|
|
||||||
<Setter TargetName="bd" Property="Opacity" Value="0.35"/>
|
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</ControlTemplate.Triggers>
|
</ControlTemplate.Triggers>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
@@ -59,9 +70,9 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
<Border CornerRadius="10" Background="{DynamicResource CardBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Margin="10">
|
<Border Margin="12" CornerRadius="10" Background="{DynamicResource CardBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
||||||
<Border.Effect>
|
<Border.Effect>
|
||||||
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.25" Direction="270" Color="Black"/>
|
<DropShadowEffect BlurRadius="24" ShadowDepth="6" Opacity="0.28" Direction="270" Color="Black"/>
|
||||||
</Border.Effect>
|
</Border.Effect>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -71,95 +82,136 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Header -->
|
<!-- header -->
|
||||||
<Border Background="Transparent" CornerRadius="12,12,0,0" Padding="20,14,12,6">
|
<DockPanel Margin="24,18,14,0">
|
||||||
<Grid>
|
<Button DockPanel.Dock="Right" Content="" Style="{StaticResource IconButton}" FontSize="10" Click="Cancel_Click" ToolTip="Esc"/>
|
||||||
<StackPanel Orientation="Horizontal">
|
<TextBlock Text="{Binding [Categories]}" FontSize="18" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="15" Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
</DockPanel>
|
||||||
<TextBlock Text="{Binding [Categories]}" FontSize="16" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
|
||||||
</StackPanel>
|
|
||||||
<Button Content="" Style="{StaticResource IconButton}" FontSize="10" HorizontalAlignment="Right" Click="Cancel_Click" IsCancel="True"/>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- Hint + column titles -->
|
<!-- explanation + column heads -->
|
||||||
<StackPanel Grid.Row="1" Margin="18,14,18,4">
|
<StackPanel Grid.Row="1" Margin="24,6,24,0">
|
||||||
<TextBlock Text="{Binding [CategoriesHint]}" FontSize="12" TextWrapping="Wrap" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
<TextBlock Text="{Binding [CategoriesIntro]}" FontSize="12.5" TextWrapping="Wrap" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
<Grid Margin="0,12,0,0">
|
<WrapPanel Margin="0,8,0,0" TextElement.FontSize="12" TextElement.Foreground="{DynamicResource TextSecondaryBrush}">
|
||||||
|
<Border Style="{StaticResource Code}"><TextBlock Text="{}{0}" FontFamily="Consolas" Foreground="{DynamicResource TextPrimaryBrush}"/></Border>
|
||||||
|
<TextBlock Text="{Binding [CatPlaceholderYears]}" Margin="0,0,16,0" VerticalAlignment="Center"/>
|
||||||
|
<Border Style="{StaticResource Code}"><TextBlock Text="{}{o}" FontFamily="Consolas" Foreground="{DynamicResource TextPrimaryBrush}"/></Border>
|
||||||
|
<TextBlock Text="{Binding [CatPlaceholderOrdinal]}" VerticalAlignment="Center"/>
|
||||||
|
</WrapPanel>
|
||||||
|
|
||||||
|
<Grid Margin="0,18,8,6">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="56"/>
|
<ColumnDefinition Width="52"/>
|
||||||
<ColumnDefinition Width="56"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="170"/>
|
<ColumnDefinition Width="200"/>
|
||||||
<ColumnDefinition Width="190"/>
|
<ColumnDefinition Width="190"/>
|
||||||
<ColumnDefinition Width="34"/>
|
<ColumnDefinition Width="34"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Column="0" Text="{Binding [CatIcon]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
<TextBlock Grid.Column="1" Text="{Binding [Name]}" Style="{StaticResource ColHead}"/>
|
||||||
<TextBlock Grid.Column="1" Text="{Binding [Color]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
<TextBlock Grid.Column="2" Text="{Binding [CatText]}" Style="{StaticResource ColHead}" Margin="10,0,0,0"/>
|
||||||
<TextBlock Grid.Column="2" Text="{Binding [Name]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
<TextBlock Grid.Column="3" Text="{Binding [CatExample]}" Style="{StaticResource ColHead}" Margin="14,0,0,0"/>
|
||||||
<TextBlock Grid.Column="3" Text="{Binding [CatText]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}" Margin="8,0,0,0"/>
|
|
||||||
<TextBlock Grid.Column="4" Text="{Binding [CatExample]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}" Margin="8,0,0,0"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Rows -->
|
<!-- rows -->
|
||||||
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto" Margin="18,0,10,0" MaxHeight="440">
|
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto" Margin="24,0,16,0" MaxHeight="420">
|
||||||
<ItemsControl x:Name="Rows" Margin="0,0,8,0">
|
<ItemsControl x:Name="Rows" Margin="0,0,8,0">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid Margin="0,4">
|
<Grid Margin="0,4">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="56"/>
|
<ColumnDefinition Width="52"/>
|
||||||
<ColumnDefinition Width="56"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="170"/>
|
<ColumnDefinition Width="200"/>
|
||||||
<ColumnDefinition Width="190"/>
|
<ColumnDefinition Width="190"/>
|
||||||
<ColumnDefinition Width="34"/>
|
<ColumnDefinition Width="34"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<ComboBox Grid.Column="0" Width="50" Height="30" HorizontalAlignment="Left"
|
<!-- icon tile: click opens icon + color picker -->
|
||||||
ItemsSource="{Binding Glyphs, RelativeSource={RelativeSource AncestorType=Window}}"
|
<ToggleButton x:Name="Tile" Width="38" Height="34" HorizontalAlignment="Left" Cursor="Hand"
|
||||||
SelectedItem="{Binding Glyph}">
|
AutomationProperties.Name="{Binding DataContext[CatChangeLook], RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
<ComboBox.ItemTemplate>
|
ToolTip="{Binding DataContext[CatChangeLook], RelativeSource={RelativeSource AncestorType=Window}}">
|
||||||
|
<ToggleButton.Template>
|
||||||
|
<ControlTemplate TargetType="ToggleButton">
|
||||||
|
<Border x:Name="Bd" CornerRadius="8" BorderThickness="1" BorderBrush="Transparent"
|
||||||
|
Background="{Binding Color, Converter={StaticResource HexToBrush}, ConverterParameter=0.16}">
|
||||||
|
<TextBlock Text="{Binding Glyph}" FontFamily="{StaticResource IconFont}" FontSize="15"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
Foreground="{Binding Color, Converter={StaticResource HexToBrush}}"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{Binding Color, Converter={StaticResource HexToBrush}, ConverterParameter=0.6}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{Binding Color, Converter={StaticResource HexToBrush}}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</ToggleButton.Template>
|
||||||
|
</ToggleButton>
|
||||||
|
<Popup IsOpen="{Binding IsChecked, ElementName=Tile, Mode=TwoWay}" PlacementTarget="{Binding ElementName=Tile}" Placement="Bottom"
|
||||||
|
StaysOpen="False" AllowsTransparency="True" PopupAnimation="Fade" VerticalOffset="4">
|
||||||
|
<Border Background="{DynamicResource MenuBackgroundBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||||
|
CornerRadius="8" Padding="10" Margin="6,0,6,10" Width="244">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="14" ShadowDepth="3" Opacity="0.22" Color="Black"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{Binding DataContext[CatIcon], RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
|
FontSize="11.5" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}" Margin="2,0,0,4"/>
|
||||||
|
<ItemsControl ItemsSource="{Binding Glyphs, RelativeSource={RelativeSource AncestorType=Window}}">
|
||||||
|
<ItemsControl.ItemsPanel><ItemsPanelTemplate><WrapPanel/></ItemsPanelTemplate></ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding}" FontFamily="Segoe MDL2 Assets" FontSize="14"/>
|
<Button Style="{StaticResource PickButton}" Click="PickGlyph_Click" Tag="{Binding}">
|
||||||
|
<TextBlock Text="{Binding}" FontFamily="{StaticResource IconFont}" FontSize="15"
|
||||||
|
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
</Button>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ComboBox>
|
</ItemsControl>
|
||||||
|
<TextBlock Text="{Binding DataContext[Color], RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
<ComboBox Grid.Column="1" Width="50" Height="30" HorizontalAlignment="Left"
|
FontSize="11.5" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}" Margin="2,10,0,4"/>
|
||||||
ItemsSource="{Binding Palette, RelativeSource={RelativeSource AncestorType=Window}}"
|
<ItemsControl ItemsSource="{Binding Palette, RelativeSource={RelativeSource AncestorType=Window}}">
|
||||||
SelectedItem="{Binding Color}">
|
<ItemsControl.ItemsPanel><ItemsPanelTemplate><WrapPanel/></ItemsPanelTemplate></ItemsControl.ItemsPanel>
|
||||||
<ComboBox.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Ellipse Width="14" Height="14" Fill="{Binding Converter={StaticResource HexToBrush}}"/>
|
<Button Style="{StaticResource PickButton}" Click="PickColor_Click" Tag="{Binding}">
|
||||||
|
<Ellipse Width="18" Height="18" Fill="{Binding Converter={StaticResource HexToBrush}}"/>
|
||||||
|
</Button>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ComboBox>
|
</ItemsControl>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Popup>
|
||||||
|
|
||||||
<TextBox Grid.Column="2" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"/>
|
<TextBox Grid.Column="1" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"/>
|
||||||
<TextBox Grid.Column="3" Text="{Binding Format, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}" Margin="8,0,0,0"/>
|
<TextBox Grid.Column="2" Text="{Binding Format, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}" Margin="10,0,0,0"/>
|
||||||
|
|
||||||
<TextBlock Grid.Column="4" Margin="8,0,0,0" VerticalAlignment="Center" FontSize="11" TextTrimming="CharacterEllipsis"
|
<TextBlock Grid.Column="3" Margin="14,0,0,0" VerticalAlignment="Center" FontSize="12.5" TextTrimming="CharacterEllipsis"
|
||||||
Foreground="{Binding Color, Converter={StaticResource HexToBrush}}"
|
Foreground="{DynamicResource TextSecondaryBrush}" Loaded="Example_Loaded" Tag="{Binding}"/>
|
||||||
Loaded="Example_Loaded" Tag="{Binding}"/>
|
|
||||||
|
|
||||||
<Button Grid.Column="5" Content="" FontFamily="Segoe MDL2 Assets" FontSize="12" Width="28" Height="28"
|
<Button Grid.Column="4" Content="" Style="{StaticResource IconButton}" HorizontalAlignment="Right"
|
||||||
Background="Transparent" BorderThickness="0" Cursor="Hand" Foreground="{DynamicResource DangerBrush}"
|
Click="Delete_Click" Tag="{Binding}"
|
||||||
Click="Delete_Click" Tag="{Binding}" ToolTip="{Binding DataContext[Delete], RelativeSource={RelativeSource AncestorType=Window}}"/>
|
ToolTip="{Binding DataContext[Delete], RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- buttons -->
|
||||||
<DockPanel Grid.Row="3" Margin="18,12,18,18">
|
<DockPanel Grid.Row="3" Margin="24,16,24,20">
|
||||||
<Button DockPanel.Dock="Left" Content="{Binding [AddCategory]}" Style="{StaticResource DialogButton}" Click="Add_Click"/>
|
<Button DockPanel.Dock="Left" Style="{StaticResource SubtleButton}" Click="Add_Click">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="" FontFamily="{StaticResource IconFont}" FontSize="11" VerticalAlignment="Center" Margin="0,1,8,0"/>
|
||||||
|
<TextBlock Text="{Binding [AddCategoryShort]}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button Content="{Binding [Cancel]}" Style="{StaticResource DialogButton}" Click="Cancel_Click"/>
|
<Button Content="{Binding [Cancel]}" Style="{StaticResource SubtleButton}" Click="Cancel_Click"/>
|
||||||
<Button Content="{Binding [Save]}" Style="{StaticResource DialogButton}" Click="Save_Click" IsDefault="True"
|
<Button Content="{Binding [Save]}" Style="{StaticResource PrimaryButton}" Click="Save_Click" IsDefault="True" Margin="8,0,0,0"/>
|
||||||
Background="{DynamicResource PrimaryBrush}" Foreground="White" BorderThickness="0" Margin="8,0,0,0"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -112,6 +112,33 @@ namespace ReminderOrganizer
|
|||||||
|
|
||||||
private void Cancel_Click(object sender, RoutedEventArgs e) => DialogResult = false;
|
private void Cancel_Click(object sender, RoutedEventArgs e) => DialogResult = false;
|
||||||
|
|
||||||
|
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape) DialogResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The picker buttons live in a popup; walk up (visual, then logical) to the category row.</summary>
|
||||||
|
private static Category? CategoryOf(object sender)
|
||||||
|
{
|
||||||
|
DependencyObject? d = sender as DependencyObject;
|
||||||
|
while (d != null)
|
||||||
|
{
|
||||||
|
if (d is FrameworkElement { DataContext: Category c }) return c;
|
||||||
|
d = System.Windows.Media.VisualTreeHelper.GetParent(d) ?? LogicalTreeHelper.GetParent(d);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PickGlyph_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is FrameworkElement { Tag: string glyph } && CategoryOf(sender) is { } c) c.Glyph = glyph;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PickColor_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is FrameworkElement { Tag: string color } && CategoryOf(sender) is { } c) c.Color = color;
|
||||||
|
}
|
||||||
|
|
||||||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.LeftButton == MouseButtonState.Pressed && e.OriginalSource is not TextBox) DragMove();
|
if (e.LeftButton == MouseButtonState.Pressed && e.OriginalSource is not TextBox) DragMove();
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace ReminderOrganizer.Core
|
namespace ReminderOrganizer.Core
|
||||||
{
|
{
|
||||||
/// <summary>Defaults taken from Windows until the user picks something in the app.</summary>
|
/// <summary>Windows settings the app follows until the user picks something (theme).</summary>
|
||||||
public static class SystemPrefs
|
public static class SystemPrefs
|
||||||
{
|
{
|
||||||
public static string Language(CultureInfo? culture = null) =>
|
|
||||||
(culture ?? CultureInfo.CurrentUICulture).TwoLetterISOLanguageName == "de" ? "de" : "en";
|
|
||||||
|
|
||||||
public static bool IsDarkMode()
|
public static bool IsDarkMode()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -138,11 +138,9 @@
|
|||||||
"AnniversaryDate": "Datum",
|
"AnniversaryDate": "Datum",
|
||||||
"Category": "Kategorie",
|
"Category": "Kategorie",
|
||||||
"Categories": "Kategorien",
|
"Categories": "Kategorien",
|
||||||
"CategoriesHint": "Jahrestage wiederholen sich jährlich und haben keine Uhrzeit. Im Text steht {0} für die Anzahl der Jahre und {o} für die Ordnungszahl (10.). Hochzeitstage zeigen zusätzlich den Namen (Silberhochzeit …).",
|
|
||||||
"CatIcon": "Symbol",
|
"CatIcon": "Symbol",
|
||||||
"CatText": "Text mit Jahr",
|
"CatText": "Text mit Jahren",
|
||||||
"CatExample": "Beispiel",
|
"CatExample": "Vorschau",
|
||||||
"AddCategory": "+ Kategorie",
|
|
||||||
"NewCategory": "Neue Kategorie",
|
"NewCategory": "Neue Kategorie",
|
||||||
"ConfirmDeleteCategory": "Kategorie „{0}“ löschen? Ihre {1} Einträge werden zu Geburtstagen.",
|
"ConfirmDeleteCategory": "Kategorie „{0}“ löschen? Ihre {1} Einträge werden zu Geburtstagen.",
|
||||||
"EditCategories": "Kategorien…",
|
"EditCategories": "Kategorien…",
|
||||||
@@ -193,5 +191,10 @@
|
|||||||
"ShortcutDelete": "Markierten Eintrag löschen",
|
"ShortcutDelete": "Markierten Eintrag löschen",
|
||||||
"ShortcutEsc": "Suche / Auswahl aufheben",
|
"ShortcutEsc": "Suche / Auswahl aufheben",
|
||||||
"MovedToNext": "„{0}“ verschoben auf {1}",
|
"MovedToNext": "„{0}“ verschoben auf {1}",
|
||||||
"TestNow": "Test senden"
|
"TestNow": "Test senden",
|
||||||
|
"CategoriesIntro": "Jahrestage wiederholen sich jährlich und haben keine Uhrzeit. Hochzeitstage zeigen zusätzlich den Namen (Silberhochzeit, Goldene Hochzeit …).",
|
||||||
|
"CatPlaceholderYears": "Anzahl der Jahre",
|
||||||
|
"CatPlaceholderOrdinal": "Ordnungszahl (25.)",
|
||||||
|
"CatChangeLook": "Symbol und Farbe ändern",
|
||||||
|
"AddCategoryShort": "Kategorie"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,11 +138,9 @@
|
|||||||
"AnniversaryDate": "Date",
|
"AnniversaryDate": "Date",
|
||||||
"Category": "Category",
|
"Category": "Category",
|
||||||
"Categories": "Categories",
|
"Categories": "Categories",
|
||||||
"CategoriesHint": "Anniversaries repeat every year without a time. In the text, {0} is the number of years and {o} the ordinal (10th). Wedding anniversaries also show the traditional name.",
|
|
||||||
"CatIcon": "Icon",
|
"CatIcon": "Icon",
|
||||||
"CatText": "Text with year",
|
"CatText": "Text with years",
|
||||||
"CatExample": "Example",
|
"CatExample": "Preview",
|
||||||
"AddCategory": "+ Category",
|
|
||||||
"NewCategory": "New category",
|
"NewCategory": "New category",
|
||||||
"ConfirmDeleteCategory": "Delete category \"{0}\"? Its {1} entries become birthdays.",
|
"ConfirmDeleteCategory": "Delete category \"{0}\"? Its {1} entries become birthdays.",
|
||||||
"EditCategories": "Categories…",
|
"EditCategories": "Categories…",
|
||||||
@@ -193,5 +191,10 @@
|
|||||||
"ShortcutDelete": "Delete selected entry",
|
"ShortcutDelete": "Delete selected entry",
|
||||||
"ShortcutEsc": "Clear search / selection",
|
"ShortcutEsc": "Clear search / selection",
|
||||||
"MovedToNext": "\"{0}\" moved to {1}",
|
"MovedToNext": "\"{0}\" moved to {1}",
|
||||||
"TestNow": "Send test"
|
"TestNow": "Send test",
|
||||||
|
"CategoriesIntro": "Anniversaries repeat every year and have no time. Wedding anniversaries also show the traditional name (Silver, Gold …).",
|
||||||
|
"CatPlaceholderYears": "number of years",
|
||||||
|
"CatPlaceholderOrdinal": "ordinal (25th)",
|
||||||
|
"CatChangeLook": "Change icon and color",
|
||||||
|
"AddCategoryShort": "Category"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -57,7 +57,8 @@ namespace ReminderOrganizer.Services
|
|||||||
public void Initialize(AppData appData)
|
public void Initialize(AppData appData)
|
||||||
{
|
{
|
||||||
_appData = appData;
|
_appData = appData;
|
||||||
var lang = string.IsNullOrEmpty(appData.Language) ? Core.SystemPrefs.Language() : appData.Language;
|
// Default language is English; the user switches in Settings.
|
||||||
|
var lang = string.IsNullOrEmpty(appData.Language) ? "en" : appData.Language;
|
||||||
if (lang == _currentLanguage)
|
if (lang == _currentLanguage)
|
||||||
{
|
{
|
||||||
appData.Language = lang;
|
appData.Language = lang;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ReminderOrganizer.Core;
|
using ReminderOrganizer.Core;
|
||||||
using ReminderOrganizer.Models;
|
using ReminderOrganizer.Models;
|
||||||
@@ -162,12 +162,6 @@ namespace ReminderOrganizer.Tests
|
|||||||
|
|
||||||
public class SettingsTests
|
public class SettingsTests
|
||||||
{
|
{
|
||||||
[Fact]
|
|
||||||
public void Language_follows_windows_culture()
|
|
||||||
{
|
|
||||||
Assert.Equal("de", SystemPrefs.Language(new System.Globalization.CultureInfo("de-AT")));
|
|
||||||
Assert.Equal("en", SystemPrefs.Language(new System.Globalization.CultureInfo("fr-FR")));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Old_files_without_new_fields_still_load()
|
public void Old_files_without_new_fields_still_load()
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
{
|
{
|
||||||
var dialog = new CategoryWindow(_appData.Categories, IsDarkMode,
|
var dialog = new CategoryWindow(_appData.Categories, IsDarkMode,
|
||||||
id => _allTasks.Count(t => t.IsAnniversary && (t.CategoryId ?? Category.BirthdayId) == id))
|
id => _allTasks.Count(t => t.IsAnniversary && (t.CategoryId ?? Category.BirthdayId) == id))
|
||||||
{ Owner = Application.Current.MainWindow };
|
{ Owner = ActiveOwner };
|
||||||
if (dialog.ShowDialog() != true) return;
|
if (dialog.ShowDialog() != true) return;
|
||||||
|
|
||||||
var result = dialog.Result;
|
var result = dialog.Result;
|
||||||
@@ -511,7 +511,7 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
ShowUpcomingCommand = new RelayCommand(() => ShowCategory(null));
|
ShowUpcomingCommand = new RelayCommand(() => ShowCategory(null));
|
||||||
ShowCategoryCommand = new RelayCommand<string>(ShowCategory);
|
ShowCategoryCommand = new RelayCommand<string>(ShowCategory);
|
||||||
OpenSettingsCommand = new RelayCommand(() =>
|
OpenSettingsCommand = new RelayCommand(() =>
|
||||||
new SettingsWindow(this) { Owner = Application.Current.MainWindow }.ShowDialog());
|
new SettingsWindow(this) { Owner = ActiveOwner }.ShowDialog());
|
||||||
OpenDataFolderCommand = new RelayCommand(() =>
|
OpenDataFolderCommand = new RelayCommand(() =>
|
||||||
{
|
{
|
||||||
try { System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo { FileName = DataFolder, UseShellExecute = true }); }
|
try { System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo { FileName = DataFolder, UseShellExecute = true }); }
|
||||||
@@ -654,9 +654,13 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
|
|
||||||
// ---------- dialogs ----------
|
// ---------- dialogs ----------
|
||||||
|
|
||||||
|
/// <summary>Dialogs belong to the window the user is looking at (e.g. Settings), not always the main window.</summary>
|
||||||
|
private static Window? ActiveOwner =>
|
||||||
|
Application.Current.Windows.OfType<Window>().FirstOrDefault(w => w.IsActive) ?? Application.Current.MainWindow;
|
||||||
|
|
||||||
private string? AskName(string title, string current)
|
private string? AskName(string title, string current)
|
||||||
{
|
{
|
||||||
var dialog = new InputDialog(title, L("NewName"), current, IsDarkMode) { Owner = Application.Current.MainWindow };
|
var dialog = new InputDialog(title, L("NewName"), current, IsDarkMode) { Owner = ActiveOwner };
|
||||||
if (dialog.ShowDialog() != true) return null;
|
if (dialog.ShowDialog() != true) return null;
|
||||||
var name = dialog.ResponseText?.Trim();
|
var name = dialog.ResponseText?.Trim();
|
||||||
return string.IsNullOrEmpty(name) ? null : name;
|
return string.IsNullOrEmpty(name) ? null : name;
|
||||||
@@ -748,7 +752,7 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
category = anniversaries.GroupBy(t => t.CategoryId ?? Category.BirthdayId).OrderByDescending(g => g.Count()).First().Key;
|
category = anniversaries.GroupBy(t => t.CategoryId ?? Category.BirthdayId).OrderByDescending(g => g.Count()).First().Key;
|
||||||
if (category == null && CategoryFilter is { } cf && cf != TaskQuery.AppointmentsFilter)
|
if (category == null && CategoryFilter is { } cf && cf != TaskQuery.AppointmentsFilter)
|
||||||
category = cf;
|
category = cf;
|
||||||
var taskWindow = new TaskWindow(null, IsDarkMode, Categories, category) { Owner = Application.Current.MainWindow };
|
var taskWindow = new TaskWindow(null, IsDarkMode, Categories, category) { Owner = ActiveOwner };
|
||||||
if (taskWindow.ShowDialog() == true)
|
if (taskWindow.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
folder.Tasks.Add(taskWindow.TaskResult);
|
folder.Tasks.Add(taskWindow.TaskResult);
|
||||||
|
|||||||
Reference in New Issue
Block a user