Browse Source

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

niehaoyu 11 months ago
parent
commit
666c742dd7

+ 19 - 5
PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.swift

@@ -366,11 +366,25 @@ extension NetService {
 extension KMPrintWindowController: KMPrintBottomViewDelegate {
     func savePDFAction() {
         KMPrint("保存PDF")
-        guard let url = self.presenter.printData.url else { return }
-        let document = CPDFDocument(url: url)
-        NSPanel.savePanel_pdf_success(self.window!, document: document) { result in
-            NSWorkspace.shared.selectFile(result.path, inFileViewerRootedAtPath: "")
-        }
+//        guard let url = self.presenter.printData.url else { return }
+        guard let document = self.tempPDFDocument else { return }
+//        guard let url = self.tempPDFDocument?.documentURL else { return }
+//        let document = CPDFDocument(url: url)
+//        NSPanel.savePanel_pdf_success(self.window!, document: document) { result in
+//            NSWorkspace.shared.selectFile(result.path, inFileViewerRootedAtPath: "")
+//        }
+//        
+        let savePanel = NSSavePanel()
+        savePanel.allowedFileTypes = ["pdf"]
+        savePanel.beginSheetModal(for: NSWindow.currentWindow(), completionHandler: { result in
+            if result != .OK {
+//                completion(result, nil)
+            } else {
+                document.write(to: savePanel.url!)
+                NSWorkspace.shared.selectFile(savePanel.url?.path, inFileViewerRootedAtPath: "")
+//                completion(result, success ? savePanel.url! : nil)
+            }
+        })
     }
     
     func printerAction() {

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.xib

@@ -48,7 +48,7 @@
                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="MIW-E0-38q">
                         <rect key="frame" x="0.0" y="450" width="600" height="50"/>
                         <subviews>
-                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="w7p-YR-VDW">
+                            <textField hidden="YES" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="w7p-YR-VDW">
                                 <rect key="frame" x="14" y="17" width="37" height="16"/>
                                 <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="hfU-Nk-JkE">
                                     <font key="font" usesAppearanceFont="YES"/>

+ 8 - 30
PDF Office/PDF Master/Class/PDFTools/Print/View/BottomView/KMPrintBottomView.swift

@@ -44,36 +44,14 @@ class KMPrintBottomView: KMBaseXibView {
     override func setup() {
         self.updateButtonState()
         
-//        self.printerButton.wantsLayer = true
-//        self.printerButton.layer?.borderWidth = 1
-//        self.printerButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
-//        self.printerButton.layer?.cornerRadius = 4
-//        self.printerButton.title = NSLocalizedString("Printer", comment: "")
-//        self.printerButton.font = NSFont.SFProTextRegularFont(14)
-//        self.printerButton.contentTintColor = NSColor.km_init(hex: "#252629")
-//        
-//        self.cancelButton.wantsLayer = true
-//        self.cancelButton.layer?.borderWidth = 1
-//        self.cancelButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
-//        self.cancelButton.layer?.cornerRadius = 4
-//        self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
-//        self.cancelButton.font = NSFont.SFProTextRegularFont(14)
-//        self.cancelButton.contentTintColor = NSColor.km_init(hex: "#252629")
-//        
-//        self.savePDFButton.wantsLayer = true
-//        self.savePDFButton.layer?.borderWidth = 1
-//        self.savePDFButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
-//        self.savePDFButton.layer?.cornerRadius = 4
-//        self.savePDFButton.title = NSLocalizedString("Save as PDF", comment: "")
-//        self.savePDFButton.font = NSFont.SFProTextRegularFont(14)
-//        self.savePDFButton.contentTintColor = NSColor.km_init(hex: "#252629")
-//        
-//        self.printButton.wantsLayer = true
-//        self.printButton.layer?.backgroundColor = NSColor.km_init(hex: "#1770F4").cgColor
-//        self.printButton.layer?.cornerRadius = 4
-//        self.printButton.title = NSLocalizedString("Printer", comment: "")
-//        self.printButton.font = NSFont.SFProTextRegularFont(14)
-//        self.printButton.contentTintColor = NSColor.km_init(hex: "#FFFFFF")
+        self.printButton.title = NSLocalizedString("Printer", comment: "")
+        self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
+        self.savePDFButton.title = NSLocalizedString("Save", comment: "")
+         
+        self.posterButton.title = NSLocalizedString("Poster", comment: "")
+        self.bookletButton.title = NSLocalizedString("Booklet", comment: "")
+        self.multipleButton.title = NSLocalizedString("Multiple", comment: "")
+
     }
     
     //刷新界面UI 和 数据

+ 4 - 4
PDF Office/PDF Master/Class/PDFTools/Print/View/Preview/KMPrintPreviewView.swift

@@ -108,7 +108,7 @@ class KMPrintPreviewView: KMBaseXibView {
 //        self.previewContentView.layer?.backgroundColor = NSColor.km_init(hex: "#F7F8FA").cgColor
         
         self.currentPageTextField.textField.font = NSFont.SFProTextRegularFont(12.0)
-        self.currentPageTextField.textField.textColor = NSColor.km_init(hex: "#252629")
+//        self.currentPageTextField.textField.textColor = NSColor.km_init(hex: "#252629")
         self.currentPageTextField.textDidEndEditing = {[unowned self] (string) in
             self.presenter.toPage(index: Int(string) ?? 0)
         }
@@ -125,13 +125,13 @@ class KMPrintPreviewView: KMBaseXibView {
         self.previousButton.layer?.borderWidth = 1
 //        self.previousButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
         self.previousButton.layer?.cornerRadius = 4
-        self.previousButton.image = NSImage(named: "icon_btn_pagination_back_norm")
+//        self.previousButton.image = NSImage(named: "icon_btn_pagination_back_norm")
         
         self.nextButton.wantsLayer = true
         self.nextButton.layer?.borderWidth = 1
 //        self.nextButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
         self.nextButton.layer?.cornerRadius = 4
-        self.nextButton.image = NSImage(named: "icon_btn_pagination_lastpage_dis")
+//        self.nextButton.image = NSImage(named: "icon_btn_pagination_lastpage_dis")
     }
     
     func notification() {
@@ -154,7 +154,7 @@ class KMPrintPreviewView: KMBaseXibView {
                 self.currentPageTextField.stringValue = (pageIndex! + 1).description
                 self.pageCountLabel.stringValue = (self.previewView.document?.pageCount.description)!
                 
-                self.titleLabel.stringValue = NSLocalizedString("size", comment: "") + ":" + size.width.description + NSLocalizedString("mm", comment: "") + "*" + String(size.height.description) + NSLocalizedString("mm", comment: "")
+                self.titleLabel.stringValue = NSLocalizedString("Size", comment: "") + ":" + size.width.description + NSLocalizedString("mm", comment: "") + "*" + String(size.height.description) + NSLocalizedString("mm", comment: "")
             }
         }
     }

+ 9 - 5
PDF Office/PDF Master/Class/PDFTools/Print/View/Preview/KMPrintPreviewView.xib

@@ -7,7 +7,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMPrintPreviewView" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMPrintPreviewView" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="currentPageTextField" destination="kAa-KE-xvz" id="go0-Ju-aOG"/>
                 <outlet property="nextButton" destination="aL4-Zm-ckR" id="5bn-Qa-tBh"/>
@@ -35,7 +35,7 @@
                                 <pdfView autoresizesSubviews="NO" wantsLayer="YES" displayMode="singlePage" translatesAutoresizingMaskIntoConstraints="NO" id="Sws-Vc-u7D">
                                     <rect key="frame" x="0.0" y="0.0" width="180" height="248"/>
                                 </pdfView>
-                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="1lQ-Db-XbA" customClass="KMPrintPosterPreviewView" customModule="PDF_Master" customModuleProvider="target">
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="1lQ-Db-XbA" customClass="KMPrintPosterPreviewView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                     <rect key="frame" x="0.0" y="0.0" width="180" height="248"/>
                                 </customView>
                             </subviews>
@@ -66,7 +66,7 @@
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="6T9-7c-n7B">
                                     <rect key="frame" x="56" y="7" width="100" height="40"/>
                                     <subviews>
-                                        <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kAa-KE-xvz" customClass="KMBaseTextField" customModule="PDF_Master" customModuleProvider="target">
+                                        <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kAa-KE-xvz" customClass="KMBaseTextField" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                             <rect key="frame" x="-2" y="12" width="54" height="16"/>
                                             <constraints>
                                                 <constraint firstAttribute="width" constant="50" id="wM0-HX-OL1"/>
@@ -107,7 +107,7 @@
                                 </customView>
                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aL4-Zm-ckR">
                                     <rect key="frame" x="164" y="15" width="24" height="24"/>
-                                    <buttonCell key="cell" type="square" title="-&gt;" bezelStyle="shadowlessSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="qlc-in-usF">
+                                    <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSGoRightTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="qlc-in-usF">
                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="system"/>
                                     </buttonCell>
@@ -121,7 +121,7 @@
                                 </button>
                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Exe-SJ-Ntq">
                                     <rect key="frame" x="24" y="15" width="24" height="24"/>
-                                    <buttonCell key="cell" type="square" title="&lt;-" bezelStyle="shadowlessSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nbC-RY-oVe">
+                                    <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSGoLeftTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nbC-RY-oVe">
                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="system"/>
                                     </buttonCell>
@@ -165,4 +165,8 @@
             <point key="canvasLocation" x="-183" y="90"/>
         </customView>
     </objects>
+    <resources>
+        <image name="NSGoLeftTemplate" width="128" height="128"/>
+        <image name="NSGoRightTemplate" width="128" height="128"/>
+    </resources>
 </document>