Explorar el Código

Merge branch 'develop_PDFReaderProMetal2' into develop_PDFReaderProV4.6.0

# Conflicts:
#	PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift
lizhe hace 7 meses
padre
commit
b590df9b69
Se han modificado 55 ficheros con 1539 adiciones y 752 borrados
  1. 3 2
      PDF Office/PDF Master/Class/ChromiumTabs/src/Tab/CTTabController.m
  2. 4 4
      PDF Office/PDF Master/Class/Document/KMMainDocument.swift
  3. 39 161
      PDF Office/PDF Master/Class/PDFTools/Merge/View/KMPDFThumbnialPageView.swift
  4. 0 14
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift
  5. 2 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m
  6. 2 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Tool.h
  7. 6 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Tool.m
  8. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/ComPDFKit
  9. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFAnnotation.h
  10. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFDocument.h
  11. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKitConfig+Private.h
  12. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKitConfig.h
  13. 2 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKitPlatform.h
  14. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFPage.h
  15. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFSelection.h
  16. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFUtilities.h
  17. 6 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFView.h
  18. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/ComPDFKit.h
  19. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Modules/module.modulemap
  20. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Assets.car
  21. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib
  22. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib/keyedobjects-101300.nib
  23. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib/keyedobjects.nib
  24. 10 10
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Info.plist
  25. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/default.metallib
  26. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/formsign_tag.png
  27. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/formsign_tag@2x.png
  28. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/loupe-hi.png
  29. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/loupe-lo.png
  30. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/loupe-mask.png
  31. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/magnifier-ranged-hi.png
  32. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/magnifier-ranged-lo.png
  33. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/magnifier-ranged-mask.png
  34. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/popup_note.png
  35. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/popup_note@2x.png
  36. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/quick_bookmark.png
  37. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/quick_bookmark~ipad.png
  38. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/recoding_on.png
  39. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/recoding_on@2x.png
  40. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/recoding_play.png
  41. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/recoding_play@2x.png
  42. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/viewer_dragDontBack.png
  43. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/viewer_dragDontBack@2x.png
  44. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/viewer_dragDontFront.png
  45. 0 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/viewer_dragDontFront@2x.png
  46. 21 529
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/_CodeSignature/CodeResources
  47. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift
  48. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Thumbnail.swift
  49. 44 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Model/KMThumbnailCache.swift
  50. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m
  51. 14 2
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  52. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  53. BIN
      PDF Office/PDF Master/Source/default.metallib
  54. 16 0
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj
  55. 1362 23
      PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+ 3 - 2
PDF Office/PDF Master/Class/ChromiumTabs/src/Tab/CTTabController.m

@@ -253,11 +253,12 @@ static NSString* const kBrowserThemeDidChangeNotification =
 }
 
 - (IBAction)closeTab:(id)sender {
-	if ([[self target] respondsToSelector:@selector(closeTab:)]) {
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"KMTabControllerWillCloseTabs" object:self];
+    if ([[self target] respondsToSelector:@selector(closeTab:)]) {
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"KMTabControllerCloseTabs" object:self];
 		[[self target] performSelector:@selector(closeTab:)
 							withObject:[self view]];
 	}
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"KMTabControllerCloseTabs" object:self];
     [[iRate sharedInstance] appLaunched];
 }
 

+ 4 - 4
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -505,11 +505,11 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
         // Insert code here to read your document from the given data of the specified type, throwing an error in case of failure.
         // Alternatively, you could remove this method and override read(from:ofType:) instead.  If you do, you should also override isEntireFileLoaded to return false if the contents are lazily loaded.
         
-        let pdfDocument = CPDFDocument.init(data: data)
+//        let pdfDocument = CPDFDocument.init(data: data)
         self.pdfData = data
-        if pdfDocument == nil {
-            throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
-        }
+//        if pdfDocument == nil {
+//            throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
+//        }
     }
     
     // MARK: Autosaving

+ 39 - 161
PDF Office/PDF Master/Class/PDFTools/Merge/View/KMPDFThumbnialPageView.swift

