Browse Source

【2025】【组件库】新增进度组件

niehaoyu 1 month ago
parent
commit
b04b0da86e

+ 16 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary.xcodeproj/project.pbxproj

@@ -188,7 +188,11 @@
 		BB7929FE2CEF3CD4006FFD5D /* ComponentSwitch.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB7929FD2CEF3CD4006FFD5D /* ComponentSwitch.xib */; };
 		BB79E7142CE60FDE0052CAD5 /* ComponentCSelectorItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB79E7132CE60FDE0052CAD5 /* ComponentCSelectorItem.swift */; };
 		BB79E7162CE60FEB0052CAD5 /* ComponentCSelectorItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB79E7152CE60FEB0052CAD5 /* ComponentCSelectorItem.xib */; };
+		BBCE73062D37990E00220096 /* ComponentProgressWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBCE73042D37990E00220096 /* ComponentProgressWindowController.xib */; };
 		BBE788472CBCFCD2008086E2 /* ComponentBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBE788462CBCFCD2008086E2 /* ComponentBaseView.swift */; };
+		BBEECCDF2D37A12600F2FBA8 /* ComponentProgressWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBCE73032D37990E00220096 /* ComponentProgressWindowController.swift */; };
+		BBEECCE52D37A63200F2FBA8 /* ComponentProgressBigCircle.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBEECCE42D37A63200F2FBA8 /* ComponentProgressBigCircle.swift */; };
+		BBEECCE72D37A63D00F2FBA8 /* ComponentProgressBigCircle.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBEECCE62D37A63D00F2FBA8 /* ComponentProgressBigCircle.xib */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -374,7 +378,11 @@
 		BB7929FD2CEF3CD4006FFD5D /* ComponentSwitch.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComponentSwitch.xib; sourceTree = "<group>"; };
 		BB79E7132CE60FDE0052CAD5 /* ComponentCSelectorItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComponentCSelectorItem.swift; sourceTree = "<group>"; };
 		BB79E7152CE60FEB0052CAD5 /* ComponentCSelectorItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComponentCSelectorItem.xib; sourceTree = "<group>"; };
+		BBCE73032D37990E00220096 /* ComponentProgressWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComponentProgressWindowController.swift; sourceTree = "<group>"; };
+		BBCE73042D37990E00220096 /* ComponentProgressWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComponentProgressWindowController.xib; sourceTree = "<group>"; };
 		BBE788462CBCFCD2008086E2 /* ComponentBaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComponentBaseView.swift; sourceTree = "<group>"; };
+		BBEECCE42D37A63200F2FBA8 /* ComponentProgressBigCircle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComponentProgressBigCircle.swift; sourceTree = "<group>"; };
+		BBEECCE62D37A63D00F2FBA8 /* ComponentProgressBigCircle.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComponentProgressBigCircle.xib; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -650,6 +658,10 @@
 				BB5A9BE12CB64D4700F64C1F /* ComponentProgressPopup.xib */,
 				BB5A9BE32CB64D4700F64C1F /* ComponentProgressCircle.swift */,
 				BB5A9BE42CB64D4700F64C1F /* ComponentProgressCircle.xib */,
+				BBEECCE42D37A63200F2FBA8 /* ComponentProgressBigCircle.swift */,
+				BBEECCE62D37A63D00F2FBA8 /* ComponentProgressBigCircle.xib */,
+				BBCE73032D37990E00220096 /* ComponentProgressWindowController.swift */,
+				BBCE73042D37990E00220096 /* ComponentProgressWindowController.xib */,
 			);
 			path = Progress;
 			sourceTree = "<group>";
@@ -1104,6 +1116,7 @@
 				BB5A9CC22CB64D4800F64C1F /* ComponentAlert.xib in Resources */,
 				BB5A9D062CB64D4800F64C1F /* ComponentGroup.xib in Resources */,
 				BB5A9CD22CB64D4800F64C1F /* ComponentSlider.xib in Resources */,
