Repo // Allow hot-toggling IMKCandidates.

This commit is contained in:
ShikiSuen 2023-06-10 17:37:30 +08:00
parent af715ad8d8
commit ffd7db4bca
7 changed files with 25 additions and 15 deletions

View File

@ -29,8 +29,25 @@ public class SessionCtl: IMKInputController {
///
public static var areWeNerfing = false
// IMK
private var candidateIMK: CtlCandidateProtocol?
//
private var candidateTDK: CtlCandidateProtocol?
///
public var candidateUI: CtlCandidateProtocol?
public var candidateUI: CtlCandidateProtocol? {
get {
PrefMgr.shared.useIMKCandidateWindow ? candidateIMK : candidateTDK
}
set {
if PrefMgr.shared.useIMKCandidateWindow {
candidateIMK = newValue
} else {
candidateTDK = newValue
}
}
}
///
public var tooltipInstance = TooltipUI()

View File

@ -166,15 +166,8 @@ struct VwrPrefPaneCandidates: View {
SSPreferences.Settings.Section(title: "Experimental:".localized) {
Toggle(
LocalizedStringKey("Use IMK Candidate Window instead of Tadokoro"),
isOn: $useIMKCandidateWindow.onChange {
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
NSApp.terminate(nil)
}
isOn: $useIMKCandidateWindow
)
Text(
LocalizedStringKey("⚠︎ This will reboot the vChewing IME.")
)
.preferenceDescription(maxWidth: CtlPrefUIShared.maxDescriptionWidth)
Text(
"IMK candidate window relies on certain Apple private APIs which are force-exposed by using bridging headers. Its usability, at this moment, is only guaranteed from macOS 10.14 Mojave to macOS 13 Ventura. Further tests are required in the future in order to tell whether it is usable in newer macOS releases.".localized
)

View File

@ -260,8 +260,8 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
}
@IBAction func updateIMKCandidateEnableStatusAction(_: Any) {
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
NSApp.terminate(nil)
// NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
// NSApp.terminate(nil)
}
@IBAction func clickedWhetherIMEShouldNotFartToggleAction(_: Any) {

View File

@ -113,7 +113,7 @@
"s7u-Fm-dVg.title" = "Revolving Pages";
"shc-Nu-UsM.title" = "Show notifications when toggling Caps Lock";
"SzF-FL-sVO.title" = "Show translated strokes in composition buffer";
"tglDevZoneIMKCandidate.title" = "Use IMK Candidate Window instead of Tadokoro (will reboot the IME)";
"tglDevZoneIMKCandidate.title" = "Use IMK Candidate Window instead of Tadokoro";
"tglTrimUnfinishedReadingsOnCommit.title" = "Trim unfinished readings / strokes on commit";
"TKl-TY-lvN.title" = "General Settings";
"TXr-FF-ehw.title" = "Traditional Chinese";

View File

@ -113,7 +113,7 @@
"s7u-Fm-dVg.title" = "ページ";
"shc-Nu-UsM.title" = "Caps Lock で切り替えの時に吹出通知メッセージを";
"SzF-FL-sVO.title" = "原始キーネームでなく、筆画を入力緩衝列で表示する";
"tglDevZoneIMKCandidate.title" = "IMK 候補陳列ウィンドウを起用(入力アプリは自動的に再起動)";
"tglDevZoneIMKCandidate.title" = "IMK 候補陳列ウィンドウを起用";
"tglTrimUnfinishedReadingsOnCommit.title" = "送り出す緩衝列内容から未完成な音読み/筆組みを除く";
"TKl-TY-lvN.title" = "一般設定";
"TXr-FF-ehw.title" = "繁体中国語";

View File

@ -113,7 +113,7 @@
"s7u-Fm-dVg.title" = "轮替页面";
"shc-Nu-UsM.title" = "以 Caps Lock 切换输入法/中英模式时显示通知";
"SzF-FL-sVO.title" = "在组字区内显示字根、而非原始键盘码";
"tglDevZoneIMKCandidate.title" = "启用与 macOS 内建输入法相同的 IMK 选字窗(会自动重启输入法)";
"tglDevZoneIMKCandidate.title" = "启用与 macOS 内建输入法相同的 IMK 选字窗";
"tglTrimUnfinishedReadingsOnCommit.title" = "在递交时清理未完成拼写的读音或字根";
"TKl-TY-lvN.title" = "一般设定";
"TXr-FF-ehw.title" = "繁体中文";

View File

@ -113,7 +113,7 @@
"s7u-Fm-dVg.title" = "輪替頁面";
"shc-Nu-UsM.title" = "以 Caps Lock 切換輸入法/中英模式時顯示通知";
"SzF-FL-sVO.title" = "在組字區內顯示字根、而非原始鍵盤碼";
"tglDevZoneIMKCandidate.title" = "啟用與 macOS 內建輸入法相同的 IMK 選字窗(會自動重啟輸入法)";
"tglDevZoneIMKCandidate.title" = "啟用與 macOS 內建輸入法相同的 IMK 選字窗";
"tglTrimUnfinishedReadingsOnCommit.title" = "在遞交時清理未完成拼寫的讀音或字根";
"TKl-TY-lvN.title" = "一般設定";
"TXr-FF-ehw.title" = "繁體中文";