Sfoglia il codice sorgente

综合-压缩、转档新增快捷键

tangchao 1 anno fa
parent
commit
79796a0737

BIN
PDF Office/PDF Office.xcodeproj/project.xcworkspace/xcuserdata/kdanmobile.xcuserdatad/UserInterfaceState.xcuserstate


+ 32 - 0
PDF Office/PDF Office.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -388,5 +388,37 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "CAB48AB5-40A1-4C3C-83ED-2A77F63697A2"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Office/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "214"
+            endingLineNumber = "214"
+            landmarkName = "-annotationImage"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "754B2692-2659-43F2-90B5-F935CE288360"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Office/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFTextAnnotation+PDFListView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "70"
+            endingLineNumber = "70"
+            landmarkName = "CPDFTextAnnotation(PDFListView)"
+            landmarkType = "3">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 16 - 0
PDF Office/PDF Office/Class/Common/KMCommonEnum.swift

@@ -28,3 +28,19 @@ import Foundation
     case fit
     case actualSize // 实际大小
 }
+
+
+@objc enum KMKeyEquivalent: UInt32 {
+    case esc = 27
+//    case enter = UInt32("r")
+    
+    public static let enter = "\r"
+    
+    public func string() -> String {
+        guard let value = Unicode.Scalar(self.rawValue) else {
+            return ""
+        }
+        
+        return String(value)
+    }
+}

+ 1 - 0
PDF Office/PDF Office/Class/Merge/OCPart/KMPDFEditAppendWindow.m

@@ -248,6 +248,7 @@ static NSString * const KMTableColumnSizeID = @"size";
     self.clearVC = [[KMDesignButton alloc] initWithType: DesignButtonTypeImage];
     self.nMergeVC = [[KMDesignButton alloc] initWithType: DesignButtonTypeText];
     self.nCancelVC = [[KMDesignButton alloc] initWithType: DesignButtonTypeText];
+//    self.nMergeVC.button.keyEquivalent = @"\\r";
     self.clearBox.fillColor = NSColor.clearColor;
     self.clearBox.contentView = self.clearVC.view;
     self.nMergeBox.fillColor = NSColor.clearColor;

+ 2 - 0
PDF Office/PDF Office/Class/PDFTools/Compress/Controller/KMCompressWindowController.swift

