Quellcode durchsuchen

【2025】【压缩】设置组件库接入

lizhe vor 3 Monaten
Ursprung
Commit
87f1baa832

+ 8 - 0
PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressSettingViewController.swift

@@ -6,6 +6,7 @@
 //
 
 import Cocoa
+import KMComponentLibrary
 
 typealias KMCompressSettingViewControllerCancelAction = (_ controller: KMCompressSettingViewController ) -> Void
 typealias KMCompressSettingViewControllerDoneAction = (_ controller: KMCompressSettingViewController ) -> Void
@@ -14,6 +15,7 @@ class KMCompressSettingViewController: KMBaseViewController {
     @IBOutlet weak var doneButton: KMButton!
     @IBOutlet weak var cancelButton: KMButton!
     @IBOutlet weak var settingView: KMCompressSettingTableView!
+    @IBOutlet weak var titleLabel: NSTextField!
     
     private var toastViews: [NSView] = [] // 用于管理多个 alertView
     
@@ -48,6 +50,12 @@ class KMCompressSettingViewController: KMBaseViewController {
 //        }
     }
     
+    func updateUI() {
+        self.titleLabel.stringValue = KMLocalizedString("Advanced Compress Settings", comment: "")
+        self.titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        //ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
+    }
+    
     func reloadData() {
         self.settingView.model = model
     }

+ 27 - 5
PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressSettingViewController.xib

@@ -11,6 +11,7 @@
                 <outlet property="cancelButton" destination="sVB-3V-Y0k" id="WuD-aB-uY1"/>
                 <outlet property="doneButton" destination="eVt-ve-VmB" id="6fM-1p-W9A"/>
                 <outlet property="settingView" destination="fbx-YC-qHs" id="vb6-gh-2ej"/>
+                <outlet property="titleLabel" destination="G5g-e3-dep" id="Wld-A7-Ihl"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
             </connections>
         </customObject>
@@ -21,7 +22,7 @@
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="fbx-YC-qHs" customClass="KMCompressSettingTableView" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                    <rect key="frame" x="0.0" y="64" width="624" height="441"/>
+                    <rect key="frame" x="8" y="64" width="608" height="405"/>
                 </customView>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sVB-3V-Y0k" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                     <rect key="frame" x="386" y="13" width="76" height="32"/>
@@ -49,18 +50,39 @@ DQ
                         </connections>
                     </buttonCell>
                 </button>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="piB-Gy-QCa">
+                    <rect key="frame" x="0.0" y="469" width="624" height="44"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="G5g-e3-dep">
+                            <rect key="frame" x="22" y="14" width="195" height="17"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Advanced Compress Settings" id="W7u-OP-0l7">
+                                <font key="font" metaFont="system" size="14"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="44" id="GoK-Nw-rLp"/>
+                        <constraint firstItem="G5g-e3-dep" firstAttribute="centerY" secondItem="piB-Gy-QCa" secondAttribute="centerY" id="Nup-Jg-u2y"/>
+                        <constraint firstItem="G5g-e3-dep" firstAttribute="leading" secondItem="piB-Gy-QCa" secondAttribute="leading" constant="24" id="tj2-Eu-hQt"/>
+                    </constraints>
+                </customView>
             </subviews>
             <constraints>
-                <constraint firstAttribute="trailing" secondItem="fbx-YC-qHs" secondAttribute="trailing" id="A1Z-3W-rxf"/>
+                <constraint firstItem="piB-Gy-QCa" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="3q3-Vc-eDr"/>
+                <constraint firstAttribute="trailing" secondItem="fbx-YC-qHs" secondAttribute="trailing" constant="8" id="A1Z-3W-rxf"/>
+                <constraint firstAttribute="trailing" secondItem="piB-Gy-QCa" secondAttribute="trailing" id="Htf-hL-aJj"/>
                 <constraint firstAttribute="bottom" secondItem="fbx-YC-qHs" secondAttribute="bottom" constant="64" id="J3x-rf-L9f"/>
                 <constraint firstAttribute="bottom" secondItem="eVt-ve-VmB" secondAttribute="bottom" constant="20" id="KCi-BI-FJQ"/>
                 <constraint firstAttribute="trailing" secondItem="eVt-ve-VmB" secondAttribute="trailing" constant="20" id="L0M-fU-M18"/>
+                <constraint firstItem="fbx-YC-qHs" firstAttribute="top" secondItem="piB-Gy-QCa" secondAttribute="bottom" id="L4B-cj-XJS"/>
                 <constraint firstItem="eVt-ve-VmB" firstAttribute="leading" secondItem="sVB-3V-Y0k" secondAttribute="trailing" constant="8" id="Okp-Tv-xiQ"/>
-                <constraint firstItem="fbx-YC-qHs" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="8" id="ckJ-fE-0nn"/>
-                <constraint firstItem="fbx-YC-qHs" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="mLG-xd-Co3"/>
+                <constraint firstItem="piB-Gy-QCa" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="dEZ-w3-4Bg"/>
+                <constraint firstItem="fbx-YC-qHs" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="8" id="mLG-xd-Co3"/>
                 <constraint firstItem="sVB-3V-Y0k" firstAttribute="centerY" secondItem="eVt-ve-VmB" secondAttribute="centerY" id="t0w-fU-UlE"/>
             </constraints>
-            <point key="canvasLocation" x="122" y="122"/>
+            <point key="canvasLocation" x="122" y="121.5"/>
         </customView>
     </objects>
 </document>

+ 28 - 17
PDF Office/PDF Master/Class/PDFTools/Compress/View/KMCompressContentView.swift

@@ -15,7 +15,10 @@ class KMCompressContentView: BaseXibView {
     @IBOutlet weak var mobileButton: ComponentRadio!
     @IBOutlet weak var customButton: ComponentRadio!
     @IBOutlet weak var tipButton: ComponentToolTipsHelp!
-    @IBOutlet weak var settingButton: ComponentButton!
+    @IBOutlet weak var settingButton: NSButton!
+    
+    @IBOutlet weak var mobileWidthConstraint: NSLayoutConstraint!
+    @IBOutlet weak var customButtonWidthConstraint: NSLayoutConstraint!
     
     
     
@@ -47,11 +50,12 @@ class KMCompressContentView: BaseXibView {
         standardButton.properties.text = KMLocalizedString("Standard (Recommend)", comment: "")
         mobileButton.properties.text = KMLocalizedString("Mobile", comment: "")
         customButton.properties.text = KMLocalizedString("Custom", comment: "")
+        settingButton.stringValue = KMLocalizedString("Setting", comment: "")
         tipButton.toolTip = KMLocalizedString("This mode is specifically tuned for mobile devices to improve compression quality and ensure clear viewing on mobile devices.", comment: "")
     }
     
     override func updateUIThemeColor() {
-       
+        settingButton.setTitleColor(NSColor(hex: "#1EB3F9"))
     }
     
     func updateUI() {
@@ -60,9 +64,11 @@ class KMCompressContentView: BaseXibView {
         
         mobileButton.properties = ComponentCheckBoxProperty(size: .s, text: KMLocalizedString("Mobile", comment: ""), checkboxType: .normal)
         mobileButton.setTarget(self, action: #selector(mobileButtonAction(_:)))
+        mobileWidthConstraint.constant = mobileButton.properties.propertyInfo.viewWidth
         
         customButton.properties = ComponentCheckBoxProperty(size: .s, text: KMLocalizedString("Custom", comment: ""), checkboxType: .normal)
         customButton.setTarget(self, action: #selector(customButtonAction(_:)))
+        customButtonWidthConstraint.constant = mobileButton.properties.propertyInfo.viewWidth
         
 //        self.tipButton.mouseMoveCallback = {[unowned self] mouseEntered in
 //            if mouseEntered {
@@ -90,23 +96,28 @@ class KMCompressContentView: BaseXibView {
     }
     
     func updateType(type: KMCompressModelsType) {
-//        self.standardButton.state = .off
-//        self.mobileButton.state = .off
-//        self.customButton.state = .off
-//        
-//        switch type {
-//        case .standard:
-//            self.standardButton.state = .on
-//        case .custom:
-//            self.customButton.state = .on
-//        case .mobile:
-//            self.mobileButton.state = .on
-//        }
+        self.standardButton.properties.checkboxType = .normal
+        self.mobileButton.properties.checkboxType = .normal
+        self.customButton.properties.checkboxType = .normal
+        
+        
+        switch type {
+        case .standard:
+            self.standardButton.properties.checkboxType = .selected
+        case .custom:
+            self.customButton.properties.checkboxType = .selected
+        case .mobile:
+            self.mobileButton.properties.checkboxType = .selected
+        }
+        
+        self.standardButton.reloadData()
+        self.mobileButton.reloadData()
+        self.customButton.reloadData()
     }
 }
 
 extension KMCompressContentView {
-    @IBAction func standardButtonAction(_ sender: Any) {
+    func standardButtonAction(_ sender: Any) {
         self.updateType(type: .standard)
         self.model = KMCompressSettingModel(modelsType: .standard)
         
@@ -115,7 +126,7 @@ extension KMCompressContentView {
         callBack(self, model)
     }
     
-    @IBAction func mobileButtonAction(_ sender: Any) {
+    func mobileButtonAction(_ sender: Any) {
         self.updateType(type: .mobile)
         self.model = KMCompressSettingModel(modelsType: .mobile)
         
@@ -124,7 +135,7 @@ extension KMCompressContentView {
         callBack(self, model)
     }
     
-    @IBAction func customButtonAction(_ sender: Any) {
+    func customButtonAction(_ sender: Any) {
         self.updateType(type: .custom)
         self.model = KMCompressSettingModel(modelsType: .custom)
         

+ 21 - 13
PDF Office/PDF Master/Class/PDFTools/Compress/View/KMCompressContentView.xib

@@ -9,8 +9,10 @@
         <customObject id="-2" userLabel="File's Owner" customClass="KMCompressContentView" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="customButton" destination="gWa-hw-0bO" id="QwU-Nb-fcP"/>
+                <outlet property="customButtonWidthConstraint" destination="cWH-Sm-AfH" id="9ys-va-O8W"/>
                 <outlet property="mobileButton" destination="Ctq-Cv-ou7" id="iYc-dp-9Dq"/>
-                <outlet property="settingButton" destination="fNC-L9-RqZ" id="2cg-oi-lWZ"/>
+                <outlet property="mobileWidthConstraint" destination="HA1-qa-7VH" id="h3S-yK-dPn"/>
+                <outlet property="settingButton" destination="F4n-mk-qNu" id="i1w-ea-Bib"/>
                 <outlet property="standardButton" destination="M9F-FB-ZLS" id="vXv-hh-DMm"/>
                 <outlet property="tipButton" destination="DsW-Ey-8zU" id="0jc-W7-lae"/>
             </connections>
@@ -31,9 +33,9 @@
                             </constraints>
                         </customView>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="Ctq-Cv-ou7" customClass="ComponentRadio" customModule="KMComponentLibrary">
-                            <rect key="frame" x="0.0" y="208" width="89" height="32"/>
+                            <rect key="frame" x="0.0" y="208" width="72" height="32"/>
                             <constraints>
-                                <constraint firstAttribute="width" constant="89" id="HA1-qa-7VH"/>
+                                <constraint firstAttribute="width" constant="72" id="HA1-qa-7VH"/>
                                 <constraint firstAttribute="height" constant="32" id="egE-Bb-hZ3"/>
                             </constraints>
                         </customView>
@@ -44,33 +46,39 @@
                                 <constraint firstAttribute="width" constant="136" id="cWH-Sm-AfH"/>
                             </constraints>
                         </customView>
-                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="fNC-L9-RqZ" customClass="ComponentButton" customModule="KMComponentLibrary">
-                            <rect key="frame" x="144" y="176" width="51" height="32"/>
-                            <constraints>
-                                <constraint firstAttribute="height" constant="32" id="MlJ-yJ-Jbe"/>
-                                <constraint firstAttribute="width" constant="51" id="zc9-u6-v8i"/>
-                            </constraints>
-                        </customView>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="DsW-Ey-8zU" customClass="ComponentToolTipsHelp" customModule="KMComponentLibrary">
-                            <rect key="frame" x="97" y="216" width="16" height="16"/>
+                            <rect key="frame" x="80" y="216" width="16" height="16"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="16" id="mob-mo-nHb"/>
                                 <constraint firstAttribute="width" constant="16" id="qj4-cT-m6e"/>
                             </constraints>
                         </customView>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="F4n-mk-qNu">
+                            <rect key="frame" x="144" y="176" width="48" height="32"/>
+                            <buttonCell key="cell" type="square" title="Setting" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="lqE-4t-QfF">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="32" id="Ae0-dw-jgg"/>
+                            </constraints>
+                            <connections>
+                                <action selector="settingButtonAction:" target="-2" id="It1-sU-hii"/>
+                            </connections>
+                        </button>
                     </subviews>
                     <constraints>
                         <constraint firstItem="Ctq-Cv-ou7" firstAttribute="top" secondItem="M9F-FB-ZLS" secondAttribute="bottom" id="6cQ-Ez-tCa"/>
-                        <constraint firstItem="fNC-L9-RqZ" firstAttribute="leading" secondItem="gWa-hw-0bO" secondAttribute="trailing" constant="8" id="Def-R4-KRV"/>
                         <constraint firstItem="M9F-FB-ZLS" firstAttribute="leading" secondItem="YC0-pH-jJZ" secondAttribute="leading" id="Oql-Wm-50b"/>
                         <constraint firstItem="DsW-Ey-8zU" firstAttribute="leading" secondItem="Ctq-Cv-ou7" secondAttribute="trailing" constant="8" id="QaS-S3-iIy"/>
                         <constraint firstItem="gWa-hw-0bO" firstAttribute="leading" secondItem="YC0-pH-jJZ" secondAttribute="leading" id="Rlk-ZK-88J"/>
-                        <constraint firstItem="fNC-L9-RqZ" firstAttribute="centerY" secondItem="gWa-hw-0bO" secondAttribute="centerY" id="TEC-td-uZE"/>
                         <constraint firstItem="Ctq-Cv-ou7" firstAttribute="leading" secondItem="YC0-pH-jJZ" secondAttribute="leading" id="cY2-qR-QT5"/>
                         <constraint firstItem="gWa-hw-0bO" firstAttribute="top" secondItem="Ctq-Cv-ou7" secondAttribute="bottom" id="iwc-RF-2XX"/>
                         <constraint firstItem="DsW-Ey-8zU" firstAttribute="centerY" secondItem="Ctq-Cv-ou7" secondAttribute="centerY" id="jtE-A9-fYu"/>
                         <constraint firstAttribute="trailing" secondItem="M9F-FB-ZLS" secondAttribute="trailing" id="kD0-KP-QD7"/>
                         <constraint firstItem="M9F-FB-ZLS" firstAttribute="top" secondItem="YC0-pH-jJZ" secondAttribute="top" id="o1O-de-gEW"/>
+                        <constraint firstItem="F4n-mk-qNu" firstAttribute="leading" secondItem="gWa-hw-0bO" secondAttribute="trailing" constant="8" id="oxH-QE-Ja3"/>
+                        <constraint firstItem="F4n-mk-qNu" firstAttribute="centerY" secondItem="gWa-hw-0bO" secondAttribute="centerY" id="qKF-OR-MLl"/>
                     </constraints>
                 </customView>
             </subviews>

+ 11 - 5
PDF Office/PDF Master/Class/PDFTools/Compress/View/KMCompressView.xib

@@ -61,7 +61,10 @@
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
                                                 <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JF7-f4-ihM">
-                                                    <rect key="frame" x="118" y="50" width="4" height="17"/>
+                                                    <rect key="frame" x="118" y="44" width="4" height="20"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="20" id="EAt-8m-Nxn"/>
+                                                    </constraints>
                                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="whk-Hu-7q8">
                                                         <font key="font" metaFont="system" size="14"/>
                                                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -69,13 +72,16 @@
                                                     </textFieldCell>
                                                 </textField>
                                                 <progressIndicator wantsLayer="YES" maxValue="100" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="rI6-3z-z33">
-                                                    <rect key="frame" x="120" y="16" width="240" height="20"/>
+                                                    <rect key="frame" x="120" y="10" width="240" height="20"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" constant="240" id="r9M-rs-3WM"/>
                                                     </constraints>
                                                 </progressIndicator>
                                                 <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="feZ-ij-cjM">
-                                                    <rect key="frame" x="118" y="75" width="298" height="17"/>
+                                                    <rect key="frame" x="118" y="72" width="298" height="20"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="20" id="B8h-pT-kq1"/>
+                                                    </constraints>
                                                     <textFieldCell key="cell" truncatesLastVisibleLine="YES" sendsActionOnEndEditing="YES" id="He2-H0-3Up">
                                                         <font key="font" metaFont="system" size="14"/>
                                                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -83,7 +89,7 @@
                                                     </textFieldCell>
                                                 </textField>
                                                 <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AVp-B0-LcQ">
-                                                    <rect key="frame" x="134" y="51" width="4" height="16"/>
+                                                    <rect key="frame" x="134" y="46" width="4" height="16"/>
                                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="XEA-VF-Y0d">
                                                         <font key="font" metaFont="system"/>
                                                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -91,7 +97,7 @@
                                                     </textFieldCell>
                                                 </textField>
                                                 <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qSB-Az-aee">
-                                                    <rect key="frame" x="373" y="18" width="4" height="16"/>
+                                                    <rect key="frame" x="373" y="12" width="4" height="16"/>
                                                     <textFieldCell key="cell" lineBreakMode="clipping" id="jbV-Qh-AnI">
                                                         <font key="font" metaFont="system"/>
                                                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>

+ 8 - 8
PDF Office/PDF Master/Class/PDFTools/Compress/View/SettingView/View/Tableview/Base/KMBaseCompressTableCellView.swift

@@ -58,14 +58,14 @@ class KMBaseCompressTableCellView: NSTableCellView {
     }
     
     func updateUI() {
-        guard let buttonConetntView = self.buttonConetntView else { return }
-        buttonConetntView.wantsLayer = true
-        buttonConetntView.layer?.cornerRadius = 6
-        if KMAppearance.isDarkMode() {
-            buttonConetntView.layer?.backgroundColor = NSColor(hex: "#424345").cgColor
-        } else {
-            buttonConetntView.layer?.backgroundColor = NSColor(hex: "#EAECF2").cgColor
-        }
+//        guard let buttonConetntView = self.buttonConetntView else { return }
+//        buttonConetntView.wantsLayer = true
+//        buttonConetntView.layer?.cornerRadius = 6
+//        if KMAppearance.isDarkMode() {
+//            buttonConetntView.layer?.backgroundColor = NSColor(hex: "#424345").cgColor
+//        } else {
+//            buttonConetntView.layer?.backgroundColor = NSColor(hex: "#EAECF2").cgColor
+//        }
     }
     
     func resetData() {

+ 31 - 15
PDF Office/PDF Master/Class/PDFTools/Compress/View/SettingView/View/Tableview/Cell/KMCompressDiscardPanelTableCellView.swift

@@ -6,6 +6,7 @@
 //
 
 import Cocoa
+import KMComponentLibrary
 
 class KMCompressDiscardPanelTableCellView: KMBaseCompressTableCellView, NibLoadable {
 
@@ -39,7 +40,7 @@ class KMCompressDiscardPanelTableCellView: KMBaseCompressTableCellView, NibLoada
         guard let model = model else { return }
         
         for button in self.buttonConetntView.subviews {
-            (button as? NSButton)?.state = .off // 重置所有按钮状态为 .off
+            (button as? ComponentCheckBox)?.properties.checkboxType = .normal // 重置所有按钮状态
         }
 
         // 定义选项与按钮标签的映射关系
@@ -69,8 +70,9 @@ class KMCompressDiscardPanelTableCellView: KMBaseCompressTableCellView, NibLoada
         // 更新按钮状态
         if let options = optionsMap[model.type] {
             for (tag, isSelected) in options where isSelected as? Bool == true {
-                if let button = self.buttonConetntView.viewWithTag(tag) as? NSButton {
-                    button.state = .on
+                if let button = self.buttonConetntView.viewWithTag(tag) as? ComponentCheckBox {
+                    button.properties.checkboxType = .selected
+                    button.reloadData()
                 }
             }
         }
@@ -83,25 +85,39 @@ class KMCompressDiscardPanelTableCellView: KMBaseCompressTableCellView, NibLoada
         let array = model.content as? Array<String>
         if array?.count != 0 {
             for (index, string) in array!.enumerated() {
-                let radioButton = NSButton(checkboxWithTitle: KMLocalizedString(string, comment: ""), target: self, action: #selector(buttonAction))
-                radioButton.frame = CGRectMake(16,
-                                               self.buttonConetntView.bounds.height - (CGFloat(index * (12 + 16)) + 12) - 16,
-                                               self.bounds.width,
-                                               16)
-                radioButton.tag = index
-                radioButton.translatesAutoresizingMaskIntoConstraints = false
-                self.buttonConetntView.addSubview(radioButton)
+                let button = ComponentCheckBox()
+                button.properties = ComponentCheckBoxProperty(size: .s,
+                                                              state: .normal,
+                                                              isDisabled: false,
+                                                              showhelp: false,
+                                                              text: KMLocalizedString(string, comment: ""),
+                                                              checkboxType: .normal)
+                button.setTarget(self, action: #selector(buttonAction(_:)))
+                button.viewTag = index
+                button.frame = CGRectMake(0,
+                                          self.buttonConetntView.bounds.height - CGFloat(index * 32) - 32,
+                                          self.bounds.width,
+                                          32)
+                self.buttonConetntView.addSubview(button)
+//                let radioButton = NSButton(checkboxWithTitle: KMLocalizedString(string, comment: ""), target: self, action: #selector(buttonAction))
+//                radioButton.frame = CGRectMake(16,
+//                                               self.buttonConetntView.bounds.height - (CGFloat(index * (12 + 16)) + 12) - 16,
+//                                               self.bounds.width,
+//                                               16)
+//                radioButton.tag = index
+//                radioButton.translatesAutoresizingMaskIntoConstraints = false
+//                self.buttonConetntView.addSubview(radioButton)
             }
         }
         self.reloadData()
     }
     
-    @objc func buttonAction(sender: NSButton) {
+    @objc func buttonAction(_ sender: ComponentCheckBox) {
         guard let data = data else { return }
         guard let model = model else { return }
         
         if model.type == .discardObject {
-            switch sender.tag {
+            switch sender.viewTag {
             case 0: toggleOption(.formAndAction, in: &data.objectOptions)
             case 1: toggleOption(.javaScript, in: &data.objectOptions)
             case 2: toggleOption(.thumbnails, in: &data.objectOptions)
@@ -111,7 +127,7 @@ class KMCompressDiscardPanelTableCellView: KMBaseCompressTableCellView, NibLoada
             }
         }
         if model.type == .discardUserData {
-            switch sender.tag {
+            switch sender.viewTag {
             case 0: toggleOption(.commentsFormAndMultimedia, in: &data.userDataOptions)
             case 1: toggleOption(.documentInfomationAndMetadata, in: &data.userDataOptions)
             case 2: toggleOption(.allObject, in: &data.userDataOptions)
@@ -122,7 +138,7 @@ class KMCompressDiscardPanelTableCellView: KMBaseCompressTableCellView, NibLoada
         }
         
         if model.type == .discardOtherData {
-            switch sender.tag {
+            switch sender.viewTag {
             case 0: toggleOption(.invalidBookmarks, in: &data.otherDataOptions)
             case 1: toggleOption(.invalidLinks, in: &data.otherDataOptions)
             case 2: toggleOption(.unrefrencedNamedDestinations, in: &data.otherDataOptions)

+ 24 - 13
PDF Office/PDF Master/Class/PDFTools/Compress/View/SettingView/View/Tableview/Cell/KMCompressDiscardPanelTableCellView.xib

@@ -13,25 +13,36 @@
             <rect key="frame" x="0.0" y="0.0" width="480" height="176"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
-                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0bg-Yr-4UM">
-                    <rect key="frame" x="-2" y="156" width="142" height="16"/>
-                    <textFieldCell key="cell" lineBreakMode="clipping" title="Discard Objects Panel:" id="5l1-4d-VTL">
-                        <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>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="lI3-GQ-szS">
-                    <rect key="frame" x="0.0" y="24" width="480" height="126"/>
+                    <rect key="frame" x="0.0" y="16" width="480" height="120"/>
+                </customView>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="tOL-4M-ebo">
+                    <rect key="frame" x="0.0" y="136" width="480" height="40"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0bg-Yr-4UM">
+                            <rect key="frame" x="-2" y="12" width="142" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Discard Objects Panel:" id="5l1-4d-VTL">
+                                <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="0bg-Yr-4UM" firstAttribute="leading" secondItem="tOL-4M-ebo" secondAttribute="leading" id="CCe-ps-NSB"/>
+                        <constraint firstItem="0bg-Yr-4UM" firstAttribute="centerY" secondItem="tOL-4M-ebo" secondAttribute="centerY" id="FGF-on-SlE"/>
+                        <constraint firstAttribute="height" constant="40" id="mO8-dq-AlN"/>
+                    </constraints>
                 </customView>
             </subviews>
             <constraints>
-                <constraint firstItem="lI3-GQ-szS" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="26" id="7dU-0G-QRQ"/>
+                <constraint firstItem="lI3-GQ-szS" firstAttribute="top" secondItem="tOL-4M-ebo" secondAttribute="bottom" id="0Xo-cE-nNg"/>
+                <constraint firstAttribute="trailing" secondItem="tOL-4M-ebo" secondAttribute="trailing" id="16J-hq-en6"/>
+                <constraint firstItem="tOL-4M-ebo" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" id="3eH-Ye-XWu"/>
+                <constraint firstItem="tOL-4M-ebo" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="5eq-vL-DhJ"/>
                 <constraint firstAttribute="trailing" secondItem="lI3-GQ-szS" secondAttribute="trailing" id="Unb-7L-5rD"/>
-                <constraint firstItem="0bg-Yr-4UM" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="4" id="XPR-A3-raq"/>
                 <constraint firstItem="lI3-GQ-szS" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="h8l-jj-3FF"/>
-                <constraint firstItem="0bg-Yr-4UM" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="hBz-hQ-5Y8"/>
-                <constraint firstAttribute="bottom" secondItem="lI3-GQ-szS" secondAttribute="bottom" constant="24" id="ops-h8-UXT"/>
+                <constraint firstAttribute="bottom" secondItem="lI3-GQ-szS" secondAttribute="bottom" constant="16" id="ops-h8-UXT"/>
             </constraints>
             <connections>
                 <outlet property="buttonConetntView" destination="lI3-GQ-szS" id="C7z-yi-0Gv"/>

+ 6 - 6
PDF Office/PDF Master/Class/PDFTools/Compress/View/SettingView/View/Tableview/Cell/KMCompressModesTableCellView.xib

@@ -10,14 +10,14 @@
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <customView id="c22-O7-iKe" customClass="KMCompressModesTableCellView" customModule="PDF_Reader_Pro" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="480" height="48"/>
+            <rect key="frame" x="0.0" y="0.0" width="480" height="52"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="yHv-cb-JkX">
-                    <rect key="frame" x="0.0" y="16" width="480" height="32"/>
+                    <rect key="frame" x="0.0" y="16" width="480" height="28"/>
                     <subviews>
                         <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Odo-EZ-jmE">
-                            <rect key="frame" x="-2" y="8" width="52" height="16"/>
+                            <rect key="frame" x="-2" y="6" width="52" height="16"/>
                             <textFieldCell key="cell" lineBreakMode="clipping" title="Modes:" id="AoX-wh-vIK">
                                 <font key="font" usesAppearanceFont="YES"/>
                                 <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -25,7 +25,7 @@
                             </textFieldCell>
                         </textField>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="4La-y1-wWt" customClass="ComponentSelect" customModule="KMComponentLibrary">
-                            <rect key="frame" x="56" y="0.0" width="314" height="32"/>
+                            <rect key="frame" x="56" y="-2" width="314" height="32"/>
                             <constraints>
                                 <constraint firstAttribute="width" constant="314" id="3ga-2o-Fu7"/>
                                 <constraint firstAttribute="height" constant="32" id="Qcw-Fb-wDj"/>
@@ -43,14 +43,14 @@
             <constraints>
                 <constraint firstItem="yHv-cb-JkX" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="CgS-3w-uEB"/>
                 <constraint firstAttribute="trailing" secondItem="yHv-cb-JkX" secondAttribute="trailing" id="e08-YC-A6t"/>
-                <constraint firstItem="yHv-cb-JkX" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" id="ee5-SS-cOo"/>
+                <constraint firstItem="yHv-cb-JkX" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="8" id="ee5-SS-cOo"/>
                 <constraint firstAttribute="bottom" secondItem="yHv-cb-JkX" secondAttribute="bottom" constant="16" id="vjT-XX-HY8"/>
             </constraints>
             <connections>
                 <outlet property="modesButton" destination="4La-y1-wWt" id="qYF-A0-D5H"/>
                 <outlet property="titleLabel" destination="Odo-EZ-jmE" id="3Ko-Zp-cC5"/>
             </connections>
-            <point key="canvasLocation" x="132" y="29"/>
+            <point key="canvasLocation" x="132" y="31"/>
         </customView>
     </objects>
 </document>

+ 6 - 6
PDF Office/PDF Master/Class/PDFTools/Compress/View/SettingView/View/Tableview/KMCompressSettingTableView.swift

@@ -36,26 +36,26 @@ class KMCompressSettingTableView: BaseXibView {
         
         var cellModel = KMCompressSettingCellModel()
         cellModel.title = KMLocalizedString("Models", comment: "")
-        cellModel.heightOfRow = 48
+        cellModel.heightOfRow = 56
         self.datas.append(cellModel)
         
         cellModel = KMCompressSettingCellModel()
         cellModel.type = .images
         cellModel.title = KMLocalizedString("Image Panel", comment: "")
-        cellModel.heightOfRow = 90
+        cellModel.heightOfRow = 128
         self.datas.append(cellModel)
         
         cellModel = KMCompressSettingCellModel()
         cellModel.type = .fonts
         cellModel.title = KMLocalizedString("Fonts Panel", comment: "")
-        cellModel.heightOfRow = 90
+        cellModel.heightOfRow = 88
         cellModel.content = "Unembed Any Font"
         self.datas.append(cellModel)
         
         cellModel = KMCompressSettingCellModel()
         cellModel.type = .discardObject
         cellModel.title = KMLocalizedString("Discard Objects Panel", comment: "")
-        cellModel.heightOfRow = 205
+        cellModel.heightOfRow = 216
         cellModel.content = ["Discard all form submission, import and reset actions",
                          "Discard all JavaScript actions",
                          "Discard embedded page thumbnails",
@@ -66,7 +66,7 @@ class KMCompressSettingTableView: BaseXibView {
         cellModel = KMCompressSettingCellModel()
         cellModel.type = .discardUserData
         cellModel.title = KMLocalizedString("Discard User Data Panel", comment: "")
-        cellModel.heightOfRow = 205
+        cellModel.heightOfRow = 216
         cellModel.content = ["Discard all comments, forms and multimedia",
                          "Discard document information and metadata",
                          "Discard all object data",
@@ -77,7 +77,7 @@ class KMCompressSettingTableView: BaseXibView {
         cellModel = KMCompressSettingCellModel()
         cellModel.type = .discardOtherData
         cellModel.title = KMLocalizedString("Discard Other Data", comment: "")
-        cellModel.heightOfRow = 173
+        cellModel.heightOfRow = 182
         cellModel.content = ["Discard invalid bookmarks",
                          "Discard invalid links",
                          "Discard unreferenced named destinations",

+ 1 - 2
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -1936,6 +1936,7 @@ extension KMMainViewController {
         }
         
         self.compressWindowController?.batchAction = { [unowned self] view, filePaths in
+            self.view.window?.endSheet((self.compressWindowController?.window)!)
             self.showBatchCompressController(filePaths)
         }
         
@@ -1957,8 +1958,6 @@ extension KMMainViewController {
     }
     
     func showBatchCompressController(_ filePaths: [URL]) {
-        self.view.window?.endSheet((self.compressWindowController?.window)!)
-        
         let batchWindowController = KMBatchOperateWindowController.sharedWindowController
         let batchOperateFile = KMBatchOperateFile(filePath: filePaths.first!.path, type: .Compress)
         batchWindowController.switchToOperateType(KMBatchOperationType.Compress, files: [batchOperateFile])