Merge pull request #49 from ShikiSuen/upd/1.3.1

1.3.1 Update
This commit is contained in:
Shiki Suen 2022-02-12 00:07:32 +08:00 committed by GitHub
commit fd8b7d8f88
18 changed files with 1784 additions and 1608 deletions

View File

@ -46,7 +46,7 @@
要注意的是 macOS 可能会限制同一次 login session 能终结同一个输入法的执行进程的次数(安装程式透过 kill input method process 来让新版的输入法生效)。如果安装若干次后,发现程式修改的结果并没有出现、或甚至输入法已无法再选用,只需要登出目前的 macOS 系统帐号、再重新登入即可。 要注意的是 macOS 可能会限制同一次 login session 能终结同一个输入法的执行进程的次数(安装程式透过 kill input method process 来让新版的输入法生效)。如果安装若干次后,发现程式修改的结果并没有出现、或甚至输入法已无法再选用,只需要登出目前的 macOS 系统帐号、再重新登入即可。
补记: 该输入法是在 2021 年 11 月初「28ae7deb4092f067539cff600397292e66a5dd56」这一版小麦注音建置的基础上完成的。因为在清洗词库的时候清洗了全部的 git commit 历史,所以无法自动从小麦注音官方仓库上游继承任何改动,只能手动同步任何在此之后的程式修正。最近一次同步參照是小麦注音 2.0.1 版 补记: 该输入法是在 2021 年 11 月初「28ae7deb4092f067539cff600397292e66a5dd56」这一版小麦注音建置的基础上完成的。因为在清洗词库的时候清洗了全部的 git commit 历史,所以无法自动从小麦注音官方仓库上游继承任何改动,只能手动同步任何在此之后的程式修正。最近一次同步參照是 zonble 的分支「5cb6819e132a02bbcba77dbf083ada418750dab7」
## 应用授权 ## 应用授权

View File

