InputState // Make SymbolNode independent.
This commit is contained in:
parent
c79b7c99a9
commit
81e157ef6e
|
@ -393,75 +393,3 @@ class InputState {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SymbolNode {
|
||||
var title: String
|
||||
var children: [SymbolNode]?
|
||||
|
||||
init(_ title: String, _ children: [SymbolNode]? = nil) {
|
||||
self.title = title
|
||||
self.children = children
|
||||
}
|
||||
|
||||
init(_ title: String, symbols: String) {
|
||||
self.title = title
|
||||
children = Array(symbols).map { SymbolNode(String($0), nil) }
|
||||
}
|
||||
|
||||
static let catCommonSymbols = String(
|
||||
format: NSLocalizedString("catCommonSymbols", comment: ""))
|
||||
static let catHoriBrackets = String(
|
||||
format: NSLocalizedString("catHoriBrackets", comment: ""))
|
||||
static let catVertBrackets = String(
|
||||
format: NSLocalizedString("catVertBrackets", comment: ""))
|
||||
static let catGreekLetters = String(
|
||||
format: NSLocalizedString("catGreekLetters", comment: ""))
|
||||
static let catMathSymbols = String(
|
||||
format: NSLocalizedString("catMathSymbols", comment: ""))
|
||||
static let catCurrencyUnits = String(
|
||||
format: NSLocalizedString("catCurrencyUnits", comment: ""))
|
||||
static let catSpecialSymbols = String(
|
||||
format: NSLocalizedString("catSpecialSymbols", comment: ""))
|
||||
static let catUnicodeSymbols = String(
|
||||
format: NSLocalizedString("catUnicodeSymbols", comment: ""))
|
||||
static let catCircledKanjis = String(
|
||||
format: NSLocalizedString("catCircledKanjis", comment: ""))
|
||||
static let catCircledKataKana = String(
|
||||
format: NSLocalizedString("catCircledKataKana", comment: ""))
|
||||
static let catBracketKanjis = String(
|
||||
format: NSLocalizedString("catBracketKanjis", comment: ""))
|
||||
static let catSingleTableLines = String(
|
||||
format: NSLocalizedString("catSingleTableLines", comment: ""))
|
||||
static let catDoubleTableLines = String(
|
||||
format: NSLocalizedString("catDoubleTableLines", comment: ""))
|
||||
static let catFillingBlocks = String(
|
||||
format: NSLocalizedString("catFillingBlocks", comment: ""))
|
||||
static let catLineSegments = String(
|
||||
format: NSLocalizedString("catLineSegments", comment: ""))
|
||||
|
||||
static let root: SymbolNode = .init(
|
||||
"/",
|
||||
[
|
||||
SymbolNode("`"),
|
||||
SymbolNode(catCommonSymbols, symbols: ",、。.?!;:‧‥﹐﹒˙·‘’“”〝〞‵′〃~$%@&#*"),
|
||||
SymbolNode(catHoriBrackets, symbols: "()「」〔〕{}〈〉『』《》【】﹙﹚﹝﹞﹛﹜"),
|
||||
SymbolNode(catVertBrackets, symbols: "︵︶﹁﹂︹︺︷︸︿﹀﹃﹄︽︾︻︼"),
|
||||
SymbolNode(
|
||||
catGreekLetters, symbols: "αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ"
|
||||
),
|
||||
SymbolNode(catMathSymbols, symbols: "+-×÷=≠≒∞±√<>﹤﹥≦≧∩∪ˇ⊥∠∟⊿㏒㏑∫∮∵∴╳﹢"),
|
||||
SymbolNode(catCurrencyUnits, symbols: "$€¥¢£₽₨₩฿₺₮₱₭₴₦৲৳૱௹﷼₹₲₪₡₫៛₵₢₸₤₳₥₠₣₰₧₯₶₷"),
|
||||
SymbolNode(catSpecialSymbols, symbols: "↑↓←→↖↗↙↘↺⇧⇩⇦⇨⇄⇆⇅⇵↻◎○●⊕⊙※△▲☆★◇◆□■▽▼§¥〒¢£♀♂↯"),
|
||||
SymbolNode(catUnicodeSymbols, symbols: "♨☀☁☂☃♠♥♣♦♩♪♫♬☺☻"),
|
||||
SymbolNode(catCircledKanjis, symbols: "㊟㊞㊚㊛㊊㊋㊌㊍㊎㊏㊐㊑㊒㊓㊔㊕㊖㊗︎㊘㊙︎㊜㊝㊠㊡㊢㊣㊤㊥㊦㊧㊨㊩㊪㊫㊬㊭㊮㊯㊰🈚︎🈯︎"),
|
||||
SymbolNode(
|
||||
catCircledKataKana, symbols: "㋐㋑㋒㋓㋔㋕㋖㋗㋘㋙㋚㋛㋜㋝㋞㋟㋠㋡㋢㋣㋤㋥㋦㋧㋨㋩㋪㋫㋬㋭㋮㋯㋰㋱㋲㋳㋴㋵㋶㋷㋸㋹㋺㋻㋼㋾"
|
||||
),
|
||||
SymbolNode(catBracketKanjis, symbols: "㈪㈫㈬㈭㈮㈯㈰㈱㈲㈳㈴㈵㈶㈷㈸㈹㈺㈻㈼㈽㈾㈿㉀㉁㉂㉃"),
|
||||
SymbolNode(catSingleTableLines, symbols: "├─┼┴┬┤┌┐╞═╪╡│▕└┘╭╮╰╯"),
|
||||
SymbolNode(catDoubleTableLines, symbols: "╔╦╗╠═╬╣╓╥╖╒╤╕║╚╩╝╟╫╢╙╨╜╞╪╡╘╧╛"),
|
||||
SymbolNode(catFillingBlocks, symbols: "_ˍ▁▂▃▄▅▆▇█▏▎▍▌▋▊▉◢◣◥◤"),
|
||||
SymbolNode(catLineSegments, symbols: "﹣﹦≡|∣∥–︱—︳╴¯ ̄﹉﹊﹍﹎﹋﹌﹏︴∕﹨╱╲/\"),
|
||||
]
|
||||
)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
// Copyright (c) 2011 and onwards The OpenVanilla Project (MIT License).
|
||||
// All possible vChewing-specific modifications are of:
|
||||
// (c) 2021 and onwards The vChewing Project (MIT-NTL License).
|
||||
/*
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
1. The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
2. No trademark license is granted to use the trade names, trademarks, service
|
||||
marks, or product names of Contributor, except as required to fulfill notice
|
||||
requirements above.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
|
||||
class SymbolNode {
|
||||
var title: String
|
||||
var children: [SymbolNode]?
|
||||
|
||||
init(_ title: String, _ children: [SymbolNode]? = nil) {
|
||||
self.title = title
|
||||
self.children = children
|
||||
}
|
||||
|
||||
init(_ title: String, symbols: String) {
|
||||
self.title = title
|
||||
children = Array(symbols).map { SymbolNode(String($0), nil) }
|
||||
}
|
||||
|
||||
static let catCommonSymbols = String(
|
||||
format: NSLocalizedString("catCommonSymbols", comment: ""))
|
||||
static let catHoriBrackets = String(
|
||||
format: NSLocalizedString("catHoriBrackets", comment: ""))
|
||||
static let catVertBrackets = String(
|
||||
format: NSLocalizedString("catVertBrackets", comment: ""))
|
||||
static let catGreekLetters = String(
|
||||
format: NSLocalizedString("catGreekLetters", comment: ""))
|
||||
static let catMathSymbols = String(
|
||||
format: NSLocalizedString("catMathSymbols", comment: ""))
|
||||
static let catCurrencyUnits = String(
|
||||
format: NSLocalizedString("catCurrencyUnits", comment: ""))
|
||||
static let catSpecialSymbols = String(
|
||||
format: NSLocalizedString("catSpecialSymbols", comment: ""))
|
||||
static let catUnicodeSymbols = String(
|
||||
format: NSLocalizedString("catUnicodeSymbols", comment: ""))
|
||||
static let catCircledKanjis = String(
|
||||
format: NSLocalizedString("catCircledKanjis", comment: ""))
|
||||
static let catCircledKataKana = String(
|
||||
format: NSLocalizedString("catCircledKataKana", comment: ""))
|
||||
static let catBracketKanjis = String(
|
||||
format: NSLocalizedString("catBracketKanjis", comment: ""))
|
||||
static let catSingleTableLines = String(
|
||||
format: NSLocalizedString("catSingleTableLines", comment: ""))
|
||||
static let catDoubleTableLines = String(
|
||||
format: NSLocalizedString("catDoubleTableLines", comment: ""))
|
||||
static let catFillingBlocks = String(
|
||||
format: NSLocalizedString("catFillingBlocks", comment: ""))
|
||||
static let catLineSegments = String(
|
||||
format: NSLocalizedString("catLineSegments", comment: ""))
|
||||
|
||||
static let root: SymbolNode = .init(
|
||||
"/",
|
||||
[
|
||||
SymbolNode("`"),
|
||||
SymbolNode(catCommonSymbols, symbols: ",、。.?!;:‧‥﹐﹒˙·‘’“”〝〞‵′〃~$%@&#*"),
|
||||
SymbolNode(catHoriBrackets, symbols: "()「」〔〕{}〈〉『』《》【】﹙﹚﹝﹞﹛﹜"),
|
||||
SymbolNode(catVertBrackets, symbols: "︵︶﹁﹂︹︺︷︸︿﹀﹃﹄︽︾︻︼"),
|
||||
SymbolNode(
|
||||
catGreekLetters, symbols: "αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ"
|
||||
),
|
||||
SymbolNode(catMathSymbols, symbols: "+-×÷=≠≒∞±√<>﹤﹥≦≧∩∪ˇ⊥∠∟⊿㏒㏑∫∮∵∴╳﹢"),
|
||||
SymbolNode(catCurrencyUnits, symbols: "$€¥¢£₽₨₩฿₺₮₱₭₴₦৲৳૱௹﷼₹₲₪₡₫៛₵₢₸₤₳₥₠₣₰₧₯₶₷"),
|
||||
SymbolNode(catSpecialSymbols, symbols: "↑↓←→↖↗↙↘↺⇧⇩⇦⇨⇄⇆⇅⇵↻◎○●⊕⊙※△▲☆★◇◆□■▽▼§¥〒¢£♀♂↯"),
|
||||
SymbolNode(catUnicodeSymbols, symbols: "♨☀☁☂☃♠♥♣♦♩♪♫♬☺☻"),
|
||||
SymbolNode(catCircledKanjis, symbols: "㊟㊞㊚㊛㊊㊋㊌㊍㊎㊏㊐㊑㊒㊓㊔㊕㊖㊗︎㊘㊙︎㊜㊝㊠㊡㊢㊣㊤㊥㊦㊧㊨㊩㊪㊫㊬㊭㊮㊯㊰🈚︎🈯︎"),
|
||||
SymbolNode(
|
||||
catCircledKataKana, symbols: "㋐㋑㋒㋓㋔㋕㋖㋗㋘㋙㋚㋛㋜㋝㋞㋟㋠㋡㋢㋣㋤㋥㋦㋧㋨㋩㋪㋫㋬㋭㋮㋯㋰㋱㋲㋳㋴㋵㋶㋷㋸㋹㋺㋻㋼㋾"
|
||||
),
|
||||
SymbolNode(catBracketKanjis, symbols: "㈪㈫㈬㈭㈮㈯㈰㈱㈲㈳㈴㈵㈶㈷㈸㈹㈺㈻㈼㈽㈾㈿㉀㉁㉂㉃"),
|
||||
SymbolNode(catSingleTableLines, symbols: "├─┼┴┬┤┌┐╞═╪╡│▕└┘╭╮╰╯"),
|
||||
SymbolNode(catDoubleTableLines, symbols: "╔╦╗╠═╬╣╓╥╖╒╤╕║╚╩╝╟╫╢╙╨╜╞╪╡╘╧╛"),
|
||||
SymbolNode(catFillingBlocks, symbols: "_ˍ▁▂▃▄▅▆▇█▏▎▍▌▋▊▉◢◣◥◤"),
|
||||
SymbolNode(catLineSegments, symbols: "﹣﹦≡|∣∥–︱—︳╴¯ ̄﹉﹊﹍﹎﹋﹌﹏︴∕﹨╱╲/\"),
|
||||
]
|
||||
)
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
5B38F5A2281E2E49007D5F5D /* 0_Megrez.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4F1615FC0EB100ABF4B3 /* 0_Megrez.swift */; };
|
||||
5B38F5A3281E2E49007D5F5D /* 3_Span.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4F1C15FC0EB100ABF4B3 /* 3_Span.swift */; };
|
||||
5B38F5A4281E2E49007D5F5D /* 5_LanguageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4F1915FC0EB100ABF4B3 /* 5_LanguageModel.swift */; };
|
||||
5B3A87BC28597CDB0090E163 /* SymbolNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B3A87BB28597CDB0090E163 /* SymbolNode.swift */; };
|
||||
5B40730C281672610023DFFF /* lmAssociates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B407309281672610023DFFF /* lmAssociates.swift */; };
|
||||
5B40730D281672610023DFFF /* lmReplacements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B40730A281672610023DFFF /* lmReplacements.swift */; };
|
||||
5B54E743283A7D89001ECBDC /* lmCoreNS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B54E742283A7D89001ECBDC /* lmCoreNS.swift */; };
|
||||
|
@ -187,6 +188,7 @@
|
|||
5B2DB17127AF8771006D874E /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = Data/Makefile; sourceTree = "<group>"; };
|
||||
5B30F11227BA568800484E24 /* vChewingKeyLayout.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = vChewingKeyLayout.bundle; sourceTree = "<group>"; };
|
||||
5B3133BE280B229700A4A505 /* KeyHandler_States.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; fileEncoding = 4; indentWidth = 2; lineEnding = 0; path = KeyHandler_States.swift; sourceTree = "<group>"; tabWidth = 2; usesTabs = 0; };
|
||||
5B3A87BB28597CDB0090E163 /* SymbolNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymbolNode.swift; sourceTree = "<group>"; };
|
||||
5B407309281672610023DFFF /* lmAssociates.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; fileEncoding = 4; lineEnding = 0; path = lmAssociates.swift; sourceTree = "<group>"; usesTabs = 0; };
|
||||
5B40730A281672610023DFFF /* lmReplacements.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; fileEncoding = 4; lineEnding = 0; path = lmReplacements.swift; sourceTree = "<group>"; usesTabs = 0; };
|
||||
5B54E742283A7D89001ECBDC /* lmCoreNS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = lmCoreNS.swift; sourceTree = "<group>"; };
|
||||
|
@ -466,6 +468,7 @@
|
|||
5B949BDA2816DDBC00D87B5D /* LMConsolidator.swift */,
|
||||
5BD0113A28180D6100609769 /* LMInstantiator.swift */,
|
||||
5BAEFACF28012565001F42C9 /* mgrLangModel.swift */,
|
||||
5B3A87BB28597CDB0090E163 /* SymbolNode.swift */,
|
||||
);
|
||||
path = LangModelRelated;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1071,6 +1074,7 @@
|
|||
D456576E279E4F7B00DF6BC9 /* InputSignal.swift in Sources */,
|
||||
5BA9FD1027FEDB6B002DE248 /* suiPrefPaneKeyboard.swift in Sources */,
|
||||
5B3133BF280B229700A4A505 /* KeyHandler_States.swift in Sources */,
|
||||
5B3A87BC28597CDB0090E163 /* SymbolNode.swift in Sources */,
|
||||
5BA9FD4327FEF3C8002DE248 /* Preferences.swift in Sources */,
|
||||
5BA9FD4427FEF3C8002DE248 /* SegmentedControlStyleViewController.swift in Sources */,
|
||||
D47F7DCE278BFB57002F9DD7 /* ctlPrefWindow.swift in Sources */,
|
||||
|
|
Loading…
Reference in New Issue