@@ -7,192 +7,70 @@
 
 import Cocoa
 
-extension CPDFPage {
-    private static var _pageEditImageKey = "KMPageEditImageKey"
-    var pageEditImage: NSImage? {
-        get {
-            return objc_getAssociatedObject(self, &CPDFPage._pageEditImageKey) as? NSImage
-        }
-        set {
-            objc_setAssociatedObject(self, &CPDFPage._pageEditImageKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
-        }
-    }
-}
-
-class KMPDFThumbnialPageLayer: CATiledLayer {
-    var page: CPDFPage?
-    
-    var isThumb = false
-    
-    override init() {
-        super.init()
-        
-        self.initDefaultValue()
-    }
-    
-    override init(layer: Any) {
-        super.init(layer: layer)
-        
-        self.initDefaultValue()
-    }
-    
-    required init?(coder: NSCoder) {
-        super.init(coder: coder)
-        
-        self.initDefaultValue()
-    }
-    
-    public func initDefaultValue() {
-        self.levelsOfDetail = 2
-        self.levelsOfDetailBias = 3
-        self.tileSize = CGSize(width: 1024, height: 1024)
-    }
-    
-    override func draw(in ctx: CGContext) {
-        super.draw(in: ctx)
-        
-        if (self.page != nil) {
-//            if let data = self.page?.pageEditImage {
-//                ctx.saveGState()
-//                var bounds = self.page!.bounds
-//                let transform = self.page!.transform()
-//                bounds = bounds.applying(transform);
-//
-//                let viewWidth: CGFloat = NSWidth(self.bounds)
-//                let viewHeight: CGFloat = NSHeight(self.bounds)
-//
-//                if (self.page!.rotation == -90 || self.page!.rotation == -270) {
-//                    let height = bounds.size.height
-//                    bounds.size.height = bounds.size.width
-//                    bounds.size.width = height
-//                }
-//
-//                ctx.scaleBy(x: viewWidth / bounds.size.width,
-//                            y: viewHeight / bounds.size.height);
-//                let bitmap = NSBitmapImageRep(data: data.tiffRepresentation!)
-//                ctx.draw((bitmap?.cgImage)!, in: NSMakeRect(0, 0, viewWidth, viewHeight))
-//                ctx.restoreGState()
-//                self.contents = bitmap?.cgImage
-//            } else {
-                ctx.saveGState();
-                
-                var bounds = self.page!.bounds
-                let transform = self.page!.transform()
-                bounds = bounds.applying(transform);
-                
-                let viewWidth: CGFloat = NSWidth(self.bounds)
-                let viewHeight: CGFloat = NSHeight(self.bounds)
-                
-                if (self.page!.rotation == -90 || self.page!.rotation == -270) {
-                    let height = bounds.size.height
-                    bounds.size.height = bounds.size.width
-                    bounds.size.width = height
-                }
-                
-                ctx.scaleBy(x: viewWidth / bounds.size.width,
-                            y: viewHeight / bounds.size.height);
-//                self.page!.drawEdit(with: .cropBox, to: ctx)
-//            self.page?.draw(with: .cropBox, to: ctx)
-//            if let tiffData = (self.page?.thumbnail(of: self.page?.size ?? .zero))?.tiffRepresentation {
-//            if let tiffData = self.page?.PDFListViewTIFFData(for: self.page?.bounds ?? .zero) {
-//                let image = NSImage(data: tiffData)
-//                image?.draw(in: ctx as! NSRect)
-//                image?.draw(in: bounds)
-//                let bitmap = NSBitmapImageRep(data: tiffData)
-//                ctx.draw((bitmap?.cgImage)!, in: NSMakeRect(0, 0, bounds.size.width, bounds.size.height))
-//                ctx.restoreGState();
-//                self.contents = bitmap?.cgImage
-//            } else {
-//            KMPrint("km_log_drawEdit \(self.isThumb) \(self.page)")
-//            km_synchronized(self.page!.document) {
-                self.page!.drawEdit(with: .cropBox, to: ctx)
-//            }
-//                self.page!.drawEdit(with: .cropBox, to: ctx)
-                ctx.restoreGState();
-//            }
-//                ctx.restoreGState();
-                
-                if let _image = ctx.makeImage() {
-                    let image = NSImage(cgImage: _image, size: NSSize(width: viewWidth, height: viewHeight))
-                    self.page?.pageEditImage = image
-                }
-//            }
-        }
-    }
-}
-
 class KMPDFThumbnialPageView: NSView {
-    internal var _page: CPDFPage?
+    private var pendingWordItem: DispatchWorkItem?
     var page: CPDFPage? {
-        get {
-            self._page
-        }
-        set {
-            self._page = newValue
-            
-            if pageLayer != nil {
-                pageLayer.contents = nil
-                pageLayer.delegate = nil
-                pageLayer.removeFromSuperlayer()
+        didSet {
+            let image = KMThumbnailCache.shared.thumbnail(for: Int(self.page?.pageIndex() ?? UInt(Int.max)))
+            if image != nil {
+                self.pageImageIv.image = image
+            } else {
+                self.pageImageIv.image = NSImage()
+                self.performTask()
             }
-            
-            pageLayer = KMPDFThumbnialPageLayer()
-            pageLayer.frame = self.bounds
-            pageLayer.page = newValue
-            self.layer?.addSublayer(pageLayer)
-            self.pageLayer.isThumb = self.isThumb
-            
-//            if let image = self._page?.pageEditImage {
-//                if (self.pageImageIv.superview == nil) {
-//                    self.addSubview(self.pageImageIv)
-//                }
-//                self.pageImageIv.image = image
-//                self.pageImageIv.imageScaling = .scaleAxesIndependently
-//                self.pageImageIv.translatesAutoresizingMaskIntoConstraints = false
-//                self.pageImageIv.frame = self.bounds
-//                self.pageImageIv.isHidden = false
-////                self.pageImageIv.image = image
-//            } else {
-//                self.pageImageIv.isHidden = true
-//            }
         }
     }
     
-    var pageLayer: KMPDFThumbnialPageLayer!
     var pageImageIv = NSImageView()
     
     var isThumb = false
     
     override init(frame frameRect: NSRect) {
         super.init(frame: frameRect)
-        
+        self.setup();
+    }
+    
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+    }
+    
+    func setup() {
         self.wantsLayer = true
         self.layer?.backgroundColor = NSColor.white.cgColor
         
         self.shadow = NSShadow()
         self.layer?.shadowColor = NSColor.black.cgColor
         self.layer?.shadowOpacity = 0.2
-        self.layer?.shadowRadius = 3
+        self.layer?.shadowRadius = 3.0
         self.layer?.shadowOffset = CGSize(width: 0, height: -3)
         
-        if (pageLayer != nil) {
-            pageLayer.frame = self.bounds
-        }
+        pageImageIv.wantsLayer = true;
+        self.addSubview(self.pageImageIv)
+        self.pageImageIv.autoresizingMask = [.width, .height];
         self.pageImageIv.frame = self.bounds
     }
     
-    required init?(coder: NSCoder) {
-        super.init(coder: coder)
+    func performTask() {
+        pendingWordItem?.cancel()
+        let newWorkItem = DispatchWorkItem {
+            self.updateThumbnial()
+        }
+        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3, execute:newWorkItem)
+        pendingWordItem = newWorkItem
     }
     
-    override func layout() {
-        super.layout()
-        
-        if (pageLayer != nil) {
-            pageLayer.frame = self.bounds
-            pageLayer.setNeedsDisplay()
+    func updateThumbnial(needReset: Bool = false) {
+        let image = KMThumbnailCache.shared.thumbnail(for: Int(self.page?.pageIndex() ?? UInt(Int.max)))
+        if image != nil {
+            self.pageImageIv.image = image
+        } else {
+            let pageIndex = self.page?.pageIndex()
+            self.page?.thumbnail(of: self.bounds.size, needReset: needReset, completion: { [unowned self] image in
+                if (image != nil) {
+                    self.pageImageIv.image = image
+                    KMThumbnailCache.shared.addThumbnail(id: Int(pageIndex ?? UInt(Int.max)), image: image!)
+                }
+            })
         }
-        self.pageImageIv.frame = self.bounds
     }
-    
 }

+ 0 - 14
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -1057,13 +1057,6 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
             return
         }
         
-        if let _document = self.thumbnailView.document {
-            for i in 0 ..< _document.pageCount {
-                let page = _document.page(at: i)
-                page?.pageEditImage = nil
-            }
-        }
-        
         if (self.itemSize.width < self.defaultItemSize.width) {
             self.itemSize = self.defaultItemSize
         } else if (self.itemSize.width == self.defaultItemSize.width) {
@@ -1082,13 +1075,6 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
             return
         }
         
-        if let _document = self.thumbnailView.document {
-            for i in 0 ..< _document.pageCount {
-                let page = _document.page(at: i)
-                page?.pageEditImage = nil
-            }
-        }
-        
         if (self.itemSize.width > self.defaultItemSize.width) {
             self.itemSize = self.defaultItemSize
         } else if (self.itemSize.width == self.defaultItemSize.width) {

+ 2 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -914,7 +914,7 @@ NSNotificationName const CPDFListViewDisplayModeChangeNotification = @"CPDFListV
         CFRelease(frameRef);
         CFRelease(framesetter);
         [NSGraphicsContext restoreGraphicsState];
-        CGContextRestoreGState(context);        
+        CGContextRestoreGState(context);
     }
 }
 
@@ -1178,6 +1178,7 @@ NSNotificationName const CPDFListViewDisplayModeChangeNotification = @"CPDFListV
     }
     [page addAnnotation:annotation];
     [self setNeedsDisplayAnnotation:annotation];
+    [self updateHighLightAnnotation:annotation];
     [[self undoManager] setActionName:NSLocalizedString(@"Add Note", @"Undo action name")];
         
     dispatch_async(dispatch_get_main_queue(), ^{

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Tool.h

@@ -45,6 +45,8 @@ typedef NS_ENUM(NSInteger, CAnnotationAlignState) {
 
 - (void)setNeedsDisplayAnnotation:(CPDFAnnotation *)annotation;
 
+- (void)updateHighLightAnnotation:(CPDFAnnotation *)annotation;
+
 - (void)requiresDisplay;
 
 - (NSRect)visibleContentRect;

+ 6 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Tool.m

@@ -320,6 +320,12 @@
     }
 }
 
+- (void)updateHighLightAnnotation:(CPDFAnnotation *)annotation {
+    if (annotation && [annotation.type isEqualToString:@"Highlight"]) {
+        [self updateHighLightAnnotationViewForPage:annotation.page];
+    }
+}
+
 - (NSRect)convertRectToScreen:(NSRect)rect {
     rect = [self convertRect:rect toView:nil];
     rect.origin = [[self window] convertBaseToScreen:rect.origin];

BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/ComPDFKit


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFAnnotation.h


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFDocument.h


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKitConfig+Private.h


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKitConfig.h


+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKitPlatform.h

@@ -20,6 +20,7 @@
 
 #import <UIKit/UIKit.h>
 
+#define CPDFKitPlatformView         UIView
 #define CPDFKitPlatformColor        UIColor
 #define CPDFKitPlatformImage        UIImage
 #define CPDFKitPlatformFont         UIFont
@@ -29,6 +30,7 @@
 
 #import <Cocoa/Cocoa.h>
 
+#define CPDFKitPlatformView         NSView
 #define CPDFKitPlatformColor        NSColor
 #define CPDFKitPlatformImage        NSImage
 #define CPDFKitPlatformFont         NSFont

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFPage.h

@@ -145,7 +145,6 @@ extern NSNotificationName const CPDFPageDidFindSearchChangeNotification;
 - (CGAffineTransform)transform;
 
 #pragma mark - Rendering
-
 /**
  * Convenience function that returns an image of this page, with annotations.
  */
@@ -155,6 +154,7 @@ extern NSNotificationName const CPDFPageDidFindSearchChangeNotification;
  * Convenience function that returns an image of this page's bound.
  */
 - (CPDFKitPlatformImage *)renderPageOfRect:(CGRect)rect pageDrawRectOptions:(CPDFPageDrawRectOptions *)pageDrawRectOptions;
+- (void)thumbnailOfSize:(CGSize)size needReset:(BOOL)reset completion:(void (^)(CPDFKitPlatformImage *image))completion;
 
 #pragma mark - Find
 /**

+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFSelection.h


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFUtilities.h


+ 6 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFView.h

@@ -271,6 +271,12 @@ typedef NS_OPTIONS(NSInteger, CPDFAreaOfInterest) {
 
 - (void)setNeedsDisplayAnnotationViewForPage:(CPDFPage *)page;
 
+- (void)updateHighLightAnnotationViewForPage:(CPDFPage *)page;
+
+- (void)updateRender:(BOOL)reset;
+
+- (void)clearScrollCache;
+
 #pragma mark - Rendering
 
 - (void)drawPage:(CPDFPage *)page toContext:(CGContextRef)context;

+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/ComPDFKit.h


+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Modules/module.modulemap

@@ -1,6 +1,6 @@
 framework module ComPDFKit {
   umbrella header "ComPDFKit.h"
-
   export *
+
   module * { export * }
 }

BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Assets.car


BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib


BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib/keyedobjects-101300.nib


BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib/keyedobjects.nib


+ 10 - 10
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Info.plist

@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
 	<key>BuildMachineOSBuild</key>
-	<string>21E230</string>
+	<string>23A344</string>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>en</string>
 	<key>CFBundleExecutable</key>
@@ -17,30 +17,30 @@
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.1.1</string>
+	<string>2.1.2</string>
 	<key>CFBundleSupportedPlatforms</key>
 	<array>
 		<string>MacOSX</string>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>2101</string>
+	<string>2102</string>
 	<key>DTCompiler</key>
 	<string>com.apple.compilers.llvm.clang.1_0</string>
 	<key>DTPlatformBuild</key>
-	<string>13A233</string>
+	<string></string>
 	<key>DTPlatformName</key>
 	<string>macosx</string>
 	<key>DTPlatformVersion</key>
-	<string>11.3</string>
+	<string>14.2</string>
 	<key>DTSDKBuild</key>
-	<string>20E214</string>
+	<string>23C53</string>
 	<key>DTSDKName</key>
-	<string>macosx11.3</string>
+	<string>macosx14.2</string>
 	<key>DTXcode</key>
-	<string>1300</string>
+	<string>1520</string>
 	<key>DTXcodeBuild</key>
-	<string>13A233</string>
+	<string>15C500b</string>
 	<key>LSMinimumSystemVersion</key>
-	<string>10.10</string>
+	<string>10.13</string>
 </dict>
 </plist>

BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/default.metallib


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/formsign_tag.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/formsign_tag@2x.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/loupe-hi.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/loupe-lo.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/loupe-mask.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/magnifier-ranged-hi.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/magnifier-ranged-lo.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/magnifier-ranged-mask.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/popup_note.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/popup_note@2x.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/quick_bookmark.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/quick_bookmark~ipad.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/recoding_on.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/recoding_on@2x.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/recoding_play.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/recoding_play@2x.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/viewer_dragDontBack.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/viewer_dragDontBack@2x.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/viewer_dragDontFront.png


+ 0 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/viewer_dragDontFront@2x.png


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 21 - 529
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/_CodeSignature/CodeResources


+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift

@@ -693,6 +693,7 @@ extension KMLeftSideViewController {
         if need == false {
             return
         }
+        self.updateThumbnail(at: Int(anno?.page?.pageIndex() ?? 0))
         if let data = anno {
             self.note_reloadDataForAnnoIfNeed(anno: data)
         }

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Thumbnail.swift

@@ -73,7 +73,7 @@ extension KMLeftSideViewController {
     func updateThumbnail(at index: Int) {
         if index < self.thumbnails.count {
             self.thumbnails[index].dirty = true
-            
+            self.thumbnailTableView.reloadData(forRowIndexes: IndexSet(integer: index), columnIndexes: IndexSet(integer: 0))
             /*
              原问题:CrashKit - SKMainWindowController updateThumbnailAtPageIndex:] ([__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 17])
              注释原因:缩略图高亮为自定义后,刷新会将高亮刷新到0行

+ 44 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Model/KMThumbnailCache.swift

@@ -0,0 +1,44 @@
+//
+//  KMThumbnailCache.swift
+//  PDF Reader Pro
+//
+//  Created by lizhe on 2024/8/9.
+//
+
+class KMThumbnailCache: NSObject {
+    static let shared = KMThumbnailCache()
+    
+    private let maxCacheSize = 50
+    private var thumbnails: [Int: NSImage] = [:]
+    private var order: [Int] = [] // 记录插入顺序的数组
+
+    func addThumbnail(id: Int, image: NSImage) {
+        if thumbnails.count >= maxCacheSize {
+            if let oldestID = order.first {
+                thumbnails.removeValue(forKey: oldestID)
+                order.removeFirst()
+            }
+        }
+        
+        thumbnails[id] = image
+        order.append(id)
+    }
+    
+    func thumbnail(for id: Int) -> NSImage? {
+        return thumbnails[id]
+    }
+    
+    func removeThumbnail(for id: Int) {
+        if let index = order.firstIndex(of: id) {
+            thumbnails.removeValue(forKey: id)
+            order.remove(at: index)
+        } else {
+            print("ID not found")
+        }
+    }
+    
+    func clearCache() {
+        thumbnails.removeAll()
+        order.removeAll()
+    }
+}

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m

@@ -693,10 +693,10 @@
         KMPageDisplayPropertiesViewController *vc = [[KMPageDisplayPropertiesViewController alloc] init];
         vc.mainController = self.mainController;
         vc.pdfView = self.pdfView;
-        __block typeof(self) blockSelf = self;
+        __weak typeof(self) weakSelf = self;
         vc.readerModeBlock = ^(BOOL isReaderMode) {
-            if (blockSelf.pageDisplayReaderMode) {
-                blockSelf.pageDisplayReaderMode(isReaderMode);
+            if (weakSelf.pageDisplayReaderMode) {
+                weakSelf.pageDisplayReaderMode(isReaderMode);
             }
         };
         self.propertiesBox.contentView = vc.view;

+ 14 - 2
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -2495,7 +2495,8 @@ extension KMMainViewController {
     func showInFinder(_ sender: Any) -> Void {
         if sender is NSNotification {
             let tabController = (sender as! NSNotification).object as? CTTabController
-            if tabController?.title == self.document?.documentURL.deletingPathExtension().lastPathComponent {
+            let path = self.document?.documentURL.deletingPathExtension().lastPathComponent
+            if tabController?.title == path {
                 if let file = self.myDocument?.fileURL {
                     if FileManager.default.fileExists(atPath: file.path) {
                         NSWorkspace.shared.activateFileViewerSelecting([file])
@@ -2523,13 +2524,24 @@ extension KMMainViewController {
     
     func closeTab(_ sender: NSNotification) -> Void {
         let tabController = sender.object as? CTTabController
-        if tabController?.title == self.document?.documentURL.lastPathComponent {
+        let path = self.document?.documentURL.deletingPathExtension().lastPathComponent
+        if tabController?.title == path {
             print("closeTab")
             self.leftSideViewController.clearAnnotationFilterData()
             self.leftSideViewController.clearNotification()
         }
     }
     
+    func willCloseTab (_ sender: NSNotification) -> Void {
+        KMThumbnailCache.shared.clearCache()
+        let tabController = sender.object as? CTTabController
+        let path = self.document?.documentURL.deletingPathExtension().lastPathComponent
+        if tabController?.title == path {
+            print("closeTab")
+            self.listView.clearScrollCache()
+        }
+    }
+    
     @IBAction func toggleSplitPDF(_ sender: Any) {
         if let menuItem = sender as? NSMenuItem {
             splitView(withTag: menuItem.tag)

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

@@ -415,6 +415,7 @@ import Cocoa
         }
 
         NotificationCenter.default.addObserver(self, selector: #selector(rename(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerRename"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(willCloseTab(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerWillCloseTabs"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(closeTab(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerCloseTabs"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(showInFinder(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerShowInFinder"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(preferenceDidChangeNotification), name: KMPreferenceManager.didChangeNotification, object: nil)

BIN
PDF Office/PDF Master/Source/default.metallib


+ 16 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -1600,6 +1600,12 @@
 		AD4C71712B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
 		AD4C71722B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
 		AD4C71732B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
+		AD5374952C65A426002DE248 /* default.metallib in Resources */ = {isa = PBXBuildFile; fileRef = AD5374942C65A426002DE248 /* default.metallib */; };
+		AD5374962C65A426002DE248 /* default.metallib in Resources */ = {isa = PBXBuildFile; fileRef = AD5374942C65A426002DE248 /* default.metallib */; };
+		AD5374972C65A426002DE248 /* default.metallib in Resources */ = {isa = PBXBuildFile; fileRef = AD5374942C65A426002DE248 /* default.metallib */; };
+		AD53749E2C65E1E1002DE248 /* KMThumbnailCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53749D2C65E1E1002DE248 /* KMThumbnailCache.swift */; };
+		AD53749F2C65E1E1002DE248 /* KMThumbnailCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53749D2C65E1E1002DE248 /* KMThumbnailCache.swift */; };
+		AD5374A02C65E1E1002DE248 /* KMThumbnailCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53749D2C65E1E1002DE248 /* KMThumbnailCache.swift */; };
 		AD53AF8F2BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */; };
 		AD53AF902BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */; };
 		AD53AF912BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */; };
