فهرست منبع

【2025】【Markup】综测问题修正

niehaoyu 2 ماه پیش
والد
کامیت
395720ce97
11فایلهای تغییر یافته به همراه104 افزوده شده و 15 حذف شده
  1. 12 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMCreateSignWindowController.swift
  2. 2 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMCreateSignWindowController.xib
  3. 8 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMPDFSignatureDrawView.swift
  4. 7 3
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/CreateSignWindowController/KMPDFSignatureInputView.swift
  5. 13 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/KMSignatureListController.swift
  6. 8 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Signature/KMSignatureManager.swift
  7. 2 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Controllers/KMStampSettingWindowController.xib
  8. 11 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/KMStampListController.swift
  9. 31 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Views/KMStampListItem.swift
  10. 10 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/StampList/Views/KMStampListItem.xib
  11. 0 8
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -11685,18 +11685,10 @@
 			isa = PBXGroup;
 			children = (
 				BBF19E972B0B31F7007154C8 /* View */,
-				BBF19E962B0B31DF007154C8 /* Controller */,
 			);
 			path = CreateStamp;
 			sourceTree = "<group>";
 		};
-		BBF19E962B0B31DF007154C8 /* Controller */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			path = Controller;
-			sourceTree = "<group>";
-		};
 		BBF19E972B0B31F7007154C8 /* View */ = {
 			isa = PBXGroup;
 			children = (