Browse Source

【注释回复】补充UI

tangchao 5 months ago
parent
commit
c91c43b462
14 changed files with 351 additions and 23 deletions
  1. 6 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/Contents.json
  2. 22 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteExpand.imageset/Contents.json
  3. 70 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteExpand.imageset/ic 1.pdf
  4. 70 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteExpand.imageset/ic.pdf
  5. 22 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteMarkup.imageset/Contents.json
  6. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteMarkup.imageset/state=normal, Switch=No 1.pdf
  7. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteMarkup.imageset/state=normal, Switch=No.pdf
  8. 15 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTableViewCell.swift
  9. 21 2
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMSectionCellView.swift
  10. 7 7
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMSectionCellView.xib
  11. 34 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift
  12. 24 10
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/LeftSideView.xib
  13. 52 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Tools/KMNoteReplyHanddler.swift
  14. 8 0
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

+ 6 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/Contents.json

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

+ 22 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteExpand.imageset/Contents.json

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

+ 70 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteExpand.imageset/ic 1.pdf

@@ -0,0 +1,70 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+-1.000000 -0.000000 -0.000000 1.000000 12.000000 5.000000 cm
+0.152276 0.234759 0.385445 scn
+8.000000 4.989752 m
+3.995897 0.000000 l
+0.000000 5.000000 l
+8.000000 4.989752 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  211
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000301 00000 n
+0000000323 00000 n
+0000000496 00000 n
+0000000570 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+629
+%%EOF

+ 70 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteExpand.imageset/ic.pdf

@@ -0,0 +1,70 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+-1.000000 -0.000000 -0.000000 1.000000 12.000000 5.000000 cm
+0.152276 0.234759 0.385445 scn
+8.000000 4.989752 m
+3.995897 0.000000 l
+0.000000 5.000000 l
+8.000000 4.989752 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  211
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000301 00000 n
+0000000323 00000 n
+0000000496 00000 n
+0000000570 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+629
+%%EOF

+ 22 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteMarkup.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "filename" : "state=normal, Switch=No.pdf",
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "filename" : "state=normal, Switch=No 1.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteMarkup.imageset/state=normal, Switch=No 1.pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Note/KMImageNameBotaNoteMarkup.imageset/state=normal, Switch=No.pdf


+ 15 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTableViewCell.swift