@@ -6078,6 +6084,8 @@
 		AD3AAD8E2B1034B400DE5FE7 /* KMHeaderFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMHeaderFooterView.swift; sourceTree = "<group>"; };
 		AD3AAD922B1034C000DE5FE7 /* KMHeaderFooterView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMHeaderFooterView.xib; sourceTree = "<group>"; };
 		AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSError_Extensions.swift; sourceTree = "<group>"; };
+		AD5374942C65A426002DE248 /* default.metallib */ = {isa = PBXFileReference; lastKnownFileType = "archive.metal-library"; path = default.metallib; sourceTree = "<group>"; };
+		AD53749D2C65E1E1002DE248 /* KMThumbnailCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMThumbnailCache.swift; sourceTree = "<group>"; };
 		AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMLoadingView.swift; sourceTree = "<group>"; };
 		AD53AF922BF1BCA300DCFFFC /* KMLoadingView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMLoadingView.xib; sourceTree = "<group>"; };
 		AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMLightMemberToken.swift; sourceTree = "<group>"; };
@@ -10254,6 +10262,7 @@
 		ADC075FB2987EF41006C752F /* Source */ = {
 			isa = PBXGroup;
 			children = (
+				AD5374942C65A426002DE248 /* default.metallib */,
 				ADEC7A7A299397F8009A8256 /* Fonts */,
 			);
 			path = Source;
@@ -13550,6 +13559,7 @@
 				BBC8A76C2B05EDDE00FA9377 /* KMThumbnail.swift */,
 				BBED0C2B2BBD569300511FAE /* KMAnnotationModel.swift */,
 				BB8363992C199C20002CE43A /* KMBotaModel.swift */,
+				AD53749D2C65E1E1002DE248 /* KMThumbnailCache.swift */,
 			);
 			path = Model;
 			sourceTree = "<group>";
@@ -14761,6 +14771,7 @@
 				9F1F82D5292F6D510092C4B4 /* KMPDFInsertPreviewViewController.xib in Resources */,
 				ADC63E4B2A49BEDD00854E02 /* KMSubscribeWaterMarkCollectionItem.xib in Resources */,
 				AD7D5C952B8F20FE006562CD /* synctex_parser_version.txt in Resources */,
+				AD5374952C65A426002DE248 /* default.metallib in Resources */,
 				BBE66D092B55467C009343FA /* repeatTrialAlert_icon.png in Resources */,
 				BBD922332B50D61200DB9585 /* KMRateWindowController.xib in Resources */,
 				BBB789932BE8BF2400F7E09C /* AITypeItemChooseView.xib in Resources */,
@@ -15405,6 +15416,7 @@
 				ADE86ABB2B0343F100414DFA /* KMWatermarkView.xib in Resources */,
 				8942F7FC2926089200389627 /* KMSignatureViewController.xib in Resources */,
 				BBA922392B4E97540061057A /* KMPurchaseFirstTrialWindowController.xib in Resources */,
+				AD5374962C65A426002DE248 /* default.metallib in Resources */,
 				9F080B18298CFDB300FC27DA /* KMTextImageButtonVC.xib in Resources */,
 				9F02019A2A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib in Resources */,
 				ADE86A8E2B02269400414DFA /* KMRemovePasswordWindowController.xib in Resources */,
