Bladeren bron

【PDF阅读】- 右键菜单&子菜单

jiajie 1 jaar geleden
bovenliggende
commit
83ab060f29

File diff suppressed because it is too large
+ 364 - 307
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m


+ 92 - 10
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -188,18 +188,29 @@ extension KMMainViewController {
     func enterAnnotationStype() -> NSMenuItem {
         let stypItem = NSMenuItem(title: NSLocalizedString("Annotation", comment: ""), action: nil, target: self)
         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("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("Line", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 6)
+//        stypeMenu.insertItem(NSMenuItem.separator(), at: 10000)
         if self.isReadMode {
             
         } else {
+            stypeMenu.addItem(NSMenuItem.separator())
             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("Image", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 10)
             stypeMenu.addItem(withTitle: NSLocalizedString("Signature", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 9)
         }
         stypItem.submenu = stypeMenu
@@ -230,11 +241,24 @@ extension KMMainViewController {
     func setAnnotationToolStype() -> NSMenuItem {
         let stypItem = NSMenuItem(title: NSLocalizedString("Tool Mode", comment: ""), action: nil, target: self)
         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("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
         if self.toolbarController.toolbarType == .Annatiton {
             stypeMenu.item(at: 0)?.state = .on
@@ -270,7 +294,12 @@ extension KMMainViewController {
     }
     func setShareStype() -> NSMenuItem {
         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
     }
     func setLookUpStype() -> NSMenuItem {
@@ -284,16 +313,59 @@ extension KMMainViewController {
         
         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 {
         let stypItem = NSMenuItem(title: NSLocalizedString("Next Page", comment: ""), action: #selector(NextPageAction), target: self)
-        
+        stypItem.isEnabled = false
+        if listView.canGoToNextPage() {
+            stypItem.isEnabled = true
+        }
         return stypItem
     }
     
     func setPreviousPageStype() -> NSMenuItem {
         let stypItem = NSMenuItem(title: NSLocalizedString("Previous Page", comment: ""), action: #selector(PreviousPageAction), target: self)
-        
+        stypItem.isEnabled = false
+        if listView.canGoToPreviousPage() {
+            stypItem.isEnabled = true
+        }
         return stypItem
     }
     
@@ -651,6 +723,12 @@ extension KMMainViewController {
     }
     @objc func customCropModel(sender: NSMenuItem) {
         
+    }
+    @objc func rotateRightAction(sender: NSMenuItem) {
+        
+    }
+    @objc func rotateLeftAction(sender: NSMenuItem) {
+        
     }
     @objc func menuItemAnnotationClick_toolModel(sender: NSMenuItem) {
         self.listView.toolMode = .noteToolMode
@@ -679,6 +757,10 @@ extension KMMainViewController {
         self.toolbarController.mainToolBarView?.delegate?.toolbarViewController?(self.toolbarController.mainToolBarView!, clickMode:model, toolbar: item, [])
     }
     
+    @objc func changeAnnotationMode(sender : NSMenuItem) {
+        
+    }
+    
     @objc func menuItemAnnotationClick_add(sender : NSMenuItem) {
         var annotationType : CAnnotationType = .unkown
         switch sender.tag {

+ 18 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -566,6 +566,24 @@ extension KMMainViewController {
     }
     @objc func AutoScrollItemAction() {
         //增加判断,如果是正在滚动,就停止,否则就开始滚动
+    }
+    @objc func shareFromService(sender: NSMenuItem) {
+        
+    }
+    @objc func cutAction(sender: NSMenuItem) {
+        
+    }
+    @objc func deleteAction(sender: NSMenuItem) {
+        
+    }
+    @objc func ColorsItemAction(sender: NSMenuItem) {
+        
+    }
+    @objc func LinesItemAction(sender: NSMenuItem) {
+        
+    }
+    @objc func EditNoteItemAction(sender: NSMenuItem) {
+        
     }
     @objc func highlightLinks() {
         let highlightLinks = KMPreferenceManager.shared.highlightLinks

+ 36 - 183
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -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 截取