PhraseEditor // Release some memory when it gets disappeared.
This commit is contained in:
parent
ac6b53b3ec
commit
d2107f847a
|
@ -297,6 +297,8 @@ public struct VwrPhraseEditorUI: View {
|
||||||
selInputMode = .imeModeNULL
|
selInputMode = .imeModeNULL
|
||||||
selUserDataType = .thePhrases
|
selUserDataType = .thePhrases
|
||||||
txtContent = NSLocalizedString("Please select Simplified / Traditional Chinese mode above.", comment: "")
|
txtContent = NSLocalizedString("Please select Simplified / Traditional Chinese mode above.", comment: "")
|
||||||
|
isLoading = true
|
||||||
|
Self.txtContentStorage = ""
|
||||||
}.onAppear {
|
}.onAppear {
|
||||||
guard let delegate = delegate else { return }
|
guard let delegate = delegate else { return }
|
||||||
selInputMode = delegate.currentInputMode
|
selInputMode = delegate.currentInputMode
|
||||||
|
|
|
@ -28,7 +28,7 @@ extension NSToolbarItem.Identifier {
|
||||||
// only works with macOS System Preference pane (like macOS built-in input methods).
|
// only works with macOS System Preference pane (like macOS built-in input methods).
|
||||||
// It should be set as "Preferences" which correspondes to the "Preference" pref pane
|
// It should be set as "Preferences" which correspondes to the "Preference" pref pane
|
||||||
// of this build target.
|
// of this build target.
|
||||||
class CtlPrefWindow: NSWindowController {
|
class CtlPrefWindow: NSWindowController, NSWindowDelegate {
|
||||||
@IBOutlet var fontSizePopUpButton: NSPopUpButton!
|
@IBOutlet var fontSizePopUpButton: NSPopUpButton!
|
||||||
@IBOutlet var uiLanguageButton: NSPopUpButton!
|
@IBOutlet var uiLanguageButton: NSPopUpButton!
|
||||||
@IBOutlet var basicKeyboardLayoutButton: NSPopUpButton!
|
@IBOutlet var basicKeyboardLayoutButton: NSPopUpButton!
|
||||||
|
@ -66,8 +66,9 @@ class CtlPrefWindow: NSWindowController {
|
||||||
public static var shared: CtlPrefWindow?
|
public static var shared: CtlPrefWindow?
|
||||||
|
|
||||||
static func show() {
|
static func show() {
|
||||||
if shared == nil { shared = CtlPrefWindow(windowNibName: "frmPrefWindow") }
|
shared = CtlPrefWindow(windowNibName: "frmPrefWindow")
|
||||||
guard let sharedWindow = shared?.window else { return }
|
guard let sharedWindow = shared?.window else { return }
|
||||||
|
sharedWindow.delegate = shared
|
||||||
sharedWindow.center()
|
sharedWindow.center()
|
||||||
sharedWindow.orderFrontRegardless() // 逼著視窗往最前方顯示
|
sharedWindow.orderFrontRegardless() // 逼著視窗往最前方顯示
|
||||||
sharedWindow.level = .statusBar
|
sharedWindow.level = .statusBar
|
||||||
|
@ -174,6 +175,10 @@ class CtlPrefWindow: NSWindowController {
|
||||||
initPhraseEditor()
|
initPhraseEditor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func windowWillClose(_: Notification) {
|
||||||
|
tfdPETextEditor.string = ""
|
||||||
|
}
|
||||||
|
|
||||||
// 這裡有必要加上這段處理,用來確保藉由偏好設定介面動過的 CNS 開關能夠立刻生效。
|
// 這裡有必要加上這段處理,用來確保藉由偏好設定介面動過的 CNS 開關能夠立刻生效。
|
||||||
// 所有涉及到語言模型開關的內容均需要這樣處理。
|
// 所有涉及到語言模型開關的內容均需要這樣處理。
|
||||||
@IBAction func toggleCNSSupport(_: Any) {
|
@IBAction func toggleCNSSupport(_: Any) {
|
||||||
|
|
Loading…
Reference in New Issue