Переглянути джерело

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

niehaoyu 10 місяців тому
батько
коміт
04e53f61c2

+ 11 - 7
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -50,16 +50,20 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
     var currentDocumentSetup: [String: Any] {
         get {
             var tempSetup: [String: Any] = [:]
-            var tempMainSetup: [String: Any] = mainViewController?.currentSetup() ?? [:]
-            let data = (fileURL != nil) ? SKAlias.init(url: fileURL).data : nil
+            let tempMainSetup: [String: Any] = mainViewController?.currentSetup() ?? [:]
             let filePath = fileURL?.path ?? ""
-            
-            tempSetup.updateValue(filePath, forKey: KMDocumentSetupFileNameKey)
-            if data != nil {
-                tempSetup.updateValue(data!, forKey: KMDocumentSetupAliasKey)
+            if filePath.count > 0{
+                tempSetup.updateValue(filePath, forKey: KMDocumentSetupFileNameKey)
+            }else {
+                return tempSetup
+            }
+            if let alias = SKAlias.init(url: fileURL){
+                if let data = alias.data{
+                    tempSetup.updateValue(data as Any, forKey: KMDocumentSetupAliasKey)
+                }
             }
             
-            if tempSetup.count != 0 {
+            if tempSetup.count > 0 {
                 tempSetup.merge(tempMainSetup) { (_, new) in new }
             }
             return tempSetup

+ 7 - 6
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/New/View/KMHeaderFooterView.swift

@@ -168,6 +168,7 @@ class KMHeaderFooterView: KMBaseXibView, NSTextViewDelegate, NSComboBoxDelegate
     @IBOutlet weak var batesStartPageLabel: NSTextField!
     @IBOutlet weak var batesStartpageCombobox: NSComboBox!
     @IBOutlet weak var constraint: NSLayoutConstraint!
+    @IBOutlet weak var loadingView: KMLoadingView!
     var isHiddenBatchBtn: Bool = false
     
     var initialID: String = ""
@@ -716,8 +717,8 @@ class KMHeaderFooterView: KMBaseXibView, NSTextViewDelegate, NSComboBoxDelegate
     }
 
     func saveAsPDFToPath(_ path: String, autoOpen: Bool) {
-        // self.loadingView.hidden = false
-        // self.loadingView.progressIndicator.startAnimation(nil)
+         self.loadingView.isHidden = false
+         self.loadingView.startAnimation()
         DispatchQueue.global(qos: .default).async { [unowned self] in
             var filePath = self.pdfDocument?.documentURL?.path
             let password = self.password
@@ -830,8 +831,8 @@ class KMHeaderFooterView: KMBaseXibView, NSTextViewDelegate, NSComboBoxDelegate
 
             if result {
                 DispatchQueue.main.async {
-                    // self.loadingView.hidden = true
-                    // self.loadingView.progressIndicator.stopAnimation(nil)
+                     self.loadingView.isHidden = true
+                     self.loadingView.stopAnimation()
                     self.cancelAction?(self)
                     if autoOpen {
                         NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: path), display: true) { _, _, _ in
@@ -842,8 +843,8 @@ class KMHeaderFooterView: KMBaseXibView, NSTextViewDelegate, NSComboBoxDelegate
                 }
             } else {
                 DispatchQueue.main.async {
-                    // self.loadingView.hidden = true
-                    // self.loadingView.progressIndicator.stopAnimation(nil)
+                     self.loadingView.isHidden = true
+                     self.loadingView.stopAnimation()
                 }
             }
         }

+ 14 - 0
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/New/View/KMHeaderFooterView.xib

@@ -43,6 +43,7 @@
                 <outlet property="leftMarginLabel" destination="TVg-mc-dUt" id="PkQ-SZ-24x"/>
                 <outlet property="leftMarginStepper" destination="cKr-m6-8RP" id="Xf7-8M-teT"/>
                 <outlet property="leftMarginTextField" destination="KNm-JI-4zb" id="J9y-lT-ZI7"/>
+                <outlet property="loadingView" destination="1hc-7j-QLD" id="YyY-an-U3Q"/>
                 <outlet property="marginBox" destination="95W-ZK-5dF" id="Pkf-lB-5tY"/>
                 <outlet property="marginLabel" destination="oIM-eE-Kpg" id="XYv-PW-w2W"/>
                 <outlet property="pageCombobox" destination="RpV-jp-NPO" id="Icj-L4-CQw"/>
@@ -635,6 +636,7 @@ DQ
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         <size key="minSize" width="173" height="38"/>
                                         <size key="maxSize" width="296" height="10000000"/>
+                                        <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
                                     </textView>
                                 </subviews>
                             </clipView>
@@ -663,6 +665,7 @@ DQ
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         <size key="minSize" width="172" height="38"/>
                                         <size key="maxSize" width="295" height="10000000"/>
+                                        <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
                                     </textView>
                                 </subviews>
                             </clipView>
@@ -688,6 +691,7 @@ DQ
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         <size key="minSize" width="173" height="38"/>
                                         <size key="maxSize" width="311" height="10000000"/>
+                                        <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
                                     </textView>
                                 </subviews>
                             </clipView>
@@ -788,6 +792,7 @@ DQ
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         <size key="minSize" width="173" height="38"/>
                                         <size key="maxSize" width="311" height="10000000"/>
+                                        <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
                                     </textView>
                                 </subviews>
                             </clipView>
@@ -813,6 +818,7 @@ DQ
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         <size key="minSize" width="172" height="38"/>
                                         <size key="maxSize" width="310" height="10000000"/>
+                                        <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
                                     </textView>
                                 </subviews>
                             </clipView>
@@ -838,6 +844,7 @@ DQ
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         <size key="minSize" width="173" height="38"/>
                                         <size key="maxSize" width="311" height="10000000"/>
+                                        <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
                                     </textView>
                                 </subviews>
                             </clipView>
@@ -1157,10 +1164,17 @@ DQ
                         <constraint firstItem="n3W-zz-qNa" firstAttribute="leading" secondItem="xiq-Lc-iq0" secondAttribute="leading" id="zkB-5c-mzd"/>
                     </constraints>
                 </view>
+                <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1hc-7j-QLD" customClass="KMLoadingView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                    <rect key="frame" x="0.0" y="0.0" width="915" height="539"/>
+                </customView>
             </subviews>
             <constraints>
                 <constraint firstAttribute="trailing" secondItem="vT7-Jw-ekX" secondAttribute="trailing" id="3ZE-eI-Ut9"/>
+                <constraint firstItem="1hc-7j-QLD" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="4W0-rQ-Zch"/>
+                <constraint firstAttribute="bottom" secondItem="1hc-7j-QLD" secondAttribute="bottom" id="BPT-Pa-5xm"/>
                 <constraint firstItem="vT7-Jw-ekX" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="ItB-sk-RL1"/>
+                <constraint firstItem="1hc-7j-QLD" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" id="S6I-FF-RpM"/>
+                <constraint firstAttribute="trailing" secondItem="1hc-7j-QLD" secondAttribute="trailing" id="UzI-FG-T9d"/>
                 <constraint firstItem="vT7-Jw-ekX" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" id="ijy-A2-XkQ"/>
                 <constraint firstAttribute="bottom" secondItem="vT7-Jw-ekX" secondAttribute="bottom" id="kcq-22-oJO"/>
             </constraints>

+ 39 - 0
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/New/View/LoadingView/KMLoadingView.swift

@@ -0,0 +1,39 @@
+//
+//  KMLoadingView.swift
+//  PDF Reader Pro
+//
+//  Created by lizhe on 2024/5/13.
+//
+
+import Cocoa
+
+class KMLoadingView: KMBaseXibView {
+
+    @IBOutlet weak var progressIndicator: NSProgressIndicator!
+    override func draw(_ dirtyRect: NSRect) {
+        super.draw(dirtyRect)
+
+        // Drawing code here.
+    }
+    
+    override func mouseDown(with event: NSEvent) {
+        
+    }
+    
+    override func mouseMoved(with event: NSEvent) {
+        
+    }
+    
+    override func mouseUp(with event: NSEvent) {
+        
+    }
+    
+    func startAnimation() {
+        self.progressIndicator.startAnimation(nil)
+    }
+    
+    func stopAnimation() {
+        self.progressIndicator.stopAnimation(nil)
+    }
+    
+}

+ 35 - 0
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/New/View/LoadingView/KMLoadingView.xib

@@ -0,0 +1,35 @@
+<?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="KMLoadingView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="progressIndicator" destination="fao-Ag-2SR" id="uIB-Qe-vzb"/>
+            </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="554" height="349"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <progressIndicator maxValue="100" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="fao-Ag-2SR">
+                    <rect key="frame" x="267" y="165" width="20" height="20"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="20" id="bzh-fd-7vi"/>
+                        <constraint firstAttribute="height" constant="20" id="q00-Mr-6OB"/>
+                    </constraints>
+                </progressIndicator>
+            </subviews>
+            <constraints>
+                <constraint firstItem="fao-Ag-2SR" firstAttribute="centerX" secondItem="c22-O7-iKe" secondAttribute="centerX" id="aMw-lY-kF0"/>
+                <constraint firstItem="fao-Ag-2SR" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="dYD-5I-KC7"/>
+            </constraints>
+            <point key="canvasLocation" x="176" y="192.5"/>
+        </customView>
+    </objects>
+</document>

+ 3 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -2228,6 +2228,9 @@ extension KMMainViewController {
         var setup: [String: Any] = [:]
         var point = NSZeroPoint
 //        var rotated = listView.currentPage().rotation
+        if listView == nil {
+            return setup
+        }
         let pageIndex = listView.currentPageIndexAndPoint(&point, rotated: nil)
         
         setup[kWindowFrameKey] = NSStringFromRect(mainWindow?.frame ?? NSZeroRect)

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

@@ -1579,6 +1579,12 @@
 		AD4C71712B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
 		AD4C71722B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
 		AD4C71732B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
+		AD53AF8F2BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */; };
+		AD53AF902BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */; };
+		AD53AF912BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */; };
+		AD53AF932BF1BCA300DCFFFC /* KMLoadingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD53AF922BF1BCA300DCFFFC /* KMLoadingView.xib */; };
+		AD53AF942BF1BCA300DCFFFC /* KMLoadingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD53AF922BF1BCA300DCFFFC /* KMLoadingView.xib */; };
+		AD53AF952BF1BCA300DCFFFC /* KMLoadingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD53AF922BF1BCA300DCFFFC /* KMLoadingView.xib */; };
 		AD53B6FE29AC5FCD00D61E81 /* KMLightMemberToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */; };
 		AD53B6FF29AC5FCD00D61E81 /* KMLightMemberToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */; };
 		AD53B70029AC5FCD00D61E81 /* KMLightMemberToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */; };
@@ -5889,6 +5895,8 @@
 		AD3AAD8E2B1034B400DE5FE7 /* KMHeaderFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMHeaderFooterView.swift; sourceTree = "<group>"; };
 		AD3AAD922B1034C000DE5FE7 /* KMHeaderFooterView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMHeaderFooterView.xib; sourceTree = "<group>"; };
 		AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSError_Extensions.swift; sourceTree = "<group>"; };
+		AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMLoadingView.swift; sourceTree = "<group>"; };
+		AD53AF922BF1BCA300DCFFFC /* KMLoadingView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMLoadingView.xib; sourceTree = "<group>"; };
 		AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMLightMemberToken.swift; sourceTree = "<group>"; };
 		AD58F4042B14954B00299EE0 /* KMCompareTextHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMCompareTextHeaderView.xib; sourceTree = "<group>"; };
 		AD58F40D2B1DAAA700299EE0 /* KMPrintDefaultView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPrintDefaultView.swift; sourceTree = "<group>"; };
@@ -9095,6 +9103,7 @@
 		AD3AAD852B1033B700DE5FE7 /* View */ = {
 			isa = PBXGroup;
 			children = (
+				AD53AF8D2BF1BC7200DCFFFC /* LoadingView */,
 				AD3AAD8E2B1034B400DE5FE7 /* KMHeaderFooterView.swift */,
 				AD3AAD922B1034C000DE5FE7 /* KMHeaderFooterView.xib */,
 			);
@@ -9109,6 +9118,15 @@
 			path = Manager;
 			sourceTree = "<group>";
 		};
