|
@@ -2097,67 +2097,46 @@ import Cocoa
|
|
|
self.mouseRightMenuEvent = theEvent
|
|
|
let currentMenu : NSMenu = menu.pointee!
|
|
|
|
|
|
-// if (listView.toolMode == .redactToolMode) {
|
|
|
-// if (listView.activeAnnotation == nil) {
|
|
|
-//
|
|
|
-// } else {
|
|
|
-// let currentPoint: NSPoint = pdfListView.convert(theEvent.locationInWindow, from: pdfListView.superview)
|
|
|
-// let currentPage = pdfListView.page(for: currentPoint, nearest: true)
|
|
|
-//// let currentPage = pdfListView.activeAnnotation.page
|
|
|
-// let pagePoint = pdfListView.convert(currentPoint, to: currentPage)
|
|
|
-//
|
|
|
-// currentMenu.removeAllItems()
|
|
|
-// if (pdfListView.activeAnnotation.bounds.contains(pagePoint)) {
|
|
|
-// currentMenu.insertItem(withTitle: NSLocalizedString("Delete", comment: ""), action: #selector(redact_menuItemClick_delete), target: self, at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
-//
|
|
|
-// currentMenu.insertItem(withTitle: NSLocalizedString("Properties...", comment: ""), action: #selector(redact_menuItemClick_setProperty), target: self, at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(withTitle: NSLocalizedString("Use Current Properties as New Default", comment: ""), action: #selector(redact_menuItemClick_setCurrentPropertyToDefaultValue), target: self, at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
-//
|
|
|
-// currentMenu.insertItem(withTitle: NSLocalizedString("Repeat mark across pages", comment: ""), action: #selector(redact_menuItemClick_MultiPageFlag), target: self, at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(withTitle: NSLocalizedString("Apply Redactions", comment: ""), action: #selector(redact_menuItemClick_apply), target: self, at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(withTitle: NSLocalizedString("Erase Redactions", comment: ""), action: #selector(redact_menuItemClick_clear), target: self, at: currentMenu.items.count)
|
|
|
-// } else {
|
|
|
-// currentMenu.insertItem(withTitle: NSLocalizedString("Paste", comment: ""), action: #selector(redact_menuItemClick_paste), target: self, at: currentMenu.items.count)
|
|
|
-//
|
|
|
-// currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(self.findStringMenu(), at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(self.printingMenu(), at: currentMenu.items.count)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return
|
|
|
-// }
|
|
|
+ if currentMenu.items.count > 3 {
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count - 3)
|
|
|
+ currentMenu.insertItem(self.addReadModelStype(), at: currentMenu.items.count - 3)
|
|
|
+ }
|
|
|
if listView.currentSelection != nil{
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
- currentMenu.insertItem(self.setSearchBaiduStype(), at: 3)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
- currentMenu.insertItem(self.setLookUpStype(), at: 3)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
- currentMenu.insertItem(self.addOutlineStype(), at: 3)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
- currentMenu.insertItem(self.setAnnotationToolStype(), at: 3)
|
|
|
- currentMenu.insertItem(self.setTTSStype(), at: 3)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
- currentMenu.insertItem(self.setShareStype(), at: 3)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
+ if listView.currentSelection.selectionType() == .text {
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
+ currentMenu.insertItem(self.setSearchBaiduStype(), at: 3)
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
+ currentMenu.insertItem(self.setLookUpStype(), at: 3)
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
+ currentMenu.insertItem(self.addOutlineStype(), at: 3)
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
+ currentMenu.insertItem(self.setAnnotationToolStype(), at: 3)
|
|
|
+ currentMenu.insertItem(self.setTTSStype(), at: 3)
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
+ currentMenu.insertItem(self.setShareStype(), at: 3)
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
+
|
|
|
+ }
|
|
|
currentMenu.insertItem(self.enterAnnotationStype(), at: 3)
|
|
|
currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(self.addReadModelStype(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(self.setNextPageStype(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(self.setPreviousPageStype(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(self.setTranslateStype(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(self.setServicesStype(), at: currentMenu.items.count)
|
|
|
+ if listView.currentSelection.selectionType() == .image{
|
|
|
+ currentMenu.insertItem(self.setCutStype(), at: 1)
|
|
|
+ currentMenu.insertItem(self.setDeleteStype(), at: 4)
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: 6)
|
|
|
+ currentMenu.insertItem(self.setEditNoteStype(), at: 6)
|
|
|
+ currentMenu.insertItem(self.setRotateStype(), at: 6)
|
|
|
+ currentMenu.insertItem(self.setLinesStype(), at: 6)
|
|
|
+ currentMenu.insertItem(self.setColorsStype(), at: 6)
|
|
|
+ }
|
|
|
+ if listView.currentSelection.selectionType() == .text {
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
+ currentMenu.insertItem(self.setTranslateStype(), at: currentMenu.items.count)
|
|
|
+ currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
+ currentMenu.insertItem(self.setServicesStype(), at: currentMenu.items.count)
|
|
|
+ }
|
|
|
}
|
|
|
if listView.activeAnnotation == nil && listView.currentSelection == nil{
|
|
|
currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(self.addReadModelStype(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(self.setNextPageStype(), at: currentMenu.items.count)
|
|
|
- currentMenu.insertItem(self.setPreviousPageStype(), at: currentMenu.items.count)
|
|
|
if(listView.toolMode == .selectToolMode) {
|
|
|
if NSIsEmptyRect(listView.currentSelectionRect()) {
|
|
|
currentMenu.insertItem(self.zoomSelectionMenuItem(), at: 0)
|
|
@@ -2194,139 +2173,13 @@ import Cocoa
|
|
|
currentMenu.removeItem(currentMenu.item(withTitle: "Zoom")!)
|
|
|
}
|
|
|
// currentMenu.insertItem(self.findStringMenu(), at: currentMenu.items.count)
|
|
|
- // currentMenu.insertItem(self.printingMenu(), at: currentMenu.items.count)
|
|
|
-
|
|
|
-// currentMenu.insertItem(self.setTranslateStype(), at: currentMenu.items.count)
|
|
|
+
|
|
|
+
|
|
|
currentMenu.insertItem(self.setAutoScrollStype(), at: currentMenu.items.count)
|
|
|
}
|
|
|
currentMenu.insertItem(self.setAnnotationToolStype(), at: 5)
|
|
|
}
|
|
|
|
|
|
-// if(listView.toolMode == .selectToolMode) {
|
|
|
-// if currentMenu.items.count > 0 {
|
|
|
-// let export = NSMenuItem(title: NSLocalizedString("Export", comment: ""), action: nil, target: self)
|
|
|
-// export.submenu = self.exportMenu()
|
|
|
-// currentMenu.insertItem(export, at: currentMenu.items.count)
|
|
|
-// let corp = NSMenuItem(title: NSLocalizedString("Crop", comment: ""), action:#selector(cropCurrentPage), target: self)
|
|
|
-//// corp?.submenu = self.cropMenu()
|
|
|
-// currentMenu.insertItem(corp, at: currentMenu.items.count)
|
|
|
-// // MARK: 暂时拿掉 2023.04.26
|
|
|
-//// currentMenu.insertItem(self.zoomSelectionMenuItem(), at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(self.printingMenu(), at: currentMenu.items.count)
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// if listView.currentSelection != nil {
|
|
|
-// if (listView.currentSelection.string() != nil || listView.currentSelection.selectionType() == .image) {
|
|
|
-// if listView.activeAnnotation != nil && ((listView.activeAnnotation is CPDFStampAnnotation) || (listView.activeAnnotation is CPDFSignatureAnnotation)) {
|
|
|
-// currentMenu.insertItem(self.exportImageStampItem(), at: currentMenu.items.count-2)
|
|
|
-// } else {
|
|
|
-// var isMarkup = false
|
|
|
-// for item in self.listView.activeAnnotations {
|
|
|
-// if (item is CPDFMarkupAnnotation) {
|
|
|
-// isMarkup = true
|
|
|
-// break
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(!isMarkup) {
|
|
|
-// self.addAnnotationForStyleMenu(menu: currentMenu)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } else if (listView.activeAnnotation == nil) {
|
|
|
-// if(currentMenu.items.count > 2) {
|
|
|
-// currentMenu.insertItem(self.enterAnnotationStype(), at: 2)
|
|
|
-// }
|
|
|
-// if(currentMenu.items.count > 2) {
|
|
|
-// currentMenu.insertItem(NSMenuItem.separator(), at: 3)
|
|
|
-// }
|
|
|
-// if(currentMenu.items.count > 3) {
|
|
|
-// currentMenu.insertItem(self.setAnnotationToolStype(), at: 4)
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(currentMenu.items.count > 4) {
|
|
|
-// currentMenu.insertItem(NSMenuItem.separator(), at: 5)
|
|
|
-// }
|
|
|
-// if(currentMenu.items.count > 5) {
|
|
|
-// currentMenu.insertItem(self.addBookmarkMenu(), at: 6)
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (currentMenu.items.count > 6) {
|
|
|
-// currentMenu.insertItem(self.addOutlineStype(), at: 7)
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (currentMenu.items.count > 6 && self.isReadMode) {
|
|
|
-// currentMenu.removeItem(currentMenu.item(withTitle: "Zoom")!)
|
|
|
-// }
|
|
|
-// if(currentMenu.items.count > 7) {
|
|
|
-// currentMenu.insertItem(NSMenuItem.separator(), at: 8)
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-//// if(currentMenu.items.count > 6) {
|
|
|
-//// let menuItem = NSMenuItem(title: NSLocalizedString("Automatic rolling", comment: ""), action:nil, target: self)!
|
|
|
-//// currentMenu.insertItem(menuItem, at: 6)
|
|
|
-//// }
|
|
|
-//// if(currentMenu.items.count > 7) {
|
|
|
-//// let menuItem = NSMenuItem(title: NSLocalizedString("TTS", comment: ""), action:nil, target: self)!
|
|
|
-//// currentMenu.insertItem(menuItem, at: 7)
|
|
|
-//// }
|
|
|
-//// if(currentMenu.items.count > 8) {
|
|
|
-//// let menuItem = NSMenuItem(title: NSLocalizedString("menuItem", comment: ""), action:nil, target: self)!
|
|
|
-//// currentMenu.insertItem(menuItem, at: 8)
|
|
|
-//// }
|
|
|
-//
|
|
|
-//// if !self.isReadMode {
|
|
|
-//// if (currentMenu.items.count > 10) {
|
|
|
-//// currentMenu.insertItem(self.addHighlightLinksStype(), at: 11)
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-//
|
|
|
-// if self.isReadMode {
|
|
|
-//
|
|
|
-// } else {
|
|
|
-// currentMenu.insertItem(NSMenuItem.separator(), at: currentMenu.items.count)
|
|
|
-//// currentMenu.insertItem(self.findStringMenu(), at: currentMenu.items.count)
|
|
|
-//// currentMenu.insertItem(self.printingMenu(), at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(self.setNextPageStype(), at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(self.setPreviousPageStype(), at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(self.setTranslateStype(), at: currentMenu.items.count)
|
|
|
-// currentMenu.insertItem(self.setAutoScrollStype(), at: currentMenu.items.count)
|
|
|
-// }
|
|
|
-// } else if listView.activeAnnotation != nil {
|
|
|
-// var type : CAnnotationType = .unkown
|
|
|
-// if listView.activeAnnotation is CPDFMarkupAnnotation {
|
|
|
-// if (listView.activeAnnotation as! CPDFMarkupAnnotation).markupType() == .highlight {
|
|
|
-// type = .highlight
|
|
|
-// } else if (listView.activeAnnotation as! CPDFMarkupAnnotation).markupType() == .underline {
|
|
|
-// type = .underline
|
|
|
-// } else {
|
|
|
-// type = .strikeOut
|
|
|
-// }
|
|
|
-// } else if listView.activeAnnotation is CPDFInkAnnotation {
|
|
|
-// type = .ink
|
|
|
-// } else if listView.activeAnnotation is CPDFFreeTextAnnotation {
|
|
|
-// type = .freeText
|
|
|
-// } else if listView.activeAnnotation is CPDFTextAnnotation {
|
|
|
-// type = .anchored
|
|
|
-// } else if listView.activeAnnotation is CPDFCircleAnnotation {
|
|
|
-// type = .circle
|
|
|
-// } else if listView.activeAnnotation is CPDFSquareAnnotation {
|
|
|
-// type = .square
|
|
|
-// }
|
|
|
-// if ((listView.activeAnnotation is CPDFStampAnnotation) || (listView.activeAnnotation is CPDFSignatureAnnotation)) {
|
|
|
-// if listView.activeAnnotations.count == 1 {
|
|
|
-// currentMenu.insertItem(self.exportImageStampItem(), at: currentMenu.items.count-2)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if type != .unkown && listView.activeAnnotations.count == 1{
|
|
|
-// currentMenu.insertItem(self.setDefaultAnnotationPorpert(type: type), at: currentMenu.items.count)
|
|
|
-// }
|
|
|
-//// closeRightPane()
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
for item in currentMenu.items {
|
|
|
if (item.action == NSSelectorFromString("menuItemClick_HidenorShowNote:")) {
|
|
|
// 显示与隐藏注释 item action 截取
|