|
@@ -15,9 +15,9 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
if searchString == "" {
|
|
if searchString == "" {
|
|
self.searchResults = []
|
|
self.searchResults = []
|
|
-// self.leftSideViewController.searchViewController.searchResults = self.searchResults
|
|
|
|
|
|
+ // self.leftSideViewController.searchViewController.searchResults = self.searchResults
|
|
self.leftSideViewController.searchResults = self.searchResults
|
|
self.leftSideViewController.searchResults = self.searchResults
|
|
-// self.leftSideViewController.searchViewController.reloadData()
|
|
|
|
|
|
+ // self.leftSideViewController.searchViewController.reloadData()
|
|
} else {
|
|
} else {
|
|
mwcFlags.wholeWordSearch = isCase == true ? 1 : 0
|
|
mwcFlags.wholeWordSearch = isCase == true ? 1 : 0
|
|
var findArray : [[CPDFSelection]]
|
|
var findArray : [[CPDFSelection]]
|
|
@@ -45,8 +45,8 @@ extension KMMainViewController {
|
|
self.searchResults.insert(mode, at: self.searchResults.count)
|
|
self.searchResults.insert(mode, at: self.searchResults.count)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-// self.leftSideViewController.searchViewController.searchResults = self.searchResults
|
|
|
|
-// self.leftSideViewController.searchViewController.reloadData()
|
|
|
|
|
|
+ // self.leftSideViewController.searchViewController.searchResults = self.searchResults
|
|
|
|
+ // self.leftSideViewController.searchViewController.reloadData()
|
|
self.leftSideViewController.searchResults = self.searchResults
|
|
self.leftSideViewController.searchResults = self.searchResults
|
|
}
|
|
}
|
|
|
|
|
|
@@ -79,20 +79,20 @@ extension KMMainViewController {
|
|
mSignatures.append(sign)
|
|
mSignatures.append(sign)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-// self.leftSideViewController.signatureViewController.signatures = signatures
|
|
|
|
-// self.leftSideViewController.signatureViewController.reloadData()
|
|
|
|
|
|
+ // self.leftSideViewController.signatureViewController.signatures = signatures
|
|
|
|
+ // self.leftSideViewController.signatureViewController.reloadData()
|
|
}
|
|
}
|
|
|
|
|
|
//MARK: menu菜单
|
|
//MARK: menu菜单
|
|
|
|
|
|
func fontColorMenuItem()->NSMenuItem {
|
|
func fontColorMenuItem()->NSMenuItem {
|
|
let fontColorItem = NSMenuItem(title: NSLocalizedString("Text Color", comment: ""), action: #selector(menuItemEditingClick_FontColor), keyEquivalent: "")
|
|
let fontColorItem = NSMenuItem(title: NSLocalizedString("Text Color", comment: ""), action: #selector(menuItemEditingClick_FontColor), keyEquivalent: "")
|
|
-
|
|
|
|
|
|
+
|
|
return fontColorItem;
|
|
return fontColorItem;
|
|
}
|
|
}
|
|
|
|
|
|
func fontSizeMenuItem()->NSMenuItem {
|
|
func fontSizeMenuItem()->NSMenuItem {
|
|
- let currentFontSize = self.listView.editingTextFontSize()
|
|
|
|
|
|
+ let currentFontSize = self.listView.editingTextFontSize()
|
|
let fontSizes = self.fontSizes()
|
|
let fontSizes = self.fontSizes()
|
|
let submenu = NSMenu(title: "")
|
|
let submenu = NSMenu(title: "")
|
|
for i in 0 ... fontSizes.count - 1 {
|
|
for i in 0 ... fontSizes.count - 1 {
|
|
@@ -107,7 +107,7 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
|
|
|
|
let fontSizeItem = NSMenuItem(title: NSLocalizedString("Font Size", comment: ""), action:nil, keyEquivalent: "")
|
|
let fontSizeItem = NSMenuItem(title: NSLocalizedString("Font Size", comment: ""), action:nil, keyEquivalent: "")
|
|
-
|
|
|
|
|
|
+
|
|
fontSizeItem.submenu = submenu
|
|
fontSizeItem.submenu = submenu
|
|
return fontSizeItem;
|
|
return fontSizeItem;
|
|
}
|
|
}
|
|
@@ -203,21 +203,21 @@ extension KMMainViewController {
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Strikethrough", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 2)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Strikethrough", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 2)
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
}
|
|
}
|
|
-// stypeMenu.addItem(withTitle: NSLocalizedString("Freehand", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 0)
|
|
|
|
|
|
+ // stypeMenu.addItem(withTitle: NSLocalizedString("Freehand", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 0)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Text Box", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 1)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Text Box", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 1)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Anchored Note", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 2)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Anchored Note", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 2)
|
|
-// stypeMenu.insertItem(NSMenuItem.separator(), at: 10000)
|
|
|
|
|
|
+ // stypeMenu.insertItem(NSMenuItem.separator(), at: 10000)
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Rectangle", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 3)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Rectangle", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 3)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Circle", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 4)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Circle", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 4)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Arrow", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 5)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Arrow", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 5)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Line", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 6)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Line", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 6)
|
|
-// stypeMenu.insertItem(NSMenuItem.separator(), at: 10000)
|
|
|
|
|
|
+ // stypeMenu.insertItem(NSMenuItem.separator(), at: 10000)
|
|
if self.isReadMode {
|
|
if self.isReadMode {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
-// _ = stypeMenu.addItem(withTitle: NSLocalizedString("Link", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 7)
|
|
|
|
|
|
+ // _ = stypeMenu.addItem(withTitle: NSLocalizedString("Link", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 7)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Stamp", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 8)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Stamp", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 8)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Image", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 10)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Image", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 10)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Signature", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 9)
|
|
_ = stypeMenu.addItem(withTitle: NSLocalizedString("Signature", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 9)
|
|
@@ -250,12 +250,12 @@ extension KMMainViewController {
|
|
func setAnnotationToolStype() -> NSMenuItem {
|
|
func setAnnotationToolStype() -> NSMenuItem {
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Tool Mode", comment: ""), action: nil, target: self)
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Tool Mode", comment: ""), action: nil, target: self)
|
|
let stypeMenu = NSMenu()
|
|
let stypeMenu = NSMenu()
|
|
-
|
|
|
|
|
|
+
|
|
let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Text", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: CToolMode.noteToolMode.rawValue)
|
|
let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Text", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: CToolMode.noteToolMode.rawValue)
|
|
let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Scroll", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: CToolMode.moveToolMode.rawValue)
|
|
let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Scroll", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: CToolMode.moveToolMode.rawValue)
|
|
let item3 = stypeMenu.addItem(withTitle: NSLocalizedString("Magnify", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: CToolMode.magnifyToolMode.rawValue)
|
|
let item3 = stypeMenu.addItem(withTitle: NSLocalizedString("Magnify", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: CToolMode.magnifyToolMode.rawValue)
|
|
let item4 = stypeMenu.addItem(withTitle: NSLocalizedString("Select", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: CToolMode.selectToolMode.rawValue)
|
|
let item4 = stypeMenu.addItem(withTitle: NSLocalizedString("Select", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: CToolMode.selectToolMode.rawValue)
|
|
-// stypeMenu.addItem(withTitle: NSLocalizedString("Zoom to Selected Area", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 4)
|
|
|
|
|
|
+ // stypeMenu.addItem(withTitle: NSLocalizedString("Zoom to Selected Area", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 4)
|
|
stypeMenu.insertItem(NSMenuItem.separator(), at: 4)
|
|
stypeMenu.insertItem(NSMenuItem.separator(), at: 4)
|
|
let item5 = stypeMenu.addItem(withTitle: NSLocalizedString("Highlight", comment: ""), action: #selector(changeAnnotationMode_itemAction), target: self, tag: CAnnotationType.highlight.rawValue)
|
|
let item5 = stypeMenu.addItem(withTitle: NSLocalizedString("Highlight", comment: ""), action: #selector(changeAnnotationMode_itemAction), target: self, tag: CAnnotationType.highlight.rawValue)
|
|
let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Underline", comment: ""), action: #selector(changeAnnotationMode_itemAction), target: self, tag: CAnnotationType.underline.rawValue)
|
|
let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Underline", comment: ""), action: #selector(changeAnnotationMode_itemAction), target: self, tag: CAnnotationType.underline.rawValue)
|
|
@@ -308,7 +308,7 @@ extension KMMainViewController {
|
|
if listView.activeAnnotation != nil {
|
|
if listView.activeAnnotation != nil {
|
|
string = listView.activeAnnotation.contents
|
|
string = listView.activeAnnotation.contents
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
stypItem.submenu = NSSharingServicePicker.menu(forSharingItems: [string], subjectContext: "", withTarget: self, selector: #selector(shareFromService), serviceDelegate: nil)
|
|
stypItem.submenu = NSSharingServicePicker.menu(forSharingItems: [string], subjectContext: "", withTarget: self, selector: #selector(shareFromService), serviceDelegate: nil)
|
|
return stypItem
|
|
return stypItem
|
|
}
|
|
}
|
|
@@ -398,11 +398,11 @@ extension KMMainViewController {
|
|
let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto", comment: ""), action: #selector(takeSnapshot), target: self, tag: 0)
|
|
let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto", comment: ""), action: #selector(takeSnapshot), target: self, tag: 0)
|
|
let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Select Area", comment: ""), action: #selector(takeSnapshotSelectContent), target: self, tag: 1)
|
|
let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Select Area", comment: ""), action: #selector(takeSnapshotSelectContent), target: self, tag: 1)
|
|
stypItem.submenu = stypeMenu
|
|
stypItem.submenu = stypeMenu
|
|
-// if self.toolbarController.toolbarType == .Annatiton {
|
|
|
|
-// stypeMenu.item(at: 0)?.state = .on
|
|
|
|
-// } else if self.toolbarController.toolbarType == .Move {
|
|
|
|
-// stypeMenu.item(at: 1)?.state = .on
|
|
|
|
-// }
|
|
|
|
|
|
+ // if self.toolbarController.toolbarType == .Annatiton {
|
|
|
|
+ // stypeMenu.item(at: 0)?.state = .on
|
|
|
|
+ // } else if self.toolbarController.toolbarType == .Move {
|
|
|
|
+ // stypeMenu.item(at: 1)?.state = .on
|
|
|
|
+ // }
|
|
return stypItem
|
|
return stypItem
|
|
}
|
|
}
|
|
|
|
|
|
@@ -417,11 +417,11 @@ extension KMMainViewController {
|
|
let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Show in Finder", comment: ""), action: #selector(showInFinder), target: self, tag: 4)
|
|
let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Show in Finder", comment: ""), action: #selector(showInFinder), target: self, tag: 4)
|
|
let item7 = stypeMenu.addItem(withTitle: NSLocalizedString("Show Info in Finder", comment: ""), action: #selector(showInfoInFinder), target: self, tag: 5)
|
|
let item7 = stypeMenu.addItem(withTitle: NSLocalizedString("Show Info in Finder", comment: ""), action: #selector(showInfoInFinder), target: self, tag: 5)
|
|
stypItem.submenu = stypeMenu
|
|
stypItem.submenu = stypeMenu
|
|
-// if self.toolbarController.toolbarType == .Annatiton {
|
|
|
|
-// stypeMenu.item(at: 0)?.state = .on
|
|
|
|
-// } else if self.toolbarController.toolbarType == .Move {
|
|
|
|
-// stypeMenu.item(at: 1)?.state = .on
|
|
|
|
-// }
|
|
|
|
|
|
+ // if self.toolbarController.toolbarType == .Annatiton {
|
|
|
|
+ // stypeMenu.item(at: 0)?.state = .on
|
|
|
|
+ // } else if self.toolbarController.toolbarType == .Move {
|
|
|
|
+ // stypeMenu.item(at: 1)?.state = .on
|
|
|
|
+ // }
|
|
return stypItem
|
|
return stypItem
|
|
}
|
|
}
|
|
func setCropStype() -> NSMenuItem {
|
|
func setCropStype() -> NSMenuItem {
|
|
@@ -431,24 +431,24 @@ extension KMMainViewController {
|
|
let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Crop Current Page", comment: ""), action: #selector(cropCurrentPageItem), target: self, tag: 1)
|
|
let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Crop Current Page", comment: ""), action: #selector(cropCurrentPageItem), target: self, tag: 1)
|
|
let item3 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto Crop – Separate", comment: ""), action: #selector(autoCropAllItem), target: self, tag: 2)
|
|
let item3 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto Crop – Separate", comment: ""), action: #selector(autoCropAllItem), target: self, tag: 2)
|
|
let item4 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto Crop – Combined", comment: ""), action: #selector(smartAutoCropAllItem), target: self, tag: 3)
|
|
let item4 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto Crop – Combined", comment: ""), action: #selector(smartAutoCropAllItem), target: self, tag: 3)
|
|
-// if(NSIsEmptyRect(selectionRect)) {
|
|
|
|
|
|
+ // if(NSIsEmptyRect(selectionRect)) {
|
|
let item5 = stypeMenu.addItem(withTitle: NSLocalizedString("Select Area", comment: ""), action: #selector(selectToolModel), target: self, tag: 4)
|
|
let item5 = stypeMenu.addItem(withTitle: NSLocalizedString("Select Area", comment: ""), action: #selector(selectToolModel), target: self, tag: 4)
|
|
let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Crop Options...", comment: ""), action: #selector(customCropModel), target: self, tag: 5)
|
|
let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Crop Options...", comment: ""), action: #selector(customCropModel), target: self, tag: 5)
|
|
-//
|
|
|
|
-// }
|
|
|
|
|
|
+ //
|
|
|
|
+ // }
|
|
|
|
|
|
stypItem.submenu = stypeMenu
|
|
stypItem.submenu = stypeMenu
|
|
-// if self.toolbarController.toolbarType == .Annatiton {
|
|
|
|
-// stypeMenu.item(at: 0)?.state = .on
|
|
|
|
-// } else if self.toolbarController.toolbarType == .Move {
|
|
|
|
-// stypeMenu.item(at: 1)?.state = .on
|
|
|
|
-// } else if self.toolbarController.toolbarType == .Magnify {
|
|
|
|
-// stypeMenu.item(at: 2)?.state = .on
|
|
|
|
-// } else if self.toolbarController.toolbarType == .Select {
|
|
|
|
-// stypeMenu.item(at: 3)?.state = .on
|
|
|
|
-// } else if self.toolbarController.toolbarType == .SelectZoom {
|
|
|
|
-// stypeMenu.item(at: 4)?.state = .on
|
|
|
|
-// }
|
|
|
|
|
|
+ // if self.toolbarController.toolbarType == .Annatiton {
|
|
|
|
+ // stypeMenu.item(at: 0)?.state = .on
|
|
|
|
+ // } else if self.toolbarController.toolbarType == .Move {
|
|
|
|
+ // stypeMenu.item(at: 1)?.state = .on
|
|
|
|
+ // } else if self.toolbarController.toolbarType == .Magnify {
|
|
|
|
+ // stypeMenu.item(at: 2)?.state = .on
|
|
|
|
+ // } else if self.toolbarController.toolbarType == .Select {
|
|
|
|
+ // stypeMenu.item(at: 3)?.state = .on
|
|
|
|
+ // } else if self.toolbarController.toolbarType == .SelectZoom {
|
|
|
|
+ // stypeMenu.item(at: 4)?.state = .on
|
|
|
|
+ // }
|
|
return stypItem
|
|
return stypItem
|
|
}
|
|
}
|
|
|
|
|
|
@@ -477,7 +477,7 @@ extension KMMainViewController {
|
|
let link = NSMenuItem(title: NSLocalizedString("Add Link", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 8)
|
|
let link = NSMenuItem(title: NSLocalizedString("Add Link", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 8)
|
|
let outline = NSMenuItem(title: NSLocalizedString("Add Outline", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 9)
|
|
let outline = NSMenuItem(title: NSLocalizedString("Add Outline", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 9)
|
|
let aiTranslation = NSMenuItem(title: NSLocalizedString("AI Translation", comment: ""), action: #selector(aiTranslationAction), target: self)
|
|
let aiTranslation = NSMenuItem(title: NSLocalizedString("AI Translation", comment: ""), action: #selector(aiTranslationAction), target: self)
|
|
-// let tts = NSMenuItem(title: NSLocalizedString("TTS", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 10)!
|
|
|
|
|
|
+ // let tts = NSMenuItem(title: NSLocalizedString("TTS", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 10)!
|
|
menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
|
|
menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
|
|
if listView.currentSelection.selectionType() != .image {
|
|
if listView.currentSelection.selectionType() != .image {
|
|
menu.insertItem(height, at: menu.items.count)
|
|
menu.insertItem(height, at: menu.items.count)
|
|
@@ -487,7 +487,7 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
|
|
|
|
if self.isReadMode {
|
|
if self.isReadMode {
|
|
-
|
|
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
if listView.currentSelection.selectionType() != .image &&
|
|
if listView.currentSelection.selectionType() != .image &&
|
|
listView.currentSelection.selectionType() != .text {
|
|
listView.currentSelection.selectionType() != .text {
|
|
@@ -505,7 +505,7 @@ extension KMMainViewController {
|
|
menu.insertItem(oval, at: menu.items.count)
|
|
menu.insertItem(oval, at: menu.items.count)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if self.isReadMode {
|
|
if self.isReadMode {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -565,6 +565,245 @@ extension KMMainViewController {
|
|
return ["6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "24", "36", "48", "72", "96", "144", "288"]
|
|
return ["6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "24", "36", "48", "72", "96", "144", "288"]
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ func handleRightMouseDown(theEvent: NSEvent) -> Bool {
|
|
|
|
+ if interactionMode == .SKPresentationMode {
|
|
|
|
+ listView.goToPreviousPage(nil)
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func canExitPresentation() -> Bool {
|
|
|
|
+ var isExit = false
|
|
|
|
+ if mwcFlags.isSwitchingFullScreen == 0 && self.interactionMode == .SKPresentationMode {
|
|
|
|
+ isExit = true
|
|
|
|
+ }
|
|
|
|
+ return isExit
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func canEnterFullscreen() -> Bool {
|
|
|
|
+ if (mwcFlags.isSwitchingFullScreen != 0) {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ if useNativeFullScreen() {
|
|
|
|
+ return interactionMode == .SKNormalMode || interactionMode == .SKPresentationMode
|
|
|
|
+ } else {
|
|
|
|
+ return !self.listView.document.isLocked && (interactionMode == .SKNormalMode || interactionMode == .SKPresentationMode) && self.view.window?.tabbedWindows?.count ?? 0 < 2
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func canEnterPresentation() -> Bool {
|
|
|
|
+ if (mwcFlags.isSwitchingFullScreen == 0 && !self.listView.document.isLocked && (interactionMode == .SKNormalMode || interactionMode == .SKFullScreenMode || interactionMode == .SKLegacyFullScreenMode) && self.view.window?.tabbedWindows?.count ?? 0 < 2){
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func useNativeFullScreen() -> Bool {
|
|
|
|
+ var isFull = false
|
|
|
|
+// NSWindow.instancesRespond(toSelector: #selector(toggleFullScreen:))
|
|
|
|
+ let sel = NSSelectorFromString("toggleFullscreen:")
|
|
|
|
+ if NSWindow.instancesRespond(to: sel) && UserDefaults.standard.bool(forKey: "SKUseLegacyFullScreenKey"){
|
|
|
|
+ isFull = true
|
|
|
|
+ }
|
|
|
|
+ return isFull
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func enterPresentation() {
|
|
|
|
+ let wasInteractionMode = self.interactionMode
|
|
|
|
+ if self.canEnterPresentation() == false { return }
|
|
|
|
+ if wasInteractionMode == .SKFullScreenMode {
|
|
|
|
+ mwcFlags.wantsPresentation = 1
|
|
|
|
+ self.view.window?.toggleFullScreen(nil)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let backgroundColor = NSColor.black
|
|
|
|
+ let level = UserDefaults.standard.bool(forKey: "SKUseNormalLevelForPresentationKey") ? NSWindow.Level.normal : NSWindow.Level.popUpMenu
|
|
|
|
+ let page = self.listView.currentPage()
|
|
|
|
+
|
|
|
|
+ if wasInteractionMode == .SKNormalMode {
|
|
|
|
+ savedNormalSetup.setDictionary(self.currentPDFSettings() as! [AnyHashable : Any])
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mwcFlags.isSwitchingFullScreen = 1
|
|
|
|
+
|
|
|
|
+// if findController.view().window() != nil {
|
|
|
|
+// findController.toggleAboveView(nil, animate: false)
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ interactionMode = .SKPresentationMode
|
|
|
|
+
|
|
|
|
+ if wasInteractionMode == .SKLegacyFullScreenMode {
|
|
|
|
+ self.enterPresentationMode()
|
|
|
|
+
|
|
|
|
+// updatePresentationOptions(for: self.view.window!)
|
|
|
|
+
|
|
|
|
+ pdfSplitView.frame = CGRect(x: 0, y: 0, width: CGRectGetWidth(centerContentView.bounds), height: CGRectGetHeight(centerContentView.bounds)-1)
|
|
|
|
+ centerContentView.addSubview(pdfSplitView)
|
|
|
|
+ listView.frame = (self.view.window?.contentView?.bounds)!
|
|
|
|
+ self.view.window?.contentView?.addSubview(listView)
|
|
|
|
+
|
|
|
|
+ self.view.window?.backgroundColor = backgroundColor
|
|
|
|
+ self.view.window?.level = level
|
|
|
|
+ listView.layoutDocumentView()
|
|
|
|
+ listView.requiresDisplay()
|
|
|
|
+
|
|
|
|
+ self.forceSubwindowsOnTop(false)
|
|
|
|
+
|
|
|
|
+ self.hideLeftSideWindow()
|
|
|
|
+ self.hideRightSideWindow()
|
|
|
|
+ self.removeBlankingWindows()
|
|
|
|
+ } else {
|
|
|
|
+ self.fadeInFullScreenWindow(with: backgroundColor, level: level.rawValue)
|
|
|
|
+
|
|
|
|
+ self.enterPresentationMode()
|
|
|
|
+
|
|
|
|
+// self.fadeInFullScreenView(listView, inset: 0.0)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// if _isShowToolbar {
|
|
|
|
+// self.toolbarViewController.hiddenToolbar(true)
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// if self.pdfView().currentPage()?.isEqual(page) == false {
|
|
|
|
+// self.pdfView().go(to: page)
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// mwcFlags.isSwitchingFullScreen = 0
|
|
|
|
+//
|
|
|
|
+// pdfView().setInteractionMode(SKPresentationMode)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func mainWindow() -> NSWindow? {
|
|
|
|
+ return self.view.window
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func fadeInFullScreenWindow(with backgroundColor: NSColor, level: Int) {
|
|
|
|
+ let view: NSView = self.view.window!.firstResponder as! NSView
|
|
|
|
+ if view.isDescendant(of: pdfSplitView){
|
|
|
|
+ self.view.window?.makeFirstResponder(nil)
|
|
|
|
+ }
|
|
|
|
+// let fullScreenWindow = SKFullScreenWindow(screen: mainWindow().screen, backgroundColor: backgroundColor, level: NSPopUpMenuWindowLevel, isMain: true)
|
|
|
|
+
|
|
|
|
+ let fullScreenWindow = KMFullScreenWindow(screen: (mainWindow()?.screen ?? NSScreen.main)!, bgColor: backgroundColor, level: NSWindow.Level.popUpMenu.rawValue, isMain: true)
|
|
|
|
+
|
|
|
|
+ mainWindow()?.delegate = nil
|
|
|
|
+ fullScreenWindow.fadeInBlocking()
|
|
|
|
+ let window = NSWindow.currentWindow()
|
|
|
|
+ window.windowController?.window = fullScreenWindow
|
|
|
|
+ fullScreenWindow.makeKey()
|
|
|
|
+
|
|
|
|
+// NSApp.updatePresentationOptions(for: fullScreenWindow)
|
|
|
|
+
|
|
|
|
+ let sel = NSSelectorFromString("setAnimationBehavior:")
|
|
|
|
+ if mainWindow()?.responds(to: sel) ?? false{
|
|
|
|
+ mainWindow()?.animationBehavior = .none
|
|
|
|
+ }
|
|
|
|
+ mainWindow()?.orderOut(nil)
|
|
|
|
+ if mainWindow()?.responds(to: sel) ?? false{
|
|
|
|
+ mainWindow()?.animationBehavior = .default
|
|
|
|
+ }
|
|
|
|
+ fullScreenWindow.level = NSWindow.Level(rawValue: level)
|
|
|
|
+ fullScreenWindow.orderFront(nil)
|
|
|
|
+// NSApp.addWindowsItem(fullScreenWindow, title: windowTitleForDocumentDisplayName(self.document?.displayName) ?? "", filename: false)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func removeBlankingWindows() {
|
|
|
|
+// blankingWindows.makeObjectsPerform(#selector(fadeOut))
|
|
|
|
+// blankingWindows = nil
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func hideLeftSideWindow() {
|
|
|
|
+// if leftSideViewController.view.window == leftSideWindow {
|
|
|
|
+// self.leftView.remove()
|
|
|
|
+// if leftSideWindow.firstResponder()?.isDescendant(of: leftSideController.view()) {
|
|
|
|
+// leftSideWindow.makeFirstResponder(nil)
|
|
|
|
+// }
|
|
|
|
+// leftSideController.view().setFrame(SKShrinkRect(NSInsetRect(leftSideContentView.bounds, -1.0, -1.0), 1.0, .maxYEdge))
|
|
|
|
+// leftSideContentView.addSubview(leftSideController.view())
|
|
|
|
+//
|
|
|
|
+// if self.interactionMode() == SKPresentationMode {
|
|
|
|
+// self.setLeftSidePaneState(mwcFlags.savedLeftSidePaneState)
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// leftSideWindow = nil
|
|
|
|
+// }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func hideRightSideWindow() {
|
|
|
|
+// if rightSideController.view().window() == rightSideWindow {
|
|
|
|
+// rightSideWindow.remove()
|
|
|
|
+// if rightSideWindow.firstResponder()?.isDescendant(of: rightSideController.view()) {
|
|
|
|
+// rightSideWindow.makeFirstResponder(nil)
|
|
|
|
+// }
|
|
|
|
+// rightSideController.view().setFrame(SKShrinkRect(NSInsetRect(rightSideContentView.bounds, -1.0, -1.0), 1.0, .maxYEdge))
|
|
|
|
+// rightSideContentView.addSubview(rightSideController.view())
|
|
|
|
+//
|
|
|
|
+// rightSideWindow = nil
|
|
|
|
+// }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func forceSubwindowsOnTop(_ flag: Bool) {
|
|
|
|
+// let winC: NSWindowController = self.kmCurrentWindowC!
|
|
|
|
+// for wc in winC.document!.windowControllers {
|
|
|
|
+// let sel = NSSelectorFromString("setForceOnTop:")
|
|
|
|
+// if wc.responds(to: sel){
|
|
|
|
+// wc.
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func enterPresentationMode() {
|
|
|
|
+ let scrollView = listView.documentView().enclosingScrollView
|
|
|
|
+ savedNormalSetup.setValue(scrollView?.hasHorizontalScroller, forKey: HASHORIZONTALSCROLLER_KEY)
|
|
|
|
+ savedNormalSetup.setValue(scrollView?.hasVerticalScroller, forKey: HASVERTICALSCROLLER_KEY)
|
|
|
|
+ savedNormalSetup.setValue(scrollView?.autohidesScrollers, forKey: AUTOHIDESSCROLLERS_KEY)
|
|
|
|
+ // Set up presentation mode
|
|
|
|
+// if RUNNING(version: 10_12) {
|
|
|
|
+// pdfView.setBackgroundColor(NSColor.black)
|
|
|
|
+// } else {
|
|
|
|
+ listView.backgroundColor = NSColor.clear
|
|
|
|
+// }
|
|
|
|
+ listView.autoScales = true
|
|
|
|
+// listView.setDisplayMode(kPDFDisplaySinglePage)
|
|
|
|
+ listView.setDisplay(.singlePage)
|
|
|
|
+// listView.setDisplayBox(kPDFDisplayBoxCropBox)
|
|
|
|
+ listView.displayBox = .cropBox
|
|
|
|
+// listView.setDisplaysPageBreaks(false)
|
|
|
|
+ listView.displaysPageBreaks = false
|
|
|
|
+// scrollView.setAutohidesScrollers(true)
|
|
|
|
+ scrollView?.autohidesScrollers = true
|
|
|
|
+// scrollView.setHasHorizontalScroller(false)
|
|
|
|
+ scrollView?.hasHorizontalScroller = false
|
|
|
|
+// scrollView.setHasVerticalScroller(false)
|
|
|
|
+ scrollView?.hasVerticalScroller = false
|
|
|
|
+
|
|
|
|
+ listView.setCurrentSelection(nil, animate: true)
|
|
|
|
+// if listView.hasReadingBar() {
|
|
|
|
+// listView.toggleReadingBar()
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// myDocument!.currentPage(presentationNotesDocument.pdfDocument().page(at: listView.currentPage().pageIndex()))
|
|
|
|
+
|
|
|
|
+ // Prevent sleep
|
|
|
|
+// if activityAssertionID == kIOPMNullAssertionID && kIOReturnSuccess != IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, "Skim" as CFString, &activityAssertionID) {
|
|
|
|
+// activityAssertionID = kIOPMNullAssertionID
|
|
|
|
+// }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func currentPDFSettings() -> NSDictionary {
|
|
|
|
+ var setup = NSMutableDictionary()
|
|
|
|
+ setup[DISPLAYSPAGEBREAKS_KEY] = NSNumber(value: listView.displaysPageBreaks)
|
|
|
|
+ setup[DISPLAYSASBOOK_KEY] = NSNumber(value: listView.displaysAsBook)
|
|
|
|
+ setup[DISPLAYBOX_KEY] = NSNumber(value: listView.displayBox.rawValue)
|
|
|
|
+ setup[SCALEFACTOR_KEY] = NSNumber(value: listView.scaleFactor)
|
|
|
|
+ setup[AUTOSCALES_KEY] = NSNumber(value: listView.autoScales)
|
|
|
|
+ setup[DISPLAYMODE_KEY] = NSNumber(value: listView.displayMode.rawValue)
|
|
|
|
+
|
|
|
|
+ return setup
|
|
|
|
+ }
|
|
|
|
+
|
|
//MARK: menuItem Action
|
|
//MARK: menuItem Action
|
|
|
|
|
|
@objc func menuItemEditingClick_FontColor(sender: NSMenuItem) {
|
|
@objc func menuItemEditingClick_FontColor(sender: NSMenuItem) {
|