@ -26,7 +26,7 @@ namespace Taiyan {
namespace Mandarin { namespace Mandarin {
class PinyinParseHelper { class PinyinParseHelper {
public: public:
static const bool ConsumePrefix(std::string& target, static const bool ConsumePrefix(std::string& target,
const std::string& prefix) { const std::string& prefix) {
if (target.length() < prefix.length()) { if (target.length() < prefix.length()) {
@ -44,13 +44,13 @@ class PinyinParseHelper {
}; };
class BopomofoCharacterMap { class BopomofoCharacterMap {
public: public:
static const BopomofoCharacterMap& SharedInstance(); static const BopomofoCharacterMap& SharedInstance();
std::map<BPMF::Component, std::string> componentToCharacter; std::map<BPMF::Component, std::string> componentToCharacter;
std::map<std::string, BPMF::Component> characterToComponent; std::map<std::string, BPMF::Component> characterToComponent;
protected: protected:
BopomofoCharacterMap(); BopomofoCharacterMap();
}; };
@ -733,9 +733,9 @@ const BPMF BPMF::FromPHT(const std::string& str) {
BPMF::Component toneComponent = 0; BPMF::Component toneComponent = 0;
#define IF_CONSUME1(k, v) \ #define IF_CONSUME1(k, v) \
else if (PinyinParseHelper::ConsumePrefix(pht, k)) { \ else if (PinyinParseHelper::ConsumePrefix(pht, k)) { \
firstComponent = v; \ firstComponent = v; \
} }
// consume the first part // consume the first part
if (0) { if (0) {
@ -761,9 +761,9 @@ const BPMF BPMF::FromPHT(const std::string& str) {
IF_CONSUME1("h", BPMF::H) IF_CONSUME1("h", BPMF::H)
#define IF_CONSUME2(k, v) \ #define IF_CONSUME2(k, v) \
else if (PinyinParseHelper::ConsumePrefix(pht, k)) { \ else if (PinyinParseHelper::ConsumePrefix(pht, k)) { \
secondComponent = v; \ secondComponent = v; \
} }
// consume the second part // consume the second part
if (0) { if (0) {
} else if (PinyinParseHelper::ConsumePrefix(pht, "ing")) { } else if (PinyinParseHelper::ConsumePrefix(pht, "ing")) {
@ -920,11 +920,11 @@ const BPMF BPMF::FromComposedString(const std::string& str) {
const std::string BPMF::composedString() const { const std::string BPMF::composedString() const {
std::string result; std::string result;
#define APPEND(c) \ #define APPEND(c) \
if (syllable_ & c) \ if (syllable_ & c) \
result += \ result += \
(*BopomofoCharacterMap::SharedInstance().componentToCharacter.find( \ (*BopomofoCharacterMap::SharedInstance().componentToCharacter.find( \
syllable_ & c)) \ syllable_ & c)) \
.second .second
APPEND(ConsonantMask); APPEND(ConsonantMask);
APPEND(MiddleVowelMask); APPEND(MiddleVowelMask);
APPEND(VowelMask); APPEND(VowelMask);
@ -990,14 +990,14 @@ BopomofoCharacterMap::BopomofoCharacterMap() {
} }
#define ASSIGNKEY1(m, vec, k, val) \ #define ASSIGNKEY1(m, vec, k, val) \
m[k] = (vec.clear(), vec.push_back((BPMF::Component)val), vec) m[k] = (vec.clear(), vec.push_back((BPMF::Component)val), vec)
#define ASSIGNKEY2(m, vec, k, val1, val2) \ #define ASSIGNKEY2(m, vec, k, val1, val2) \
m[k] = (vec.clear(), vec.push_back((BPMF::Component)val1), \ m[k] = (vec.clear(), vec.push_back((BPMF::Component)val1), \
vec.push_back((BPMF::Component)val2), vec) vec.push_back((BPMF::Component)val2), vec)
#define ASSIGNKEY3(m, vec, k, val1, val2, val3) \ #define ASSIGNKEY3(m, vec, k, val1, val2, val3) \
m[k] = (vec.clear(), vec.push_back((BPMF::Component)val1), \ m[k] = (vec.clear(), vec.push_back((BPMF::Component)val1), \
vec.push_back((BPMF::Component)val2), \ vec.push_back((BPMF::Component)val2), \
vec.push_back((BPMF::Component)val3), vec) vec.push_back((BPMF::Component)val3), vec)
static BopomofoKeyboardLayout* CreateStandardLayout() { static BopomofoKeyboardLayout* CreateStandardLayout() {
std::vector<BPMF::Component> vec; std::vector<BPMF::Component> vec;
@ -1097,6 +1097,55 @@ static BopomofoKeyboardLayout* CreateIBMLayout() {
return new BopomofoKeyboardLayout(ktcm, "IBM"); return new BopomofoKeyboardLayout(ktcm, "IBM");
} }
static BopomofoKeyboardLayout* CreateMiTACLayout() {
std::vector<BPMF::Component> vec;
BopomofoKeyToComponentMap ktcm;
ASSIGNKEY1(ktcm, vec, '1', BPMF::Tone5);
ASSIGNKEY1(ktcm, vec, '2', BPMF::Tone2);
ASSIGNKEY1(ktcm, vec, '3', BPMF::Tone3);
ASSIGNKEY1(ktcm, vec, '4', BPMF::Tone4);
ASSIGNKEY1(ktcm, vec, '5', BPMF::AI);
ASSIGNKEY1(ktcm, vec, '6', BPMF::AO);
ASSIGNKEY1(ktcm, vec, '7', BPMF::AN);
ASSIGNKEY1(ktcm, vec, '8', BPMF::EN);
ASSIGNKEY1(ktcm, vec, '9', BPMF::ANG);
ASSIGNKEY1(ktcm, vec, '0', BPMF::ENG);
ASSIGNKEY1(ktcm, vec, '-', BPMF::ERR);
ASSIGNKEY1(ktcm, vec, ';', BPMF::E);
ASSIGNKEY1(ktcm, vec, ',', BPMF::ZH);
ASSIGNKEY1(ktcm, vec, '.', BPMF::CH);
ASSIGNKEY1(ktcm, vec, '/', BPMF::SH);
ASSIGNKEY1(ktcm, vec, 'a', BPMF::A);
ASSIGNKEY1(ktcm, vec, 'b', BPMF::B);
ASSIGNKEY1(ktcm, vec, 'c', BPMF::C);
ASSIGNKEY1(ktcm, vec, 'd', BPMF::D);
ASSIGNKEY1(ktcm, vec, 'e', BPMF::ER);
ASSIGNKEY1(ktcm, vec, 'f', BPMF::F);
ASSIGNKEY1(ktcm, vec, 'g', BPMF::G);
ASSIGNKEY1(ktcm, vec, 'h', BPMF::H);
ASSIGNKEY1(ktcm, vec, 'i', BPMF::EI);
ASSIGNKEY1(ktcm, vec, 'j', BPMF::J);
ASSIGNKEY1(ktcm, vec, 'k', BPMF::K);
ASSIGNKEY1(ktcm, vec, 'l', BPMF::L);
ASSIGNKEY1(ktcm, vec, 'm', BPMF::M);
ASSIGNKEY1(ktcm, vec, 'n', BPMF::N);
ASSIGNKEY1(ktcm, vec, 'o', BPMF::O);
ASSIGNKEY1(ktcm, vec, 'p', BPMF::P);
ASSIGNKEY1(ktcm, vec, 'q', BPMF::Q);
ASSIGNKEY1(ktcm, vec, 'r', BPMF::R);
ASSIGNKEY1(ktcm, vec, 's', BPMF::S);
ASSIGNKEY1(ktcm, vec, 't', BPMF::T);
ASSIGNKEY1(ktcm, vec, 'u', BPMF::OU);
ASSIGNKEY1(ktcm, vec, 'v', BPMF::UE);
ASSIGNKEY1(ktcm, vec, 'w', BPMF::U);
ASSIGNKEY1(ktcm, vec, 'x', BPMF::X);
ASSIGNKEY1(ktcm, vec, 'y', BPMF::I);
ASSIGNKEY1(ktcm, vec, 'z', BPMF::Z);
return new BopomofoKeyboardLayout(ktcm, "MiTAC");
}
static BopomofoKeyboardLayout* CreateETenLayout() { static BopomofoKeyboardLayout* CreateETenLayout() {
std::vector<BPMF::Component> vec; std::vector<BPMF::Component> vec;
BopomofoKeyToComponentMap ktcm; BopomofoKeyToComponentMap ktcm;
@ -1242,6 +1291,11 @@ const BopomofoKeyboardLayout* BopomofoKeyboardLayout::IBMLayout() {
return layout; return layout;
} }
const BopomofoKeyboardLayout* BopomofoKeyboardLayout::MiTACLayout() {
static BopomofoKeyboardLayout* layout = CreateMiTACLayout();
return layout;
}
const BopomofoKeyboardLayout* BopomofoKeyboardLayout::HanyuPinyinLayout() { const BopomofoKeyboardLayout* BopomofoKeyboardLayout::HanyuPinyinLayout() {
static BopomofoKeyboardLayout* layout = CreateHanyuPinyinLayout(); static BopomofoKeyboardLayout* layout = CreateHanyuPinyinLayout();
return layout; return layout;
@ -1249,3 +1303,4 @@ const BopomofoKeyboardLayout* BopomofoKeyboardLayout::HanyuPinyinLayout() {
} // namespace Mandarin } // namespace Mandarin
} // namespace Taiyan } // namespace Taiyan

View File

@ -29,7 +29,7 @@ namespace Taiyan {
namespace Mandarin { namespace Mandarin {
class BopomofoSyllable { class BopomofoSyllable {
public: public:
typedef uint16_t Component; typedef uint16_t Component;
explicit BopomofoSyllable(Component syllable = 0) : syllable_(syllable) {} explicit BopomofoSyllable(Component syllable = 0) : syllable_(syllable) {}
@ -116,9 +116,9 @@ class BopomofoSyllable {
const BopomofoSyllable operator+(const BopomofoSyllable& another) const { const BopomofoSyllable operator+(const BopomofoSyllable& another) const {
Component newSyllable = syllable_; Component newSyllable = syllable_;
#define OP_SOVER(mask) \ #define OP_SOVER(mask) \
if (another.syllable_ & mask) { \ if (another.syllable_ & mask) { \
newSyllable = (newSyllable & ~mask) | (another.syllable_ & mask); \ newSyllable = (newSyllable & ~mask) | (another.syllable_ & mask); \
} }
OP_SOVER(ConsonantMask); OP_SOVER(ConsonantMask);
OP_SOVER(MiddleVowelMask); OP_SOVER(MiddleVowelMask);
OP_SOVER(VowelMask); OP_SOVER(VowelMask);
@ -129,9 +129,9 @@ class BopomofoSyllable {
BopomofoSyllable& operator+=(const BopomofoSyllable& another) { BopomofoSyllable& operator+=(const BopomofoSyllable& another) {
#define OPE_SOVER(mask) \ #define OPE_SOVER(mask) \
if (another.syllable_ & mask) { \ if (another.syllable_ & mask) { \
syllable_ = (syllable_ & ~mask) | (another.syllable_ & mask); \ syllable_ = (syllable_ & ~mask) | (another.syllable_ & mask); \
} }
OPE_SOVER(ConsonantMask); OPE_SOVER(ConsonantMask);
OPE_SOVER(MiddleVowelMask); OPE_SOVER(MiddleVowelMask);
OPE_SOVER(VowelMask); OPE_SOVER(VowelMask);
@ -191,7 +191,7 @@ class BopomofoSyllable {
ENG = 0x0600, ERR = 0x0680, Tone1 = 0x0000, Tone2 = 0x0800, ENG = 0x0600, ERR = 0x0680, Tone1 = 0x0000, Tone2 = 0x0800,
Tone3 = 0x1000, Tone4 = 0x1800, Tone5 = 0x2000; Tone3 = 0x1000, Tone4 = 0x1800, Tone5 = 0x2000;
protected: protected:
Component syllable_; Component syllable_;
}; };
@ -207,12 +207,13 @@ typedef std::map<char, std::vector<BPMF::Component> > BopomofoKeyToComponentMap;
typedef std::map<BPMF::Component, char> BopomofoComponentToKeyMap; typedef std::map<BPMF::Component, char> BopomofoComponentToKeyMap;
class BopomofoKeyboardLayout { class BopomofoKeyboardLayout {
public: public:
static const BopomofoKeyboardLayout* StandardLayout(); static const BopomofoKeyboardLayout* StandardLayout();
static const BopomofoKeyboardLayout* ETenLayout(); static const BopomofoKeyboardLayout* ETenLayout();
static const BopomofoKeyboardLayout* HsuLayout(); static const BopomofoKeyboardLayout* HsuLayout();
static const BopomofoKeyboardLayout* ETen26Layout(); static const BopomofoKeyboardLayout* ETen26Layout();
static const BopomofoKeyboardLayout* IBMLayout(); static const BopomofoKeyboardLayout* IBMLayout();
static const BopomofoKeyboardLayout* MiTACLayout();
static const BopomofoKeyboardLayout* HanyuPinyinLayout(); static const BopomofoKeyboardLayout* HanyuPinyinLayout();
BopomofoKeyboardLayout(const BopomofoKeyToComponentMap& ktcm, BopomofoKeyboardLayout(const BopomofoKeyToComponentMap& ktcm,
@ -247,9 +248,9 @@ class BopomofoKeyboardLayout {
BPMF::Component c; BPMF::Component c;
char k; char k;
#define STKS_COMBINE(component) \ #define STKS_COMBINE(component) \
if ((c = component)) { \ if ((c = component)) { \
if ((k = componentToKey(c))) sequence += std::string(1, k); \ if ((k = componentToKey(c))) sequence += std::string(1, k); \
} }
STKS_COMBINE(syllable.consonantComponent()); STKS_COMBINE(syllable.consonantComponent());
STKS_COMBINE(syllable.middleVowelComponent()); STKS_COMBINE(syllable.middleVowelComponent());
STKS_COMBINE(syllable.vowelComponent()); STKS_COMBINE(syllable.vowelComponent());
@ -361,7 +362,7 @@ class BopomofoKeyboardLayout {
return syllable; return syllable;
} }
protected: protected:
bool endAheadOrAheadHasToneMarkKey(std::string::const_iterator ahead, bool endAheadOrAheadHasToneMarkKey(std::string::const_iterator ahead,
std::string::const_iterator end) const { std::string::const_iterator end) const {
if (ahead == end) return true; if (ahead == end) return true;
@ -398,7 +399,7 @@ class BopomofoKeyboardLayout {
}; };
class BopomofoReadingBuffer { class BopomofoReadingBuffer {
public: public:
explicit BopomofoReadingBuffer(const BopomofoKeyboardLayout* layout) explicit BopomofoReadingBuffer(const BopomofoKeyboardLayout* layout)
: layout_(layout), pinyin_mode_(false) { : layout_(layout), pinyin_mode_(false) {
if (layout == BopomofoKeyboardLayout::HanyuPinyinLayout()) { if (layout == BopomofoKeyboardLayout::HanyuPinyinLayout()) {
@ -494,8 +495,7 @@ class BopomofoReadingBuffer {
const BPMF syllable() const { return syllable_; } const BPMF syllable() const { return syllable_; }
const std::string standardLayoutQueryString() const { const std::string standardLayoutQueryString() const {
return BopomofoKeyboardLayout::StandardLayout()->keySequenceFromSyllable( return BopomofoKeyboardLayout::StandardLayout()->keySequenceFromSyllable(syllable_);
syllable_);
} }
const std::string absoluteOrderQueryString() const { const std::string absoluteOrderQueryString() const {
@ -504,7 +504,7 @@ class BopomofoReadingBuffer {
bool hasToneMarker() const { return syllable_.hasToneMarker(); } bool hasToneMarker() const { return syllable_.hasToneMarker(); }
protected: protected:
const BopomofoKeyboardLayout* layout_; const BopomofoKeyboardLayout* layout_;
BPMF syllable_; BPMF syllable_;

View File

@ -343,22 +343,38 @@ class InputState: NSObject {
super.init() super.init()
} }
@objc static let catCommonSymbols = String(format: NSLocalizedString("catCommonSymbols", comment: ""))
@objc static let catHoriBrackets = String(format: NSLocalizedString("catHoriBrackets", comment: ""))
@objc static let catVertBrackets = String(format: NSLocalizedString("catVertBrackets", comment: ""))
@objc static let catGreekLetters = String(format: NSLocalizedString("catGreekLetters", comment: ""))
@objc static let catMathSymbols = String(format: NSLocalizedString("catMathSymbols", comment: ""))
@objc static let catCurrencyUnits = String(format: NSLocalizedString("catCurrencyUnits", comment: ""))
@objc static let catSpecialSymbols = String(format: NSLocalizedString("catSpecialSymbols", comment: ""))
@objc static let catUnicodeSymbols = String(format: NSLocalizedString("catUnicodeSymbols", comment: ""))
@objc static let catCircledKanjis = String(format: NSLocalizedString("catCircledKanjis", comment: ""))
@objc static let catCircledKataKana = String(format: NSLocalizedString("catCircledKataKana", comment: ""))
@objc static let catBracketKanjis = String(format: NSLocalizedString("catBracketKanjis", comment: ""))
@objc static let catSingleTableLines = String(format: NSLocalizedString("catSingleTableLines", comment: ""))
@objc static let catDoubleTableLines = String(format: NSLocalizedString("catDoubleTableLines", comment: ""))
@objc static let catFillingBlocks = String(format: NSLocalizedString("catFillingBlocks", comment: ""))
@objc static let catLineSegments = String(format: NSLocalizedString("catLineSegments", comment: ""))
@objc static let root: SymbolNode = SymbolNode("/", [ @objc static let root: SymbolNode = SymbolNode("/", [
SymbolNode(""), SymbolNode(""),
SymbolNode("常用", symbols:",、。.?!;:‧‥﹐﹒˙·‘’“”〝〞‵′〃~$%@&#*"), SymbolNode(catCommonSymbols, symbols:",、。.?!;:‧‥﹐﹒˙·‘’“”〝〞‵′〃~$%@&#*"),
SymbolNode("橫括", symbols:"()「」〔〕{}〈〉『』《》【】﹙﹚﹝﹞﹛﹜"), SymbolNode(catHoriBrackets, symbols:"()「」〔〕{}〈〉『』《》【】﹙﹚﹝﹞﹛﹜"),
SymbolNode("縱括", symbols:"︵︶﹁﹂︹︺︷︸︿﹀﹃﹄︽︾︻︼"), SymbolNode(catVertBrackets, symbols:"︵︶﹁﹂︹︺︷︸︿﹀﹃﹄︽︾︻︼"),
SymbolNode("希臘", symbols:"αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ"), SymbolNode(catGreekLetters, symbols:"αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ"),
SymbolNode("數學", symbols:"+-×÷=≠≒∞±√<>﹤﹥≦≧∩∪ˇ⊥∠∟⊿㏒㏑∫∮∵∴╳﹢"), SymbolNode(catMathSymbols, symbols:"+-×÷=≠≒∞±√<>﹤﹥≦≧∩∪ˇ⊥∠∟⊿㏒㏑∫∮∵∴╳﹢"),
SymbolNode("貨幣", symbols:"$€¥¢£₽₨₩฿₺₮₱₭₴₦৲৳૱௹﷼₹₲₪₡₫៛₵₢₸₤₳₥₠₣₰₧₯₶₷"), SymbolNode(catCurrencyUnits, symbols:"$€¥¢£₽₨₩฿₺₮₱₭₴₦৲৳૱௹﷼₹₲₪₡₫៛₵₢₸₤₳₥₠₣₰₧₯₶₷"),
SymbolNode("特殊", symbols:"↑↓←→↖↗↙↘↺⇧⇩⇦⇨⇄⇆⇅⇵↻◎○●⊕⊙※△▲☆★◇◆□■▽▼§¥〒¢£♀♂↯"), SymbolNode(catSpecialSymbols, symbols:"↑↓←→↖↗↙↘↺⇧⇩⇦⇨⇄⇆⇅⇵↻◎○●⊕⊙※△▲☆★◇◆□■▽▼§¥〒¢£♀♂↯"),
SymbolNode("萬國", symbols:"♨☀☁☂☃♠♥♣♦♩♪♫♬☺☻"), SymbolNode(catUnicodeSymbols, symbols:"♨☀☁☂☃♠♥♣♦♩♪♫♬☺☻"),
SymbolNode("圈字", symbols:"㊟㊞㊚㊛㊊㊋㊌㊍㊎㊏㊐㊑㊒㊓㊔㊕㊖㊗︎㊘㊙︎㊜㊝㊠㊡㊢㊣㊤㊥㊦㊧㊨㊩㊪㊫㊬㊭㊮㊯㊰🈚︎🈯︎"), SymbolNode(catCircledKanjis, symbols:"㊟㊞㊚㊛㊊㊋㊌㊍㊎㊏㊐㊑㊒㊓㊔㊕㊖㊗︎㊘㊙︎㊜㊝㊠㊡㊢㊣㊤㊥㊦㊧㊨㊩㊪㊫㊬㊭㊮㊯㊰🈚︎🈯︎"),
SymbolNode("圈假", symbols:"㋐㋑㋒㋓㋔㋕㋖㋗㋘㋙㋚㋛㋜㋝㋞㋟㋠㋡㋢㋣㋤㋥㋦㋧㋨㋩㋪㋫㋬㋭㋮㋯㋰㋱㋲㋳㋴㋵㋶㋷㋸㋹㋺㋻㋼㋾"), SymbolNode(catCircledKataKana, symbols:"㋐㋑㋒㋓㋔㋕㋖㋗㋘㋙㋚㋛㋜㋝㋞㋟㋠㋡㋢㋣㋤㋥㋦㋧㋨㋩㋪㋫㋬㋭㋮㋯㋰㋱㋲㋳㋴㋵㋶㋷㋸㋹㋺㋻㋼㋾"),
SymbolNode("括字", symbols:"㈪㈫㈬㈭㈮㈯㈰㈱㈲㈳㈴㈵㈶㈷㈸㈹㈺㈻㈼㈽㈾㈿㉀㉁㉂㉃"), SymbolNode(catBracketKanjis, symbols:"㈪㈫㈬㈭㈮㈯㈰㈱㈲㈳㈴㈵㈶㈷㈸㈹㈺㈻㈼㈽㈾㈿㉀㉁㉂㉃"),
SymbolNode("單線", symbols:"├─┼┴┬┤┌┐╞═╪╡│▕└┘╭╮╰╯"), SymbolNode(catSingleTableLines, symbols:"├─┼┴┬┤┌┐╞═╪╡│▕└┘╭╮╰╯"),
SymbolNode("雙線", symbols:"╔╦╗╠═╬╣╓╥╖╒╤╕║╚╩╝╟╫╢╙╨╜╞╪╡╘╧╛"), SymbolNode(catDoubleTableLines, symbols:"╔╦╗╠═╬╣╓╥╖╒╤╕║╚╩╝╟╫╢╙╨╜╞╪╡╘╧╛"),
SymbolNode("填色", symbols:"_ˍ▁▂▃▄▅▆▇█▏▎▍▌▋▊▉◢◣◥◤"), SymbolNode(catFillingBlocks, symbols:"_ˍ▁▂▃▄▅▆▇█▏▎▍▌▋▊▉◢◣◥◤"),
SymbolNode("線段", symbols:"﹣﹦≡|∣∥–︱—︳╴¯ ̄﹉﹊﹍﹎﹋﹌﹏︴∕﹨╱╲/\"), SymbolNode(catLineSegments, symbols:"﹣﹦≡|∣∥–︱—︳╴¯ ̄﹉﹊﹍﹎﹋﹌﹏︴∕﹨╱╲/\"),
]) ])
} }

View File

@ -179,12 +179,15 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
case KeyboardLayoutEten26: case KeyboardLayoutEten26:
_bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::ETen26Layout()); _bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::ETen26Layout());
break; break;
case KeyboardLayoutHanyuPinyin:
_bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::HanyuPinyinLayout());
break;
case KeyboardLayoutIBM: case KeyboardLayoutIBM:
_bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::IBMLayout()); _bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::IBMLayout());
break; break;
case KeyboardLayoutMiTAC:
_bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::MiTACLayout());
break;
case KeyboardLayoutHanyuPinyin:
_bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::HanyuPinyinLayout());
break;
default: default:
_bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::StandardLayout()); _bpmfReadingBuffer->setKeyboardLayout(BopomofoKeyboardLayout::StandardLayout());
Preferences.keyboardLayout = KeyboardLayoutStandard; Preferences.keyboardLayout = KeyboardLayoutStandard;

View File

@ -154,8 +154,9 @@ struct ComposingBufferSize {
case eten = 1 case eten = 1
case hsu = 2 case hsu = 2
case eten26 = 3 case eten26 = 3
case hanyuPinyin = 4 case IBM = 4
case IBM = 5 case MiTAC = 5
case hanyuPinyin = 10
var name: String { var name: String {
switch (self) { switch (self) {
@ -167,10 +168,12 @@ struct ComposingBufferSize {
return "Hsu" return "Hsu"
case .eten26: case .eten26:
return "ETen26" return "ETen26"
case .hanyuPinyin:
return "HanyuPinyin"
case .IBM: case .IBM:
return "IBM" return "IBM"
case .MiTAC:
return "MiTAC"
case .hanyuPinyin:
return "HanyuPinyin"
} }
} }
} }
@ -381,7 +384,7 @@ struct ComposingBufferSize {
return useSCPCTypingMode return useSCPCTypingMode
} }
@UserDefault(key: kMaxCandidateLength, defaultValue: 10) @UserDefault(key: kMaxCandidateLength, defaultValue: kDefaultComposingBufferSize * 2)
@objc static var maxCandidateLength: Int @objc static var maxCandidateLength: Int
@UserDefault(key: kShouldNotFartInLieuOfBeep, defaultValue: true) @UserDefault(key: kShouldNotFartInLieuOfBeep, defaultValue: true)

View File

@ -47,3 +47,20 @@
"zh-Hant" = "Traditional Chinese"; "zh-Hant" = "Traditional Chinese";
"ja" = "Japanese"; "ja" = "Japanese";
"Apple Zhuyin Bopomofo" = "Apple Zhuyin Bopomofo"; "Apple Zhuyin Bopomofo" = "Apple Zhuyin Bopomofo";
// The followings are the category names used in the Symbol menu.
"catCommonSymbols" = "CommonSymbols";
"catHoriBrackets" = "HorizontalBrackets";
"catVertBrackets" = "VerticalBrackets";
"catGreekLetters" = "GreekLetters";
"catMathSymbols" = "MathSymbols";
"catCurrencyUnits" = "CurrencyUnits";
"catSpecialSymbols" = "SpecialSymbols";
"catUnicodeSymbols" = "UnicodeSymbols";
"catCircledKanjis" = "CircledKanjis";
"catCircledKataKana" = "CircledKataKana";
"catBracketKanjis" = "BracketKanjis";
"catSingleTableLines" = "SingleTableLines";
"catDoubleTableLines" = "DoubleTableLines";
"catFillingBlocks" = "FillingBlocks";
"catLineSegments" = "LineSegments";

View File

@ -47,3 +47,20 @@
"zh-Hant" = "Traditional Chinese"; "zh-Hant" = "Traditional Chinese";
"ja" = "Japanese"; "ja" = "Japanese";
"Apple Zhuyin Bopomofo" = "Apple Zhuyin Bopomofo"; "Apple Zhuyin Bopomofo" = "Apple Zhuyin Bopomofo";
// The followings are the category names used in the Symbol menu.
"catCommonSymbols" = "CommonSymbols";
"catHoriBrackets" = "HoriBrackets";
"catVertBrackets" = "VertBrackets";
"catGreekLetters" = "GreekLetters";
"catMathSymbols" = "MathSymbols";
"catCurrencyUnits" = "CurrencyUnits";
"catSpecialSymbols" = "SpecialSymbols";
"catUnicodeSymbols" = "UnicodeSymbols";
"catCircledKanjis" = "CircledKanjis";
"catCircledKataKana" = "CircledKataKana";
"catBracketKanjis" = "BracketKanjis";
"catSingleTableLines" = "SingleTableLines";
"catDoubleTableLines" = "DoubleTableLines";
"catFillingBlocks" = "FillingBlocks";
"catLineSegments" = "LineSegments";

View File

@ -47,3 +47,20 @@
"zh-Hant" = "繁體中国語"; "zh-Hant" = "繁體中国語";
"ja" = "和語"; "ja" = "和語";
"Apple Zhuyin Bopomofo" = "Apple 注音ボポモフォ配列"; "Apple Zhuyin Bopomofo" = "Apple 注音ボポモフォ配列";
// The followings are the category names used in the Symbol menu.
"catCommonSymbols" = "常用";
"catHoriBrackets" = "横括";
"catVertBrackets" = "縦括";
"catGreekLetters" = "ギリシャ";
"catMathSymbols" = "数学";
"catCurrencyUnits" = "貨幣";
"catSpecialSymbols" = "特殊";
"catUnicodeSymbols" = "Unicode";
"catCircledKanjis" = "丸付漢字";
"catCircledKataKana" = "丸付仮名";
"catBracketKanjis" = "括付漢字";
"catSingleTableLines" = "単線";
"catDoubleTableLines" = "双線";
"catFillingBlocks" = "ブロック";
"catLineSegments" = "線分";

View File

@ -47,3 +47,20 @@
"zh-Hant" = "繁体中文"; "zh-Hant" = "繁体中文";
"ja" = "和文"; "ja" = "和文";
"Apple Zhuyin Bopomofo" = "Apple 注音键盘布局"; "Apple Zhuyin Bopomofo" = "Apple 注音键盘布局";
// The followings are the category names used in the Symbol menu.
"catCommonSymbols" = "常用";
"catHoriBrackets" = "横括";
"catVertBrackets" = "纵括";
"catGreekLetters" = "希腊";
"catMathSymbols" = "数学";
"catCurrencyUnits" = "货币";
"catSpecialSymbols" = "特殊";
"catUnicodeSymbols" = "万国";
"catCircledKanjis" = "圈字";
"catCircledKataKana" = "圈假";
"catBracketKanjis" = "括字";
"catSingleTableLines" = "单线";
"catDoubleTableLines" = "双线";
"catFillingBlocks" = "填色";
"catLineSegments" = "线段";

View File

@ -47,3 +47,20 @@
"zh-Hant" = "繁體中文"; "zh-Hant" = "繁體中文";
"ja" = "和文"; "ja" = "和文";
"Apple Zhuyin Bopomofo" = "Apple 注音鍵盤佈局"; "Apple Zhuyin Bopomofo" = "Apple 注音鍵盤佈局";
// The followings are the category names used in the Symbol menu.
"catCommonSymbols" = "常用";
"catHoriBrackets" = "橫括";
"catVertBrackets" = "縱括";
"catGreekLetters" = "希臘";
"catMathSymbols" = "數學";
"catCurrencyUnits" = "貨幣";
"catSpecialSymbols" = "特殊";
"catUnicodeSymbols" = "萬國";
"catCircledKanjis" = "圈字";
"catCircledKataKana" = "圈假";
"catBracketKanjis" = "括字";
"catSingleTableLines" = "單線";
"catDoubleTableLines" = "雙線";
"catFillingBlocks" = "填色";
"catLineSegments" = "線段";

View File

@ -36,13 +36,12 @@ extension RangeReplaceableCollection where Element: Hashable {
@IBOutlet weak var uiLanguageButton: NSPopUpButton! @IBOutlet weak var uiLanguageButton: NSPopUpButton!
@IBOutlet weak var basisKeyboardLayoutButton: NSPopUpButton! @IBOutlet weak var basisKeyboardLayoutButton: NSPopUpButton!
@IBOutlet weak var selectionKeyComboBox: NSComboBox! @IBOutlet weak var selectionKeyComboBox: NSComboBox!
@IBOutlet weak var clickedWhetherIMEShouldNotFartToggle: NSButton!
var currentLanguageSelectItem: NSMenuItem? = nil var currentLanguageSelectItem: NSMenuItem? = nil
override func awakeFromNib() { override func awakeFromNib() {
let languages = ["auto", "en", "zh-Hans", "zh-Hant", "ja"] let languages = ["auto", "en", "zh-Hans", "zh-Hant", "ja"]
var autoSelectItem: NSMenuItem? = nil var autoMUISelectItem: NSMenuItem? = nil
var chosenLanguageItem: NSMenuItem? = nil var chosenLanguageItem: NSMenuItem? = nil
uiLanguageButton.menu?.removeAllItems() uiLanguageButton.menu?.removeAllItems()
@ -53,7 +52,7 @@ extension RangeReplaceableCollection where Element: Hashable {
menuItem.representedObject = language menuItem.representedObject = language
if language == "auto" { if language == "auto" {
autoSelectItem = menuItem autoMUISelectItem = menuItem
} }
if !appleLanguages.isEmpty { if !appleLanguages.isEmpty {
@ -64,12 +63,12 @@ extension RangeReplaceableCollection where Element: Hashable {
uiLanguageButton.menu?.addItem(menuItem) uiLanguageButton.menu?.addItem(menuItem)
} }
currentLanguageSelectItem = chosenLanguageItem ?? autoSelectItem currentLanguageSelectItem = chosenLanguageItem ?? autoMUISelectItem
uiLanguageButton.select(currentLanguageSelectItem) uiLanguageButton.select(currentLanguageSelectItem)
let list = TISCreateInputSourceList(nil, true).takeRetainedValue() as! [TISInputSource] let list = TISCreateInputSourceList(nil, true).takeRetainedValue() as! [TISInputSource]
var usKeyboardLayoutItem: NSMenuItem? = nil var usKeyboardLayoutItem: NSMenuItem? = nil
var chosenItem: NSMenuItem? = nil var chosenBaseKeyboardLayoutItem: NSMenuItem? = nil
basisKeyboardLayoutButton.menu?.removeAllItems() basisKeyboardLayoutButton.menu?.removeAllItems()
@ -128,7 +127,7 @@ extension RangeReplaceableCollection where Element: Hashable {
usKeyboardLayoutItem = menuItem usKeyboardLayoutItem = menuItem
} }
if basisKeyboardLayoutID == sourceID { if basisKeyboardLayoutID == sourceID {
chosenItem = menuItem chosenBaseKeyboardLayoutItem = menuItem
} }
basisKeyboardLayoutButton.menu?.addItem(menuItem) basisKeyboardLayoutButton.menu?.addItem(menuItem)
} }
@ -137,8 +136,8 @@ extension RangeReplaceableCollection where Element: Hashable {
menuItem.title = String(format: NSLocalizedString("Apple Zhuyin Bopomofo", comment: "")) menuItem.title = String(format: NSLocalizedString("Apple Zhuyin Bopomofo", comment: ""))
menuItem.representedObject = String("com.apple.keylayout.ZhuyinBopomofo") menuItem.representedObject = String("com.apple.keylayout.ZhuyinBopomofo")
basisKeyboardLayoutButton.menu?.addItem(menuItem) basisKeyboardLayoutButton.menu?.addItem(menuItem)
basisKeyboardLayoutButton.select(chosenBaseKeyboardLayoutItem ?? usKeyboardLayoutItem)
basisKeyboardLayoutButton.select(chosenItem ?? usKeyboardLayoutItem)
selectionKeyComboBox.usesDataSource = false selectionKeyComboBox.usesDataSource = false
selectionKeyComboBox.removeAllItems() selectionKeyComboBox.removeAllItems()
selectionKeyComboBox.addItems(withObjectValues: Preferences.suggestedCandidateKeys) selectionKeyComboBox.addItems(withObjectValues: Preferences.suggestedCandidateKeys)

View File

@ -262,7 +262,7 @@
<font key="font" metaFont="cellTitle"/> <font key="font" metaFont="cellTitle"/>
</buttonCell> </buttonCell>
<connections> <connections>
<action selector="clickedWhetherIMEShouldNotFartToggleAction:" target="-1" id="bUl-EZ-USn"/> <action selector="clickedWhetherIMEShouldNotFartToggleAction:" target="-2" id="9h1-f6-SGF"/>
<binding destination="32" name="value" keyPath="values.ShouldNotFartInLieuOfBeep" id="EOH-Pc-8Hk"/> <binding destination="32" name="value" keyPath="values.ShouldNotFartInLieuOfBeep" id="EOH-Pc-8Hk"/>
</connections> </connections>
</button> </button>
@ -594,8 +594,9 @@
<menuItem title="ETen" tag="1" id="7"/> <menuItem title="ETen" tag="1" id="7"/>
<menuItem title="Hsu" tag="2" id="8"/> <menuItem title="Hsu" tag="2" id="8"/>
<menuItem title="ETen26" tag="3" id="9"/> <menuItem title="ETen26" tag="3" id="9"/>
<menuItem title="IBM" tag="5" id="137"/> <menuItem title="IBM" tag="4" id="137"/>
<menuItem title="Hanyu Pinyin" tag="4" id="10"/> <menuItem title="MiTAC" tag="5" id="7fV-x8-WHQ"/>
<menuItem title="Hanyu Pinyin" tag="10" id="10"/>
</items> </items>
</menu> </menu>
<connections> <connections>

View File

@ -89,6 +89,9 @@
/* Class = "NSMenuItem"; title = "IBM"; ObjectID = "137"; */ /* Class = "NSMenuItem"; title = "IBM"; ObjectID = "137"; */
"137.title" = "IBM"; "137.title" = "IBM";
/* Class = "NSMenuItem"; title = "MiTAC"; ObjectID = "7fV-x8-WHQ"; */
"7fV-x8-WHQ.title" = "MiTAC";
/* Class = "NSTabViewItem"; label = "Keyboard"; ObjectID = "1AW-xf-c2f"; */ /* Class = "NSTabViewItem"; label = "Keyboard"; ObjectID = "1AW-xf-c2f"; */
"1AW-xf-c2f.label" = "Keyboard"; "1AW-xf-c2f.label" = "Keyboard";

View File

@ -89,6 +89,9 @@
/* Class = "NSMenuItem"; title = "IBM"; ObjectID = "137"; */ /* Class = "NSMenuItem"; title = "IBM"; ObjectID = "137"; */
"137.title" = "IBM"; "137.title" = "IBM";
/* Class = "NSMenuItem"; title = "MiTAC"; ObjectID = "7fV-x8-WHQ"; */
"7fV-x8-WHQ.title" = "神通";
/* Class = "NSTabViewItem"; label = "Keyboard"; ObjectID = "1AW-xf-c2f"; */ /* Class = "NSTabViewItem"; label = "Keyboard"; ObjectID = "1AW-xf-c2f"; */
"1AW-xf-c2f.label" = "キーボード"; "1AW-xf-c2f.label" = "キーボード";

View File

@ -89,6 +89,9 @@
/* Class = "NSMenuItem"; title = "IBM"; ObjectID = "137"; */ /* Class = "NSMenuItem"; title = "IBM"; ObjectID = "137"; */
"137.title" = "IBM"; "137.title" = "IBM";
/* Class = "NSMenuItem"; title = "MiTAC"; ObjectID = "7fV-x8-WHQ"; */
"7fV-x8-WHQ.title" = "神通";
/* Class = "NSTabViewItem"; label = "Keyboard"; ObjectID = "1AW-xf-c2f"; */ /* Class = "NSTabViewItem"; label = "Keyboard"; ObjectID = "1AW-xf-c2f"; */
"1AW-xf-c2f.label" = "键盘"; "1AW-xf-c2f.label" = "键盘";

View File

@ -89,6 +89,9 @@
/* Class = "NSMenuItem"; title = "IBM"; ObjectID = "137"; */ /* Class = "NSMenuItem"; title = "IBM"; ObjectID = "137"; */
"137.title" = "IBM"; "137.title" = "IBM";
/* Class = "NSMenuItem"; title = "MiTAC"; ObjectID = "7fV-x8-WHQ"; */
"7fV-x8-WHQ.title" = "神通";
/* Class = "NSTabViewItem"; label = "Keyboard"; ObjectID = "1AW-xf-c2f"; */ /* Class = "NSTabViewItem"; label = "Keyboard"; ObjectID = "1AW-xf-c2f"; */
"1AW-xf-c2f.label" = "鍵盤"; "1AW-xf-c2f.label" = "鍵盤";

View File

@ -780,7 +780,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 1320; LastSwiftUpdateCheck = 1320;
LastUpgradeCheck = 1310; LastUpgradeCheck = 1320;
TargetAttributes = { TargetAttributes = {
5BD05BB727B2A429004C4F1D = { 5BD05BB727B2A429004C4F1D = {
CreatedOnToolsVersion = 13.2; CreatedOnToolsVersion = 13.2;
@ -1136,6 +1136,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = vChewingPhraseEditor/vChewingPhraseEditor.entitlements; CODE_SIGN_ENTITLEMENTS = vChewingPhraseEditor/vChewingPhraseEditor.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
@ -1190,6 +1191,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = vChewingPhraseEditor/vChewingPhraseEditor.entitlements; CODE_SIGN_ENTITLEMENTS = vChewingPhraseEditor/vChewingPhraseEditor.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;