CtlPrefWindow // Conditionally force-reload phrase editor on show().

This commit is contained in:
ShikiSuen 2022-12-16 10:03:16 +08:00
parent e15b778ffe
commit 6734bc49c5
1 changed files with 2 additions and 0 deletions

View File

@ -66,6 +66,7 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
public static var shared: CtlPrefWindow?
static func show() {
let resetPhraseEditor: Bool = shared?.window == nil || !(shared?.window?.isVisible ?? false) || shared == nil
if shared == nil { shared = CtlPrefWindow(windowNibName: "frmPrefWindow") }
guard let shared = shared, let sharedWindow = shared.window else { return }
sharedWindow.delegate = shared
@ -74,6 +75,7 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
sharedWindow.level = .statusBar
sharedWindow.titlebarAppearsTransparent = true
shared.showWindow(shared)
if resetPhraseEditor { shared.initPhraseEditor() }
NSApp.activate(ignoringOtherApps: true)
}