+				BBEECCE72D37A63D00F2FBA8 /* ComponentProgressBigCircle.xib in Resources */,
 				BB79E7162CE60FEB0052CAD5 /* ComponentCSelectorItem.xib in Resources */,
 				BB5A9D0A2CB64D4800F64C1F /* ComponentToolTip.xib in Resources */,
 				BB5A9D052CB64D4800F64C1F /* ComponentSelect.xib in Resources */,
@@ -1136,6 +1149,7 @@
 				BB5A9CF62CB64D4800F64C1F /* ComponentModal.xib in Resources */,
 				BB5A9CB92CB64D4800F64C1F /* ComponentInputWithAddon.xib in Resources */,
 				BB5A9C882CB64D4800F64C1F /* ComponentDropdownTool.xib in Resources */,
+				BBCE73062D37990E00220096 /* ComponentProgressWindowController.xib in Resources */,
 				BB5A9C8B2CB64D4800F64C1F /* ComponentDropdown.xib in Resources */,
 				BB5A9C902CB64D4800F64C1F /* ComponentPaginationItem.xib in Resources */,
 				BB5A9C792CB64D4800F64C1F /* ComponentTabs.xib in Resources */,
@@ -1173,6 +1187,7 @@
 				BB5A9D042CB64D4800F64C1F /* ComponentSelect.swift in Sources */,
 				BB5A9D012CB64D4800F64C1F /* ComponentSelectZoomProperty.swift in Sources */,
 				BB5A9CFB2CB64D4800F64C1F /* ComponentDivider.swift in Sources */,
+				BBEECCE52D37A63200F2FBA8 /* ComponentProgressBigCircle.swift in Sources */,
 				BB5A9D182CB64D4800F64C1F /* ComponentPropertyInfo.swift in Sources */,
 				BB5A9D192CB64D4800F64C1F /* ComponentProperty.swift in Sources */,
 				BB5A9CFF2CB64D4800F64C1F /* ComponentSecureTextField.swift in Sources */,
@@ -1247,6 +1262,7 @@
 				BB5A9CD12CB64D4800F64C1F /* ComponentNavbarItemProperty.swift in Sources */,
 				BB5A9D1B2CB64D4800F64C1F /* ComponentLibrary.swift in Sources */,
 				BB40413D2D363EFF00186F52 /* ComponentGroupWindowController.swift in Sources */,
+				BBEECCDF2D37A12600F2FBA8 /* ComponentProgressWindowController.swift in Sources */,
 				BB5A9C962CB64D4800F64C1F /* ComponentCardFile.swift in Sources */,
 				BB5A9C7E2CB64D4800F64C1F /* ComponentSideBarItemProperty.swift in Sources */,
 				BB5A9CA92CB64D4800F64C1F /* ComponentProgressPopup.swift in Sources */,

+ 3 - 3
PDF Office/KMComponentLibrary/KMComponentLibrary/View/GroupItem/ComponentGroupWindowController.swift

@@ -16,15 +16,15 @@ class ComponentGroupWindow: NSWindow {
 }
 
 
