Repo // Use new tags for pinyin parsers.

This commit is contained in:
ShikiSuen 2023-05-23 19:39:51 +08:00
parent f3280ebf44
commit a1fd56b872
4 changed files with 10 additions and 14 deletions

View File

@ -178,12 +178,12 @@ public enum KeyboardParser: Int, CaseIterable {
case ofETen26 = 3 case ofETen26 = 3
case ofHsu = 2 case ofHsu = 2
case ofStarlight = 9 case ofStarlight = 9
case ofHanyuPinyin = 10 case ofHanyuPinyin = 100
case ofSecondaryPinyin = 11 case ofSecondaryPinyin = 101
case ofYalePinyin = 12 case ofYalePinyin = 102
case ofHualuoPinyin = 13 case ofHualuoPinyin = 103
case ofUniversalPinyin = 14 case ofUniversalPinyin = 104
case ofWadeGilesPinyin = 15 case ofWadeGilesPinyin = 105
public var localizedMenuName: String { public var localizedMenuName: String {
let rawString: String = { let rawString: String = {

View File

@ -39,11 +39,7 @@ public extension PrefMgr {
} }
} }
// //
var isKeyboardParserOptionValid = false if KeyboardParser(rawValue: keyboardParser) == nil {
KeyboardParser.allCases.forEach {
if $0.rawValue == keyboardParser { isKeyboardParserOptionValid = true }
}
if !isKeyboardParserOptionValid {
keyboardParser = 0 keyboardParser = 0
} }
// //

View File

@ -52,7 +52,7 @@ struct VwrPrefPaneKeyboard: View {
Text("↻ㄅ" + " " + NSLocalizedString("Eten Trad.", comment: "")) Text("↻ㄅ" + " " + NSLocalizedString("Eten Trad.", comment: ""))
} }
Button { Button {
keyboardParser = 10 keyboardParser = 100
basicKeyboardLayout = "com.apple.keylayout.ABC" basicKeyboardLayout = "com.apple.keylayout.ABC"
} label: { } label: {
Text("↻A") Text("↻A")
@ -66,7 +66,7 @@ struct VwrPrefPaneKeyboard: View {
selection: $keyboardParser selection: $keyboardParser
) { ) {
ForEach(KeyboardParser.allCases, id: \.self) { item in ForEach(KeyboardParser.allCases, id: \.self) { item in
if [7, 10].contains(item.rawValue) { Divider() } if [7, 100].contains(item.rawValue) { Divider() }
Text(item.localizedMenuName).tag(item.rawValue) Text(item.localizedMenuName).tag(item.rawValue)
}.id(UUID()) }.id(UUID())
} }

View File

@ -194,7 +194,7 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
parserButton.menu?.removeAllItems() parserButton.menu?.removeAllItems()
let basicParserID = PrefMgr.shared.keyboardParser let basicParserID = PrefMgr.shared.keyboardParser
KeyboardParser.allCases.forEach { item in KeyboardParser.allCases.forEach { item in
if [7, 10].contains(item.rawValue) { if [7, 100].contains(item.rawValue) {
parserButton.menu?.addItem(NSMenuItem.separator()) parserButton.menu?.addItem(NSMenuItem.separator())
} }
let menuItem = NSMenuItem() let menuItem = NSMenuItem()