[QuickAccent] Support Chinese Phonetic Alphabet(Pinyin) and other unicode characters (#21618)

* #21300-0

* 注释无关代码

* 修改为多行注释,将GetDefaultLetterKeyPI返回值类型修改为string[]

* 重写ToUpper函数

* 更改_characters变量类型为string[]

* 重写Insert函数

* 修改OnSelectCharacter类型为Action<int, string>

* 修改OnChangeDisplay类型为Action<bool, string[]>

* 修改PowerAccent_OnSelectionCharacter和PowerAccent_OnChangeDisplay函数

* 清理无用注释

* #21300-1

* 将修改应用到其他语言

* Removed previous method and change another refence of previous method.

* PowerAccent-21300: sort Pinyin languages
This commit is contained in:
char46
2022-11-18 00:15:53 +08:00
committed by GitHub
parent 08636c6a22
commit 5779b43c80
4 changed files with 262 additions and 245 deletions

View File

@@ -14,12 +14,14 @@ public class PowerAccent : IDisposable
private readonly SettingsService _settingService;
private bool _visible;
private char[] _characters = Array.Empty<char>();
private string[] _characters = Array.Empty<string>();
private int _selectedIndex = -1;
public event Action<bool, char[]> OnChangeDisplay;
public event Action<bool, string[]> OnChangeDisplay;
public event Action<int, char> OnSelectCharacter;
public event Action<int, string> OnSelectCharacter;
private KeyboardListener _keyboardListener;
@@ -84,7 +86,7 @@ public class PowerAccent : IDisposable
{
case InputType.Space:
{
WindowsFunctions.Insert(' ');
WindowsFunctions.Insert(" ");
break;
}
@@ -191,18 +193,18 @@ public class PowerAccent : IDisposable
GC.SuppressFinalize(this);
}
public static char[] ToUpper(char[] array)
public static string[] ToUpper(string[] array)
{
char[] result = new char[array.Length];
string[] result = new string[array.Length];
for (int i = 0; i < array.Length; i++)
{
if (array[i] == 'ß')
if (array[i].Contains('ß'))
{
result[i] = 'ẞ';
result[i] = "ẞ";
}
else
{
result[i] = char.ToUpper(array[i], System.Globalization.CultureInfo.InvariantCulture);
result[i] = array[i].ToUpper(System.Globalization.CultureInfo.InvariantCulture);
}
}