-class ComponentGroupWindowController: NSWindowController {
+public class ComponentGroupWindowController: NSWindowController {
 
-    override func windowDidLoad() {
+    public override func windowDidLoad() {
         super.windowDidLoad()
 
         // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
     }
     
-    override func showWindow(_ sender: Any?) {
+    public override func showWindow(_ sender: Any?) {
         super.showWindow(sender)
         
         self.window?.backgroundColor = NSColor.red.withAlphaComponent(0.001)

+ 103 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressBigCircle.swift

@@ -0,0 +1,103 @@
+//
+//  ComponentProgressBigCircle.swift
+//  KMComponentLibrary
+//
+//  Created by Niehaoyu on 2025/1/15.
+//
+
+import Cocoa
+
+public class ComponentProgressBigCircle: ComponentBaseXibView {
+    
+    @IBOutlet var contendBox: NSBox!
+   
+    @IBOutlet var titleLabel: NSTextField!
+    
+    // MARK: Private Property
+    private var _properties : ComponentProgressProperty = ComponentProgressProperty()
+    
+    public override func draw(_ dirtyRect: NSRect) {
+        super.draw(dirtyRect)
+        
+        let radius = min(bounds.width, bounds.height) / 2
+        let center = CGPoint(x: bounds.midX, y: bounds.midY)
+        
+        let path = NSBezierPath()
+        path.appendArc(withCenter: center, radius: radius-2, startAngle: 90, endAngle: -360, clockwise: true)
+        
+        let color = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/bg-opacity-dark")
+        color.setStroke()
+        
+        path.lineWidth = 8
+        path.stroke()
+        
+        // 计算进度的起始和结束角度
+        let progress = properties.progress
+        let startAngle = 90.0 // 12点钟位置
+        let endAngle = -360.0 * progress + startAngle
+        
+        let progressPath = NSBezierPath()
+        progressPath.appendArc(withCenter: center, radius: radius-2, startAngle: startAngle, endAngle: endAngle, clockwise: true)
+        if let color = properties.propertyInfo.progressTipColor {
+            color.setStroke()
+        }
+        progressPath.lineWidth = 8
+        progressPath.stroke()
+        
+    }
+    
+    // MARK: 初始化
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+        
+    }
+    
+    public required init?(coder decoder: NSCoder) {
+        super.init(coder: decoder)
+        
+    }
+    
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+    }
+    
+    public override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        titleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
+        
+    }
+     
+    public var properties : ComponentProgressProperty {
+        get {
+            return _properties
+        }
+        set {
+            _properties = newValue
+            
+            ComponentLibrary.shared.configProgressComponent(properties: _properties)
+            
+            setupUI()
+            
+            refreshUI()
+        }
+    }
+    
+    //MARK: - SetupUI
+    func setupUI() {
+         
+    }
+    
+    func refreshUI() {
+        
+        titleLabel.stringValue = String(format: "%.0f%@", properties.progress*100,"%")
+        
+        display()
+    }
+    
+    public func reloadData() {
+        refreshUI()
+         
+    }
+}

+ 60 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressBigCircle.xib

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <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="ComponentProgressBigCircle" customModule="KMComponentLibrary" customModuleProvider="target">
+            <connections>
+                <outlet property="contendBox" destination="Dxl-3D-4XD" id="Op6-1v-60Z"/>
+                <outlet property="titleLabel" destination="tEd-i3-H2l" id="Jbd-jb-G9a"/>
+            </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="80" height="80"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Dxl-3D-4XD">
+                    <rect key="frame" x="0.0" y="0.0" width="80" height="80"/>
+                    <view key="contentView" id="cu5-It-Uyp">
+                        <rect key="frame" x="0.0" y="0.0" width="80" height="80"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tEd-i3-H2l">
+                                <rect key="frame" x="-2" y="32" width="84" height="16"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="80" id="FBu-gU-YdA"/>
+                                </constraints>
+                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="20%" id="U8h-lw-Stj">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="tEd-i3-H2l" firstAttribute="leading" secondItem="cu5-It-Uyp" secondAttribute="leading" id="6dM-g9-cXU"/>
+                            <constraint firstItem="tEd-i3-H2l" firstAttribute="centerY" secondItem="cu5-It-Uyp" secondAttribute="centerY" id="Eyx-g2-RPu"/>
+                            <constraint firstAttribute="trailing" secondItem="tEd-i3-H2l" secondAttribute="trailing" id="IiR-nX-u5X"/>
+                        </constraints>
+                    </view>
+                </box>
+            </subviews>
+            <constraints>
+                <constraint firstAttribute="trailing" secondItem="Dxl-3D-4XD" secondAttribute="trailing" id="Uha-Wu-R9n"/>
+                <constraint firstItem="Dxl-3D-4XD" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" id="gRA-69-Sth"/>
+                <constraint firstAttribute="bottom" secondItem="Dxl-3D-4XD" secondAttribute="bottom" id="h26-Wo-lyS"/>
+                <constraint firstItem="Dxl-3D-4XD" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="sZO-kw-Dsn"/>
+            </constraints>
+            <connections>
+                <outlet property="contendBox" destination="Dxl-3D-4XD" id="yEs-1C-pn8"/>
+                <outlet property="titleLabel" destination="tEd-i3-H2l" id="5Pt-Id-vfC"/>
+            </connections>
+            <point key="canvasLocation" x="132" y="-72"/>
+        </customView>
+    </objects>
+</document>

+ 6 - 2
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressProperty.swift

@@ -24,7 +24,8 @@ import AppKit
     case line_Progressing
     case line_Error
     case line_Success
-    case popup_Normal
+    case popup_Line
+    case popup_Circle
 }
 
 
@@ -35,6 +36,7 @@ public class ComponentProgressProperty: NSObject {
     public var progressSubType: componentProgressSubType = .circle_Waiting //子类型
     public var progress: CGFloat = 0 // 0-1
     public var titleString: String? //Popup类型中,提示语文字
+    public var cancelString: String? //popup弹窗中,取消按钮文字
     
     public var propertyInfo = ProgressPropertyInfo()
     
@@ -42,13 +44,15 @@ public class ComponentProgressProperty: NSObject {
                 progressType: componentProgressType = .circle,
                 subType: componentProgressSubType = .circle_Waiting,
                 progress: CGFloat = 0,
-                titleString: String = "") {
+                titleString: String? = nil,
+                cancelString: String? = nil) {
         
         self.size = size
         self.progressType = progressType
         self.progressSubType = subType
         self.progress = progress
         self.titleString = titleString
+        self.cancelString = cancelString
         
     }
 }

+ 108 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressWindowController.swift

@@ -0,0 +1,108 @@
+//
+//  ComponentProgressWindowController.swift
+//  KMComponentLibrary
+//
+//  Created by Niehaoyu on 2025/1/15.
+//
+
+import Cocoa
+
+public class ComponentProgressWindowController: NSWindowController {
+    
+    @IBOutlet var closeButton: ComponentButton!
+    @IBOutlet var progressView: ComponentProgressBigCircle!
+    @IBOutlet var progressBottomConst: NSLayoutConstraint!
+    
+    private var action: Selector?   // 点击事件
+    private weak var target: AnyObject? // 对象目标
+    
+    // MARK: Private Property
+    private var _properties : ComponentProgressProperty = ComponentProgressProperty()
+    
+    public override func windowDidLoad() {
+        super.windowDidLoad()
+        
+        // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
+        
+        setupUI()
+        
+        refreshUI()
+    }
+    
+    public class func windowController() -> ComponentProgressWindowController {
+        return ComponentProgressWindowController(windowNibName: "ComponentProgressWindowController")
+    }
+    
+    // MARK: 初始化
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+        
+    }
+    
+    public override func awakeFromNib() {
+        super.awakeFromNib()
+         
+    }
+    
+    public var properties : ComponentProgressProperty {
+        get {
+            return _properties
+        }
+        set {
+            _properties = newValue
+            
+            ComponentLibrary.shared.configProgressComponent(properties: _properties)
+            
+            setupUI()
+            
+            refreshUI()
+        }
+    }
+    
+    //MARK: - SetupUI
+    func setupUI() {
+        guard let _ = progressBottomConst else {
+            return
+        }
+        if let string = properties.cancelString {
+            progressBottomConst.constant = 40
+            closeButton.isHidden = false
+            
+            closeButton.properties = ComponentButtonProperty(type: .text_gray_low, size: .m, buttonText: string)
+            closeButton.setTarget(self, action: #selector(contendButtonClick(_:)))
+        } else {
+            progressBottomConst.constant = 0
+            closeButton.isHidden = true
+        }
+        
+        let properties: ComponentProgressProperty = ComponentProgressProperty.init(size: .m, progressType: .circle, subType: .circle_ProgressPercent, progress: 0)
+        progressView.properties = properties
+        
+    }
+    
+    func refreshUI() {
+        guard let _ = progressView else {
+            return
+        }
+        progressView.properties.progress = properties.progress
+        progressView.reloadData()
+        
+    }
+    
+    @objc func contendButtonClick(_ sender: Any) {
+        if let target = target, let action = action {
+            _ = target.perform(action, with: self)
+        }
+    }
+    
+    //MARK: - Public Method
+    public func reloadData() {
+        refreshUI()
+    }
+    
+    public func setTarget(_ target: AnyObject?, action: Selector?) {
+        self.target = target!
+        self.action = action!
+    }
+    
+}

+ 74 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressWindowController.xib

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <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="ComponentProgressWindowController" customModule="KMComponentLibrary" customModuleProvider="target">
+            <connections>
+                <outlet property="closeButton" destination="8Ob-jX-jVG" id="cwq-ay-Z8D"/>
+                <outlet property="progressBottomConst" destination="Y1D-au-7Ha" id="4V9-CZ-25X"/>
+                <outlet property="progressView" destination="upz-XI-abG" id="Ocy-HM-arQ"/>
+                <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="F0z-JX-Cv5">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="144" height="168"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <view key="contentView" id="se5-gp-TjO">
+                <rect key="frame" x="0.0" y="0.0" width="144" height="168"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="iFT-sL-5fP">
+                        <rect key="frame" x="0.0" y="40" width="144" height="128"/>
+                        <subviews>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="upz-XI-abG" customClass="ComponentProgressBigCircle" customModule="KMComponentLibrary" customModuleProvider="target">
+                                <rect key="frame" x="32" y="24" width="80" height="80"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="80" id="GTe-tp-dUi"/>
+                                    <constraint firstAttribute="height" constant="80" id="Mei-BE-7KC"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="upz-XI-abG" firstAttribute="centerY" secondItem="iFT-sL-5fP" secondAttribute="centerY" id="R2n-SV-EhO"/>
+                            <constraint firstItem="upz-XI-abG" firstAttribute="centerX" secondItem="iFT-sL-5fP" secondAttribute="centerX" id="YQt-YM-eIe"/>
+                        </constraints>
+                    </customView>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="8Ob-jX-jVG" customClass="ComponentButton" customModule="KMComponentLibrary" customModuleProvider="target">
+                        <rect key="frame" x="0.0" y="0.0" width="144" height="40"/>
+                    </customView>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="8R4-Qd-tn4" customClass="ComponentDivider" customModule="KMComponentLibrary" customModuleProvider="target">
+                        <rect key="frame" x="0.0" y="39" width="144" height="1"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="1" id="vOm-iz-r3s"/>
+                        </constraints>
+                    </customView>
+                </subviews>
+                <constraints>
+                    <constraint firstAttribute="trailing" secondItem="iFT-sL-5fP" secondAttribute="trailing" id="Ewq-3j-3RS"/>
+                    <constraint firstAttribute="trailing" secondItem="8Ob-jX-jVG" secondAttribute="trailing" id="OEv-Lr-pJT"/>
+                    <constraint firstAttribute="trailing" secondItem="8R4-Qd-tn4" secondAttribute="trailing" id="Qx8-Zx-7ix"/>
+                    <constraint firstItem="8Ob-jX-jVG" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="WdX-Ox-LDi"/>
+                    <constraint firstAttribute="bottom" secondItem="iFT-sL-5fP" secondAttribute="bottom" constant="40" id="Y1D-au-7Ha"/>
+                    <constraint firstAttribute="bottom" secondItem="8Ob-jX-jVG" secondAttribute="bottom" id="azF-YL-ydl"/>
+                    <constraint firstItem="iFT-sL-5fP" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="hyB-d1-dEE"/>
+                    <constraint firstItem="8R4-Qd-tn4" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="moM-Cc-nqq"/>
+                    <constraint firstItem="8Ob-jX-jVG" firstAttribute="top" secondItem="iFT-sL-5fP" secondAttribute="bottom" id="p4C-aE-D8T"/>
+                    <constraint firstItem="iFT-sL-5fP" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="vOg-f0-ORw"/>
+                    <constraint firstItem="8R4-Qd-tn4" firstAttribute="top" secondItem="iFT-sL-5fP" secondAttribute="bottom" id="veQ-1c-Ly4"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="139" y="118"/>
+        </window>
+    </objects>
+</document>

+ 19 - 4
PDF Office/PDF Master/KMClass/ComponentLibraryDemo/Demo/ProgressVC.swift

@@ -20,11 +20,12 @@ class ProgressVC: NSViewController {
     @IBOutlet weak var lineTypeBox: NSComboBox!
     
     @IBOutlet weak var progressPopup: ComponentProgressPopup!
-    
-    
+     
     var progressTimer: Timer?
     
     
+    var progressPopupWC: ComponentProgressWindowController = ComponentProgressWindowController.windowController()
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         // Do view setup here.
@@ -34,6 +35,7 @@ class ProgressVC: NSViewController {
         self.lineTypeBox.selectItem(at: 0)
         
         self.reloadData()
+        
     }
     
     func reloadData() {
@@ -93,16 +95,23 @@ class ProgressVC: NSViewController {
             self.progressTimer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(progressTimerAction), userInfo: nil, repeats: true)
         }
         
-        //Progress Popup
-        let popUpProperties: ComponentProgressProperty = ComponentProgressProperty.init(size: size, progressType: .popup, subType: .popup_Normal, progress: 0, titleString: "Progressing")
+        //Progress PopupLine
+        let popUpProperties: ComponentProgressProperty = ComponentProgressProperty.init(size: size, progressType: .popup, subType: .popup_Line, progress: 0, titleString: "Progressing")
         self.progressPopup.properties = popUpProperties
         
+        //Progress Popup
+        let popUpProgressProperties: ComponentProgressProperty = ComponentProgressProperty.init(size: size, progressType: .popup, subType: .popup_Circle, progress: 0, cancelString: "Cancel")
+        self.progressPopupWC.properties = popUpProgressProperties
     }
     
     @IBAction func boxAction(_ sender: Any) {
         self.reloadData()
     }
     
+    @IBAction func showProgressPopup(_ sender: Any) {
+        progressPopupWC.showWindow(nil)
+    }
+    
     @objc func progressTimerAction() {
         
         if self.progressCircle.properties.progressSubType == .circle_ProgressPercent ||
@@ -131,6 +140,12 @@ class ProgressVC: NSViewController {
         }
         self.progressPopup.reloadData()
         
+        self.progressPopupWC.properties.progress += 0.01
+        if self.progressPopupWC.properties.progress >= 1 {
+            self.progressPopupWC.properties.progress = 0
+        }
+        self.progressPopupWC.reloadData()
+        
     }
     
 }

