瀏覽代碼

[批量] - UI问题修复

liujiajie 1 年之前
父節點
當前提交
b89664290d

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

@@ -212,10 +212,11 @@ import Cocoa
     override func mouseEntered(with event: NSEvent) {
         if (self.enable) {
             super.mouseEntered(with: event)
-//            [self setState:KMCustomViewButtonState_MouseIn];
             self._showPop()
             if (self.dataSource == nil) {
                 NotificationCenter.default.post(name: NSNotification.Name("KMCloseCustomViewButtonPopNotification"), object: nil)
+            }else {
+                self._state = .mouseIn
             }
         }
     }

+ 3 - 3
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateBaseWindowController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -16,7 +16,7 @@
         <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="422" y="270" width="480" height="270"/>
-            <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"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
                 <autoresizingMask key="autoresizingMask"/>

+ 67 - 71
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift

@@ -94,7 +94,7 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
         self.lockFileIndex = 0
         self.progressInt = 0
         
-        self.selectFileButton.title = NSLocalizedString("Add Files", comment: "")
+        self.selectFileButton.title = NSLocalizedString(" Add Files", comment: "")
         self.selectFileButton.wantsLayer = true
         self.selectFileButton.layer?.borderWidth = 1.0
         self.selectFileButton.layer?.borderColor = KMAppearance.Interactive.m0Color().cgColor
