Browse Source

【批量处理】- 添加到工程显示

jiajie 1 year ago
parent
commit
d5d9ebaef5

+ 1 - 1
PDF Office/PDF Master/Class/Batch/Catogary/NSButton+CustomAppearance.swift

@@ -17,7 +17,7 @@ extension NSButton{
             return (objc_getAssociatedObject(self, NSButtonAddHoverKey) as? NSNumber)?.boolValue ?? false
         }
         set {
-            removeTrackingArea(self.neededTrackingArea!)
+            removeTrackingArea(self.neededTrackingArea ?? NSTrackingArea())
             if newValue {
                 addNewTrackingArea()
             }

+ 1 - 1
PDF Office/PDF Master/Class/Batch/View/KMLongerButton.swift

@@ -8,7 +8,7 @@
 import Cocoa
 
 class KMLongerButton: NSButton{
-    var containerViewController: KMBatchOperateLeftViewController?
+    weak var containerViewController: KMBatchOperateLeftViewController?
     var isImageToPDF = false
     var popOver: NSPopover?
     var buttonLayer: CALayer?

+ 1 - 1
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateBaseWindowController.swift

@@ -60,7 +60,7 @@ class KMBatchOperateBaseWindowController: NSWindowController{
     }
     func switchToOperateType(_ operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
         self.files = files 
-        (self.contentViewController as? KMBatchOperateSplitViewController)?.switchToOperateType(operateType: operateType, files: files as! NSMutableArray)
+        (self.contentViewController as? KMBatchOperateSplitViewController)?.switchToOperateType(operateType: operateType, files: files)
         self.operateType = operateType
     }
     func checkNeedPasswordSwitchToOperateType(operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {

+ 2 - 2
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.xib

@@ -34,7 +34,7 @@
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="yD5-qe-EWK">
                     <rect key="frame" x="0.0" y="419" width="793" height="40"/>
                     <subviews>
-                        <button verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9ff-Qn-trv" customClass="KMLongerButton">
+                        <button verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9ff-Qn-trv" customClass="KMLongerButton" customModule="PDF_Master" customModuleProvider="target">
                             <rect key="frame" x="20" y="10" width="143" height="18"/>
                             <buttonCell key="cell" type="square" title="Add File..." bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnAddHov" imagePosition="left" alignment="center" inset="2" id="GI3-CE-S91" customClass="KMButtomCell">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -236,7 +236,7 @@
                         <autoresizingMask key="autoresizingMask"/>
                     </tableHeaderView>
                 </scrollView>
-                <customView translatesAutoresizingMaskIntoConstraints="NO" id="G6v-if-4fr" customClass="KMBlankView">
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="G6v-if-4fr" customClass="KMBlankView" customModule="PDF_Master" customModuleProvider="target">
                     <rect key="frame" x="0.0" y="0.0" width="793" height="419"/>
                     <subviews>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="9GJ-Lf-bRA">

+ 1 - 1
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateRightViewController.swift

@@ -176,7 +176,7 @@ class KMBatchOperateRightViewController: NSViewController{
     
     func switchToConvertType(_ convertType: KMConvertWithPDFType) {
         if self.currentType == .Convert {
-            self.convertViewController!.switchToConvertType(convertType)
+            self.convertViewController?.switchToConvertType(convertType)
         }
     }
     

+ 3 - 3
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateSplitViewController.swift

@@ -30,9 +30,9 @@ class KMBatchOperateSplitViewController: NSSplitViewController{
         self.view.addTrackingArea(trackingArea)
     }
     
-    func switchToOperateType(operateType: KMBatchOperationType, files: NSMutableArray) {
-        self.leftFileListViewController?.switchToOperateType(operateType, files: files as! [KMBatchOperateFile])
-        self.rightPropertiesViewController?.switchToOperateType(operateType: operateType, files: files as! [KMBatchOperateFile])
+    func switchToOperateType(operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
+        self.leftFileListViewController?.switchToOperateType(operateType, files: files)
+        self.rightPropertiesViewController?.switchToOperateType(operateType: operateType, files: files )
     }
     func checkNeedPasswordSwitchToOperateType(_ operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
         self.leftFileListViewController?.checkNeedPasswordSwitchToOperateType(operateType, files: files)

+ 1 - 1
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateWindowController.xib

@@ -13,7 +13,7 @@
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5" customClass="KMBatchWindow">
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5" customClass="KMBatchWindow" customModule="PDF_Master" customModuleProvider="target">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <rect key="contentRect" x="463" y="248" width="480" height="270"/>
             <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>

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

@@ -865,6 +865,8 @@ extension KMHomeViewController {
     
     func fastTool_Batch() { // Batch
 //        KMBatchWindowController.openFile(nil, .Batch)
+        let batchWindowController = KMBatchOperateWindowController.sharedWindowController
+        batchWindowController.window?.makeKeyAndOrderFront("")
     }
     
     func fastTool_OCR() {   // OCR

+ 5 - 1
PDF Office/PDF Master/Class/Merge/OCPart/KMBlankView.swift

@@ -43,7 +43,11 @@ class KMBlankView: NSView {
         addTrackingArea()
         self.wantsLayer = true
         
-        customView.addSubview(button!)
+        if customView == nil {
+            
+        } else {
+            customView.addSubview(button!)
+        }
         
         registerForDraggedTypes([.fileURL])
     }