Repo // Turn currentLM and currentUOM into dynamic var.
This commit is contained in:
parent
60b3fcf625
commit
9e857b80d4
|
@ -27,7 +27,7 @@ public enum LMMgr {
|
||||||
public private(set) static var uomCHT = vChewingLM.LMUserOverride(
|
public private(set) static var uomCHT = vChewingLM.LMUserOverride(
|
||||||
dataURL: Self.userOverrideModelDataURL(.imeModeCHT))
|
dataURL: Self.userOverrideModelDataURL(.imeModeCHT))
|
||||||
|
|
||||||
public static func currentLM() -> vChewingLM.LMInstantiator {
|
public static var currentLM: vChewingLM.LMInstantiator {
|
||||||
switch IMEApp.currentInputMode {
|
switch IMEApp.currentInputMode {
|
||||||
case .imeModeCHS:
|
case .imeModeCHS:
|
||||||
return Self.lmCHS
|
return Self.lmCHS
|
||||||
|
@ -38,7 +38,7 @@ public enum LMMgr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func currentUOM() -> vChewingLM.LMUserOverride {
|
public static var currentUOM: vChewingLM.LMUserOverride {
|
||||||
switch IMEApp.currentInputMode {
|
switch IMEApp.currentInputMode {
|
||||||
case .imeModeCHS:
|
case .imeModeCHS:
|
||||||
return Self.uomCHS
|
return Self.uomCHS
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class SessionCtl: IMKInputController {
|
||||||
|
|
||||||
/// 輸入調度模組的副本。
|
/// 輸入調度模組的副本。
|
||||||
var inputHandler: InputHandlerProtocol = InputHandler(
|
var inputHandler: InputHandlerProtocol = InputHandler(
|
||||||
lm: LMMgr.currentLM(), uom: LMMgr.currentUOM(), pref: PrefMgr.shared
|
lm: LMMgr.currentLM, uom: LMMgr.currentUOM, pref: PrefMgr.shared
|
||||||
)
|
)
|
||||||
/// 用以記錄當前輸入法狀態的變數。
|
/// 用以記錄當前輸入法狀態的變數。
|
||||||
public var state: IMEStateProtocol = IMEState.ofEmpty() {
|
public var state: IMEStateProtocol = IMEState.ofEmpty() {
|
||||||
|
@ -110,8 +110,8 @@ public class SessionCtl: IMKInputController {
|
||||||
inputHandler.clear() // 這句不要砍,因為後面 handle State.Empty() 不一定執行。
|
inputHandler.clear() // 這句不要砍,因為後面 handle State.Empty() 不一定執行。
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
/// 重設所有語言模組。這裡不需要做按需重設,因為對運算量沒有影響。
|
/// 重設所有語言模組。這裡不需要做按需重設,因為對運算量沒有影響。
|
||||||
inputHandler.currentLM = LMMgr.currentLM() // 會自動更新組字引擎內的模組。
|
inputHandler.currentLM = LMMgr.currentLM // 會自動更新組字引擎內的模組。
|
||||||
inputHandler.currentUOM = LMMgr.currentUOM()
|
inputHandler.currentUOM = LMMgr.currentUOM
|
||||||
/// 清空注拼槽+同步最新的注拼槽排列設定。
|
/// 清空注拼槽+同步最新的注拼槽排列設定。
|
||||||
inputHandler.ensureKeyboardParser()
|
inputHandler.ensureKeyboardParser()
|
||||||
/// 將輸入法偏好設定同步至語言模組內。
|
/// 將輸入法偏好設定同步至語言模組內。
|
||||||
|
@ -241,12 +241,12 @@ extension SessionCtl {
|
||||||
|
|
||||||
/// 將輸入法偏好設定同步至語言模組內。
|
/// 將輸入法偏好設定同步至語言模組內。
|
||||||
public func syncBaseLMPrefs() {
|
public func syncBaseLMPrefs() {
|
||||||
LMMgr.currentLM().isPhraseReplacementEnabled = PrefMgr.shared.phraseReplacementEnabled
|
LMMgr.currentLM.isPhraseReplacementEnabled = PrefMgr.shared.phraseReplacementEnabled
|
||||||
LMMgr.currentLM().isCNSEnabled = PrefMgr.shared.cns11643Enabled
|
LMMgr.currentLM.isCNSEnabled = PrefMgr.shared.cns11643Enabled
|
||||||
LMMgr.currentLM().isSymbolEnabled = PrefMgr.shared.symbolInputEnabled
|
LMMgr.currentLM.isSymbolEnabled = PrefMgr.shared.symbolInputEnabled
|
||||||
LMMgr.currentLM().isSCPCEnabled = PrefMgr.shared.useSCPCTypingMode
|
LMMgr.currentLM.isSCPCEnabled = PrefMgr.shared.useSCPCTypingMode
|
||||||
LMMgr.currentLM().isCassetteEnabled = PrefMgr.shared.cassetteEnabled
|
LMMgr.currentLM.isCassetteEnabled = PrefMgr.shared.cassetteEnabled
|
||||||
LMMgr.currentLM().deltaOfCalendarYears = PrefMgr.shared.deltaOfCalendarYears
|
LMMgr.currentLM.deltaOfCalendarYears = PrefMgr.shared.deltaOfCalendarYears
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ extension SessionCtl {
|
||||||
? NSLocalizedString("NotificationSwitchON", comment: "")
|
? NSLocalizedString("NotificationSwitchON", comment: "")
|
||||||
: NSLocalizedString("NotificationSwitchOFF", comment: ""))
|
: NSLocalizedString("NotificationSwitchOFF", comment: ""))
|
||||||
)
|
)
|
||||||
if !LMMgr.currentLM().currentCassette.isLoaded {
|
if !LMMgr.currentLM.currentCassette.isLoaded {
|
||||||
LMMgr.loadCassetteData()
|
LMMgr.loadCassetteData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue