Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.

Commit 554d21d

Browse files
committed
Change key categories
1 parent b13370c commit 554d21d

File tree

3 files changed

+40
-62
lines changed

3 files changed

+40
-62
lines changed

src/InvvardDev.EZLayoutDisplay.Desktop/Model/Enum/KeyCategory.cs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,11 @@
22
{
33
public enum KeyCategory
44
{
5-
Audio = 0,
6-
AutoShift,
7-
Digit,
5+
Base = 0,
86
DualFunction,
9-
Fn,
10-
French,
11-
Fw,
12-
German,
13-
Hungarian,
14-
Lang,
15-
Layer,
16-
LayerShortcuts,
17-
Letters,
187
Macro,
19-
Media,
8+
CustomLabel,
209
Modifier,
21-
Mouse,
22-
Nav,
23-
Nordic,
24-
NumPad,
25-
Other,
26-
Punct,
27-
ShiftedPunct,
28-
Shine,
29-
Shortcuts,
30-
Spacing,
31-
Spanish,
32-
System,
10+
ColorControl
3311
}
3412
}

src/InvvardDev.EZLayoutDisplay.Desktop/Skins/KeyboardLayoutSkin.xaml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,28 @@
66
<FontFamily x:Key="LatoFontFamily">/InvvardDev.EZLayoutDisplay.Desktop;component/Skins/Fonts/#Lato</FontFamily>
77
<FontFamily x:Key="OryxFontFamily">/InvvardDev.EZLayoutDisplay.Desktop;component/Skins/Fonts/#Oryx</FontFamily>
88

9-
<SolidColorBrush x:Key="BaseDefaultBackgroundBrush" Color="#f4f4f4" />
10-
<SolidColorBrush x:Key="BaseDualFunctionBackgroundBrush" Color="#d5e1f9" />
11-
<SolidColorBrush x:Key="BaseModifierBackgroundBrush" Color="#e1f5d7" />
12-
<SolidColorBrush x:Key="BaseShineBackgroundBrush" Color="#f1e5b6" />
9+
<SolidColorBrush x:Key="DefaultBackgroundBrush" Color="#FFFFFF" />
10+
<SolidColorBrush x:Key="ColorControlBackgroundBrush" Color="#FFF1BA" />
11+
<SolidColorBrush x:Key="CustomLabelBackgroundBrush" Color="#FFBFA3" />
12+
<SolidColorBrush x:Key="DualFunctionBackgroundBrush" Color="#E1EBFF" />
13+
<SolidColorBrush x:Key="MacroBackgroundBrush" Color="#E0DBFF" />
14+
<SolidColorBrush x:Key="ModifierBackgroundBrush" Color="#EBFFE1" />
1315

1416
<SolidColorBrush x:Key="TopDefaultBackgroundBrush" Color="#fcfcfc" />
1517
<SolidColorBrush x:Key="TopDualFunctionBackgroundBrush" Color="#e1ebff" />
1618
<SolidColorBrush x:Key="TopModifierBackgroundBrush" Color="#ebffe1" />
17-
<SolidColorBrush x:Key="TopShineBackgroundBrush" Color="#fff1ba" />
1819

19-
<converter:KeyCategoryToBrushConverter x:Key="KeyCategoryToBaseBrushConverter"
20-
DefaultBackgroundBrush="{StaticResource BaseDefaultBackgroundBrush}"
21-
DualFunctionBackgroundBrush="{StaticResource BaseDualFunctionBackgroundBrush}"
22-
ModifierBackgroundBrush="{StaticResource BaseModifierBackgroundBrush}"
23-
ShineBackgroundBrush="{StaticResource BaseShineBackgroundBrush}"/>
20+
<converter:KeyCategoryToBrushConverter x:Key="KeyCategoryToBrushConverter"
21+
DefaultBackgroundBrush="{StaticResource DefaultBackgroundBrush}"
22+
ColorControlBackgroundBrush="{StaticResource ColorControlBackgroundBrush}"
23+
CustomLabelBackgroundBrush="{StaticResource CustomLabelBackgroundBrush}"
24+
DualFunctionBackgroundBrush="{StaticResource DualFunctionBackgroundBrush}"
25+
MacroBackgroundBrush="{StaticResource MacroBackgroundBrush}"
26+
ModifierBackgroundBrush="{StaticResource ModifierBackgroundBrush}"/>
2427
<converter:KeyCategoryToBrushConverter x:Key="KeyCategoryToTopBrushConverter"
2528
DefaultBackgroundBrush="{StaticResource TopDefaultBackgroundBrush}"
2629
DualFunctionBackgroundBrush="{StaticResource TopDualFunctionBackgroundBrush}"
27-
ModifierBackgroundBrush="{StaticResource TopModifierBackgroundBrush}"
28-
ShineBackgroundBrush="{StaticResource TopShineBackgroundBrush}" />
30+
ModifierBackgroundBrush="{StaticResource TopModifierBackgroundBrush}" />
2931

