Selaa lähdekoodia

【BOTA】缩图 删除快捷键补充

lizhe 1 vuosi sitten
vanhempi
commit
ff05a71596

+ 18 - 1
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMThumbnailViewController.swift

@@ -54,7 +54,16 @@ class KMThumbnailViewController: NSViewController {
         self.pdfCurrentPageChange()
         
         self.initNotification()
-        
+     
+//        localMonitor =  [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyUp | NSEventMaskKeyDown  handler:^NSEvent * _Nullable(NSEvent * _Nonnull aEvent) {
+//            if (aEvent.type == NSEventTypeKeyUp) {
+//                return [self self_keyUp:aEvent];
+//            } else if (aEvent.type == NSEventTypeKeyDown) {
+//    //            [SourceMultiSelectManager sourceMultiSelectManager].holdCommand = NO;
+//    //            [SourceMultiSelectManager sourceMultiSelectManager].holdShift = NO;
+//            }
+//            return aEvent;
+//        }];
         self.view.window?.makeFirstResponder(self)
     }
     
@@ -568,11 +577,17 @@ extension KMThumbnailViewController: KMThumbnailViewControllerAction {
     @IBAction func paste(_ sender: Any) {
         self.pastePageItemAction(menu: NSMenuItem())
     }
+    
+    @IBAction func delete(_ sender: Any) {
+        self.deletePageItemAction(menu: NSMenuItem())
+        
+    }
 }
 
 //MARK: KMPDFThumbnailViewDelegate
 extension KMThumbnailViewController : KMPDFThumbnailViewDelegate {
     func thumbnailView(thumbanView: KMPDFThumbnailView, didSelectPageAtIndex index: UInt) {
+        self.view.window?.makeFirstResponder(self)
         if thumbanView.collectionView.selectionIndexes.count == 1 {
             let page : CPDFPage = self.listView.document.page(at: index)
             self.listView.go(toPageIndex: Int(page.pageIndex()), animated: true)
@@ -669,6 +684,8 @@ extension KMThumbnailViewController : NSMenuDelegate,NSMenuItemValidation {
 //        item = menu.addItem(withTitle: NSLocalizedString("Extract", comment: ""), action: #selector(extractPageItemAction), target: self)
 //        item.representedObject = row
         item = menu.addItem(withTitle: NSLocalizedString("Delete Page", comment: ""), action: #selector(deletePageItemAction), target: self)
+        item.keyEquivalent = String(Unicode.Scalar(NSBackspaceCharacter)!)
+        item.keyEquivalentModifierMask = []
         item.representedObject = row
         item = menu.addItem(withTitle: NSLocalizedString("Page Edit", comment: ""), action: #selector(pageEditItemAction), target: self)
         item.representedObject = row