Browse Source

【OCToSwift】SKProgressController替换为Swift

wanjun 1 year ago
parent
commit
85800fde11

+ 8 - 10
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -1009,6 +1009,9 @@
 		9FCFEC9C2AD152FA00EAD2CB /* CustomAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC9B2AD152FA00EAD2CB /* CustomAlertView.swift */; };
 		9FCFEC9D2AD152FA00EAD2CB /* CustomAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC9B2AD152FA00EAD2CB /* CustomAlertView.swift */; };
 		9FCFEC9E2AD152FA00EAD2CB /* CustomAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC9B2AD152FA00EAD2CB /* CustomAlertView.swift */; };
+		9FCFECA02AD17B8A00EAD2CB /* SKProgressController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC9F2AD17B8A00EAD2CB /* SKProgressController.swift */; };
+		9FCFECA12AD17B8A00EAD2CB /* SKProgressController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC9F2AD17B8A00EAD2CB /* SKProgressController.swift */; };
+		9FCFECA22AD17B8A00EAD2CB /* SKProgressController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC9F2AD17B8A00EAD2CB /* SKProgressController.swift */; };
 		9FD0FA2929CD3ED400F2AB0D /* KMRightSideEmptyVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD0FA2729CD3ED400F2AB0D /* KMRightSideEmptyVC.swift */; };
 		9FD0FA2A29CD3ED400F2AB0D /* KMRightSideEmptyVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD0FA2729CD3ED400F2AB0D /* KMRightSideEmptyVC.swift */; };
 		9FD0FA2B29CD3ED400F2AB0D /* KMRightSideEmptyVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD0FA2729CD3ED400F2AB0D /* KMRightSideEmptyVC.swift */; };
@@ -2442,9 +2445,6 @@
 		BB4EEF4C2976544F003A3537 /* KMRedactAligementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4EEF4B2976544F003A3537 /* KMRedactAligementView.swift */; };
 		BB4EEF4D2976544F003A3537 /* KMRedactAligementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4EEF4B2976544F003A3537 /* KMRedactAligementView.swift */; };
 		BB4EEF4E2976544F003A3537 /* KMRedactAligementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4EEF4B2976544F003A3537 /* KMRedactAligementView.swift */; };
-		BB51073F29A61B4100978662 /* SKProgressController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB51073C29A61B3F00978662 /* SKProgressController.m */; };
-		BB51074029A61B4100978662 /* SKProgressController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB51073C29A61B3F00978662 /* SKProgressController.m */; };
-		BB51074129A61B4100978662 /* SKProgressController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB51073C29A61B3F00978662 /* SKProgressController.m */; };
 		BB51074229A61B4100978662 /* ProgressSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB51073E29A61B4000978662 /* ProgressSheet.xib */; };
 		BB51074329A61B4100978662 /* ProgressSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB51073E29A61B4000978662 /* ProgressSheet.xib */; };
 		BB51074429A61B4100978662 /* ProgressSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB51073E29A61B4000978662 /* ProgressSheet.xib */; };
@@ -3932,6 +3932,7 @@
 		9FCFEC932AD12EE800EAD2CB /* KMCoverButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMCoverButton.swift; sourceTree = "<group>"; };
 		9FCFEC972AD14EEF00EAD2CB /* KMMailHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMMailHelper.swift; sourceTree = "<group>"; };
 		9FCFEC9B2AD152FA00EAD2CB /* CustomAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomAlertView.swift; sourceTree = "<group>"; };
+		9FCFEC9F2AD17B8A00EAD2CB /* SKProgressController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SKProgressController.swift; sourceTree = "<group>"; };
 		9FD0FA2729CD3ED400F2AB0D /* KMRightSideEmptyVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMRightSideEmptyVC.swift; sourceTree = "<group>"; };
 		9FD0FA2829CD3ED400F2AB0D /* KMRightSideEmptyVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMRightSideEmptyVC.xib; sourceTree = "<group>"; };
 		9FD0FA2F29CD947000F2AB0D /* KMOpacityPanel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMOpacityPanel.swift; sourceTree = "<group>"; };
@@ -4487,8 +4488,6 @@
 		BB4EEF4329764FEF003A3537 /* KMWatermarkAligementView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMWatermarkAligementView.swift; sourceTree = "<group>"; };
 		BB4EEF472976504C003A3537 /* KMRedactColorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMRedactColorView.swift; sourceTree = "<group>"; };
 		BB4EEF4B2976544F003A3537 /* KMRedactAligementView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMRedactAligementView.swift; sourceTree = "<group>"; };
-		BB51073C29A61B3F00978662 /* SKProgressController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKProgressController.m; sourceTree = "<group>"; };
-		BB51073D29A61B4000978662 /* SKProgressController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKProgressController.h; sourceTree = "<group>"; };
 		BB51073E29A61B4000978662 /* ProgressSheet.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ProgressSheet.xib; sourceTree = "<group>"; };
 		BB52372429C313CA00663BD7 /* KMAnnotationPropertyBaseController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KMAnnotationPropertyBaseController.h; sourceTree = "<group>"; };
 		BB52372529C313CA00663BD7 /* KMAnnotationPropertyBaseController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KMAnnotationPropertyBaseController.m; sourceTree = "<group>"; };
@@ -8135,8 +8134,7 @@
 			isa = PBXGroup;
 			children = (
 				BB51073E29A61B4000978662 /* ProgressSheet.xib */,