@@ -587,32 +587,38 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
         var result: NSDragOperation = []
         let pboard = info.draggingPasteboard
         if pboard.availableType(from: [.fileURL]) != nil {
-            if let fileURLs = pboard.propertyList(forType: .fileURL) as? [URL] {
-                for url in fileURLs {
-                    var isDirectory: ObjCBool = false
-                    let fileExists = FileManager.default.fileExists(atPath: url.path, isDirectory: &isDirectory)
-                    if fileExists && isDirectory.boolValue {
-                        let containFile = folderContainAvailableFile(url.path)
-                        if containFile {
-                            isCanDrag = true
-                            break
-                        }
-                    } else {
-                        if let UTType = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, url.pathExtension as CFString, nil)?.takeRetainedValue() as String? {
-                            if self.type == .CreatePDF {
-                                if UTTypeConformsTo(UTType as CFString, kUTTypeImage) {
-                                    isCanDrag = true
-                                }
-                            } else {
-                                if UTTypeConformsTo(UTType as CFString, kUTTypePDF) {
-                                    isCanDrag = true
-                                }
+            guard let pbItems = pboard.pasteboardItems else {
+                return NSDragOperation(rawValue: 0)
+            }
+            var hasValidFile = false
+            
+            for item in pbItems {
+                guard let data = item.string(forType: .fileURL), let _url = URL(string: data) else {
+                    continue
+                }
+                var isDirectory: ObjCBool = false
+                let fileExists = FileManager.default.fileExists(atPath: _url.path, isDirectory: &isDirectory)
+                if fileExists && isDirectory.boolValue {
+                    let containFile = folderContainAvailableFile(_url.path)
+                    if containFile {
+                        isCanDrag = true
+                        break
+                    }
+                } else {
+                    if let UTType = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, _url.pathExtension as CFString, nil)?.takeRetainedValue() as String? {
+                        if self.type == .CreatePDF {
+                            if UTTypeConformsTo(UTType as CFString, kUTTypeImage) {
+                                isCanDrag = true
+                            }
+                        } else {
+                            if UTTypeConformsTo(UTType as CFString, kUTTypePDF) {
+                                isCanDrag = true
                             }
-                        }
-                        if isCanDrag {
-                            break
                         }
                     }
+                    if isCanDrag {
+                        break
+                    }
                 }
             }
             if isCanDrag {
@@ -661,30 +667,28 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
             self.tableView.reloadData()
             return true
         } else if pboard.availableType(from: [.fileURL]) != nil {
-            guard let fileNames = pboard.propertyList(forType: .fileURL) as? [String]
-            else {
-                return false
+            if (pboard.pasteboardItems == nil) {
+                
+                return true
             }
+           
             let allFilesArray = NSMutableArray()
-            for path in fileNames {
+            for item in pboard.pasteboardItems! {
+                let fileURL = item.string(forType: .fileURL)
+                if (fileURL == nil) {
+                    continue
+                }
+                let path = URL.init(string: fileURL!)
+                if (path == nil) {
+                    continue
+                }
                 var isFolder = ObjCBool(false)
-                FileManager.default.fileExists(atPath: path, isDirectory: &isFolder)
+                FileManager.default.fileExists(atPath: path!.path, isDirectory: &isFolder)
                 if isFolder.boolValue {
-                    let containFiles = fetchAvailableFilesInFolder(path)
+                    let containFiles = fetchAvailableFilesInFolder(path!.path)
                     allFilesArray.addObjects(from: containFiles)
                 } else {
-                    let UTTypeString = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, path.customPathExtension as CFString, nil)
-                    let TypeCFString = UTTypeString as! CFString
-                    
-                    if self.type == .CreatePDF {
-                        if UTTypeConformsTo(TypeCFString, kUTTypeImage) {
-                            allFilesArray.add(path)
-                        }
-                    } else {
-                        if UTTypeConformsTo(TypeCFString, kUTTypePDF) {
-                            allFilesArray.add(path)
-                        }
-                    }
+                    allFilesArray.add(path!.path)
                 }
             }
             var insertArray = NSMutableArray()
@@ -692,40 +696,32 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
             lockFileIndex = 0
             for i in 0..<allFilesArray.count {
                 let filePath: String = allFilesArray[i] as! String
-                let UTTypeString = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, filePath.customPathExtension as CFString, nil)
-                let TypeCFString = UTTypeString as! CFString
-                if UTTypeConformsTo(TypeCFString, kUTTypePDF) {
-                    let document = CPDFDocument(url: URL(fileURLWithPath: filePath))
-                    if let pdf = CPDFDocument(url: URL(fileURLWithPath: filePath)) {
-                        if !pdf.allowsPrinting || !pdf.allowsCopying {
-                            let alert = NSAlert()
-                            alert.alertStyle = .critical
-                            alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
-                            alert.runModal()
-                            continue
-                        } else if document?.isLocked ?? false {
-                            lockFilePathArr?.add(filePath)
-                        } else {
-                            let file = KMBatchOperateFile(filePath: filePath, type: self.type!)
-                            if !(self.files.contains(file) ) {
-                                insertArray.add(file)
-                            }
+                
+                let document = CPDFDocument(url: URL(fileURLWithPath: filePath))
+                if let pdf = CPDFDocument(url: URL(fileURLWithPath: filePath)) {
+                    if !pdf.allowsPrinting || !pdf.allowsCopying {
+                        let alert = NSAlert()
+                        alert.alertStyle = .critical
+                        alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
+                        alert.runModal()
+                        continue
+                    } else if document?.isLocked ?? false {
+                        lockFilePathArr?.add(filePath)
+                    } else {
+                        let file = KMBatchOperateFile(filePath: filePath, type: self.type!)
+                        if !(self.files.contains(file) ) {
+                            insertArray.add(file)
                         }
                     }
-                } else {
-                    let file = KMBatchOperateFile(filePath: filePath, type: self.type!)
-                    if !(self.files.contains(file) ) {
-                        insertArray.add(file)
-                    }
                 }
             }
             //        if !(IAPProductsManager.defaultManager.isAvailableAllFunction) {
-            if self.files.count < 1 {
-                insertArray = [insertArray.first].compactMap { $0 } as! NSMutableArray
-            } else {
-                //                KMPurchaseCompareWindowController.sharedInstance.showWindow(nil)
-                return false
-            }
+//            if self.files.count < 1 {
+//                insertArray = [insertArray.first].compactMap { $0 } as! NSMutableArray
+//            } else {
+//                //                KMPurchaseCompareWindowController.sharedInstance.showWindow(nil)
+//                return false
+//            }
             //        }
             for i in 0..<insertArray.count {
                 self.files.insert(insertArray[i] as! KMBatchOperateFile, at: row + i)

+ 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="792" height="40"/>
                     <subviews>
-                        <button verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9ff-Qn-trv" customClass="KMLongerButton" customModule="PDF_Master" customModuleProvider="target">
+                        <button imageHugsTitle="YES" 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">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -105,7 +105,7 @@
                                         <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                         <prototypeCellViews>
                                             <tableCellView id="Mgh-hp-ErW">
-                                                <rect key="frame" x="81" y="1" width="101" height="17"/>
+                                                <rect key="frame" x="81" y="1" width="100" height="17"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             </tableCellView>
                                         </prototypeCellViews>

+ 7 - 7
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateCompressViewController.xib

@@ -37,7 +37,7 @@
                         <constraint firstAttribute="height" constant="1" id="quc-k2-w7g"/>
                     </constraints>
                 </box>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9XA-Ss-REU">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9XA-Ss-REU">
                     <rect key="frame" x="34" y="245" width="37" height="16"/>
                     <textFieldCell key="cell" title="Label" id="EuU-hO-Up2">
                         <font key="font" metaFont="system"/>
@@ -45,7 +45,7 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NJ8-R3-NNq">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NJ8-R3-NNq">
                     <rect key="frame" x="34" y="218" width="37" height="16"/>
                     <textFieldCell key="cell" title="Label" id="7Po-hc-8df">
                         <font key="font" metaFont="system"/>
@@ -53,7 +53,7 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="s3M-WR-b0B">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="s3M-WR-b0B">
                     <rect key="frame" x="34" y="191" width="37" height="16"/>
                     <textFieldCell key="cell" title="Label" id="i0p-bT-jDe">
                         <font key="font" metaFont="system"/>
@@ -61,7 +61,7 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="G4p-Mj-Wqk">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="G4p-Mj-Wqk">
                     <rect key="frame" x="34" y="164" width="37" height="16"/>
                     <textFieldCell key="cell" title="Label" id="9BY-68-WZA">
                         <font key="font" metaFont="system"/>
@@ -119,7 +119,7 @@
                         <action selector="buttonClicked_ChooseDPI:" target="-2" id="f7f-xL-i2z"/>
                     </connections>
                 </button>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BGJ-le-5vT">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BGJ-le-5vT">
                     <rect key="frame" x="14" y="272" width="42" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="Och-Je-3zh">
                         <font key="font" metaFont="systemBold" size="14"/>
@@ -150,7 +150,7 @@
                         <action selector="comprssVauleAction:" target="-2" id="R9C-l8-4aD"/>
                     </connections>
                 </slider>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tY3-My-5Ov">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tY3-My-5Ov">
                     <rect key="frame" x="36" y="85" width="37" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="1C5-jz-2Kv">
                         <font key="font" metaFont="system"/>
@@ -158,7 +158,7 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uQM-Hg-SLo">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uQM-Hg-SLo">
                     <rect key="frame" x="203" y="85" width="37" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="dmh-q4-Y71">
                         <font key="font" metaFont="system"/>