فهرست منبع

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

zenghong 2 ماه پیش
والد
کامیت
7c21a2f2d0
68فایلهای تغییر یافته به همراه3873 افزوده شده و 2086 حذف شده
  1. 1 1
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentTextarea/ComponentTextarea.swift
  2. 0 22
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSForward.imageset/Contents.json
  3. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSForward.imageset/tts_ic_sentence_last.pdf
  4. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSForward.imageset/tts_ic_sentence_last_dark.pdf
  5. 0 22
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSNext.imageset/Contents.json
  6. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSNext.imageset/tts_ic_sentence_next.pdf
  7. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSNext.imageset/tts_ic_sentence_next_dark.pdf
  8. 0 22
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSPause.imageset/Contents.json
  9. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSPause.imageset/tts_ic_pause.pdf
  10. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSPause.imageset/tts_ic_pause_dark.pdf
  11. 0 22
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSStop.imageset/Contents.json
  12. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSStop.imageset/tts_ic_play.pdf
  13. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSStop.imageset/tts_ic_play_dark.pdf
  14. 1 0
      PDF Office/PDF Master/Class/Common/OC/OCR/KMGOCRManager.h
  15. 85 0
      PDF Office/PDF Master/Class/Common/OC/OCR/KMGOCRManager.m
  16. 2 24
      PDF Office/PDF Master/Class/PDFTools/AddPassword/New/KMSecurityWindowController.swift
  17. 55 35
      PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.swift
  18. 42 188
      PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.xib
  19. 328 221
      PDF Office/PDF Master/Class/PDFTools/TTS/WindowController/KMTTSWindowController.swift
  20. 130 200
      PDF Office/PDF Master/Class/PDFTools/TTS/WindowController/KMTTSWindowController.xib
  21. 0 176
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/CPDFListViewColorMenuItemView.swift
  22. 34 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFEditArea/CPDFListView+CPDFEditArea.swift
  23. 2 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFListViewExtension/CPDFListView+Event.h
  24. 37 458
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFListViewExtension/CPDFListView+Event.m
  25. 18 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h
  26. 122 3
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m
  27. 0 18
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  28. 0 32
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift
  29. 0 12
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift
  30. 4 18
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.swift
  31. 30 51
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMLinkViewController/KMLinkViewController.swift
  32. 7 5
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMLinkViewController/Views/KMLinkEmailView/KMLinkEmailView.swift
  33. 25 16
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMLinkViewController/Views/KMLinkPageView/KMLinkPageView.swift
  34. 6 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMLinkViewController/Views/KMLinkWebView/KMLinkWebView.swift
  35. 1234 23
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift
  36. 1235 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMPDFMenuConfig.swift
  37. 6 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/Contents.json
  38. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/next_fill.imageset/Contents.json
  39. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/next_fill.imageset/next_fill.pdf
  40. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/pause_fill.imageset/Contents.json
  41. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/pause_fill.imageset/pause_fill.pdf
  42. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/play_fill.imageset/Contents.json
  43. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/play_fill.imageset/play_fill.pdf
  44. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/previous_fill.imageset/Contents.json
  45. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/previous_fill.imageset/previous_fill.pdf
  46. 192 18
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/OCR/Tool/Manager/KMOCRManager.swift
  47. 4 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/OCR/Tool/View/Area/KMOCRAreaView.swift
  48. 5 1
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/OCR/Tool/View/Page/KMOCRPageView.swift
  49. 12 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMCreateSignWindowController.swift
  50. 2 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMCreateSignWindowController.xib
  51. 8 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMPDFSignatureDrawView.swift
  52. 7 3
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMPDFSignatureInputView.swift
  53. 13 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/KMSignatureListController.swift
  54. 8 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/KMSignatureManager.swift
  55. 2 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Controllers/KMStampSettingWindowController.xib
  56. 11 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/KMStampListController.swift
  57. 31 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Views/KMStampListItem.swift
  58. 10 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Views/KMStampListItem.xib
  59. 33 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/Toolbar/KMPDFToolbarController.swift
  60. 9 3
      PDF Office/PDF Master/KMClass/Left/Outline/Controller/KMOutlineViewController.swift
  61. 1 1
      PDF Office/PDF Master/KMClass/Left/Outline/Tools/KMNOutlineHanddler.swift
  62. 2 2
      PDF Office/PDF Master/KMClass/Left/ThumnailView/KMNThumnailViewController.swift
  63. 1 1
      PDF Office/PDF Master/KMClass/PDFListView/ViewController/KMNAlertTipViewController.swift
  64. 2 2
      PDF Office/PDF Master/KMClass/PDFListView/ViewController/KMNAlertTipViewController.xib
  65. 9 175
      PDF Office/PDF Master/KMClass/PDFListView/WindowController/KMNPopAnnotationWindowController.swift
  66. 16 204
      PDF Office/PDF Master/KMClass/PDFListView/WindowController/KMNPopContentEditWindowController.swift
  67. 8 16
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj
  68. 35 85
      PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+ 1 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentTextarea/ComponentTextarea.swift

@@ -189,7 +189,7 @@ public class ComponentTextarea: ComponentBaseXibView {
     }
     
     public override func mouseDown(with event: NSEvent) {
-        super.mouseDown(with: event)
+//        super.mouseDown(with: event)
     
     }
     

+ 0 - 22
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSForward.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "filename" : "tts_ic_sentence_last.pdf",
-      "idiom" : "mac"
-    },
-    {
-      "appearances" : [
-        {
-          "appearance" : "luminosity",
-          "value" : "dark"
-        }
-      ],
-      "filename" : "tts_ic_sentence_last_dark.pdf",
-      "idiom" : "mac"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSForward.imageset/tts_ic_sentence_last.pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSForward.imageset/tts_ic_sentence_last_dark.pdf


+ 0 - 22
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSNext.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "filename" : "tts_ic_sentence_next.pdf",
-      "idiom" : "mac"
-    },
-    {
-      "appearances" : [
-        {
-          "appearance" : "luminosity",
-          "value" : "dark"
-        }
-      ],
-      "filename" : "tts_ic_sentence_next_dark.pdf",
-      "idiom" : "mac"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSNext.imageset/tts_ic_sentence_next.pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSNext.imageset/tts_ic_sentence_next_dark.pdf


+ 0 - 22
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSPause.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "filename" : "tts_ic_pause.pdf",
-      "idiom" : "mac"
-    },
-    {
-      "appearances" : [
-        {
-          "appearance" : "luminosity",
-          "value" : "dark"
-        }
-      ],
-      "filename" : "tts_ic_pause_dark.pdf",
-      "idiom" : "mac"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSPause.imageset/tts_ic_pause.pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSPause.imageset/tts_ic_pause_dark.pdf


+ 0 - 22
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSStop.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "filename" : "tts_ic_play.pdf",
-      "idiom" : "mac"
-    },
-    {
-      "appearances" : [
-        {
-          "appearance" : "luminosity",
-          "value" : "dark"
-        }
-      ],
-      "filename" : "tts_ic_play_dark.pdf",
-      "idiom" : "mac"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSStop.imageset/tts_ic_play.pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Toolbar/Toolbar(New)/KMImageNameTTSStop.imageset/tts_ic_play_dark.pdf


+ 1 - 0
PDF Office/PDF Master/Class/Common/OC/OCR/KMGOCRManager.h

@@ -58,6 +58,7 @@ extern NSString * KMGOCRLanguageStringKey;
 + (NSArray *)languages;
 
 - (void)createPDFFile:(NSString *)filePath imagePaths:(NSArray *)paths results:(NSArray *)resultsArray scale:(CGFloat)scale;
+- (void)createPDFFile:(NSString *)filePath images:(NSArray *)images results:(NSArray *)resultsArray scale:(CGFloat)scale;
 
 - (void)recognitionImages:(NSArray *)images withLanguages:(NSArray *)languages;
 //- (void)recognitionImages:(NSArray *)images withLanguages:(NSArray *)languages fileType:(NSString * _Nullable)fileType filePath:(NSURL *)filePath;

+ 85 - 0
PDF Office/PDF Master/Class/Common/OC/OCR/KMGOCRManager.m

@@ -341,6 +341,91 @@ static inline NSFont * FontWithSize(NSString *strChar, CGSize size) {
     CGContextRelease (pdfContext);
 }
 
+- (void)createPDFFile:(NSString *)filePath images:(NSArray *)images results:(NSArray *)resultsArray scale:(CGFloat)scale {
+    if (images.count < 1) {
+        return;
+    }
+    
+    CFStringRef path = (__bridge CFStringRef)filePath;
+    CFURLRef url = CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, 0);
+    CFMutableDictionaryRef myDictionary = CFDictionaryCreateMutable(NULL,
+                                                                    0,
+                                                                    &kCFTypeDictionaryKeyCallBacks,
+                                                                    &kCFTypeDictionaryValueCallBacks);
+    CFDictionarySetValue(myDictionary, kCGPDFContextCreator, CFSTR("Kdan Mobile PDF Reader"));
+    
+    CGContextRef pdfContext = CGPDFContextCreateWithURL(url, &CGRectZero, myDictionary);
+    CGContextSetRGBFillColor(pdfContext, 1.0, 0.0, 0.0, 0.0);
+    CGContextSetTextDrawingMode(pdfContext, kCGTextFill);
+    
+    CFRelease(myDictionary);
+    CFRelease(url);
+    
+    for (int i=0; i<images.count; i++) {
+        NSImage *image = images[i];
+        
+        CIImage *imageCIImage = [CIImage imageWithCGImage:image.CGImage];
+        NSSize size = [imageCIImage extent].size;
+        CGRect pageRect = CGRectMake(0, 0, size.width/scale, size.height/scale);
+        
+        CFMutableDictionaryRef pageDictionary = CFDictionaryCreateMutable(NULL,
+                                                                          0,
+                                                                          &kCFTypeDictionaryKeyCallBacks,
+                                                                          &kCFTypeDictionaryValueCallBacks);
+        CFDataRef boxData = CFDataCreate(NULL,(const UInt8 *)&pageRect, sizeof (CGRect));
+        CFDictionarySetValue(pageDictionary, kCGPDFContextMediaBox, boxData);
+        CGPDFContextBeginPage (pdfContext, pageDictionary);
+
+        NSData *imageData = image.TIFFRepresentation;
+        CGImageSourceRef imageSource = CGImageSourceCreateWithData((CFDataRef)imageData, NULL);
+        CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
+        CGContextSaveGState(pdfContext);
+        CGContextDrawImage(pdfContext, pageRect, imageRef);
+        CGContextRestoreGState(pdfContext);
+        CGImageRelease(imageRef);
+        
+        [NSGraphicsContext saveGraphicsState];
+        [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:pdfContext flipped:NO]];
+        NSArray *results = nil;
+        if (i < resultsArray.count) {
+            results = resultsArray[i];
+            CGFloat newScale = scale;
+            if([KMGOCRManager defaultManager].OCRType == KMOCRType_Apple)
+                newScale = 1;
+            if (results.count == 1) {
+                KMGOCRResult *result = results[0];
+                NSRect bounds = NSMakeRect((result.textBounds.origin.x)/newScale,
+                                           pageRect.size.height-(result.textBounds.origin.y+result.textBounds.size.height)/newScale,
+                                           (result.textBounds.size.width)/newScale,
+                                           (result.textBounds.size.height)/newScale);
+                NSDictionary *dic = @{NSFontAttributeName:FontWithSize(result.text, CGSizeMake(result.textBounds.size.width/newScale, result.textBounds.size.height/newScale)),
+                                      NSForegroundColorAttributeName:[NSColor clearColor]};
+                [result.text drawInRect:bounds withAttributes:dic];
+            } else {
+                for (int i=1; i<results.count; i++) {
+                    KMGOCRResult *result = results[i];
+                    NSRect bounds = NSMakeRect((result.textBounds.origin.x)/newScale,
+                                               pageRect.size.height-(result.textBounds.origin.y+result.textBounds.size.height)/newScale,
+                                               (result.textBounds.size.width)/newScale,
+                                               (result.textBounds.size.height)/newScale);
+                    NSDictionary *dic = @{NSFontAttributeName:FontWithSize(result.text, CGSizeMake(result.textBounds.size.width/newScale, result.textBounds.size.height/newScale)),
+                                          NSForegroundColorAttributeName:[NSColor clearColor]};
+                    [result.text drawInRect:bounds withAttributes:dic];
+                }
+            }
+        }
+        [NSGraphicsContext restoreGraphicsState];
+        
+        CGPDFContextEndPage (pdfContext);
+        
+        CFRelease(pageDictionary);
+        CFRelease(boxData);
+    }
+    
+    CGPDFContextClose(pdfContext);
+    CGContextRelease (pdfContext);
+}
+
 - (void)recognitionImages:(NSArray *)images withLanguages:(NSArray *)languages {
     [self recognitionImages:images withLanguages:languages fileType:nil filePath:nil];
 }

+ 2 - 24
PDF Office/PDF Master/Class/PDFTools/AddPassword/New/KMSecurityWindowController.swift

@@ -16,28 +16,11 @@ class KMSecurityWindowController: KMBaseWindowController {
     var doneAction: KMSecurityWindowControllerDoneAction?
     
     
-    var documentURL: URL? //{
-//        didSet{
-//            if self.password.count != 0 {
-//                self.securityView.documentURL = self.documentURL
-//            } else {
-//                KMBaseWindowController.checkPassword(url: documentURL, type: .owner) { [unowned self] success, paasswordString in
-//                    if success {
-//                        self.securityView.documentURL = self.documentURL
-//                    } else {
-//                        guard let callBack = self.itemClick else { return }
-//                        
-//                        callBack()
-//                    }
-//                }
-//            }
-//        }
-//    }
+    var documentURL: URL?
     
     override func windowDidLoad() {
         super.windowDidLoad()
-
-        // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
+        
         securityView.cancelAction = { [unowned self] view in
             self.cancelAction?(self)
         }
@@ -64,7 +47,6 @@ extension KMSecurityWindowController {
             guard let filePath = files.first?.filePath else { return }
         }
         
-//        let myDocument = CPDFDocument(url: NSURL(fileURLWithPath: filePath) as URL)
         if (pdfDocument != nil || documentURL != nil) {
             var options: [CPDFDocumentWriteOption : Any] = [:]
             var attribute: [CPDFDocumentAttribute : Any] = [:]
@@ -157,8 +139,6 @@ extension KMSecurityWindowController {
                         options.updateValue(false, forKey: .allowsCopyingOption)
                     }
                 }
-                
-                /// 加密层级 sdk 缺接口
             }
             
             attribute.updateValue(model.title, forKey: .titleAttribute)
@@ -166,8 +146,6 @@ extension KMSecurityWindowController {
             attribute.updateValue(model.subject, forKey: .subjectAttribute)
             attribute.updateValue(model.keywords, forKey: .keywordsAttribute)
             
-            //            let result = myDocument.write(to: documentURL, withOptions: options)
-            //            myDocument.setPasswordOptions(options)
             guard let callback = doneAction else {
                 return
             }

+ 55 - 35
PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.swift

@@ -6,15 +6,21 @@
 //
 
 import Cocoa
+import KMComponentLibrary
 
 typealias KMSecurityViewBatchAction = (_ view: KMSecurityView, _ files: [KMFileAttribute]) -> Void
 typealias KMSecurityViewCancelAction = (_ view: KMSecurityView) -> Void
 typealias KMSecurityViewDoneAction = (_ view: KMSecurityView, _ model: KMSecureEncryptModel, _ files: [KMFileAttribute]) -> Void
 
 class KMSecurityView: BaseXibView {
-    @IBOutlet weak var batchButton: NSButton!
-    @IBOutlet weak var cancelButton: NSButton!
-    @IBOutlet weak var doneButton: NSButton!
+    
+    @IBOutlet var batchButton: ComponentButton!
+    @IBOutlet var cancelButton: ComponentButton!
+    @IBOutlet var doneButton: ComponentButton!
+     
+    @IBOutlet var batchWidthConst: NSLayoutConstraint!
+    @IBOutlet var cancelWidthConst: NSLayoutConstraint!
+    @IBOutlet var doneWidthConst: NSLayoutConstraint!
     
     @IBOutlet weak var box1: NSBox!
     @IBOutlet weak var boxLabel1: NSTextField!
@@ -27,18 +33,7 @@ class KMSecurityView: BaseXibView {
     @IBOutlet weak var ownerPassword: NSSecureTextField!
     @IBOutlet weak var notPrintCheckBtn: NSButton!
     @IBOutlet weak var notCopyCheckBtn: NSButton!
-    
-    @IBOutlet weak var box2: NSBox!
-    @IBOutlet weak var boxLabel2: NSTextField!
-    @IBOutlet weak var titleTextField: NSTextField!
-    @IBOutlet weak var authorTextField: NSTextField!
-    @IBOutlet weak var subjectTextField: NSTextField!
-    @IBOutlet weak var keywordTextField: NSTextField!
-    
-    @IBOutlet weak var titleLabel: NSTextField!
-    @IBOutlet weak var authorLabel: NSTextField!
-    @IBOutlet weak var subjectLabel: NSTextField!
-    @IBOutlet weak var keywordLabel: NSTextField!
+ 
 
     var batchAction: KMSecurityViewBatchAction?
     var cancelAction: KMSecurityViewCancelAction?
@@ -63,27 +58,54 @@ class KMSecurityView: BaseXibView {
         ownerPassword.delegate = self
         
         self.updateOwnerButtonState()
+        
+        updateLanguage()
     }
     
     func updateLanguage() {
-        batchButton.title = NSLocalizedString("Batch", comment: "")
-//        cancelButton.title = NSLocalizedString("Remove All", comment: "")
-        doneButton.title = NSLocalizedString("Encrypt", comment: "")
-        cancelButton.title = NSLocalizedString("Close", comment: "")
+        box1.fillColor = NSColor.clear
+        
+        
+        
+        
+        boxLabel1.stringValue = KMLocalizedString("Password Security Settings")
+        boxLabel1.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        boxLabel1.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
         
-        boxLabel1.stringValue = NSLocalizedString("Password Security Settings", comment: "")
-        boxLabel2.stringValue = NSLocalizedString("Document Description", comment: "")
         openPwdCheckBtn.title = NSLocalizedString("Require a password to open the document.", comment: "")
         ownerPwdCheckBtn.title = NSLocalizedString("Restrict printing and copying of the document.", comment: "")
         notPrintCheckBtn.title = NSLocalizedString("Restrict document printing", comment: "")
         notCopyCheckBtn.title = NSLocalizedString("Restrict content copying", comment: "")
         openPasswordPLabel.stringValue = NSLocalizedString("Open Password:", comment: "")
         ownerPasswordLabel.stringValue = NSLocalizedString("Owner Password:", comment: "")
-        titleLabel.stringValue = NSLocalizedString("Title:", comment: "")
-        authorLabel.stringValue = NSLocalizedString("Author:", comment: "")
-        subjectLabel.stringValue = NSLocalizedString("Subject:", comment: "")
-        keywordLabel.stringValue = NSLocalizedString("Keywords:", comment: "")
-    }
+        
+        
+        batchButton.properties = ComponentButtonProperty(type: .default_tertiary,
+                                                         size: .s,
+                                                         state: .normal,
+                                                         onlyIcon: false,
+                                                         buttonText: KMLocalizedString("Batch"))
+        batchButton.setTarget(self, action: #selector(batchButtonAction(_:)))
+        batchWidthConst.constant = batchButton.properties.propertyInfo.viewWidth
+        
+        cancelButton.properties = ComponentButtonProperty(type: .default_tertiary,
+                                                         size: .s,
+                                                         state: .normal,
+                                                         onlyIcon: false,
+                                                         buttonText: KMLocalizedString("Cancel"))
+        cancelButton.setTarget(self, action: #selector(cancelButtonAction(_:)))
+        cancelWidthConst.constant = cancelButton.properties.propertyInfo.viewWidth
+        
+        doneButton.properties = ComponentButtonProperty(type: .primary,
+                                                         size: .s,
+                                                         state: .normal,
+                                                         onlyIcon: false,
+                                                         buttonText: KMLocalizedString("Encrypt"))
+        doneButton.setTarget(self, action: #selector(doneButtonAction(_:)))
+        doneWidthConst.constant = doneButton.properties.propertyInfo.viewWidth
+        
+        
+     }
     
     func reloadData() {
         
@@ -125,19 +147,17 @@ extension KMSecurityView {
         
         self.canEncrypt = enabled
         if enabled {
-            self.doneButton.isEnabled = true
+            doneButton.properties.isDisabled = false
         } else {
-            self.doneButton.isEnabled = false
+            doneButton.properties.isDisabled = true
         }
+        doneButton.reloadData()
     }
     
     func updatePasswordState() {
         self.model.openPassword = openPassword.stringValue
         self.model.ownerPassword = ownerPassword.stringValue
-        self.model.title = titleTextField.stringValue
-        self.model.author = authorTextField.stringValue
-        self.model.subject = subjectTextField.stringValue
-        self.model.keywords = keywordTextField.stringValue
+        
         self.reloadData()
     }
     
@@ -158,7 +178,7 @@ extension KMSecurityView {
 }
 
 extension KMSecurityView {
-    @IBAction func batchButtonAction(_ sender: Any) {
+    @objc func batchButtonAction(_ sender: Any) {
         if !IAPProductsManager.default().isAvailableAllFunction(){
             KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
             return
@@ -168,13 +188,13 @@ extension KMSecurityView {
         callBack(self, files)
     }
     
-    @IBAction func cancelButtonAction(_ sender: Any) {
+    @objc func cancelButtonAction(_ sender: Any) {
         guard let callBack = cancelAction else { return }
         
         callBack(self)
     }
     
-    @IBAction func doneButtonAction(_ sender: Any) {
+    @objc func doneButtonAction(_ sender: Any) {
         self.updatePasswordState()
         
         if model.ownerPassword == model.openPassword {

+ 42 - 188
PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.xib

@@ -8,17 +8,14 @@
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="KMSecurityView" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
-                <outlet property="authorLabel" destination="feB-OM-BTK" id="z0F-u2-2gZ"/>
-                <outlet property="authorTextField" destination="FbH-uh-vhX" id="TSb-Px-cuK"/>
-                <outlet property="batchButton" destination="uXk-aN-bU2" id="wuM-he-LvR"/>
+                <outlet property="batchButton" destination="isu-0h-g7x" id="1BT-O2-6SM"/>
+                <outlet property="batchWidthConst" destination="7ep-Ty-dPW" id="hvT-0d-fZx"/>
                 <outlet property="box1" destination="ST2-wX-xoy" id="U5Y-7a-KRx"/>
-                <outlet property="box2" destination="AuG-7F-1zd" id="jPC-lV-K5l"/>
                 <outlet property="boxLabel1" destination="aXy-qa-30P" id="bCh-vV-qX9"/>
-                <outlet property="boxLabel2" destination="bDa-JE-YYY" id="tF7-OJ-t8p"/>
-                <outlet property="cancelButton" destination="J4j-YE-zds" id="SI8-j0-Zvg"/>
-                <outlet property="doneButton" destination="zu9-tu-Eu4" id="4N6-12-ny5"/>
-                <outlet property="keywordLabel" destination="Pye-Uj-4I0" id="4zl-eR-4Qq"/>
-                <outlet property="keywordTextField" destination="SX3-7U-7ea" id="qXG-PG-cEL"/>
+                <outlet property="cancelButton" destination="a6k-zh-Xgk" id="ADP-7Q-rjv"/>
+                <outlet property="cancelWidthConst" destination="xKm-qz-lkn" id="WpQ-bX-gLt"/>
+                <outlet property="doneButton" destination="nBe-xF-dqG" id="Agv-Be-fCG"/>
+                <outlet property="doneWidthConst" destination="Vbh-dU-jah" id="iva-pB-Vnz"/>
                 <outlet property="notCopyCheckBtn" destination="Q12-nq-8Ww" id="gpQ-Ln-6cH"/>
                 <outlet property="notPrintCheckBtn" destination="Df0-VK-282" id="KkW-CT-YkD"/>
                 <outlet property="openPassword" destination="6g4-S8-Wrw" id="yCD-AY-913"/>
@@ -27,23 +24,27 @@
                 <outlet property="ownerPassword" destination="KlB-P6-WnC" id="bVf-dr-b7Z"/>
                 <outlet property="ownerPasswordLabel" destination="HTv-gT-hdG" id="zhb-Nz-5py"/>
                 <outlet property="ownerPwdCheckBtn" destination="MN5-MX-XNZ" id="fJo-jR-iVq"/>
-                <outlet property="subjectLabel" destination="621-mt-orF" id="3M7-JD-z4o"/>
-                <outlet property="subjectTextField" destination="wJ2-bm-ZhO" id="Ebc-P3-2hQ"/>
-                <outlet property="titleLabel" destination="G69-bY-klh" id="pad-lb-MQU"/>
-                <outlet property="titleTextField" destination="1qu-Ea-pYg" id="xHO-9b-n9k"/>
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <customView id="c22-O7-iKe">
-            <rect key="frame" x="0.0" y="0.0" width="572" height="544"/>
+            <rect key="frame" x="0.0" y="0.0" width="572" height="431"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <view translatesAutoresizingMaskIntoConstraints="NO" id="NUM-Vn-wUf">
-                    <rect key="frame" x="0.0" y="0.0" width="572" height="544"/>
+                    <rect key="frame" x="0.0" y="0.0" width="572" height="431"/>
                     <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aXy-qa-30P">
+                            <rect key="frame" x="22" y="399" width="170" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Password Security Settings" id="416-1G-mAh">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
                         <box autoresizesSubviews="NO" title="Password Security Settings" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="ST2-wX-xoy">
-                            <rect key="frame" x="37" y="274" width="498" height="236"/>
+                            <rect key="frame" x="37" y="145" width="498" height="236"/>
                             <view key="contentView" id="6hv-cP-65h">
                                 <rect key="frame" x="4" y="5" width="490" height="228"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -155,187 +156,40 @@
                                 <constraint firstAttribute="height" constant="230" id="TNB-oZ-hWb"/>
                             </constraints>
                         </box>
-                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uXk-aN-bU2">
-                            <rect key="frame" x="8" y="13" width="69" height="32"/>
-                            <buttonCell key="cell" type="push" title="Batch" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="BeV-Ko-4dE">
-                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                <font key="font" metaFont="system"/>
-                            </buttonCell>
-                            <connections>
-                                <action selector="batchButtonAction:" target="-2" id="hMt-rI-UNp"/>
-                            </connections>
-                        </button>
-                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="J4j-YE-zds">
-                            <rect key="frame" x="409" y="13" width="76" height="32"/>
-                            <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Yqp-kX-5kF">
-                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                <font key="font" metaFont="system"/>
-                                <string key="keyEquivalent" base64-UTF8="YES">
-Gw
-</string>
-                            </buttonCell>
-                            <connections>
-                                <action selector="cancelButtonAction:" target="-2" id="VDL-pe-5oZ"/>
-                            </connections>
-                        </button>
-                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zu9-tu-Eu4">
-                            <rect key="frame" x="478" y="13" width="81" height="32"/>
-                            <buttonCell key="cell" type="push" title="Encrypt" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="t4I-3Z-AJg">
-                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                <font key="font" metaFont="system"/>
-                                <string key="keyEquivalent" base64-UTF8="YES">
-DQ
-</string>
-                            </buttonCell>
-                            <connections>
-                                <action selector="doneButtonAction:" target="-2" id="Nwn-uO-qCZ"/>
-                            </connections>
-                        </button>
-                        <box autoresizesSubviews="NO" title="Document Description" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="AuG-7F-1zd">
-                            <rect key="frame" x="37" y="66" width="498" height="176"/>
-                            <view key="contentView" id="dsj-4C-14o">
-                                <rect key="frame" x="4" y="5" width="490" height="168"/>
-                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                <subviews>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="G69-bY-klh">
-                                        <rect key="frame" x="14" y="135" width="67" height="16"/>
-                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Title:" id="ChV-F8-rdz">
-                                            <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                                        </textFieldCell>
-                                    </textField>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1qu-Ea-pYg">
-                                        <rect key="frame" x="85" y="132" width="395" height="21"/>
-                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="fDe-4Q-Pyw">
-                                            <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                        </textFieldCell>
-                                    </textField>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="feB-OM-BTK">
-                                        <rect key="frame" x="14" y="99" width="67" height="16"/>
-                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Author:" id="Le5-rl-XYu">
-                                            <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                                        </textFieldCell>
-                                    </textField>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FbH-uh-vhX">
-                                        <rect key="frame" x="85" y="96" width="395" height="21"/>
-                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="dHR-ed-Cv8">
-                                            <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                        </textFieldCell>
-                                    </textField>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pye-Uj-4I0">
-                                        <rect key="frame" x="14" y="27" width="67" height="16"/>
-                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Keywords:" id="Wfk-WB-BEW">
-                                            <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                                        </textFieldCell>
-                                    </textField>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wJ2-bm-ZhO">
-                                        <rect key="frame" x="85" y="60" width="395" height="21"/>
-                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="nPj-Eh-Hsz">
-                                            <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                        </textFieldCell>
-                                    </textField>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SX3-7U-7ea">
-                                        <rect key="frame" x="85" y="24" width="395" height="21"/>
-                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="HXf-ig-qVm">
-                                            <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                        </textFieldCell>
-                                    </textField>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="621-mt-orF">
-                                        <rect key="frame" x="14" y="63" width="67" height="16"/>
-                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Subject:" id="oZ4-Yu-aS5">
-                                            <font key="font" metaFont="system"/>
-                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                                        </textFieldCell>
-                                    </textField>
-                                </subviews>
-                                <constraints>
-                                    <constraint firstItem="621-mt-orF" firstAttribute="leading" secondItem="G69-bY-klh" secondAttribute="leading" id="04r-8r-hob"/>
-                                    <constraint firstItem="wJ2-bm-ZhO" firstAttribute="centerY" secondItem="621-mt-orF" secondAttribute="centerY" id="0Va-dK-TO0"/>
-                                    <constraint firstItem="FbH-uh-vhX" firstAttribute="top" secondItem="1qu-Ea-pYg" secondAttribute="bottom" constant="15" id="103-NO-J4b"/>
-                                    <constraint firstItem="FbH-uh-vhX" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="feB-OM-BTK" secondAttribute="trailing" constant="6" id="1mJ-yD-m1m"/>
-                                    <constraint firstItem="1qu-Ea-pYg" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="G69-bY-klh" secondAttribute="trailing" constant="6" id="3Z7-5b-Xix"/>
-                                    <constraint firstItem="SX3-7U-7ea" firstAttribute="centerY" secondItem="Pye-Uj-4I0" secondAttribute="centerY" id="5Tg-EE-hKi"/>
-                                    <constraint firstItem="wJ2-bm-ZhO" firstAttribute="trailing" secondItem="1qu-Ea-pYg" secondAttribute="trailing" id="Qdv-l4-X1Y"/>
-                                    <constraint firstItem="feB-OM-BTK" firstAttribute="leading" secondItem="G69-bY-klh" secondAttribute="leading" id="RQS-Gb-g25"/>
-                                    <constraint firstItem="feB-OM-BTK" firstAttribute="trailing" secondItem="G69-bY-klh" secondAttribute="trailing" id="Tdj-Iu-7eL"/>
-                                    <constraint firstItem="wJ2-bm-ZhO" firstAttribute="top" secondItem="FbH-uh-vhX" secondAttribute="bottom" constant="15" id="VRD-gi-0hF"/>
-                                    <constraint firstItem="FbH-uh-vhX" firstAttribute="leading" secondItem="1qu-Ea-pYg" secondAttribute="leading" id="XCv-cf-iX1"/>
-                                    <constraint firstItem="621-mt-orF" firstAttribute="trailing" secondItem="G69-bY-klh" secondAttribute="trailing" id="Xuh-EX-GTw"/>
-                                    <constraint firstItem="SX3-7U-7ea" firstAttribute="trailing" secondItem="1qu-Ea-pYg" secondAttribute="trailing" id="YG3-Kl-2xS"/>
-                                    <constraint firstItem="G69-bY-klh" firstAttribute="leading" secondItem="dsj-4C-14o" secondAttribute="leading" constant="16" id="awE-xq-5Pf"/>
-                                    <constraint firstItem="1qu-Ea-pYg" firstAttribute="top" secondItem="dsj-4C-14o" secondAttribute="top" constant="15" id="bKB-BI-pTw"/>
-                                    <constraint firstItem="SX3-7U-7ea" firstAttribute="leading" secondItem="Pye-Uj-4I0" secondAttribute="trailing" constant="6" id="bct-6H-a67"/>
-                                    <constraint firstAttribute="trailing" secondItem="1qu-Ea-pYg" secondAttribute="trailing" constant="10" id="eI6-b6-kJW"/>
-                                    <constraint firstItem="wJ2-bm-ZhO" firstAttribute="leading" secondItem="1qu-Ea-pYg" secondAttribute="leading" id="gqP-vC-Tgh"/>
-                                    <constraint firstItem="SX3-7U-7ea" firstAttribute="leading" secondItem="1qu-Ea-pYg" secondAttribute="leading" id="icb-jY-jeH"/>
-                                    <constraint firstItem="wJ2-bm-ZhO" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="621-mt-orF" secondAttribute="trailing" constant="6" id="lUn-qh-zLz"/>
-                                    <constraint firstItem="1qu-Ea-pYg" firstAttribute="centerY" secondItem="G69-bY-klh" secondAttribute="centerY" id="qb2-DU-WBL"/>
-                                    <constraint firstItem="Pye-Uj-4I0" firstAttribute="trailing" secondItem="G69-bY-klh" secondAttribute="trailing" id="rba-3V-1pZ"/>
-                                    <constraint firstItem="SX3-7U-7ea" firstAttribute="top" secondItem="wJ2-bm-ZhO" secondAttribute="bottom" constant="15" id="rlP-tK-DkG"/>
-                                    <constraint firstItem="FbH-uh-vhX" firstAttribute="centerY" secondItem="feB-OM-BTK" secondAttribute="centerY" id="tfg-yx-HVK"/>
-                                    <constraint firstItem="Pye-Uj-4I0" firstAttribute="leading" secondItem="G69-bY-klh" secondAttribute="leading" id="vem-Yk-TMk"/>
-                                    <constraint firstItem="FbH-uh-vhX" firstAttribute="trailing" secondItem="1qu-Ea-pYg" secondAttribute="trailing" id="xqk-cW-TuF"/>
-                                </constraints>
-                            </view>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="isu-0h-g7x" customClass="ComponentButton" customModule="KMComponentLibrary">
+                            <rect key="frame" x="24" y="16" width="62" height="32"/>
                             <constraints>
-                                <constraint firstAttribute="height" constant="170" id="jfE-Tm-3ew"/>
-                                <constraint firstAttribute="width" constant="492" id="kta-Mj-cgQ"/>
+                                <constraint firstAttribute="width" constant="62" id="7ep-Ty-dPW"/>
+                                <constraint firstAttribute="height" constant="32" id="qDl-YG-vyf"/>
                             </constraints>
-                        </box>
-                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aXy-qa-30P">
-                            <rect key="frame" x="54" y="508" width="170" height="18"/>
+                        </customView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="a6k-zh-Xgk" customClass="ComponentButton" customModule="KMComponentLibrary">
+                            <rect key="frame" x="416" y="16" width="62" height="32"/>
                             <constraints>
-                                <constraint firstAttribute="height" constant="18" id="FeS-5P-ueR"/>
+                                <constraint firstAttribute="height" constant="32" id="twe-GB-Uah"/>
+                                <constraint firstAttribute="width" constant="62" id="xKm-qz-lkn"/>
                             </constraints>
-                            <textFieldCell key="cell" lineBreakMode="clipping" title="Password Security Settings" id="416-1G-mAh">
-                                <font key="font" metaFont="system"/>
-                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                            </textFieldCell>
-                        </textField>
-                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bDa-JE-YYY">
-                            <rect key="frame" x="54" y="240" width="140" height="18"/>
+                        </customView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="nBe-xF-dqG" customClass="ComponentButton" customModule="KMComponentLibrary">
+                            <rect key="frame" x="486" y="16" width="62" height="32"/>
                             <constraints>
-                                <constraint firstAttribute="height" constant="18" id="Exf-QJ-ne2"/>
+                                <constraint firstAttribute="height" constant="32" id="9bk-uW-7c8"/>
+                                <constraint firstAttribute="width" constant="62" id="Vbh-dU-jah"/>
                             </constraints>
-                            <textFieldCell key="cell" lineBreakMode="clipping" title="Document Description" id="t8a-nn-oig">
-                                <font key="font" metaFont="system"/>
-                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                            </textFieldCell>
-                        </textField>
+                        </customView>
                     </subviews>
                     <constraints>
-                        <constraint firstItem="aXy-qa-30P" firstAttribute="top" secondItem="NUM-Vn-wUf" secondAttribute="top" constant="18" id="2mI-FV-BXv"/>
-                        <constraint firstItem="AuG-7F-1zd" firstAttribute="top" secondItem="bDa-JE-YYY" secondAttribute="bottom" id="34V-O0-9bV"/>
-                        <constraint firstItem="ST2-wX-xoy" firstAttribute="top" secondItem="aXy-qa-30P" secondAttribute="bottom" id="8of-mz-w1C"/>
-                        <constraint firstItem="bDa-JE-YYY" firstAttribute="leading" secondItem="NUM-Vn-wUf" secondAttribute="leading" constant="56" id="Atk-Lb-F40"/>
-                        <constraint firstItem="aXy-qa-30P" firstAttribute="leading" secondItem="NUM-Vn-wUf" secondAttribute="leading" constant="56" id="BT3-O2-jf6"/>
-                        <constraint firstItem="zu9-tu-Eu4" firstAttribute="leading" secondItem="J4j-YE-zds" secondAttribute="trailing" constant="7" id="CPB-xB-qTX"/>
-                        <constraint firstItem="bDa-JE-YYY" firstAttribute="top" secondItem="ST2-wX-xoy" secondAttribute="bottom" constant="20" id="ETv-4a-FLN"/>
-                        <constraint firstAttribute="bottom" secondItem="uXk-aN-bU2" secondAttribute="bottom" constant="20" id="FAE-Ee-xvR"/>
+                        <constraint firstItem="aXy-qa-30P" firstAttribute="top" secondItem="NUM-Vn-wUf" secondAttribute="top" constant="16" id="2mI-FV-BXv"/>
+                        <constraint firstItem="aXy-qa-30P" firstAttribute="leading" secondItem="NUM-Vn-wUf" secondAttribute="leading" constant="24" id="BT3-O2-jf6"/>
+                        <constraint firstAttribute="bottom" secondItem="nBe-xF-dqG" secondAttribute="bottom" constant="16" id="LQT-Xt-pwv"/>
+                        <constraint firstAttribute="bottom" secondItem="a6k-zh-Xgk" secondAttribute="bottom" constant="16" id="Lsh-7K-lJx"/>
+                        <constraint firstItem="ST2-wX-xoy" firstAttribute="top" secondItem="NUM-Vn-wUf" secondAttribute="top" constant="52" id="MG7-9V-Wjp"/>
                         <constraint firstItem="ST2-wX-xoy" firstAttribute="centerX" secondItem="NUM-Vn-wUf" secondAttribute="centerX" id="U9e-z3-nfl"/>
-                        <constraint firstItem="zu9-tu-Eu4" firstAttribute="centerY" secondItem="uXk-aN-bU2" secondAttribute="centerY" id="XT7-oe-yLC"/>
                         <constraint firstAttribute="trailing" secondItem="ST2-wX-xoy" secondAttribute="trailing" constant="40" id="Xtj-EA-E5b"/>
-                        <constraint firstItem="zu9-tu-Eu4" firstAttribute="top" secondItem="AuG-7F-1zd" secondAttribute="bottom" constant="30" id="frF-lS-4u4"/>
-                        <constraint firstAttribute="trailing" secondItem="zu9-tu-Eu4" secondAttribute="trailing" constant="20" id="jwN-kH-sgb"/>
-                        <constraint firstItem="J4j-YE-zds" firstAttribute="centerY" secondItem="uXk-aN-bU2" secondAttribute="centerY" id="nLe-SK-5bJ"/>
-                        <constraint firstItem="AuG-7F-1zd" firstAttribute="leading" secondItem="ST2-wX-xoy" secondAttribute="leading" id="pr5-4L-E6z"/>
-                        <constraint firstItem="uXk-aN-bU2" firstAttribute="leading" secondItem="NUM-Vn-wUf" secondAttribute="leading" constant="15" id="ygR-VP-pdj"/>
+                        <constraint firstItem="isu-0h-g7x" firstAttribute="leading" secondItem="NUM-Vn-wUf" secondAttribute="leading" constant="24" id="fHS-zS-RO4"/>
+                        <constraint firstAttribute="trailing" secondItem="nBe-xF-dqG" secondAttribute="trailing" constant="24" id="phE-Sm-FYU"/>
+                        <constraint firstItem="nBe-xF-dqG" firstAttribute="leading" secondItem="a6k-zh-Xgk" secondAttribute="trailing" constant="8" id="xjA-7i-VFK"/>
+                        <constraint firstAttribute="bottom" secondItem="isu-0h-g7x" secondAttribute="bottom" constant="16" id="zX7-YW-zBg"/>
                     </constraints>
                 </view>
             </subviews>
@@ -345,7 +199,7 @@ DQ
                 <constraint firstAttribute="trailing" secondItem="NUM-Vn-wUf" secondAttribute="trailing" id="Awj-Tg-tsj"/>
                 <constraint firstItem="NUM-Vn-wUf" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="L5a-dl-Cal"/>
             </constraints>
-            <point key="canvasLocation" x="159.5" y="220"/>
+            <point key="canvasLocation" x="155" y="163.5"/>
         </customView>
     </objects>
 </document>

+ 328 - 221
PDF Office/PDF Master/Class/PDFTools/TTS/WindowController/KMTTSWindowController.swift

@@ -6,6 +6,7 @@
 //
 
 import Cocoa
+import KMComponentLibrary
 
 typealias TTSCloseWindowCallback = (_ isCloseWindow: Bool) -> Void
 
@@ -13,28 +14,43 @@ let  minSpeed: Float = 0.6
 let  maxSpeed: Float = 5.0
 let  standardSpeed: Float = 175.0
 
-class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowDelegate, NSTextFieldDelegate{
-    var pdfView: CPDFView!
-    var closeWindowCallback: TTSCloseWindowCallback?
-    @IBOutlet var sontinuouButton: NSButton!
-    @IBOutlet var speedLabel: NSTextField!
-    @IBOutlet var languageLabel: NSTextField!
+class KMTTSWindowController: NSWindowController, NSWindowDelegate{
     
-    @IBOutlet var languageComboBox: NSPopUpButton!
-    @IBOutlet var speedTextField: NSTextField!
-    @IBOutlet var speedSlider: NSSlider!
-    
-    @IBOutlet var speedStepper: NSStepper!
-    @IBOutlet var nextButton: KMToolbarItem!
-    @IBOutlet var forwardButton: KMToolbarItem!
+    @IBOutlet var titleLabel: NSTextField!
+    @IBOutlet var previousButton: ComponentButton!
+    @IBOutlet var playButton: ComponentButton!
+    @IBOutlet var nextButton: ComponentButton!
+    @IBOutlet var divider: ComponentDivider!
+    @IBOutlet var languageLabel: NSTextField!
+    @IBOutlet var languageSelect: ComponentSelect!
+    @IBOutlet var speedLabel: NSTextField!
+    @IBOutlet var speedSlider: ComponentSlider!
+    @IBOutlet var speedInput: ComponentInputNumber!
+    @IBOutlet var continueCheckbox: ComponentCheckBox!
     
-    @IBOutlet var playButton: KMToolbarItem!
     
-    @IBOutlet var speedBox: NSBox!
     
     
-    @IBOutlet var sppendCountLabel: NSTextField!
+    //    @IBOutlet var sontinuouButton: NSButton!
+    //    @IBOutlet var speedLabel: NSTextField!
+    //    @IBOutlet var languageLabel: NSTextField!
+    //
+    //    @IBOutlet var languageComboBox: NSPopUpButton!
+    //    @IBOutlet var speedTextField: NSTextField!
+    //    @IBOutlet var speedSlider: NSSlider!
+    //
+    //    @IBOutlet var speedStepper: NSStepper!
+    //    @IBOutlet var nextButton: KMToolbarItem!
+    //    @IBOutlet var forwardButton: KMToolbarItem!
+    //
+    //    @IBOutlet var playButton: KMToolbarItem!
+    //
+    //    @IBOutlet var speedBox: NSBox!
+    //
+    //    @IBOutlet var sppendCountLabel: NSTextField!
     
+    var pdfView: CPDFView!
+    var closeWindowCallback: TTSCloseWindowCallback?
     
     var pdfSelection: CPDFSelection?
     
@@ -49,33 +65,71 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
     convenience init() {
         self.init(windowNibName: "KMTTSWindowController")
     }
+    
     deinit {
         DistributedNotificationCenter.default().removeObserver(self)
         NotificationCenter.default.removeObserver(self)
     }
+    
     override func windowDidLoad() {
         super.windowDidLoad()
-        self.window?.title = NSLocalizedString("TTS", comment: "")
         
-        self.speedStepper.minValue = Double(minSpeed)
-        self.speedStepper.maxValue = Double(maxSpeed);
-        self.speedSlider.minValue = Double(minSpeed);
-        self.speedSlider.maxValue = Double(maxSpeed);
+        setUpproperty()
+    }
+     
+    func setUpproperty() {
+        
+        titleLabel.stringValue = KMLocalizedString("TTS")
+        titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        titleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
         
-        self.nextButton.toolTip = KMLocalizedString("Next Page")
-        self.forwardButton.toolTip = KMLocalizedString("Previous Page")
-        self.speedSlider.isEnabled = true
-        self.speedStepper.isEnabled = true
-        self.playButton.toolTip = KMLocalizedString("Play")
-        self.sppendCountLabel.stringValue = KMLocalizedString("SpeedX")
-        let str = String(format: "%.1f", KMTTSManager.defalutManager.rate/Float(standardSpeed))
-        self.speedStepper.stringValue = str
-        self.speedTextField.stringValue = str
-        self.speedSlider.stringValue = str//[NSString stringWithFormat:@"%.1f",([KMTTSManager defaultManager].rate/standardSpeed)];
+        previousButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, onlyIcon: true, icon: NSImage(named: "previous_fill"))
+        playButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, onlyIcon: true, icon: NSImage(named: "pause_fill"))
+        nextButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, onlyIcon: true, icon: NSImage(named: "next_fill"))
+        
+        previousButton.setTarget(self, action: #selector(buttonItemClick_Forward(_:)))
+        playButton.setTarget(self, action: #selector(buttonItemClick_Play(_:)))
+        nextButton.setTarget(self, action: #selector(buttonItemClick_Next(_:)))
+        
+        languageLabel.stringValue = KMLocalizedString("Language:")
+        languageLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-form/colorText-label")
+        languageLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
+        
+        languageSelect.properties = ComponentSelectProperties(size: .s,
+                                                              state: .normal,
+                                                              creatable: false,
+                                                              text: "English (Albert)",
+                                                              textUnit: "")
+        languageSelect.delegate = self
+        
+        speedLabel.stringValue = KMLocalizedString("Speed:")
+        speedLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-form/colorText-label")
+        speedLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
+        
+        speedSlider.properties = ComponentSliderProperty(size: .m, percent: 1)
+        speedSlider.delegate = self
+         
+        speedInput.properties = ComponentInputNumberProperty(alignment: .left,
+                                                             size: .s,
+                                                             state: .normal,
+                                                             isError: false,
+                                                             showErrorInfo: false,
+                                                             isDisabled: false,
+                                                             showPrefix: false,
+                                                             showSuffix: false,
+                                                             minSize: 1,
+                                                             maxSize: 11,
+                                                             text:"1",
+                                                             valueType: .floatType)
+        speedInput.delegate = self
+ 
+        continueCheckbox.properties = ComponentCheckBoxProperty(size: .s,
+                                                                state: .normal,
+                                                                isDisabled: false,
+                                                                showhelp: false,
+                                                                text: KMLocalizedString("Continuous Reading"),
+                                                                checkboxType: .normal)
         
-        self.sontinuouButton.title = KMLocalizedString("Continuous Reading");
-        self.speedLabel.stringValue = KMLocalizedString("Speed") + ":"//[NSString stringWithFormat:@"%@:",KMLocalizedString("Speed")];
-        self.languageLabel.stringValue = KMLocalizedString("Language") + ":" //[NSString stringWithFormat:@"%@:",KMLocalizedString(@"Language")];
         
         let array = KMTTSManager.defalutManager.availableVoices()
         let currentVoicName = KMTTSManager.defalutManager.voice()
@@ -84,7 +138,6 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
         
         for voiceType: NSSpeechSynthesizer.VoiceName in array {
             let voiceDic = NSMutableDictionary()
-            //            let dic = KMTTSManager.defalutManager.attributesForVoice(voiceType)
             let voiceLocaleIdentifier = ( NSSpeechSynthesizer.attributes( forVoice: voiceType )[ NSSpeechSynthesizer.VoiceAttributeKey.localeIdentifier ] as! String )
             
             let name = self.switchLanguage(withCode: voiceLocaleIdentifier)
@@ -92,6 +145,8 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
             voiceDic["voiceName"] = name
             voiceArrays.add(voiceDic)
         }
+        
+        var opacityItems: [ComponentMenuitemProperty] = []
         voiceArrays = self.sortArray(voiceArrays)
         for i in 0..<voiceArrays.count {
             let voiceDic = voiceArrays[i] as! NSDictionary
@@ -108,77 +163,35 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
             if voiceName.count > 0 {
                 languageStaring = "\(name)(\(voiceName))"
             }
-            
-            let font = NSFont.systemFont(ofSize: 12.0)
-            let namefont = NSFont.systemFont(ofSize: 10.0)
-            
-            let textRowSpace = NSMutableAttributedString(string: languageStaring ?? "")
-            textRowSpace.addAttribute(.font, value: font, range: NSRange(location: 0, length: name.count))
-            textRowSpace.addAttribute(.font, value: namefont, range: NSRange(location: name.count, length: languageStaring!.count - name.count))
-            let item = NSMenuItem()
-            item.attributedTitle = textRowSpace
-            menu.addItem(item)
+            if let value = languageStaring, value.count > 0 {
+                let item = ComponentMenuitemProperty(type: .normal, text: value)
+                opacityItems.append(item)
+            }
+            languageSelect.updateMenuItemsArr(opacityItems)
         }
-        self.languageComboBox.menu = menu
-        self.languageComboBox.selectItem(at: currentIndex)
+        languageSelect.selectItemAtIndex(currentIndex)
+        
         KMTTSManager.defalutManager.delegate = self
+        
         self.updateViewColor()
-        self.window?.standardWindowButton(.zoomButton)?.isHidden = true
+        
         if KMTTSManager.defalutManager.isContinue {
-            self.sontinuouButton.state = .on
+            continueCheckbox.properties.checkboxType = .selected
         } else {
-            self.sontinuouButton.state = .off
+            continueCheckbox.properties.checkboxType = .normal
         }
+        continueCheckbox.setTarget(self, action: #selector(buttonItemClick_Continue(_:)))
+        continueCheckbox.reloadData()
+        
         DistributedNotificationCenter.default().addObserver(self, selector: #selector(themeChanged(notification:)), name: NSNotification.Name("AppleInterfaceThemeChangedNotification"), object: nil)
         
         NotificationCenter.default.addObserver(self, selector: #selector(handlePageChangedNotification), name: NSNotification.Name.CPDFViewPageChanged, object: self.pdfView)
     }
     
     func updateViewColor() {
-        var viewBackcolor = NSColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)
-        var textColor = NSColor(red: 51.0/255.0, green: 51.0/255.0, blue: 51.0/255.0, alpha: 1.0)
-        var contentColor = NSColor(red: 102.0/255.0, green: 102.0/255.0, blue: 102.0/255.0, alpha: 1.0)
-        var fillColor = NSColor.white
-        if #available(macOS 10.14, *) {
-            let appearanceName = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
-            if appearanceName == .darkAqua {
-                viewBackcolor = NSColor(red: 69.0/255.0, green: 69.0/255.0, blue: 71.0/255.0, alpha: 1.0)
-                textColor = NSColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)
-                contentColor = NSColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 0.6)
-                fillColor = NSColor(red: 101.0/255.0, green: 101.0/255.0, blue: 101.0/255.0, alpha: 1.0)
-            }
-        }
         
-        self.window?.backgroundColor = viewBackcolor
-        self.window?.isMovableByWindowBackground = true
-        self.languageLabel.textColor = contentColor
-        self.speedLabel.textColor = contentColor
-        self.speedTextField.textColor = textColor
-        self.speedBox.fillColor = fillColor
-        self.sontinuouButton.setTitleColor(contentColor)
     }
     
-    
-    @objc func themeChanged(notification: NSNotification) {
-        DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
-            self.updateViewColor()
-        }
-    }
-    @objc func handlePageChangedNotification(notification: NSNotification) {
-        guard let PDFView = notification.object as? CPDFView else { return }
-        if PDFView == self.pdfView {
-            if self.pdfView.canGoToNextPage() {
-                self.nextButton.isEnabled = true
-            } else{
-                self.nextButton.isEnabled = false
-            }
-            if self.pdfView.canGoToPreviousPage() {
-                self.forwardButton.isEnabled = true
-            } else {
-                self.forwardButton.isEnabled = false
-            }
-        }
-    }
     func sortArray(_ array: NSArray) -> NSMutableArray {
         let sortDesc = [NSSortDescriptor(key: "voiceName", ascending: true)]
         let sortedArr = array.sortedArray(using: sortDesc) as NSArray
@@ -196,27 +209,40 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
     
     override func showWindow(_ sender: Any?) {
         super.showWindow(sender)
+        
         self.isChangePage = false
         if self.pdfView.canGoToNextPage() {
-            self.nextButton.isEnabled = true
+            nextButton.properties.isDisabled = false
         } else{
-            self.nextButton.isEnabled = false
+            nextButton.properties.isDisabled = true
         }
+        nextButton.reloadData()
+        
         if self.pdfView.canGoToPreviousPage() {
-            self.forwardButton.isEnabled = true
+            previousButton.properties.isDisabled = false
         } else {
-            self.forwardButton.isEnabled = false
+            previousButton.properties.isDisabled = true
         }
+        previousButton.reloadData()
+        
+        speedSlider.reloadData()
+        
     }
     
     func stopSpeaking() {
         if KMTTSManager.defalutManager.isSpeaking() || KMTTSManager.defalutManager.isPaused {
             self.isChangePage = true
             KMTTSManager.defalutManager.stopSpeaking()
-            self.speedSlider.isEnabled = true
-            self.speedStepper.isEnabled = true
-            self.playButton.image = NSImage(named: "KMImageNameTTSStop")
-            self.playButton.toolTip = NSLocalizedString("Play", comment: "")
+            
+            speedSlider.properties.isDisabled = false
+            speedSlider.reloadData()
+            
+            speedInput.properties.isDisabled = false
+            speedInput.reloadData()
+            
+            playButton.properties.icon = NSImage(named: "pause_fill")
+            playButton.reloadData()
+            
             self.pdfView.setHighlightedSelections([])
         }
         self.pdfSelection = nil
@@ -231,28 +257,36 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
         self.currentPageIndex = Int(self.pdfView.document?.index(for: page) ?? 0)
         self.startSpeakingPDFPage(page)
     }
+    
     func startSpeakingPDFPage(_ page: CPDFPage) {
-        let dex = self.languageComboBox.indexOfSelectedItem
+        
+        let dex = self.languageSelect.indexOfSelect()
         if dex >= 0 && dex < self.voiceArrays.count {
             let dic: NSMutableDictionary = self.voiceArrays[dex] as! NSMutableDictionary
             if let voiceName = dic["voiceType"] {
                 KMTTSManager.defalutManager.setVoice(voice: voiceName as! NSSpeechSynthesizer.VoiceName)
             }
         }
-        KMTTSManager.defalutManager.rate = self.speedSlider.floatValue * Float(standardSpeed)
+        KMTTSManager.defalutManager.rate = Float(self.speedSlider.properties.percent) * Float(standardSpeed)
         let isSuccess = KMTTSManager.defalutManager.startSpeakingPDFPage(page)
         if isSuccess {
-            self.playButton.image = NSImage(named: "KMImageNameTTSPause")
-            self.playButton.toolTip = NSLocalizedString("Pause", comment: "")
-            self.speedSlider.isEnabled = false
-            self.speedStepper.isEnabled = false
+            playButton.properties.icon = NSImage(named: "play_fill")
+            playButton.toolTip = NSLocalizedString("Pause", comment: "")
+            speedSlider.properties.isDisabled = true
+            speedInput.properties.isDisabled = true
+            
         } else {
-            self.playButton.image = NSImage(named: "KMImageNameTTSStop")
-            self.playButton.toolTip = NSLocalizedString("Play", comment: "")
-            self.speedSlider.isEnabled = true
-            self.speedStepper.isEnabled = true
+            playButton.properties.icon = NSImage(named: "pause_fill")
+            playButton.toolTip = NSLocalizedString("Play", comment: "")
+            speedSlider.properties.isDisabled = false
+            speedInput.properties.isDisabled = false
+            
         }
+        playButton.reloadData()
+        speedSlider.reloadData()
+        speedInput.reloadData()
     }
+    
     func startSpeakingPDFSelection(_ selection: CPDFSelection) {
         if KMTTSManager.defalutManager.isSpeaking() || KMTTSManager.defalutManager.isPaused {
             KMTTSManager.defalutManager.stopSpeaking()
@@ -260,28 +294,60 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
         }
         self.pdfSelection = selection
         self.pdfView?.setCurrentSelection(nil, animate: false)
-        let dex = self.languageComboBox.indexOfSelectedItem
+        let dex = self.languageSelect.indexOfSelect()
         if dex >= 0 && dex < self.voiceArrays.count {
             let dic: NSMutableDictionary = self.voiceArrays[dex] as! NSMutableDictionary
             if let voiceName = dic["voiceType"] as? NSSpeechSynthesizer.VoiceName {
                 KMTTSManager.defalutManager.setVoice(voice: voiceName)
             }
         }
-        KMTTSManager.defalutManager.rate = self.speedSlider.floatValue * Float(standardSpeed)
+        KMTTSManager.defalutManager.rate = Float(self.speedSlider.properties.percent) * Float(standardSpeed)
         let isSuccess = KMTTSManager.defalutManager.startSpeakingPDFSelection(selection)
         if isSuccess {
-            self.speedSlider.isEnabled = false
-            self.speedStepper.isEnabled = false
-            self.playButton.image = NSImage(named: "KMImageNameTTSPause")
-            self.playButton.toolTip = NSLocalizedString("Pause", comment: "")
+            playButton.properties.icon = NSImage(named: "play_fill")
+            playButton.toolTip = NSLocalizedString("Pause", comment: "")
+            speedSlider.properties.isDisabled = true
+            speedInput.properties.isDisabled = true
+            
         } else {
-            self.speedSlider.isEnabled = true
-            self.speedStepper.isEnabled = true
-            self.playButton.image = NSImage(named: "KMImageNameTTSStop")
-            self.playButton.toolTip = NSLocalizedString("Play", comment: "")
+            playButton.properties.icon = NSImage(named: "pause_fill")
+            playButton.toolTip = NSLocalizedString("Play", comment: "")
+            speedSlider.properties.isDisabled = false
+            speedInput.properties.isDisabled = false
+            
+        }
+    }
+    
+    //MARK: - Noti
+    @objc func themeChanged(notification: NSNotification) {
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+            self.updateViewColor()
         }
     }
-    @IBAction func buttonItemClick_Next(_ sender: NSButton) {
+    
+    @objc func handlePageChangedNotification(notification: NSNotification) {
+        guard let PDFView = notification.object as? CPDFView else { return }
+        if PDFView == self.pdfView {
+            
+            if self.pdfView.canGoToNextPage() {
+                nextButton.properties.isDisabled = false
+            } else{
+                nextButton.properties.isDisabled = true
+            }
+            nextButton.reloadData()
+            
+            if self.pdfView.canGoToPreviousPage() {
+                previousButton.properties.isDisabled = false
+            } else {
+                previousButton.properties.isDisabled = true
+            }
+            previousButton.reloadData()
+            
+        }
+    }
+    
+    //MARK: - IBAction
+    @objc func buttonItemClick_Next(_ sender: NSView) {
         if (KMTTSManager.defalutManager.isSpeaking()) {
             var currentPageNum = self.currentPageIndex;
             var page: CPDFPage?
@@ -298,7 +364,8 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
             self.startSpeakingPDFPage(page!)
         }
     }
-    @IBAction func buttonItemClick_Forward(_ sender: NSButton) {
+    
+    @objc func buttonItemClick_Forward(_ sender: NSView) {
         if (KMTTSManager.defalutManager.isSpeaking()) {
             var currentPageNum = self.currentPageIndex;
             var page: CPDFPage?
@@ -315,20 +382,22 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
             self.startSpeakingPDFPage(page!)
         }
     }
-    @IBAction func buttonItemClick_Play(_ sender: KMToolbarItem) {
+    
+    @objc func buttonItemClick_Play(_ sender: NSView) {
         if (KMTTSManager.defalutManager.isPaused) {
-            self.playButton.image = NSImage(named: "KMImageNameTTSPause")
+            self.playButton.properties.icon = NSImage(named: "play_fill")
             self.playButton.toolTip = KMLocalizedString("Pause")
-            self.speedSlider.isEnabled = false
-            self.speedStepper.isEnabled = false
+            self.speedSlider.properties.isDisabled = true
+            self.speedInput.properties.isDisabled = true
+            
             KMTTSManager.defalutManager.continueSpeaking()
         } else if (KMTTSManager.defalutManager.isSpeaking()) {
             self.isChangePage = true
-            self.playButton.image = NSImage(named: "KMImageNameTTSStop")
+            self.playButton.properties.icon = NSImage(named: "pause_fill")
             self.playButton.toolTip = KMLocalizedString("Play")
+            self.speedSlider.properties.isDisabled = false
+            self.speedInput.properties.isDisabled = false
             
-            self.speedSlider.isEnabled = true
-            self.speedStepper.isEnabled = true
             self.pdfView.setHighlightedSelection(nil, animated: false)
             KMTTSManager.defalutManager.pauseSpeaking()
         } else {
@@ -343,28 +412,32 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
             }
         }
     }
-    @IBAction func buttonItemClick_Continue(_ sender: NSButton) {
+    
+    @objc func buttonItemClick_Continue(_ sender: NSView) {
         KMTTSManager.defalutManager.isContinue = !(KMTTSManager.defalutManager.isContinue)
     }
-    @IBAction func stepperItemClick_Speed(_ sender: NSButton) {
-        var rate = self.speedStepper.floatValue
-        let str = String(format: "%.1f", rate)
-        self.speedStepper.stringValue = str
-        self.speedTextField.stringValue = str
-        self.speedSlider.stringValue = str
-        rate = Float(standardSpeed) * rate
-        KMTTSManager.defalutManager.rate = rate
+    
+    func stepperItemClick_Speed(_ sender: NSButton) {
+        //        var rate = self.speedStepper.floatValue
+        //        let str = String(format: "%.1f", rate)
+        //        self.speedStepper.stringValue = str
+        //        self.speedTextField.stringValue = str
+        //        self.speedSlider.stringValue = str
+        //        rate = Float(standardSpeed) * rate
+        //        KMTTSManager.defalutManager.rate = rate
     }
-    @IBAction func sliderItemClick_Speed(_ sender: NSButton) {
-        var rate: CGFloat = CGFloat(self.speedSlider.floatValue)
-        let str = String(format: "%.1f", rate)
-        self.speedStepper.stringValue = str
-        self.speedTextField.stringValue = str
-        self.speedSlider.stringValue = str
-        rate = CGFloat(standardSpeed) * rate
-        KMTTSManager.defalutManager.rate = Float(rate)
+    
+    func sliderItemClick_Speed(_ sender: NSButton) {
+        //        var rate: CGFloat = CGFloat(self.speedSlider.floatValue)
+        //        let str = String(format: "%.1f", rate)
+        //        self.speedStepper.stringValue = str
+        //        self.speedTextField.stringValue = str
+        //        self.speedSlider.stringValue = str
+        //        rate = CGFloat(standardSpeed) * rate
+        //        KMTTSManager.defalutManager.rate = Float(rate)
     }
-    @IBAction func buttonItemClick_Language(_ sender: NSButton) {
+    
+    func buttonItemClick_Language() {
         if KMTTSManager.defalutManager.isSpeaking() {
             self.isChangePage = true
             if let pdfSelection = self.pdfSelection {
@@ -378,85 +451,12 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
             }
         }
     }
+    
+    //MARK: - MouseEvent
     override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         self.window?.makeFirstResponder(self)
     }
-    //MARK: KMTTSManagerDelegate
-    func ttsMananger(_ tts: KMTTSManager, willSpeak selection: CPDFSelection) {
-        self.pdfView?.setHighlightedSelection(selection, animated: false)
-    }
-    func ttsManangerDidFinishSpeech(_ tts: KMTTSManager) -> Bool {
-        var isFinish = true
-        if self.pdfSelection != nil {
-            self.pdfSelection = nil
-            self.pdfView.setHighlightedSelections(nil)
-            self.playButton.image = NSImage(named: "KMImageNameTTSStop")
-            self.speedSlider.isEnabled = true
-            self.speedStepper.isEnabled = true
-            self.playButton.toolTip = KMLocalizedString("Play")
-        } else {
-            if KMTTSManager.defalutManager.isContinue {
-                if !isChangePage {
-                    if let pdfSelection = self.pdfSelection {
-                        self.pdfView.setHighlightedSelections(nil)
-                        self.playButton.image = NSImage(named: "KMImageNameTTSStop")
-                        self.speedSlider.isEnabled = true
-                        self.speedStepper.isEnabled = true
-                        self.playButton.toolTip = KMLocalizedString("Play")
-                    } else {
-                        let currentPageIndex = self.currentPageIndex
-                        if currentPageIndex + 1 < self.pdfView.document.pageCount {
-                            let page = self.pdfView.document.page(at: UInt(currentPageIndex+1))
-                            self.currentPageIndex = currentPageIndex+1
-                            self.pdfView.go(to: page)
-                            self.startSpeakingPDFPage(page!)
-                            isFinish = false
-                        } else {
-                            self.pdfView.setHighlightedSelections(nil)
-                            self.playButton.image = NSImage(named: "KMImageNameTTSStop")
-                            self.speedSlider.isEnabled = true
-                            self.speedStepper.isEnabled = true
-                            self.playButton.toolTip = KMLocalizedString("Play")
-                        }
-                    }
-                }
-            } else {
-                if !isChangePage {
-                    self.speedSlider.isEnabled = true
-                    self.speedStepper.isEnabled = true
-                    self.pdfView.setHighlightedSelections(nil)
-                    self.playButton.image = NSImage(named: "KMImageNameTTSStop")
-                    self.playButton.toolTip = KMLocalizedString("Play")
-                }
-            }
-            if isChangePage {
-                isChangePage = false
-            }
-        }
-        return isFinish
-    }
-    func ttsManangerdidErrorSpeech(_ tts: KMTTSManager, message: String) {
-        
-    }
-    //MARK: NSTextFieldDelegate
-    func controlTextDidEndEditing(_ obj: Notification) {
-        if let textField = obj.object as? NSTextField {
-            if textField == self.speedTextField {
-                var rate: Float = Float(textField.stringValue) ?? 0
-                if maxSpeed - rate < 0 {
-                    rate = maxSpeed
-                } else if rate - minSpeed < 0 {
-                    rate = minSpeed
-                }
-                self.speedStepper.stringValue = String(format: "%.1f", rate)
-                self.speedTextField.stringValue = String(format: "%.1f", rate)
-                self.speedSlider.stringValue = String(format: "%.1f", rate)
-                rate = standardSpeed * rate
-                KMTTSManager.defalutManager.rate = rate
-            }
-        }
-    }
     
     func switchLanguage(withCode code: String) -> String {
         var language = code
@@ -542,3 +542,110 @@ class KMTTSWindowController: NSWindowController, KMTTSManagerDelegate, NSWindowD
 }
 
 
+//MARK: KMTTSManagerDelegate
+extension KMTTSWindowController: KMTTSManagerDelegate {
+    func ttsMananger(_ tts: KMTTSManager, willSpeak selection: CPDFSelection) {
+        self.pdfView?.setHighlightedSelection(selection, animated: false)
+    }
+    
+    func ttsManangerDidFinishSpeech(_ tts: KMTTSManager) -> Bool {
+        var isFinish = true
+        if self.pdfSelection != nil {
+            self.pdfSelection = nil
+            self.pdfView.setHighlightedSelections(nil)
+            self.playButton.properties.icon = NSImage(named: "pause_fill")
+            self.speedSlider.properties.isDisabled = false
+            self.speedInput.properties.isDisabled = false
+            self.playButton.toolTip = KMLocalizedString("Play")
+        } else {
+            if KMTTSManager.defalutManager.isContinue {
+                if !isChangePage {
+                    if let pdfSelection = self.pdfSelection {
+                        self.pdfView.setHighlightedSelections(nil)
+                        self.playButton.properties.icon = NSImage(named: "pause_fill")
+                        
+                        self.speedSlider.properties.isDisabled = false
+                        self.speedInput.properties.isDisabled = false
+                        self.playButton.toolTip = KMLocalizedString("Play")
+                    } else {
+                        let currentPageIndex = self.currentPageIndex
+                        if currentPageIndex + 1 < self.pdfView.document.pageCount {
+                            let page = self.pdfView.document.page(at: UInt(currentPageIndex+1))
+                            self.currentPageIndex = currentPageIndex+1
+                            self.pdfView.go(to: page)
+                            self.startSpeakingPDFPage(page!)
+                            isFinish = false
+                        } else {
+                            self.pdfView.setHighlightedSelections(nil)
+                            self.playButton.properties.icon = NSImage(named: "pause_fill")
+                            self.speedSlider.properties.isDisabled = false
+                            self.speedInput.properties.isDisabled = false
+                            self.playButton.toolTip = KMLocalizedString("Play")
+                        }
+                    }
+                }
+            } else {
+                if !isChangePage {
+                    self.speedSlider.properties.isDisabled = false
+                    self.speedInput.properties.isDisabled = false
+                    self.pdfView.setHighlightedSelections(nil)
+                    self.playButton.properties.icon = NSImage(named: "pause_fill")
+                    self.playButton.toolTip = KMLocalizedString("Play")
+                }
+            }
+            if isChangePage {
+                isChangePage = false
+            }
+        }
+        return isFinish
+    }
+    func ttsManangerdidErrorSpeech(_ tts: KMTTSManager, message: String) {
+        
+    }
+    
+}
+
+//MARK: NSTextFieldDelegate
+extension KMTTSWindowController: NSTextFieldDelegate {
+    func controlTextDidEndEditing(_ obj: Notification) {
+        //        if let textField = obj.object as? NSTextField {
+        //            if textField == self.speedTextField {
+        //                var rate: Float = Float(textField.stringValue) ?? 0
+        //                if maxSpeed - rate < 0 {
+        //                    rate = maxSpeed
+        //                } else if rate - minSpeed < 0 {
+        //                    rate = minSpeed
+        //                }
+        //                self.speedStepper.stringValue = String(format: "%.1f", rate)
+        //                self.speedTextField.stringValue = String(format: "%.1f", rate)
+        //                self.speedSlider.stringValue = String(format: "%.1f", rate)
+        //                rate = standardSpeed * rate
+        //                KMTTSManager.defalutManager.rate = rate
+        //            }
+        //        }
+    }
+    
+}
+
+//MARK: ComponentSelectDelegate
+extension KMTTSWindowController: ComponentSelectDelegate {
+    func componentSelectDidSelect(view: ComponentSelect?, menuItemProperty: ComponentMenuitemProperty?) {
+        buttonItemClick_Language()
+    }
+}
+
+//MARK: ComponentSliderDelegate
+extension KMTTSWindowController: ComponentSliderDelegate {
+    func componentSliderDidUpdate(_ view: ComponentSlider) {
+        let percent = view.properties.percent
+        
+        
+    }
+}
+
+//MARK: ComponentInputNumberDelegate
+extension KMTTSWindowController: ComponentInputNumberDelegate {
+    func componentInputNumberDidValueChanged(inputNumber: ComponentInputNumber?) {
+        
+    }
+}

+ 130 - 200
PDF Office/PDF Master/Class/PDFTools/TTS/WindowController/KMTTSWindowController.xib

@@ -1,232 +1,162 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="KMTTSWindowController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
-                <outlet property="forwardButton" destination="e4k-fY-QVV" id="8tb-RI-1tB"/>
-                <outlet property="languageComboBox" destination="9fT-vD-o2j" id="eih-GL-lW6"/>
-                <outlet property="languageLabel" destination="rQn-eL-pyW" id="pRa-hs-J9v"/>
-                <outlet property="nextButton" destination="iPi-uv-9TU" id="mSj-CW-N6w"/>
-                <outlet property="playButton" destination="J22-av-VRD" id="4oE-w7-5hv"/>
-                <outlet property="sontinuouButton" destination="upy-4H-SEZ" id="uUc-dp-Nec"/>
-                <outlet property="speedBox" destination="GzC-vA-NHb" id="Xg1-ek-g1t"/>
-                <outlet property="speedLabel" destination="DFJ-Ak-XZz" id="uHf-ld-u9F"/>
-                <outlet property="speedSlider" destination="kuF-Om-R8M" id="eXe-gW-nfF"/>
-                <outlet property="speedStepper" destination="rNV-Re-6ql" id="JhG-B2-bmV"/>
-                <outlet property="speedTextField" destination="xA2-tf-ljd" id="OKg-mA-fnP"/>
-                <outlet property="sppendCountLabel" destination="zCs-0F-iqc" id="zpp-Oz-cyj"/>
+                <outlet property="continueCheckbox" destination="KCO-ns-wWr" id="DVy-Bi-iN1"/>
+                <outlet property="divider" destination="q4o-Q5-H0R" id="WKh-yu-ZFw"/>
+                <outlet property="languageLabel" destination="A0B-vT-R5b" id="rLd-uu-2q8"/>
+                <outlet property="languageSelect" destination="uSS-HE-Ad1" id="J0a-JC-5zL"/>
+                <outlet property="nextButton" destination="evR-uL-gDz" id="88K-eV-1zt"/>
+                <outlet property="playButton" destination="gkQ-Zt-RiX" id="fTk-7N-dzL"/>
+                <outlet property="previousButton" destination="2ti-MI-eLl" id="kjc-84-gZ2"/>
+                <outlet property="speedInput" destination="m2k-qX-UXK" id="aJh-GD-CbC"/>
+                <outlet property="speedLabel" destination="9Pr-dt-cob" id="TNR-oj-HF6"/>
+                <outlet property="speedSlider" destination="lTQ-1g-9YF" id="YfA-BM-dtQ"/>
+                <outlet property="titleLabel" destination="iVL-nd-0Dr" id="5dj-Np-S5o"/>
                 <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <window title="TTS" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
+        <window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" titleVisibility="hidden" id="F0z-JX-Cv5">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" fullSizeContentView="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
-            <rect key="contentRect" x="449" y="545" width="353" height="179"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
+            <rect key="contentRect" x="449" y="545" width="480" height="276"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
             <value key="minSize" type="size" width="353" height="179"/>
             <value key="maxSize" type="size" width="353" height="179"/>
             <view key="contentView" id="se5-gp-TjO">
-                <rect key="frame" x="0.0" y="0.0" width="353" height="187"/>
+                <rect key="frame" x="0.0" y="0.0" width="480" height="276"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
-                    <button focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="e4k-fY-QVV" customClass="KMToolbarItem" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                        <rect key="frame" x="77" y="127" width="20" height="20"/>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="5Mb-xL-69R">
+                        <rect key="frame" x="0.0" y="12" width="480" height="236"/>
+                        <subviews>
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iVL-nd-0Dr">
+                                <rect key="frame" x="22" y="208" width="29" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="TTS" id="UTJ-Ss-ahR">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="2ti-MI-eLl" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                <rect key="frame" x="120" y="160" width="32" height="32"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="32" id="Bhg-YU-kC4"/>
+                                    <constraint firstAttribute="height" constant="32" id="lhB-vF-v9E"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="gkQ-Zt-RiX" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                <rect key="frame" x="224" y="160" width="32" height="32"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="32" id="Wnc-qm-Uc9"/>
+                                    <constraint firstAttribute="height" constant="32" id="fGA-Fx-rt5"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="evR-uL-gDz" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                <rect key="frame" x="328" y="160" width="32" height="32"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="32" id="KoK-Hm-RmV"/>
+                                    <constraint firstAttribute="width" constant="32" id="pt8-de-mQG"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="q4o-Q5-H0R" customClass="ComponentDivider" customModule="KMComponentLibrary">
+                                <rect key="frame" x="24" y="139" width="432" height="1"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="432" id="L33-d8-nNh"/>
+                                    <constraint firstAttribute="height" constant="1" id="lsZ-Oy-vVn"/>
+                                </constraints>
+                            </customView>
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="A0B-vT-R5b">
+                                <rect key="frame" x="22" y="95" width="68" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Language:" id="lrT-XF-C5D">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="uSS-HE-Ad1" customClass="ComponentSelect" customModule="KMComponentLibrary">
+                                <rect key="frame" x="92" y="87" width="364" height="32"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="32" id="pur-gt-XUZ"/>
+                                </constraints>
+                            </customView>
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9Pr-dt-cob">
+                                <rect key="frame" x="22" y="55" width="47" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Speed:" id="7gt-dW-008">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="lTQ-1g-9YF" customClass="ComponentSlider" customModule="KMComponentLibrary">
+                                <rect key="frame" x="75" y="47" width="285" height="32"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="32" id="Nez-cE-0FJ"/>
+                                    <constraint firstAttribute="width" constant="285" id="QCQ-01-5M8"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="m2k-qX-UXK" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
+                                <rect key="frame" x="376" y="47" width="80" height="32"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="80" id="TnV-oL-jj4"/>
+                                    <constraint firstAttribute="height" constant="32" id="r35-ea-7GP"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="KCO-ns-wWr" customClass="ComponentCheckBox" customModule="KMComponentLibrary">
+                                <rect key="frame" x="24" y="7" width="232" height="32"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="32" id="KRw-uM-cIE"/>
+                                    <constraint firstAttribute="width" constant="232" id="d6z-aR-Dua"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
                         <constraints>
-                            <constraint firstAttribute="height" constant="20" id="Qi5-8w-VGb"/>
-                            <constraint firstAttribute="width" constant="20" id="SOJ-Eb-cZp"/>
+                            <constraint firstItem="m2k-qX-UXK" firstAttribute="centerY" secondItem="lTQ-1g-9YF" secondAttribute="centerY" id="2Cp-Nq-cOg"/>
+                            <constraint firstItem="gkQ-Zt-RiX" firstAttribute="top" secondItem="5Mb-xL-69R" secondAttribute="top" constant="44" id="7Rm-Rc-X1N"/>
+                            <constraint firstAttribute="height" constant="236" id="7k9-iS-Yrb"/>
+                            <constraint firstItem="KCO-ns-wWr" firstAttribute="top" secondItem="lTQ-1g-9YF" secondAttribute="bottom" constant="8" id="8Ee-a8-xk2"/>
+                            <constraint firstItem="lTQ-1g-9YF" firstAttribute="centerY" secondItem="9Pr-dt-cob" secondAttribute="centerY" id="D48-BD-sZc"/>
+                            <constraint firstItem="m2k-qX-UXK" firstAttribute="leading" secondItem="lTQ-1g-9YF" secondAttribute="trailing" constant="16" id="GlE-xh-dSp"/>
+                            <constraint firstItem="q4o-Q5-H0R" firstAttribute="centerX" secondItem="5Mb-xL-69R" secondAttribute="centerX" id="HdD-CJ-RrE"/>
+                            <constraint firstItem="evR-uL-gDz" firstAttribute="leading" secondItem="gkQ-Zt-RiX" secondAttribute="trailing" constant="72" id="HwB-Yu-n3D"/>
+                            <constraint firstItem="uSS-HE-Ad1" firstAttribute="centerY" secondItem="A0B-vT-R5b" secondAttribute="centerY" id="IBq-2b-30e"/>
+                            <constraint firstAttribute="trailing" secondItem="uSS-HE-Ad1" secondAttribute="trailing" constant="24" id="PfW-pn-fz0"/>
+                            <constraint firstItem="gkQ-Zt-RiX" firstAttribute="centerX" secondItem="5Mb-xL-69R" secondAttribute="centerX" id="R5v-dw-tq6"/>
+                            <constraint firstItem="A0B-vT-R5b" firstAttribute="leading" secondItem="5Mb-xL-69R" secondAttribute="leading" constant="24" id="Ua0-oG-gGs"/>
+                            <constraint firstItem="m2k-qX-UXK" firstAttribute="top" secondItem="uSS-HE-Ad1" secondAttribute="bottom" constant="8" id="Wcr-Rq-sxd"/>
+                            <constraint firstItem="iVL-nd-0Dr" firstAttribute="leading" secondItem="5Mb-xL-69R" secondAttribute="leading" constant="24" id="WuU-Tn-4cO"/>
+                            <constraint firstItem="9Pr-dt-cob" firstAttribute="leading" secondItem="5Mb-xL-69R" secondAttribute="leading" constant="24" id="Zyx-W7-316"/>
+                            <constraint firstItem="iVL-nd-0Dr" firstAttribute="top" secondItem="5Mb-xL-69R" secondAttribute="top" constant="12" id="b2h-rj-uCI"/>
+                            <constraint firstItem="lTQ-1g-9YF" firstAttribute="leading" secondItem="9Pr-dt-cob" secondAttribute="trailing" constant="8" id="d6g-Qd-g3K"/>
+                            <constraint firstAttribute="trailing" secondItem="m2k-qX-UXK" secondAttribute="trailing" constant="24" id="dZS-YO-Y4s"/>
+                            <constraint firstItem="uSS-HE-Ad1" firstAttribute="top" secondItem="q4o-Q5-H0R" secondAttribute="bottom" constant="20" id="gNg-r8-EFe"/>
+                            <constraint firstItem="gkQ-Zt-RiX" firstAttribute="centerY" secondItem="2ti-MI-eLl" secondAttribute="centerY" id="ld7-de-lFI"/>
+                            <constraint firstItem="uSS-HE-Ad1" firstAttribute="leading" secondItem="A0B-vT-R5b" secondAttribute="trailing" constant="4" id="lkK-J9-kWP"/>
+                            <constraint firstItem="gkQ-Zt-RiX" firstAttribute="leading" secondItem="2ti-MI-eLl" secondAttribute="trailing" constant="72" id="nH1-nE-17a"/>
+                            <constraint firstItem="q4o-Q5-H0R" firstAttribute="top" secondItem="2ti-MI-eLl" secondAttribute="bottom" constant="20" id="rB3-AB-UzR"/>
+                            <constraint firstItem="evR-uL-gDz" firstAttribute="centerY" secondItem="gkQ-Zt-RiX" secondAttribute="centerY" id="suF-bI-Pr0"/>
+                            <constraint firstItem="KCO-ns-wWr" firstAttribute="leading" secondItem="5Mb-xL-69R" secondAttribute="leading" constant="24" id="wEH-SA-NRY"/>
                         </constraints>
-                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameTTSForward" imagePosition="only" alignment="center" focusRingType="none" imageScaling="proportionallyUpOrDown" inset="2" id="cZo-qa-ElH">
-                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="system"/>
-                        </buttonCell>
-                        <connections>
-                            <action selector="buttonItemClick_Forward:" target="-2" id="3sz-e1-G5W"/>
-                        </connections>
-                    </button>
-                    <button focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="J22-av-VRD" customClass="KMToolbarItem" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                        <rect key="frame" x="167" y="127" width="20" height="20"/>
-                        <constraints>
-                            <constraint firstAttribute="width" constant="20" id="FXz-Rp-6x2"/>
-                            <constraint firstAttribute="height" constant="20" id="ohp-zV-fN2"/>
-                        </constraints>
-                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameTTSStop" imagePosition="only" alignment="center" focusRingType="none" imageScaling="proportionallyUpOrDown" inset="2" id="4wL-Pk-QMU">
-                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="system"/>
-                        </buttonCell>
-                        <connections>
-                            <action selector="buttonItemClick_Play:" target="-2" id="uzW-jl-ZIt"/>
-                        </connections>
-                    </button>
-                    <button focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="iPi-uv-9TU" customClass="KMToolbarItem" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                        <rect key="frame" x="257" y="127" width="20" height="20"/>
-                        <constraints>
-                            <constraint firstAttribute="height" constant="20" id="ZLR-0u-A9e"/>
-                            <constraint firstAttribute="width" constant="20" id="xgc-aG-JWR"/>
-                        </constraints>
-                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameTTSNext" imagePosition="only" alignment="center" focusRingType="none" imageScaling="proportionallyUpOrDown" inset="2" id="gr1-LS-zDz">
-                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="system"/>
-                        </buttonCell>
-                        <connections>
-                            <action selector="buttonItemClick_Next:" target="-2" id="4Bg-i6-Fbd"/>
-                        </connections>
-                    </button>
-                    <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="nS9-Bi-nrK">
-                        <rect key="frame" x="20" y="109" width="313" height="5"/>
-                    </box>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DFJ-Ak-XZz">
-                        <rect key="frame" x="18" y="49" width="41" height="15"/>
-                        <textFieldCell key="cell" lineBreakMode="clipping" title="Speed" id="VT8-Zk-oJq">
-                            <font key="font" metaFont="cellTitle"/>
-                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                    </textField>
-                    <slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kuF-Om-R8M">
-                        <rect key="frame" x="65" y="40" width="171" height="28"/>
-                        <sliderCell key="cell" state="on" alignment="left" minValue="1" maxValue="5" doubleValue="3" tickMarkPosition="above" sliderType="linear" id="XqB-cn-IzR"/>
-                        <connections>
-                            <action selector="sliderItemClick_Speed:" target="-2" id="JWB-Ml-1d3"/>
-                        </connections>
-                    </slider>
-                    <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rNV-Re-6ql">
-                        <rect key="frame" x="311" y="42" width="19" height="28"/>
-                        <stepperCell key="cell" continuous="YES" alignment="left" increment="0.10000000000000001" maxValue="100" doubleValue="40" id="dvc-LI-TGa"/>
-                        <connections>
-                            <action selector="stepperItemClick_Speed:" target="-2" id="hCI-F8-3Kh"/>
-                        </connections>
-                    </stepper>
-                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="GzC-vA-NHb">
-                        <rect key="frame" x="239" y="47" width="70" height="19"/>
-                        <view key="contentView" id="TIA-n5-N7G">
-                            <rect key="frame" x="1" y="1" width="68" height="17"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                            <subviews>
-                                <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xA2-tf-ljd">
-                                    <rect key="frame" x="0.0" y="0.0" width="68" height="15"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="64" id="6sI-Pw-hRl"/>
-                                    </constraints>
-                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" focusRingType="none" alignment="center" title="3" id="J9h-gr-ftV">
-                                        <font key="font" metaFont="cellTitle"/>
-                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                    </textFieldCell>
-                                    <connections>
-                                        <outlet property="delegate" destination="-2" id="i1Q-re-mrz"/>
-                                    </connections>
-                                </textField>
-                            </subviews>
-                            <constraints>
-                                <constraint firstAttribute="trailing" secondItem="xA2-tf-ljd" secondAttribute="trailing" constant="2" id="8Qp-4N-AuH"/>
-                                <constraint firstAttribute="bottom" secondItem="xA2-tf-ljd" secondAttribute="bottom" id="BsA-CV-v3r"/>
-                                <constraint firstItem="xA2-tf-ljd" firstAttribute="top" secondItem="TIA-n5-N7G" secondAttribute="top" constant="2" id="Mor-2Z-GL2"/>
-                                <constraint firstItem="xA2-tf-ljd" firstAttribute="leading" secondItem="TIA-n5-N7G" secondAttribute="leading" constant="2" id="b3V-rv-rUa"/>
-                            </constraints>
-                        </view>
-                        <color key="borderColor" red="0.67450980392156867" green="0.67450980392156867" blue="0.67450980392156867" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
-                        <color key="fillColor" white="0.62351190476190477" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                    </box>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zCs-0F-iqc">
-                        <rect key="frame" x="327" y="49" width="13" height="15"/>
-                        <constraints>
-                            <constraint firstAttribute="height" constant="15" id="Gs7-zH-2ub"/>
-                        </constraints>
-                        <textFieldCell key="cell" lineBreakMode="clipping" title="X" id="BXz-xw-Zsy">
-                            <font key="font" metaFont="cellTitle"/>
-                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                    </textField>
-                    <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9fT-vD-o2j">
-                        <rect key="frame" x="83" y="72" width="254" height="25"/>
-                        <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="EDh-Zf-0aV" id="Zfc-vb-Ldc">
-                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="menu"/>
-                            <menu key="menu" id="IZP-oW-2vi">
-                                <items>
-                                    <menuItem title="Item 1" state="on" id="EDh-Zf-0aV"/>
-                                    <menuItem title="Item 2" id="V92-kp-lhe"/>
-                                    <menuItem title="Item 3" id="YcL-bB-wCt"/>
-                                </items>
-                            </menu>
-                        </popUpButtonCell>
-                        <connections>
-                            <action selector="buttonItemClick_Language:" target="-2" id="2Ju-VW-oTv"/>
-                        </connections>
-                    </popUpButton>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rQn-eL-pyW">
-                        <rect key="frame" x="18" y="78" width="60" height="15"/>
-                        <constraints>
-                            <constraint firstAttribute="height" constant="15" id="WJ9-I7-tbx"/>
-                        </constraints>
-                        <textFieldCell key="cell" lineBreakMode="clipping" title="Language" id="bOV-kf-mIJ">
-                            <font key="font" metaFont="cellTitle"/>
-                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                    </textField>
-                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="upy-4H-SEZ">
-                        <rect key="frame" x="18" y="19" width="148" height="18"/>
-                        <buttonCell key="cell" type="check" title="Continuous Reading" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="d25-Vy-Zdu">
-                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
-                            <font key="font" metaFont="system"/>
-                        </buttonCell>
-                        <connections>
-                            <action selector="buttonItemClick_Continue:" target="-2" id="8wd-1L-Qmw"/>
-                        </connections>
-                    </button>
+                    </customView>
                 </subviews>
                 <constraints>
-                    <constraint firstItem="nS9-Bi-nrK" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="0i5-Qy-pQv"/>
-                    <constraint firstItem="J22-av-VRD" firstAttribute="leading" secondItem="e4k-fY-QVV" secondAttribute="trailing" constant="70" id="0l5-ee-XAh"/>
-                    <constraint firstItem="iPi-uv-9TU" firstAttribute="top" secondItem="e4k-fY-QVV" secondAttribute="top" id="2vT-iX-agP"/>
-                    <constraint firstAttribute="bottom" secondItem="upy-4H-SEZ" secondAttribute="bottom" constant="20" id="3zh-1J-ru4"/>
-                    <constraint firstItem="9fT-vD-o2j" firstAttribute="top" secondItem="nS9-Bi-nrK" secondAttribute="bottom" constant="15" id="6I1-I0-WZA"/>
-                    <constraint firstItem="upy-4H-SEZ" firstAttribute="top" secondItem="kuF-Om-R8M" secondAttribute="bottom" constant="10" id="7Jr-Ow-9WM"/>
-                    <constraint firstItem="GzC-vA-NHb" firstAttribute="top" secondItem="9fT-vD-o2j" secondAttribute="bottom" constant="10" id="7Rq-mU-Lzk"/>
-                    <constraint firstItem="9fT-vD-o2j" firstAttribute="leading" secondItem="rQn-eL-pyW" secondAttribute="trailing" constant="10" id="AKE-VC-LbC"/>
-                    <constraint firstItem="DFJ-Ak-XZz" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="F75-a3-ihc"/>
-                    <constraint firstItem="J22-av-VRD" firstAttribute="centerX" secondItem="se5-gp-TjO" secondAttribute="centerX" id="OFG-7x-2uD"/>
-                    <constraint firstItem="GzC-vA-NHb" firstAttribute="centerY" secondItem="DFJ-Ak-XZz" secondAttribute="centerY" id="Ooo-k3-y2c"/>
-                    <constraint firstItem="e4k-fY-QVV" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="40" id="Oz7-WR-sgx"/>
-                    <constraint firstItem="iPi-uv-9TU" firstAttribute="leading" secondItem="J22-av-VRD" secondAttribute="trailing" constant="70" id="PmI-tB-UoK"/>
-                    <constraint firstItem="9fT-vD-o2j" firstAttribute="centerY" secondItem="rQn-eL-pyW" secondAttribute="centerY" id="PqP-A9-Ile"/>
-                    <constraint firstItem="GzC-vA-NHb" firstAttribute="leading" secondItem="kuF-Om-R8M" secondAttribute="trailing" constant="5" id="Tur-QR-UpG"/>
-                    <constraint firstItem="rQn-eL-pyW" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="WU1-N0-ihR"/>
-                    <constraint firstItem="nS9-Bi-nrK" firstAttribute="top" secondItem="e4k-fY-QVV" secondAttribute="bottom" constant="15" id="Wtd-Op-cFs"/>
-                    <constraint firstItem="kuF-Om-R8M" firstAttribute="leading" secondItem="DFJ-Ak-XZz" secondAttribute="trailing" constant="10" id="eZ5-HO-kUa"/>
-                    <constraint firstItem="rNV-Re-6ql" firstAttribute="leading" secondItem="GzC-vA-NHb" secondAttribute="trailing" constant="5" id="ftf-KQ-b6l"/>
-                    <constraint firstItem="upy-4H-SEZ" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="iTX-Ih-n14"/>
-                    <constraint firstItem="zCs-0F-iqc" firstAttribute="leading" secondItem="rNV-Re-6ql" secondAttribute="trailing" constant="2" id="kDv-Yj-zEI"/>
-                    <constraint firstAttribute="trailing" secondItem="nS9-Bi-nrK" secondAttribute="trailing" constant="20" id="pQh-va-Pjg"/>
-                    <constraint firstItem="GzC-vA-NHb" firstAttribute="centerY" secondItem="DFJ-Ak-XZz" secondAttribute="centerY" id="q95-01-Gya"/>
-                    <constraint firstAttribute="trailing" secondItem="9fT-vD-o2j" secondAttribute="trailing" constant="20" id="qdK-nl-QB4"/>
-                    <constraint firstItem="GzC-vA-NHb" firstAttribute="centerY" secondItem="kuF-Om-R8M" secondAttribute="centerY" id="r4R-Ps-N0D"/>
-                    <constraint firstItem="GzC-vA-NHb" firstAttribute="centerY" secondItem="zCs-0F-iqc" secondAttribute="centerY" id="rrd-VG-uF1"/>
-                    <constraint firstItem="J22-av-VRD" firstAttribute="top" secondItem="e4k-fY-QVV" secondAttribute="top" id="ry0-EP-b9Z"/>
-                    <constraint firstItem="J22-av-VRD" firstAttribute="bottom" secondItem="e4k-fY-QVV" secondAttribute="bottom" id="tSW-vg-ftW"/>
-                    <constraint firstItem="GzC-vA-NHb" firstAttribute="centerY" secondItem="rNV-Re-6ql" secondAttribute="centerY" id="tmn-cB-06s"/>
-                    <constraint firstItem="iPi-uv-9TU" firstAttribute="bottom" secondItem="e4k-fY-QVV" secondAttribute="bottom" id="uwP-Os-s7h"/>
-                    <constraint firstAttribute="trailing" secondItem="zCs-0F-iqc" secondAttribute="trailing" constant="15" id="yar-1h-EzA"/>
+                    <constraint firstAttribute="trailing" secondItem="5Mb-xL-69R" secondAttribute="trailing" id="5bd-68-U6M"/>
+                    <constraint firstItem="5Mb-xL-69R" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="28" id="bAc-Ni-xlq"/>
+                    <constraint firstItem="5Mb-xL-69R" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="yyT-DS-IOT"/>
                 </constraints>
             </view>
             <connections>
                 <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
             </connections>
-            <point key="canvasLocation" x="141.5" y="161"/>
+            <point key="canvasLocation" x="141" y="161"/>
         </window>
     </objects>
-    <resources>
-        <image name="KMImageNameTTSForward" width="20" height="20"/>
-        <image name="KMImageNameTTSNext" width="20" height="20"/>
-        <image name="KMImageNameTTSStop" width="20" height="20"/>
-    </resources>
 </document>

+ 0 - 176
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/CPDFListViewColorMenuItemView.swift

@@ -1,176 +0,0 @@
-//
-//  CPDFListViewColorMenuItemView.swift
-//  PDF Reader Pro
-//
-//  Created by wanjun on 2023/9/26.
-//
-
-import Cocoa
-import Quartz
-
-typealias clolorCallBackBlock = ((NSColor?) -> Void)?
-
-let CColorMenuItem_HeadGap: CGFloat = 20
-let CColorMenuItem_DefaultXGap: CGFloat = 2
-let CColorMenuItem_DefaultYGap: CGFloat = 1
-
-class CPDFListViewColorMenuItemView: NSView {
-    
-    var needsColorWheel: Bool = false
-    var colorArray: [NSColor] = []
-    var titleTextField: NSTextField?
-    var block: clolorCallBackBlock?
-
-    // MARK: Init Method
-
-    
-    @objc init(title: String?, colorArray: [Any], needsColorWheel: Bool, completeHandler handler: clolorCallBackBlock) {
-        super.init(frame: .zero)
-        
-        self.block = handler
-        self.needsColorWheel = false
-        self.colorArray = NSArray(array: colorArray) as! [NSColor]
-        var x: CGFloat = CColorMenuItem_HeadGap
-        
-        
-        if let title = title {
-            let size = (title as NSString).size(withAttributes: [NSAttributedString.Key.font: NSFont.systemFont(ofSize: 14)])
-            self.titleTextField = NSTextField(frame: CGRect(x: x, y: 0, width: size.width + 10, height: 22))
-            self.titleTextField!.stringValue = title
-            self.titleTextField!.font = NSFont.systemFont(ofSize: 14)
-            self.titleTextField!.isEditable = false
-            addSubview(self.titleTextField!)
-            self.titleTextField!.drawsBackground = false
-            self.titleTextField!.isBordered = false
-            x = self.titleTextField!.frame.maxX
-        }
-
-        for i in 0..<self.colorArray.count {
-            let kframe: NSRect = CGRect(x: x + CColorMenuItem_DefaultXGap, y: CColorMenuItem_DefaultYGap, width: 20, height: 20)
-            let button = CPDFListViewColorMenuItemButton.buttonWithTitle("", target: self, action: #selector(buttonClicked_SelectColor), color: self.colorArray[i], frame: kframe)
-            button.tag = i
-            button.isBordered = false
-            button.title = ""
-            addSubview(button)
-            x = kframe.maxX
-        }
-        
-        if needsColorWheel {
-            self.needsColorWheel = needsColorWheel
-            let frame = CGRect(x: x, y: CColorMenuItem_DefaultYGap, width: 20, height: 20)
-            let button = CPDFListViewColorMenuItemButton.buttonWithTitle("", target: self, action: #selector(buttonClicked_ColorWheel), color: nil, frame: frame)
-            button.isBordered = false
-            button.title = ""
-            addSubview(button)
-            x = frame.maxX
-        }
-        x += CColorMenuItem_HeadGap
-        self.frame = CGRect(x: 0, y: 0, width: x, height: 22)
-    }
-
-    required init?(coder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-    
-    // MARK: Button Action
-
-    @objc func buttonClicked_SelectColor(_ sender: CPDFListViewColorMenuItemButton) {
-        let tag = sender.tag
-        if let block = block {
-            block!(colorArray[tag])
-        }
-        
-    }
-
-    @objc func buttonClicked_ColorWheel(_ sender: CPDFListViewColorMenuItemButton) {
-        if let block = block {
-            block!(nil)
-        }
-    }
-}
-
-class CPDFListViewColorMenuItemButton: NSButton {
-    var trackingArea: NSTrackingArea?
-    
-    // MARK: Init Method
-    
-    static func buttonWithTitle(_ title: String?, target: Any?, action: Selector, color: NSColor?, frame: NSRect) -> CPDFListViewColorMenuItemButton {
-        let button = CPDFListViewColorMenuItemButton()
-        button.title = title!
-        button.target = target as AnyObject?
-        button.action = action
-        button.frame = frame
-        if let color1 = color {
-            button.adjustColor(color1)
-        } else {
-            button.adjust(withPictureName: "view_color")
-        }
-        return button
-    }
-    
-    // MARK: Init Method
-
-    override func updateTrackingAreas() {
-        super.updateTrackingAreas()
-        
-        if let trackingArea = trackingArea {
-            self.removeTrackingArea(trackingArea)
-        }
-        
-        let options: NSTrackingArea.Options = [.mouseEnteredAndExited, .activeAlways]
-        trackingArea = NSTrackingArea(rect: bounds, options: options, owner: self, userInfo: nil)
-        addTrackingArea(trackingArea!)
-    }
-
-    
-    func adjustColor(_ paintColor: NSColor?) {
-        if let paintColor = paintColor {
-            self.wantsLayer = true
-            
-            let layer = CAShapeLayer()
-            layer.frame = NSMakeRect(4, 4, self.frame.size.width - 8, self.frame.size.height - 8)
-            layer.cornerRadius = self.frame.size.width / 2 - 4
-            layer.borderWidth = 0.5
-            layer.borderColor = NSColor.lightGray.cgColor
-            layer.backgroundColor = paintColor.cgColor
-
-            if paintColor == NSColor.clear {
-                let x = (layer.frame.size.width - sqrt(pow(layer.frame.size.width, 2) / 2)) / 2
-                let path = CGMutablePath()
-                path.move(to: CGPoint(x: x, y: layer.frame.size.height - x))
-                path.addLine(to: CGPoint(x: layer.frame.size.width - x, y: x))
-                layer.path = path
-                layer.strokeColor = NSColor.red.cgColor
-                layer.lineWidth = 1.0
-            }
-            self.layer?.addSublayer(layer)
-        }
-    }
-    
-    func adjust(withPictureName aPictureName: String) {
-        self.title = ""
-        self.wantsLayer = true
-        let layer = CALayer()
-
-        let baseLayer = CALayer()
-        baseLayer.frame = NSMakeRect(3.5, 3.5, self.frame.size.width - 7, self.frame.size.height - 7)
-        baseLayer.cornerRadius = (self.frame.size.width / 2) - 3.5
-        baseLayer.backgroundColor = NSColor.lightGray.cgColor
-        self.layer?.addSublayer(baseLayer)
-
-        layer.contents = NSImage(named: aPictureName)
-        layer.frame = NSMakeRect(4, 4, self.frame.size.width - 8, self.frame.size.height - 8)
-        layer.cornerRadius = (self.frame.size.width / 2) - 4
-
-        self.layer?.addSublayer(layer)
-    }
-    
-    override func mouseEntered(with event: NSEvent) {
-        self.layer?.backgroundColor = NSColor(red: 216/255.0, green: 216/255.0, blue: 216/255.0, alpha: 1).cgColor
-        self.layer?.cornerRadius = 2.0
-    }
-    
-    override func mouseExited(with event: NSEvent) {
-        self.layer?.backgroundColor = NSColor.clear.cgColor
-    }
-}

+ 34 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFEditArea/CPDFListView+CPDFEditArea.swift

@@ -509,6 +509,40 @@ extension CPDFListView {
         self.cropCancelAction()
     }
     
+    func zoomInEditTextFontSize() {
+        let textEditAreas = self.km_editingTextAreas()
+        for i in 0 ..< (textEditAreas.count) {
+            let textEditArea = textEditAreas[i]
+            let fontSize = self.editingSelectionFontSize(byRangeEdit: textEditArea)
+            self.setEditingSelectionFontSize((fontSize + changeValue), with: textEditArea, isAutoSize: false)
+        }
+    }
+    
+    func zoomOutEditTextFontSize() {
+        let textEditAreas = self.km_editingTextAreas()
+        for i in 0 ..< (textEditAreas.count) {
+            let textEditArea = textEditAreas[i]
+            let fontSize = self.editingSelectionFontSize(byRangeEdit: textEditArea)
+            if(fontSize > changeValue) {
+                self.setEditingSelectionFontSize((fontSize - changeValue), with: textEditArea, isAutoSize: false)
+            }
+        }
+    }
+    func replaceImageEdit() {
+        let areas = self.km_editingImageAreas()
+        let panel = NSOpenPanel()
+        panel.allowsMultipleSelection = false
+        panel.allowedFileTypes = ["png","jpg"]
+        panel.beginSheetModal(for: NSApp.mainWindow!) { response in
+            if response == .OK {
+                let openPath = panel.url?.path
+                for area in areas {
+                    self.replace(area, imagePath: openPath!)
+                }
+            }
+        }
+    }
+    
     //MARK: - updateFrame
     func updateArea(_ area: CPDFEditImageArea, newWidth width: CGFloat, _ syncChanged: Bool) {
         self.editAreaBoundUpdating = true

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

@@ -55,7 +55,9 @@ static inline NSRect SKRectFromPoints(NSPoint aPoint, NSPoint bPoint) {
 - (IBAction)cut:(id)sender;
 - (IBAction)copy:(id)sender;
 - (IBAction)paste:(id)sender;
+- (void)menuPointPaste:(NSPoint)pagePoint page:(CPDFPage *)page isRightPaste:(BOOL)isRightPaste;
 - (IBAction)delete:(id)sender;
+- (void)exportPDF: (NSImage *)image;
 
 - (CPDFRedactAnnotation *)addRedactPDFSelection:(CPDFSelection *)currentSelection;
 - (CPDFRedactAnnotation *)addWhiteRedactPDFSelection:(CPDFSelection *)currentSelection;

+ 37 - 458
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFListViewExtension/CPDFListView+Event.m

@@ -658,426 +658,37 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
 #pragma mark - NSMenu
 
 - (NSMenu *)menuForEvent:(NSEvent *)event {
-    if(self.isPresentationMode) {
-        return nil;
-    } else {
-        if(self.presentationDrawView && self.presentationDrawView.isHidden == NO) {
-            return nil;
-        }
-    }
-    
-    
-    [self endMeasureModeAddAnnotation];
-    if (self.annotationType == CAnnotationTypeInk || self.annotationType == CAnnotationTypeEraser) {
-        return nil;
-    }
-    if([self.activeAnnotations count] > 1) {
-        NSMenu *menu = [[NSMenu alloc] init];
-        
-        [menu removeAllItems];
-        NSMenuItem * deleteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Delete", @"PDFListView") action:@selector(delete:) keyEquivalent:@""];
-        [menu insertItem:deleteItem atIndex:0];
-        
-        BOOL hasMarkup = false;
-        for (CPDFAnnotation *anno in self.activeAnnotations) {
-            if ([anno isKindOfClass:[CPDFMarkupAnnotation class]]) {
-                hasMarkup = true;
-                break;
-            }
-        }
-        if (hasMarkup) {
-            NSMenuItem * cutItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Cut", @"PDFListView") action:NULL keyEquivalent:@"x"];
-            [menu insertItem:cutItem atIndex:0];
-            
-            NSMenuItem * copyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy", @"PDFListView") action:NULL keyEquivalent:@"c"];
-            [menu insertItem:copyItem atIndex:0];
-        } else {
-            NSMenuItem * cutItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Cut", @"PDFListView") action:@selector(cut:) keyEquivalent:@"x"];
-            [menu insertItem:cutItem atIndex:0];
-            
-            NSMenuItem * copyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy", @"PDFListView") action:@selector(copy:) keyEquivalent:@"c"];
-            [menu insertItem:copyItem atIndex:0];
-        }
-        
-        return menu;
-    }
-    
     NSMenu *menu = [super menuForEvent:event];
     if(!menu)
         menu = [[NSMenu alloc] init];
     
+    [self endMeasureModeAddAnnotation];
     NSPoint pagePoint = NSZeroPoint;
     CPDFAnnotation *annotationSel = nil;
     CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:event nearest:YES];
     if (page) {
         annotationSel = [page annotationAtPoint:pagePoint];
-        if (annotationSel.type) {
-            
-        }
     }
-    
-    if(CRedactToolMode != self.toolMode && [annotationSel isKindOfClass:[CPDFRedactAnnotation class]]) {
+    if (self.annotationType == CAnnotationTypeInk || self.annotationType == CAnnotationTypeEraser) {
         return nil;
     }
-    
-    NSMenuItem * copyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy", @"PDFListView") action:@selector(copy:) keyEquivalent:@"c"];
-    
-    NSMenuItem * pasteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Paste", @"PDFListView") action:@selector(menuItemClick_Paste:) keyEquivalent:@"v"];
-    pasteItem.representedObject = event;
-    NSMenuItem * cutItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Cut", @"PDFListView") action:@selector(cut:) keyEquivalent:@"x"];
-    
-    NSMenuItem * deleteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Delete", @"PDFListView") action:@selector(delete:) keyEquivalent:@""];
-    
-    NSMenu *subMenu = nil;
-    NSMenuItem * arrangementItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Arrangement", @"PDFListView") action:nil keyEquivalent:@""];
-    subMenu = [[NSMenu alloc] init];
-    
-    NSMenuItem * sendBackItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send to Back", @"PDFListView") action:@selector(menuItemClick_SendBack:) keyEquivalent:@""];
-    NSMenuItem * sendBackForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send Backward", @"PDFListView") action:@selector(menuItemClick_SendBackward:) keyEquivalent:@""];
-    
-    NSMenuItem * bringFrontItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring to Front", @"PDFListView") action:@selector(menuItemClick_BringFront:) keyEquivalent:@""];
-    NSMenuItem * bringForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring Forward", @"PDFListView") action:@selector(menuItemClick_BringForward:) keyEquivalent:@""];
-    
-    NSMenuItem * editNoteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Edit Note", @"PDFListView") action:@selector(menuItemClick_EditNote:) keyEquivalent:@""];
-    
-    {
-        CPDFAnnotation *annotation = nil;
-        
-        if (([self toolMode] == CTextToolMode ||
-             [self toolMode] == CNoteToolMode ||
-             [self toolMode] == CFormToolMode ||
-             [self toolMode] == CRedactToolMode) &&
-            [self hideNotes] == NO) {
-            
-            for (CPDFAnnotation *tAnnotation in page.annotations) {
-                if ([tAnnotation hitTest:pagePoint]) {
-                    annotation = tAnnotation;
-                    break;
-                }
-            }
-            if(annotation && [annotation isKindOfClass:[CPDFWidgetAnnotation class]]) {
-                if(annotation == self.hoverAnnotation) {
-                    self.hoverAnnotation = nil;
-                    [self setNeedsDisplayAnnotation:annotation];
-                }
-                if([self toolMode] != CFormToolMode) {
-                    annotation = nil;
-                }
-            } else if(annotation && [annotation isKindOfClass:[CPDFRedactAnnotation class]]) {
-                if(annotation == self.hoverAnnotation) {
-                    self.hoverAnnotation = nil;
-                    [self setNeedsDisplayAnnotation:annotation];
-                }
-                if([self toolMode] != CRedactToolMode) {
-                    annotation = nil;
-                }
-            } else if (annotation && [annotation isKindOfClass:[CPDFInkAnnotation class]]) {
-                if(annotation == self.hoverAnnotation) {
-                    self.hoverAnnotation = nil;
-                    [self setNeedsDisplayAnnotation:annotation];
-                }
-                if([self toolMode] != CEditLinkToolMode) {
-                    annotation = nil;
-                }
-            }
-            
-            if(annotation) {
-                if(![self.activeAnnotations containsObject:annotation]) {
-                    [self updateIsRightActiveAnnotations:@[annotation]];
-                    [self setNeedsDisplayAnnotation:annotation];
-                }
-            }
-        }
-        
-        
-        CPDFSelection *selection = [self creatImageCurrentSelectionForPoint:[event locationInPDFListView:self]];
-        if(selection && CPDFSelectionTypeImage == [selection selectionType] && !self.activeAnnotation){
-            self.currentSelection = selection;
-        }
-        NSMenu *subMenu = [[NSMenu alloc] init];
-        NSMenuItem * previousPageItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Previous Page", @"PDFListView") action:@selector(PreviousPageAction:) keyEquivalent:@""];
-        NSMenuItem * nextPageItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Next Page", @"PDFListView") action:@selector(NextPageAction:) keyEquivalent:@""];
-        
-        
-        NSMenuItem * pageDisplayItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Page Display", @"PDFListView") action:nil keyEquivalent:@""];
-        subMenu = [[NSMenu alloc] init];
-        
-        NSMenuItem * twoPagesContinuousItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Two Pages Continuous", @"PDFListView") action:@selector(menuItemClick_TwoPagesContinuous:) keyEquivalent:@""];
-        NSMenuItem * twoPagesItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Two Pages", @"PDFListView") action:@selector(menuItemClick_TwoPages:) keyEquivalent:@""];
-        NSMenuItem * singlePageContinuousItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Single Page Continuous", @"PDFListView") action:@selector(menuItemClick_SinglePagesContinuous:) keyEquivalent:@""];
-        NSMenuItem * singlePageItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Single Page", @"PDFListView") action:@selector(menuItemClick_SinglePage:) keyEquivalent:@""];
-        NSMenuItem * bookModeItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Book Mode", @"PDFListView") action:@selector(menuItemClick_BookMode:) keyEquivalent:@""];
-        switch (self.displayViewMode) {
-            case CPDFDisplayViewSinglePageContinuous:
-                singlePageContinuousItem.state = NSControlStateValueOn;
-                break;
-            case CPDFDisplayViewTwoUp:
-                if (self.displaysAsBook)
-                    bookModeItem.state = NSControlStateValueOn;
-                else
-                    twoPagesItem.state = NSControlStateValueOn;
-                break;
-            case CPDFDisplayViewTwoUpContinuous:
-                if (self.displaysAsBook)
-                    bookModeItem.state = NSControlStateValueOn;
-                else
-                    twoPagesContinuousItem.state = NSControlStateValueOn;
-                break;
-            default:
-            case CPDFDisplayViewSinglePage:
-                singlePageItem.state = NSControlStateValueOn;
-                break;
-        }
-        
-        [menu insertItem:previousPageItem atIndex:0];
-        [menu insertItem:nextPageItem atIndex:0];
-        [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-        [menu insertItem:twoPagesContinuousItem atIndex:0];
-        [menu insertItem:twoPagesItem atIndex:0];
-        [menu insertItem:singlePageContinuousItem atIndex:0];
-        [menu insertItem:singlePageItem atIndex:0];
-        
-        
-        NSMenuItem *zoomItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom", @"PDFListView") action:nil keyEquivalent:@""];
-        subMenu = [[NSMenu alloc]init];
-        
-        NSMenuItem * fitWidthItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Automatically Resize", @"PDFListView") action:@selector(menuItemClick_FitWidth:) keyEquivalent:@""];
-        NSMenuItem * automaticallyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Fit Page", @"PDFListView") action:@selector(menuItemClick_FitPage:) keyEquivalent:@""];
-        NSMenuItem * zoomInItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom In", @"PDFListView") action:@selector(menuItemClick_ZoomIn:) keyEquivalent:@""];
-        NSMenuItem * zoomOutItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom Out", @"PDFListView") action:@selector(menuItemClick_ZoomOut:) keyEquivalent:@""];
-        NSMenuItem * actualSizeItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Actual Size", @"PDFListView") action:@selector(menuItemClick_ActualSize:) keyEquivalent:@""];
-        
-        NSMenuItem * hidenShowNoteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Hide Notes", @"PDFListView") action:@selector(menuItemClick_HidenorShowNote:) keyEquivalent:@""];
-        
-        CGFloat pageHeight = self.currentPage.size.height;
-        CGFloat pdfviewHeight = self.bounds.size.height;
-        
-        if (self.autoScales) {
-            fitWidthItem.state = NSControlStateValueOn;
-        } else if (self.scaleFactor == 1.0) {
-            actualSizeItem.state = NSControlStateValueOn;
-        } else if (self.scaleFactor == pdfviewHeight/pageHeight) {
-            automaticallyItem.state = NSControlStateValueOn;
-        }
-        
-        if(self.hideNotes) {
-            [hidenShowNoteItem setTitle:NSLocalizedString(@"Show Notes", @"PDFListView")];
-        } else {
-            [hidenShowNoteItem setTitle:NSLocalizedString(@"Hide Notes", @"PDFListView")];
-        }
-        
-        [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-        NSMenuItem *itemPhysical = [menu insertItemWithTitle:NSLocalizedString(@"Physical Size", nil) action:@selector(zoomToPhysicalSize:) target:self atIndex:0];
-        [itemPhysical setKeyEquivalentModifierMask:NSEventModifierFlagOption];
-        [itemPhysical setAlternate:YES];
-        [menu insertItem:actualSizeItem atIndex:0];
-        [menu insertItem:zoomOutItem atIndex:0];
-        [menu insertItem:zoomInItem atIndex:0];
-        [menu insertItem:fitWidthItem atIndex:0];
-        
-    }
-    
-    if(CSelectToolMode == self.toolMode || CCropToolMode == self.toolMode) {
-        if (NSIsEmptyRect([self currentSelectionRect]) == NO) {
-            if (NSIsEmptyRect([self currentSelectionRect]) == NO) {
-                NSMenuItem *selectionItem = [menu insertItemWithTitle:NSLocalizedString(@"Zoom To Selection", @"Menu item title") action:@selector(doZoomToAutoSelection:) target:self atIndex:0];
-                [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-            }
-            
-            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-            [menu insertItem:copyItem atIndex:0];
-        }
-    } else if ([self.activeAnnotation isKindOfClass:[KMTableAnnotation class]]) { //Table
-        [menu removeAllItems];
-        KMTableAnnotation *annotation =(KMTableAnnotation*)self.activeAnnotation;
-        [annotation completeEditCellText];
-        if (!NSIsEmptyRect([(KMTableAnnotation *)self.activeAnnotation drawRect])) {
-            [(KMTableAnnotation *)self.activeAnnotation drawLine:pagePoint];
-            [[NSNotificationCenter defaultCenter] postNotificationName:KMPDFViewTableAnnotationDidChangeNotification object:self userInfo:@{@"point":[NSValue valueWithPoint:pagePoint]}];
-            
-        }
-        if (([annotation rowNumber]-[annotation currentCell].row-1) < 0) {
-            return nil;
-        }
-        menu = [self tableMenu:menu withTable:(KMTableAnnotation*)self.activeAnnotation point:pagePoint];
-        return menu;
-    } else {
-        
-        if (annotationSel && self.activeAnnotations.count > 0) {
-            NSDictionary *dictPresentObject = @{@"page":page,@"annotation":annotationSel};
-            bringForwardItem.representedObject = dictPresentObject;
-            bringFrontItem.representedObject = dictPresentObject;
-            sendBackForwardItem.representedObject = dictPresentObject;
-            sendBackItem.representedObject = dictPresentObject;
-            
-            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-            [menu insertItem:bringForwardItem atIndex:0];
-            [menu insertItem:bringFrontItem atIndex:0];
-            [menu insertItem:sendBackForwardItem atIndex:0];
-            [menu insertItem:sendBackItem atIndex:0];
-        }
-        
-        [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-        if(self.activeAnnotations.count == 1) {
-            NSMenuItem * lineStyleItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Lines", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
-            lineStyleItem.representedObject = self.activeAnnotations.firstObject;
-            
-            subMenu = [[NSMenu alloc] init];
-            NSMenuItem * lineSolidItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Solid", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
-            lineSolidItem.tag = CPDFBorderStyleSolid;
-            NSMenuItem * lineDashedItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Dashed", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
-            lineDashedItem.tag = CPDFBorderStyleDashed;
-            
-            NSMenuItem * changeColorItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Colors", @"PDFListView") action:@selector(menuItemClick_ChangeColor:) keyEquivalent:@""];
-            
-            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-            
-            NSMenuItem * rotateItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Rotate", @"PDFListView") action:nil keyEquivalent:@""];
-            {
-                subMenu = [[NSMenu alloc]init];
-                
-                NSMenuItem * leftItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Rotate Left", @"PDFListView") action:@selector(rotateLeftStampAnnotation:) keyEquivalent:@""];
-                NSMenuItem * rightItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Rotate Right", @"PDFListView") action:@selector(rotateRightStampAnnotation:) keyEquivalent:@""];
-                [subMenu addItem:leftItem];
-                [subMenu addItem:rightItem];
-                rotateItem.submenu = subMenu;
-            }
-            
-            if([self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]] ||
-               [self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
-                [menu insertItem:editNoteItem atIndex:0];
-                __weak typeof(self) blockSelf = self;
-                if([self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
-                    NSArray *colors = @[[NSColor colorWithRed:255.0/255.0 green:254.0/255.0 blue:84.0/255.0 alpha:1.0],
-                                        [NSColor colorWithRed:234.0/255.0 green:51.0/255.0 blue:35.0/255.0 alpha:1.0],
-                                        [NSColor colorWithRed:239.0/255.0 green:134.0/255.0 blue:51.0/255.0 alpha:1.0],
-                                        [NSColor colorWithRed:117.0/255.0 green:250.0/255.0 blue:76.0/255.0 alpha:1.0]];
-                    if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewEventMarkupColorWithAnnotation:)]) {
-                        colors = [self.pdfListViewDelegate PDFListViewEventMarkupColorWithAnnotation:self.activeAnnotation];
-                    }
-                    
-                    CPDFListViewColorMenuItemView *itemView = [[CPDFListViewColorMenuItemView alloc] initWithTitle:nil
-                                                                                                        colorArray:colors
-                                                                                                   needsColorWheel:NO
-                                                                                                   completeHandler:^(NSColor *color) {
-                        CGFloat red,green,blue,alpha;
-                        if (color) {
-                            [[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
-                        }
-                        
-                        [blockSelf setNeedsDisplayAnnotation:blockSelf.activeAnnotation];
-                        [blockSelf updateHighLightAnnotation:blockSelf.activeAnnotation];
-                        [menu cancelTracking];
-                    }];
-                    
-                    NSMenuItem * colorItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Highlight", @"Menu item title") action:nil keyEquivalent:@""];
-                    colorItem.view = itemView;
-                    [menu insertItem:colorItem atIndex:0];
-                }
-            } else if ([self.activeAnnotation isKindOfClass:[CPDFStampAnnotation class]]) {
-                [menu insertItem:editNoteItem atIndex:0];
-                if ([self.activeAnnotation isKindOfClass:[CPDFListStampAnnotation class]]) {
-                    [menu insertItem:rotateItem atIndex:0];
-                }
-                [menu insertItem:lineStyleItem atIndex:0];
-                [menu insertItem:changeColorItem atIndex:0];
-            } else if ([self.activeAnnotation isKindOfClass:[CPDFInkAnnotation class]]) {
-                [menu insertItem:editNoteItem atIndex:0];
-                [menu insertItem:lineStyleItem atIndex:0];
-                [menu insertItem:changeColorItem atIndex:0];
-            } else if ([self.activeAnnotation isKindOfClass:[CPDFTextAnnotation class]]) {
-                [menu insertItem:editNoteItem atIndex:0];
-                [menu insertItem:changeColorItem atIndex:0];
-            } else if ([self.activeAnnotation isKindOfClass:[CPDFSquareAnnotation class]] ||
-                       [self.activeAnnotation isKindOfClass:[CPDFCircleAnnotation class]] ||
-                       [self.activeAnnotation isKindOfClass:[CPDFLineAnnotation class]]) {
-                [menu insertItem:editNoteItem atIndex:0];
-                if([self.activeAnnotation isKindOfClass:[CPDFLineAnnotation class]]) {
-                    NSMenuItem * directionItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Direction", @"PDFListView") action:nil keyEquivalent:@""];
-                    subMenu = [[NSMenu alloc]init];
-                    
-                    NSMenuItem * lineHorizontalItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Horizontal", @"PDFListView") action:@selector(menuItemClick_LineHorizontal:) keyEquivalent:@""];
-                    NSMenuItem * lineVerticalItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Vertical", @"PDFListView") action:@selector(menuItemClick_LineVertical:) keyEquivalent:@""];
-                    [subMenu addItem:lineHorizontalItem];
-                    [subMenu addItem:lineVerticalItem];
-                    directionItem.submenu = subMenu;
-                    
-                    [menu insertItem:directionItem atIndex:0];
-                }
-                [menu insertItem:lineStyleItem atIndex:0];
-                [menu insertItem:changeColorItem atIndex:0];
-            } else if ([self.activeAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
-                NSMenuItem * textAlignmentItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Text Alignment", @"PDFListView") action:nil keyEquivalent:@""];
-                subMenu = [[NSMenu alloc] init];
-                
-                NSMenuItem * leftAlignmentItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Left Alignment", @"PDFListView") action:@selector(menuItemClick_Alignment:) keyEquivalent:@""];
-                leftAlignmentItem.tag = NSTextAlignmentLeft;
-                NSMenuItem * rightAlignmentItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Right Alignment", @"PDFListView") action:@selector(menuItemClick_Alignment:) keyEquivalent:@""];
-                rightAlignmentItem.tag = NSTextAlignmentRight;
-                
-                NSMenuItem * centerAlignmentItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Center", @"PDFListView") action:@selector(menuItemClick_Alignment:) keyEquivalent:@""];
-                centerAlignmentItem.tag = NSTextAlignmentCenter;
-                
-                [subMenu addItem:leftAlignmentItem];
-                [subMenu addItem:rightAlignmentItem];
-                [subMenu addItem:centerAlignmentItem];
-                textAlignmentItem.submenu = subMenu;
-                [menu insertItem:editNoteItem atIndex:0];
-                [menu insertItem:textAlignmentItem atIndex:0];
-                
-                NSMenuItem * fontItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Fonts", @"PDFListView") action:@selector(menuItemClick_ChangeFont:) keyEquivalent:@""];
-                subMenu = [[NSMenu alloc] init];
-                [menu insertItem:fontItem atIndex:0];
-                [menu insertItem:lineStyleItem atIndex:0];
-                [menu insertItem:changeColorItem atIndex:0];
-            }
-            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-            [menu insertItem:deleteItem atIndex:0];
-            if ([self.activeAnnotation isKindOfClass:[CPDFStampAnnotation class]]) {
-                NSMenuItem * exportImageItem = [self creatExportItem];
-                [menu insertItem:exportImageItem atIndex:0];
-            }
-            if(![self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
-                if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
-                    [menu insertItem:pasteItem atIndex:0];
-                }
-                [menu insertItem:cutItem atIndex:0];
-            }
-            if ([self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
-                if ([menu.itemArray containsObject:pasteItem] == false) {
-                    [menu insertItem:pasteItem atIndex:0];
+    if([self.activeAnnotations count] > 1) {
+        CPDFAnnotation *newActiveAnnotation = nil;
+        if([self doClickAnnotationWithEvent:event forAnnotation:&newActiveAnnotation]) {
+            if ([self consistentTypeWithAnnotation:newActiveAnnotation]) {
+                if(![self.activeAnnotations containsObject:newActiveAnnotation]) {
+                    [self updateIsRightActiveAnnotations:@[newActiveAnnotation]];
+                    [self setNeedsDisplayAnnotation:newActiveAnnotation];
                 }
             }
-            [menu insertItem:copyItem atIndex:0];
-            
         }
         
-        if (self.currentSelection) {
-            if(CPDFSelectionTypeImage == [self.currentSelection selectionType]) {
-                if (self.activeAnnotations.count < 1) {
-                    NSMenuItem * exportImageItem = [self creatExportItem];
-                    [menu insertItem:exportImageItem atIndex:0];
-                }
-                //                [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-            }
-            if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
-                if (![menu.itemArray containsObject:pasteItem]) {
-                    [menu insertItem:pasteItem atIndex:0];
-                }
-            }
-            if (![menu.itemArray containsObject:copyItem]) {
-                [menu insertItem:copyItem atIndex:0];
-            }
-        }else{
-            if (self.toolMode != CMoveToolMode && self.toolMode != CMagnifyToolMode){
-                if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
-                    if (![menu.itemArray containsObject:pasteItem]) {
-                        [menu insertItem:pasteItem atIndex:0];
-                    }
-                }
+        if(self.activeAnnotations.count > 0) {
+            CPDFSelection *selection = [self creatImageCurrentSelectionForPoint:[event locationInPDFListView:self]];
+            if(selection && CPDFSelectionTypeImage == [selection selectionType]){
+                self.currentSelection = selection;
             }
         }
-        
     }
     
     if ([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMenuForEvent:forEvent:clickMenu:isMoveSelectAnno:)]) {
@@ -1283,30 +894,12 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
 }
 
 - (NSArray<NSMenuItem *> *)menuItemsEditingAtPoint:(CGPoint)point forPage:(CPDFPage *)page {
-    if(self.isPresentationMode) {
-        return nil;
-    } else {
-        if(self.presentationDrawView.isHidden == NO) {
-            return nil;
-        }
-    }
+    
     NSMutableArray <NSMenuItem *>*menuItems = [super menuItemsEditingAtPoint:point forPage:page].mutableCopy;
     if (!menuItems) {
         menuItems  = [NSMutableArray array];
     }
     
-    if (self.isSelectEditCharRange || [self isSelecteditAreaWithPoint:point]) {
-        
-        [menuItems insertObject:[NSMenuItem separatorItem] atIndex:0];
-        [menuItems insertObject:[self fontColorMenuItem] atIndex:0];
-        [menuItems insertObject:[self fontSizeMenuItem] atIndex:0];
-        
-    }
-    
-    if (self.toolMode != CEditPDFToolMode) {
-        return menuItems;
-    }
-    
     if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMenuItemsEditingAtPoint:forPage:menuItems:)]) {
         return [self.pdfListViewDelegate PDFListViewMenuItemsEditingAtPoint:point forPage:page menuItems:menuItems];
     }
@@ -5638,27 +5231,11 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
     [self menuItemClick_Paste:nil];
 }
 
-- (IBAction)menuItemClick_Paste:(NSMenuItem *)sender {
+- (void)menuPointPaste:(NSPoint)pagePoint page:(CPDFPage *)page isRightPaste:(BOOL)isRightPaste{
     if ([self hideNotes]) {
         NSBeep();
         return;
     }
-    CPDFPage *page = self.currentPage;
-    CGPoint pagePoint = CGPointZero;
-    BOOL isRightPaste = YES;
-    if(sender) {
-        NSEvent * event= sender.representedObject;
-        page = [self pageAndPoint:&pagePoint forEvent:event nearest:YES];
-        if(self.currentSelection) {
-            pagePoint = self.currentSelection.bounds.origin;
-        }
-    } else {
-        CGRect visibleRect = self.scrollView.visibleRect;
-        pagePoint = CPDFlistViewCenterPoint(visibleRect);
-        
-        pagePoint = [self convertPoint:pagePoint toPage:self.currentPage];
-        isRightPaste = NO;
-    }
     NSPasteboard *pboard = [NSPasteboard generalPasteboard];
     NSDictionary *options = [NSDictionary dictionary];
     NSArray *newAnnotations = nil;
@@ -5705,7 +5282,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
             
             for (CPDFAnnotation * an in self.aCopyAnnotations) {
                 NSRect bounds = CGRectZero;
-                if (sender) {
+                if (isRightPaste) {
                     CGPoint point = CPDFListViewSubstractPoints(an.bounds.origin, selectAnnotationBounds.origin);
                     if([an isKindOfClass:[CPDFStampAnnotation class]] && self.aCopyAnnotations.count == 1) {
                         bounds = CGRectMake(pagePoint.x + point.x-[an bounds].size.width/2, pagePoint.y-[an bounds].size.height/2+point.y, [an bounds].size.width,  [an bounds].size.height);
@@ -5964,6 +5541,27 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
     }
 }
 
+- (IBAction)menuItemClick_Paste:(NSMenuItem *)sender {
+    CPDFPage *page = self.currentPage;
+    CGPoint pagePoint = CGPointZero;
+    BOOL isRightPaste = YES;
+    if(sender) {
+        NSEvent * event= sender.representedObject;
+        page = [self pageAndPoint:&pagePoint forEvent:event nearest:YES];
+        if(self.currentSelection) {
+            pagePoint = self.currentSelection.bounds.origin;
+        }
+    } else {
+        CGRect visibleRect = self.scrollView.visibleRect;
+        pagePoint = CPDFlistViewCenterPoint(visibleRect);
+        
+        pagePoint = [self convertPoint:pagePoint toPage:self.currentPage];
+        isRightPaste = NO;
+    }
+    
+    [self menuPointPaste:pagePoint page:page isRightPaste:isRightPaste];
+}
+
 - (IBAction)cut:(id)sender {
     BOOL isContinue = YES;
     if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewHaveDocumentAttribute)]) {
@@ -6009,11 +5607,6 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
 }
 
 - (IBAction)menuItemClick_BringForward:(NSMenuItem *)sender {
-    
-    //    for (CPDFAnnotation *annotation in self.activeAnnotations) {
-    //        CPDFPage *page = annotation.page;
-    //        [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] + 1];
-    //    }
     NSDictionary *dict = sender.representedObject;
     CPDFPage *page = dict[@"page"];
     CPDFAnnotation *annotation = dict[@"annotation"];
@@ -6021,10 +5614,6 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
 }
 
 - (IBAction)menuItemClick_SendBackward:(NSMenuItem *)sender {
-    //    for (CPDFAnnotation *annotation in self.activeAnnotations) {
-    //        CPDFPage *page = annotation.page;
-    //        [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] - 1];
-    //    }
     NSDictionary *dict = sender.representedObject;
     CPDFPage *page = dict[@"page"];
     CPDFAnnotation *annotation = dict[@"annotation"];
@@ -6032,10 +5621,6 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
 }
 
 - (IBAction)menuItemClick_BringFront:(NSMenuItem *)sender {
-    //    for (CPDFAnnotation *annotation in self.activeAnnotations) {
-    //        CPDFPage *page = annotation.page;
-    //        [self moveAnnotationOnPage:page annotation:annotation newIndex:page.annotations.count -1];
-    //    }
     NSDictionary *dict = sender.representedObject;
     CPDFPage *page = dict[@"page"];
     CPDFAnnotation *annotation = dict[@"annotation"];
@@ -6043,10 +5628,6 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
 }
 
 - (IBAction)menuItemClick_SendBack:(NSMenuItem *)sender {
-    //    for (CPDFAnnotation *annotation in self.activeAnnotations) {
-    //        CPDFPage *page = annotation.page;
-    //        [self moveAnnotationOnPage:page annotation:annotation newIndex:0];
-    //    }
     NSDictionary *dict = sender.representedObject;
     CPDFPage *page = dict[@"page"];
     CPDFAnnotation *annotation = dict[@"annotation"];
@@ -6058,8 +5639,6 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
 }
 
 - (IBAction)menuItemClick_LineStyle:(id)sender {
-    //    self.activeAnnotation.borderStyle = sender.tag;
-    //    [self setNeedsDisplayAnnotation:self.activeAnnotation];
     CPDFAnnotation *annotation = [sender representedObject];
     if (annotation){
         [self.activeAnnotations removeAllObjects];

+ 18 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h

@@ -229,6 +229,8 @@ enum {
 
 @property (nonatomic, assign) BOOL isPresentationMode;
 
+@property (nonatomic, readonly) BOOL isShowSplitBar;
+
 @property (nonatomic, strong) KMDrawView *presentationDrawView;
 
 - (CPDFAnnotation *)addAnnotationWithType:(CAnnotationType)annotationType selection:(CPDFSelection *)selection page:(CPDFPage *)page bounds:(NSRect)bounds;
@@ -307,6 +309,21 @@ enum {
 
 - (void)removeAnnotation:(CPDFAnnotation *)annotation;
 
+- (IBAction)menuItemClick_TwoPagesContinuous:(id)sender;
+- (IBAction)menuItemClick_TwoPages:(id)sender;
+- (IBAction)menuItemClick_SinglePagesContinuous:(id)sender;
+- (IBAction)menuItemClick_SinglePage:(id)sender;
+- (IBAction)menuItemClick_BookMode:(id)sender;
+
+- (IBAction)menuItemClick_BringForward:(NSMenuItem *)sender;
+- (IBAction)menuItemClick_SendBackward:(NSMenuItem *)sender;
+- (IBAction)menuItemClick_BringFront:(NSMenuItem *)sender;
+- (IBAction)menuItemClick_SendBack:(NSMenuItem *)sender;
+
+- (void)editAnnotation:(CPDFAnnotation *)annotation;
+- (void)redactAddAnnotationPages:(NSMutableArray *)pages redactAnnotation:(CPDFRedactAnnotation *)redactAnnotation;
+- (void)exprotSelection:(CPDFSelection *)selection type:(NSInteger)type; //0 png //1 jpg, 2 pdf
+
 @end
 
 @protocol CPDFListViewDelegate <NSObject>
@@ -376,5 +393,6 @@ enum {
 
 - (void)PDFListViewMobileAnnotationEnd:(CGPoint)point forPDFListView:(CPDFListView *)pdfListView forActiveAnnotations:(NSArray<CPDFAnnotation *> *)annotations;
 
+- (BOOL)PDFListViewSplitModeShowBar;
 
 @end

+ 122 - 3
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -493,9 +493,11 @@ void CPDFListViewOCDrawLineHandles(CGContextRef context, CGRect rect, CGFloat ra
     for(NSInteger i = 0;i<self.document.pageCount;i++) {
         CPDFPage *page = [self.document pageAtIndex:i];
         for (CPDFAnnotation *annotation in page.annotations) {
-            [annotation setAnnotationShouldDisplay:!self.hideNotes];
-            [annotation setHidden: self.hideNotes];
-            [self updateHighLightAnnotation:annotation];
+            if(!annotation.isForm) {
+                [annotation setAnnotationShouldDisplay:!self.hideNotes];
+                [annotation setHidden: self.hideNotes];
+                [self updateHighLightAnnotation:annotation];
+            }
         }
     }
     [self setNeedsDisplayAnnotationViewForVisiblePages];
@@ -573,6 +575,14 @@ void CPDFListViewOCDrawLineHandles(CGContextRef context, CGRect rect, CGFloat ra
     [super setCurrentSelection:currentSelection];
 }
 
+- (BOOL)isShowSplitBar {
+    if ([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewSplitModeShowBar)]) {
+        return [self.pdfListViewDelegate PDFListViewSplitModeShowBar];
+    }
+    
+    return NO;
+}
+
 #pragma mark - menu add image
 - (void)addImageAnnotation:(NSImage *)image center:(NSPoint)center isRemoveBGColor:(BOOL)isRemoveBGColor{
     [self setToolMode:CTextToolMode]; //不支持重复添加,重置状态
@@ -768,6 +778,115 @@ void CPDFListViewOCDrawLineHandles(CGContextRef context, CGRect rect, CGFloat ra
 }
 
 #pragma mark - Public
+- (void)redactAddAnnotationPages:(NSMutableArray *)pages redactAnnotation:(CPDFRedactAnnotation *)redactAnnotation {
+    if (pages.count == 0) {
+        return;
+    }
+    
+    NSMutableArray *annotations = [[NSMutableArray alloc] init];
+    
+    for (NSUInteger i = 0; i < pages.count; i++) {
+        NSNumber *indexNumber = (NSNumber *)[pages objectAtIndex:i];
+        NSInteger index = indexNumber.integerValue;
+        
+        if (index - 1 < self.document.pageCount) {
+            CPDFPage *page = [self.document pageAtIndex:(NSUInteger)(index - 1)];
+            CPDFRedactAnnotation *annotation = [[CPDFRedactAnnotation alloc] initWithDocument:self.document];
+            
+            if (redactAnnotation) {
+                [annotation setUserName:[redactAnnotation userName]];
+                [annotation setModificationDate:[redactAnnotation modificationDate]];
+                [annotation setQuadrilateralPoints:[redactAnnotation quadrilateralPoints]];
+                annotation.borderWidth = redactAnnotation.borderWidth;
+                
+                [annotation setBorderColor:[redactAnnotation borderColor]];
+                [annotation setInteriorColor:[redactAnnotation interiorColor]];
+
+                annotation.cFont = redactAnnotation.cFont;
+                annotation.fontSize = redactAnnotation.fontSize;
+                [annotation setOverlayText:[redactAnnotation overlayText]];
+                [annotation setFontColor:[redactAnnotation fontColor]];
+                [annotation setAlignment:[redactAnnotation alignment]];
+                
+                NSRect pageRect = page.bounds;
+                NSRect annotationRect = annotation.bounds;
+                
+                if (NSMaxX(annotationRect) > NSMaxX(pageRect) ||
+                    NSMinX(annotationRect) < NSMinX(pageRect) ||
+                    NSMinY(annotationRect) < NSMinY(pageRect) ||
+                    NSMaxY(annotationRect) > NSMaxY(pageRect) ||
+                    annotation.page == page) {
+                    continue;
+                }
+            }
+            
+            [page addAnnotation:annotation];
+            [annotations addObject:annotation];
+            [self setNeedsDisplayAnnotationViewForPage:page];
+        }
+    }
+    
+    [[self.undoManager prepareWithInvocationTarget:self] removeRedactAnnotations:annotations pages:pages  redactAnnotation:redactAnnotation];
+}
+
+- (void)removeRedactAnnotations:(NSMutableArray *)annotations pages:(NSMutableArray *)pages redactAnnotation:(CPDFRedactAnnotation *)redactAnnotation{
+    if (annotations.count == 0) {
+        return;
+    }
+
+    NSMutableArray *pageIndexes = [[NSMutableArray alloc] init];
+    
+    for (NSUInteger i = 0; i < annotations.count; i++) {
+        CPDFRedactAnnotation *annotation = (CPDFRedactAnnotation *)[annotations objectAtIndex:i];
+        if (!annotation) {
+            continue;
+        }
+
+        CPDFPage *page = annotation.page;
+        NSUInteger index = [self.document indexForPage:page];
+        [page removeAnnotation:annotation];
+        [pageIndexes addObject:[NSNumber numberWithInteger:(index + 1)]];
+        [self setNeedsDisplayAnnotationViewForPage:page];
+    }
+
+    [[self.undoManager prepareWithInvocationTarget:self] redactAddAnnotationPages:pageIndexes redactAnnotation:redactAnnotation];
+}
+
+- (void)exprotSelection:(CPDFSelection *)selection type:(NSInteger)type {
+    NSImage *image = nil;
+     if (selection.selectionType == CPDFSelectionTypeImage) {
+        image = [self.document extractImageFromPage:self.currentSelection.page imageSelection:self.currentSelection];
+    }
+    
+    if (image) {
+        NSData *data = [image TIFFRepresentation];
+        NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:data];
+        [imageRep setSize:[image size]];
+        NSBitmapImageFileType type = NSBitmapImageFileTypePNG;
+        NSString *typeStr = @"png";
+        if (type == 0) {
+            type = NSBitmapImageFileTypePNG;
+            typeStr = @"png";
+        } else if (type == 1) {
+            type = NSBitmapImageFileTypeJPEG;
+            typeStr = @"jpg";
+        } else if (type == 2) {
+            [self exportPDF:image];
+        }
+        NSData *imageData = [imageRep representationUsingType:NSBitmapImageFileTypeJPEG properties:@{}];
+        
+        NSSavePanel *savePanel = [NSSavePanel savePanel];
+        savePanel.allowedFileTypes = @[typeStr];
+        [savePanel beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(NSInteger result) {
+            if (result) {
+                if ([imageData writeToURL:savePanel.URL atomically:YES]) {
+                    [[NSWorkspace sharedWorkspace] selectFile:savePanel.URL.path
+                                     inFileViewerRootedAtPath:@""];
+                }
+            }
+        }];
+    }
+}
 
 - (CPDFAnnotation *)addAnnotationWithType:(CAnnotationType)annotationType selection:(CPDFSelection *)selection page:(CPDFPage *)page bounds:(NSRect)bounds {
     CPDFAnnotation *annotation = nil;

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

@@ -924,24 +924,6 @@ extension KMMainViewController {
         }
     }
     
-    @objc func menuItemBookMarkClick_add(sender:NSMenuItem) {
-        if self.listView.document?.bookmark(forPageIndex: UInt(self.listView.currentPageIndex)) == nil {
-            let index = self.listView.currentPageIndex
-            self.listView.document?.addBookmark("\(NSLocalizedString("Page", comment: "")) \(index+1)", forPageIndex: UInt(index))
-            self.listView.setNeedsDisplayForVisiblePages()
-        } else {
-            self.listView.document?.removeBookmark(forPageIndex: UInt(self.listView.currentPageIndex))
-            self.listView.setNeedsDisplayForVisiblePages()
-        }
-        
-        self.listView.undoManager?.setActionName("")//添加undo事件就可删除
-        
-        if viewManager.isPDFReadMode {
-            
-        } else {
-         }
-    }
-    
     @objc func menuItemAnnotationClick_FindString(sender:NSMenuItem) {
      }
     

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

@@ -78,14 +78,7 @@ extension KMMainViewController {
     @IBAction func menuItemAction_showInFinder(_ sender: Any) {
         NSWorkspace.shared.activateFileViewerSelecting([self.listView.document.documentURL])
     }
-    
-    @IBAction func menuItemAction_property(_ sender: Any) {
 
-    }
-    
-    @IBAction func menuItemAction_print(_ sender: Any) {
-        self.showPrintWindow()
-    }
 }
 
 
@@ -284,13 +277,6 @@ extension KMMainViewController {
         }
     }
     
-    @IBAction func toggleAutoFlow(_ sender: Any?) {
-        if (self.listView.isAutoFlow()) {
-            self.listView.stopAutoFlow()
-        } else {
-            self.listView.startAutoFlow()
-        }
-    }
     @IBAction func chooseAutoFlowSetting(_ sender: Any?) {
         autoFlowOptionsSheetController = KMAutoFlowOptionsSheetController(windowNibName: "KMAutoFlowOptionsSheetController")
         NSWindow.currentWindow().beginSheet((autoFlowOptionsSheetController?.window)!) { responce in }
@@ -580,24 +566,6 @@ extension KMMainViewController: KMSystemPDFMenuProtocol {
         
     }
     
-    func highlightFormFiled(_ sender: Any?) {
-        let enabled = CPDFKitConfig.sharedInstance().enableFormFieldHighlight()
-        CPDFKitConfig.sharedInstance().setEnableFormFieldHighlight(!enabled)
-        
-        self.listView.setNeedsDisplayForVisiblePages()
-    }
-    
-    func highlightLinks(_ sender: Any?) {
-        let enabled = CPDFKitConfig.sharedInstance().enableLinkFieldHighlight()
-        CPDFKitConfig.sharedInstance().setEnableLinkFieldHighlight(!enabled)
-        
-        self.listView.setNeedsDisplayForVisiblePages()
-    }
-    
-    func resetForm(_ sender: Any?) {
-        self.listView.resetFormAnnotation()
-    }
-    
     func removeAllAnnotation(_ sender: Any?) {
         self.listView.removeAllAnnotation()
     }

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

@@ -89,23 +89,11 @@ extension KMMainViewController {
 //MARK: - ReadModel
 extension KMMainViewController {
     
-    @objc func addOutLineItemAction() {
-        
-    }
-    
     @objc func lookUpAction() {
         let label = self.listView.currentSelection?.string() ?? ""
         
     }
     
-    @objc func searchBaiduAction() {
-        let label = self.listView.currentSelection?.string() ?? ""
-        let query = label.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? ""
-        if let url = URL(string: "https://www.baidu.com/s?wd=\(query)") {
-            NSWorkspace.shared.open(url)
-        }
-    }
-    
     @objc func showInfoInFinder() {
         
     }

+ 4 - 18
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.swift

@@ -32,21 +32,7 @@ let topThumOffset: CGFloat = 12.0 // 缩图顶部高度
 let infoThumTitleHeight: CGFloat = 16.0 //文字高度
 let infoThumTitleBottom: CGFloat = 16.0 // 底部高度
 
-let ThumbnailMenuIdentifier_Copy = "ThumbnailMenuIdentifier_Copy"
-let ThumbnailMenuIdentifier_Cut = "ThumbnailMenuIdentifier_Cut"
-let ThumbnailMenuIdentifier_Paste = "ThumbnailMenuIdentifier_Paste"
-let ThumbnailMenuIdentifier_Delete = "ThumbnailMenuIdentifier_Delete"
-let ThumbnailMenuIdentifier_RotateRight = "ThumbnailMenuIdentifier_RotateRight"
-let ThumbnailMenuIdentifier_RotateLeft = "ThumbnailMenuIdentifier_RotateLeft"
-let ThumbnailMenuIdentifier_InsertFile = "ThumbnailMenuIdentifier_InsertFile"
-let ThumbnailMenuIdentifier_InsertBlank = "ThumbnailMenuIdentifier_InsertBlank"
-let ThumbnailMenuIdentifier_Replace = "ThumbnailMenuIdentifier_Replace"
-let ThumbnailMenuIdentifier_Share = "ThumbnailMenuIdentifier_Share"
-let ThumbnailMenuIdentifier_Export = "ThumbnailMenuIdentifier_Export"
-let ThumbnailMenuIdentifier_PastNull = "ThumbnailMenuIdentifier_PastNull"
-let ThumbnailMenuIdentifier_FileShowSize = "ThumbnailMenuIdentifier_FileShowSize"
-
-struct ThumbnailMenuStruct {
+struct KMNMenuStruct {
     var menuitems: [ComponentMenuitemProperty]
     var viewHeight: CGFloat          // 不可变属性
 }
@@ -292,7 +278,7 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
     }
     
     // MARK: - private
-    public func clickMenu(point:NSPoint)->ThumbnailMenuStruct {
+    public func clickMenu(point:NSPoint)->KMNMenuStruct {
         let copyPages: [CPDFPage] = KMNThumbnailManager.manager.copyPages
         let selectedIndexPaths = collectionView.selectionIndexPaths
 
@@ -359,7 +345,7 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
                 } else if value == ThumbnailMenuIdentifier_PastNull {
                     properties_Menuitem.keyEquivalent = "⌘ v"
                 } else if value == ThumbnailMenuIdentifier_Delete {
-                    properties_Menuitem.keyEquivalent = "⌘ " + String(Unicode.Scalar(NSBackspaceCharacter)!)
+                    properties_Menuitem.keyEquivalent = "⌘ " + "⌫"
                 }  else if value == ThumbnailMenuIdentifier_RotateRight {
                     properties_Menuitem.keyEquivalent = "⌥ ⌘ R"
                 } else if value == ThumbnailMenuIdentifier_RotateLeft {
@@ -375,7 +361,7 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
             }
         }
         
-        let menuStruct = ThumbnailMenuStruct(menuitems: menuItemArr, viewHeight: viewHeight)
+        let menuStruct = KMNMenuStruct(menuitems: menuItemArr, viewHeight: viewHeight)
         
         return menuStruct
     }

+ 30 - 51
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMLinkViewController/KMLinkViewController.swift

@@ -127,6 +127,10 @@ import KMComponentLibrary
         if annotations.count == 0 {
             emptyContendView.isHidden = false
             
+            linkWebView.clearData()
+            
+            linkEmailView.clearData()
+            
         } else if annotations.count == 1 {
             
             current_Annotation = annotations.first
@@ -207,24 +211,8 @@ import KMComponentLibrary
             linkPageView.reloadData()
         } else if pdfLinkType == .Web {
             linkWebView.isHidden = false
-            linkWebView.annotation = current_Annotation
-            
-            if let url = current_Annotation?.url() {
-                if url.hasPrefix("mailto:") == true {
-                    linkWebView.inputTextarea.properties.text = ""
-                    linkWebView.inputTextarea.reloadData()
-                }
-            }
         } else if pdfLinkType == .Email {
             linkEmailView.isHidden = false
-            linkEmailView.annotation = current_Annotation
-            
-            if let url = current_Annotation?.url() {
-                if url.hasPrefix("mailto:") == false {
-                    linkEmailView.inputTextarea.properties.text = ""
-                    linkEmailView.inputTextarea.reloadData()
-                }
-            }
         }
     }
     
@@ -240,20 +228,36 @@ import KMComponentLibrary
 //MARK: - ComponentTabsDelegate
 extension KMLinkViewController: ComponentTabsDelegate {
     public func componentTabsDidSelected(_ view: ComponentTabs, _ property: ComponentTabsProperty) {
-        if property == pageProperty {
-            pdfLinkType = .Page
-        } else if property == webProperty {
-            pdfLinkType = .Web
-        } else if property == emailProperty {
-            pdfLinkType = .Email
-        }
-        
         if let annotation = current_Annotation {
+            if property == pageProperty {
+                pdfLinkType = .Page
+                annotation.setURL(nil)
+                
+                if let page = pdfView?.document.page(at: UInt(linkPageView.choosedIndex-1)) {
+                    let bounds = page.bounds(for: .cropBox)
+                    let destination = CPDFDestination(page: page, at: NSPoint(x: 0, y: bounds.size.height))
+                    annotation.setDestination(destination)
+                }
+                
+            } else if property == webProperty {
+                pdfLinkType = .Web
+                annotation.setDestination(nil)
+                
+                let linkUrlPath = KMNTools.judgeWebURL(linkWebView.inputTextarea.properties.text)
+                annotation.setURL(linkUrlPath)
+                
+            } else if property == emailProperty {
+                pdfLinkType = .Email
+                annotation.setDestination(nil)
+                
+                let linkUrlPath = KMNTools.judgeEmailURL(linkEmailView.inputTextarea.properties.text)
+                annotation.setURL(linkUrlPath)
+            }
+            
             pdfLinkTypeChanged()
+            
         }
-        
         CPDFLinkAnnotation.updateDefault_AddLinkType(pdfLinkType.rawValue)
-        
     }
 }
 
@@ -264,23 +268,6 @@ extension KMLinkViewController: KMLinkPageViewDelegate {
             pdfView?.go(toPageIndex: pageIndex-1, animated: false)
         }
     }
-    
-    func kmLinkPageViewDidChangeDestination(_ view: KMLinkPageView, _ pageIndex: Int) {
-        guard let activiteAnno = current_Annotation else {
-            return
-        }
-        activiteAnno.setURL(nil)
-        
-        if let page = pdfView?.document.page(at: UInt(pageIndex-1)) {
-            let bounds = page.bounds(for: .cropBox)
-            let destination = CPDFDestination(page: page, at: NSPoint(x: 0, y: bounds.size.height))
-            activiteAnno.setDestination(destination)
-        }
-        
-        if let _ = pdfView?.document.page(at: UInt(pageIndex-1)) {
-            pdfView?.go(toPageIndex: pageIndex-1, animated: false)
-        }
-    }
 }
 
 //MARK: - KMLinkPageViewDelegate
@@ -289,10 +276,6 @@ extension KMLinkViewController: KMLinkWebViewDelegate {
         guard let activeAnnotation = current_Annotation else {
             return
         }
-        activeAnnotation.setDestination(nil)
-        
-        let linkUrlPath = KMNTools.judgeWebURL(webString)
-        activeAnnotation.setURL(linkUrlPath)
         
         if let url = activeAnnotation.url() {
             if let data = URL(string: url) {
@@ -317,10 +300,6 @@ extension KMLinkViewController: KMLinkEmailViewDelegate {
             alert.runModal()
             return
         }
-        activeAnnotation.setDestination(nil)
-        
-        let linkUrlPath = KMNTools.judgeEmailURL(emailString)
-        activeAnnotation.setURL(linkUrlPath)
         
         if let url = activeAnnotation.url() {
             NSWorkspace.shared.open(URL(string: url)!)

+ 7 - 5
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMLinkViewController/Views/KMLinkEmailView/KMLinkEmailView.swift

@@ -74,10 +74,8 @@ public class KMLinkEmailView: BaseXibView {
         guard let annotation = self.annotation else {
             return
         }
-        if var urlString = annotation.url() {
-            if urlString.hasPrefix("mailto:") {
-                urlString = urlString.substring(form: 7)
-            }
+        if var urlString = annotation.url(), urlString.hasPrefix("mailto:") {
+             urlString = urlString.substring(form: 7)
              inputTextarea.properties.text = urlString
         } else {
             inputTextarea.properties.text = ""
@@ -86,6 +84,11 @@ public class KMLinkEmailView: BaseXibView {
         
     }
     
+    func clearData() {
+        inputTextarea.properties.text = ""
+        inputTextarea.reloadData()
+    }
+    
     //MARK: - Action
     @objc func buttonClicked(_ sender: NSView) {
         delegate?.kmLinkEmailViewDidGo?(self, inputTextarea.properties.text)
@@ -118,7 +121,6 @@ extension KMLinkEmailView: ComponentTextareaDelegate {
             let linkUrlPath = KMNTools.judgeEmailURL(view.properties.text)
             annotation.setURL(linkUrlPath)
             
-            annotation.setDestination(nil)
         }
     }
     

+ 25 - 16
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMLinkViewController/Views/KMLinkPageView/KMLinkPageView.swift

@@ -11,9 +11,7 @@ import KMComponentLibrary
 @objc public protocol KMLinkPageViewDelegate: AnyObject {
     
     @objc optional func kmLinkPageViewDidGoToPage(_ view: KMLinkPageView, _ pageIndex: Int)
-    
-    @objc optional func kmLinkPageViewDidChangeDestination(_ view: KMLinkPageView, _ pageIndex: Int)
- 
+     
 }
  
 public class KMLinkPageView: BaseXibView {
@@ -31,7 +29,7 @@ public class KMLinkPageView: BaseXibView {
     
     var annotation: CPDFLinkAnnotation? = nil
     
-    var startPageIndex: Int = 0
+//    var startPageIndex: Int = 0
     var choosedIndex: Int = 0
     var isGo: Bool = false
 
@@ -89,8 +87,7 @@ public class KMLinkPageView: BaseXibView {
                                                       keepPressState: false)
         goButton.setTarget(self, action: #selector(buttonClicked(_:)))
     }
-    
-    
+     
     func reloadData() {
         guard let pdfView = self.pdfView else {
             return
@@ -107,13 +104,12 @@ public class KMLinkPageView: BaseXibView {
         paginationView.properties.totalCount = Int(pdfView.document.pageCount)
         paginationView.reloadData()
         
-        isGo = false
-        goButton.properties.buttonText = KMLocalizedString("Go")
-        
         choosedIndex = paginationView.properties.currentIndex
-        startPageIndex = paginationView.properties.currentIndex
+//        startPageIndex = paginationView.properties.currentIndex
          
         refreshPage()
+        
+        refreshGoButton()
     }
     
     func refreshPage() {
@@ -130,6 +126,14 @@ public class KMLinkPageView: BaseXibView {
     }
     
     func refreshGoButton() {
+        //当前页码等于PDF阅读页,显示Back
+        //当前页码不等于PDF阅读页,显示Go,
+        if choosedIndex != (pdfView?.currentPageIndex ?? 0) + 1 {
+            isGo = false
+        } else {
+            isGo = true
+        }
+        
         if isGo {
             goButton.properties.buttonText = KMLocalizedString("Back")
         } else {
@@ -140,12 +144,13 @@ public class KMLinkPageView: BaseXibView {
     }
     
     @objc func buttonClicked(_ sender: NSView) {
-        if isGo == false {
-            delegate?.kmLinkPageViewDidChangeDestination?(self, choosedIndex)
-            isGo = true
+        if isGo == true {
+            if let annotation = annotation {
+                delegate?.kmLinkPageViewDidGoToPage?(self, Int(annotation.pageIndex()) + 1)
+            }
         } else {
-            delegate?.kmLinkPageViewDidGoToPage?(self, startPageIndex)
-            isGo = false
+            delegate?.kmLinkPageViewDidGoToPage?(self, choosedIndex)
+ 
         }
         refreshGoButton()
         
@@ -167,7 +172,11 @@ extension KMLinkPageView: ComponentPaginationDelegate {
         if choosedIndex != pagination.properties.currentIndex {
             choosedIndex = pagination.properties.currentIndex
             
-            isGo = false
+            if let page = pdfView?.document.page(at: UInt(choosedIndex-1)), let annotation = annotation {
+                let bounds = page.bounds(for: .cropBox)
+                let destination = CPDFDestination(page: page, at: NSPoint(x: 0, y: bounds.size.height))
+                annotation.setDestination(destination)
+            }
             
             refreshPage()
             

+ 6 - 2
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMLinkViewController/Views/KMLinkWebView/KMLinkWebView.swift

@@ -74,7 +74,7 @@ public class KMLinkWebView: BaseXibView {
         guard let annotation = self.annotation else {
             return
         }
-        if let urlString = annotation.url() {
+        if let urlString = annotation.url(), urlString.hasPrefix("mailto:") == false {
             inputTextarea.properties.text = urlString
         } else {
             inputTextarea.properties.text = ""
@@ -82,6 +82,11 @@ public class KMLinkWebView: BaseXibView {
         inputTextarea.reloadData()
     }
     
+    func clearData() {
+        inputTextarea.properties.text = ""
+        inputTextarea.reloadData()
+    }
+    
     //MARK: - Action
     @objc func buttonClicked(_ sender: NSView) {
         delegate?.kmLinkWebViewDidGo?(self, inputTextarea.properties.text)
@@ -113,7 +118,6 @@ extension KMLinkWebView: ComponentTextareaDelegate {
             let linkUrlPath = KMNTools.judgeWebURL(view.properties.text)
             annotation.setURL(linkUrlPath)
             
-            annotation.setDestination(nil)
         }
         
     }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1234 - 23
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1235 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/KMPDFMenuConfig.swift


+ 6 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 12 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/next_fill.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "next_fill.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/next_fill.imageset/next_fill.pdf


+ 12 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/pause_fill.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "pause_fill.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/pause_fill.imageset/pause_fill.pdf


+ 12 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/play_fill.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "play_fill.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/play_fill.imageset/play_fill.pdf


+ 12 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/previous_fill.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "previous_fill.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/TTS/previous_fill.imageset/previous_fill.pdf


+ 192 - 18
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/OCR/Tool/Manager/KMOCRManager.swift

@@ -12,6 +12,8 @@ import ComDocumentAIKit
 typealias KMOCRManagerOCRComplete = (_ document: CPDFDocument?, _ error: Error?) -> Void
 typealias KMOCRManagerOCRProgress = ( _ progress: Float) -> Void
 
+let maxImageScale = 4.0
+
 class KMOCRManager: NSObject {
     static let manager = KMOCRManager()
     
@@ -25,6 +27,11 @@ class KMOCRManager: NSObject {
     private var document: CPDFDocument?
     private var saveAsPDFFilePath: String = ""
     
+    //Tool OCR
+    private var OCRManger: KMGOCRManager?
+    private var ocrDictionary:[NSNumber: Any] = [:]
+    private var pageImages: [NSImage] = []
+    
 //    var documentContainsImagePages: [String: Int] = [:]
 
     var type: KMOCRType = .google {
@@ -64,7 +71,106 @@ class KMOCRManager: NSObject {
 
 //MARK: Tool OCR
 extension KMOCRManager {
+    func convertOCR(document: CPDFDocument, model: KMOCRModel, progress: @escaping KMOCRManagerOCRProgress, complete: @escaping KMOCRManagerOCRComplete) {
+        self.OCRComplete = complete
+        self.progress = progress
+        //计算需要处理的页面
+        var pages:[Int] = self.fetchPageIndex(document: document, model: model)
+        model.pageRange = pages
+        
+        if model.saveAsPDF {
+            DispatchQueue.main.async {
+                NSPanel.savePanel(NSWindow.currentWindow()) { panel in
+                    let url: URL = document.documentURL
+                    panel.nameFieldStringValue = ""+url.deletingPathExtension().lastPathComponent+"_OCR"
+                    panel.allowedFileTypes = ["pdf"]
+                } completion: { [unowned self] response, url in
+                    if (response == .cancel) {
+                        return
+                    }
+                    self.saveAsPDFFilePath = url?.path ?? ""
+                    self.convertOCR(document: document, indexs: model.pageRange, language: model.languageType, type: model.ocrType, saveAsPDF: true)
+                }
+            }
+        } else {
+            self.convertOCR(document: document, indexs: model.pageRange, language: model.languageType, type: model.ocrType)
+        }
+    }
+    
+    func convertOCR(document: CPDFDocument, indexs: [Int], language: COCRLanguage, type: KMOCRType, saveAsPDF: Bool = false) {
+        self.document = document
+        self.pageIndexs = indexs
+        
+        //获取缩图
+        var selctPageImages: [NSImage] = []
+        for i in 0..<indexs.count {
+            autoreleasepool {
+                let index = indexs[i]
+                let page = document.page(at: UInt(index))
+                let image = page?.thumbnail(of: CGSize(width: (page?.size.width ?? 0) * maxImageScale, height: (page?.size.height ?? 0) * maxImageScale))
+                if (image != nil) {
+                    selctPageImages.append(image!)
+                }
+            }
+        }
+        
+        self.pageImages = selctPageImages
+        
+        if (selctPageImages.count == 0) {
+            fail()
+        } else {
+            self.cancelRecognition()
+            DispatchQueue.main.async {
+                self.OCRManger = KMGOCRManager()
+                if type == .google {
+                    self.OCRManger?.ocrType = .google
+                } else if type == .apple {
+                    self.OCRManger?.ocrType = .apple
+                }
+                self.OCRManger?.delegate = self
+                self.OCRManger?.recognitionImages(selctPageImages, withLanguages: [language])
+            }
+        }
+        
+        
+    }
     
+    
+    func recognitionImages() {
+        
+    }
+    
+    func dealWithResults(_ rlts: [KMGOCRResult]?, OCRImageAtIndex index: Int) {
+        let key = NSNumber(value: Int32(index))
+    
+        ocrDictionary[key] = rlts
+//        ocrDictionary.setObject(rlts as Any, forKey: key as NSCopying)
+        
+        let sortedKeys = ocrDictionary.keys.sorted(by: { ($0 ).compare($1 ) == .orderedAscending })
+        var textString = ""
+        
+//        for key in sortedKeys {
+//            let results: Array<KMGOCRResult> = ocrDictionary.object(forKey: key) as! Array<KMGOCRResult>
+//            var rStr = ""
+//            if results.count > 0 {
+//                rStr = results[0].text
+//            }
+//            if textString.count > 0 {
+//                textString += "\n\n"
+//            }
+//            textString += String(format: NSLocalizedString("Page %ld", comment: ""), (key as AnyObject).intValue + 1)
+//            textString += "\n"
+//            textString += rStr
+//        }
+    }
+    
+    func cancelRecognition() {
+        let error = NSError(domain: "com.example.MyApp", code: 404, userInfo: [NSLocalizedDescriptionKey: "取消转换"])
+        OCRComplete?(nil, error)
+        
+        KMGOCRManager.default().delegate = nil
+        OCRManger?.cancelRecognition()
+    }
 }
 
 //MARK: Edit OCR
@@ -74,24 +180,7 @@ extension KMOCRManager {
         self.progress = progress
         
         //计算需要处理的页面
-        var pages:[Int] = []
-        if model.pageRangeType == .current {
-            pages = model.pageRange
-        } else if model.pageRangeType == .all {
-            for i in 0..<document.pageCount {
-                pages.append(Int(i) + 1)
-            }
-        } else if model.pageRangeType == .odd {
-            for i in 0..<document.pageCount where i % 2 == 0 {
-                pages.append(Int(i) + 1)
-            }
-        } else if model.pageRangeType == .even {
-            for i in 0..<document.pageCount where i % 2 != 0 {
-                pages.append(Int(i) + 1)
-            }
-        } else {
-            pages = KMPageRangeTools.findSelectPage(pageRangeString:model.pageRangeString , pageCount: Int(document.pageCount))
-        }
+        let pages:[Int] = self.fetchPageIndex(document: document, model: model)
         model.pageRange = pages
         
         if model.saveAsPDF {
@@ -162,6 +251,44 @@ extension KMOCRManager {
             OCRComplete?(nil, error)
         }
     }
+}
+
+//MARK: - KMGOCRManagerDelegate
+extension KMOCRManager: KMGOCRManagerDelegate {
+    func gocrManagerDidFinishOCR(_ manager: KMGOCRManager!) {
+//        self.batchesOCR()
+//        KMGOCRManager.default().createPDFFile(savePDFPath, imagePaths: self.pageImages, results: resultArrays, scale: KMImageScale)
+    }
+    
+    func gocrManager(_ manager: KMGOCRManager!, didCancelOCRImageAt index: Int) {
+        
+    }
+    
+    func gocrManager(_ manager: KMGOCRManager!, didStartOCRImageAt index: Int) {
+//        DispatchQueue.main.async {
+//            self.pageRangeBox.isEnabled = false
+//            self.languageButton.isEnabled = false
+//            self.planComboBox.isEnabled = false
+//        }
+    }
+    
+    func gocrManager(_ manager: KMGOCRManager!, didFinishOCRImageAt index: Int, results: [KMGOCRResult]!) {
+        let pageIndex = self.pageIndexs[index]
+        self.dealWithResults(results, OCRImageAtIndex: pageIndex)
+    }
+    
+    func gocrManager(_ manager: KMGOCRManager!, didFailureOCRImageAt index: Int, error: Error!) {
+//        let pagenum = self.pageIndexs?[index] as! NSNumber
+//        if (error != nil) {
+//            self.errorOCRArrays?.append(pagenum)
+//        }
+//        self.dealWithResults([], OCRImageAtIndex: index)
+    }
+    
+    
+    
+    
+    
 }
 
 //MARK: CPDFConverterDelegate
@@ -237,3 +364,50 @@ extension KMOCRManager {
 //    let destinationDirectory = "/path/to/destination/directory"  // 目标目录路径
 //    let newFileName = "newFileName.txt"                           // 新的文件名
 }
+
+//
+extension KMOCRManager {
+    func fetchPageIndex(document: CPDFDocument, model: KMOCRModel) -> [Int] {
+        //计算需要处理的页面
+        var pages:[Int] = []
+        if model.pageRangeType == .current {
+            pages = model.pageRange
+        } else if model.pageRangeType == .all {
+            for i in 0..<document.pageCount {
+                pages.append(Int(i) + 1)
+            }
+        } else if model.pageRangeType == .odd {
+            for i in 0..<document.pageCount where i % 2 == 0 {
+                pages.append(Int(i) + 1)
+            }
+        } else if model.pageRangeType == .even {
+            for i in 0..<document.pageCount where i % 2 != 0 {
+                pages.append(Int(i) + 1)
+            }
+        } else {
+            pages = KMPageRangeTools.findSelectPage(pageRangeString:model.pageRangeString , pageCount: Int(document.pageCount))
+        }
+        return pages
+    }
+    
+    private func getOCRResrultsFolderPath() -> String {
+        var path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.applicationSupportDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last
+        path?.append("/")
+        path?.append(Bundle.main.bundleIdentifier!)
+        if (FileManager.default.fileExists(atPath: path!) == false) {
+            try?FileManager.default.createDirectory(atPath: path!, withIntermediateDirectories: false)
+        }
+        
+        path?.append("/")
+        path?.append("OCR_Resrults")
+        
+        return path!
+    }
+}
+
+extension KMOCRManager {
+    func fail() {
+        let error = NSError(domain: "com.example.MyApp", code: 404, userInfo: [NSLocalizedDescriptionKey: "转换失败"])
+        OCRComplete?(nil, error)
+    }
+}

+ 4 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/OCR/Tool/View/Area/KMOCRAreaView.swift

@@ -147,6 +147,8 @@ class KMOCRAreaView: BaseXibView {
 extension KMOCRAreaView {
     func OCRPlan1ButtonAction(_ sender: ComponentCheckBox) {
         model.ocrType = .google
+        
+        self.updateLanguages()
         self.reloadData()
         
         guard let callBack = changeAction else { return }
@@ -156,6 +158,8 @@ extension KMOCRAreaView {
     
     func OCRPlan2ButtonAction(_ sender: ComponentCheckBox) {
         model.ocrType = .apple
+        
+        self.updateLanguages()
         self.reloadData()
         
         guard let callBack = changeAction else { return }

+ 5 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/OCR/Tool/View/Page/KMOCRPageView.swift

@@ -204,6 +204,8 @@ class KMOCRPageView: BaseXibView {
 extension KMOCRPageView {
     func OCRPlan1ButtonAction(_ sender: ComponentCheckBox) {
         model.ocrType = .google
+        
+        self.updateLanguages()
         self.reloadData()
         
         guard let callBack = changeAction else { return }
@@ -213,6 +215,8 @@ extension KMOCRPageView {
     
     func OCRPlan2ButtonAction(_ sender: ComponentCheckBox) {
         model.ocrType = .apple
+        
+        self.updateLanguages()
         self.reloadData()
         
         guard let callBack = changeAction else { return }
@@ -252,7 +256,7 @@ extension KMOCRPageView: ComponentSelectDelegate {
             let values: [String: String] = KMGOCRManager.languages()[position] as? [String : String] ?? [:]
             let key = values[KMGOCRLanguageCodeKey]
             
-            model.language = menuItemProperty?.text ?? ""
+            model.language = key ?? ""
             if let unwrappedKey = key, let intValue = Int(unwrappedKey) {
                 model.languageType = COCRLanguage(rawValue: intValue) ?? .english
             } else {

+ 12 - 2
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMCreateSignWindowController.swift

@@ -40,7 +40,7 @@ class KMCreateSignWindowController: KMNBaseWindowController {
     
     //MARK: - func
     deinit {
-        print("1")
+        
     }
     
     override func windowDidLoad() {
@@ -73,6 +73,7 @@ class KMCreateSignWindowController: KMNBaseWindowController {
         signTextView?.infoUpdateCallback = {[weak self] valid in
             self?.updateCreateButtonState()
         }
+        signTextView?.clear()
         infoContendView.addSubview(signTextView!)
         
         if signDrawView == nil {
@@ -84,6 +85,7 @@ class KMCreateSignWindowController: KMNBaseWindowController {
         signDrawView?.infoUpdateCallback = {[weak self] valid in
             self?.updateCreateButtonState()
         }
+        signDrawView?.clear()
         
         if signImageView == nil {
             signImageView = KMPDFSignatureImageView.init()
@@ -93,6 +95,7 @@ class KMCreateSignWindowController: KMNBaseWindowController {
         signImageView?.changeSignatureImageCallback = {[weak self] valid in
             self?.updateCreateButtonState()
         }
+        signImageView?.clearImage()
         infoContendView.addSubview(signImageView!)
         
         
@@ -125,6 +128,12 @@ class KMCreateSignWindowController: KMNBaseWindowController {
         typeTabs.refreshItems()
     }
     
+    func clear() {
+        signTextView?.clear()
+        signDrawView?.clear()
+        signImageView?.clearImage()
+    }
+    
     //MARK: - reloadData
     func reloadData() {
         //Tabs
@@ -174,11 +183,12 @@ class KMCreateSignWindowController: KMNBaseWindowController {
     
     @objc func buttonClicked(_ button: ComponentButton) {
         if button == cancelButton {
-            
+            clear()
         } else if button == createButton {
             if let value = self.createSignature() {
                 delegate?.kmCreateSignWindowControllerDidCreate?(self, value)
             }
+            clear()
         }
         self.own_closeEndSheet()
     }

+ 2 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMCreateSignWindowController.xib

@@ -24,6 +24,8 @@
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="480" height="436"/>
             <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <value key="minSize" type="size" width="480" height="436"/>
+            <value key="maxSize" type="size" width="480" height="436"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="480" height="436"/>
                 <autoresizingMask key="autoresizingMask"/>

+ 8 - 2
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMPDFSignatureDrawView.swift

@@ -153,12 +153,18 @@ class KMPDFSignatureDrawView: BaseXibView {
          
     }
     
-    //MARK: - Action
-    @objc func clearButtonClicked(_ sender: ComponentButton) {
+    func clear() {
         drawView?.clearImage()
         
         reloadData()
         
+    }
+    
+    //MARK: - Action
+    @objc func clearButtonClicked(_ sender: ComponentButton) {
+
+        clear()
+        
         guard let callBack = self.infoUpdateCallback else {
             return
         }

+ 7 - 3
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMPDFSignatureInputView.swift

@@ -144,12 +144,16 @@ class KMPDFSignatureInputView: BaseXibView {
         
     }
     
-    //MARK: - Action
-    @objc func clearButtonClicked(_ sender: ComponentButton) {
-
+    func clear() {
         textView?.clearImage()
         
         reloadData()
+    }
+    
+    //MARK: - Action
+    @objc func clearButtonClicked(_ sender: ComponentButton) {
+
+        clear()
         
         guard let callBack = self.infoUpdateCallback else {
             return

+ 13 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/KMSignatureListController.swift

@@ -107,6 +107,8 @@ extension KMSignatureListController: NSCollectionViewDelegate, NSCollectionViewD
         
         let item: KMStampListItem = collectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMStampListItem"), for: indexPath) as! KMStampListItem
         item.signObject = allObjects[indexPath.item]
+        item.stampType = .custom
+        item.delegate = self
         item.reloadData()
         
         return item
@@ -148,3 +150,14 @@ extension KMSignatureListController: KMCreateSignWindowControllerDelegate {
         
     }
 }
+
+//MARK: - KMStampListItemDelegate
+extension KMSignatureListController: KMStampListItemDelegate {
+    func kmStampListItemDelete(_ stampListItem: KMStampListItem) {
+        if let signObject = stampListItem.signObject {
+            KMSignatureManager.manager.removeObject(signObject)
+        }
+        
+        reloadData()
+    }
+}

+ 8 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/KMSignatureManager.swift

@@ -62,6 +62,14 @@ import Foundation
     
     @objc func addSignature(_ signature: KMSignature) {
         signatureList.append(signature)
+        
+        saveSingaturesToFile()
+    }
+    
+    func removeObject(_ signature: KMSignature) {
+        signatureList.removeObject(signature)
+        
+        saveSingaturesToFile()
     }
     
     @objc func saveSingaturesToFile() {

+ 2 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Controllers/KMStampSettingWindowController.xib

@@ -29,6 +29,8 @@
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="480" height="300"/>
             <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <value key="minSize" type="size" width="480" height="300"/>
+            <value key="maxSize" type="size" width="480" height="300"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="480" height="300"/>
                 <autoresizingMask key="autoresizingMask"/>

+ 11 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/KMStampListController.swift

@@ -198,7 +198,9 @@ extension KMStampListController: NSCollectionViewDelegate, NSCollectionViewDataS
         let item: KMStampListItem = collectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMStampListItem"), for: indexPath) as! KMStampListItem
         
         let stamp: CStampObject = stampObjects[indexPath.item]
+        item.stampType = self.stampType
         item.stampObject = stamp
+        item.delegate = self
         item.reloadData()
         
         return item
@@ -227,3 +229,12 @@ extension KMStampListController: NSCollectionViewDelegate, NSCollectionViewDataS
      
     
 }
+
+extension KMStampListController: KMStampListItemDelegate {
+    func kmStampListItemDelete(_ stampListItem: KMStampListItem) {
+        if let stampObject = stampListItem.stampObject {
+           let _ = KMStampManager.defaultManager.removeStamp(stampObject)
+        }
+        reloadData()
+    }
+}

+ 31 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Views/KMStampListItem.swift

@@ -8,14 +8,25 @@
 import Cocoa
 import KMComponentLibrary
 
+@objc protocol KMStampListItemDelegate: AnyObject {
+    
+    @objc optional func kmStampListItemDelete(_ stampListItem: KMStampListItem)
+    
+}
+
 class KMStampListItem: NSCollectionViewItem {
 
     @IBOutlet var bottomBox: NSBox!
     @IBOutlet var iconImage: NSImageView!
+    @IBOutlet var deleteButton: ComponentButton!
     
     private var area: NSTrackingArea?
     private var isMouseEnter: Bool = false
     
+    weak open var delegate: KMStampListItemDelegate?
+    
+    var stampType: KMStampList_Type = .standard
+    
     var stampObject: CStampObject?
     
     var signObject: KMSignature?
@@ -32,6 +43,11 @@ class KMStampListItem: NSCollectionViewItem {
         // Do view setup here.
         
         self.updateTrackingArea()
+        
+        deleteButton.properties = ComponentButtonProperty(type: .default_tertiary,  size: .xxs, onlyIcon: true, icon: NSImage(named: "pageEdit_delete"))
+        deleteButton.isHidden = true
+        deleteButton.setTarget(self, action: #selector(deleteButtonClicked(_:)))
+        
     }
     
     override var isSelected: Bool {
@@ -86,8 +102,23 @@ class KMStampListItem: NSCollectionViewItem {
                  bottomBox.fillColor = NSColor.clear
             }
         }
+        
+        if stampType == .custom {
+            if isMouseEnter {
+                deleteButton.isHidden = false
+            } else {
+                deleteButton.isHidden = true
+            }
+        } else {
+            deleteButton.isHidden = true
+        }
+    }
+    
+    @objc func deleteButtonClicked(_ sender: ComponentButton) {
+        delegate?.kmStampListItemDelete?(self)
     }
     
+    //MARK: - Mouse Event
     override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
         

+ 10 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Views/KMStampListItem.xib

@@ -9,6 +9,7 @@
         <customObject id="-2" userLabel="File's Owner" customClass="KMStampListItem" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="bottomBox" destination="Chm-gE-a3n" id="RVf-bn-CmR"/>
+                <outlet property="deleteButton" destination="cOP-zU-eoW" id="wt8-9F-MGn"/>
                 <outlet property="iconImage" destination="moE-kh-pGW" id="dtk-ZP-djx"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
             </connections>
@@ -37,6 +38,13 @@
                             </constraints>
                             <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="jD0-J9-VGx"/>
                         </imageView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="cOP-zU-eoW" customClass="ComponentButton" customModule="KMComponentLibrary">
+                            <rect key="frame" x="200" y="56" width="24" height="24"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="24" id="Guy-TJ-ttc"/>
+                                <constraint firstAttribute="height" constant="24" id="bqx-mQ-u5m"/>
+                            </constraints>
+                        </customView>
                     </subviews>
                     <constraints>
                         <constraint firstAttribute="bottom" secondItem="Chm-gE-a3n" secondAttribute="bottom" id="9Y9-g9-ToB"/>
@@ -44,7 +52,9 @@
                         <constraint firstItem="moE-kh-pGW" firstAttribute="centerX" secondItem="agb-C4-x5I" secondAttribute="centerX" id="Z4c-fM-gmo"/>
                         <constraint firstItem="moE-kh-pGW" firstAttribute="centerY" secondItem="agb-C4-x5I" secondAttribute="centerY" id="j2c-eJ-bNG"/>
                         <constraint firstItem="Chm-gE-a3n" firstAttribute="top" secondItem="agb-C4-x5I" secondAttribute="top" id="o9f-Nc-3UX"/>
+                        <constraint firstItem="cOP-zU-eoW" firstAttribute="top" secondItem="agb-C4-x5I" secondAttribute="top" constant="8" id="osS-Kq-vcx"/>
                         <constraint firstItem="Chm-gE-a3n" firstAttribute="leading" secondItem="agb-C4-x5I" secondAttribute="leading" id="sRy-P7-8us"/>
+                        <constraint firstAttribute="trailing" secondItem="cOP-zU-eoW" secondAttribute="trailing" constant="8" id="u8d-1a-jAO"/>
                     </constraints>
                 </customView>
             </subviews>

+ 33 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/Toolbar/KMPDFToolbarController.swift

@@ -568,6 +568,39 @@ class KMPDFToolbarController: NSViewController {
         } else if identify == KMPDFToolbar_Markup_Identifier {
             componentTabsDidSelected(tabsView, toolbarManager.markupMode_Property)
             
+        } else if identify == KMPDFToolbar_edit_link_Identifier {
+            viewManager.toolMode = .Edit
+            viewManager.subToolMode = .Edit_Link
+            
+            toolbarManager.edit_text_Property.state = .normal
+            toolbarManager.edit_image_Property.state = .normal
+            toolbarManager.edit_link_Property.state = .pressed
+            
+            refreshSecondToolbarItemsState()
+            kmPDFSecToolbarControllerDidItemClicked(secondToolBar, toolbarManager.edit_link_Property)
+            
+        } else if identify == KMPDFToolbar_edit_text_Identifier {
+            viewManager.toolMode = .Edit
+            viewManager.subToolMode = .Edit_text
+            
+            toolbarManager.edit_text_Property.state = .pressed
+            toolbarManager.edit_image_Property.state = .normal
+            toolbarManager.edit_link_Property.state = .normal
+            
+            refreshSecondToolbarItemsState()
+            kmPDFSecToolbarControllerDidItemClicked(secondToolBar, toolbarManager.edit_text_Property)
+            
+        } else if identify == KMPDFToolbar_edit_image_Identifier {
+            viewManager.toolMode = .Edit
+            viewManager.subToolMode = .Edit_Image
+            
+            toolbarManager.edit_text_Property.state = .normal
+            toolbarManager.edit_image_Property.state = .pressed
+            toolbarManager.edit_link_Property.state = .normal
+            
+            refreshSecondToolbarItemsState()
+            
+            kmPDFSecToolbarControllerDidItemClicked(secondToolBar, toolbarManager.edit_image_Property)
         }
     }
     

+ 9 - 3
PDF Office/PDF Master/KMClass/Left/Outline/Controller/KMOutlineViewController.swift

@@ -720,9 +720,15 @@ extension KMOutlineViewController {
     }
     
     func addOutlineToIndex(index: Int, parent: KMBOTAOutlineItem?) {
-        let pageIndex = self.handdler.currentPageIndex
-        let label = self.fetchCurrentLabel(pageIndex: pageIndex)
-        let destination = self.handdler.currentDestination()
+        var pageIndex = self.handdler.currentPageIndex
+        var label = self.fetchCurrentLabel(pageIndex: pageIndex)
+        var destination = self.handdler.currentDestination()
+
+        if ((self.handdler.pdfView?.currentSelection) != nil) {
+            pageIndex = Int(((self.handdler.pdfView?.currentSelection.page.pageIndex() ?? 0) + 1))
+            label = self.handdler.pdfView?.currentSelection?.string() ?? ""
+            destination =  self.handdler.pdfView?.currentDestination
+        }
     
         self.addOutlineToIndex(index: index, pageIndex: pageIndex, destination: destination, lable: label, parent: parent)
     }

+ 1 - 1
PDF Office/PDF Master/KMClass/Left/Outline/Tools/KMNOutlineHanddler.swift

@@ -30,7 +30,7 @@ class KMNOutlineHanddler: NSObject {
     
     var currentPageIndex: Int {
         get {
-            return pdfView?.currentPageIndex ?? 0
+            return (pdfView?.currentPageIndex ?? 0) + 1
         }
     }
     

+ 2 - 2
PDF Office/PDF Master/KMClass/Left/ThumnailView/KMNThumnailViewController.swift

@@ -66,7 +66,7 @@ class KMNThumnailViewController: KMNThumbnailBaseViewController {
         collectionView.reloadData()
     }
     
-    override func clickMenu(point:NSPoint)->ThumbnailMenuStruct {
+    override func clickMenu(point:NSPoint)->KMNMenuStruct {
         let menuStruct = super.clickMenu(point: point)
         
         var viewHeight: CGFloat = menuStruct.viewHeight
@@ -92,7 +92,7 @@ class KMNThumnailViewController: KMNThumbnailBaseViewController {
             }
         }
         
-        let newMenuStruct = ThumbnailMenuStruct(menuitems: menuItemArr, viewHeight: viewHeight)
+        let newMenuStruct = KMNMenuStruct(menuitems: menuItemArr, viewHeight: viewHeight)
         
         return newMenuStruct
     }

+ 1 - 1
PDF Office/PDF Master/KMClass/PDFListView/ViewController/KMNAlertTipViewController.swift

@@ -336,7 +336,7 @@ class KMNAlertTipViewController: KMNBaseViewController {
             alertHeight += 32.0
         }
         
-        if OCRComponentAlert.superview != nil {
+        if OCRComponentAlert.superview != nil && OCRComponentAlert.isHidden == false {
             if alertHeight > 0 {
                 alertHeight += 1
             }

+ 2 - 2
PDF Office/PDF Master/KMClass/PDFListView/ViewController/KMNAlertTipViewController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>

+ 9 - 175
PDF Office/PDF Master/KMClass/PDFListView/WindowController/KMNPopAnnotationWindowController.swift

@@ -237,209 +237,43 @@ class KMNPopAnnotationWindowController: KMNBaseWindowController {
     
     private var objectAlignType:ObjectAlignType = .alightLeft {
         didSet {
-            var zeroRect = NSRect.null
-            var highestRect = NSZeroRect
-            var widthestRect = NSZeroRect
-            
-            let objects = annotationPopMode.annotations
-            let fristObject : CPDFAnnotation = objects.first ?? CPDFAnnotation()
-            var leftestRect = fristObject.bounds
-            var rightestRect = fristObject.bounds
-            var topestRect = fristObject.bounds
-            var bottomestRect = fristObject.bounds
-            
-            var leftestObject  : CPDFAnnotation = fristObject
-            var rightestObject : CPDFAnnotation = fristObject
-            var topestObject : CPDFAnnotation = fristObject
-            var bottomestObject: CPDFAnnotation = fristObject
-            
-            var totalWidth = 0.0
-            var totalHeight = 0.0
-            
-            for i in 0 ..< objects.count {
-                let annotation : CPDFAnnotation = objects[i]
-                zeroRect = zeroRect.union(annotation.bounds)
-                totalWidth = totalWidth + annotation.bounds.width
-                totalHeight = totalHeight + annotation.bounds.height
-                
-                if annotation.bounds.height > highestRect.height {
-                    highestRect = annotation.bounds
-                }
-                
-                if annotation.bounds.width > widthestRect.width {
-                    widthestRect = annotation.bounds
-                }
-                
-                if leftestRect.minX > annotation.bounds.minX {
-                    leftestRect = annotation.bounds
-                    leftestObject = annotation
-                }
-                
-                if annotation.bounds.maxX > rightestRect.maxX {
-                    rightestRect = annotation.bounds
-                    rightestObject = annotation
-                }
-                
-                if annotation.bounds.maxY > topestRect.maxY {
-                    topestRect = annotation.bounds
-                    topestObject = annotation
-                }
-                
-                if bottomestRect.minY > annotation.bounds.minY {
-                    bottomestRect = annotation.bounds
-                    bottomestObject = annotation
-                }
-            }
-            
-            var resultAreasArray: [CPDFAnnotation] = []
-            var newBoundsArray: [String] = []
-            
+            let activeAnnotations = annotationPopMode.annotations
             switch objectAlignType {
             case .alightLeft :
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.x = zeroRect.origin.x
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.change(activeAnnotations, alignmentType: .left)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightLeft")
                 break
             case .alightRight:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.x = zeroRect.maxX - bounds.size.width
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.change(activeAnnotations, alignmentType: .right)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightRight")
                 break
             case .alightTop:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.y = zeroRect.maxY - bounds.size.height
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.change(activeAnnotations, alignmentType: .top)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightTop")
                 break
                 
             case .alightVer:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.x = widthestRect.midX - bounds.width/2
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.change(activeAnnotations, alignmentType: .vertical)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightVer")
                 break
             case .alightHor:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.y = highestRect.midY - bounds.height/2
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.change(activeAnnotations, alignmentType: .horizontally)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightHor")
                 break
             case .alightBottom:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.y = zeroRect.minY
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.change(activeAnnotations, alignmentType: .bottom)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightBottom")
                 break
             case .averageVer:
-                let middleGap = zeroRect.height - topestRect.height - bottomestRect.height
-                let otherAreasTotalHeight = totalHeight - topestRect.height - bottomestRect.height
-                
-                let gap = (middleGap - otherAreasTotalHeight)/CGFloat(objects.count - 1)
-                var areasCopyArray : [CPDFAnnotation] = objects
-                areasCopyArray.sorted(by: { obj1, obj2 in
-                    let area1 = obj1
-                    let area2 = obj2
-                    if area1.bounds.origin.x < area2.bounds.origin.x {
-                        return true
-                    } else {
-                        return false
-                    }
-                })
-                if let index = areasCopyArray.firstIndex(of: topestObject) {
-                    areasCopyArray.remove(at: index)
-                }
-                
-                if let index = areasCopyArray.firstIndex(of: bottomestObject) {
-                    areasCopyArray.remove(at: index)
-                }
-                
-                var bottomStartY = bottomestRect.maxY + gap
-                for i in 0 ..< areasCopyArray.count {
-                    let areas = areasCopyArray[i]
-                    var bounds = areas.bounds
-                    bounds.origin.y = bottomStartY
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                    bottomStartY = bottomStartY + bounds.height + gap
-                }
-                resultAreasArray = areasCopyArray
-                
+                listView?.change(activeAnnotations, alignmentType: .disVertical)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjecAlignAverageVer")
                 break
             case .averageHor:
-                let middleGap = zeroRect.width - leftestRect.width - rightestRect.width
-                let otherAreasTotalWidth = totalWidth - leftestRect.width - rightestRect.width
-                
-                let gap = (middleGap - otherAreasTotalWidth)/CGFloat(objects.count - 1)
-                var areasCopyArray : [CPDFAnnotation] = objects
-                areasCopyArray.sorted(by: { obj1, obj2 in
-                    let area1 = obj1
-                    let area2 = obj2
-                    if area1.bounds.origin.x < area2.bounds.origin.x {
-                        return true
-                    } else {
-                        return false
-                    }
-                })
-                
-                if let index = areasCopyArray.firstIndex(of: leftestObject) {
-                    areasCopyArray.remove(at: index)
-                }
-                
-                if let index = areasCopyArray.firstIndex(of: rightestObject) {
-                    areasCopyArray.remove(at: index)
-                }
-                
-                var leftStartX = leftestRect.maxX + gap
-                for i in 0 ..< areasCopyArray.count {
-                    let areas = areasCopyArray[i]
-                    var bounds = areas.bounds
-                    bounds.origin.x = leftStartX
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                    leftStartX = leftStartX + bounds.width + gap
-                }
-                resultAreasArray = areasCopyArray
-                
+                listView?.change(activeAnnotations, alignmentType: .disHorizontally)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjecAlignAverageHor")
                 break
             }
             alightButton.reloadData()
-            
-            for i in 0 ..< resultAreasArray.count {
-                let annotation : CPDFAnnotation = resultAreasArray[i]
-                annotation.bounds = NSRectFromString(newBoundsArray[i])
-            }
         }
     }
     

+ 16 - 204
PDF Office/PDF Master/KMClass/PDFListView/WindowController/KMNPopContentEditWindowController.swift

@@ -249,209 +249,45 @@ class KMNPopContentEditWindowController: KMNBaseWindowController {
     
     private var objectAlign:ObjectAlignType = .alightLeft {
         didSet {
-            var zeroRect = NSRect.null
-            var highestRect = NSZeroRect
-            var widthestRect = NSZeroRect
-            
-            let objects = editContentPopMode.editAreas
-            let fristObject : CPDFEditArea = objects.first ?? CPDFEditArea()
-            var leftestRect = fristObject.bounds
-            var rightestRect = fristObject.bounds
-            var topestRect = fristObject.bounds
-            var bottomestRect = fristObject.bounds
-            
-            var leftestObject  : CPDFEditArea = fristObject
-            var rightestObject : CPDFEditArea = fristObject
-            var topestObject : CPDFEditArea = fristObject
-            var bottomestObject: CPDFEditArea = fristObject
-            
-            var totalWidth = 0.0
-            var totalHeight = 0.0
-            
-            for i in 0 ..< objects.count {
-                let annotation : CPDFEditArea = objects[i]
-                zeroRect = zeroRect.union(annotation.bounds)
-                totalWidth = totalWidth + annotation.bounds.width
-                totalHeight = totalHeight + annotation.bounds.height
-                
-                if annotation.bounds.height > highestRect.height {
-                    highestRect = annotation.bounds
-                }
-                
-                if annotation.bounds.width > widthestRect.width {
-                    widthestRect = annotation.bounds
-                }
-                
-                if leftestRect.minX > annotation.bounds.minX {
-                    leftestRect = annotation.bounds
-                    leftestObject = annotation
-                }
-                
-                if annotation.bounds.maxX > rightestRect.maxX {
-                    rightestRect = annotation.bounds
-                    rightestObject = annotation
-                }
-                
-                if annotation.bounds.maxY > topestRect.maxY {
-                    topestRect = annotation.bounds
-                    topestObject = annotation
-                }
-                
-                if bottomestRect.minY > annotation.bounds.minY {
-                    bottomestRect = annotation.bounds
-                    bottomestObject = annotation
-                }
-            }
-            
-            var resultAreasArray: [CPDFEditArea] = []
-            var newBoundsArray: [String] = []
-            
             switch objectAlign {
             case .alightLeft :
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.x = zeroRect.origin.x
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.changeEditingAreas(.left)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightLeft")
                 break
             case .alightRight:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.x = zeroRect.maxX - bounds.size.width
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.changeEditingAreas(.right)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightRight")
                 break
             case .alightTop:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.y = zeroRect.maxY - bounds.size.height
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.changeEditingAreas(.top)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightTop")
                 break
                 
             case .alightVer:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.x = widthestRect.midX - bounds.width/2
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.changeEditingAreas(.vertical)
+
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightVer")
                 break
             case .alightHor:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.y = highestRect.midY - bounds.height/2
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.changeEditingAreas(.horizontally)
+
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightHor")
                 break
             case .alightBottom:
-                for i in 0 ..< objects.count {
-                    let object = objects[i]
-                    var bounds = object.bounds
-                    bounds.origin.y = zeroRect.minY
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                }
-                resultAreasArray = objects
-                
+                listView?.changeEditingAreas(.bottom)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjectPopAlightBottom")
                 break
             case .averageVer:
-                let middleGap = zeroRect.height - topestRect.height - bottomestRect.height
-                let otherAreasTotalHeight = totalHeight - topestRect.height - bottomestRect.height
-                
-                let gap = (middleGap - otherAreasTotalHeight)/CGFloat(objects.count - 1)
-                var areasCopyArray : [CPDFEditArea] = objects
-                areasCopyArray.sorted(by: { obj1, obj2 in
-                    let area1 = obj1
-                    let area2 = obj2
-                    if area1.bounds.origin.x < area2.bounds.origin.x {
-                        return true
-                    } else {
-                        return false
-                    }
-                })
-                if let index = areasCopyArray.firstIndex(of: topestObject) {
-                    areasCopyArray.remove(at: index)
-                }
-                
-                if let index = areasCopyArray.firstIndex(of: bottomestObject) {
-                    areasCopyArray.remove(at: index)
-                }
-                
-                var bottomStartY = bottomestRect.maxY + gap
-                for i in 0 ..< areasCopyArray.count {
-                    let areas = areasCopyArray[i]
-                    var bounds = areas.bounds
-                    bounds.origin.y = bottomStartY
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                    bottomStartY = bottomStartY + bounds.height + gap
-                }
-                resultAreasArray = areasCopyArray
-                
+                listView?.changeEditingAreas(.disVertical)
+
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjecAlignAverageVer")
                 break
             case .averageHor:
-                let middleGap = zeroRect.width - leftestRect.width - rightestRect.width
-                let otherAreasTotalWidth = totalWidth - leftestRect.width - rightestRect.width
-                
-                let gap = (middleGap - otherAreasTotalWidth)/CGFloat(objects.count - 1)
-                var areasCopyArray : [CPDFEditArea] = objects
-                areasCopyArray.sorted(by: { obj1, obj2 in
-                    let area1 = obj1
-                    let area2 = obj2
-                    if area1.bounds.origin.x < area2.bounds.origin.x {
-                        return true
-                    } else {
-                        return false
-                    }
-                })
-                
-                if let index = areasCopyArray.firstIndex(of: leftestObject) {
-                    areasCopyArray.remove(at: index)
-                }
-                
-                if let index = areasCopyArray.firstIndex(of: rightestObject) {
-                    areasCopyArray.remove(at: index)
-                }
-                
-                var leftStartX = leftestRect.maxX + gap
-                for i in 0 ..< areasCopyArray.count {
-                    let areas = areasCopyArray[i]
-                    var bounds = areas.bounds
-                    bounds.origin.x = leftStartX
-                    newBoundsArray.append(NSStringFromRect(bounds))
-                    leftStartX = leftStartX + bounds.width + gap
-                }
-                resultAreasArray = areasCopyArray
-                
+                listView?.changeEditingAreas(.disHorizontally)
                 alightButton.properties.icon = NSImage(named: "KMNImageNameObjecAlignAverageHor")
                 break
             }
-            alightButton.reloadData()
-            
-            for i in 0 ..< resultAreasArray.count {
-                let editArea : CPDFEditArea = resultAreasArray[i]
-                listView?.setBoundsEditArea(editArea, withBounds: NSRectFromString(newBoundsArray[i]))
-            }
+            alightButton.reloadData()            
         }
     }
     
@@ -868,25 +704,12 @@ class KMNPopContentEditWindowController: KMNBaseWindowController {
     }
     
     @objc func fontSizeZoomOutButtonClicked(_ sender: NSView) {
-        let textEditAreas = listView?.km_editingTextAreas()
-        for i in 0 ..< (textEditAreas?.count ?? 0) {
-            let textEditArea = textEditAreas?[i]
-            let fontSize = listView?.editingSelectionFontSize(byRangeEdit: textEditArea) ?? 0
-            if(fontSize > changeValue) {
-                listView?.setEditingSelectionFontSize((fontSize - changeValue), with: textEditArea, isAutoSize: false)
-            }
-        }
+        listView?.zoomOutEditTextFontSize()
         updatePDFViewCallback?()
     }
     
     @objc func fontSizeZoomInButtonClicked(_ sender: NSView) {
-        let textEditAreas = listView?.km_editingTextAreas()
-        for i in 0 ..< (textEditAreas?.count ?? 0) {
-            let textEditArea = textEditAreas?[i]
-            let fontSize = listView?.editingSelectionFontSize(byRangeEdit: textEditArea) ?? 0
-            listView?.setEditingSelectionFontSize((fontSize + changeValue), with: textEditArea, isAutoSize: false)
-            
-        }
+        listView?.zoomInEditTextFontSize()
         updatePDFViewCallback?()
     }
     
@@ -966,19 +789,8 @@ class KMNPopContentEditWindowController: KMNBaseWindowController {
     }
     
     @objc func replaceImageButtonClicked(_ sender: NSView) {
-        if let areas = listView?.km_editingImageAreas() {
-            let panel = NSOpenPanel()
-            panel.allowsMultipleSelection = false
-            panel.allowedFileTypes = ["png","jpg"]
-            panel.beginSheetModal(for: NSApp.mainWindow!) { response in
-                if response == .OK {
-                    let openPath = panel.url?.path
-                    for area in areas {
-                        self.listView?.replace(area, imagePath: openPath!)
-                    }
-                }
-            }
-        }
+        listView?.replaceImageEdit()
+        updatePDFViewCallback?()
     }
     
     @objc func extractImageButtonClicked(_ sender: NSView) {

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

@@ -744,9 +744,6 @@
 		9FBC489D2996500300CA39D7 /* KMDocumentController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FBC489A2996500300CA39D7 /* KMDocumentController.swift */; };
 		9FC444FA2AA61EDE00D7187C /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC444F82AA5F7D600D7187C /* ZipArchive.framework */; };
 		9FC444FB2AA61EDE00D7187C /* ZipArchive.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC444F82AA5F7D600D7187C /* ZipArchive.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		9FCFEC682AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC672AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift */; };
-		9FCFEC692AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC672AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift */; };
-		9FCFEC6A2AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC672AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift */; };
 		9FCFEC6C2AC3D96800EAD2CB /* CPDFListViewAnimatedBorderlessWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC6B2AC3D96800EAD2CB /* CPDFListViewAnimatedBorderlessWindow.swift */; };
 		9FCFEC6D2AC3D96800EAD2CB /* CPDFListViewAnimatedBorderlessWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC6B2AC3D96800EAD2CB /* CPDFListViewAnimatedBorderlessWindow.swift */; };
 		9FCFEC6E2AC3D96800EAD2CB /* CPDFListViewAnimatedBorderlessWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC6B2AC3D96800EAD2CB /* CPDFListViewAnimatedBorderlessWindow.swift */; };
@@ -4312,6 +4309,9 @@
 		F3A65ED52CDF1C1E00F00102 /* KMNCustomCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A65ED42CDF1C1E00F00102 /* KMNCustomCollectionViewLayout.swift */; };
 		F3A65ED62CDF1C1E00F00102 /* KMNCustomCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A65ED42CDF1C1E00F00102 /* KMNCustomCollectionViewLayout.swift */; };
 		F3A65ED72CDF1C1E00F00102 /* KMNCustomCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A65ED42CDF1C1E00F00102 /* KMNCustomCollectionViewLayout.swift */; };
+		F3A7D39E2D1A50310001F243 /* KMPDFMenuConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A7D39D2D1A50300001F243 /* KMPDFMenuConfig.swift */; };
+		F3A7D39F2D1A50310001F243 /* KMPDFMenuConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A7D39D2D1A50300001F243 /* KMPDFMenuConfig.swift */; };
+		F3A7D3A02D1A50310001F243 /* KMPDFMenuConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3A7D39D2D1A50300001F243 /* KMPDFMenuConfig.swift */; };
 		F3A9DC81294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F3A9DC7D294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib */; };
 		F3A9DC82294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F3A9DC7D294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib */; };
 		F3A9DC83294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F3A9DC7D294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib */; };
@@ -4830,7 +4830,6 @@
 		9FBDA7282A4D32A500A972F3 /* KMWebsocket.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMWebsocket.swift; sourceTree = "<group>"; };
 		9FBDA72C2A4D532700A972F3 /* KMWebsocketManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMWebsocketManager.swift; sourceTree = "<group>"; };
 		9FC444F82AA5F7D600D7187C /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ZipArchive.framework; sourceTree = "<group>"; };
-		9FCFEC672AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPDFListViewColorMenuItemView.swift; sourceTree = "<group>"; };
 		9FCFEC6B2AC3D96800EAD2CB /* CPDFListViewAnimatedBorderlessWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPDFListViewAnimatedBorderlessWindow.swift; sourceTree = "<group>"; };
 		9FCFEC6F2AC40F9B00EAD2CB /* CStampSignatureObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CStampSignatureObject.swift; sourceTree = "<group>"; };
 		9FCFEC732AC56ECE00EAD2CB /* CPDFListStampAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPDFListStampAnnotation.swift; sourceTree = "<group>"; };
@@ -6231,6 +6230,7 @@
 		F3A465712D0290950032F5DB /* KMNPopDetailsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMNPopDetailsViewController.xib; sourceTree = "<group>"; };
 		F3A65ECC2CDF19C300F00102 /* KMNThumDecorationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMNThumDecorationView.swift; sourceTree = "<group>"; };
 		F3A65ED42CDF1C1E00F00102 /* KMNCustomCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMNCustomCollectionViewLayout.swift; sourceTree = "<group>"; };
+		F3A7D39D2D1A50300001F243 /* KMPDFMenuConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMPDFMenuConfig.swift; sourceTree = "<group>"; };
 		F3A9DC7D294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CPDFListEditAnnotationViewController.xib; sourceTree = "<group>"; };
 		F3B2DFC72CF4B2FB0078F439 /* DigtalSignatureImage.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DigtalSignatureImage.xcassets; sourceTree = "<group>"; };
 		F3B7DF992948565000333201 /* CPDFListHoverAnnotationViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CPDFListHoverAnnotationViewController.xib; sourceTree = "<group>"; };
@@ -10310,6 +10310,7 @@
 		BB52F54C2CC1FA69007418DB /* KMPDFViewController */ = {
 			isa = PBXGroup;
 			children = (
+				F3A7D39D2D1A50300001F243 /* KMPDFMenuConfig.swift */,
 				BB8AA53E2CC66E490084F183 /* PDFImages.xcassets */,
 				BB8AA5422CC6711B0084F183 /* KMPDFConfig.swift */,
 				BBBE68132CC7C02800358B31 /* KMPDFViewManager.swift */,
@@ -11685,18 +11686,10 @@
 			isa = PBXGroup;
 			children = (
 				BBF19E972B0B31F7007154C8 /* View */,
-				BBF19E962B0B31DF007154C8 /* Controller */,
 			);
 			path = CreateStamp;
 			sourceTree = "<group>";
 		};
-		BBF19E962B0B31DF007154C8 /* Controller */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			path = Controller;
-			sourceTree = "<group>";
-		};
 		BBF19E972B0B31F7007154C8 /* View */ = {
 			isa = PBXGroup;
 			children = (
@@ -12083,7 +12076,6 @@
 				F3A9DC7D294309D80074E5D2 /* CPDFListEditAnnotationViewController.xib */,
 				9F53D5462AD664C300CCF9D8 /* CPDFListHoverAnnotationViewController.swift */,
 				F3B7DF992948565000333201 /* CPDFListHoverAnnotationViewController.xib */,
-				9FCFEC672AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift */,
 			);
 			path = AppKitCategories;
 			sourceTree = "<group>";
@@ -14724,6 +14716,7 @@
 				9F1FE4CC29406E4700E952CA /* CTTabContentsController.m in Sources */,
 				BBD8EE932B8EC86A00EB05FE /* AutoSaveFileItem.m in Sources */,
 				AD3AAD232B0B6F9E00DE5FE7 /* KMCompareContentView.swift in Sources */,
+				F3A7D39E2D1A50310001F243 /* KMPDFMenuConfig.swift in Sources */,
 				651675CA2CE3312000019A20 /* KMTocTableCellView.swift in Sources */,
 				BB74DA7F2AC42959006EDFE7 /* NSButton+KMExtension.swift in Sources */,
 				BB6D2DAB2B674D7900624C24 /* CPDFPage+KMExtension.swift in Sources */,
@@ -14780,7 +14773,6 @@
 				ADBC2D37299F0A5A006280C8 /* KMPrintHelpViewController.swift in Sources */,
 				BBB9428B2BA2CB6A00542373 /* KMAdsInfo.swift in Sources */,
 				BB6B4C0C292F62B20071CA06 /* KMPDFThumbnialPageView.swift in Sources */,
-				9FCFEC682AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift in Sources */,
 				BB2EDF46296E4618003BCF58 /* KMPageEditTools.swift in Sources */,
 				AD3AAD132B0B5B2700DE5FE7 /* KMCompareContentWindowController.swift in Sources */,
 				BB2F9AAB2AFCADA900F9DD93 /* KMProfileCellView.swift in Sources */,
@@ -15284,7 +15276,6 @@
 				65AD988A2CB615F000927779 /* KMNoteFilterStateViewModel.swift in Sources */,
 				9FDD0F65294AB645000C4DAD /* KMMainViewController.swift in Sources */,
 				BB451A9B2CF59F4C003E1565 /* KMPenController.swift in Sources */,
-				9FCFEC692AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift in Sources */,
 				ADAFDA262AE8DE1B00F084BC /* KMAdvertisementModel.swift in Sources */,
 				AD055E2E2B70B3D50035F824 /* KMBookmarkSheetController.swift in Sources */,
 				AD1FE8332BD7C98300AA4A9B /* NSMutableArray+KMOddEvenPartFetch.m in Sources */,
@@ -15690,6 +15681,7 @@
 				BB31981F2AC57ACA00107371 /* CPDFPage+PDFListView.swift in Sources */,
 				BBFEF71C2B3A784200C28AC0 /* KMSystemEditMenu.swift in Sources */,
 				6515590F2CCA6E2400C0F0D9 /* KMConvertBaseWindowController.swift in Sources */,
+				F3A7D39F2D1A50310001F243 /* KMPDFMenuConfig.swift in Sources */,
 				AD3AAD5D2B0DA3D400DE5FE7 /* KMCompareTextViewItem.swift in Sources */,
 				AD3AAD242B0B6F9E00DE5FE7 /* KMCompareContentView.swift in Sources */,
 				AD8E48C52D1BB0600055D3E6 /* KMOCRSettingWindowController.swift in Sources */,
@@ -16371,7 +16363,6 @@
 				AD07BCB72D02CBB20075054B /* KMCompressSettingCellModel.swift in Sources */,
 				BB74DA7D2AC41DE9006EDFE7 /* NSString+KMExtension.swift in Sources */,
 				BB0FE0482B734DD1001E0F88 /* AIInfoConfig.swift in Sources */,
-				9FCFEC6A2AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift in Sources */,
 				BBE788B92CBD2463008086E2 /* PaginationVC.swift in Sources */,
 				AD9527CC295297B70039D2BC /* KMPrintModel.swift in Sources */,
 				9F1FE4B929406E4700E952CA /* CTBrowserFrameView.m in Sources */,
@@ -16711,6 +16702,7 @@
 				BBF729C12B19783600576AC5 /* KMBatchRemoveHeaderFooterOperation.swift in Sources */,
 				BBC5ABE12D01C950008BA0CB /* KMSignatureController.swift in Sources */,
 				BB88E45A29404752002B3655 /* KMPDFConvert.swift in Sources */,
+				F3A7D3A02D1A50310001F243 /* KMPDFMenuConfig.swift in Sources */,
 				F321C2122CDA0C5F009982C8 /* BaseXibView.swift in Sources */,
 				AD1FE8462BD7C98300AA4A9B /* KMPDFPosterPrintWindowController.m in Sources */,
 				ADAFDA362AE8EE9300F084BC /* KMAdvertisementImage.swift in Sources */,

+ 35 - 85
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -1229,54 +1229,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "358E2342-CA57-4FD1-A9F9-045A3C3466EB"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/PDFTools/TTS/WindowController/KMTTSWindowController.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "382"
-            endingLineNumber = "382"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-            <Locations>
-               <Location
-                  uuid = "358E2342-CA57-4FD1-A9F9-045A3C3466EB - de66a966439ce16f"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMTTSWindowController.buttonItemClick_Language(__C.NSButton) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFTools/TTS/WindowController/KMTTSWindowController.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "382"
-                  endingLineNumber = "382"
-                  offsetFromSymbolStart = "2376">
-               </Location>
-               <Location
-                  uuid = "358E2342-CA57-4FD1-A9F9-045A3C3466EB - 285cd2444207b0ae"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMTTSWindowController.mouseDown(with: __C.NSEvent) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFTools/TTS/WindowController/KMTTSWindowController.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "382"
-                  endingLineNumber = "382"
-                  offsetFromSymbolStart = "52">
-               </Location>
-            </Locations>
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -3170,8 +3122,8 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "4691"
             endingLineNumber = "4691"
-            landmarkName = "unknown"
-            landmarkType = "0">
+            landmarkName = "pdfListViewMenu(forEvent:for:click:isMoveSelectAnno:)"
+            landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
@@ -4614,7 +4566,7 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "229"
             endingLineNumber = "229"
-            landmarkName = "updateDefaultInfo(_:_:)"
+            landmarkName = "componentCColorDidChooseColor(_:_:)"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
@@ -4730,38 +4682,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "2D1DB66A-F786-45C1-918B-75FBEEC99E15"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KMComponentLibrary/KMComponentLibrary/View/InputNumber/ComponentInputNumber.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "327"
-            endingLineNumber = "327"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "93A05C0E-0BD7-4EDF-B10F-2534B2045998"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KMComponentLibrary/KMComponentLibrary/View/InputNumber/ComponentStepper/ComponentStepper.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "144"
-            endingLineNumber = "144"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -5184,6 +5104,21 @@
                   endingLineNumber = "6000"
                   offsetFromSymbolStart = "176">
                </Location>
+               <Location
+                  uuid = "55D287D3-1501-491A-A540-B8728475A83C - 1e597b363dc901dd"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "-[CPDFListView(Event) zoomToPhysicalSize:]"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFListViewExtension/CPDFListView+Event.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "6000"
+                  endingLineNumber = "6000"
+                  offsetFromSymbolStart = "92">
+               </Location>
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
@@ -5358,8 +5293,8 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "4465"
             endingLineNumber = "4465"
-            landmarkName = "KMMainViewController"
-            landmarkType = "21">
+            landmarkName = "pdfListViewKeyDownIsContinue(_:theEvent:)"
+            landmarkType = "7">
             <Locations>
                <Location
                   uuid = "7EA5A061-399F-4EE9-B9C0-16DCE1F7448F - b776b492e6be500d"
@@ -5406,6 +5341,21 @@
                   endingLineNumber = "4465"
                   offsetFromSymbolStart = "3384">
                </Location>
+               <Location
+                  uuid = "7EA5A061-399F-4EE9-B9C0-16DCE1F7448F - 680781a5883869ab"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.pdfListViewKeyDownIsContinue(_: Swift.Optional&lt;__C.CPDFListView&gt;, theEvent: Swift.Optional&lt;__C.NSEvent&gt;) -&gt; Swift.Bool"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMPDFViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "4465"
+                  endingLineNumber = "4465"
+                  offsetFromSymbolStart = "13892">
+               </Location>
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>