diff --git a/Source/UI/PrefUI/suiPrefPaneDangerZone.swift b/Source/UI/PrefUI/suiPrefPaneDangerZone.swift index b9622194..45965ca7 100644 --- a/Source/UI/PrefUI/suiPrefPaneDangerZone.swift +++ b/Source/UI/PrefUI/suiPrefPaneDangerZone.swift @@ -50,8 +50,12 @@ struct suiPrefPaneDangerZone: View { mgrPrefs.handleDefaultCandidateFontsByLangIdentifier = selHandleDefaultCandidateFontsByLangIdentifier } ) - Text(LocalizedStringKey("This only works since macOS 12 with non-IMK candidate window as an alternative wordaround of Apple Bug Report #FB10978412. Apple should patch that for macOS 11 and later.")) - .preferenceDescription().fixedSize(horizontal: false, vertical: true) + Text( + LocalizedStringKey( + "This only works since macOS 12 with non-IMK candidate window as an alternative wordaround of Apple Bug Report #FB10978412. Apple should patch that for macOS 11 and later." + ) + ) + .preferenceDescription().fixedSize(horizontal: false, vertical: true) } } } diff --git a/Source/WindowControllers/ctlPrefWindow.swift b/Source/WindowControllers/ctlPrefWindow.swift index fe1d8d14..ef930057 100644 --- a/Source/WindowControllers/ctlPrefWindow.swift +++ b/Source/WindowControllers/ctlPrefWindow.swift @@ -18,6 +18,7 @@ extension NSToolbarItem.Identifier { fileprivate static let ofExperience = NSToolbarItem.Identifier(rawValue: "tabExperience") fileprivate static let ofDictionary = NSToolbarItem.Identifier(rawValue: "tabDictionary") fileprivate static let ofKeyboard = NSToolbarItem.Identifier(rawValue: "tabKeyboard") + fileprivate static let ofDangerZone = NSToolbarItem.Identifier(rawValue: "tabDangerZone") } // Please note that the class should be exposed using the same class name @@ -32,11 +33,13 @@ class ctlPrefWindow: NSWindowController { @IBOutlet var chkTrad2KangXi: NSButton! @IBOutlet var chkTrad2JISShinjitai: NSButton! @IBOutlet var lblCurrentlySpecifiedUserDataFolder: NSTextFieldCell! + @IBOutlet var tglControlDangerZoneIMKCandidate: NSButton! @IBOutlet var vwrGeneral: NSView! @IBOutlet var vwrExperience: NSView! @IBOutlet var vwrDictionary: NSView! @IBOutlet var vwrKeyboard: NSView! + @IBOutlet var vwrDangerZone: NSView! var currentLanguageSelectItem: NSMenuItem? @@ -236,6 +239,10 @@ class ctlPrefWindow: NSWindowController { } } + @IBAction func updateIMKCandidateEnableStatusAction(_: Any) { + NSApplication.shared.terminate(nil) + } + @IBAction func clickedWhetherIMEShouldNotFartToggleAction(_: Any) { clsSFX.beep() } @@ -329,15 +336,15 @@ extension ctlPrefWindow: NSToolbarDelegate { } func toolbarDefaultItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] { - [.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard] + [.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard, .ofDangerZone] } func toolbarAllowedItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] { - [.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard] + [.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard, .ofDangerZone] } func toolbarSelectableItemIdentifiers(_: NSToolbar) -> [NSToolbarItem.Identifier] { - [.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard] + [.ofGeneral, .ofExperience, .ofDictionary, .ofKeyboard, .ofDangerZone] } @objc func showGeneralView(_: Any?) { @@ -360,6 +367,11 @@ extension ctlPrefWindow: NSToolbarDelegate { window?.toolbar?.selectedItemIdentifier = .ofKeyboard } + @objc func showDangerZOneView(_: Any?) { + use(view: vwrDangerZone) + window?.toolbar?.selectedItemIdentifier = .ofDangerZone + } + func toolbar( _: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar _: Bool @@ -413,6 +425,18 @@ extension ctlPrefWindow: NSToolbarDelegate { } item.action = #selector(showKeyboardView(_:)) + case .ofDangerZone: + let title = NSLocalizedString("DangerZone", comment: "") + item.label = title + if #available(macOS 11.0, *) { + item.image = NSImage( + systemSymbolName: "hand.raised.circle", accessibilityDescription: "DangerZone Preferences" + ) + } else { + item.image = NSImage(named: "PrefToolbar-DangerZone") + } + item.action = #selector(showDangerZOneView(_:)) + default: return nil } diff --git a/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib b/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib index b9b3661b..ca62144d 100644 --- a/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib +++ b/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib @@ -14,7 +14,9 @@ + + @@ -1054,5 +1056,92 @@ + + + + + + + + + Warning: This page is for testing future features. +Features listed here may not work as expected. + + + + + + + + + + + + + + + + + + + + + + + + + This only works since macOS 12 with non-IMK candidate window as an alternative wordaround of Apple Bug Report #FB10978412. Apple should patch that for macOS 11 and later. + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/WindowNIBs/en.lproj/frmPrefWindow.strings b/Source/WindowNIBs/en.lproj/frmPrefWindow.strings index ffdd4664..7cbe385e 100644 --- a/Source/WindowNIBs/en.lproj/frmPrefWindow.strings +++ b/Source/WindowNIBs/en.lproj/frmPrefWindow.strings @@ -102,3 +102,8 @@ "XqL-rf-X6d.title" = "Space to +cycle pages, Shift+Space to +cycle candidates"; "xrE-8T-WKO.label" = "Advanced"; "ZEv-Q2-mYL.title" = "Change user interface language (will reboot the IME)."; +"lblDangerZoneTitleDescription.title" = "Warning: This page is for testing future features. \nFeatures listed here may not work as expected."; +"tglDangerZoneIMKCandidate.title" = "Use IMK Candidate Window instead (will reboot the IME)"; +"lblDangerZoneIMKCandidate.title" = "Candidate selection keys are not yet available in IMK candidate window."; +"tglDangerZoneCandidateFont.title" = "Use .langIdentifier to handle UI font in candidate window"; +"lblDangerZoneCandidateFont.title" = "This only works since macOS 12 with non-IMK candidate window as an alternative wordaround of Apple Bug Report #FB10978412. Apple should patch that for macOS 11 and later."; diff --git a/Source/WindowNIBs/ja.lproj/frmPrefWindow.strings b/Source/WindowNIBs/ja.lproj/frmPrefWindow.strings index 6246c14b..c6a77218 100644 --- a/Source/WindowNIBs/ja.lproj/frmPrefWindow.strings +++ b/Source/WindowNIBs/ja.lproj/frmPrefWindow.strings @@ -102,3 +102,8 @@ "XqL-rf-X6d.title" = "Space で次のページ、Shift+Space で次の候補文字を"; "xrE-8T-WKO.label" = "詳細"; "ZEv-Q2-mYL.title" = "アプリ表示用言語をご指定ください、そして入力アプリは自動的に再起動。"; +"lblDangerZoneTitleDescription.title" = "警告:これからの新機能テストのために作ったページですから、\nここで陳列されている諸機能は予想通り動けるだと思わないでください。"; +"tglDangerZoneIMKCandidate.title" = "IMK 候補陳列ウィンドウを起用(入力アプリは自動的に再起動)"; +"lblDangerZoneIMKCandidate.title" = "IMK 候補陳列ウィンドウで言選り用キーは現時点で利用不可。"; +"tglDangerZoneCandidateFont.title" = "「.langIdentifier」を使って候補陳列ウィンドウのフォントを取り扱う"; +"lblDangerZoneCandidateFont.title" = "これは Apple Bug Report #FB10978412 の臨時対策であり、macOS 12 からの macOS に効き、IMK 以外の候補陳列ウィンドウに作用する。Apple は macOS 11 からの macOS のために該当 Bug を修復すべきである。"; diff --git a/Source/WindowNIBs/zh-Hans.lproj/frmPrefWindow.strings b/Source/WindowNIBs/zh-Hans.lproj/frmPrefWindow.strings index 0653a16e..dba709be 100644 --- a/Source/WindowNIBs/zh-Hans.lproj/frmPrefWindow.strings +++ b/Source/WindowNIBs/zh-Hans.lproj/frmPrefWindow.strings @@ -102,3 +102,8 @@ "XqL-rf-X6d.title" = "Space 换下一页,Shift+Space 换选下一个候选字。"; "xrE-8T-WKO.label" = "进阶"; "ZEv-Q2-mYL.title" = "变更使用者界面语言,会自动重新启动输入法。"; +"lblDangerZoneTitleDescription.title" = "警告:该页面仅作未来功能测试所用。\n在此列出的功能并非处于完全可用之状态。"; +"tglDangerZoneIMKCandidate.title" = "启用 IMK 选字窗(会自动重启输入法)"; +"lblDangerZoneIMKCandidate.title" = "IMK 选字窗目前暂时无法正常使用选字键。"; +"tglDangerZoneCandidateFont.title" = "使用 .langIdentifier 来管理选字窗的预设介面字型"; +"lblDangerZoneCandidateFont.title" = "该方法是 Apple Bug Report #FB10978412 的保守治疗方案,用来仅针对 macOS 12 开始的系统,且仅对非 IMK 选字窗起作用。Apple 应该对 macOS 11 开始的系统修复这个 Bug。"; diff --git a/Source/WindowNIBs/zh-Hant.lproj/frmPrefWindow.strings b/Source/WindowNIBs/zh-Hant.lproj/frmPrefWindow.strings index 31fca5da..c0018f65 100644 --- a/Source/WindowNIBs/zh-Hant.lproj/frmPrefWindow.strings +++ b/Source/WindowNIBs/zh-Hant.lproj/frmPrefWindow.strings @@ -102,3 +102,8 @@ "XqL-rf-X6d.title" = "Space 換下一頁,Shift+Space 換選下一個候選字"; "xrE-8T-WKO.label" = "進階"; "ZEv-Q2-mYL.title" = "變更使用者介面語言,會自動重新啟動輸入法。"; +"lblDangerZoneTitleDescription.title" = "警告:該頁面僅作未來功能測試所用。\n在此列出的功能並非處於完全可用之狀態。"; +"tglDangerZoneIMKCandidate.title" = "啟用 IMK 選字窗(會自動重啟輸入法)"; +"lblDangerZoneIMKCandidate.title" = "IMK 選字窗目前暫時無法正常使用選字鍵。"; +"tglDangerZoneCandidateFont.title" = "使用 .langIdentifier 來管理選字窗的預設介面字型"; +"lblDangerZoneCandidateFont.title" = "該方法是 Apple Bug Report #FB10978412 的保守治療方案,用來僅針對 macOS 12 開始的系統,且僅對非 IMK 選字窗起作用。Apple 應該對 macOS 11 開始的系統修復這個 Bug。";