mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-24 04:12:32 +08:00
[QuickAccent]Add setting to select language (#20798)
* add selection of country langages * Add Greek and Iceland countries * Update src/modules/poweraccent/PowerAccent.Core/PowerAccent.Core.csproj * fix ß in all section * remove greek * improve UI * langage to language * remove GR reference * change 'All' to 'All available' * adding Romanian and Hungarian * Missing characters * Add Italian * Fix translation key Remove GameMode activation * Fix PR build issues * Callback to get if a letter is part of the language * Add additional dlls to installer * Fix new dlls signing * Fix spelling * Add description to language selection Co-authored-by: Damien LEROY <dleroy@veepee.com>
This commit is contained in:
parent
1ecaf039ca
commit
5e955f034e
@ -202,9 +202,16 @@
|
|||||||
"vcruntime140_1_app.dll",
|
"vcruntime140_1_app.dll",
|
||||||
"vcruntime140_app.dll",
|
"vcruntime140_app.dll",
|
||||||
"modules\\PowerAccent\\Vanara.Core.dll",
|
"modules\\PowerAccent\\Vanara.Core.dll",
|
||||||
|
"modules\\PowerAccent\\Vanara.PInvoke.ComCtl32.dll",
|
||||||
|
"modules\\PowerAccent\\Vanara.PInvoke.Cryptography.dll",
|
||||||
"modules\\PowerAccent\\Vanara.PInvoke.Gdi32.dll",
|
"modules\\PowerAccent\\Vanara.PInvoke.Gdi32.dll",
|
||||||
"modules\\PowerAccent\\Vanara.PInvoke.Kernel32.dll",
|
"modules\\PowerAccent\\Vanara.PInvoke.Kernel32.dll",
|
||||||
|
"modules\\PowerAccent\\Vanara.PInvoke.Ole.dll",
|
||||||
|
"modules\\PowerAccent\\Vanara.PInvoke.Rpc.dll",
|
||||||
|
"modules\\PowerAccent\\Vanara.PInvoke.Security.dll",
|
||||||
"modules\\PowerAccent\\Vanara.PInvoke.Shared.dll",
|
"modules\\PowerAccent\\Vanara.PInvoke.Shared.dll",
|
||||||
|
"modules\\PowerAccent\\Vanara.PInvoke.Shell32.dll",
|
||||||
|
"modules\\PowerAccent\\Vanara.PInvoke.ShlwApi.dll",
|
||||||
"modules\\PowerAccent\\Vanara.PInvoke.User32.dll",
|
"modules\\PowerAccent\\Vanara.PInvoke.User32.dll",
|
||||||
"modules\\FileExplorerPreview\\Microsoft.Web.WebView2.Core.dll",
|
"modules\\FileExplorerPreview\\Microsoft.Web.WebView2.Core.dll",
|
||||||
"modules\\FileExplorerPreview\\Microsoft.Web.WebView2.WinForms.dll",
|
"modules\\FileExplorerPreview\\Microsoft.Web.WebView2.WinForms.dll",
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
|
|
||||||
<?define MeasureToolMicrosoftUIXamlAssetsInstallFiles=NoiseAsset_256x256_PNG.png?>
|
<?define MeasureToolMicrosoftUIXamlAssetsInstallFiles=NoiseAsset_256x256_PNG.png?>
|
||||||
|
|
||||||
<?define PowerAccentFiles=ControlzEx.dll;GongSolutions.WPF.DragDrop.dll;Ijwhost.dll;MahApps.Metro.dll;Microsoft.Xaml.Behaviors.dll;PowerAccent.Core.dll;PowerAccent.deps.json;PowerAccent.dll;PowerAccent.exe;PowerAccent.runtimeconfig.json;PowerToys.PowerAccentModuleInterface.dll;PowerToys.ManagedCommon.dll;PowerToys.ManagedTelemetry.dll;PowerToys.PowerAccent.deps.json;PowerToys.PowerAccent.dll;PowerToys.PowerAccent.exe;PowerToys.PowerAccent.runtimeconfig.json;PowerToys.Settings.UI.Lib.dll;System.IO.Abstractions.dll;System.Management.dll;System.Text.Json.dll;Vanara.Core.dll;Vanara.PInvoke.Gdi32.dll;Vanara.PInvoke.Kernel32.dll;Vanara.PInvoke.Shared.dll;Vanara.PInvoke.User32.dll;PowerToys.PowerAccentKeyboardService.dll;Microsoft.Windows.SDK.NET.dll;WinRT.Runtime.dll?>
|
<?define PowerAccentFiles=ControlzEx.dll;GongSolutions.WPF.DragDrop.dll;Ijwhost.dll;MahApps.Metro.dll;Microsoft.Xaml.Behaviors.dll;PowerAccent.Core.dll;PowerAccent.deps.json;PowerAccent.dll;PowerAccent.exe;PowerAccent.runtimeconfig.json;PowerToys.PowerAccentModuleInterface.dll;PowerToys.ManagedCommon.dll;PowerToys.ManagedTelemetry.dll;PowerToys.PowerAccent.deps.json;PowerToys.PowerAccent.dll;PowerToys.PowerAccent.exe;PowerToys.PowerAccent.runtimeconfig.json;PowerToys.Settings.UI.Lib.dll;System.IO.Abstractions.dll;System.Management.dll;System.Text.Json.dll;Vanara.Core.dll;Vanara.PInvoke.ComCtl32.dll;Vanara.PInvoke.Cryptography.dll;Vanara.PInvoke.Gdi32.dll;Vanara.PInvoke.Kernel32.dll;Vanara.PInvoke.Ole.dll;Vanara.PInvoke.Rpc.dll;Vanara.PInvoke.Security.dll;Vanara.PInvoke.Shared.dll;Vanara.PInvoke.Shell32.dll;Vanara.PInvoke.ShlwApi.dll;Vanara.PInvoke.User32.dll;PowerToys.PowerAccentKeyboardService.dll;Microsoft.Windows.SDK.NET.dll;WinRT.Runtime.dll?>
|
||||||
|
|
||||||
<Product Id="*"
|
<Product Id="*"
|
||||||
Name="PowerToys (Preview)"
|
Name="PowerToys (Preview)"
|
||||||
|
501
src/modules/poweraccent/PowerAccent.Core/Languages.cs
Normal file
501
src/modules/poweraccent/PowerAccent.Core/Languages.cs
Normal file
@ -0,0 +1,501 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
namespace PowerAccent.Core
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using PowerToys.PowerAccentKeyboardService;
|
||||||
|
|
||||||
|
public enum Language
|
||||||
|
{
|
||||||
|
ALL,
|
||||||
|
CUR,
|
||||||
|
CZ,
|
||||||
|
DE,
|
||||||
|
FR,
|
||||||
|
HU,
|
||||||
|
IS,
|
||||||
|
IT,
|
||||||
|
MI,
|
||||||
|
PI,
|
||||||
|
PL,
|
||||||
|
RO,
|
||||||
|
SK,
|
||||||
|
SP,
|
||||||
|
TK,
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class Languages
|
||||||
|
{
|
||||||
|
public static char[] GetDefaultLetterKey(LetterKey letter, Language lang)
|
||||||
|
{
|
||||||
|
switch (lang)
|
||||||
|
{
|
||||||
|
case Language.ALL: return GetDefaultLetterKeyALL(letter); // ALL
|
||||||
|
case Language.CUR: return GetDefaultLetterKeyCUR(letter); // Currency
|
||||||
|
case Language.CZ: return GetDefaultLetterKeyCZ(letter); // Czech
|
||||||
|
case Language.DE: return GetDefaultLetterKeyDE(letter); // German
|
||||||
|
case Language.FR: return GetDefaultLetterKeyFR(letter); // French
|
||||||
|
case Language.HU: return GetDefaultLetterKeyHU(letter); // Hungarian
|
||||||
|
case Language.IS: return GetDefaultLetterKeyIS(letter); // Iceland
|
||||||
|
case Language.IT: return GetDefaultLetterKeyIT(letter); // Italian
|
||||||
|
case Language.MI: return GetDefaultLetterKeyMI(letter); // Maori
|
||||||
|
case Language.PI: return GetDefaultLetterKeyPI(letter); // Pinyin
|
||||||
|
case Language.PL: return GetDefaultLetterKeyPL(letter); // Polish
|
||||||
|
case Language.RO: return GetDefaultLetterKeyRO(letter); // Romanian
|
||||||
|
case Language.SK: return GetDefaultLetterKeySK(letter); // Slovak
|
||||||
|
case Language.SP: return GetDefaultLetterKeySP(letter); // Spain
|
||||||
|
case Language.TK: return GetDefaultLetterKeyTK(letter); // Turkish
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ArgumentException("The language {0} is not know in this context", lang.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// All
|
||||||
|
private static char[] GetDefaultLetterKeyALL(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_0:
|
||||||
|
return new char[] { '₀', '⁰' };
|
||||||
|
case LetterKey.VK_1:
|
||||||
|
return new char[] { '₁', '¹' };
|
||||||
|
case LetterKey.VK_2:
|
||||||
|
return new char[] { '₂', '²' };
|
||||||
|
case LetterKey.VK_3:
|
||||||
|
return new char[] { '₃', '³' };
|
||||||
|
case LetterKey.VK_4:
|
||||||
|
return new char[] { '₄', '⁴' };
|
||||||
|
case LetterKey.VK_5:
|
||||||
|
return new char[] { '₅', '⁵' };
|
||||||
|
case LetterKey.VK_6:
|
||||||
|
return new char[] { '₆', '⁶' };
|
||||||
|
case LetterKey.VK_7:
|
||||||
|
return new char[] { '₇', '⁷' };
|
||||||
|
case LetterKey.VK_8:
|
||||||
|
return new char[] { '₈', '⁸' };
|
||||||
|
case LetterKey.VK_9:
|
||||||
|
return new char[] { '₉', '⁹' };
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'á', 'à', 'ä', 'â', 'ă', 'å', 'α', 'ā', 'ą', 'ȧ', 'ã', 'æ' };
|
||||||
|
case LetterKey.VK_B:
|
||||||
|
return new char[] { 'ḃ', 'β' };
|
||||||
|
case LetterKey.VK_C:
|
||||||
|
return new char[] { 'ç', 'ć', 'ĉ', 'č', 'ċ', '¢', 'χ' };
|
||||||
|
case LetterKey.VK_D:
|
||||||
|
return new char[] { 'ď', 'ḋ', 'đ', 'δ', 'ð' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'é', 'è', 'ê', 'ë', 'ě', 'ē', 'ę', 'ė', 'ε', 'η', '€' };
|
||||||
|
case LetterKey.VK_F:
|
||||||
|
return new char[] { 'ƒ', 'ḟ' };
|
||||||
|
case LetterKey.VK_G:
|
||||||
|
return new char[] { 'ğ', 'ģ', 'ǧ', 'ġ', 'ĝ', 'ǥ', 'γ' };
|
||||||
|
case LetterKey.VK_H:
|
||||||
|
return new char[] { 'ḣ', 'ĥ', 'ħ' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'ï', 'î', 'í', 'ì', 'ī', 'į', 'i', 'ı', 'İ', 'ι' };
|
||||||
|
case LetterKey.VK_J:
|
||||||
|
return new char[] { 'ĵ' };
|
||||||
|
case LetterKey.VK_K:
|
||||||
|
return new char[] { 'ķ', 'ǩ', 'κ' };
|
||||||
|
case LetterKey.VK_L:
|
||||||
|
return new char[] { 'ĺ', 'ľ', 'ļ', 'ł', '₺', 'λ' };
|
||||||
|
case LetterKey.VK_M:
|
||||||
|
return new char[] { 'ṁ' };
|
||||||
|
case LetterKey.VK_N:
|
||||||
|
return new char[] { 'ñ', 'ń', 'ŋ', 'ň', 'ņ', 'ṅ', 'ⁿ', 'ν' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ô', 'ó', 'ö', 'ő', 'ò', 'ō', 'ȯ', 'ø', 'õ', 'œ', 'ω' };
|
||||||
|
case LetterKey.VK_P:
|
||||||
|
return new char[] { 'ṗ', '₽', 'π', 'φ', 'ψ' };
|
||||||
|
case LetterKey.VK_R:
|
||||||
|
return new char[] { 'ŕ', 'ř', 'ṙ', '₹', 'ρ' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { 'ś', 'ş', 'š', 'ș', 'ṡ', 'ŝ', 'ß', 'σ', '$' };
|
||||||
|
case LetterKey.VK_T:
|
||||||
|
return new char[] { 'ţ', 'ť', 'ț', 'ṫ', 'ŧ', 'θ', 'τ' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'û', 'ú', 'ü', 'ŭ', 'ű', 'ù', 'ů', 'ū', 'ų' };
|
||||||
|
case LetterKey.VK_W:
|
||||||
|
return new char[] { 'ẇ', 'ŵ', '₩' };
|
||||||
|
case LetterKey.VK_X:
|
||||||
|
return new char[] { 'ẋ', 'ξ' };
|
||||||
|
case LetterKey.VK_Y:
|
||||||
|
return new char[] { 'ÿ', 'ŷ', 'ý', 'ẏ' };
|
||||||
|
case LetterKey.VK_Z:
|
||||||
|
return new char[] { 'ź', 'ž', 'ż', 'ʒ', 'ǯ', 'ζ' };
|
||||||
|
case LetterKey.VK_COMMA:
|
||||||
|
return new char[] { '¿', '¡', '∙', '₋', '⁻', '–', '≤', '≥', '≠', '≈', '≙', '±', '₊', '⁺', 'þ' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money)
|
||||||
|
private static char[] GetDefaultLetterKeyCUR(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_B:
|
||||||
|
return new char[] { '฿', 'в' };
|
||||||
|
case LetterKey.VK_C:
|
||||||
|
return new char[] { '¢', '₡', 'č' };
|
||||||
|
case LetterKey.VK_D:
|
||||||
|
return new char[] { '₫' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { '€' };
|
||||||
|
case LetterKey.VK_F:
|
||||||
|
return new char[] { 'ƒ' };
|
||||||
|
case LetterKey.VK_H:
|
||||||
|
return new char[] { '₴' };
|
||||||
|
case LetterKey.VK_K:
|
||||||
|
return new char[] { '₭' };
|
||||||
|
case LetterKey.VK_L:
|
||||||
|
return new char[] { 'ł' };
|
||||||
|
case LetterKey.VK_N:
|
||||||
|
return new char[] { 'л' };
|
||||||
|
case LetterKey.VK_M:
|
||||||
|
return new char[] { '₼' };
|
||||||
|
case LetterKey.VK_P:
|
||||||
|
return new char[] { '£', '₽' };
|
||||||
|
case LetterKey.VK_R:
|
||||||
|
return new char[] { '₹', '៛', '﷼' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { '$', '₪' };
|
||||||
|
case LetterKey.VK_T:
|
||||||
|
return new char[] { '₮', '₺' };
|
||||||
|
case LetterKey.VK_W:
|
||||||
|
return new char[] { '₩' };
|
||||||
|
case LetterKey.VK_Y:
|
||||||
|
return new char[] { '¥' };
|
||||||
|
case LetterKey.VK_Z:
|
||||||
|
return new char[] { 'z' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// French
|
||||||
|
private static char[] GetDefaultLetterKeyFR(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'à', 'â', 'á', 'ä', 'ã', 'æ' };
|
||||||
|
case LetterKey.VK_C:
|
||||||
|
return new char[] { 'ç' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'é', 'è', 'ê', 'ë', '€' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'î', 'ï', 'í', 'ì' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ô', 'ö', 'ó', 'ò', 'õ', 'œ' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'û', 'ù', 'ü', 'ú' };
|
||||||
|
case LetterKey.VK_Y:
|
||||||
|
return new char[] { 'ÿ', 'ý' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iceland
|
||||||
|
private static char[] GetDefaultLetterKeyIS(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'á', 'æ' };
|
||||||
|
case LetterKey.VK_D:
|
||||||
|
return new char[] { 'ð' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'é' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ó', 'ö' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ú' };
|
||||||
|
case LetterKey.VK_Y:
|
||||||
|
return new char[] { 'ý' };
|
||||||
|
case LetterKey.VK_COMMA:
|
||||||
|
return new char[] { 'þ' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spain
|
||||||
|
private static char[] GetDefaultLetterKeySP(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'á' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'é', '€' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'í' };
|
||||||
|
case LetterKey.VK_N:
|
||||||
|
return new char[] { 'ñ' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ó' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ú', 'ü' };
|
||||||
|
case LetterKey.VK_COMMA:
|
||||||
|
return new char[] { '¿', '?' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Maori
|
||||||
|
private static char[] GetDefaultLetterKeyMI(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'ā' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'ē' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'ī' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ō' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { '$' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ū' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pinyin
|
||||||
|
private static char[] GetDefaultLetterKeyPI(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'ā', 'á', 'ǎ', 'à', 'a' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'ē', 'é', 'ě', 'è', 'e' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'ī', 'í', 'ǐ', 'ì', 'i' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ō', 'ó', 'ǒ', 'ò', 'o' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ū', 'ú', 'ǔ', 'ù', 'u' };
|
||||||
|
case LetterKey.VK_V:
|
||||||
|
return new char[] { 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'ü' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turkish
|
||||||
|
private static char[] GetDefaultLetterKeyTK(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'â' };
|
||||||
|
case LetterKey.VK_C:
|
||||||
|
return new char[] { 'ç' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'ë', '€' };
|
||||||
|
case LetterKey.VK_G:
|
||||||
|
return new char[] { 'ğ' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'ı', 'İ', 'î', };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ö', 'ô' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { 'ş' };
|
||||||
|
case LetterKey.VK_T:
|
||||||
|
return new char[] { '₺' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ü', 'û' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Polish
|
||||||
|
private static char[] GetDefaultLetterKeyPL(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'ą' };
|
||||||
|
case LetterKey.VK_C:
|
||||||
|
return new char[] { 'ć' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'ę', '€' };
|
||||||
|
case LetterKey.VK_L:
|
||||||
|
return new char[] { 'ł' };
|
||||||
|
case LetterKey.VK_N:
|
||||||
|
return new char[] { 'ń' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ó' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { 'ś' };
|
||||||
|
case LetterKey.VK_Z:
|
||||||
|
return new char[] { 'ż', 'ź' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Slovak
|
||||||
|
private static char[] GetDefaultLetterKeySK(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'á', 'ä' };
|
||||||
|
case LetterKey.VK_C:
|
||||||
|
return new char[] { 'č' };
|
||||||
|
case LetterKey.VK_D:
|
||||||
|
return new char[] { 'ď' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'é', '€' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'í' };
|
||||||
|
case LetterKey.VK_L:
|
||||||
|
return new char[] { 'ľ', 'ĺ' };
|
||||||
|
case LetterKey.VK_N:
|
||||||
|
return new char[] { 'ň' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ó', 'ô' };
|
||||||
|
case LetterKey.VK_R:
|
||||||
|
return new char[] { 'ŕ' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { 'š' };
|
||||||
|
case LetterKey.VK_T:
|
||||||
|
return new char[] { 'ť' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ú' };
|
||||||
|
case LetterKey.VK_Y:
|
||||||
|
return new char[] { 'ý' };
|
||||||
|
case LetterKey.VK_Z:
|
||||||
|
return new char[] { 'ž' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Czech
|
||||||
|
private static char[] GetDefaultLetterKeyCZ(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'á' };
|
||||||
|
case LetterKey.VK_C:
|
||||||
|
return new char[] { 'č' };
|
||||||
|
case LetterKey.VK_D:
|
||||||
|
return new char[] { 'ď' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'ě', 'é' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'í' };
|
||||||
|
case LetterKey.VK_N:
|
||||||
|
return new char[] { 'ň' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ó' };
|
||||||
|
case LetterKey.VK_R:
|
||||||
|
return new char[] { 'ř' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { 'š' };
|
||||||
|
case LetterKey.VK_T:
|
||||||
|
return new char[] { 'ť' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ů', 'ú' };
|
||||||
|
case LetterKey.VK_Y:
|
||||||
|
return new char[] { 'ý' };
|
||||||
|
case LetterKey.VK_Z:
|
||||||
|
return new char[] { 'ž' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// German
|
||||||
|
private static char[] GetDefaultLetterKeyDE(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'ä' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { '€' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ö' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { 'ß' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ü' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hungarian
|
||||||
|
private static char[] GetDefaultLetterKeyHU(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'á' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'é' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'í' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ó', 'ő', 'ö' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ú', 'ű', 'ü' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Romanian
|
||||||
|
private static char[] GetDefaultLetterKeyRO(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'ă', 'â' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'î' };
|
||||||
|
case LetterKey.VK_S:
|
||||||
|
return new char[] { 'ș' };
|
||||||
|
case LetterKey.VK_T:
|
||||||
|
return new char[] { 'ț' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Italian
|
||||||
|
private static char[] GetDefaultLetterKeyIT(LetterKey letter)
|
||||||
|
{
|
||||||
|
switch (letter)
|
||||||
|
{
|
||||||
|
case LetterKey.VK_A:
|
||||||
|
return new char[] { 'à' };
|
||||||
|
case LetterKey.VK_E:
|
||||||
|
return new char[] { 'è', 'é', '€' };
|
||||||
|
case LetterKey.VK_I:
|
||||||
|
return new char[] { 'ì', 'í' };
|
||||||
|
case LetterKey.VK_O:
|
||||||
|
return new char[] { 'ò', 'ó' };
|
||||||
|
case LetterKey.VK_U:
|
||||||
|
return new char[] { 'ù', 'ú' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<char>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,7 @@
|
|||||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.0" />
|
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.0" />
|
||||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
|
||||||
<PackageReference Include="Vanara.PInvoke.User32" Version="3.3.15" />
|
<PackageReference Include="Vanara.PInvoke.User32" Version="3.3.15" />
|
||||||
|
<PackageReference Include="Vanara.PInvoke.Shell32" Version="3.3.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -57,12 +57,17 @@ public class PowerAccent : IDisposable
|
|||||||
ProcessNextChar(triggerKey);
|
ProcessNextChar(triggerKey);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
_keyboardListener.SetIsLanguageLetterDelegate(new PowerToys.PowerAccentKeyboardService.IsLanguageLetter((LetterKey letterKey, out bool result) =>
|
||||||
|
{
|
||||||
|
result = Languages.GetDefaultLetterKey(letterKey, _settingService.SelectedLang).Length > 0;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowToolbar(LetterKey letterKey)
|
private void ShowToolbar(LetterKey letterKey)
|
||||||
{
|
{
|
||||||
_visible = true;
|
_visible = true;
|
||||||
_characters = (WindowsFunctions.IsCapsLockState() || WindowsFunctions.IsShiftState()) ? ToUpper(SettingsService.GetDefaultLetterKey(letterKey)) : SettingsService.GetDefaultLetterKey(letterKey);
|
_characters = (WindowsFunctions.IsCapsLockState() || WindowsFunctions.IsShiftState()) ? ToUpper(Languages.GetDefaultLetterKey(letterKey, _settingService.SelectedLang)) : Languages.GetDefaultLetterKey(letterKey, _settingService.SelectedLang);
|
||||||
Task.Delay(_settingService.InputTime).ContinueWith(
|
Task.Delay(_settingService.InputTime).ContinueWith(
|
||||||
t =>
|
t =>
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,9 @@ public class SettingsService
|
|||||||
|
|
||||||
InputTime = settings.Properties.InputTime.Value;
|
InputTime = settings.Properties.InputTime.Value;
|
||||||
_keyboardListener.UpdateInputTime(InputTime);
|
_keyboardListener.UpdateInputTime(InputTime);
|
||||||
|
|
||||||
|
SelectedLang = Enum.TryParse(settings.Properties.SelectedLang.Value, out Language selectedLangValue) ? selectedLangValue : Language.ALL;
|
||||||
|
|
||||||
switch (settings.Properties.ToolbarPosition.Value)
|
switch (settings.Properties.ToolbarPosition.Value)
|
||||||
{
|
{
|
||||||
case "Top center":
|
case "Top center":
|
||||||
@ -85,8 +88,6 @@ public class SettingsService
|
|||||||
Position = Position.Center;
|
Position = Position.Center;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_keyboardListener.UpdateInputTime(InputTime);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -142,31 +143,19 @@ public class SettingsService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static char[] GetDefaultLetterKey(LetterKey letter)
|
private Language _selectedLang;
|
||||||
|
|
||||||
|
public Language SelectedLang
|
||||||
{
|
{
|
||||||
switch (letter)
|
get
|
||||||
{
|
{
|
||||||
case LetterKey.VK_A:
|
return _selectedLang;
|
||||||
return new char[] { 'à', 'â', 'á', 'ä', 'ã', 'å', 'æ' };
|
|
||||||
case LetterKey.VK_C:
|
|
||||||
return new char[] { 'ć', 'ĉ', 'č', 'ċ', 'ç', 'ḉ' };
|
|
||||||
case LetterKey.VK_E:
|
|
||||||
return new char[] { 'é', 'è', 'ê', 'ë', 'ē', 'ė', '€' };
|
|
||||||
case LetterKey.VK_I:
|
|
||||||
return new char[] { 'î', 'ï', 'í', 'ì', 'ī' };
|
|
||||||
case LetterKey.VK_N:
|
|
||||||
return new char[] { 'ñ', 'ń' };
|
|
||||||
case LetterKey.VK_O:
|
|
||||||
return new char[] { 'ô', 'ö', 'ó', 'ò', 'õ', 'ø', 'œ' };
|
|
||||||
case LetterKey.VK_S:
|
|
||||||
return new char[] { 'š', 'ß', 'ś' };
|
|
||||||
case LetterKey.VK_U:
|
|
||||||
return new char[] { 'û', 'ù', 'ü', 'ú', 'ū' };
|
|
||||||
case LetterKey.VK_Y:
|
|
||||||
return new char[] { 'ÿ', 'ý' };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ArgumentException("Letter {0} is missing", letter.ToString());
|
set
|
||||||
|
{
|
||||||
|
_selectedLang = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,15 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeyboardListener::SetIsLanguageLetterDelegate(IsLanguageLetter isLanguageLetterDelegate)
|
||||||
|
{
|
||||||
|
m_isLanguageLetterCb = [trigger = std::move(isLanguageLetterDelegate)](LetterKey key) {
|
||||||
|
bool result;
|
||||||
|
trigger(key, result);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
void KeyboardListener::UpdateActivationKey(int32_t activationKey)
|
void KeyboardListener::UpdateActivationKey(int32_t activationKey)
|
||||||
{
|
{
|
||||||
m_settings.activationKey = static_cast<PowerAccentActivationKey>(activationKey);
|
m_settings.activationKey = static_cast<PowerAccentActivationKey>(activationKey);
|
||||||
@ -80,7 +89,7 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
|||||||
|
|
||||||
bool KeyboardListener::OnKeyDown(KBDLLHOOKSTRUCT info) noexcept
|
bool KeyboardListener::OnKeyDown(KBDLLHOOKSTRUCT info) noexcept
|
||||||
{
|
{
|
||||||
if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters))
|
if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters) && m_isLanguageLetterCb(static_cast<LetterKey>(info.vkCode)))
|
||||||
{
|
{
|
||||||
m_stopwatch.reset();
|
m_stopwatch.reset();
|
||||||
letterPressed = static_cast<LetterKey>(info.vkCode);
|
letterPressed = static_cast<LetterKey>(info.vkCode);
|
||||||
@ -139,7 +148,7 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
|||||||
|
|
||||||
bool KeyboardListener::OnKeyUp(KBDLLHOOKSTRUCT info) noexcept
|
bool KeyboardListener::OnKeyUp(KBDLLHOOKSTRUCT info) noexcept
|
||||||
{
|
{
|
||||||
if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters))
|
if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters) && m_isLanguageLetterCb(static_cast<LetterKey>(info.vkCode)))
|
||||||
{
|
{
|
||||||
letterPressed = LetterKey::None;
|
letterPressed = LetterKey::None;
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
|||||||
void SetShowToolbarEvent(ShowToolbar showToolbarEvent);
|
void SetShowToolbarEvent(ShowToolbar showToolbarEvent);
|
||||||
void SetHideToolbarEvent(HideToolbar hideToolbarEvent);
|
void SetHideToolbarEvent(HideToolbar hideToolbarEvent);
|
||||||
void SetNextCharEvent(NextChar NextCharEvent);
|
void SetNextCharEvent(NextChar NextCharEvent);
|
||||||
|
void SetIsLanguageLetterDelegate(IsLanguageLetter IsLanguageLetterDelegate);
|
||||||
|
|
||||||
void UpdateActivationKey(int32_t activationKey);
|
void UpdateActivationKey(int32_t activationKey);
|
||||||
void UpdateInputTime(int32_t inputTime);
|
void UpdateInputTime(int32_t inputTime);
|
||||||
@ -49,18 +50,47 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
|
|||||||
std::function<void(LetterKey)> m_showToolbarCb;
|
std::function<void(LetterKey)> m_showToolbarCb;
|
||||||
std::function<void(InputType)> m_hideToolbarCb;
|
std::function<void(InputType)> m_hideToolbarCb;
|
||||||
std::function<void(TriggerKey)> m_nextCharCb;
|
std::function<void(TriggerKey)> m_nextCharCb;
|
||||||
|
std::function<bool(LetterKey)> m_isLanguageLetterCb;
|
||||||
bool m_triggeredWithSpace;
|
bool m_triggeredWithSpace;
|
||||||
spdlog::stopwatch m_stopwatch;
|
spdlog::stopwatch m_stopwatch;
|
||||||
|
|
||||||
static inline const std::vector<LetterKey> letters = { LetterKey::VK_A,
|
static inline const std::vector<LetterKey> letters = { LetterKey::VK_0,
|
||||||
|
LetterKey::VK_1,
|
||||||
|
LetterKey::VK_2,
|
||||||
|
LetterKey::VK_3,
|
||||||
|
LetterKey::VK_4,
|
||||||
|
LetterKey::VK_5,
|
||||||
|
LetterKey::VK_6,
|
||||||
|
LetterKey::VK_7,
|
||||||
|
LetterKey::VK_8,
|
||||||
|
LetterKey::VK_9,
|
||||||
|
LetterKey::VK_A,
|
||||||
|
LetterKey::VK_B,
|
||||||
LetterKey::VK_C,
|
LetterKey::VK_C,
|
||||||
|
LetterKey::VK_D,
|
||||||
LetterKey::VK_E,
|
LetterKey::VK_E,
|
||||||
|
LetterKey::VK_F,
|
||||||
|
LetterKey::VK_G,
|
||||||
|
LetterKey::VK_H,
|
||||||
LetterKey::VK_I,
|
LetterKey::VK_I,
|
||||||
|
LetterKey::VK_J,
|
||||||
|
LetterKey::VK_K,
|
||||||
|
LetterKey::VK_L,
|
||||||
|
LetterKey::VK_M,
|
||||||
LetterKey::VK_N,
|
LetterKey::VK_N,
|
||||||
LetterKey::VK_O,
|
LetterKey::VK_O,
|
||||||
|
LetterKey::VK_P,
|
||||||
|
LetterKey::VK_Q,
|
||||||
|
LetterKey::VK_R,
|
||||||
LetterKey::VK_S,
|
LetterKey::VK_S,
|
||||||
|
LetterKey::VK_T,
|
||||||
LetterKey::VK_U,
|
LetterKey::VK_U,
|
||||||
LetterKey::VK_Y };
|
LetterKey::VK_V,
|
||||||
|
LetterKey::VK_W,
|
||||||
|
LetterKey::VK_X,
|
||||||
|
LetterKey::VK_Y,
|
||||||
|
LetterKey::VK_Z,
|
||||||
|
LetterKey::VK_COMMA };
|
||||||
LetterKey letterPressed{};
|
LetterKey letterPressed{};
|
||||||
|
|
||||||
static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space };
|
static inline const std::vector<TriggerKey> triggers = { TriggerKey::Right, TriggerKey::Left, TriggerKey::Space };
|
||||||
|
@ -5,15 +5,43 @@ namespace PowerToys
|
|||||||
enum LetterKey
|
enum LetterKey
|
||||||
{
|
{
|
||||||
None = 0x00,
|
None = 0x00,
|
||||||
|
VK_0 = 0x30,
|
||||||
|
VK_1 = 0x31,
|
||||||
|
VK_2 = 0x32,
|
||||||
|
VK_3 = 0x33,
|
||||||
|
VK_4 = 0x34,
|
||||||
|
VK_5 = 0x35,
|
||||||
|
VK_6 = 0x36,
|
||||||
|
VK_7 = 0x37,
|
||||||
|
VK_8 = 0x38,
|
||||||
|
VK_9 = 0x39,
|
||||||
VK_A = 0x41,
|
VK_A = 0x41,
|
||||||
|
VK_B = 0x42,
|
||||||
VK_C = 0x43,
|
VK_C = 0x43,
|
||||||
|
VK_D = 0x44,
|
||||||
VK_E = 0x45,
|
VK_E = 0x45,
|
||||||
|
VK_F = 0x46,
|
||||||
|
VK_G = 0x47,
|
||||||
|
VK_H = 0x48,
|
||||||
VK_I = 0x49,
|
VK_I = 0x49,
|
||||||
|
VK_J = 0x4A,
|
||||||
|
VK_K = 0x4B,
|
||||||
|
VK_L = 0x4C,
|
||||||
|
VK_M = 0x4D,
|
||||||
VK_N = 0x4E,
|
VK_N = 0x4E,
|
||||||
VK_O = 0x4F,
|
VK_O = 0x4F,
|
||||||
|
VK_P = 0x50,
|
||||||
|
VK_Q = 0x51,
|
||||||
|
VK_R = 0x52,
|
||||||
VK_S = 0x53,
|
VK_S = 0x53,
|
||||||
|
VK_T = 0x54,
|
||||||
VK_U = 0x55,
|
VK_U = 0x55,
|
||||||
VK_Y = 0x59
|
VK_V = 0x56,
|
||||||
|
VK_W = 0x57,
|
||||||
|
VK_X = 0x58,
|
||||||
|
VK_Y = 0x59,
|
||||||
|
VK_Z = 0x5A,
|
||||||
|
VK_COMMA = 0xBC
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TriggerKey
|
enum TriggerKey
|
||||||
@ -33,6 +61,7 @@ namespace PowerToys
|
|||||||
[version(1.0), uuid(37197089-5438-4479-af57-30ab3f3c8be4)] delegate void ShowToolbar(LetterKey key);
|
[version(1.0), uuid(37197089-5438-4479-af57-30ab3f3c8be4)] delegate void ShowToolbar(LetterKey key);
|
||||||
[version(1.0), uuid(8eb79d6b-1826-424f-9fbc-af21ae19725e)] delegate void HideToolbar(InputType inputType);
|
[version(1.0), uuid(8eb79d6b-1826-424f-9fbc-af21ae19725e)] delegate void HideToolbar(InputType inputType);
|
||||||
[version(1.0), uuid(db72d45c-a5a2-446f-bdc1-506e9121764a)] delegate void NextChar(TriggerKey inputSpace);
|
[version(1.0), uuid(db72d45c-a5a2-446f-bdc1-506e9121764a)] delegate void NextChar(TriggerKey inputSpace);
|
||||||
|
[version(1.0), uuid(20be2919-2b91-4313-b6e0-4c3484fe91ef)] delegate void IsLanguageLetter(LetterKey key, [out] boolean* result);
|
||||||
|
|
||||||
[default_interface] runtimeclass KeyboardListener {
|
[default_interface] runtimeclass KeyboardListener {
|
||||||
KeyboardListener();
|
KeyboardListener();
|
||||||
@ -41,6 +70,7 @@ namespace PowerToys
|
|||||||
void SetShowToolbarEvent(event ShowToolbar showToolbarEvent);
|
void SetShowToolbarEvent(event ShowToolbar showToolbarEvent);
|
||||||
void SetHideToolbarEvent(event HideToolbar hideToolbarEvent);
|
void SetHideToolbarEvent(event HideToolbar hideToolbarEvent);
|
||||||
void SetNextCharEvent(event NextChar nextCharEvent);
|
void SetNextCharEvent(event NextChar nextCharEvent);
|
||||||
|
void SetIsLanguageLetterDelegate(IsLanguageLetter isLanguageLetterDelegate);
|
||||||
void UpdateActivationKey(Int32 activationKey);
|
void UpdateActivationKey(Int32 activationKey);
|
||||||
void UpdateInputTime(Int32 inputTime);
|
void UpdateInputTime(Int32 inputTime);
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,15 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
[JsonPropertyName("input_time_ms")]
|
[JsonPropertyName("input_time_ms")]
|
||||||
public IntProperty InputTime { get; set; }
|
public IntProperty InputTime { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("selected_lang")]
|
||||||
|
public StringProperty SelectedLang { get; set; }
|
||||||
|
|
||||||
public PowerAccentProperties()
|
public PowerAccentProperties()
|
||||||
{
|
{
|
||||||
ActivationKey = PowerAccentActivationKey.Both;
|
ActivationKey = PowerAccentActivationKey.Both;
|
||||||
ToolbarPosition = "Top center";
|
ToolbarPosition = "Top center";
|
||||||
InputTime = new IntProperty(200);
|
InputTime = new IntProperty(200);
|
||||||
|
SelectedLang = "ALL";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,55 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (_powerAccentSettings.Properties.SelectedLang.Value)
|
||||||
|
{
|
||||||
|
case "ALL":
|
||||||
|
_selectedLangIndex = 0;
|
||||||
|
break;
|
||||||
|
case "CUR":
|
||||||
|
_selectedLangIndex = 1;
|
||||||
|
break;
|
||||||
|
case "CZ":
|
||||||
|
_selectedLangIndex = 2;
|
||||||
|
break;
|
||||||
|
case "DE":
|
||||||
|
_selectedLangIndex = 3;
|
||||||
|
break;
|
||||||
|
case "FR":
|
||||||
|
_selectedLangIndex = 4;
|
||||||
|
break;
|
||||||
|
case "HU":
|
||||||
|
_selectedLangIndex = 5;
|
||||||
|
break;
|
||||||
|
case "IS":
|
||||||
|
_selectedLangIndex = 6;
|
||||||
|
break;
|
||||||
|
case "IT":
|
||||||
|
_selectedLangIndex = 7;
|
||||||
|
break;
|
||||||
|
case "MI":
|
||||||
|
_selectedLangIndex = 8;
|
||||||
|
break;
|
||||||
|
case "PI":
|
||||||
|
_selectedLangIndex = 9;
|
||||||
|
break;
|
||||||
|
case "PL":
|
||||||
|
_selectedLangIndex = 10;
|
||||||
|
break;
|
||||||
|
case "RO":
|
||||||
|
_selectedLangIndex = 11;
|
||||||
|
break;
|
||||||
|
case "SK":
|
||||||
|
_selectedLangIndex = 12;
|
||||||
|
break;
|
||||||
|
case "SP":
|
||||||
|
_selectedLangIndex = 13;
|
||||||
|
break;
|
||||||
|
case "TK":
|
||||||
|
_selectedLangIndex = 14;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// set the callback functions value to hangle outgoing IPC message.
|
// set the callback functions value to hangle outgoing IPC message.
|
||||||
SendConfigMSG = ipcMSGCallBackFunc;
|
SendConfigMSG = ipcMSGCallBackFunc;
|
||||||
}
|
}
|
||||||
@ -192,6 +241,74 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int _selectedLangIndex;
|
||||||
|
|
||||||
|
public int SelectedLangIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _selectedLangIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_selectedLangIndex != value)
|
||||||
|
{
|
||||||
|
_selectedLangIndex = value;
|
||||||
|
switch (_selectedLangIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "ALL";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "CUR";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "CZ";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "DE";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "FR";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "HU";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "IS";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "IT";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "MI";
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "PI";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "PL";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "RO";
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "SK";
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "SP";
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
_powerAccentSettings.Properties.SelectedLang.Value = "TK";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
RaisePropertyChanged(nameof(SelectedLangIndex));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
private void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
{
|
{
|
||||||
// Notify UI of property change
|
// Notify UI of property change
|
||||||
|
@ -2350,7 +2350,8 @@ Activate by holding the key for the character you want to add an accent to, then
|
|||||||
<data name="QuickAccent_InputTimeMs.Description" xml:space="preserve">
|
<data name="QuickAccent_InputTimeMs.Description" xml:space="preserve">
|
||||||
<value>Hold the key down for this much time to make the accent menu appear (ms)</value>
|
<value>Hold the key down for this much time to make the accent menu appear (ms)</value>
|
||||||
<comment>ms = milliseconds</comment>
|
<comment>ms = milliseconds</comment>
|
||||||
</data> <data name="LearnMore_TextExtractor.Text" xml:space="preserve">
|
</data>
|
||||||
|
<data name="LearnMore_TextExtractor.Text" xml:space="preserve">
|
||||||
<value>Learn more about Text Extractor</value>
|
<value>Learn more about Text Extractor</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TextExtractor.ModuleDescription" xml:space="preserve">
|
<data name="TextExtractor.ModuleDescription" xml:space="preserve">
|
||||||
@ -2399,4 +2400,61 @@ Activate by holding the key for the character you want to add an accent to, then
|
|||||||
<value>The continuous capture mode will consume more resources when in use. Also, measurements will be excluded from screenshots and screen capture.</value>
|
<value>The continuous capture mode will consume more resources when in use. Also, measurements will be excluded from screenshots and screen capture.</value>
|
||||||
<comment>pointer as in mouse pointer. Resources refer to things like CPU, GPU, RAM</comment>
|
<comment>pointer as in mouse pointer. Resources refer to things like CPU, GPU, RAM</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="QuickAccent_DisableFullscreen.Header" xml:space="preserve">
|
||||||
|
<value>Disable when Game Mode is On</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_Language.Header" xml:space="preserve">
|
||||||
|
<value>Language</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage.Header" xml:space="preserve">
|
||||||
|
<value>Choose language</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage.Description" xml:space="preserve">
|
||||||
|
<value>Show only accented characters common to the selected language</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_All.Content" xml:space="preserve">
|
||||||
|
<value>All available</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Currency.Content" xml:space="preserve">
|
||||||
|
<value>Currency</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Czech.Content" xml:space="preserve">
|
||||||
|
<value>Czech</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Dutch.Content" xml:space="preserve">
|
||||||
|
<value>Dutch</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_French.Content" xml:space="preserve">
|
||||||
|
<value>French</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Maori.Content" xml:space="preserve">
|
||||||
|
<value>Maori</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Pinyin.Content" xml:space="preserve">
|
||||||
|
<value>Pinyin</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Polish.Content" xml:space="preserve">
|
||||||
|
<value>Polish</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Slovakian.Content" xml:space="preserve">
|
||||||
|
<value>Slovakian</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Spanish.Content" xml:space="preserve">
|
||||||
|
<value>Spanish</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Turkish.Content" xml:space="preserve">
|
||||||
|
<value>Turkish</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Icelandic.Content" xml:space="preserve">
|
||||||
|
<value>Icelandic</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Romanian.Content" xml:space="preserve">
|
||||||
|
<value>Romanian</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Hungarian.Content" xml:space="preserve">
|
||||||
|
<value>Hungarian</value>
|
||||||
|
</data>
|
||||||
|
<data name="QuickAccent_SelectedLanguage_Italian.Content" xml:space="preserve">
|
||||||
|
<value>Italian</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -36,6 +36,31 @@
|
|||||||
</controls:Setting>
|
</controls:Setting>
|
||||||
</controls:SettingsGroup>
|
</controls:SettingsGroup>
|
||||||
|
|
||||||
|
<controls:SettingsGroup x:Uid="QuickAccent_Language" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
|
||||||
|
<controls:Setting x:Uid="QuickAccent_SelectedLanguage" Icon="">
|
||||||
|
<controls:Setting.ActionContent>
|
||||||
|
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||||
|
SelectedIndex="{x:Bind Path=ViewModel.SelectedLangIndex, Mode=TwoWay}" >
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_All"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Currency"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Czech"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Dutch"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_French"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Hungarian"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Icelandic"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Italian"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Maori"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Pinyin"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Polish"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Romanian"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Slovakian"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Spanish"/>
|
||||||
|
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Turkish"/>
|
||||||
|
</ComboBox>
|
||||||
|
</controls:Setting.ActionContent>
|
||||||
|
</controls:Setting>
|
||||||
|
</controls:SettingsGroup>
|
||||||
|
|
||||||
<controls:SettingsGroup x:Uid="QuickAccent_Toolbar" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
|
<controls:SettingsGroup x:Uid="QuickAccent_Toolbar" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
|
||||||
<controls:Setting x:Uid="QuickAccent_ToolbarPosition" Icon="">
|
<controls:Setting x:Uid="QuickAccent_ToolbarPosition" Icon="">
|
||||||
<controls:Setting.ActionContent>
|
<controls:Setting.ActionContent>
|
||||||
@ -54,6 +79,7 @@
|
|||||||
</controls:Setting.ActionContent>
|
</controls:Setting.ActionContent>
|
||||||
</controls:Setting>
|
</controls:Setting>
|
||||||
</controls:SettingsGroup>
|
</controls:SettingsGroup>
|
||||||
|
|
||||||
<controls:SettingsGroup x:Uid="QuickAccent_Behavior" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
|
<controls:SettingsGroup x:Uid="QuickAccent_Behavior" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
|
||||||
<controls:Setting x:Uid="QuickAccent_InputTimeMs" Icon="">
|
<controls:Setting x:Uid="QuickAccent_InputTimeMs" Icon="">
|
||||||
<controls:Setting.ActionContent>
|
<controls:Setting.ActionContent>
|
||||||
|
Loading…
Reference in New Issue
Block a user