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

Commit c14840e

Browse files
committed
Update KeyDefinition importer
1 parent 267da95 commit c14840e

File tree

14 files changed

+206
-71
lines changed

14 files changed

+206
-71
lines changed

src/InvvardDev.EZLayoutDisplay.Desktop/InvvardDev.EZLayoutDisplay.Desktop.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@
8383
</ApplicationDefinition>
8484
<Compile Include="Helper\KeyContentTemplateSelector.cs" />
8585
<Compile Include="Helper\LoggerHelper.cs" />
86-
<Compile Include="Model\Enum\KeyDisplayType.cs" />
86+
<Compile Include="Model\Enum\KeyDisplayMode.cs" />
8787
<Compile Include="Model\Ez\Content\BaseContent.cs" />
8888
<Compile Include="Model\Ez\Content\ColorPicker.cs" />
8989
<Compile Include="Model\Ez\Content\Glyph.cs" />
9090
<Compile Include="Model\Ez\Content\Layer.cs" />
91+
<Compile Include="Model\Enum\KeyCategory.cs" />
9192
<Compile Include="Model\ZsaModels\ErgodoxTag.cs" />
9293
<Compile Include="Model\ZsaModels\ErgodoxKeyFeature.cs" />
9394
<Compile Include="Model\KeyTemplate.cs" />
@@ -109,7 +110,6 @@
109110
<Compile Include="Model\Ez\Key.cs" />
110111
<Compile Include="Model\EZLayout.cs" />
111112
<Compile Include="Model\EZModifier.cs" />
112-
<Compile Include="Model\Enum\KeyCategory.cs" />
113113
<Compile Include="Model\Dictionary\KeyDefinitionDictionary.cs" />
114114
<Compile Include="Model\Enum\SettingsName.cs" />
115115
<Compile Include="Model\EZLayer.cs" />
Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,75 @@
1-
namespace InvvardDev.EZLayoutDisplay.Desktop.Model.Enum
1+
/// <summary>
2+
/// KeyCategory.cs auto generated enumeration
3+
/// Generated on : 01/17/2022 00:00:29 (UTC)
4+
/// </summary>
5+
namespace InvvardDev.EZLayoutDisplay.Desktop.Model.Enum
26
{
37
public enum KeyCategory
48
{
5-
Base = 0,
6-
DualFunction,
7-
Macro,
8-
CustomLabel,
9-
Modifier,
10-
ColorControl
9+
Letters = 61,
10+
Digit = 62,
11+
Modifier = 63,
12+
DualFunction = 64,
13+
Layer = 65,
14+
Punct = 66,
15+
ShiftedPunct = 67,
16+
Autoshift = 68,
17+
Fn = 69,
18+
Fw = 70,
19+
Lang = 71,
20+
LayerShortcuts = 72,
21+
Media = 73,
22+
Momentary = 74,
23+
Mouse = 75,
24+
Nav = 76,
25+
Numpad = 77,
26+
Int = 78,
27+
Other = 79,
28+
Shine = 80,
29+
Spacing = 81,
30+
Special = 82,
31+
System = 83,
32+
Audio = 84,
33+
Macro = 85,
34+
Toggle = 86,
35+
Belgian = 87,
36+
Bepo = 88,
37+
Brazilian = 89,
38+
Cms = 90,
39+
French = 91,
40+
Frenchca = 92,
41+
German = 93,
42+
Hungarian = 94,
43+
Icelandic = 95,
44+
Italian = 96,
45+
Lithuanian = 97,
46+
Danish = 98,
47+
Slovenian = 99,
48+
Portuguese = 100,
49+
PortugueseOsx = 101,
50+
Norwegian = 102,
51+
Japanese = 103,
52+
Korean = 104,
53+
Nordic = 105,
54+
Spanish = 106,
55+
Spanishla = 107,
56+
Swedish = 108,
57+
SwissFrench = 109,
58+
SwissGerman = 110,
59+
Polish = 111,
60+
Kazakh = 112,
61+
Czech = 113,
62+
Romanian = 114,
63+
Russian = 115,
64+
Uk = 116,
65+
Ukranian = 117,
66+
Usint = 118,
67+
Estonian = 119,
68+
Stenography = 120,
69+
Disable = 121,
70+
Croatian = 122,
71+
Slovak = 123,
72+
Turkish = 124,
1173
}
12-
}
74+
}
75+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace InvvardDev.EZLayoutDisplay.Desktop.Model.Enum
2+
{
3+
public enum KeyDisplayMode
4+
{
5+
Base = 0,
6+
DualFunction = 1,
7+
Macro = 2,
8+
CustomLabel = 3,
9+
Modifier = 4,
10+
ColorControl = 5
11+
}
12+
}

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

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/InvvardDev.EZLayoutDisplay.Desktop/Model/Ez/Key.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public class Key
1717
/// <summary>
1818
/// Gets or sets the key category.
1919
/// </summary>
20-
public KeyCategory Category { get; set; }
20+
public KeyDisplayMode DisplayMode { get; set; }
2121
}
2222
}