-				BB51073D29A61B4000978662 /* SKProgressController.h */,
-				BB51073C29A61B3F00978662 /* SKProgressController.m */,
+				9FCFEC9F2AD17B8A00EAD2CB /* SKProgressController.swift */,
 			);
 			path = OC;
 			sourceTree = "<group>";
@@ -10715,12 +10713,12 @@
 				9FCFEC702AC40F9B00EAD2CB /* CStampSignatureObject.swift in Sources */,
 				9FDD0F6B294AD12C000C4DAD /* KMMainViewController+UI.swift in Sources */,
 				9F02017E2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
+				9FCFECA02AD17B8A00EAD2CB /* SKProgressController.swift in Sources */,
 				89D9897428FE743E003A3E87 /* KMOutlineView.swift in Sources */,
 				ADC63E482A49BEDD00854E02 /* KMSubscribeWaterMarkCollectionItem.swift in Sources */,
 				89752E1D2942CB03003FF08E /* KMSearchMode.swift in Sources */,
 				AD3A3587294C11ED00D72802 /* KMPrintPreviewPresenter.swift in Sources */,
 				BB3AD6F929935483004FC1AE /* Reachability.m in Sources */,
-				BB51073F29A61B4100978662 /* SKProgressController.m in Sources */,
 				BBEC00BF295C306400A26C98 /* KMBatesPropertyController.swift in Sources */,
 				89E4E6EC2963D1B7002DBA6F /* KMColorPickerViewController.m in Sources */,
 				BB49ED19293F4D4E00C82CA2 /* KMConvertCSVSettingView.swift in Sources */,
@@ -11521,7 +11519,6 @@
 				9FDD0F6C294AD12C000C4DAD /* KMMainViewController+UI.swift in Sources */,
 				F34BF94F29531213002C25A2 /* NSGraphics+PDFListView.m in Sources */,
 				BB3AD6FA29935483004FC1AE /* Reachability.m in Sources */,
-				BB51074029A61B4100978662 /* SKProgressController.m in Sources */,
 				BBEC00C0295C306400A26C98 /* KMBatesPropertyController.swift in Sources */,
 				BB0A55222A30968900B6E84B /* KMDesignBaseView.swift in Sources */,
 				9FCFEC992AD14EEF00EAD2CB /* KMMailHelper.swift in Sources */,
@@ -11816,6 +11813,7 @@
 				9F1FE4CD29406E4700E952CA /* CTTabContentsController.m in Sources */,
 				8942F7BC29222C7E00389627 /* KMBookCellView.swift in Sources */,
 				9F0201872A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
+				9FCFECA12AD17B8A00EAD2CB /* SKProgressController.swift in Sources */,
 				BBEC00DA295C39FD00A26C98 /* KMBatesPropertyInfoController.swift in Sources */,
 				9F0CB52A298656C900007028 /* KMDesignToken+BorderWidthTop.swift in Sources */,
 				BB4EEF492976504C003A3537 /* KMRedactColorView.swift in Sources */,
@@ -12258,7 +12256,6 @@
 				BB003017298CA446002DD1A0 /* KMPreferenceGeneralController.swift in Sources */,
 				9F8DDF2F2924B855006CDC73 /* KMPDFToolsViewController.swift in Sources */,
 				ADD1B6AD2941E97F00C3FFF7 /* KMPrintWindowController.swift in Sources */,
-				BB51074129A61B4100978662 /* SKProgressController.m in Sources */,
 				9FDD0FB029534FDC000C4DAD /* KMCompLight.swift in Sources */,
 				8942F80129260EC700389627 /* KMLeftMethodMode.swift in Sources */,
 				BB14703A299DC0D200784A6A /* OIDAuthorizationResponse.m in Sources */,
@@ -12506,6 +12503,7 @@
 				9F1FE4B029406E4700E952CA /* CTPresentationModeController.m in Sources */,
 				BBD1F791296FE6A500343885 /* KMPageEditSplitWindowController.swift in Sources */,
 				ADD1B6EA2946C02600C3FFF7 /* KMPrintChoosePageSizeMultipageView.swift in Sources */,
+				9FCFECA22AD17B8A00EAD2CB /* SKProgressController.swift in Sources */,
 				9F0CB4612966C9E200007028 /* KMFormPropertPanelViewController.swift in Sources */,
 				9F1FE4EF29406E4700E952CA /* ThrobberView.m in Sources */,
 				F37322FB292DF9410013862C /* CPDFRedactAnnotation+PDFListView.m in Sources */,

+ 3 - 3
PDF Office/PDF Master/Class/Common/Base/KMBaseViewController.swift

@@ -382,13 +382,13 @@ class KMBaseViewController: NSViewController {
         }
         
         let progressC = SKProgressController()
-        progressC.showClose = false
-        progressC.message = message
         progressC.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progressC.window?.contentView?.wantsLayer = true
         progressC.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progressC.progressField.textColor = NSColor.white
-        
+        progressC.showClose = false
+        progressC.message = message
+
         self.progressC = progressC
         self.view.window?.beginSheet(progressC.window!)
     }

+ 5 - 5
PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.swift