+ 12 - 1
PDF Office/PDF Master/KMClass/ComponentLibraryDemo/Demo/ProgressVC.xib

@@ -76,6 +76,17 @@
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                 </textFieldCell>
                             </textField>
+                            <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iqJ-XO-tuK">
+                                <rect key="frame" x="14" y="13" width="73" height="32"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                <buttonCell key="cell" type="push" title="Popup" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="uTO-tt-37g">
+                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                    <font key="font" metaFont="system"/>
+                                </buttonCell>
+                                <connections>
+                                    <action selector="showProgressPopup:" target="-2" id="2yn-qa-BQg"/>
+                                </connections>
+                            </button>
                         </subviews>
                         <constraints>
                             <constraint firstItem="ZAn-gc-OVg" firstAttribute="leading" secondItem="TLV-N6-t1L" secondAttribute="leading" constant="20" id="A4O-ZS-ZLi"/>
@@ -259,7 +270,7 @@
                 <constraint firstItem="THv-1X-fiB" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="bH2-cC-P1W"/>
                 <constraint firstAttribute="bottom" secondItem="nc3-EK-V3J" secondAttribute="bottom" id="t8v-P7-qr7"/>
             </constraints>
-            <point key="canvasLocation" x="278" y="205"/>
+            <point key="canvasLocation" x="232" y="356"/>
         </customView>
     </objects>
 </document>

