Преглед на файлове

【BOTA】快照模块补充右键菜单

tangchao преди 1 година
родител
ревизия
e67e0887ab

+ 64 - 0
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -420,5 +420,69 @@
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "7DE657D9-692B-4280-90C1-136451935B81"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "5421"
+            endingLineNumber = "5421"
+            landmarkName = "hideSnapshot(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "2EBC946B-9896-4938-9330-BB7C0B2909A1"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "5425"
+            endingLineNumber = "5425"
+            landmarkName = "showSnapshot(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "337BB0AD-43C4-4986-82C2-5A9BC3944735"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "5429"
+            endingLineNumber = "5429"
+            landmarkName = "deleteSnapshot(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "49F6EC92-C1AC-414B-BD4B-9D1D6032B7CD"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "5433"
+            endingLineNumber = "5433"
+            landmarkName = "menuItemClick_Copy(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 61 - 43
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -253,6 +253,7 @@ class KMLeftSideViewController: KMSideViewController {
         
         self.snapshotTableView.delegate = self
         self.snapshotTableView.dataSource = self
+        self.snapshotTableView.menu = NSMenu()
         self.snapshotTableView.menu?.delegate = self
         self.snapshotTableView.doubleAction = #selector(toggleSelectedSnapshots)
         self.snapshotTableView.target = self
@@ -4524,49 +4525,48 @@ extension KMLeftSideViewController: NSMenuDelegate {
 //                    [item setRepresentedObject:selections];
 //                }
             }
-        }
-//        else if ([menu isEqual:[rightSideController.snapshotTableView menu]]) {
-//            NSInteger row = [rightSideController.snapshotTableView clickedRow];
-//            if (row != -1) {
-//                SKSnapshotWindowController *controller = [[rightSideController.snapshotArrayController arrangedObjects] objectAtIndex:row];
-//
-//                if ([[controller window] isVisible]) {
-//                    item = [menu addItemWithTitle:NSLocalizedString(@"Hide", @"Menu item title") action:@selector(hideSnapshot:) target:self];
-//                    [item setRepresentedObject:controller];
-//                } else {
-//                    item = [menu addItemWithTitle:NSLocalizedString(@"Show", @"Menu item title") action:@selector(showSnapshot:) target:self];
-//                    [item setRepresentedObject:controller];
-//                }
-//                [menu addItem:[NSMenuItem separatorItem]];
-//
-//                item = [menu addItemWithTitle:NSLocalizedString(@"Export", @"Menu item title") action:nil target:self];
-//                NSMenu *subMenu = [NSMenu menu];
-//
-//                NSMenuItem *t = [subMenu addItemWithTitle:NSLocalizedString(@"PNG", @"Menu item title") action:@selector(menuItemClick_ExportPNG:) target:self];
-//                [t setRepresentedObject:controller];
-//
-//                t = [subMenu addItemWithTitle:NSLocalizedString(@"JPG", @"Menu item title") action:@selector(menuItemClick_ExportJPG:) target:self];
-//                [t setRepresentedObject:controller];
-//
-//                t = [subMenu addItemWithTitle:NSLocalizedString(@"PDF", @"Menu item title") action:@selector(menuItemClick_ExportPDF:) target:self];
-//                [t setRepresentedObject:controller];
-//                item.submenu = subMenu;
-//
-//                item = [menu addItemWithTitle:NSLocalizedString(@"Print", @"Menu item title") action:@selector(menuItemClick_Print:) target:self];
-//                [item setRepresentedObject:controller];
-//                [menu addItem:[NSMenuItem separatorItem]];
-//
-//                item = [menu addItemWithTitle:NSLocalizedString(@"Copy", @"Menu item title") action:@selector(menuItemClick_Copy:) target:self];
-//                [item setRepresentedObject:controller];
-//                [menu addItem:[NSMenuItem separatorItem]];
-//
-//                item = [menu addItemWithTitle:NSLocalizedString(@"Delete", @"Menu item title") action:@selector(deleteSnapshot:) target:self];
-//                [item setRepresentedObject:controller];
-//                item = [menu addItemWithTitle:NSLocalizedString(@"Delete All Snapshots", @"Menu item title") action:@selector(deleteAllSnapshot:) target:self];
-//                [item setRepresentedObject:controller];
-//            }
-//        }
-    else if menu.isEqual(to: self.noteOutlineView.menu) {
+        } else if menu.isEqual(to: self.snapshotTableView.menu) {
+            let row = self.snapshotTableView.clickedRow
+            if (row != -1) {
+                let model = self.snapshots[row]
+                let controller = model.windowC
+
+                if let data = controller?.window?.isVisible, data {
+                    item = menu.addItem(title: KMLocalizedString("Hide", "Menu item title"), action: #selector(hideSnapshot), target: self)
+                    item?.representedObject = controller
+                } else {
+                    item = menu.addItem(title: KMLocalizedString("Show", "Menu item title"), action: #selector(showSnapshot), target: self)
+                    item?.representedObject = controller
+                }
+                menu.addItem(.separator())
+
+                item = menu.addItem(title: KMLocalizedString("Export", "Menu item title"), action: nil, target: self)
+                let subMenu = NSMenu()
+
+                var t = subMenu.addItem(title: KMLocalizedString("PNG", "Menu item title"), action: #selector(menuItemClick_ExportPNG), target: self)
+                t?.representedObject = controller
+
+                t = subMenu.addItem(title: KMLocalizedString("JPG", "Menu item title"), action: #selector(menuItemClick_ExportJPG), target: self)
+                t?.representedObject = controller
+                
+                t = subMenu.addItem(title: KMLocalizedString("PDF", "Menu item title"), action: #selector(menuItemClick_ExportPDF), target: self)
+                t?.representedObject = controller
+                item?.submenu = subMenu
+
+                item = menu.addItem(title: KMLocalizedString("Print", "Menu item title"), action: #selector(menuItemClick_Print), target: self)
+                item?.representedObject = controller
+                menu.addItem(.separator())
+                
+                item = menu.addItem(title: KMLocalizedString("Copy", "Menu item title"), action: #selector(menuItemClick_Copy), target: self)
+                item?.representedObject = controller
+                menu.addItem(.separator())
+
+                item = menu.addItem(title: KMLocalizedString("Delete", "Menu item title"), action: #selector(deleteSnapshot), target: self)
+                item?.representedObject = controller
+                item = menu.addItem(title: KMLocalizedString("Delete All Snapshots", "Menu item title"), action: #selector(deleteAllSnapshot), target: self)
+                item?.representedObject = controller
+            }
+        } else if menu.isEqual(to: self.noteOutlineView.menu) {
             //            NSArray *items;
             var rowIndexes = self.noteOutlineView.selectedRowIndexes
             let row = self.noteOutlineView.clickedRow
@@ -4705,6 +4705,8 @@ extension KMLeftSideViewController: NSMenuDelegate {
     }
 }
 
+// MARK: - NSMenuItemValidation
+
 extension KMLeftSideViewController: NSMenuItemValidation {
     func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
         if (self.listView.document == nil || self.listView.document!.isLocked) {
@@ -5415,6 +5417,22 @@ extension KMLeftSideViewController {
         }
     }
     
+    @objc func hideSnapshot(_ sender: AnyObject?) {
+        KMPrint("hideSnapshot")
+    }
+    
+    @objc func showSnapshot(_ sender: AnyObject?) {
+        KMPrint("showSnapshot")
+    }
+    
+    @objc func deleteSnapshot(_ sender: AnyObject?) {
+        KMPrint("deleteSnapshot")
+    }
+    
+    @objc func menuItemClick_Copy(_ sender: AnyObject?) {
+        KMPrint("menuItemClick_Copy")
+    }
+    
     private func _snapshotListIsAllSelected() -> Bool {
         if self.snapshots.isEmpty {
             return false

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

@@ -2398,7 +2398,6 @@ extension KMMainViewController: KMSnapshotWindowControllerDelegate {
         let image = controller.thumbnailWithSize(400)
         controller.thumbnail = image
         
-//        [[self mutableArrayValueForKey:SNAPSHOTS_KEY] addObject:controller];
         let model = KMSnapshotModel()
         model.windowC = controller
         self.leftSideViewController.snapshots.append(model)