Browse Source

【综合】注释回复调整UI

tangchao 5 months ago
parent
commit
a58a17b2dd

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/Controller/KMNoteOutlineFilterViewController.swift

@@ -450,7 +450,7 @@ class KMNoteOutlineFilterViewController: NSViewController {
         self.authorCollectionView.reloadData()
         self.colorCollectionView.reloadData()
         self.typeCollectionView.reloadData()
-        self.collectionView.reloadData()
+        self.stateCollectionView.reloadData()
     }
     
     @IBAction func cancelButtonAction(_ sender: NSButton) {

+ 9 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteFooterCellView.swift

@@ -159,6 +159,8 @@ class KMNoteFooterCellView: NSTableCellView, NibLoadable {
         
         self.commentNumberLabel.font = .SFProTextRegularFont(11)
         self.commentNumberLabel.textColor = NSColor(hex: "#43474D")
+        
+        self.updateUI()
     }
     
     func updateUI(expand: Bool, animated: Bool) {
@@ -206,9 +208,7 @@ class KMNoteFooterCellView: NSTableCellView, NibLoadable {
         self.inputRespButton_.isHidden = true
     }
     
-    override func updateLayer() {
-        super.updateLayer()
-        
+    func updateUI() {
         if KMAppearance.isDarkMode() {
             self.inputBox.fillColor = NSColor(hex: "#393C3E")
             self.inputBox.borderColor = NSColor(hex: "#56585A")
@@ -217,6 +217,12 @@ class KMNoteFooterCellView: NSTableCellView, NibLoadable {
             self.inputBox.borderColor = NSColor(white: 0, alpha: 0.2)
         }
     }
+    
+    override func updateLayer() {
+        super.updateLayer()
+        
+        self.updateUI()
+    }
 }
 
 extension KMNoteFooterCellView: NSTextFieldDelegate {

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteFooterCellView.xib

@@ -109,7 +109,7 @@
                     </constraints>
                 </box>
                 <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="AKC-lX-l6Q" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                    <rect key="frame" x="377" y="12" width="64" height="20"/>
+                    <rect key="frame" x="379" y="12" width="64" height="20"/>
                     <view key="contentView" id="D5W-gK-4uq">
                         <rect key="frame" x="1" y="1" width="62" height="18"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -155,7 +155,7 @@
                     </constraints>
                 </box>
                 <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="D8j-Z1-l9J">
-                    <rect key="frame" x="323" y="12" width="38" height="20"/>
+                    <rect key="frame" x="325" y="12" width="38" height="20"/>
                     <view key="contentView" id="c41-HI-s8f">
                         <rect key="frame" x="1" y="1" width="36" height="18"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -220,7 +220,7 @@
                 <constraint firstAttribute="trailing" secondItem="Zps-kZ-RvQ" secondAttribute="trailing" id="RVa-g5-2Gl"/>
                 <constraint firstItem="Zps-kZ-RvQ" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" id="UP8-yd-0EJ"/>
                 <constraint firstItem="AKC-lX-l6Q" firstAttribute="top" secondItem="Zps-kZ-RvQ" secondAttribute="bottom" constant="6" id="fbR-we-VWb"/>
-                <constraint firstAttribute="trailing" secondItem="AKC-lX-l6Q" secondAttribute="trailing" constant="12" id="gFB-6P-VV3"/>
+                <constraint firstAttribute="trailing" secondItem="AKC-lX-l6Q" secondAttribute="trailing" constant="10" id="gFB-6P-VV3"/>
                 <constraint firstItem="AKC-lX-l6Q" firstAttribute="leading" secondItem="D8j-Z1-l9J" secondAttribute="trailing" constant="16" id="gdQ-4H-R9l"/>
                 <constraint firstItem="Zps-kZ-RvQ" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="klZ-3P-NUk"/>
             </constraints>

+ 9 - 9
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteReplyCellView.swift

@@ -32,6 +32,7 @@ class KMNoteReplyCellView: NSTableCellView, NibLoadable {
     override func awakeFromNib() {
         super.awakeFromNib()
         self.backgroundBox.borderWidth = 0
+        self.backgroundBox.cornerRadius = 0
         self.backgroundBox.moveCallback = { [weak self] enter, theBox in
             if enter {
                 theBox.fillColor = NSColor(hex: "#467DDE").withAlphaComponent(0.2)
@@ -66,12 +67,7 @@ class KMNoteReplyCellView: NSTableCellView, NibLoadable {
             }
         }
         
-        self.leftVorLineView.wantsLayer = true
-        if KMAppearance.isDarkMode() {
-            self.leftVorLineView.layer?.backgroundColor = NSColor(hex: "E2E3E6").cgColor
-        } else {
-            self.leftVorLineView.layer?.backgroundColor = NSColor(white: 0, alpha: 0.2).cgColor
-        }
+        self.updateUI()
     }
     
     @objc func moreAction(_ sender: NSButton) {
@@ -82,9 +78,7 @@ class KMNoteReplyCellView: NSTableCellView, NibLoadable {
         super.mouseUp(with: event)
     }
     
-    override func updateLayer() {
-        super.updateLayer()
-        
+    func updateUI() {
         self.leftVorLineView.wantsLayer = true
         if KMAppearance.isDarkMode() {
             self.leftVorLineView.layer?.backgroundColor = NSColor(hex: "E2E3E6").cgColor
@@ -92,4 +86,10 @@ class KMNoteReplyCellView: NSTableCellView, NibLoadable {
             self.leftVorLineView.layer?.backgroundColor = NSColor(white: 0, alpha: 0.2).cgColor
         }
     }
+    
+    override func updateLayer() {
+        super.updateLayer()
+        
+        self.updateUI()
+    }
 }

+ 17 - 8
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteReplyCellView.xib

@@ -9,14 +9,14 @@
         <customObject id="-2" userLabel="File's Owner"/>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <tableCellView misplaced="YES" id="cJ2-C3-BYm" customClass="KMNoteReplyCellView" customModule="PDF_Reader_Pro" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="248" height="70"/>
+        <tableCellView id="cJ2-C3-BYm" customClass="KMNoteReplyCellView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="248" height="66"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Gun-Jd-J23" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                    <rect key="frame" x="16" y="0.0" width="220" height="66"/>
+                    <rect key="frame" x="18" y="0.0" width="218" height="66"/>
                     <view key="contentView" id="v5i-Rx-mrG">
-                        <rect key="frame" x="1" y="1" width="218" height="64"/>
+                        <rect key="frame" x="1" y="1" width="216" height="64"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YhK-ga-zgX">
@@ -28,7 +28,7 @@
                                 </textFieldCell>
                             </textField>
                             <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="jIA-71-L4Q">
-                                <rect key="frame" x="190" y="40" width="24" height="24"/>
+                                <rect key="frame" x="188" y="40" width="24" height="24"/>
                                 <view key="contentView" id="ZKd-Tw-1e4">
                                     <rect key="frame" x="1" y="1" width="22" height="22"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -69,7 +69,7 @@
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                 </textFieldCell>
                             </textField>
-                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="zvz-ss-Nrt">
+                            <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zvz-ss-Nrt">
                                 <rect key="frame" x="0.0" y="0.0" width="1" height="64"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="1" id="TgQ-cH-Tvw"/>
@@ -94,17 +94,26 @@
                         </constraints>
                     </view>
                 </box>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="NKP-2Z-tbN">
+                    <rect key="frame" x="17" y="0.0" width="1" height="66"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="1" id="1q2-uM-K27"/>
+                    </constraints>
+                </customView>
             </subviews>
             <constraints>
                 <constraint firstAttribute="trailing" secondItem="Gun-Jd-J23" secondAttribute="trailing" constant="12" id="2gT-zp-lTN"/>
+                <constraint firstItem="NKP-2Z-tbN" firstAttribute="leading" secondItem="cJ2-C3-BYm" secondAttribute="leading" constant="17" id="FC6-Ja-y8L"/>
+                <constraint firstItem="NKP-2Z-tbN" firstAttribute="top" secondItem="cJ2-C3-BYm" secondAttribute="top" id="Pfy-Eb-K8D"/>
                 <constraint firstItem="Gun-Jd-J23" firstAttribute="top" secondItem="cJ2-C3-BYm" secondAttribute="top" id="hhq-XB-HPC"/>
                 <constraint firstAttribute="bottom" secondItem="Gun-Jd-J23" secondAttribute="bottom" id="tNb-Ko-CwT"/>
-                <constraint firstItem="Gun-Jd-J23" firstAttribute="leading" secondItem="cJ2-C3-BYm" secondAttribute="leading" constant="16" id="vv8-HJ-b8h"/>
+                <constraint firstItem="Gun-Jd-J23" firstAttribute="leading" secondItem="cJ2-C3-BYm" secondAttribute="leading" constant="18" id="vv8-HJ-b8h"/>
+                <constraint firstAttribute="bottom" secondItem="NKP-2Z-tbN" secondAttribute="bottom" id="xnY-uz-OId"/>
             </constraints>
             <connections>
                 <outlet property="backgroundBox" destination="Gun-Jd-J23" id="CCn-fK-BaQ"/>
                 <outlet property="contentLabel" destination="IC2-1d-jhL" id="BgV-ji-YIn"/>
-                <outlet property="leftVorLineView" destination="zvz-ss-Nrt" id="bFt-oN-bMj"/>
+                <outlet property="leftVorLineView" destination="NKP-2Z-tbN" id="mw6-25-tIs"/>
                 <outlet property="moreBox" destination="jIA-71-L4Q" id="pCM-YA-xsh"/>
                 <outlet property="moreButton" destination="XZ6-t2-NDE" id="Kmp-hj-pDj"/>
                 <outlet property="timeLabel" destination="vul-74-pMF" id="KGx-eD-rC1"/>

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

@@ -83,6 +83,8 @@ extension KMLeftSideViewController {
         self.noteOutlineView.menu = NSMenu()
         self.noteOutlineView.menu?.delegate = self
         self.noteOutlineView.typeSelectHelper = SKTypeSelectHelper(matchOption: .SKSubstringMatch)
+        self.noteOutlineView.enclosingScrollView?.scrollerStyle = .legacy
+        self.noteOutlineView.enclosingScrollView?.autohidesScrollers = true
         
         self.noteOutlineView.registerForDraggedTypes(NSColor.readableTypes(for: NSPasteboard(name: .drag)))
         self.noteOutlineView.target = self

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

@@ -1154,7 +1154,7 @@
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="udQ-rE-Njy">
-                                                <rect key="frame" x="16" y="81" width="155" height="24"/>
+                                                <rect key="frame" x="16" y="81" width="170" 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"/>
@@ -1206,7 +1206,7 @@
                                                 </textFieldCell>
                                             </textField>
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="mv9-xH-dgE">
-                                                <rect key="frame" x="0.0" y="12" width="219" height="61"/>
+                                                <rect key="frame" x="0.0" y="12" width="221" height="61"/>
                                                 <subviews>
                                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8iM-cD-LbJ">
                                                         <rect key="frame" x="0.0" y="43" width="16" height="16"/>
@@ -1223,13 +1223,13 @@
                                                         </connections>
                                                     </button>
                                                     <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="urW-lZ-sYJ">
-                                                        <rect key="frame" x="18" y="8" width="201" height="28"/>
+                                                        <rect key="frame" x="18" y="8" width="203" height="28"/>
                                                         <view key="contentView" id="3Zt-zx-JkS">
-                                                            <rect key="frame" x="1" y="1" width="199" height="26"/>
+                                                            <rect key="frame" x="1" y="1" width="201" 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="189" height="17"/>
+                                                                    <rect key="frame" x="5" y="5" width="195" height="17"/>
                                                                     <constraints>
                                                                         <constraint firstAttribute="height" constant="17" id="KpE-VJ-Nbx"/>
                                                                     </constraints>
@@ -1243,7 +1243,7 @@
                                                             <constraints>
                                                                 <constraint firstAttribute="bottom" secondItem="hDI-gM-mdu" secondAttribute="bottom" constant="5" id="Gnc-Mc-Y5Z"/>
                                                                 <constraint firstItem="hDI-gM-mdu" firstAttribute="top" secondItem="3Zt-zx-JkS" secondAttribute="top" constant="4" id="TZl-cx-Mjp"/>
-                                                                <constraint firstAttribute="trailing" secondItem="hDI-gM-mdu" secondAttribute="trailing" constant="7" id="aD6-K6-K1m"/>
+                                                                <constraint firstAttribute="trailing" secondItem="hDI-gM-mdu" secondAttribute="trailing" constant="3" id="aD6-K6-K1m"/>
                                                                 <constraint firstItem="hDI-gM-mdu" firstAttribute="leading" secondItem="3Zt-zx-JkS" secondAttribute="leading" constant="7" id="l30-oT-6b1"/>
                                                             </constraints>
                                                         </view>
@@ -1293,10 +1293,10 @@
                                         </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="80" id="1h3-oY-1aP"/>
+                                            <constraint firstAttribute="trailing" secondItem="udQ-rE-Njy" secondAttribute="trailing" constant="65" 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="-38" id="DVe-2C-VRp"/>
+                                            <constraint firstItem="Pnc-2Q-X2x" firstAttribute="leading" secondItem="mv9-xH-dgE" secondAttribute="trailing" constant="-40" 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="btZ-nY-HvQ" secondAttribute="trailing" constant="12" id="Rse-jw-WVt"/>
                                             <constraint firstAttribute="trailing" secondItem="Pnc-2Q-X2x" secondAttribute="trailing" constant="40" id="Sjk-E8-SlY"/>

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

@@ -333,6 +333,10 @@ class KMNoteReplyHanddler: NSObject {
         let a = theAnno.createReply()
         a?.contents = content ?? ""
         a?.setUserName(userName ?? "")
+        
+        if let data = self.viewC?.view.window {
+            KMTools.setDocumentEditedState(window: data)
+        }
         return a
     }
     
@@ -341,6 +345,7 @@ class KMNoteReplyHanddler: NSObject {
             return
         }
         
+        model.annoModel?.footerModel?.isExpand = true
         model.annoModel?.footerModel?.replyModel = model
     }
     
@@ -350,6 +355,10 @@ class KMNoteReplyHanddler: NSObject {
         }
         
         theAnno.page.removeAnnotation(theAnno)
+        
+        if let data = self.viewC?.view.window {
+            KMTools.setDocumentEditedState(window: data)
+        }
     }
     
     func fetchReviewState(_ anno: CPDFAnnotation?) -> CPDFAnnotationState? {