|
@@ -14,7 +14,7 @@ import Cocoa
|
|
|
@objc optional func snapshotController(_ controller: KMSnapshotWindowController, miniaturizedRect isMiniaturize: Bool) -> NSRect
|
|
|
}
|
|
|
|
|
|
-class KMSnapshotWindowController: NSWindowController {
|
|
|
+class KMSnapshotWindowController: KMBaseWindowController {
|
|
|
|
|
|
@IBOutlet var pdfView: KMSnapshotPDFView!
|
|
|
|
|
@@ -92,6 +92,12 @@ class KMSnapshotWindowController: NSWindowController {
|
|
|
self.hasWindow = true
|
|
|
}
|
|
|
|
|
|
+ override func initNotification() {
|
|
|
+ super.initNotification()
|
|
|
+
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(preferenceInfoDidChange), name: KMPreferenceManager.didChangeNotification, object: nil)
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
+ (NSSet *)keyPathsForValuesAffectingPageAndWindow {
|
|
|
return [NSSet setWithObjects:PAGELABEL_KEY, HASWINDOW_KEY, nil];
|
|
@@ -611,13 +617,24 @@ class KMSnapshotWindowController: NSWindowController {
|
|
|
self.perform(#selector(goToRect), with: NSValue(rect: rect), afterDelay: SMALL_DELAY)
|
|
|
}
|
|
|
|
|
|
+ // MARK: - Noti Actions
|
|
|
+
|
|
|
+ @objc func preferenceInfoDidChange(sender: Notification) {
|
|
|
+ let info : [AnyHashable : Any] = sender.userInfo ?? [:]
|
|
|
+ if info.keys.contains(KMPreferenceManager.keepSnapshotWindowToTopKey) {
|
|
|
+ let data = KMPreferenceManager.shared.keepSnapshotWindowToTop
|
|
|
+ if let data = self.window?.isVisible, data {
|
|
|
+ self._updateWindowLevel()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// MARK: - Private Methods
|
|
|
|
|
|
extension KMSnapshotWindowController {
|
|
|
private func _updateWindowLevel() {
|
|
|
-
|
|
|
let onTop = self.forceOnTop || UserDefaults.standard.bool(forKey: SKSnapshotsOnTopKey)
|
|
|
self.window?.level = onTop ? .floating : .normal
|
|
|
self.window?.hidesOnDeactivate = onTop
|