@@ -21,6 +21,8 @@ class KMNoteTableViewCell: NSTableCellView {
     @IBOutlet var noteContentLabel: NSTextField!
     @IBOutlet var noteImageView: NSImageView!
     
+    @IBOutlet var markupButton: NSButton!
+    
     @IBOutlet var topViewLayoutConstraint: NSLayoutConstraint!
     @IBOutlet var autherLayoutConstraint: NSLayoutConstraint!
     @IBOutlet var typeImageViewLayoutConstraint: NSLayoutConstraint!
@@ -66,6 +68,9 @@ class KMNoteTableViewCell: NSTableCellView {
     var isUnFoldNote: ((_ cellNote: CPDFAnnotation?, _ isUnfold: Bool)->Void)?
     var renameActionCallback: ((_ count: String)->Void)?
 
+    
+    var itemClick: KMCommonClickBlock?
+    
     var model: KMBotaAnnotationModel? {
         didSet {
             self.updateView(self.model)
@@ -111,6 +116,10 @@ class KMNoteTableViewCell: NSTableCellView {
         self.annotationContentLabel.cell?.truncatesLastVisibleLine = true
         self.annotationContentLabel.isEditable = false
         
+        self.markupButton.image = NSImage(named: "KMImageNameBotaNoteMarkup")
+        self.markupButton.target = self
+        self.markupButton.action = #selector(markupAction)
+        
 //        self.noteImageView.imageScaling = .scaleAxesIndependently
         
         NotificationCenter.default.addObserver(self, selector: #selector(_contextDidEndEdit), name: NSControl.textDidEndEditingNotification, object: self.annotationContentLabel)
@@ -121,7 +130,8 @@ class KMNoteTableViewCell: NSTableCellView {
     
     func contentViewHidden(_ hidden: Bool) {
         self.contentViewTopConstraint.constant = hidden ? -(NSHeight(self.topView.bounds)) : 8.0
-        self.pageLabelTopConstraint.constant = hidden ? -(NSHeight(self.topView.bounds)) : 4.0
+//        self.pageLabelTopConstraint.constant = hidden ? -(NSHeight(self.topView.bounds)) : 4.0
+        self.pageLabelTopConstraint.constant = -(NSHeight(self.topView.bounds)-4)
     }
     
     @IBAction func foldButtonAction(_ sender: NSButton) {
@@ -153,6 +163,10 @@ class KMNoteTableViewCell: NSTableCellView {
         self.annotationContentWidthConstraint.constant = contentW-foldW
     }
     
+    @objc func markupAction() {
+        self.itemClick?(1)
+    }
+    
 }
 
 // MARK: - Private Methods

+ 21 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMSectionCellView.swift

@@ -12,6 +12,18 @@ class KMSectionCellView: NSTableCellView, NibLoadable {
     @IBOutlet weak var countLabel: NSTextField!
     @IBOutlet weak var expandButton: NSButton!
     
+    var itemClick: KMCommonClickBlock?
+    
+    var isExpand = false {
+        didSet {
+            if self.isExpand {
+                self.expandButton.image = NSImage(named: "KMImageNameBotaNoteExpand")
+            } else {
+                self.expandButton.image = NSImage(named: "KMImageNameBotaNoteExpand")
+            }
+        }
+    }
+    
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
 
@@ -21,7 +33,14 @@ class KMSectionCellView: NSTableCellView, NibLoadable {
     override func awakeFromNib() {
         super.awakeFromNib()
         
-        self.titleLabel.stringValue = "1234"
-        self.countLabel.stringValue = "2"
+        self.expandButton.target = self
+        self.expandButton.action = #selector(expandAction)
+        
+        self.wantsLayer = true
+        self.layer?.backgroundColor = NSColor(hex: "#EAECF2").cgColor
+    }
+    
+    @objc func expandAction() {
+        self.itemClick?(1)
     }
 }

+ 7 - 7
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMSectionCellView.xib

@@ -9,12 +9,12 @@
         <customObject id="-2" userLabel="File's Owner" customClass="KMSectionCellView" customModule="PDF_Reader_Pro" customModuleProvider="target"/>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <tableCellView id="qeq-9Z-4A5" customClass="KMSectionCellView" customModule="PDF_Reader_Pro" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="239" height="32"/>
+        <tableCellView misplaced="YES" id="qeq-9Z-4A5" customClass="KMSectionCellView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="239" height="28"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Ivc-dC-Pho">
-                    <rect key="frame" x="0.0" y="8" width="4" height="16"/>
+                    <rect key="frame" x="0.0" y="4" width="4" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" id="eCT-hy-8qi">
                         <font key="font" usesAppearanceFont="YES"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -22,7 +22,7 @@
                     </textFieldCell>
                 </textField>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rjc-uD-mQf">
-                    <rect key="frame" x="180" y="8" width="37" height="16"/>
+                    <rect key="frame" x="180" y="4" width="37" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="xg9-Kz-vHH">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -30,7 +30,7 @@
                     </textFieldCell>
                 </textField>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1Z2-Dc-fxz">
-                    <rect key="frame" x="219" y="8" width="16" height="16"/>
+                    <rect key="frame" x="219" y="4" width="16" height="16"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="16" id="SC8-Wl-hxz"/>
                         <constraint firstAttribute="height" constant="16" id="zBo-6g-duz"/>
@@ -43,13 +43,13 @@
             </subviews>
             <constraints>
                 <constraint firstItem="Ivc-dC-Pho" firstAttribute="leading" secondItem="qeq-9Z-4A5" secondAttribute="leading" constant="2" id="5zC-Az-1Sz"/>
-                <constraint firstItem="1Z2-Dc-fxz" firstAttribute="top" secondItem="qeq-9Z-4A5" secondAttribute="top" constant="8" id="Elh-QV-3BZ"/>
+                <constraint firstItem="1Z2-Dc-fxz" firstAttribute="top" secondItem="qeq-9Z-4A5" secondAttribute="top" constant="4" id="Elh-QV-3BZ"/>
                 <constraint firstItem="Ivc-dC-Pho" firstAttribute="centerY" secondItem="qeq-9Z-4A5" secondAttribute="centerY" id="JUy-id-kUc"/>
                 <constraint firstItem="rjc-uD-mQf" firstAttribute="centerY" secondItem="qeq-9Z-4A5" secondAttribute="centerY" id="Jas-8P-hzB"/>
                 <constraint firstItem="1Z2-Dc-fxz" firstAttribute="centerY" secondItem="qeq-9Z-4A5" secondAttribute="centerY" id="OmN-UY-uxq"/>
                 <constraint firstAttribute="trailing" secondItem="1Z2-Dc-fxz" secondAttribute="trailing" constant="4" id="RfC-U6-OFQ"/>
                 <constraint firstAttribute="trailing" secondItem="rjc-uD-mQf" secondAttribute="trailing" constant="24" id="Z97-QS-N9P"/>
-                <constraint firstAttribute="bottom" secondItem="1Z2-Dc-fxz" secondAttribute="bottom" constant="8" id="kP7-zb-HYq"/>
+                <constraint firstAttribute="bottom" secondItem="1Z2-Dc-fxz" secondAttribute="bottom" constant="4" id="kP7-zb-HYq"/>
             </constraints>
             <connections>
                 <outlet property="countLabel" destination="rjc-uD-mQf" id="yTm-O6-wPh"/>

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

@@ -225,6 +225,7 @@ class KMLeftSideViewController: KMSideViewController {
     private var deletePages_ = Set<CPDFPage>()
     
     let userFbHanddler = KMUserFeekbackHanddler()
+    let noteReplyHanddler = KMNoteReplyHanddler()
     
     deinit {
         KMPrint("KMLeftSideViewController deinit.")
@@ -2025,12 +2026,18 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
         } else if outlineView.isEqual(to: self.noteOutlineView) {
             if let data = item as? KMBotaAnnotationSectionModel {
                 var cell = outlineView.makeView(withIdentifier: KMSectionCellView.km_identifier, owner: nil) as? KMSectionCellView
-//                let cell = outlineView.makeView(withIdentifier: KMNoteTableViewCell.km_identifier, owner: self) as! KMNoteTableViewCell
                 if cell == nil {
                     cell = KMSectionCellView.createFromNib()
                 }
-//                cell?.titleLabel.stringValue = "llllll"
-//                cell?.countLabel.stringValue = "2"
+                cell?.isExpand = true
+                cell?.titleLabel.stringValue = "Page 2"
+                cell?.countLabel.stringValue = "\(data.itemCount)"
+                
+                cell?.itemClick = { idx, _ in
+                    if idx == 1 { // 收取 & 展开
+                        KMPrint("")
+                    }
+                }
                 return cell
             }
             let model = item as? KMBotaAnnotationModel
@@ -2038,6 +2045,12 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
             let cell = outlineView.makeView(withIdentifier: KMNoteTableViewCell.km_identifier, owner: self) as! KMNoteTableViewCell
             cell.cellNote = note
             cell.model = model
+            let state = self.noteReplyHanddler.fetchAnnoState(note) ?? .unMarked
+            if state == .unMarked {
+                cell.markupButton.isHidden = false
+            } else {
+                cell.markupButton.isHidden = true
+            }
             if let data = note {
                 if data.isKind(of: CPDFStampAnnotation.self) && data.isKind(of: KMSelfSignAnnotation.self) == false {
                     
@@ -2053,6 +2066,24 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
                     }
                 }
             }
+            cell.itemClick = { [weak self] idx , _ in
+                if idx == 1 { // Markup
+                    let anno = model?.anno
+                    guard let state = self?.noteReplyHanddler.fetchAnnoState(anno), state == .marked else {
+                        self?.noteReplyHanddler.markAnnotation(anno)
+                        
+                        if let theA = anno {
+                            self?.note_reloadDataForAnnoIfNeed(anno: theA)
+                        }
+                        return
+                    }
+                    self?.noteReplyHanddler.unMarkAnnotation(anno)
+                    
+                    if let theA = anno {
+                        self?.note_reloadDataForAnnoIfNeed(anno: theA)
+                    }
+                }
+            }
             cell.isUnFoldNote = { cellNote, isUnfold in
                 // 将折叠状态记录到模型
                 model?.foldType = isUnfold  ? .unfold : .fold

+ 24 - 10
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/LeftSideView.xib

@@ -371,7 +371,7 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <clipView key="contentView" drawsBackground="NO" id="LIi-mQ-ZiW">
                 <rect key="frame" x="0.0" y="0.0" width="204" height="400"/>
-                <autoresizingMask key="autoresizingMask"/>
+                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                 <subviews>
                     <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="40" viewBased="YES" id="111" customClass="KMBotaTableView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="204" height="400"/>
@@ -474,7 +474,7 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <clipView key="contentView" drawsBackground="NO" id="4hs-Ss-bnw">
                 <rect key="frame" x="0.0" y="0.0" width="223" height="400"/>
-                <autoresizingMask key="autoresizingMask"/>
+                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                 <subviews>
                     <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" columnReordering="NO" columnResizing="NO" autosaveColumns="NO" typeSelect="NO" rowSizeStyle="automatic" viewBased="YES" id="128" customClass="KMBotaTableView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="223" height="400"/>
@@ -1155,7 +1155,7 @@
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="udQ-rE-Njy">
-                                                <rect key="frame" x="16" y="81" width="205" height="24"/>
+                                                <rect key="frame" x="16" y="81" width="155" height="24"/>
                                                 <subviews>
                                                     <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Lbo-Vh-Jiw">
                                                         <rect key="frame" x="0.0" y="4" width="16" height="16"/>
@@ -1196,7 +1196,7 @@
                                                 </constraints>
                                             </customView>
                                             <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pnc-2Q-X2x">
-                                                <rect key="frame" x="210" y="62" width="34" height="15"/>
+                                                <rect key="frame" x="179" y="62" width="34" height="15"/>
                                                 <constraints>
                                                     <constraint firstAttribute="width" constant="30" id="ns3-Zn-Vcw"/>
                                                 </constraints>
@@ -1207,7 +1207,7 @@
                                                 </textFieldCell>
                                             </textField>
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="mv9-xH-dgE">
-                                                <rect key="frame" x="0.0" y="12" width="208" height="61"/>
+                                                <rect key="frame" x="0.0" y="12" width="177" height="61"/>
                                                 <subviews>
                                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8iM-cD-LbJ">
                                                         <rect key="frame" x="0.0" y="43" width="16" height="16"/>
@@ -1224,13 +1224,13 @@
                                                         </connections>
                                                     </button>
                                                     <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="urW-lZ-sYJ">
-                                                        <rect key="frame" x="18" y="8" width="190" height="28"/>
+                                                        <rect key="frame" x="18" y="8" width="159" height="28"/>
                                                         <view key="contentView" id="3Zt-zx-JkS">
-                                                            <rect key="frame" x="1" y="1" width="188" height="26"/>
+                                                            <rect key="frame" x="1" y="1" width="157" height="26"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                             <subviews>
                                                                 <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="hDI-gM-mdu">
-                                                                    <rect key="frame" x="5" y="5" width="178" height="17"/>
+                                                                    <rect key="frame" x="5" y="5" width="147" height="17"/>
                                                                     <constraints>
                                                                         <constraint firstAttribute="height" constant="17" id="KpE-VJ-Nbx"/>
                                                                     </constraints>
@@ -1280,18 +1280,31 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageAlignment="left" imageScaling="proportionallyUpOrDown" id="Cgf-KG-ODg"/>
                                             </imageView>
+                                            <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="btZ-nY-HvQ">
+                                                <rect key="frame" x="215" y="85" width="20" height="20"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="20" id="VQf-ZS-nJ6"/>
+                                                    <constraint firstAttribute="width" constant="20" id="wWI-DF-xK0"/>
+                                                </constraints>
+                                                <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="fMn-4J-1vB">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="system"/>
+                                                </buttonCell>
+                                            </button>
                                         </subviews>
                                         <constraints>
                                             <constraint firstItem="Pnc-2Q-X2x" firstAttribute="top" secondItem="udQ-rE-Njy" secondAttribute="bottom" constant="4" id="0VN-YH-0OW"/>
-                                            <constraint firstAttribute="trailing" secondItem="udQ-rE-Njy" secondAttribute="trailing" constant="30" id="1h3-oY-1aP"/>
+                                            <constraint firstAttribute="trailing" secondItem="udQ-rE-Njy" secondAttribute="trailing" constant="80" id="1h3-oY-1aP"/>
                                             <constraint firstItem="zkB-0O-cuV" firstAttribute="leading" secondItem="3TS-lp-G7v" secondAttribute="leading" constant="16" id="809-dl-a9T"/>
                                             <constraint firstItem="mv9-xH-dgE" firstAttribute="top" secondItem="udQ-rE-Njy" secondAttribute="bottom" constant="8" id="DIv-1w-hI5"/>
                                             <constraint firstItem="Pnc-2Q-X2x" firstAttribute="leading" secondItem="mv9-xH-dgE" secondAttribute="trailing" constant="4" id="DVe-2C-VRp"/>
                                             <constraint firstItem="udQ-rE-Njy" firstAttribute="top" secondItem="3TS-lp-G7v" secondAttribute="top" constant="12" id="P1e-sT-bb4"/>
-                                            <constraint firstAttribute="trailing" secondItem="Pnc-2Q-X2x" secondAttribute="trailing" constant="9" id="Sjk-E8-SlY"/>
+                                            <constraint firstAttribute="trailing" secondItem="btZ-nY-HvQ" secondAttribute="trailing" constant="16" id="Rse-jw-WVt"/>
+                                            <constraint firstAttribute="trailing" secondItem="Pnc-2Q-X2x" secondAttribute="trailing" constant="40" id="Sjk-E8-SlY"/>
                                             <constraint firstItem="mv9-xH-dgE" firstAttribute="leading" secondItem="3TS-lp-G7v" secondAttribute="leading" id="aWn-yv-ia6"/>
                                             <constraint firstItem="udQ-rE-Njy" firstAttribute="leading" secondItem="3TS-lp-G7v" secondAttribute="leading" constant="16" id="ebM-dJ-RE4"/>
                                             <constraint firstItem="zkB-0O-cuV" firstAttribute="top" secondItem="mv9-xH-dgE" secondAttribute="top" id="o5h-AD-Csk"/>
+                                            <constraint firstItem="btZ-nY-HvQ" firstAttribute="top" secondItem="3TS-lp-G7v" secondAttribute="top" constant="12" id="q6q-xv-vfE"/>
                                             <constraint firstAttribute="bottom" secondItem="mv9-xH-dgE" secondAttribute="bottom" constant="12" id="rPt-rv-YAR"/>
                                         </constraints>
                                         <connections>
@@ -1305,6 +1318,7 @@
                                             <outlet property="foldButton" destination="8iM-cD-LbJ" id="2r7-kK-dje"/>
                                             <outlet property="imageViewHeightConstraint" destination="hms-0M-GIs" id="zVH-ft-qSu"/>
                                             <outlet property="maltlineLabelLayoutConstraint" destination="nok-GN-zdZ" id="WTm-Ll-giM"/>
+                                            <outlet property="markupButton" destination="btZ-nY-HvQ" id="Qa8-Gq-LMp"/>
                                             <outlet property="noteContentBox" destination="urW-lZ-sYJ" id="3li-ez-6Db"/>
                                             <outlet property="noteContentHeightConstraint" destination="KpE-VJ-Nbx" id="TAW-jl-P53"/>
                                             <outlet property="noteContentLabel" destination="hDI-gM-mdu" id="LfL-nV-3s2"/>

+ 52 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Tools/KMNoteReplyHanddler.swift

@@ -0,0 +1,52 @@
+//
+//  KMNoteReplyHanddler.swift
+//  PDF Reader Pro
+//
+//  Created by User-Tangchao on 2024/9/19.
+//
+
+import Cocoa
+
+// 注释回复处理类
+
+class KMNoteReplyHanddler: NSObject {
+    
+    func markAnnotation(_ anno: CPDFAnnotation?) {
+        guard let state = self.fetchAnnoState(anno) else {
+            anno?.createReplyStateAnnotation(.marked)
+            return
+        }
+        if state == .unMarked {
+            anno?.setAnnotState(.marked)
+        }
+    }
+    
+    func unMarkAnnotation(_ anno: CPDFAnnotation?) {
+        guard let state = self.fetchAnnoState(anno) else {
+            return
+        }
+        if state == .marked {
+            anno?.setAnnotState(.unMarked)
+        }
+    }
+    
+    func fetchAnnoState(_ anno: CPDFAnnotation?) -> CPDFAnnotationState? {
+        guard let replyA = self.fetchMarkAnnotation(anno) else {
+            return nil
+        }
+        return replyA.getAnnotState()
+    }
+    
+    func fetchMarkAnnotation(_ anno: CPDFAnnotation?) -> CPDFAnnotation? {
+        guard let theAnno = anno else {
+            return nil
+        }
+        
+        for replyA in theAnno.replyAnnotations ?? [] {
+            if replyA.replyAnnotationType == .mark {
+                return replyA
+            }
+        }
+        return nil
+    }
+}

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

@@ -27,6 +27,9 @@
 		65341C7C2C646C6400FE30F9 /* KMSearchReplaceHanddler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65341C7B2C646C6400FE30F9 /* KMSearchReplaceHanddler.swift */; };
 		65341C7D2C646C6400FE30F9 /* KMSearchReplaceHanddler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65341C7B2C646C6400FE30F9 /* KMSearchReplaceHanddler.swift */; };
 		65341C7E2C646C6400FE30F9 /* KMSearchReplaceHanddler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65341C7B2C646C6400FE30F9 /* KMSearchReplaceHanddler.swift */; };
+		6536FDE32C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6536FDE22C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift */; };
+		6536FDE42C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6536FDE22C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift */; };
+		6536FDE52C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6536FDE22C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift */; };
 		654A5A832C895DE5001FBD4B /* KMComparativeGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD6218D32A7D29F40088475C /* KMComparativeGradientView.swift */; };
 		654A5A842C895DE6001FBD4B /* KMComparativeGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD6218D32A7D29F40088475C /* KMComparativeGradientView.swift */; };
 		654A5A852C89628A001FBD4B /* KMWatermarkAdjectivePropertyBaseController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB897235294B38DC0045787C /* KMWatermarkAdjectivePropertyBaseController.xib */; };
@@ -5558,6 +5561,7 @@
 		65341C722C63CCFE00FE30F9 /* KMSearchReplaceWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSearchReplaceWindowController.swift; sourceTree = "<group>"; };
 		65341C732C63CCFE00FE30F9 /* KMSearchReplaceWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMSearchReplaceWindowController.xib; sourceTree = "<group>"; };
 		65341C7B2C646C6400FE30F9 /* KMSearchReplaceHanddler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSearchReplaceHanddler.swift; sourceTree = "<group>"; };
+		6536FDE22C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMNoteReplyHanddler.swift; sourceTree = "<group>"; };
 		654A5A8B2C8AE200001FBD4B /* KMAnalytics+KMExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KMAnalytics+KMExtensions.swift"; sourceTree = "<group>"; };
 		655445082C88483B00BD9010 /* KMDiscountToSaveWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMDiscountToSaveWindowController.xib; sourceTree = "<group>"; };
 		655445092C88483C00BD9010 /* KMDiscountToSaveWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMDiscountToSaveWindowController.h; sourceTree = "<group>"; };
@@ -12087,6 +12091,7 @@
 			isa = PBXGroup;
 			children = (
 				BB2C84872BAE753E00AF6142 /* KMBotaTools.swift */,
+				6536FDE22C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift */,
 			);
 			path = Tools;
 			sourceTree = "<group>";