+		AD53AF8D2BF1BC7200DCFFFC /* LoadingView */ = {
+			isa = PBXGroup;
+			children = (
+				AD53AF8E2BF1BC9200DCFFFC /* KMLoadingView.swift */,
+				AD53AF922BF1BCA300DCFFFC /* KMLoadingView.xib */,
+			);
+			path = LoadingView;
+			sourceTree = "<group>";
+		};
 		AD53B70129ACC63D00D61E81 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
@@ -14427,6 +14445,7 @@
 				9F0201752A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */,
 				BB853CAE2AF8FA67009C20C1 /* KMHeaderFooterManagerWindowController.xib in Resources */,
 				9F0201812A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */,
+				AD53AF932BF1BCA300DCFFFC /* KMLoadingView.xib in Resources */,
 				BB1B0AD42B4FC6E900889528 /* KMFunctionGuideSingleController.xib in Resources */,
 				ADDF83532B391A5C00A81A4E /* DSignatureFileListViewController.xib in Resources */,
 				AD85D1B02AF09C79000F4D28 /* KMHomeQuickToolsWindowCollectionViewItem.xib in Resources */,
@@ -14487,6 +14506,7 @@
 				ADD1B6F92946C0CA00C3FFF7 /* KMPrintChoosePageSizeMultipageView.xib in Resources */,
 				BB1A916F2AFB7871005E5FD8 /* KMConvertWindowController.xib in Resources */,
 				AD88109B29A78AEC00178CA1 /* KMVerificationCodeView.xib in Resources */,