@@ -306,16 +306,16 @@ class KMAIRewritingVC: NSViewController {
     
     func showProgressWindow() {
         let progress = SKProgressController()
+        progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
+        progress.window?.contentView?.wantsLayer = true
+        progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
+        progress.progressField.textColor = NSColor.white
         if self.state == .AIRewriting {
             progress.message = NSLocalizedString("Rewriting...", comment: "")
         } else if self.state == . AIErrorCorrection {
             progress.message = NSLocalizedString("Error Correcting...", comment: "")
         }
-        progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
-        progress.window?.contentView?.wantsLayer = true
-        progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
-        progress.progressField.textColor = NSColor.white
-        
+
         progress.closeBlock = { [unowned self] in
             
         }

+ 2 - 2
PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.swift

@@ -402,12 +402,12 @@ class KMAITranslationVC: NSViewController {
     
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Translating...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Translating...", comment: "")
+
         progress.closeBlock = { [unowned self] in
             
         }

+ 2 - 2
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift

@@ -627,12 +627,12 @@ import KMAdvertisement
     
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Translating...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Translating...", comment: "")
+
         progress.closeBlock = { [unowned self] in
             
         }

+ 2 - 2
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.swift

@@ -278,12 +278,12 @@ class KMAITranslationConfirmWindowController: NSWindowController {
 
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Translating...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Translating...", comment: "")
+
         progress.closeBlock = { [unowned self] in
             
         }

+ 2 - 2
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.swift

@@ -302,12 +302,12 @@ class KMAITranslationWindowController: NSWindowController {
     
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Translating...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Translating...", comment: "")
+
         progress.closeBlock = {}
         
         self.progressController = progress

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

@@ -853,12 +853,12 @@ class KMConvertBaseWindowController: KMBaseWindowController {
         self.hiddenProgressWindow()
         
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Converting...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Converting...", comment: "")
+
         progress.closeBlock = { [weak self] in
             if let convert = self?.convert {
                 KMPDFConvertManager.defaultManager.cancel(convert: convert)

+ 7 - 7
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/ProgressSheet.xib

@@ -1,12 +1,12 @@
 <?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">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment version="101300" identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="SKProgressController">
+        <customObject id="-2" userLabel="File's Owner" customClass="SKProgressController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="progressBar" destination="7" id="10"/>
                 <outlet property="progressField" destination="8" id="11"/>
@@ -14,19 +14,19 @@
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
-        <customObject id="-3" userLabel="Application"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" appearanceType="aqua" animationBehavior="default" id="5" userLabel="ProgressSheet" customClass="NSPanel">
             <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="302" y="374" width="226" height="58"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <value key="minSize" type="size" width="300" height="87"/>
             <value key="maxSize" type="size" width="300" height="87"/>
             <view key="contentView" id="6">
                 <rect key="frame" x="0.0" y="0.0" width="226" height="58"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
-                    <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" preferredMaxLayoutWidth="262" translatesAutoresizingMaskIntoConstraints="NO" id="8">
+                    <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" preferredMaxLayoutWidth="262" translatesAutoresizingMaskIntoConstraints="NO" id="8">
                         <rect key="frame" x="16" y="32" width="125" height="17"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="14">
@@ -35,7 +35,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <progressIndicator verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" bezeled="NO" controlSize="small" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="7" customClass="SKProgressController_ProgressIndicator">
+                    <progressIndicator verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" bezeled="NO" controlSize="small" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="7" customClass="SKProgressController_ProgressIndicator" customModule="PDF_Master" customModuleProvider="target">
                         <rect key="frame" x="16" y="12" width="194" height="12"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </progressIndicator>

+ 0 - 61
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.h

@@ -1,61 +0,0 @@
-//
-//  SKProgressController.h
-//  Skim
-//
-//  Created by Christiaan Hofman on 9/16/07.
-/*
- This software is Copyright (c) 2007-2018
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface SKProgressController : NSWindowController {
-    NSProgressIndicator *progressBar;
-    NSTextField *progressField;
-}
-
-@property (nonatomic, retain) IBOutlet NSProgressIndicator *progressBar;
-@property (nonatomic, retain) IBOutlet NSTextField *progressField;
-@property (nonatomic, retain) NSString *message;
-@property (nonatomic, getter=isIndeterminate) BOOL indeterminate;
-@property (nonatomic) double maxValue, doubleValue;
-
-// 是否显示关闭按钮 [默认是显示]
-@property (nonatomic, assign) BOOL showClose;
-@property (nonatomic, copy) void(^closeBlock)(void);
-
-- (void)incrementBy:(double)delta;
-
-- (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger result))handler;
-
-@end

+ 0 - 191
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.m

@@ -1,191 +0,0 @@
-//
-//  SKProgressController.m
-//  Skim
-//
-//  Created by Christiaan Hofman on 9/16/07.
-/*
- This software is Copyright (c) 2007-2018
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "SKProgressController.h"
-
-@interface SKProgressController_ProgressIndicator : NSProgressIndicator
-
-@end
-
-@implementation SKProgressController_ProgressIndicator
-
-- (instancetype)init {
-    if (self = [super init]) {
-        
-    }
-    return self;
-}
-
-- (void)drawRect:(NSRect)dirtyRect {
-    NSColor *color = [NSColor colorWithRed:206/255.f green:208/255.f blue:212/255.f alpha:1.f];
-    [color setStroke];
-    [color setFill];
-    NSRect lineRect = NSMakeRect(1.5, (NSHeight(self.bounds)-2.4)*0.5, NSWidth(self.bounds)-2, 2.4);
-    NSBezierPath *linePath = [NSBezierPath bezierPathWithRoundedRect:lineRect xRadius:0 yRadius:0];
-    [linePath fill];
-    [linePath stroke];
-    
-    [super drawRect:dirtyRect];
-}
-
-@end
-
-
-@implementation SKProgressController
-
-@synthesize progressBar, progressField;
-@dynamic message, indeterminate, maxValue, doubleValue;
-
-- (void)dealloc {}
-
-- (NSString *)windowNibName { 
-    return @"ProgressSheet";
-}
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.showClose = YES;
-    }
-    return self;
-}
-
-- (void)windowDidLoad {
-    [progressBar setUsesThreadedAnimation:YES];
-    
-    self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
-    
-    NSButton *button = [[NSButton alloc] init];
-    [self.window.contentView addSubview:button];
-    
-    CGFloat width = NSWidth(self.window.contentView.frame);
-    CGFloat height = NSWidth(self.window.contentView.frame);
-    CGSize size = CGSizeMake(20, 20);
-    CGFloat buttonY = 28;
-    CGFloat buttonX = width-size.width-10;
-    button.frame = NSMakeRect(buttonX, buttonY, size.width, size.height);
-    button.autoresizingMask = NSViewMinXMargin | NSViewMaxYMargin;
-    button.bordered = NO;
-    button.image = [NSImage imageNamed:@"KMImageNameWhiteClose"];
-    button.target = self;
-    button.action = @selector(buttonAction:);
-    
-    button.hidden = !self.showClose;
-}
-
-- (NSProgressIndicator *)progressBar {
-    [self window];
-    return progressBar;
-}
-
-- (NSString *)message {
-    [self window];
-    return [progressField stringValue];
-}
-
-- (void)setMessage:(NSString *)newMessage {
-    [self window];
-    [progressField setStringValue:newMessage];
-    [[self window] setTitle:newMessage];
-}
-
-- (BOOL)isIndeterminate {
-    return [[self progressBar] isIndeterminate];
-}
-
-- (void)setIndeterminate:(BOOL)flag {
-    [[self progressBar] setIndeterminate:flag];
-}
-
-- (double)maxValue {
-    return [[self progressBar] maxValue];
-}
-
-- (void)setMaxValue:(double)newMaximum {
-    [[self progressBar] setMaxValue:newMaximum];
-    [[self progressBar] setDoubleValue:0.0];
-}
-
-- (double)doubleValue {
-    return [[self progressBar] doubleValue];
-}
-
-- (void)setDoubleValue:(double)doubleValue {
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [[self progressBar] setDoubleValue:doubleValue];
-        [[self progressBar] displayIfNeeded];
-    });
-}
-
-- (void)incrementBy:(double)delta {
-    [[self progressBar] incrementBy:delta];
-    [[self progressBar] displayIfNeeded];
-}
-
-- (void)buttonAction:(NSButton *)sender {
-    if (self.closeBlock) {
-        self.closeBlock();
-    }
-    
-    [self dismissSheet:nil];
-}
-
-- (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger result))handler {
-    [[self progressBar] startAnimation:self];
-//    [(SKApplication *)NSApp setUserAttentionDisabled:YES];
-//    [super beginSheetModalForWindow:window completionHandler:handler];
-    [NSApp beginSheet:[self window]
-       modalForWindow:window
-        modalDelegate:self
-       didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
-          contextInfo:handler ? CFBridgingRetain(handler) : NULL];
-    
-//    [(SKApplication *)NSApp setUserAttentionDisabled:NO];
-}
-
-- (IBAction)dismissSheet:(id)sender {
-    [[self progressBar] stopAnimation:self];
-//    [super dismissSheet:sender];
-    if (@available(macOS 10.13, *)) {
-        [NSApp endSheet:[self window] returnCode:[sender tag]];
-    } else {
-        [NSApp endSheet:[self window]];
-    }
-    [[self window] orderOut:self];
-}
-
-@end

+ 151 - 0
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.swift

@@ -0,0 +1,151 @@
+//
+//  SKProgressController.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/7.
+//
+
+import Cocoa
+
+class SKProgressController_ProgressIndicator: NSProgressIndicator {
+    override func draw(_ dirtyRect: NSRect) {
+        let color = NSColor(red: 206/255.0, green: 208/255.0, blue: 212/255.0, alpha: 1.0)
+        color.setStroke()
+        color.setFill()
+        
+        let lineRect = NSRect(x: 1.5, y: (self.bounds.height - 2.4) * 0.5, width: self.bounds.width - 2, height: 2.4)
+        let linePath = NSBezierPath(roundedRect: lineRect, xRadius: 0, yRadius: 0)
+        
+        linePath.fill()
+        linePath.stroke()
+        
+        super.draw(dirtyRect)
+    }
+}
+
+class SKProgressController: NSWindowController {
+
+    @IBOutlet var progressBar: NSProgressIndicator!
+    @IBOutlet var progressField: NSTextField!
+
+    var _message: String?
+    var _indeterminate: Bool = false
+    var _maxValue: Double = 100.0
+    var _doubleValue: Double = 0.0
+
+    // 是否显示关闭按钮 [默认是显示]
+    var showClose: Bool = true
+    var closeBlock: (() -> Void)?
+    
+    override var windowNibName: NSNib.Name? {
+        return NSNib.Name("ProgressSheet")
+    }
+    
+    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.
+        
+        progressBar.usesThreadedAnimation = true
+        
+        self.window?.appearance = NSAppearance(named: .aqua)
+        
+        let button = NSButton()
+        self.window?.contentView?.addSubview(button)
+        
+        let width = self.window?.contentView?.frame.width ?? 0
+        let height = self.window?.contentView?.frame.height ?? 0
+        let size = CGSize(width: 20, height: 20)
+        let buttonY: CGFloat = 28
+        let buttonX = width - size.width - 10
+        button.frame = NSRect(x: buttonX, y: buttonY, width: size.width, height: size.height)
+        button.autoresizingMask = [.minXMargin, .maxYMargin]
+        button.isBordered = false
+        button.image = NSImage(named: "KMImageNameWhiteClose")
+        button.target = self
+        button.action = #selector(buttonAction(_:))
+        
+        button.isHidden = !self.showClose
+    }
+    
+//MARK: Get & Set
+    var message: String? {
+        get {
+            return progressField?.stringValue ?? ""
+        }
+        set {
+            progressField.stringValue = newValue!
+            self.window?.title = newValue!
+        }
+    }
+    
+    var indeterminate: Bool {
+        get {
+            return self.progressBar.isIndeterminate
+        }
+        set {
+            self.progressBar.isIndeterminate = newValue
+        }
+    }
+    
+    var maxValue: Double {
+        get {
+            return self.progressBar.maxValue
+        }
+        set {
+            self.progressBar.maxValue = newValue
+            self.progressBar.doubleValue = 0.0
+        }
+    }
+    
+    var doubleValue: Double {
+        get {
+            return self.progressBar.doubleValue
+        }
+        set {
+            DispatchQueue.main.async {
+                self.progressBar.doubleValue = newValue
+                self.progressBar.displayIfNeeded()
+            }
+        }
+    }
+    
+    func increment(by delta: Double) {
+        self.progressBar.increment(by: delta)
+        self.progressBar.displayIfNeeded()
+    }
+
+    
+    //MARK: Action
+    
+    @objc func buttonAction(_ sender: NSButton) {
+        // Your button action code here
+        if let closeBlock = self.closeBlock {
+            closeBlock()
+        }
+        
+        self.dismissSheet(sender)
+    }
+    //didEndSheet(returnCode:contextInfo:)
+//    func beginSheetModal(for window: NSWindow, completionHandler handler: ((NSInteger) -> Void)?) {
+//        progressBar.startAnimation(self)
+//        
+//        NSApp.beginSheet(window,
+//                         modalFor: window,
+//                         modalDelegate: self,
+//                         didEnd: #selector(didEndSheet(returnCode:contextInfo:)),
+//                         contextInfo: handler != nil ? Unmanaged.passRetained(handler as AnyObject).toOpaque() : nil)
+//    }
+    
+    @IBAction func dismissSheet(_ sender: Any) {
+        self.progressBar.stopAnimation(self)
+        
+        if #available(macOS 10.13, *) {
+            NSApp.endSheet(self.window!, returnCode: (sender as AnyObject).tag)
+        } else {
+            NSApp.endSheet(self.window!)
+        }
+        
+        self.window!.orderOut(self)
+    }
+}

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Convert/View/KMConvertOCRSettingItemView.swift

@@ -158,12 +158,12 @@ class KMConvertOCRSettingItemView: KMConvertBaseView {
     
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Download...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Download...", comment: "")
+
         progress.closeBlock = { [unowned self] in
 #if VERSION_DMG
             KMResourceDownloadManager.manager.cancelDownload()

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

@@ -1177,13 +1177,13 @@ import Cocoa
         }
         
         let progress = SKProgressController()
-        progress.showClose = false
-        progress.message = message
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.showClose = false
+        progress.message = message
+
         self.progressController = progress
         self.view.window?.beginSheet(progress.window!)
     }

+ 0 - 1
PDF Office/PDF Master/PDF_Master DMG-Bridging-Header.h

@@ -44,7 +44,6 @@
 //
 #import "KMPrintAccessoryController_OC.h"
 //
-#import "SKProgressController.h"
 #import "KMSelfSignAnnotationFreeText.h"
 
 #import "CStringConstants.h"

+ 0 - 1
PDF Office/PDF Master/PDF_Master Pro-Bridging-Header.h

@@ -31,7 +31,6 @@
 //
 #import "KMPrintAccessoryController_OC.h"
 //
-#import "SKProgressController.h"
 
 #import "CStringConstants.h"
 #import "NSUserDefaults+PDFListView.h"

+ 0 - 1
PDF Office/PDF Master/PDF_Master-Bridging-Header.h

@@ -44,7 +44,6 @@
 //
 #import "KMPrintAccessoryController_OC.h"
 //
-#import "SKProgressController.h"
 #import "KMSelfSignAnnotationFreeText.h"
 
 #import "CStringConstants.h"