@@ -16632,6 +16637,7 @@
 				9FB221072B19BD8B00A5B208 /* KMGeneralAnnotationViewController.swift in Sources */,
 				F3F0B27329B8ACD000722957 /* CPDFListViewDragObject.m in Sources */,
 				BB0FE0462B734DD1001E0F88 /* AIInfoConfig.swift in Sources */,
+				6536FDE32C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift in Sources */,
 				ADAC0DE52AC2B04900FD4F52 /* KMNoteTypeImageView.swift in Sources */,
 				9F8810952B56877C00F69815 /* KMAnnotationChoiceWidgetOptionsViewController.swift in Sources */,
 				9F8539BE2943085A00DF644E /* KMBrowser.swift in Sources */,
@@ -18211,6 +18217,7 @@
 				BB4A948E2B04726A00940F8B /* KMOCTool.m in Sources */,
 				F3732324292DFFFE0013862C /* CPDFListView+Extension.m in Sources */,
 				ADB5E5132A371131007110A8 /* KMSubscribeWaterMarkWindowController.swift in Sources */,
+				6536FDE42C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift in Sources */,
 				BB234F082BA3D798008B3754 /* KMAIIconGuideView.swift in Sources */,
 				AD68782229A5FADC005B5210 /* KMLightMemberCache.swift in Sources */,
 				ADAFDA492AEA7F1300F084BC /* KMAdvertisementShowView.swift in Sources */,
@@ -20093,6 +20100,7 @@
 				AD1FE8372BD7C98300AA4A9B /* KMPDFPrintManageWindowController.m in Sources */,
 				9FBC48C1299E23B100CA39D7 /* NSViewController+DesignToken.swift in Sources */,
 				89752DF429389F82003FF08E /* KMToolbarItem.m in Sources */,
+				6536FDE52C9C1EF2004A0FB9 /* KMNoteReplyHanddler.swift in Sources */,
 				ADDEEA742AD3EFE200EF675D /* KMButton.swift in Sources */,
 				AD1D481B2AFB6B96007AC1F0 /* KMMergeWindowController.swift in Sources */,
 				ADBC374329CAB1C300D93208 /* KMComparativeOutlineCell.swift in Sources */,