|
@@ -188,18 +188,29 @@ extension KMMainViewController {
|
|
func enterAnnotationStype() -> NSMenuItem {
|
|
func enterAnnotationStype() -> NSMenuItem {
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Annotation", comment: ""), action: nil, target: self)
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Annotation", comment: ""), action: nil, target: self)
|
|
let stypeMenu = NSMenu()
|
|
let stypeMenu = NSMenu()
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Freehand", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 0)
|
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Text", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 1)
|
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Note", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 2)
|
|
|
|
|
|
+ if listView.currentSelection != nil && listView.currentSelection.selectionType() == .text {
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Highlight", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 0)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Underline", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 1)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Strikethrough", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 2)
|
|
|
|
+ stypeMenu.addItem(NSMenuItem.separator())
|
|
|
|
+ }
|
|
|
|
+// 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("Anchored Note", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 2)
|
|
|
|
+// stypeMenu.insertItem(NSMenuItem.separator(), at: 10000)
|
|
|
|
+ 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)
|
|
if self.isReadMode {
|
|
if self.isReadMode {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
+ 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("Signature", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 9)
|
|
stypeMenu.addItem(withTitle: NSLocalizedString("Signature", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 9)
|
|
}
|
|
}
|
|
stypItem.submenu = stypeMenu
|
|
stypItem.submenu = stypeMenu
|
|
@@ -230,11 +241,24 @@ 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()
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Default Tool", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 0)
|
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Scroll Tool", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 1)
|
|
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Text", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 0)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Scroll", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 1)
|
|
stypeMenu.addItem(withTitle: NSLocalizedString("Magnify", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 2)
|
|
stypeMenu.addItem(withTitle: NSLocalizedString("Magnify", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 2)
|
|
stypeMenu.addItem(withTitle: NSLocalizedString("Select", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 3)
|
|
stypeMenu.addItem(withTitle: NSLocalizedString("Select", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 3)
|
|
- 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.addItem(withTitle: NSLocalizedString("Highlight", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 5)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Underline", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 6)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Strikethrough", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 7)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Freehand", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 8)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Text Note", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 9)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Anchored Note", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 10)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Rectangle", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 11)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Circle", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 12)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Arrow", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 13)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Line", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 14)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Link", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 15)
|
|
|
|
+
|
|
stypItem.submenu = stypeMenu
|
|
stypItem.submenu = stypeMenu
|
|
if self.toolbarController.toolbarType == .Annatiton {
|
|
if self.toolbarController.toolbarType == .Annatiton {
|
|
stypeMenu.item(at: 0)?.state = .on
|
|
stypeMenu.item(at: 0)?.state = .on
|
|
@@ -270,7 +294,12 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
func setShareStype() -> NSMenuItem {
|
|
func setShareStype() -> NSMenuItem {
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Share", comment: ""), action: #selector(showShareAction), target: self)
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Share", comment: ""), action: #selector(showShareAction), target: self)
|
|
-
|
|
|
|
|
|
+ var string = ""
|
|
|
|
+ if listView.activeAnnotation != nil {
|
|
|
|
+ string = listView.activeAnnotation.contents
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ stypItem.submenu = NSSharingServicePicker.menu(forSharingItems: [string], subjectContext: "", withTarget: self, selector: #selector(shareFromService), serviceDelegate: nil)
|
|
return stypItem
|
|
return stypItem
|
|
}
|
|
}
|
|
func setLookUpStype() -> NSMenuItem {
|
|
func setLookUpStype() -> NSMenuItem {
|
|
@@ -284,16 +313,59 @@ extension KMMainViewController {
|
|
|
|
|
|
return stypItem
|
|
return stypItem
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ func setCutStype() -> NSMenuItem {
|
|
|
|
+ let stypItem = NSMenuItem(title: NSLocalizedString("Cut", comment: ""), action: #selector(cutAction), target: self)
|
|
|
|
+
|
|
|
|
+ return stypItem
|
|
|
|
+ }
|
|
|
|
+ func setDeleteStype() -> NSMenuItem {
|
|
|
|
+ let stypItem = NSMenuItem(title: NSLocalizedString("Delete", comment: ""), action: #selector(deleteAction), target: self)
|
|
|
|
+
|
|
|
|
+ return stypItem
|
|
|
|
+ }
|
|
|
|
+ func setColorsStype() -> NSMenuItem {
|
|
|
|
+ let stypItem = NSMenuItem(title: NSLocalizedString("Colors...", comment: ""), action: #selector(ColorsItemAction), target: self)
|
|
|
|
+
|
|
|
|
+ return stypItem
|
|
|
|
+ }
|
|
|
|
+ func setLinesStype() -> NSMenuItem {
|
|
|
|
+ let stypItem = NSMenuItem(title: NSLocalizedString("Lines...", comment: ""), action: #selector(LinesItemAction), target: self)
|
|
|
|
+
|
|
|
|
+ return stypItem
|
|
|
|
+ }
|
|
|
|
+ func setEditNoteStype() -> NSMenuItem {
|
|
|
|
+ let stypItem = NSMenuItem(title: NSLocalizedString("Edit Note", comment: ""), action: #selector(EditNoteItemAction), target: self)
|
|
|
|
+
|
|
|
|
+ return stypItem
|
|
|
|
+ }
|
|
|
|
+ func setRotateStype() -> NSMenuItem {
|
|
|
|
+ let stypItem = NSMenuItem(title: NSLocalizedString("Rotate", comment: ""), action: nil, target: self)
|
|
|
|
+ let stypeMenu = NSMenu()
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Rotate Left", comment: ""), action: #selector(rotateLeftAction), target: self, tag: 0)
|
|
|
|
+ stypeMenu.addItem(withTitle: NSLocalizedString("Rotate Right", comment: ""), action: #selector(rotateRightAction), target: self, tag: 1)
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ return stypItem
|
|
|
|
+ }
|
|
func setNextPageStype() -> NSMenuItem {
|
|
func setNextPageStype() -> NSMenuItem {
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Next Page", comment: ""), action: #selector(NextPageAction), target: self)
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Next Page", comment: ""), action: #selector(NextPageAction), target: self)
|
|
-
|
|
|
|
|
|
+ stypItem.isEnabled = false
|
|
|
|
+ if listView.canGoToNextPage() {
|
|
|
|
+ stypItem.isEnabled = true
|
|
|
|
+ }
|
|
return stypItem
|
|
return stypItem
|
|
}
|
|
}
|
|
|
|
|
|
func setPreviousPageStype() -> NSMenuItem {
|
|
func setPreviousPageStype() -> NSMenuItem {
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Previous Page", comment: ""), action: #selector(PreviousPageAction), target: self)
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Previous Page", comment: ""), action: #selector(PreviousPageAction), target: self)
|
|
-
|
|
|
|
|
|
+ stypItem.isEnabled = false
|
|
|
|
+ if listView.canGoToPreviousPage() {
|
|
|
|
+ stypItem.isEnabled = true
|
|
|
|
+ }
|
|
return stypItem
|
|
return stypItem
|
|
}
|
|
}
|
|
|
|
|
|
@@ -651,6 +723,12 @@ extension KMMainViewController {
|
|
}
|
|
}
|
|
@objc func customCropModel(sender: NSMenuItem) {
|
|
@objc func customCropModel(sender: NSMenuItem) {
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ @objc func rotateRightAction(sender: NSMenuItem) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ @objc func rotateLeftAction(sender: NSMenuItem) {
|
|
|
|
+
|
|
}
|
|
}
|
|
@objc func menuItemAnnotationClick_toolModel(sender: NSMenuItem) {
|
|
@objc func menuItemAnnotationClick_toolModel(sender: NSMenuItem) {
|
|
self.listView.toolMode = .noteToolMode
|
|
self.listView.toolMode = .noteToolMode
|
|
@@ -679,6 +757,10 @@ extension KMMainViewController {
|
|
self.toolbarController.mainToolBarView?.delegate?.toolbarViewController?(self.toolbarController.mainToolBarView!, clickMode:model, toolbar: item, [])
|
|
self.toolbarController.mainToolBarView?.delegate?.toolbarViewController?(self.toolbarController.mainToolBarView!, clickMode:model, toolbar: item, [])
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func changeAnnotationMode(sender : NSMenuItem) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc func menuItemAnnotationClick_add(sender : NSMenuItem) {
|
|
@objc func menuItemAnnotationClick_add(sender : NSMenuItem) {
|
|
var annotationType : CAnnotationType = .unkown
|
|
var annotationType : CAnnotationType = .unkown
|
|
switch sender.tag {
|
|
switch sender.tag {
|