src/InvvardDev.EZLayoutDisplay.Desktop/Model/KeyDefinition.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Newtonsoft.Json;
1+
using InvvardDev.EZLayoutDisplay.Desktop.Model.Enum;
2+
using Newtonsoft.Json;
23

34
namespace InvvardDev.EZLayoutDisplay.Desktop.Model
45
{
@@ -27,5 +28,8 @@ public class KeyDefinition
2728
/// </summary>
2829
[JsonProperty("is_glyph", DefaultValueHandling = DefaultValueHandling.Ignore)]
2930
public bool IsGlyph { get; set; }
31+
32+
[JsonProperty("category")]
33+
public KeyCategory Category { get; set; }
3034
}
3135
}

src/InvvardDev.EZLayoutDisplay.Desktop/Properties/keyDefinitions.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/InvvardDev.EZLayoutDisplay.Desktop/ViewModel/DisplayLayoutViewModel.cs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
using InvvardDev.EZLayoutDisplay.Desktop.Helper;
1212
using InvvardDev.EZLayoutDisplay.Desktop.Model;
1313
using InvvardDev.EZLayoutDisplay.Desktop.Model.Enum;
14+
using InvvardDev.EZLayoutDisplay.Desktop.Model.Ez.Content;
1415
using InvvardDev.EZLayoutDisplay.Desktop.Model.Messenger;
1516
using InvvardDev.EZLayoutDisplay.Desktop.Properties;
1617
using InvvardDev.EZLayoutDisplay.Desktop.Service.Interface;
1718
using InvvardDev.EZLayoutDisplay.Desktop.View;
1819
using Newtonsoft.Json;
1920
using NLog;
21+
using Key = InvvardDev.EZLayoutDisplay.Desktop.Model.Ez.Key;
2022

