|
@@ -282,8 +282,6 @@ import Cocoa
|
|
|
self.removeKeyEventMonitor()
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
// Do view setup here.
|
|
@@ -346,8 +344,6 @@ import Cocoa
|
|
|
pdfSplitBottomView.addSubview(splitPDFController!.view)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//MARK: - 工具栏
|
|
|
func initToolbar() {
|
|
|
toolbarBox.borderWidth = 0
|
|
@@ -467,6 +463,7 @@ import Cocoa
|
|
|
infoSplitViewLeftConst.constant = 0
|
|
|
toolbarBoxHeightConst.constant = 0
|
|
|
|
|
|
+ view.window?.makeFirstResponder(listView)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -482,12 +479,167 @@ import Cocoa
|
|
|
//MARK: - PPT
|
|
|
func togglePresentation(_ sender: Any?) {
|
|
|
if self.canExitPresentation() {
|
|
|
- self.exitFullScreen("")
|
|
|
- } else if self.canEnterPresentation(){
|
|
|
- self.enterPresentation()
|
|
|
+ exitFullScreen()
|
|
|
+ } else if self.canEnterPresentation() {
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(willEnterInteractionModeNotification), name: NSWindow.willEnterInteractionModeNotification, object: nil)
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(didEnterInteractionModeNotification), name: NSWindow.didEnterInteractionModeNotification, object: nil)
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(willShowFullScreenNotification), name: NSWindow.willShowFullScreenNotification, object: nil)
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(didShowFullScreenNotification), name: NSWindow.didShowFullScreenNotification, object: nil)
|
|
|
+
|
|
|
+ view.window?.enterPresentation(provider: self)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func enterPresentationMode() {
|
|
|
+ let scrollView = listView.documentView().enclosingScrollView
|
|
|
+ savedNormalSetup.setValue(scrollView?.hasHorizontalScroller, forKey: KMMainModel.Key.kHasHorizontalScroller)
|
|
|
+ savedNormalSetup.setValue(scrollView?.hasVerticalScroller, forKey: KMMainModel.Key.kHasVerticalsCroller)
|
|
|
+ savedNormalSetup.setValue(scrollView?.autohidesScrollers, forKey: KMMainModel.Key.kAutoHidesScrollers)
|
|
|
+
|
|
|
+ listView.backgroundColor = NSColor.clear
|
|
|
+ listView.setDisplay(.singlePage)
|
|
|
+ listView.autoScales = true
|
|
|
+ listView.displayBox = .cropBox
|
|
|
+ listView.displaysPageBreaks = false
|
|
|
+ scrollView?.autohidesScrollers = true
|
|
|
+ scrollView?.hasHorizontalScroller = false
|
|
|
+ scrollView?.hasVerticalScroller = false
|
|
|
+
|
|
|
+ listView.setCurrentSelection(nil, animate: true)
|
|
|
+ }
|
|
|
+
|
|
|
+ func exitPresentationMode() {
|
|
|
+ self.selectDisplay(display: KMPDFDisplayType(rawValue: KMPDFDisplayType.RawValue(self.listView.fetchDisplayViewMode().rawValue)) ?? .singlePage, viewSettingIsReload: false)
|
|
|
+
|
|
|
+ NotificationCenter.default.removeObserver(self, name: NSWindow.willEnterInteractionModeNotification, object: nil)
|
|
|
+ NotificationCenter.default.removeObserver(self, name: NSWindow.didEnterInteractionModeNotification, object: nil)
|
|
|
+ NotificationCenter.default.removeObserver(self, name: NSWindow.willShowFullScreenNotification, object: nil)
|
|
|
+ NotificationCenter.default.removeObserver(self, name: NSWindow.willShowFullScreenNotification, object: nil)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ func exitFullScreen() {
|
|
|
+ if self.canExitPresentation() == true {
|
|
|
+ let mainDocument = self.myDocument as? KMMainDocument
|
|
|
+ let browserWindowController = mainDocument?.browser?.windowController as? KMBrowserWindowController
|
|
|
+ browserWindowController?.exitFullscreen()
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func exitFullscreenMode() {
|
|
|
+ if self.interactionMode == .presentation {
|
|
|
+ self.exitPresentationMode()
|
|
|
+ }
|
|
|
+
|
|
|
+ self.applyPDFSettings(self.savedNormalSetup)
|
|
|
+ self.savedNormalSetup.removeAllObjects()
|
|
|
+
|
|
|
+ listView.layoutDocumentView()
|
|
|
+ listView.requiresDisplay()
|
|
|
+
|
|
|
+ if let backgroundColor = UserDefaults.standard.color(forKey: KMBackgroundColorKey) {
|
|
|
+ listView.backgroundColor = backgroundColor
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func applyPDFSettings(_ setup: NSDictionary) {
|
|
|
+ if let data = setup.object(forKey: KMMainModel.Key.kAutoScales) as? NSNumber {
|
|
|
+ self.listView.autoScales = data.boolValue
|
|
|
+ }
|
|
|
+ if self.listView.autoScales == false {
|
|
|
+ if let data = setup.object(forKey: KMMainModel.Key.kScaleFactor) as? NSNumber {
|
|
|
+ self.listView.scaleFactor = data.floatValue.cgFloat
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = setup.object(forKey: KMMainModel.Key.kDisplayMode) as? NSNumber {
|
|
|
+ self.listView.setDisplay(CPDFDisplayViewMode(rawValue: data.intValue) ?? .singlePage)
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = setup.object(forKey: KMMainModel.Key.kDisplaysAsBook) as? NSNumber {
|
|
|
+ self.listView.displaysAsBook = data.boolValue
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = setup.object(forKey: KMMainModel.Key.kDisplaysPageBreaks) as? NSNumber {
|
|
|
+ self.listView.displaysPageBreaks = data.boolValue
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = setup.object(forKey: KMMainModel.Key.kDisplayBox) as? NSNumber {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ self.listView.layoutDocumentView()
|
|
|
+ }
|
|
|
+
|
|
|
+ func currentPDFSettings() -> NSDictionary {
|
|
|
+ let setup = NSMutableDictionary()
|
|
|
+ setup[KMMainModel.Key.kDisplaysPageBreaks] = NSNumber(value: listView.displaysPageBreaks)
|
|
|
+ setup[KMMainModel.Key.kDisplaysAsBook] = NSNumber(value: listView.displaysAsBook)
|
|
|
+ setup[KMMainModel.Key.kDisplayBox] = NSNumber(value: listView.displayBox.rawValue)
|
|
|
+ setup[KMMainModel.Key.kScaleFactor] = NSNumber(value: listView.scaleFactor)
|
|
|
+ setup[KMMainModel.Key.kAutoScales] = NSNumber(value: listView.autoScales)
|
|
|
+ setup[KMMainModel.Key.kDisplayMode] = NSNumber(value: listView.fetchDisplayViewMode().rawValue)
|
|
|
+
|
|
|
+ return setup
|
|
|
+ }
|
|
|
+
|
|
|
+ func canEnterFullscreen() -> Bool {
|
|
|
+ if (mwcFlags.isSwitchingFullScreen != 0) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if useNativeFullScreen() {
|
|
|
+ return interactionMode == .normal || interactionMode == .presentation
|
|
|
+ } else {
|
|
|
+ return !self.listView.document.isLocked && (interactionMode == .normal || interactionMode == .presentation) && self.view.window?.tabbedWindows?.count ?? 0 < 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override func canEnterPresentation() -> Bool {
|
|
|
+ let can = super.canEnterPresentation()
|
|
|
+ if can == false {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ guard let doc = self.listView.document, doc.isLocked == false else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return can
|
|
|
+ }
|
|
|
+
|
|
|
+ func fadeOutFullScreenWindow() {
|
|
|
+ guard let fullScreenWindow = self.view.window as? KMFullScreenWindow else {
|
|
|
+ NSSound.beep()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let mainWindow = fullScreenWindow.interactionParent
|
|
|
+ let collectionBehavior = mainWindow?.collectionBehavior
|
|
|
+
|
|
|
+ mainWindow?.alphaValue = 0
|
|
|
+ if let data = mainWindow?.responds(to: NSSelectorFromString("setAnimationBehavior:")), data {
|
|
|
+ mainWindow?.animationBehavior = .none
|
|
|
+ }
|
|
|
+ // trick to make sure the main window shows up in the same space as the fullscreen window
|
|
|
+ fullScreenWindow.addChildWindow(mainWindow!, ordered: .below)
|
|
|
+ fullScreenWindow.removeChildWindow(mainWindow!)
|
|
|
+ fullScreenWindow.level = .popUpMenu
|
|
|
+ // these can change due to the child window trick
|
|
|
+ mainWindow?.level = .normal
|
|
|
+ mainWindow?.alphaValue = 1.0
|
|
|
+ mainWindow?.collectionBehavior = collectionBehavior!
|
|
|
+ mainWindow?.display()
|
|
|
+ mainWindow?.makeFirstResponder(self.listView)
|
|
|
+ mainWindow?.recalculateKeyViewLoop()
|
|
|
+// mainWindow?.delegate = self
|
|
|
+ mainWindow?.makeKey()
|
|
|
+
|
|
|
+ if let data = mainWindow?.responds(to: NSSelectorFromString("setAnimationBehavior:")), data {
|
|
|
+ mainWindow?.animationBehavior = .default
|
|
|
+ }
|
|
|
+ NSApp.removeWindowsItem(fullScreenWindow)
|
|
|
+ fullScreenWindow.fadeOut()
|
|
|
+ }
|
|
|
+
|
|
|
//MARK: - PDF分屏视图
|
|
|
func reloadPDFSplitInfo() {
|
|
|
if listView.viewSplitMode == .disable {
|
|
@@ -770,7 +922,7 @@ extension KMMainViewController: KMNDisplayViewControllerDelegate {
|
|
|
|
|
|
//PPT
|
|
|
func displayViewControllerDidGotoSlideShow(_ controller: KMNDisplayViewController) {
|
|
|
-
|
|
|
+ togglePresentation(nil)
|
|
|
}
|
|
|
|
|
|
//SplitView
|
|
@@ -791,6 +943,140 @@ extension KMMainViewController: KMNDisplayViewControllerDelegate {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//MARK: - PPT
|
|
|
+extension KMMainViewController: KMInteractionProviderProtocol {
|
|
|
+ func providerContentView(fullScreenWindow: NSWindow, inset: CGFloat) -> NSView? {
|
|
|
+ if(interactionMode == .presentation) {
|
|
|
+ if listView.presentationDrawView == nil {
|
|
|
+ listView.createPresentationDraw()
|
|
|
+ }
|
|
|
+
|
|
|
+ presentationTopViewController = KMPresentationTopViewController.init(nibName: "KMPresentationTopViewController", bundle: nil)
|
|
|
+ presentationTopViewController?.pdfView = listView
|
|
|
+ presentationTopViewController?.delegate = self
|
|
|
+ presentationTopViewController?.isSelectionPre = true
|
|
|
+ listView.isPresentationMode = true
|
|
|
+ presentationTopViewController?.view.frame = CGRect(x: 0, y: (fullScreenWindow.contentView?.bounds.height ?? 0) - 42, width: fullScreenWindow.contentView?.bounds.width ?? 0, height: 42)
|
|
|
+ if((presentationTopViewController) != nil) {
|
|
|
+ fullScreenWindow.contentView?.addSubview(presentationTopViewController!.view)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ listView.frame = NSInsetRect(fullScreenWindow.contentView?.bounds ?? .zero, 0, 0)
|
|
|
+ }
|
|
|
+
|
|
|
+ fullScreenWindow.contentView?.addSubview(listView)
|
|
|
+ if(interactionMode == .presentation) {
|
|
|
+ let frame = fullScreenWindow.frame
|
|
|
+ listView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height-42)
|
|
|
+ listView.autoresizingMask = [.width, .maxYMargin]
|
|
|
+ }
|
|
|
+ return view
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func willEnterInteractionModeNotification(_ sender: Notification) {
|
|
|
+ guard let win = sender.object as? NSWindow, win.isEqual(to: self.view.window) else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let interactionMode = sender.userInfo?[NSWindow.UserInfo.interactionModeKey] as? KMInteractionMode
|
|
|
+ if interactionMode == .presentation {
|
|
|
+ let backgroundColor = NSColor.black
|
|
|
+ let level = UserDefaults.standard.bool(forKey: "SKUseNormalLevelForPresentationKey") ? NSWindow.Level.normal : NSWindow.Level.popUpMenu
|
|
|
+
|
|
|
+ let wasInteractionMode = self.interactionMode
|
|
|
+ if wasInteractionMode == .normal {
|
|
|
+ self.savedNormalSetup.setDictionary(self.currentPDFSettings() as! [AnyHashable : Any])
|
|
|
+ }
|
|
|
+
|
|
|
+ if wasInteractionMode == .legacyFullScreen {
|
|
|
+ self.enterPresentationMode()
|
|
|
+
|
|
|
+ self.pdfSplitView.frame = CGRect(x: 0, y: 0, width: NSWidth(centerContentView.bounds), height: NSHeight(centerContentView.bounds)-1)
|
|
|
+ self.centerContentView.addSubview(pdfSplitView)
|
|
|
+ self.listView.frame = (self.view.window?.contentView?.bounds)!
|
|
|
+ self.view.window?.contentView?.addSubview(listView)
|
|
|
+
|
|
|
+// self.view.window?.backgroundColor = backgroundColor
|
|
|
+ self.view.window?.level = level
|
|
|
+ self.listView.layoutDocumentView()
|
|
|
+ self.listView.requiresDisplay()
|
|
|
+
|
|
|
+ self.forceSubwindowsOnTop(false)
|
|
|
+
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ KMPrint("2")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func didEnterInteractionModeNotification(_ sender: Notification) {
|
|
|
+ guard let win = sender.object as? NSWindow, win.isEqual(to: self.view.window) else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if self.interactionMode == .presentation {
|
|
|
+
|
|
|
+ self.listView.layoutDocumentView()
|
|
|
+ self.listView.requiresDisplay()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func willShowFullScreenNotification(_ sender: Notification) {
|
|
|
+ guard let win = sender.object as? NSWindow, win.isEqual(to: self.view.window) else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if self.interactionMode == .presentation {
|
|
|
+ let view = self.view.window?.firstResponder as? NSView
|
|
|
+ if let data = view?.isDescendant(of: self.pdfSplitView), data {
|
|
|
+ self.view.window?.makeFirstResponder(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func didShowFullScreenNotification(_ sender: Notification) {
|
|
|
+ guard let win = sender.object as? NSWindow, win.isEqual(to: self.view.window) else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if self.interactionMode == .presentation {
|
|
|
+ self.enterPresentationMode()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// MARK: -KMPresentationTopViewControllerDelegate (幻灯片)
|
|
|
+extension KMMainViewController: KMPresentationTopViewControllerDelegate {
|
|
|
+ func presentationTopViewExit(_ presentationTopViewController: KMPresentationTopViewController, withButton: NSButton) {
|
|
|
+ self.exitFullScreen()
|
|
|
+ }
|
|
|
+
|
|
|
+ func presentationTopViewClear(_ presentationTopViewController: KMPresentationTopViewController, withButton: NSButton) {
|
|
|
+ listView.presentationDrawView?.clear()
|
|
|
+ }
|
|
|
+
|
|
|
+ func presentationTopViewUndo(_ presentationTopViewController: KMPresentationTopViewController, withButton: NSButton) {
|
|
|
+ let presentationDrawView = listView.presentationDrawView
|
|
|
+ if presentationDrawView?.canUndo() == true {
|
|
|
+ presentationDrawView?.undo()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func presentationTopViewType(_ presentationTopViewController: KMPresentationTopViewController, withButton: NSButton, isSeletion: Bool) {
|
|
|
+ listView.isPresentationMode = isSeletion
|
|
|
+ if listView.isEnterPresentationDrawMode() == true {
|
|
|
+ listView.exitPresentationDrawMode()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func presentationTopViewDrawColor(_ presentationTopViewController: KMPresentationTopViewController, withView: NSView,color:NSColor?) {
|
|
|
+ if color == nil{
|
|
|
+ listView.exitPresentationDrawMode()
|
|
|
+ } else {
|
|
|
+ if listView.isEnterPresentationDrawMode() == false {
|
|
|
+ listView.enterPresentationDrawMode()
|
|
|
+ }
|
|
|
+ listView.changePresentationDrawModelColor(color)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//MARK: - KMSplitPDFViewControllerDelegate SplitPDFView分屏视图
|
|
|
extension KMMainViewController: KMSplitPDFViewControllerDelegate {
|
|
|
func splitPDFViewControllerDidUpdateFilePath(_ controller: KMSplitPDFViewController) {
|
|
@@ -1050,7 +1336,7 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
|
|
|
if theEvent.keyCode == 53 {
|
|
|
//ESC
|
|
|
- self.exitFullScreen(Any.self)
|
|
|
+ self.exitFullScreen()
|
|
|
|
|
|
if viewManager.isPDFReadMode {
|
|
|
self.exitPDFReadMode()
|
|
@@ -1768,46 +2054,6 @@ extension KMMainViewController: KMNThumbnailBaseViewDelegate {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// MARK: - KMPresentationTopViewControllerDelegate (幻灯片)
|
|
|
-extension KMMainViewController: KMPresentationTopViewControllerDelegate {
|
|
|
- func presentationTopViewExit(_ presentationTopViewController: KMPresentationTopViewController, withButton: NSButton) {
|
|
|
- if self.canExitPresentation() == true {
|
|
|
- let mainDocument = self.myDocument as? KMMainDocument
|
|
|
- let browserWindowController = mainDocument?.browser?.windowController as? KMBrowserWindowController
|
|
|
- browserWindowController?.exitFullscreen()
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func presentationTopViewClear(_ presentationTopViewController: KMPresentationTopViewController, withButton: NSButton) {
|
|
|
- listView.presentationDrawView?.clear()
|
|
|
- }
|
|
|
-
|
|
|
- func presentationTopViewUndo(_ presentationTopViewController: KMPresentationTopViewController, withButton: NSButton) {
|
|
|
- let presentationDrawView = listView.presentationDrawView
|
|
|
- if presentationDrawView?.canUndo() == true {
|
|
|
- presentationDrawView?.undo()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func presentationTopViewType(_ presentationTopViewController: KMPresentationTopViewController, withButton: NSButton, isSeletion: Bool) {
|
|
|
- listView.isPresentationMode = isSeletion
|
|
|
- if listView.isEnterPresentationDrawMode() == true {
|
|
|
- listView.exitPresentationDrawMode()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func presentationTopViewDrawColor(_ presentationTopViewController: KMPresentationTopViewController, withView: NSView,color:NSColor?) {
|
|
|
- if color == nil{
|
|
|
- listView.exitPresentationDrawMode()
|
|
|
- } else {
|
|
|
- if listView.isEnterPresentationDrawMode() == false {
|
|
|
- listView.enterPresentationDrawMode()
|
|
|
- }
|
|
|
- listView.changePresentationDrawModelColor(color)
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
|
|
|
//MARK: -
|
|
@@ -1998,11 +2244,8 @@ extension KMMainViewController {
|
|
|
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(handlePageChangedNotification), name: NSNotification.Name.CPDFViewPageChanged, object: self.listView)
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(handleDisplayBoxChangedNotification), name: NSNotification.Name.CPDFViewDisplayBoxChanged, object: self.listView)
|
|
|
- // 互动模式
|
|
|
- NotificationCenter.default.addObserver(self, selector: #selector(willEnterInteractionModeNotification), name: NSWindow.willEnterInteractionModeNotification, object: nil)
|
|
|
- NotificationCenter.default.addObserver(self, selector: #selector(didEnterInteractionModeNotification), name: NSWindow.didEnterInteractionModeNotification, object: nil)
|
|
|
- NotificationCenter.default.addObserver(self, selector: #selector(willShowFullScreenNotification), name: NSWindow.willShowFullScreenNotification, object: nil)
|
|
|
- NotificationCenter.default.addObserver(self, selector: #selector(didShowFullScreenNotification), name: NSWindow.didShowFullScreenNotification, object: nil)
|
|
|
+
|
|
|
+
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(didAddContentViewNotification), name: NSWindow.didAddContentViewNotification, object: nil)
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(addAutoSaveEvent), name: AutoSaveManager.kTimeValueChangedNotificationName, object: nil)
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(didRemoveAnnotationNotification), name: NSNotification.Name.CPDFPageDidRemoveAnnotation, object: nil)
|
|
@@ -3429,11 +3672,7 @@ extension KMMainViewController {
|
|
|
keyEventMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown) { [weak self] event in
|
|
|
if event.keyCode == 53 {
|
|
|
if let data = self?.interactionMode, data == .presentation { // 幻灯片模式下
|
|
|
- if let data = self?.canExitPresentation(), data {
|
|
|
- let mainDocument = self?.myDocument as? KMMainDocument
|
|
|
- let browserWindowController = mainDocument?.browser?.windowController as? KMBrowserWindowController
|
|
|
- browserWindowController?.exitFullscreen()
|
|
|
- }
|
|
|
+ self?.exitFullScreen()
|
|
|
return nil
|
|
|
}
|
|
|
if self?.listView.toolMode == .editPDFToolMode {
|
|
@@ -3569,7 +3808,7 @@ extension KMMainViewController {
|
|
|
NSSpellChecker.shared.closeSpellDocument(withTag: self.listView.spellingTag())
|
|
|
}
|
|
|
self.removeAutoSaveInfo()
|
|
|
- KMAdsManager.defaultManager.dismissSheetModal(for: self.readContentView)
|
|
|
+
|
|
|
self.myDocument = nil
|
|
|
|
|
|
}
|
|
@@ -3763,43 +4002,6 @@ extension KMMainViewController {
|
|
|
self.leftSideViewController.reloadThumbnailDataIfNeed()
|
|
|
}
|
|
|
|
|
|
- @objc func willEnterInteractionModeNotification(_ sender: Notification) {
|
|
|
- guard let win = sender.object as? NSWindow, win.isEqual(to: self.view.window) else {
|
|
|
- return
|
|
|
- }
|
|
|
- let interactionMode = sender.userInfo?[NSWindow.UserInfo.interactionModeKey] as? KMInteractionMode
|
|
|
- if interactionMode == .presentation {
|
|
|
- let backgroundColor = NSColor.black
|
|
|
- let level = UserDefaults.standard.bool(forKey: "SKUseNormalLevelForPresentationKey") ? NSWindow.Level.normal : NSWindow.Level.popUpMenu
|
|
|
-
|
|
|
- let wasInteractionMode = self.interactionMode
|
|
|
- if wasInteractionMode == .normal {
|
|
|
- self.savedNormalSetup.setDictionary(self.currentPDFSettings() as! [AnyHashable : Any])
|
|
|
- }
|
|
|
-
|
|
|
- if wasInteractionMode == .legacyFullScreen {
|
|
|
- self.enterPresentationMode()
|
|
|
-
|
|
|
- self.pdfSplitView.frame = CGRect(x: 0, y: 0, width: NSWidth(centerContentView.bounds), height: NSHeight(centerContentView.bounds)-1)
|
|
|
- self.centerContentView.addSubview(pdfSplitView)
|
|
|
- self.listView.frame = (self.view.window?.contentView?.bounds)!
|
|
|
- self.view.window?.contentView?.addSubview(listView)
|
|
|
-
|
|
|
- self.view.window?.backgroundColor = backgroundColor
|
|
|
- self.view.window?.level = level
|
|
|
- self.listView.layoutDocumentView()
|
|
|
- self.listView.requiresDisplay()
|
|
|
-
|
|
|
- self.forceSubwindowsOnTop(false)
|
|
|
-
|
|
|
- self.hideLeftSideWindow()
|
|
|
- self.hideRightSideWindow()
|
|
|
- self.removeBlankingWindows()
|
|
|
- }
|
|
|
- } else {
|
|
|
- KMPrint("2")
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
|
|
|
}
|