3032
<SolidColorBrush x:Key="KeyBaseBorderColorBrush" Color="#c7c7c7" />
3133
<SolidColorBrush x:Key="KeyTopBorderColorBrush" Color="#1affffff" />
@@ -45,7 +47,7 @@
4547
<Style TargetType="Rectangle" BasedOn="{StaticResource BaseKey}" x:Key="KeyBase">
4648
<Setter Property="RadiusX" Value="5" />
4749
<Setter Property="RadiusY" Value="5" />
48-
<Setter Property="Fill" Value="{Binding EZKey.KeyCategory, Converter={StaticResource KeyCategoryToBaseBrushConverter}}" />
50+
<Setter Property="Fill" Value="{Binding EZKey.KeyCategory, Converter={StaticResource KeyCategoryToBrushConverter}}" />
4951
<Setter Property="Stroke" Value="{StaticResource KeyBaseBorderColorBrush}" />
5052
<Setter Property="Canvas.Top" Value="{Binding BaseKeyY}" />
5153
<Setter Property="Canvas.Left" Value="{Binding BaseKeyX}" />
@@ -66,12 +68,12 @@
6668

6769
<Style TargetType="Label" x:Key="LabelStyle">
6870
<Style.Triggers>
69-
<DataTrigger Binding="{Binding EZKey.Label.IsGlyph}" Value="true">
71+
<DataTrigger Binding="{Binding EZKey.Primary.Content.IsGlyph}" Value="true">
7072
<Setter Property="FontFamily" Value="{StaticResource OryxFontFamily}" />
7173
<Setter Property="FontSize" Value="18" />
7274
<Setter Property="Foreground" Value="{Binding EZKey.Color}" />
7375
</DataTrigger>
74-
<DataTrigger Binding="{Binding EZKey.Label.IsGlyph}" Value="false">
76+
<DataTrigger Binding="{Binding EZKey.Primary.Content.IsGlyph}" Value="false">
7577
<Setter Property="FontFamily" Value="{StaticResource LatoFontFamily}" />
7678
<Setter Property="FontSize" Value="22" />
7779
<Setter Property="FontWeight" Value="Bold" />

src/InvvardDev.EZLayoutDisplay.Desktop/View/Converter/KeyCategoryToBrushConverter.cs

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,36 @@ namespace InvvardDev.EZLayoutDisplay.Desktop.View.Converter
1111
public class KeyCategoryToBrushConverter : IValueConverter
1212
{
1313
public SolidColorBrush DefaultBackgroundBrush { private get; set; }
14+
public SolidColorBrush ColorControlBackgroundBrush { private get; set; }
15+
public SolidColorBrush CustomLabelBackgroundBrush { private get; set; }
1416
public SolidColorBrush DualFunctionBackgroundBrush { private get; set; }
17+
public SolidColorBrush MacroBackgroundBrush { private get; set; }
1518
public SolidColorBrush ModifierBackgroundBrush { private get; set; }
16-
public SolidColorBrush ShineBackgroundBrush { private get; set; }
1719

1820
public KeyCategoryToBrushConverter()
1921
{
20-
DefaultBackgroundBrush = Application.Current.Resources["BaseDefaultBackgroundBrush"] as SolidColorBrush;
21-
DualFunctionBackgroundBrush = Application.Current.Resources["BaseDualFunctionBackgroundBrush"] as SolidColorBrush;
22-
ModifierBackgroundBrush = Application.Current.Resources["BaseModifierBackgroundBrush"] as SolidColorBrush;
23-
ShineBackgroundBrush = Application.Current.Resources["BaseShineBackgroundBrush"] as SolidColorBrush;
22+
DefaultBackgroundBrush = Application.Current.Resources["DefaultBackgroundBrush"] as SolidColorBrush;
23+
ColorControlBackgroundBrush = Application.Current.Resources["ColorControlBackgroundBrush"] as SolidColorBrush;
24+
CustomLabelBackgroundBrush = Application.Current.Resources["CustomLabelBackgroundBrush"] as SolidColorBrush;
25+
DualFunctionBackgroundBrush = Application.Current.Resources["DualFunctionBackgroundBrush"] as SolidColorBrush;
26+
MacroBackgroundBrush = Application.Current.Resources["MacroBackgroundBrush"] as SolidColorBrush;
27+
ModifierBackgroundBrush = Application.Current.Resources["ModifierBackgroundBrush"] as SolidColorBrush;
2428
}
2529

2630
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2731
{
28-
if (!(value is KeyCategory)) return null;
29-
30-
SolidColorBrush brush;
31-
switch ((KeyCategory)value)
32+
SolidColorBrush brush = null;
33+
if (value is KeyCategory category)
3234
{
33-
case KeyCategory.LayerShortcuts:
34-
case KeyCategory.DualFunction:
35-
brush = DualFunctionBackgroundBrush;
36-
break;
37-
case KeyCategory.Modifier:
38-
brush = ModifierBackgroundBrush;
39-
break;
40-
case KeyCategory.Shine:
41-
brush = ShineBackgroundBrush;
42-
break;
43-
default:
44-
brush = DefaultBackgroundBrush;
45-
break;
35+
brush = category switch
36+
{
37+
KeyCategory.ColorControl => ColorControlBackgroundBrush,
38+
KeyCategory.CustomLabel => CustomLabelBackgroundBrush,
39+
KeyCategory.DualFunction => DualFunctionBackgroundBrush,
40+
KeyCategory.Macro => MacroBackgroundBrush,
41+
KeyCategory.Modifier => ModifierBackgroundBrush,
42+
_ => DefaultBackgroundBrush
43+
};
4644
}
4745

4846
return brush;

0 commit comments

Comments
 (0)