+				AD53AF942BF1BCA300DCFFFC /* KMLoadingView.xib in Resources */,
 				BBB789C42BE8BF2400F7E09C /* AIRedoConfirmView.xib in Resources */,
 				9F69DBBE2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib in Resources */,
 				9F512CD32B469A7700EC0BC3 /* KMPageDisplayThemeCollectionViewItem.xib in Resources */,
@@ -15484,6 +15504,7 @@
 				BB8810632B4F74DD00AFA63E /* KMRepeatTrialAlertController.xib in Resources */,
 				BB49ED13293F462E00C82CA2 /* KMConvertImageWindowController.xib in Resources */,
 				ADE86A7D2B0221E100414DFA /* KMSecurityWindowController.xib in Resources */,
+				AD53AF952BF1BCA300DCFFFC /* KMLoadingView.xib in Resources */,
 				9F00CCBB2A2F1E0F00AC462E /* dsa_priv.pem in Resources */,
 				BBF62C6E2B033B5B007B7E86 /* KMPDFEditExtractWindow.xib in Resources */,
 				9F0CB46C2967E5CB00007028 /* KMPropertiesPanelSubViewController.xib in Resources */,
@@ -15997,6 +16018,7 @@
 				BBD8EE962B8EC86A00EB05FE /* AutoSavePopController.m in Sources */,
 				BB2F9AAF2AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift in Sources */,
 				AD58F41F2B1DC29100299EE0 /* KMPrintViewModel.swift in Sources */,
+				AD53AF8F2BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */,
 				BBFE6E87293210AB00142C01 /* KMCompressCellView.swift in Sources */,
 				BB146FE1299DC0D100784A6A /* GTLRDriveQuery.m in Sources */,
 				BB328B632B55512F00B382C6 /* KMVerificationMessageViewController.m in Sources */,
@@ -17042,6 +17064,7 @@
 				9FA607DA28F8227500B46586 /* KMBox.swift in Sources */,
 				BB146FD3299DC0D100784A6A /* GTLRDateTime.m in Sources */,
 				BB8810A12B4F7D1000AFA63E /* KMVerificationActivateViewController.m in Sources */,
+				AD53AF902BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */,
 				AD9527BF295294E20039D2BC /* KMPrintPageModel.swift in Sources */,
 				BB8F457B295AFB330037EA22 /* KMHeaderFooterFontInfoView.swift in Sources */,
 				BBB5C80829F4CEE40054F261 /* KMLinkAnnotationPropertyEmptyController.swift in Sources */,
@@ -18383,6 +18406,7 @@
 				BBA762D429D2D98D00844513 /* KMCommonDefine.swift in Sources */,
 				BB9599CD2B3184230062D346 /* KMRedactSelectPagesWindowController.swift in Sources */,
 				BB135C2C29B6CD9A00FD5965 /* KMTools.swift in Sources */,
+				AD53AF912BF1BC9200DCFFFC /* KMLoadingView.swift in Sources */,
 				BBEC00B9295C2C1600A26C98 /* KMBatesPropertyHomeController.swift in Sources */,
 				BB4EEF3629764166003A3537 /* KMRedactPropertyWindowController.swift in Sources */,
 				AD867FA829DFB77500F00440 /* KMAnnotationOutlineView.swift in Sources */,