+ 54 - 49
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -4439,55 +4439,60 @@ extension KMMainViewController: KMEditToolbarViewDelegate {
     }
     
     func kmEditToolbarViewDidChooseApply(_ view: KMEditToolbarView) {
-        //        let pageIndex = view.getSelectedPageIndex(listView.document)
-        //        if pageIndex.isEmpty {
-        //            let alert = NSAlert()
-        //            alert.alertStyle = .critical
-        //            alert.messageText = KMLocalizedString("Invalid page range or the page number is out of range. Please try again.")
-        //            alert.runModal()
-        //            return
-        //        }
-        //        let pageString = view.getSelectedPageString(listView.document, pageIndex)
-        //
-        //        if view.editType == .watermark {
-        //            if let model = watermarkViewController?.currentWatermarkData {
-        //                let watermark = KMPDFWatermarkData.returnWaterMarkWith(model, listView.document)
-        //                watermark.pageString = pageString
-        //                listView.document.addWatermark(watermark)
-        //                listView.layoutDocumentView()
-        //            }
-        //            exitEditToolbarView()
-        //        } else if view.editType == .background {
-        //            if let model = backgroundViewController?.backgroundModel {
-        //                if let background = listView.document.background() {
-        //                    KMBackgroundManager.defaultManager.updateBackground(background, withModel: model)
-        //                    background.pageString = pageString
-        //                    background.update()
-        //
-        //                    listView.document?.refreshPageData()
-        //                    listView.layoutDocumentView()
-        //                }
-        //            }
-        //            exitEditToolbarView()
-        //
-        //        } else if view.editType == .header_Footer {
-        //            if let model = headerFooterViewController?.headerFooterModel {
-        //                if let headerFooter = listView.document.headerFooter() {
-        //                    KMHeaderFooterManager.defaultManager.updateCPDFHeaderFooter(headerFooter, withModel: model, Int(listView.document.pageCount))
-        //                    headerFooter.pageString = pageString
-        //                    headerFooter.update()
-        //
-        //                    listView.document?.refreshPageData()
-        //                    listView.layoutDocumentView()
-        //                }
-        //            }
-        //
-        //            exitEditToolbarView()
-        //
-        //        } else if view.editType == .bates {
-        //            exitEditToolbarView()
-        //
-        //        }
+        let pageInfo = view.pageRangeSelectView.getSelectedPageIndex(listView.document)
+        let pageIndex = pageInfo.0
+        let isCurrentPage = pageInfo.1
+        
+        if pageIndex.isEmpty {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = KMLocalizedString("Invalid page range or the page number is out of range. Please try again.")
+            alert.runModal()
+            return
+        }
+        let pageString = view.pageRangeSelectView.getSelectedPageString(listView.document, pageIndex)
+        if isCurrentPage {
+            
+        }
+        if view.editType == .watermark {
+            if let model = watermarkViewController?.currentWatermarkData {
+                let watermark = KMPDFWatermarkData.returnWaterMarkWith(model, listView.document)
+                watermark.pageString = pageString
+                listView.document.addWatermark(watermark)
+                listView.layoutDocumentView()
+            }
+            exitEditToolbarView()
+        } else if view.editType == .background {
+            if let model = backgroundViewController?.backgroundModel {
+                if let background = listView.document.background() {
+                    KMBackgroundManager.defaultManager.updateBackground(background, withModel: model)
+                    background.pageString = pageString
+                    background.update()
+                    
+                    listView.document?.refreshPageData()
+                    listView.layoutDocumentView()
+                }
+            }
+            exitEditToolbarView()
+            
+        } else if view.editType == .header_Footer {
+            if let model = headerFooterViewController?.headerFooterModel {
+                if let headerFooter = listView.document.headerFooter() {
+                    KMHeaderFooterManager.defaultManager.updateCPDFHeaderFooter(headerFooter, withModel: model, Int(listView.document.pageCount))
+                    headerFooter.pageString = pageString
+                    headerFooter.update()
+                    
+                    listView.document?.refreshPageData()
+                    listView.layoutDocumentView()
+                }
+            }
+            
+            exitEditToolbarView()
+            
+        } else if view.editType == .bates {
+            exitEditToolbarView()
+            
+        }
         
     }
     

+ 1 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/OCR/Tool/View/ProgressMask/KMOCRProgressView.swift

@@ -21,7 +21,7 @@ class KMOCRProgressView: BaseXibView {
     
     func updateUI() {
         //Progress Popup
-        let popUpProperties: ComponentProgressProperty = ComponentProgressProperty.init(size: .m, progressType: .popup, subType: .popup_Normal, progress: 0, titleString: "Progressing")
+        let popUpProperties: ComponentProgressProperty = ComponentProgressProperty.init(size: .m, progressType: .popup, subType: .popup_Line, progress: 0, titleString: "Progressing")
         self.progressView.properties = popUpProperties
     }