Bläddra i källkod

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

niehaoyu 9 månader sedan
förälder
incheckning
d8402bae9b

+ 6 - 2
PDF Office/PDF Master/Class/Common/Category/NSDocumentController+KMExtension.swift

@@ -55,9 +55,13 @@ extension NSDocumentController {
                         let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
                         selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
                         if (selectDocument?.browser.window.isVisible)! as Bool {
-                            selectDocument?.browser.window.orderFront(nil)
+                            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
+                                selectDocument?.browser.window.orderFront(nil)
+                            }
                         } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
-                            selectDocument?.browser.window.orderFront(nil)
+                            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
+                                selectDocument?.browser.window.orderFront(nil)
+                            }
                         }
                     }
                 } else {

+ 6 - 2
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -682,9 +682,13 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
                 let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
                 selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
                 if (selectDocument?.browser.window.isVisible)! as Bool {
-                    selectDocument?.browser.window.orderFront(nil)
+                    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
+                        selectDocument?.browser.window.orderFront(nil)
+                    }
                 } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
-                    selectDocument?.browser.window.orderFront(nil)
+                    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
+                        selectDocument?.browser.window.orderFront(nil)
+                    }
                 }
             }
         }

+ 5 - 1
PDF Office/PDF Master/Class/PDFTools/Redact/Controller/KMPDFRedactViewController.swift

@@ -9,7 +9,11 @@ import Cocoa
 
 class KMPDFRedactViewController: NSViewController {
     
-    var scaleFactor: CGFloat = 0
+    var scaleFactor: CGFloat = 0 {
+        didSet {
+            self.redactPdfView.scaleFactor = scaleFactor
+        }
+    }
     
     var callback: ((Bool, Int, Bool, URL?)->Void)?
     var titleBack: ((String)->Void)?

+ 3 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -790,7 +790,9 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                 [menu insertItem:cutItem atIndex:0];
             }
             if ([self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
-                [menu insertItem:pasteItem atIndex:0];
+                if ([menu.itemArray containsObject:pasteItem] == false) {
+                    [menu insertItem:pasteItem atIndex:0];
+                }
             }
             [menu insertItem:copyItem atIndex:0];
             

+ 3 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift

@@ -807,10 +807,9 @@ extension KMLeftSideViewController {
                     }
                 }
                 for annotation in annos {
-                    //                    if annotation.isKind(of: KMTableAnnotation.self) {
-                    //                        annos.removeObject(annotation)
-                    //                    } else
-                    if annotation.annotationShouldDisplay() == false {
+                    if annotation.isKind(of: KMTableAnnotation.self) {
+                        annos.removeObject(annotation)
+                    } else if annotation.annotationShouldDisplay() == false {
                         annos.removeObject(annotation)
                     } else if annotation.isKind(of: CPDFLinkAnnotation.self) {
                         annos.removeObject(annotation)

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

@@ -168,6 +168,11 @@ extension KMMainViewController {
     
     func exportImageArea()->NSMenuItem {
         let exportItem = NSMenuItem(title: NSLocalizedString("Export", comment: ""), action: #selector(menuItemEditingClick_ExportImage), target: self)
+        let menu = NSMenu()
+        let item1 = menu.insertItem(withTitle: NSLocalizedString("PNG", comment: ""), action:#selector(exportStampImage), target: self, tag:0, at: 0)
+        let item2 = menu.insertItem(withTitle: NSLocalizedString("JPG", comment: ""), action:#selector(exportCorpImage), target: self, tag:1, at: 1)
+        let item3 = menu.insertItem(withTitle: NSLocalizedString("PDF", comment: ""), action:#selector(exportStampImage), target: self, tag:2, at: 2)
+        exportItem.submenu = menu
         return exportItem
     }
     
@@ -1620,12 +1625,14 @@ extension KMMainViewController {
     
     
     @objc func exportStampImage(sender:NSMenuItem) {
-        if listView.activeAnnotation != nil && ((listView.activeAnnotation is CPDFStampAnnotation) || (listView.activeAnnotation is CPDFSignatureAnnotation)) {
+        if listView.activeAnnotation != nil && ((listView.activeAnnotation is CPDFStampAnnotation) || (listView.activeAnnotation is CPDFSignatureAnnotation)) || (self.listView.selectImageAreas != nil) {
             var image : NSImage = NSImage()
             if (listView.activeAnnotation is CPDFStampAnnotation) {
                 image = (listView.activeAnnotation as! CPDFStampAnnotation).stampImage()
             } else if (listView.activeAnnotation is CPDFSignatureAnnotation) {
                 image = (listView.activeAnnotation as! CPDFSignatureAnnotation).signImage
+            } else {
+                image = self.listView.selectImageAreas.thumbnailImage(with: CGSize(width: 1920, height: 1920)) ?? NSImage()
             }
             let data = image.tiffRepresentation
             if sender.tag == 0 {

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

@@ -311,10 +311,10 @@ import Cocoa
                 }
             } else {
                 self.passwordWindow = nil
-            }
-            
-            if self.model.needConvertNotes && self.tabViewIsDragging() == false {
-                self.showConvertNotesProgress()
+                
+                if self.model.needConvertNotes && self.tabViewIsDragging() == false {
+                    self.showConvertNotesProgress()
+                }
             }
         }
     }