@@ -171,11 +171,13 @@ class KMCompressWindowController: NSWindowController {
         cancelVC.action = #selector(cancelButtonAction)
         cancelVC.stringValue = NSLocalizedString("Cancel", comment: "")
         cancelVC.button(type: .Sec, size: .m)
+        cancelVC.button.keyEquivalent = KMKeyEquivalent.esc.string()
         
         compressVC.target = self
         compressVC.action = #selector(compressButtonAction)
         compressVC.stringValue = NSLocalizedString("Compress", comment: "")
         compressVC.button(type: .Cta, size: .m)
+        compressVC.button.keyEquivalent = KMKeyEquivalent.enter
         
         largeVC.target = self
         largeVC.action = #selector(self.radioButtonAction(_:))

+ 2 - 1
PDF Office/PDF Office/Class/PDFTools/Convert/Controller/KMConvertBaseWindowController.swift

@@ -254,6 +254,7 @@ class KMConvertBaseWindowController: NSWindowController {
         canelButtonVC.action = #selector(cancelButtonAction)
         canelButtonVC.stringValue = NSLocalizedString("Cancel", comment: "")
         canelButtonVC.button(type: .Sec, size: .m)
+        canelButtonVC.button.keyEquivalent = KMKeyEquivalent.esc.string()
         
         convertBox.fillColor = .clear
         convertBox.contentView = convertButtonVC.view
@@ -261,7 +262,7 @@ class KMConvertBaseWindowController: NSWindowController {
         convertButtonVC.action = #selector(convertButtonAction)
         convertButtonVC.stringValue = NSLocalizedString("Convert", comment: "")
         convertButtonVC.button(type: .Cta, size: .m)
-        
+        convertButtonVC.button.keyEquivalent = KMKeyEquivalent.enter
         self.rightScrollView.hasVerticalScroller = false
         self.rightScrollView.hasHorizontalScroller = false
         

+ 48 - 18
PDF Office/PDF Office/Class/PDFTools/Secure/Window/KMPasswordInputWindow.swift

@@ -33,6 +33,8 @@ private var passwordInputWindow: KMPasswordInputWindow?
     @IBOutlet weak var cancelButton: NSButton!
     @IBOutlet weak var confirmButton: NSButton!
     
+    var confirmButtonVC: KMDesignButton?
+    
     static var myDocumentURL: URL!
     var documentURL: URL {
         get {
@@ -115,6 +117,7 @@ private var passwordInputWindow: KMPasswordInputWindow?
             despLabel.stringValue = NSLocalizedString("is protected, please enter the password to unlock it.", comment: "")
             self.despLabel.textColor = NSColor.titleColor()
             despLabel.font = NSFont.SFProTextRegular(14)
+            despLabel.isSelectable = false
             let ps = NSMutableParagraphStyle()
             ps.lineSpacing = 5
             despLabel.maximumNumberOfLines = 2
@@ -147,7 +150,7 @@ private var passwordInputWindow: KMPasswordInputWindow?
             clearButton.action = #selector(clearButtonAction)
             rightView.isHidden = true
 
-            secureTextFiled.becomeFirstResponderHandler = { [self] securetextFiled in
+            secureTextFiled.becomeFirstResponderHandler = { [unowned self] securetextFiled in
                 let mySecureTextField: KMSecureTextFiled = securetextFiled as! KMSecureTextFiled
                 mySecureTextField.backgroundView.wantsLayer = true
                 mySecureTextField.backgroundView.layer?.borderColor = NSColor(hex: "#1770F4").cgColor
@@ -156,7 +159,7 @@ private var passwordInputWindow: KMPasswordInputWindow?
                     self.passwordErrorLabel.isHidden = true
                 }
             }
-            secureTextFiled.valueDidChange = { [self] string in
+            secureTextFiled.valueDidChange = { [unowned self] string in
                 self.secureTextFiled.backgroundView.layer?.borderColor = NSColor(hex: "#1770F4").cgColor
                 if self.passwordErrorLabel != nil {
                     self.passwordErrorLabel.isHidden = true
@@ -188,18 +191,41 @@ private var passwordInputWindow: KMPasswordInputWindow?
                 if ((button?.isEqual(to: cancelButton))!) {
                     button?.layer?.borderWidth = 1
                     button?.layer?.borderColor = NSColor.buttonBorderColor().cgColor
-                    button?.title = NSLocalizedString("Cancel", comment: "")
-                    button?.setTitleColor(NSColor.buttonTitleColor())
-                    button?.font = NSFont.SFProTextRegular(14)
-                    button?.action = #selector(cancelButtonAction)
+//                    button?.title = NSLocalizedString("Cancel", comment: "")
+                    button?.title = ""
+//                    button?.setTitleColor(NSColor.buttonTitleColor())
+//                    button?.font = NSFont.SFProTextRegular(14)
+//                    button?.action = #selector(cancelButtonAction)
                 } else {
-                    button?.title = NSLocalizedString("Open", comment: "")
-                    button?.attributedTitle = NSMutableAttributedString(string: button!.title, attributes: [.foregroundColor : NSColor.white])
-                    button?.font = NSFont.SFProTextRegular(14)
-                    button?.action = #selector(confirmButtonAction)
+//                    button?.title = NSLocalizedString("Open", comment: "")
+//                    button?.attributedTitle = NSMutableAttributedString(string: button!.title, attributes: [.foregroundColor : NSColor.white])
+//                    button?.font = NSFont.SFProTextRegular(14)
+//                    button?.action = #selector(confirmButtonAction)
+                    button?.title = ""
                 }
             }
             
+            let cancelButtonVC = KMDesignButton(withType: .Text)
+            self.cancelButton.addSubview(cancelButtonVC.view)
+            cancelButtonVC.view.frame = self.cancelButton.bounds
+            cancelButtonVC.view.autoresizingMask = [.width, .height]
+            cancelButtonVC.stringValue = NSLocalizedString("Cancel", comment: "")
+            cancelButtonVC.button(type: .Sec_Icon, size: .m)
+            cancelButtonVC.target = self
+            cancelButtonVC.action = #selector(cancelButtonAction)
+            cancelButtonVC.button.keyEquivalent = KMKeyEquivalent.esc.string()
+            
+            let confirmButtonVC = KMDesignButton(withType: .Text)
+            self.confirmButton.addSubview(confirmButtonVC.view)
+            confirmButtonVC.view.frame = self.confirmButton.bounds
+            confirmButtonVC.view.autoresizingMask = [.width, .height]
+            confirmButtonVC.stringValue = NSLocalizedString("Open", comment: "")
+            confirmButtonVC.button(type: .Cta, size: .m)
+            confirmButtonVC.target = self
+            confirmButtonVC.action = #selector(confirmButtonAction)
+            self.confirmButtonVC = confirmButtonVC
+            self.confirmButtonVC?.button.keyEquivalent = KMKeyEquivalent.enter
+            
             dealConfirmButtonEnabledState(enabled: false)
         }
     }
@@ -325,14 +351,18 @@ private var passwordInputWindow: KMPasswordInputWindow?
         if confirmButton != nil {
             KMPasswordInputWindow.canEncrpty = enabled
             
-            confirmButton.wantsLayer = true
-            confirmButton.layer?.backgroundColor = NSColor.buttonFunctionBackgroundColor(enabled: enabled).cgColor
-            confirmButton?.title = NSLocalizedString("Open", comment: "")
-            var color = NSColor.buttonTitleColor(enabled: enabled)
-            if (enabled) {
-                color = NSColor(hex: "#FFFFFF")
-            }
-            confirmButton?.attributedTitle = NSMutableAttributedString(string: confirmButton!.title, attributes: [.foregroundColor : color])
+//            confirmButton.wantsLayer = true
+//            confirmButton.layer?.backgroundColor = NSColor.buttonFunctionBackgroundColor(enabled: enabled).cgColor
+//            confirmButton?.title = NSLocalizedString("Open", comment: "")
+//            var color = NSColor.buttonTitleColor(enabled: enabled)
+//            if (enabled) {
+//                color = NSColor(hex: "#FFFFFF")
+//            }
+//            confirmButton?.attributedTitle = NSMutableAttributedString(string: confirmButton!.title, attributes: [.foregroundColor : color])
+            
+            if (self.confirmButtonVC != nil) {
+                self.confirmButtonVC?.enabled = enabled
+            }
         }
     }
     

+ 8 - 6
PDF Office/PDF Office/Class/Preference/Controller/KMPreferenceDisplayController.swift

@@ -203,11 +203,11 @@ class KMPreferenceDisplayController: NSViewController {
             self.selectLeftSideRadio(self.rememberLastSelectionRadio)
         }
         
-        if (KMPreferenceManager.shared.showOutlineList) {
-            self.showOutlineCheck.state = .on
-        } else {
-            self.showOutlineCheck.state = .off
-        }
+//        if (KMPreferenceManager.shared.showOutlineList) {
+//            self.showOutlineCheck.state = .on
+//        } else {
+//            self.showOutlineCheck.state = .off
+//        }
         
         if (KMPreferenceManager.shared.propertyPanelExpandType == .auto) {
             self.selectDisplayRadio(self.autoExpandRadio)
@@ -276,6 +276,8 @@ class KMPreferenceDisplayController: NSViewController {
     
     @objc private func checkAction(sender: NSButton) {
         if (self.showOutlineCheck.isEqual(sender)) {
+            self.selectLeftSideRadio(sender)
+            
             KMPreferenceManager.shared.showOutlineList = sender.state == .on
         } else if (self.hightlightedFormsLabel.isEqual(sender)) {
             KMPreferenceManager.shared.highlightForms = sender.state == .on
@@ -313,7 +315,7 @@ class KMPreferenceDisplayController: NSViewController {
     }
     
     private func selectLeftSideRadio(_ sender: NSButton) {
-        for radio in [self.putAwayRadio, self.rememberLastSelectionRadio] {
+        for radio in [self.putAwayRadio, self.rememberLastSelectionRadio, self.showOutlineCheck] {
             if (sender.isEqual(to: radio)) {
                 radio?.state = .on
             } else {

+ 15 - 15
PDF Office/PDF Office/Class/Preference/Controller/KMPreferenceDisplayController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -52,7 +52,7 @@
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Del-t8-fOz">
-                    <rect key="frame" x="14" y="398" width="37" height="16"/>
+                    <rect key="frame" x="14" y="419" width="37" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="peA-3h-2xi">
                         <font key="font" usesAppearanceFont="YES"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -60,7 +60,7 @@
                     </textFieldCell>
                 </textField>
                 <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Xhq-lP-rLf">
-                    <rect key="frame" x="16" y="328" width="480" height="68"/>
+                    <rect key="frame" x="16" y="349" width="480" height="68"/>
                     <view key="contentView" id="gBT-DI-ozZ">
                         <rect key="frame" x="1" y="1" width="478" height="66"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -128,7 +128,7 @@
                     </view>
                 </box>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3Ap-hh-tvL">
-                    <rect key="frame" x="14" y="296" width="37" height="16"/>
+                    <rect key="frame" x="14" y="317" width="37" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="SM4-Lj-IPI">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -136,13 +136,13 @@
                     </textFieldCell>
                 </textField>
                 <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="LZG-xJ-N2a">
-                    <rect key="frame" x="16" y="204" width="480" height="90"/>
+                    <rect key="frame" x="16" y="204" width="480" height="111"/>
                     <view key="contentView" id="bhK-3o-Xne">
-                        <rect key="frame" x="1" y="1" width="478" height="88"/>
+                        <rect key="frame" x="1" y="1" width="478" height="109"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="92G-l2-Pp1">
-                                <rect key="frame" x="6" y="64" width="37" height="16"/>
+                                <rect key="frame" x="6" y="85" width="37" height="16"/>
                                 <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="y39-Fb-hkh">
                                     <font key="font" usesAppearanceFont="YES"/>
                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -150,25 +150,25 @@
                                 </textFieldCell>
                             </textField>
                             <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aDE-qN-O2S">
-                                <rect key="frame" x="6" y="37" width="61" height="18"/>
+                                <rect key="frame" x="6" y="58" width="61" height="18"/>
                                 <buttonCell key="cell" type="radio" title="Radio" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="RC2-fc-pQ1">
                                     <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                     <font key="font" metaFont="system"/>
                                 </buttonCell>
                             </button>
                             <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iAj-it-gdO">
-                                <rect key="frame" x="6" y="11" width="61" height="18"/>
+                                <rect key="frame" x="6" y="32" width="61" height="18"/>
                                 <buttonCell key="cell" type="radio" title="Radio" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="IJS-t3-oXU">
                                     <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                     <font key="font" metaFont="system"/>
                                 </buttonCell>
                             </button>
-                            <button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Elh-rT-caB">
-                                <rect key="frame" x="6" y="0.0" width="65" height="3"/>
+                            <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Elh-rT-caB">
+                                <rect key="frame" x="6" y="4" width="65" height="20"/>
                                 <constraints>
-                                    <constraint firstAttribute="height" constant="1" id="g5r-Hg-D26"/>
+                                    <constraint firstAttribute="height" constant="18" id="g5r-Hg-D26"/>
                                 </constraints>
-                                <buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Ikz-Hf-Bna">
+                                <buttonCell key="cell" type="radio" title="Check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Ikz-Hf-Bna">
                                     <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                     <font key="font" metaFont="system"/>
                                 </buttonCell>
@@ -180,7 +180,7 @@
                             <constraint firstItem="92G-l2-Pp1" firstAttribute="leading" secondItem="bhK-3o-Xne" secondAttribute="leading" constant="8" id="Md3-bS-Abv"/>
                             <constraint firstItem="Elh-rT-caB" firstAttribute="leading" secondItem="bhK-3o-Xne" secondAttribute="leading" constant="8" id="OGG-Cg-vBS"/>
                             <constraint firstItem="Elh-rT-caB" firstAttribute="top" secondItem="iAj-it-gdO" secondAttribute="bottom" constant="10" id="ah7-Du-01C"/>
-                            <constraint firstAttribute="bottom" secondItem="Elh-rT-caB" secondAttribute="bottom" constant="1" id="b7D-0i-Ou8"/>
+                            <constraint firstAttribute="bottom" secondItem="Elh-rT-caB" secondAttribute="bottom" constant="5" id="b7D-0i-Ou8"/>
                             <constraint firstItem="iAj-it-gdO" firstAttribute="top" secondItem="aDE-qN-O2S" secondAttribute="bottom" constant="10" id="n4e-Wf-QAU"/>
                             <constraint firstItem="aDE-qN-O2S" firstAttribute="top" secondItem="92G-l2-Pp1" secondAttribute="bottom" constant="10" id="srP-a6-7ac"/>
                             <constraint firstItem="iAj-it-gdO" firstAttribute="leading" secondItem="bhK-3o-Xne" secondAttribute="leading" constant="8" id="uSp-z0-8M7"/>

+ 1 - 1
PDF Office/PDF Office/Class/Preference/Window/KMPreferenceWindowController.swift

@@ -148,7 +148,7 @@ class KMPreferenceWindowController: NSWindowController {
             controller.view.autoresizingMask = [.width, .height]
             self.currentController = controller
         } else if (index == 2) {
-            self.adjectWindowSize(NSSize(width: 512, height: 548), false)
+            self.adjectWindowSize(NSSize(width: 512, height: 570), false)
             
             let controller = KMPreferenceDisplayController()
             self.contentBox.contentView?.addSubview(controller.view)