2123
namespace InvvardDev.EZLayoutDisplay.Desktop.ViewModel
2224
{
@@ -182,29 +184,25 @@ public bool IsWindowPinned
182184
/// Lost focus command.
183185
/// </summary>
184186
public ICommand LostFocusCommand =>
185-
_lostFocusCommand
186-
?? (_lostFocusCommand = new RelayCommand(LostFocus, LostFocusCanExecute));
187+
_lostFocusCommand ??= new RelayCommand(LostFocus, LostFocusCanExecute);
187188

188189
/// <summary>
189190
/// Hide window command.
190191
/// </summary>
191192
public ICommand HideWindowCommand =>
192-
_hideWindowCommand
193-
?? (_hideWindowCommand = new RelayCommand(LostFocus));
193+
_hideWindowCommand ??= new RelayCommand(LostFocus);
194194

195195
/// <summary>
196196
/// Next layer command.
197197
/// </summary>
198198
public ICommand NextLayerCommand =>
199-
_nextLayerCommand
200-
?? (_nextLayerCommand = new RelayCommand(NextLayer, NextLayerCanExecute));
199+
_nextLayerCommand ??= new RelayCommand(NextLayer, NextLayerCanExecute);
201200

202201
/// <summary>
203202
/// Next layer command.
204203
/// </summary>
205204
public ICommand ScrollLayerCommand =>
206-
_scrollLayerCommand
207-
?? (_scrollLayerCommand = new RelayCommand<MouseWheelEventArgs>(ScrollLayer));
205+
_scrollLayerCommand ??= new RelayCommand<MouseWheelEventArgs>(ScrollLayer);
208206

209207
#endregion
210208

@@ -302,28 +300,28 @@ private void LoadDesignTimeModel()
302300

303301
// ReSharper disable once UseObjectOrCollectionInitializer
304302
CurrentLayoutTemplate = new ObservableCollection<KeyTemplate>(layoutDefinition);
305-
CurrentLayoutTemplate[0].EZKey = new EZKey
303+
CurrentLayoutTemplate[0].Key = new Key
306304
{
307-
Primary = new KeyFeature ("=", modifier: "Shift"),
308-
DisplayMode = KeyDisplayMode.SingleFeature,
309-
Color = "#111"
305+
Primary = new BaseContent { Label = "Shift + =" },
306+
DisplayMode = KeyDisplayMode.Base,
307+
GlowColor = "#111"
310308
};
311309

312-
CurrentLayoutTemplate[1].EZKey = new EZKey
310+
CurrentLayoutTemplate[1].Key = new Key
313311
{
314-
Primary = new KeyFeature("LT \u2192 1"),
315-
Secondary = new KeyFeature("LT \u2192 1"),
316-
DisplayMode = KeyDisplayMode.DoubleFeature,
317-
Color = "#BBB"
312+
Primary = new Layer { Label = "\u2192", Id = 1 },
313+
Secondary = new Layer { Label = "\u2192", Id = 2 },
314+
DisplayMode = KeyDisplayMode.DualFunction,
315+
GlowColor = "#BBB"
318316
};
319317

320318
for (int i = 2; i < CurrentLayoutTemplate.Count; i++)
321319
{
322-
CurrentLayoutTemplate[i].EZKey = new EZKey
320+
CurrentLayoutTemplate[i].Key = new Key
323321
{
324-
Primary = new KeyFeature("E", modifier: "Shift", tag: "fr"),
325-
DisplayMode = KeyDisplayMode.SingleFeature,
326-
Color = "#777"
322+
Primary = new BaseContent { Label = "Shift + E", Tag = "fr" },
323+
DisplayMode = KeyDisplayMode.Base,
324+
GlowColor = "#777"
327325
};
328326
}
329327
}
@@ -334,13 +332,14 @@ private async Task PopulateLayoutTemplates(string geometry)
334332

335333
foreach (var ezLayer in _ezLayout.EZLayers)
336334
{
337-
if (!(await LoadLayoutDefinition(geometry) is List<KeyTemplate> layoutTemplate)) break;
335+
if (await LoadLayoutDefinition(geometry) is not List<KeyTemplate> layoutTemplate)
336+
break;
338337

339338
if (layoutTemplate.Count == 0) return;
340339

341340
for (int j = 0; j < layoutTemplate.Count; j++)
342341
{
343-
layoutTemplate[j].EZKey = ezLayer.Keys[j];
342+
layoutTemplate[j].Key = ezLayer.Keys[j];
344343
}
345344

346345
_layoutTemplates.Add(layoutTemplate);

src/InvvardDev.EZLayoutDisplay.Tool.KeyDefinitionProvider/InvvardDev.EZLayoutDisplay.Tool.KeyDefinitionProvider.csproj

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
@@ -15,4 +15,23 @@
1515
<ProjectReference Include="..\InvvardDev.EZLayoutDisplay.Desktop\InvvardDev.EZLayoutDisplay.Desktop.csproj" />
1616
</ItemGroup>
1717

18+
<ItemGroup>
19+
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
20+
</ItemGroup>
21+
22+
<ItemGroup>
23+
<Compile Update="KeyCategory.cs">
24+
<DesignTime>True</DesignTime>
25+
<AutoGen>True</AutoGen>
26+
<DependentUpon>KeyCategory.tt</DependentUpon>
27+
</Compile>
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<None Update="KeyCategory.tt">
32+
<Generator>TextTemplatingFileGenerator</Generator>
33+
<LastGenOutput>KeyCategory.cs</LastGenOutput>
34+
</None>
35+
</ItemGroup>
36+
1837
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <summary>
2+
/// Moved to <see cref="InvvardDev.EZLayoutDisplay.Desktop.Model.Enum.KeyCategory">
3+
/// </summary>

0 commit comments

Comments
 (0)