@@ -15856,6 +15868,7 @@
 				AD199DE32B200FB000D56FEE /* KMPrintPosterView.xib in Resources */,
 				9F8539DC294318D600DF644E /* TabsImage.xcassets in Resources */,
 				BBE66D0B2B55467C009343FA /* repeatTrialAlert_icon.png in Resources */,
+				AD5374972C65A426002DE248 /* default.metallib in Resources */,
 				AD7D5C972B8F20FE006562CD /* synctex_parser_version.txt in Resources */,
 				BBD922352B50D61200DB9585 /* KMRateWindowController.xib in Resources */,
 				BB1E7F2E2B4FE2C6002D9785 /* GuideInfoImages.xcassets in Resources */,
@@ -17067,6 +17080,7 @@
 				BBF62C682B033B34007B7E86 /* KMPDFEditExtractWindow.swift in Sources */,
 				BB3A669E2B0752A800575343 /* KMTocOutlineView.swift in Sources */,
 				BB2F9AB32AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift in Sources */,
+				AD53749E2C65E1E1002DE248 /* KMThumbnailCache.swift in Sources */,
 				ADE3C1AB29A4779E00793B13 /* KMPrintAccessoryController.swift in Sources */,
 				ADDF83922B391A5D00A81A4E /* DSignatureFilelistRow.swift in Sources */,
 				BB8F4557295AA1270037EA22 /* KMHeaderFooterPropertyInfoController.swift in Sources */,
@@ -18053,6 +18067,7 @@
 				9F02017F2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
 				9FDD0F78294FEF64000C4DAD /* KMConvertPDFManager.swift in Sources */,
 				BBBB6CD72AD150D20035AA66 /* CPDFCircleAnnotation+PDFListView.swift in Sources */,
+				AD53749F2C65E1E1002DE248 /* KMThumbnailCache.swift in Sources */,
 				9FDCD81E2B6CDEFE00E22166 /* KMAnnotationChoiceWidgeOptionsTextField.swift in Sources */,
 				8942F80429262B2E00389627 /* KMSideViewController.swift in Sources */,
 				BB1D41D42B26D9BD00994EDC /* KMReusable.swift in Sources */,
@@ -19526,6 +19541,7 @@
 				BB1B0ACD2B4FC6E900889528 /* KMFunctionGuideWindowController.swift in Sources */,
 				8942F7BD29222C7E00389627 /* KMBookCellView.swift in Sources */,
 				9F1FE4C229406E4700E952CA /* NSWindow+CTThemed.m in Sources */,
+				AD5374A02C65E1E1002DE248 /* KMThumbnailCache.swift in Sources */,
 				BB147001299DC0D100784A6A /* OIDRedirectHTTPHandler.m in Sources */,
 				AD7D5C9D2B8F20FE006562CD /* synctex_parser.m in Sources */,
 				89E4E6EE2963D1B7002DBA6F /* KMColorPickerViewController.m in Sources */,

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1362 - 23
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist