Browse Source

【2025】【Edit-Link】Link逻辑串接

niehaoyu 4 months ago
parent
commit
8920bf747c
18 changed files with 523 additions and 275 deletions
  1. 87 83
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Button/ComponentButton.swift
  2. 1 2
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Button/ComponentButton.xib
  3. 83 67
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentTextarea/ComponentTextarea.swift
  4. 1 0
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Pagination/ComponentPagination.swift
  5. 2 12
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/ToolTips/ComponentToolTip.swift
  6. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationLinkViewController.xib
  7. 6 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m
  8. 6 6
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.xib
  9. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.xib
  10. 1 9
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  11. 96 25
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/KMLinkViewController.swift
  12. 0 25
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/KMLinkViewController.xib
  13. 37 3
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/KMLinkEmailView/KMLinkEmailView.swift
  14. 78 6
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/KMLinkPageView/KMLinkPageView.swift
  15. 35 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/KMLinkWebView/KMLinkWebView.swift
  16. 25 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/PopupViews/KMLinkPopupBaseView.swift
  17. 59 9
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/PopupViews/KMLinkPopupBaseView.xib
  18. 0 16
      PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+ 87 - 83
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Button/ComponentButton.swift

@@ -59,7 +59,7 @@ public class ComponentButton: ComponentBaseXibView {
             
             ComponentLibrary.shared.configButtonComponent(properties: _properties)
             
-            self.reloadData()
+            reloadData()
         }
     }
      
@@ -67,23 +67,27 @@ public class ComponentButton: ComponentBaseXibView {
     //MARK: - setupUI
     
     func setupUI() {
-        self.leftIcon.isHidden = true
-        self.label.isHidden = true
-        self.rightIcon.isHidden = true
+       leftIcon.isHidden = true
+       label.isHidden = true
+       rightIcon.isHidden = true
         
-        if self.properties.onlyIcon == true {
-            self.leftIcon.isHidden = false
+        if properties.onlyIcon == true {
+            leftIcon.isHidden = false
         } else {
-            self.label.isHidden = false
-            if self.properties.showLeftIcon == true && self.properties.showRightIcon == true {
-                self.leftIcon.isHidden = false
-                self.rightIcon.isHidden = false
+           label.isHidden = false
+            if properties.showLeftIcon == true &&
+                properties.showRightIcon == true {
                 
-            } else if self.properties.showLeftIcon == true && self.properties.showRightIcon == false {
-                self.leftIcon.isHidden = false
+                 leftIcon.isHidden = false
+                 rightIcon.isHidden = false
                 
-            } else if self.properties.showLeftIcon == false && self.properties.showRightIcon == true {
-                self.rightIcon.isHidden = false
+            } else if properties.showLeftIcon == true &&
+                        properties.showRightIcon == false {
+              leftIcon.isHidden = false
+                
+            } else if properties.showLeftIcon == false && 
+                        properties.showRightIcon == true {
+                rightIcon.isHidden = false
                 
             } else {
                 
@@ -92,44 +96,44 @@ public class ComponentButton: ComponentBaseXibView {
     }
     
     func refreshUI() {
-        var fillColor = self.properties.propertyInfo.color_nor
-        var borderWidth = self.properties.propertyInfo.borderWidth
-        var borderColor = self.properties.propertyInfo.borderColor_nor
+        var fillColor =  properties.propertyInfo.color_nor
+        var borderWidth = properties.propertyInfo.borderWidth
+        var borderColor = properties.propertyInfo.borderColor_nor
         
-        var textColor = self.properties.propertyInfo.textColor
+        var textColor = properties.propertyInfo.textColor
         
-        var leftImage = self.properties.propertyInfo.leftIcon_nor
-        var rightImage = self.properties.propertyInfo.rightIcon_nor
+        var leftImage = properties.propertyInfo.leftIcon_nor
+        var rightImage = properties.propertyInfo.rightIcon_nor
 
-        if self.properties.state == .normal {
+        if properties.state == .normal {
             
-        } else if self.properties.state == .hover {
-            fillColor = self.properties.propertyInfo.color_hov
-            borderWidth = self.properties.propertyInfo.borderWidth
-            borderColor = self.properties.propertyInfo.borderColor_hov
-            textColor = self.properties.propertyInfo.textColor_hov
-            leftImage = self.properties.propertyInfo.leftIcon_hov ?? self.properties.propertyInfo.leftIcon_nor
-            rightImage = self.properties.propertyInfo.rightIcon_hov ?? self.properties.propertyInfo.rightIcon_nor
-        } else if self.properties.state == .pressed {
-            fillColor = self.properties.propertyInfo.color_active
-            borderWidth = self.properties.propertyInfo.borderWidth
-            borderColor = self.properties.propertyInfo.borderColor_active
-            textColor = self.properties.propertyInfo.textColor_Active
-            leftImage = self.properties.propertyInfo.leftIcon_press ?? self.properties.propertyInfo.leftIcon_nor
-            rightImage = self.properties.propertyInfo.rightIcon_press ?? self.properties.propertyInfo.rightIcon_nor
+        } else if properties.state == .hover {
+            fillColor = properties.propertyInfo.color_hov
+            borderWidth = properties.propertyInfo.borderWidth
+            borderColor = properties.propertyInfo.borderColor_hov
+            textColor = properties.propertyInfo.textColor_hov
+            leftImage = properties.propertyInfo.leftIcon_hov ?? properties.propertyInfo.leftIcon_nor
+            rightImage = properties.propertyInfo.rightIcon_hov ?? properties.propertyInfo.rightIcon_nor
+        } else if properties.state == .pressed {
+            fillColor = properties.propertyInfo.color_active
+            borderWidth = properties.propertyInfo.borderWidth
+            borderColor = properties.propertyInfo.borderColor_active
+            textColor = properties.propertyInfo.textColor_Active
+            leftImage = properties.propertyInfo.leftIcon_press ?? properties.propertyInfo.leftIcon_nor
+            rightImage = properties.propertyInfo.rightIcon_press ?? properties.propertyInfo.rightIcon_nor
         }
-        if self.properties.isDisabled == true {
-            fillColor = self.properties.propertyInfo.color_dis
-            borderWidth = self.properties.propertyInfo.borderWidth
-            borderColor = self.properties.propertyInfo.borderColor_dis
-            textColor = self.properties.propertyInfo.textColor_dis
-            leftImage = self.properties.propertyInfo.leftIcon_dis ?? self.properties.propertyInfo.leftIcon_nor
-            rightImage = self.properties.propertyInfo.rightIcon_dis ?? self.properties.propertyInfo.rightIcon_nor
+        if properties.isDisabled == true {
+            fillColor = properties.propertyInfo.color_dis
+            borderWidth = properties.propertyInfo.borderWidth
+            borderColor = properties.propertyInfo.borderColor_dis
+            textColor = properties.propertyInfo.textColor_dis
+            leftImage = properties.propertyInfo.leftIcon_dis ?? properties.propertyInfo.leftIcon_nor
+            rightImage = properties.propertyInfo.rightIcon_dis ?? properties.propertyInfo.rightIcon_nor
         }
          
         contendBox.fillColor = fillColor
         contendBox.borderColor = borderColor
-        contendBox.cornerRadius = self.properties.propertyInfo.cornerRadius
+        contendBox.cornerRadius = properties.propertyInfo.cornerRadius
         contendBox.borderWidth = borderWidth
          
         label.textColor = textColor
@@ -137,14 +141,14 @@ public class ComponentButton: ComponentBaseXibView {
         label.font = properties.propertyInfo.textFont
          
         if let image = leftImage {
-            self.leftIcon.image = image
+            leftIcon.image = image
         }
         
         if let image = rightImage {
-            self.rightIcon.image = image
+            rightIcon.image = image
         }
         
-        self.label.stringValue = self.properties.buttonText ?? ""
+        label.stringValue = properties.buttonText ?? ""
         
 //        let paragraphStyle = NSMutableParagraphStyle()
 //        paragraphStyle.maximumLineHeight = 24
@@ -163,44 +167,44 @@ public class ComponentButton: ComponentBaseXibView {
 //                                                  ])
 //        label.attributedStringValue = attributedString
         
-        self.leftImgWidthConst.constant = self.properties.propertyInfo.imageWidth
-        self.rightImgWidthConst.constant = self.leftImgWidthConst.constant
+        leftImgWidthConst.constant = properties.propertyInfo.imageWidth
+        rightImgWidthConst.constant = leftImgWidthConst.constant
         
-        if self.properties.onlyIcon == true {
-            self.properties.propertyInfo.viewWidth = self.properties.propertyInfo.viewHeight
-            let viewWidth = self.properties.propertyInfo.viewWidth
-            self.leftImgLeftConst.constant = (viewWidth - self.leftImgWidthConst.constant)/2
+        if properties.onlyIcon == true {
+            properties.propertyInfo.viewWidth = properties.propertyInfo.viewHeight
+            let viewWidth = properties.propertyInfo.viewWidth
+            leftImgLeftConst.constant = (viewWidth - leftImgWidthConst.constant)/2
             
         } else {
-            let viewWidth = self.frame.size.width
-            let imageWidth = self.properties.propertyInfo.imageWidth
-            let layoutGap = self.properties.propertyInfo.layout_gap
-            
-            self.label.sizeToFit()
-            var labelRect = self.label.frame
-            labelRect.origin.y = (CGRectGetHeight(self.frame) - labelRect.size.height)/2
+            let viewWidth = frame.size.width
+            let imageWidth = properties.propertyInfo.imageWidth
+            let layoutGap = properties.propertyInfo.layout_gap
+                
+            label.sizeToFit()
+            var labelRect = label.frame
+            labelRect.origin.y = (CGRectGetHeight(frame) - labelRect.size.height)/2
             
-            if self.properties.showLeftIcon == true && self.properties.showRightIcon == true {
-                self.leftIcon.isHidden = false
-                self.rightIcon.isHidden = false
+            if properties.showLeftIcon == true && properties.showRightIcon == true {
+                leftIcon.isHidden = false
+                rightIcon.isHidden = false
                 
                 labelRect.origin.x = (viewWidth - labelRect.size.width - imageWidth*2 - layoutGap*2)/2.0 + imageWidth + layoutGap
-            } else if self.properties.showLeftIcon == true && self.properties.showRightIcon == false {
-                self.leftIcon.isHidden = false
+            } else if properties.showLeftIcon == true && properties.showRightIcon == false {
+                leftIcon.isHidden = false
                 
                 labelRect.origin.x = (viewWidth - labelRect.size.width - imageWidth - layoutGap)/2.0 + imageWidth + layoutGap
-            } else if self.properties.showLeftIcon == false && self.properties.showRightIcon == true {
-                self.rightIcon.isHidden = false
+            } else if properties.showLeftIcon == false && properties.showRightIcon == true {
+                rightIcon.isHidden = false
                 
                 labelRect.origin.x = (viewWidth - labelRect.size.width - imageWidth - layoutGap)/2.0
             } else {
                 labelRect.origin.x = (viewWidth - labelRect.size.width)/2.0
             }
-            self.label.frame = labelRect
-            self.leftImgLeftConst.constant = CGRectGetMinX(labelRect) - self.leftImgWidthConst.constant - layoutGap
-            self.rightImgRightConst.constant = self.frame.size.width - CGRectGetMaxX(labelRect) - self.leftImgWidthConst.constant - layoutGap
+            label.frame = labelRect
+            leftImgLeftConst.constant = CGRectGetMinX(labelRect) - leftImgWidthConst.constant - layoutGap
+            rightImgRightConst.constant = frame.size.width - CGRectGetMaxX(labelRect) - leftImgWidthConst.constant - layoutGap
         }
-        self.leftIcon.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
+        leftIcon.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
         
     }
     
@@ -241,10 +245,10 @@ public class ComponentButton: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
         
-        if self.properties.isDisabled == false && properties.state != .pressed {
-            self.properties.state = .hover
+        if properties.isDisabled == false && properties.state != .pressed {
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -256,38 +260,38 @@ public class ComponentButton: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false && properties.state != .pressed {
-            self.properties.state = .normal
+        if properties.isDisabled == false && properties.state != .pressed {
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         
         mouseDownEnable = false
-        if self.properties.isDisabled == false && properties.state != .pressed {
-            self.properties.state = .pressed
+        if properties.isDisabled == false && properties.state != .pressed {
+            properties.state = .pressed
             
             mouseDownEnable = true
         }
         
-        self.refreshUI()
+        refreshUI()
         
     }
     
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
-        if self.properties.isDisabled == false &&
+        if properties.isDisabled == false &&
             properties.keepActiveState == false &&
             mouseDownEnable == true {
-            self.properties.state = .normal
+            properties.state = .normal
         }
-        self.refreshUI()
+        refreshUI()
         
-        if self.properties.isDisabled == false &&
+        if properties.isDisabled == false &&
             mouseDownEnable == true {
             if let target = target, let action = action {
                 _ = target.perform(action, with: self)

+ 1 - 2
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Button/ComponentButton.xib

@@ -36,7 +36,7 @@
                                     <constraint firstAttribute="width" constant="20" id="Jru-ch-BtO"/>
                                     <constraint firstAttribute="width" secondItem="eod-1a-vcr" secondAttribute="height" multiplier="1:1" id="gXp-0k-kkn"/>
                                 </constraints>
-                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSBonjour" id="dzc-OM-GnR"/>
+                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" id="dzc-OM-GnR"/>
                             </imageView>
                             <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="JuI-wo-ih4">
                                 <rect key="frame" x="159" y="17" width="20" height="20"/>
@@ -81,6 +81,5 @@
     </objects>
     <resources>
         <image name="Dropdown_arrowDown" width="20" height="20"/>
-        <image name="NSBonjour" width="32" height="32"/>
     </resources>
 </document>

+ 83 - 67
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentTextarea/ComponentTextarea.swift

@@ -8,6 +8,17 @@
 import Cocoa
 import AppKit
 
+@objc public protocol ComponentTextareaDelegate: AnyObject {
+    
+    @objc optional func componentTextareaTextDidBeginEditing(_ view: ComponentTextarea)
+    
+    @objc optional func componentTextareaTextDidChange(_ view: ComponentTextarea)
+    
+    @objc optional func componentTextareaTextDidEndEditing(_ view: ComponentTextarea)
+  
+        
+}
+
 public class ComponentTextarea: ComponentBaseXibView {
     
     @IBOutlet var contendBox: NSBox!
@@ -20,6 +31,8 @@ public class ComponentTextarea: ComponentBaseXibView {
     
     private var _properties: ComponentTextareaProperty = ComponentTextareaProperty()
      
+    weak open var delegate: ComponentTextareaDelegate?
+    
     // MARK: 初始化
     
     public required init?(coder decoder: NSCoder) {
@@ -33,10 +46,10 @@ public class ComponentTextarea: ComponentBaseXibView {
     
     public override func awakeFromNib() {
         super.awakeFromNib()
-  
-        self.textView.drawsBackground = false
-        self.textView.delegate = self
-        self.textView.componentDelegate = self
+        
+        textView.drawsBackground = false
+        textView.delegate = self
+        textView.componentDelegate = self
         
     }
     
@@ -52,22 +65,22 @@ public class ComponentTextarea: ComponentBaseXibView {
             
             ComponentLibrary.shared.configInputTextareaComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
     
     func setupUI() {
         
-        self.textView.string = self.properties.text
+        textView.string = properties.text
         
-        self.placeholderLabel.stringValue = ""
-        self.placeholderLabel.placeholderString = properties.placeholderString
-        self.placeholderLabel.isHidden = properties.text.isEmpty == false
+        placeholderLabel.stringValue = ""
+        placeholderLabel.placeholderString = properties.placeholderString
+        placeholderLabel.isHidden = properties.text.isEmpty == false
         
-        self.textViewStringDidChanged()
+        textViewStringDidChanged()
         
         if properties.totalCount < 0 {
             textCountLabel.isHidden = true
@@ -81,64 +94,64 @@ public class ComponentTextarea: ComponentBaseXibView {
     
     public func refreshUI() {
         
-        self.contendBox.cornerRadius = self.properties.propertyInfo.cornerRadius
-        self.contendBox.borderWidth = self.properties.propertyInfo.borderWidth
+        contendBox.cornerRadius = properties.propertyInfo.cornerRadius
+        contendBox.borderWidth = properties.propertyInfo.borderWidth
         
         var fillColor = NSColor.clear
         var borderColor = NSColor.clear
-        if self.properties.state == .normal {
-            fillColor = self.properties.propertyInfo.color_nor
-            borderColor = self.properties.propertyInfo.borderColor_nor
+        if properties.state == .normal {
+            fillColor = properties.propertyInfo.color_nor
+            borderColor = properties.propertyInfo.borderColor_nor
             
-        } else if self.properties.state == .hover {
-            fillColor = self.properties.propertyInfo.color_hov
-            borderColor = self.properties.propertyInfo.borderColor_hov
+        } else if properties.state == .hover {
+            fillColor = properties.propertyInfo.color_hov
+            borderColor = properties.propertyInfo.borderColor_hov
             
-        } else if self.properties.state == .pressed {
-            fillColor = self.properties.propertyInfo.color_active
-            borderColor = self.properties.propertyInfo.borderColor_active
+        } else if properties.state == .pressed {
+            fillColor = properties.propertyInfo.color_active
+            borderColor = properties.propertyInfo.borderColor_active
             
         } 
-        if self.properties.isDisabled == true {
-            fillColor = self.properties.propertyInfo.color_dis
-            borderColor = self.properties.propertyInfo.borderColor_dis
+        if properties.isDisabled == true {
+            fillColor = properties.propertyInfo.color_dis
+            borderColor = properties.propertyInfo.borderColor_dis
         }
         
-        self.textCountLabel.textColor = self.properties.propertyInfo.textCountColor
-        self.textCountLabel.font = self.properties.propertyInfo.textCountFont ?? NSFont.systemFont(ofSize: 12)
-        if self.properties.isError == true {
-            borderColor = self.properties.propertyInfo.borderColor_error
-            self.textCountLabel.textColor = self.properties.propertyInfo.textCountColor_error
+        textCountLabel.textColor = properties.propertyInfo.textCountColor
+        textCountLabel.font = properties.propertyInfo.textCountFont ?? NSFont.systemFont(ofSize: 12)
+        if properties.isError == true {
+            borderColor = properties.propertyInfo.borderColor_error
+            textCountLabel.textColor = properties.propertyInfo.textCountColor_error
         }
         
-        self.contendBox.fillColor = fillColor
-        self.contendBox.borderColor = borderColor
+        contendBox.fillColor = fillColor
+        contendBox.borderColor = borderColor
     
-        if self.properties.isDisabled == true {
-            self.textView.isEditable = false
+        if properties.isDisabled == true {
+            textView.isEditable = false
         } else {
-            self.textView.isEditable = true
+            textView.isEditable = true
         }
         
-        self.textView.font = properties.propertyInfo.textFont
-        self.textView.textColor = properties.isDisabled ? properties.propertyInfo.textColor_dis : properties.propertyInfo.textColor
+        textView.font = properties.propertyInfo.textFont
+        textView.textColor = properties.isDisabled ? properties.propertyInfo.textColor_dis : properties.propertyInfo.textColor
         
-        self.placeholderLabel.font = properties.propertyInfo.textCountFont
+        placeholderLabel.font = properties.propertyInfo.textCountFont
         
     }
     
     func textViewStringDidChanged() {
-        self.placeholderLabel.isHidden = properties.text.isEmpty == false
+        placeholderLabel.isHidden = properties.text.isEmpty == false
         
         if properties.totalCount >= 0 {
-            if self.textView.string.count <= self.properties.totalCount {
-                self.properties.isError = false
+            if textView.string.count <= properties.totalCount {
+                properties.isError = false
             } else {
-                self.properties.isError = true
+                properties.isError = true
             }
         }
-        self.refreshUI()
-        self.textCountLabel.stringValue = String(format: "%d/%d", self.textView.string.count, self.properties.totalCount)
+        refreshUI()
+        textCountLabel.stringValue = String(format: "%d/%d", textView.string.count, properties.totalCount)
     }
     
     
@@ -146,11 +159,11 @@ public class ComponentTextarea: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties.isDisabled == false &&
-            self.textView.isResponder == false {
-            self.properties.state = .hover
+        if properties.isDisabled == false &&
+            textView.isResponder == false {
+            properties.state = .hover
         }
-        self.refreshUI()
+      refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -162,12 +175,12 @@ public class ComponentTextarea: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false &&
-            self.textView.isResponder == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false &&
+            textView.isResponder == false {
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -178,11 +191,11 @@ public class ComponentTextarea: ComponentBaseXibView {
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
-        if self.properties.isDisabled == false &&
-            self.textView.isResponder == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false &&
+            textView.isResponder == false {
+            properties.state = .normal
         }
-        self.refreshUI()
+        refreshUI()
         
     }
 }
@@ -192,41 +205,44 @@ extension ComponentTextarea: NSTextViewDelegate {
     public func textDidBeginEditing(_ notification: Notification) {
         textView.isResponder = true
         
-        self.properties.text = self.textView.string
+        properties.text = textView.string
         
-        self.textViewStringDidChanged()
+        textViewStringDidChanged()
         
+        delegate?.componentTextareaTextDidBeginEditing?(self)
     }
     
     public func textDidChange(_ notification: Notification) {
         textView.isResponder = true
         
-        self.properties.text = self.textView.string
+        properties.text =  textView.string
         
-        self.textViewStringDidChanged()
+        textViewStringDidChanged()
         
+        delegate?.componentTextareaTextDidChange?(self)
     }
     
     public func textDidEndEditing(_ notification: Notification) {
         
         textView.isResponder = false
         
-        self.properties.text = self.textView.string
+        properties.text = textView.string
         
-        self.textViewStringDidChanged()
+        textViewStringDidChanged()
         
+        delegate?.componentTextareaTextDidEndEditing?(self)
     }
 }
 
 extension ComponentTextarea: ComponentTextViewDelegate {
     func componentTextViewDidResponderChanged(textField: ComponentTextView) {
-        if self.properties.isDisabled == false {
-            if self.textView.isResponder {
-                self.properties.state = .pressed
+        if  properties.isDisabled == false {
+            if textView.isResponder {
+                properties.state = .pressed
             } else {
-                self.properties.state = .normal
+                properties.state = .normal
             }
-            self.refreshUI()
+            refreshUI()
         }
     }
 }

+ 1 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Pagination/ComponentPagination.swift

@@ -174,6 +174,7 @@ public class ComponentPagination: ComponentBaseXibView {
     public func reloadData() {
         self.setupUI()
         
+        self.refreshUI()
     }
     
     

+ 2 - 12
PDF Office/KMComponentLibrary/KMComponentLibrary/View/ToolTips/ComponentToolTip.swift

@@ -238,11 +238,11 @@ public class ComponentToolTip: ComponentBaseXibView {
         
     }
     
-    public func showWithPoint(_ point: CGPoint, inView view: NSView?, withBackView: Bool = true) {
+    public func showWithPoint(_ point: CGPoint, inView view: NSView?) {
         
         
         let screenRect = NSScreen.main!.frame
-        var contentWindow: NSWindow = NSWindow(contentRect: screenRect,
+        let contentWindow: NSWindow = NSWindow(contentRect: screenRect,
                                                styleMask: [.borderless],
                                                backing: .buffered, defer: false)
         contentWindow.level = .statusBar
@@ -252,22 +252,12 @@ public class ComponentToolTip: ComponentBaseXibView {
         if let subView = view {
             var rect = self.frame
             rect.origin.x = point.x
-            if CGRectGetMaxX(rect) > CGRectGetWidth(subView.frame) - 10 {
-                rect.origin.x = CGRectGetWidth(subView.frame) - rect.size.width - 10
-            }
             rect.origin.y = point.y
-            if rect.origin.y < 0 {
-                rect.origin.y = 10
-                rect.size.height = subView.frame.origin.y - 10
-            }
             rect.origin.x += subView.window?.frame.origin.x ?? 0
             rect.origin.y += subView.window?.frame.origin.y ?? 0
             
             self.frame = rect
             
-            if withBackView {
-                
-            }
             contentWindow.contentView?.addSubview(self)
          }
         

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationLinkViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" 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="22154"/>
+        <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="KMAnnotationLinkViewController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationLinkViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="linkActionLabel" destination="mve-Fx-rd0" id="iaP-Jy-EZ3"/>
                 <outlet property="view" destination="HRO-5H-M6b" id="R2G-8e-9Z6"/>

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

@@ -319,14 +319,16 @@
         } else {
             contents = [NSString stringWithFormat:@"0%@", @([[linkAnnotation destination] pageIndex]+1)];
         }
-        
-        KMAnnotationSelectLinkViewController *vc = [[KMAnnotationSelectLinkViewController alloc] init];
+         
+        KMLinkViewController *vc = [[KMLinkViewController alloc] init];
+        vc.pdfView = self.pdfView;
         vc.annotations = self.annotations;
-        vc.pdfDocument = self.pdfView.document;
-        vc.pdfview = self.pdfView;
         vc.view.frame = [self viewControllerRect];
+        vc.view.autoresizingMask = NSViewWidthSizable|NSViewHeightSizable;
         [self.view addSubview:vc.view];
         self.contentViewController = vc;
+        [vc reloadData];
+        
     } else if ([annotation isKindOfClass:[CSelfSignAnnotation class]]) {
         CSelfSignAnnotation *newAnnotation = (CSelfSignAnnotation *)annotation;
         if (newAnnotation.annotationType == CAnnotationTypeSignFalse ||

+ 6 - 6
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" 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="22154"/>
+        <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="KMAnnotationSelectLinkViewController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationSelectLinkViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="allPageLabel" destination="DS4-Pe-jrX" id="7Da-9g-Ten"/>
                 <outlet property="contentBox" destination="W3X-RT-epC" id="70S-OH-CA9"/>
@@ -128,7 +128,7 @@
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="MoX-Dg-OAo">
                                 <rect key="frame" x="16" y="393" width="241" height="69"/>
                                 <subviews>
-                                    <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="iuu-mN-h5Y" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="iuu-mN-h5Y" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="0.0" width="64" height="69"/>
                                         <view key="contentView" id="eNo-TU-Gfr">
                                             <rect key="frame" x="0.0" y="0.0" width="64" height="69"/>
@@ -164,7 +164,7 @@
                                             <constraint firstAttribute="width" constant="64" id="7QR-LL-F0H"/>
                                         </constraints>
                                     </box>
-                                    <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="8T1-6p-sqt" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="8T1-6p-sqt" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="89" y="0.0" width="64" height="69"/>
                                         <view key="contentView" id="267-ww-qqI">
                                             <rect key="frame" x="0.0" y="0.0" width="64" height="69"/>
@@ -199,7 +199,7 @@
                                             <constraint firstAttribute="width" constant="64" id="ZPb-39-AE1"/>
                                         </constraints>
                                     </box>
-                                    <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Eqj-rm-lmf" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Eqj-rm-lmf" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="177" y="0.0" width="64" height="69"/>
                                         <view key="contentView" id="Ha0-A8-3Kn">
                                             <rect key="frame" x="0.0" y="0.0" width="64" height="69"/>

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" 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="22154"/>
+        <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="KMRightSideViewController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMRightSideViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="contextBox" destination="i3N-8M-mET" id="qnt-Ug-E5R"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>

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

@@ -91,9 +91,6 @@ import Cocoa
     //引导
     var guideInfoWindowController: KMGuideInfoWindowController?
     
-    var pdflinkController: KMLinkViewController!
-    
-    
     //春季活动
     var recommondPopWindowVC: KMRecommondPopWindow?
     
@@ -253,11 +250,6 @@ import Cocoa
     override func viewDidAppear() {
         super.viewDidAppear()
         
-        self.pdflinkController = KMLinkViewController.init()
-        self.pdflinkController?.view.frame = self.rightView.bounds
-        self.pdflinkController.view.autoresizingMask = [.height, .width]
-        self.rightView.addSubview(self.pdflinkController.view)
-         
         
         //春季活动
         if ((KMAdvertisementManager.manager.info.popWindowContent) != nil) {
@@ -518,7 +510,7 @@ import Cocoa
         //        self.rightSideViewController.view.isHidden = true
         self.rightSideViewController.isHidden = true
         self.rightSideViewController.delegate = self
-//        self.rightView.addSubview(self.rightSideViewController.view)
+        self.rightView.addSubview(self.rightSideViewController.view)
         self.rightSideViewController.propertyDidChange = { [weak self] model in
             if let anno = model as? CSelfSignAnnotation {
                 self?.leftSideViewController.refreshUIForAnnoAttributeDidChange(anno, attributes: nil)

+ 96 - 25
PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/KMLinkViewController.swift

@@ -22,7 +22,7 @@ import KMComponentLibrary
     case MultiSelect   //Popup弹窗
 }
 
-class KMLinkViewController: NSViewController {
+@objcMembers class KMLinkViewController: NSViewController {
 
     @IBOutlet var contendBox: NSBox!
     @IBOutlet var titleLabel: NSTextField!
@@ -34,23 +34,29 @@ class KMLinkViewController: NSViewController {
     @IBOutlet var linkEmailView: KMLinkEmailView!
     
     @IBOutlet var linkWebView: KMLinkWebView!
+     
+    private var _annotations: [CPDFLinkAnnotation]? = nil
+    
+    private weak var _pdfView: CPDFListView? = nil
     
-    @IBOutlet var testPopView: KMLinkPopupBaseView!
+    private var annotation: CPDFLinkAnnotation? = nil
     
     
     let pageProperty = ComponentTabsProperty(tabsType: .underline_Fill, state: .normal, showIcon: false, title: KMLocalizedString("Page"))
     let webProperty = ComponentTabsProperty(tabsType: .underline_Fill, state: .normal, showIcon: false, title: KMLocalizedString("Web"))
     let emailProperty = ComponentTabsProperty(tabsType: .underline_Fill, state: .normal, showIcon: false, title: KMLocalizedString("Email"))
      
-    override func viewDidLoad() {
+    public override func viewDidLoad() {
         super.viewDidLoad()
         // Do view setup here.
         
-        self.pdfLinkType = .Page
+        pdfLinkType = .Page
 
-        
-        self.setUpUI()
+        setUpUI()
                 
+        view.wantsLayer = true
+        view.layer?.backgroundColor = NSColor.red.cgColor
+        
     }
     
     func setUpUI() {
@@ -69,9 +75,14 @@ class KMLinkViewController: NSViewController {
             emailProperty.state = .pressed
         }
         
-        self.tabsView.updateItemProperty([pageProperty, webProperty, emailProperty])
-        self.tabsView.delegate = self
+        tabsView.updateItemProperty([pageProperty, webProperty, emailProperty])
+        tabsView.delegate = self
+        
+        linkPageView.delegate = self
         
+        linkWebView.delegate = self
+        
+        linkEmailView.delegate = self
     }
     
     
@@ -79,12 +90,37 @@ class KMLinkViewController: NSViewController {
     var pdfLinkType: PDFLinkType = .Page {
         didSet {
             
-            self.reloadData()
+            view.window?.makeFirstResponder(nil)
             
+            reloadData()
+        }
+    }
+    
+    weak var pdfView: CPDFListView? {
+        get {
+            return _pdfView
+        }
+        set {
+            _pdfView = newValue
         }
     }
     
+    var annotations: [CPDFLinkAnnotation]? {
+        get {
+            return _annotations
+        }
+        set {
+            _annotations = newValue
+            
+            if _annotations != nil && _annotations?.isEmpty == false {
+                annotation = _annotations?.first
+            } else {
+                annotation = nil
+            }
+        }
+    }
     
+    //MARK: - func
     func reloadData() {
         
         linkPageView.isHidden = true
@@ -93,6 +129,9 @@ class KMLinkViewController: NSViewController {
         
         if pdfLinkType == .Page {
             linkPageView.isHidden = false
+            linkPageView.pdfView = pdfView
+            linkPageView.annotation = annotation
+            linkPageView.reloadData()
             
         } else if pdfLinkType == .Web {
             linkWebView.isHidden = false
@@ -104,21 +143,8 @@ class KMLinkViewController: NSViewController {
         
     }
     
-    @IBAction func test(_ sender: Any) {
-        if testPopView.linkPopupType == .None {
-            testPopView.linkPopupType = .Page
-        } else if testPopView.linkPopupType == .Page {
-            testPopView.linkPopupType = .Web
-        } else if testPopView.linkPopupType == .Web {
-            testPopView.linkPopupType = .Email
-        } else if testPopView.linkPopupType == .Email {
-            testPopView.linkPopupType = .None
-        }
-    }
-    
-    
     //MARK: - MouseEvent
-    override func mouseUp(with event: NSEvent) {
+    public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
     }
@@ -128,7 +154,7 @@ class KMLinkViewController: NSViewController {
 
 //MARK: - ComponentTabsDelegate
 extension KMLinkViewController: ComponentTabsDelegate {
-    func componentTabsDidSelected(_ view: ComponentTabs, _ property: ComponentTabsProperty) {
+    public func componentTabsDidSelected(_ view: ComponentTabs, _ property: ComponentTabsProperty) {
         if property == pageProperty {
             pdfLinkType = .Page
         } else if property == webProperty {
@@ -136,7 +162,52 @@ extension KMLinkViewController: ComponentTabsDelegate {
         } else if property == emailProperty {
             pdfLinkType = .Email
         }
-        self.reloadData()
+        reloadData()
+        
+    }
+}
+
+//MARK: - KMLinkPageViewDelegate
+extension KMLinkViewController: KMLinkPageViewDelegate {
+    func kmLinkPageViewDidGoToPage(_ view: KMLinkPageView, _ pageIndex: Int) {
+        if let page = pdfView?.document.page(at: UInt(pageIndex-1)) {
+            pdfView?.go(toPageIndex: pageIndex-1, animated: false)
+        }
+    }
+    
+    func kmLinkPageViewDidChangeDestination(_ view: KMLinkPageView, _ pageIndex: Int) {
+        guard let activiteAnno = 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)
+            pdfView?.needsDisplay = true
+            
+        }
+        
+        if let page = pdfView?.document.page(at: UInt(pageIndex-1)) {
+            pdfView?.go(toPageIndex: pageIndex-1, animated: false)
+        }
+    }
+}
+
+//MARK: - KMLinkPageViewDelegate
+extension KMLinkViewController: KMLinkWebViewDelegate {
+    func kmLinkWebViewDidGo(_ view: KMLinkWebView, _ webString: String) {
+        
+    }
+    
+}
+
+//MARK: - KMLinkPageViewDelegate
+extension KMLinkViewController: KMLinkEmailViewDelegate {
+    func kmLinkEmailViewDidGo(_ view: KMLinkEmailView, _ emailString: String) {
         
     }
+    
 }

+ 0 - 25
PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/KMLinkViewController.xib

@@ -14,7 +14,6 @@
                 <outlet property="linkPageView" destination="x7p-Hb-EyP" id="a2Z-MU-Fi6"/>
                 <outlet property="linkWebView" destination="fH6-Uy-dbh" id="WXi-Pk-sCY"/>
                 <outlet property="tabsView" destination="7KZ-04-qIH" id="EFi-fc-PS2"/>
-                <outlet property="testPopView" destination="KCJ-26-UEz" id="2Bb-8p-oPX"/>
                 <outlet property="titleLabel" destination="cWl-1z-Oo9" id="Oks-CT-g1E"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
             </connections>
@@ -83,29 +82,8 @@
                                     </customView>
                                 </subviews>
                             </customView>
-                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="gSg-Lr-D8q">
-                                <rect key="frame" x="0.0" y="0.0" width="259" height="328"/>
-                                <subviews>
-                                    <customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KCJ-26-UEz" customClass="KMLinkPopupBaseView" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                                        <rect key="frame" x="40" y="73" width="187" height="144"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                                    </customView>
-                                    <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ONO-Y5-K0t">
-                                        <rect key="frame" x="92" y="267" width="75" height="32"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                                        <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="9tK-iq-iaU">
-                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                            <font key="font" metaFont="system"/>
-                                        </buttonCell>
-                                        <connections>
-                                            <action selector="test:" target="-2" id="bfJ-dy-7S2"/>
-                                        </connections>
-                                    </button>
-                                </subviews>
-                            </customView>
                         </subviews>
                         <constraints>
-                            <constraint firstItem="gSg-Lr-D8q" firstAttribute="leading" secondItem="O0h-RK-4bo" secondAttribute="leading" id="1jh-ES-Bwh"/>
                             <constraint firstItem="ZTL-oi-jx1" firstAttribute="leading" secondItem="O0h-RK-4bo" secondAttribute="leading" id="6UD-f0-ote"/>
                             <constraint firstAttribute="bottom" secondItem="BK6-TZ-Fw8" secondAttribute="bottom" id="BPK-qA-uHY"/>
                             <constraint firstItem="BK6-TZ-Fw8" firstAttribute="top" secondItem="ZTL-oi-jx1" secondAttribute="bottom" id="CCV-Bi-LqY"/>
@@ -118,11 +96,8 @@
                             <constraint firstItem="BK6-TZ-Fw8" firstAttribute="leading" secondItem="O0h-RK-4bo" secondAttribute="leading" id="Ldv-N6-Isp"/>
                             <constraint firstAttribute="trailing" secondItem="ari-Wn-bbp" secondAttribute="trailing" id="R8J-X6-PPa"/>
                             <constraint firstAttribute="trailing" secondItem="BK6-TZ-Fw8" secondAttribute="trailing" id="di8-tZ-M1j"/>
-                            <constraint firstAttribute="trailing" secondItem="gSg-Lr-D8q" secondAttribute="trailing" id="gqM-JC-AxK"/>
                             <constraint firstItem="ari-Wn-bbp" firstAttribute="top" secondItem="O0h-RK-4bo" secondAttribute="top" id="hAz-0u-UW9"/>
                             <constraint firstItem="BK6-TZ-Fw8" firstAttribute="leading" secondItem="O0h-RK-4bo" secondAttribute="leading" id="i0j-6F-uVV"/>
-                            <constraint firstAttribute="bottom" secondItem="gSg-Lr-D8q" secondAttribute="bottom" id="m8N-xt-8MR"/>
-                            <constraint firstItem="gSg-Lr-D8q" firstAttribute="top" secondItem="ZTL-oi-jx1" secondAttribute="bottom" id="t9a-X3-6GM"/>
                         </constraints>
                     </view>
                 </box>

+ 37 - 3
PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/KMLinkEmailView/KMLinkEmailView.swift

@@ -8,12 +8,20 @@
 import Cocoa
 import KMComponentLibrary
 
-class KMLinkEmailView: BaseXibView {
+@objc public protocol KMLinkEmailViewDelegate: AnyObject {
+    
+    @objc optional func kmLinkEmailViewDidGo(_ view: KMLinkEmailView, _ emailString: String)
+ 
+}
+
+public class KMLinkEmailView: BaseXibView {
 
     @IBOutlet var contendBox: NSBox!
     @IBOutlet var inputTextarea: ComponentTextarea!
     @IBOutlet var goButton: ComponentButton!
     
+    weak open var delegate: KMLinkEmailViewDelegate?
+    
     //MARK: - func
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
@@ -45,19 +53,45 @@ class KMLinkEmailView: BaseXibView {
                                                              totalCount: -1,
                                                              text: "",
                                                              isDisabled:false)
+        inputTextarea.delegate = self
         
         goButton.properties = ComponentButtonProperty(type: .default_tertiary,
                                                            size: .s,
                                                            buttonText: KMLocalizedString("Go"))
-        
+        goButton.setTarget(self, action: #selector(buttonClicked(_:)))
+        goButton.isHidden = true
+
     }
  
+    @objc func buttonClicked(_ sender: NSView) {
+        delegate?.kmLinkEmailViewDidGo?(self, inputTextarea.properties.text)
+        
+    }
     
     //MARK: - MouseEvent
-    override func mouseDown(with event: NSEvent) {
+    public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         
         self.window?.makeFirstResponder(nil)
     }
     
 }
+
+//MARK: - ComponentTextareaDelegate
+extension KMLinkEmailView: ComponentTextareaDelegate {
+    public func componentTextareaTextDidBeginEditing(_ view: ComponentTextarea) {
+        
+    }
+    
+    public func componentTextareaTextDidChange(_ view: ComponentTextarea) {
+        if view.properties.text.count > 0 {
+            goButton.isHidden = false
+        } else {
+            goButton.isHidden = true
+        }
+    }
+    
+    public func componentTextareaTextDidEndEditing(_ view: ComponentTextarea) {
+        
+    }
+}

+ 78 - 6
PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/KMLinkPageView/KMLinkPageView.swift

@@ -8,6 +8,14 @@
 import Cocoa
 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 {
 
     @IBOutlet var infoContendView: NSView!
@@ -18,6 +26,16 @@ public class KMLinkPageView: BaseXibView {
     
     @IBOutlet var goButton: ComponentButton!
     
+    var pdfView: CPDFView? = nil
+    
+    var annotation: CPDFLinkAnnotation? = nil
+    
+    var startPageIndex: Int = 0
+    var choosedIndex: Int = 0
+    var isGo: Bool = false
+
+    weak open var delegate: KMLinkPageViewDelegate?
+
     //MARK: - func
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
@@ -62,19 +80,60 @@ public class KMLinkPageView: BaseXibView {
         imageBGView.layer?.borderColor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/4").cgColor
         imageBGView.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorFill/4").cgColor
         imageBGView.layer?.masksToBounds = true
-        
-        
-        
-        paginationView.properties = ComponentPaginationProperty(doubleArrow_show: false, currentIndex: 0, totalCount: 100)
+         
+        paginationView.properties = ComponentPaginationProperty(doubleArrow_show: false, currentIndex: 0, totalCount: 1)
+        paginationView.delegate = self
         
         goButton.properties = ComponentButtonProperty(type: .default_tertiary,
                                                            size: .s,
                                                            buttonText: KMLocalizedString("Go"))
-        
+        goButton.setTarget(self, action: #selector(buttonClicked(_:)))
     }
     
     
     func reloadData() {
+        guard let pdfView = self.pdfView else {
+            return
+        }
+        
+        paginationView.properties.currentIndex = pdfView.currentPageIndex + 1
+        if let destination = annotation?.destination() {
+            if let page = destination.page() {
+                let pageIndex = page.document?.index(for: page) ?? 0
+                paginationView.properties.currentIndex = Int((pageIndex + 1))
+            }
+        }
+        
+        paginationView.properties.totalCount = Int(pdfView.document.pageCount)
+        paginationView.reloadData()
+        
+        isGo = false
+        goButton.properties.buttonText = KMLocalizedString("Go")
+        
+        choosedIndex = paginationView.properties.currentIndex
+        startPageIndex = paginationView.properties.currentIndex
+        
+    }
+    
+    func refreshGoButton() {
+        if isGo {
+            goButton.properties.buttonText = KMLocalizedString("Back")
+        } else {
+            goButton.properties.buttonText = KMLocalizedString("Go")
+        }
+        goButton.reloadData()
+        
+    }
+    
+    @objc func buttonClicked(_ sender: NSView) {
+        if isGo == false {
+            delegate?.kmLinkPageViewDidChangeDestination?(self, choosedIndex)
+            isGo = true
+        } else {
+            delegate?.kmLinkPageViewDidGoToPage?(self, startPageIndex)
+            isGo = false
+        }
+        refreshGoButton()
         
     }
     
@@ -83,7 +142,20 @@ public class KMLinkPageView: BaseXibView {
     public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         
-        self.window?.makeFirstResponder(nil)
+        window?.makeFirstResponder(nil)
     }
     
 }
+
+//MARK: - ComponentPaginationDelegate
+extension KMLinkPageView: ComponentPaginationDelegate {
+    public func componentPaginationDidValueChanged(pagination: ComponentPagination) {
+        if choosedIndex != pagination.properties.currentIndex {
+            choosedIndex = pagination.properties.currentIndex
+            
+            isGo = false
+            
+            refreshGoButton()
+        }
+    }
+}

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

@@ -8,12 +8,19 @@
 import Cocoa
 import KMComponentLibrary
 
-class KMLinkWebView: BaseXibView {
+@objc public protocol KMLinkWebViewDelegate: AnyObject {
+    
+    @objc optional func kmLinkWebViewDidGo(_ view: KMLinkWebView, _ webString: String)
+ 
+}
+
+public class KMLinkWebView: BaseXibView {
 
     @IBOutlet var contendBox: NSBox!
     @IBOutlet var inputTextarea: ComponentTextarea!
     @IBOutlet var goButton: ComponentButton!
     
+    weak open var delegate: KMLinkWebViewDelegate?
     
     //MARK: - func
     public override func draw(_ dirtyRect: NSRect) {
@@ -48,19 +55,45 @@ class KMLinkWebView: BaseXibView {
                                                              totalCount: -1,
                                                              text: "",
                                                              isDisabled:false)
+        inputTextarea.delegate = self
         
         goButton.properties = ComponentButtonProperty(type: .default_tertiary,
                                                            size: .s,
                                                            buttonText: KMLocalizedString("Go"))
+        goButton.setTarget(self, action: #selector(buttonClicked(_:)))
+        goButton.isHidden = true
         
     }
     
     
+    @objc func buttonClicked(_ sender: NSView) {
+        delegate?.kmLinkWebViewDidGo?(self, inputTextarea.properties.text)
+    }
+    
     //MARK: - MouseEvent
-    override func mouseDown(with event: NSEvent) {
+    public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         
         self.window?.makeFirstResponder(nil)
     }
     
 }
+
+//MARK: - ComponentTextareaDelegate
+extension KMLinkWebView: ComponentTextareaDelegate {
+    public func componentTextareaTextDidBeginEditing(_ view: ComponentTextarea) {
+        
+    }
+    
+    public func componentTextareaTextDidChange(_ view: ComponentTextarea) {
+        if view.properties.text.count > 0 {
+            goButton.isHidden = false
+        } else {
+            goButton.isHidden = true
+        }
+    }
+    
+    public func componentTextareaTextDidEndEditing(_ view: ComponentTextarea) {
+        
+    }
+}

+ 25 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/PopupViews/KMLinkPopupBaseView.swift

@@ -6,9 +6,19 @@
 //
 
 import Cocoa
+import KMComponentLibrary
 
 class KMLinkPopupBaseView: BaseXibView {
 
+    @IBOutlet var contendBox: NSBox!
+    
+    @IBOutlet var baseView: NSView!
+    @IBOutlet var pageButton: ComponentButton!
+    @IBOutlet var webButton: ComponentButton!
+    @IBOutlet var emailButton: ComponentButton!
+    @IBOutlet var moreButton: ComponentButton!
+    
+    
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
 
@@ -27,6 +37,21 @@ class KMLinkPopupBaseView: BaseXibView {
         }
     }
     
+    func setUpProperty() {
+        pageButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, state: .normal, onlyIcon: false, showLeftIcon: true, showRightIcon: false, buttonText: KMLocalizedString("Page"))
+        pageButton.properties.propertyInfo.leftIcon_nor = NSImage(named: "")
+        
+        webButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, state: .normal, onlyIcon: false, showLeftIcon: true, showRightIcon: false, buttonText: KMLocalizedString("Web"))
+        webButton.properties.propertyInfo.leftIcon_nor = NSImage(named: "")
+        
+        emailButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, state: .normal, onlyIcon: false, showLeftIcon: true, showRightIcon: false, buttonText: KMLocalizedString("Email"))
+        emailButton.properties.propertyInfo.leftIcon_nor = NSImage(named: "")
+        
+        moreButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, onlyIcon: true)
+        moreButton.properties.propertyInfo.leftIcon_nor = NSImage(named: "")
+        
+    }
+    
     func refreshUI() {
         var rect = self.frame
         if linkPopupType == .None {

+ 59 - 9
PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/Views/PopupViews/KMLinkPopupBaseView.xib

@@ -7,28 +7,78 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMLinkPopupBaseView" customModule="PDF_Reader_Pro" customModuleProvider="target"/>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMLinkPopupBaseView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="baseView" destination="LjH-d2-mMz" id="i3M-Ia-wgc"/>
+                <outlet property="contendBox" destination="ocp-w7-gcM" id="kcc-MJ-Mab"/>
+                <outlet property="emailButton" destination="KQo-Mf-ryb" id="ixu-f2-0nT"/>
+                <outlet property="moreButton" destination="p6q-un-PKG" id="Kl2-BI-U2c"/>
+                <outlet property="pageButton" destination="ReC-gU-eYc" id="Tnq-i7-fGV"/>
+                <outlet property="webButton" destination="OBG-Rs-ect" id="w34-cS-GvJ"/>
+            </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="381" height="74"/>
+            <rect key="frame" x="0.0" y="0.0" width="310" height="40"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ocp-w7-gcM">
-                    <rect key="frame" x="0.0" y="0.0" width="381" height="74"/>
+                    <rect key="frame" x="0.0" y="0.0" width="310" height="40"/>
                     <view key="contentView" id="XIN-cf-7Vi">
-                        <rect key="frame" x="1" y="1" width="379" height="72"/>
+                        <rect key="frame" x="1" y="1" width="308" height="38"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="LjH-d2-mMz">
-                                <rect key="frame" x="8" y="4" width="363" height="64"/>
+                                <rect key="frame" x="0.0" y="0.0" width="308" height="38"/>
+                                <subviews>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="ReC-gU-eYc" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="4" y="3" width="84" height="32"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="32" id="QRa-ZN-aox"/>
+                                            <constraint firstAttribute="width" constant="84" id="eQ2-xO-qbb"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="OBG-Rs-ect" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="92" y="3" width="84" height="32"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="84" id="VAq-ID-o3i"/>
+                                            <constraint firstAttribute="height" constant="32" id="tcb-fv-RIK"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="KQo-Mf-ryb" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="180" y="3" width="84" height="32"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="84" id="ad0-bT-i67"/>
+                                            <constraint firstAttribute="height" constant="32" id="ttU-R8-evu"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="p6q-un-PKG" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="268" y="3" width="32" height="32"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="32" id="3kI-7r-bQg"/>
+                                            <constraint firstAttribute="height" constant="32" id="ZGJ-7D-e8n"/>
+                                        </constraints>
+                                    </customView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="ReC-gU-eYc" firstAttribute="centerY" secondItem="LjH-d2-mMz" secondAttribute="centerY" id="2RL-l8-dYh"/>
+                                    <constraint firstItem="KQo-Mf-ryb" firstAttribute="leading" secondItem="OBG-Rs-ect" secondAttribute="trailing" constant="4" id="5KN-G2-VdW"/>
+                                    <constraint firstAttribute="trailing" secondItem="p6q-un-PKG" secondAttribute="trailing" constant="8" id="5vZ-lc-8Zr"/>
+                                    <constraint firstItem="OBG-Rs-ect" firstAttribute="centerY" secondItem="LjH-d2-mMz" secondAttribute="centerY" id="6MH-7L-rwY"/>
+                                    <constraint firstItem="OBG-Rs-ect" firstAttribute="leading" secondItem="ReC-gU-eYc" secondAttribute="trailing" constant="4" id="NbM-9k-MhK"/>
+                                    <constraint firstItem="p6q-un-PKG" firstAttribute="centerY" secondItem="LjH-d2-mMz" secondAttribute="centerY" id="U91-Rr-4XT"/>
+                                    <constraint firstItem="ReC-gU-eYc" firstAttribute="leading" secondItem="LjH-d2-mMz" secondAttribute="leading" constant="4" id="fjF-ah-U04"/>
+                                    <constraint firstItem="p6q-un-PKG" firstAttribute="leading" secondItem="KQo-Mf-ryb" secondAttribute="trailing" constant="4" id="m6t-DS-zcB"/>
+                                    <constraint firstItem="KQo-Mf-ryb" firstAttribute="centerY" secondItem="LjH-d2-mMz" secondAttribute="centerY" id="smr-BK-Can"/>
+                                </constraints>
                             </customView>
                         </subviews>
                         <constraints>
-                            <constraint firstAttribute="trailing" secondItem="LjH-d2-mMz" secondAttribute="trailing" constant="8" id="1NV-SZ-uOJ"/>
-                            <constraint firstAttribute="bottom" secondItem="LjH-d2-mMz" secondAttribute="bottom" constant="4" id="4mR-cZ-l4M"/>
-                            <constraint firstItem="LjH-d2-mMz" firstAttribute="leading" secondItem="XIN-cf-7Vi" secondAttribute="leading" constant="8" id="ZlA-O8-CNY"/>
-                            <constraint firstItem="LjH-d2-mMz" firstAttribute="top" secondItem="XIN-cf-7Vi" secondAttribute="top" constant="4" id="e6C-FA-mF9"/>
+                            <constraint firstAttribute="trailing" secondItem="LjH-d2-mMz" secondAttribute="trailing" id="1NV-SZ-uOJ"/>
+                            <constraint firstAttribute="bottom" secondItem="LjH-d2-mMz" secondAttribute="bottom" id="4mR-cZ-l4M"/>
+                            <constraint firstItem="LjH-d2-mMz" firstAttribute="leading" secondItem="XIN-cf-7Vi" secondAttribute="leading" id="ZlA-O8-CNY"/>
+                            <constraint firstItem="LjH-d2-mMz" firstAttribute="top" secondItem="XIN-cf-7Vi" secondAttribute="top" id="e6C-FA-mF9"/>
                         </constraints>
                     </view>
                     <color key="fillColor" name="KM_757780_Color"/>

+ 0 - 16
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -732,22 +732,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "9F270306-5D15-43FD-A3CE-36DBF6161919"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Home/View/KMBox.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "123"
-            endingLineNumber = "123"
-            landmarkName = "mouseUp(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent