CtlPrefWindow // Conditionally force-reload phrase editor on show().
This commit is contained in:
parent
e15b778ffe
commit
6734bc49c5
|
@ -66,6 +66,7 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
|
||||||
public static var shared: CtlPrefWindow?
|
public static var shared: CtlPrefWindow?
|
||||||
|
|
||||||
static func show() {
|
static func show() {
|
||||||
|
let resetPhraseEditor: Bool = shared?.window == nil || !(shared?.window?.isVisible ?? false) || shared == nil
|
||||||
if shared == nil { shared = CtlPrefWindow(windowNibName: "frmPrefWindow") }
|
if shared == nil { shared = CtlPrefWindow(windowNibName: "frmPrefWindow") }
|
||||||
guard let shared = shared, let sharedWindow = shared.window else { return }
|
guard let shared = shared, let sharedWindow = shared.window else { return }
|
||||||
sharedWindow.delegate = shared
|
sharedWindow.delegate = shared
|
||||||
|
@ -74,6 +75,7 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
|
||||||
sharedWindow.level = .statusBar
|
sharedWindow.level = .statusBar
|
||||||
sharedWindow.titlebarAppearsTransparent = true
|
sharedWindow.titlebarAppearsTransparent = true
|
||||||
shared.showWindow(shared)
|
shared.showWindow(shared)
|
||||||
|
if resetPhraseEditor { shared.initPhraseEditor() }
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue