ソースを参照

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

tangchao 1 年間 前
コミット
86672be5e1
18 ファイル変更149 行追加120 行削除
  1. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/1024.png
  2. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/128.png
  3. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/16.png
  4. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/256 1.png
  5. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/256.png
  6. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/32 1.png
  7. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/32.png
  8. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/512 1.png
  9. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/512.png
  10. BIN
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/64.png
  11. 10 0
      PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/Contents.json
  12. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/KMimageAppIcon.imageset/1024.png
  13. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/KMimageAppIcon.imageset/Contents.json
  14. 7 0
      PDF Office/PDF Master/Class/Document/KMMainDocument.swift
  15. 109 109
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+UI.swift
  16. 3 3
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.xib
  17. 2 2
      PDF Office/PDF Master/Class/Home/WindowController/KMHistoryFileDeleteWindowController.xib
  18. 6 6
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.xib

BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/1024.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/128.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/16.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/256 1.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/256.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/32 1.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/32.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/512 1.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/512.png


BIN
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/64.png


+ 10 - 0
PDF Office/PDF Master/Assets.xcassets/AppIcon.appiconset/Contents.json

@@ -1,51 +1,61 @@
 {
   "images" : [
     {
+      "filename" : "16.png",
       "idiom" : "mac",
       "scale" : "1x",
       "size" : "16x16"
     },
     {
+      "filename" : "32 1.png",
       "idiom" : "mac",
       "scale" : "2x",
       "size" : "16x16"
     },
     {
+      "filename" : "32.png",
       "idiom" : "mac",
       "scale" : "1x",
       "size" : "32x32"
     },
     {
+      "filename" : "64.png",
       "idiom" : "mac",
       "scale" : "2x",
       "size" : "32x32"
     },
     {
+      "filename" : "128.png",
       "idiom" : "mac",
       "scale" : "1x",
       "size" : "128x128"
     },
     {
+      "filename" : "256 1.png",
       "idiom" : "mac",
       "scale" : "2x",
       "size" : "128x128"
     },
     {
+      "filename" : "256.png",
       "idiom" : "mac",
       "scale" : "1x",
       "size" : "256x256"
     },
     {
+      "filename" : "512 1.png",
       "idiom" : "mac",
       "scale" : "2x",
       "size" : "256x256"
     },
     {
+      "filename" : "512.png",
       "idiom" : "mac",
       "scale" : "1x",
       "size" : "512x512"
     },
     {
+      "filename" : "1024.png",
       "idiom" : "mac",
       "scale" : "2x",
       "size" : "512x512"

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/KMimageAppIcon.imageset/1024.png


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/KMimageAppIcon.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "1024.png",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

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

@@ -57,6 +57,13 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
         mainViewController?.myDocument = self
         
         if ((self.fileURL?.path) != nil) {
+            if !self.fileURL!.path.isPDFValid() {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
+                alert.runModal()
+                return
+            }
             let pdfDocument = CPDFDocument.init(url: URL(fileURLWithPath: self.fileURL!.path))
             mainViewController?.document = pdfDocument
         }

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

@@ -11,115 +11,115 @@ extension KMHomeViewController {
     
     // MARK: Private Methods
     func productPromotionShow(_ pdfProSeries: NSArray, withOthers others: NSArray, isInitialize initialize: Bool) {
-        if pdfProSeries.count > 0 {
-            if (self.pdfProSeriesBoxHeightConstraint.constant == 0.0) || initialize {
-                var height = CGFloat(pdfProSeries.count) * 32.0
-                for name in pdfProSeries {
-                    height -= 32.0
-
-                    let dict: Dictionary = self.productPromotionData[name] as! Dictionary<NSString, NSString>
-                    let subBox = KMBox(frame: CGRect(origin: CGPoint(x: 0, y: height), size: CGSize(width: self.pdfProSeriesBox.frame.width, height: 32.0)))
-                    subBox.boxType = .custom
-                    subBox.borderWidth = 0.0
-                    self.pdfProSeriesBox.contentView?.addSubview(subBox)
-                    subBox.downCallback = {(downEntered, mouseBox, event) -> Void in
-                        if downEntered {
-                            self.productPromotionClickAction(dict["Name"]!)
-                        }
-                    }
-                                        
-                    let subImageView = NSImageView(frame: NSZeroRect)
-                    subImageView.image = NSImage(named: dict["Image"]! as NSImage.Name)
-                    subBox.addSubview(subImageView)
-                    subImageView.mas_makeConstraints { (make) in
-                        make?.width.height().equalTo()(16)
-                        make?.centerY.equalTo()(0)
-                        make?.left.equalTo()(18)
-                    }
-
-                    let subLabel = NSTextField(frame: NSZeroRect)
-                    subLabel.isBezeled = false
-                    subLabel.isEditable = false
-                    subLabel.backgroundColor = .clear
-                    let paragraphStyle = NSMutableParagraphStyle()
-                    paragraphStyle.lineSpacing = 22.0
-                    subLabel.attributedStringValue = NSAttributedString(string: dict["Name"]! as String, attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])
-                    subLabel.font = NSFont(name: "SFProText-Regular", size: 14)
-                    subLabel.textColor = NSColor(hex: "#616469")
-                    subLabel.sizeToFit()
-                    subBox.addSubview(subLabel)
-                    subLabel.mas_makeConstraints { (make) in
-                        make?.left.equalTo()(subImageView.mas_right)?.offset()(10)
-                        make?.centerY.equalTo()(0)
-                    }
-                }
-                
-                pdfSeriesButtonVC.image = NSImage(named: "icon_btn_expand_lv2_down_false")!
-                self.pdfProSeriesBoxHeightConstraint.constant = CGFloat(pdfProSeries.count) * 32.0
-            }
-        } else {
-            pdfSeriesButtonVC.image = NSImage(named: "icon_btn_expand_lv2_right_false")!
-            self.pdfProSeriesBox.contentView = NSView.init()
-            self.pdfProSeriesBoxHeightConstraint.constant = 0.0
-        }
-        
-        if others.count > 0 {
-            if (self.othersBoxHeightConstraint.constant == 0.0) || initialize {
-                var height = CGFloat(others.count) * 32.0
-                for name in others {
-                    height -= 32.0
-
-                    let dict: Dictionary = self.productPromotionData[name] as! Dictionary<NSString, NSString>
-                    let subBox = KMBox(frame: CGRect(x: 0, y: height, width: self.othersBox.frame.width, height: 32.0))
-                    subBox.boxType = .custom
-                    subBox.borderWidth = 0.0
-                    self.othersBox.contentView?.addSubview(subBox)
-                    subBox.downCallback = {(downEntered, mouseBox, event) -> Void in
-                        if downEntered {
-                            self.productPromotionClickAction(dict["Name"]!)
-                        }
-                    }
-                    
-                    let subImageView = NSImageView(frame: NSZeroRect)
-                    subImageView.image = NSImage(named: dict["Image"]! as NSImage.Name)
-                    subImageView.imageScaling = .scaleProportionallyDown
-                    subImageView.imageAlignment = .alignCenter
-                    subImageView.sizeToFit()
-                    subBox.addSubview(subImageView)
-                    subImageView.mas_makeConstraints { (make) in
-                        make?.width.height().equalTo()(16)
-                        make?.centerY.equalTo()(0)
-                        make?.left.equalTo()(18)
-                    }
-
-                    let subLabel = NSTextField(frame: NSZeroRect)
-                    subLabel.isBezeled = false
-                    subLabel.isEditable = false
-                    subLabel.backgroundColor = .clear
-                    let paragraphStyle = NSMutableParagraphStyle()
-                    paragraphStyle.lineSpacing = 22.0
-                    subLabel.attributedStringValue = NSAttributedString(string: dict["Name"]! as String, attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])
-                    subLabel.font = NSFont(name: "SFProText-Regular", size: 14)
-                    subLabel.textColor = NSColor(red: 0.38, green: 0.392, blue: 0.412, alpha: 1.0)
-                    subLabel.sizeToFit()
-                    subBox.addSubview(subLabel)
-                    subLabel.mas_makeConstraints { (make) in
-                        make?.left.equalTo()(subImageView.mas_right)?.offset()(10)
-                        make?.centerY.equalTo()(0)
-                    }
-                }
-                
-                self.pdfOthersButtonVC.image = NSImage(named: "icon_btn_expand_lv2_down_false")!
-                self.othersBoxHeightConstraint.constant = CGFloat(others.count) * 32.0
-            }
-        } else {
-            self.pdfOthersButtonVC.image = NSImage(named: "icon_btn_expand_lv2_right_false")!
-            self.othersBox.contentView = NSView.init()
-            self.othersBoxHeightConstraint.constant = 0.0
-        }
-        
-        pdfSeriesButtonVC.updateUI()
-        pdfOthersButtonVC.updateUI()
+//        if pdfProSeries.count > 0 {
+//            if (self.pdfProSeriesBoxHeightConstraint.constant == 0.0) || initialize {
+//                var height = CGFloat(pdfProSeries.count) * 32.0
+//                for name in pdfProSeries {
+//                    height -= 32.0
+//
+//                    let dict: Dictionary = self.productPromotionData[name] as! Dictionary<NSString, NSString>
+//                    let subBox = KMBox(frame: CGRect(origin: CGPoint(x: 0, y: height), size: CGSize(width: self.pdfProSeriesBox.frame.width, height: 32.0)))
+//                    subBox.boxType = .custom
+//                    subBox.borderWidth = 0.0
+//                    self.pdfProSeriesBox.contentView?.addSubview(subBox)
+//                    subBox.downCallback = {(downEntered, mouseBox, event) -> Void in
+//                        if downEntered {
+//                            self.productPromotionClickAction(dict["Name"]!)
+//                        }
+//                    }
+//
+//                    let subImageView = NSImageView(frame: NSZeroRect)
+//                    subImageView.image = NSImage(named: dict["Image"]! as NSImage.Name)
+//                    subBox.addSubview(subImageView)
+//                    subImageView.mas_makeConstraints { (make) in
+//                        make?.width.height().equalTo()(16)
+//                        make?.centerY.equalTo()(0)
+//                        make?.left.equalTo()(18)
+//                    }
+//
+//                    let subLabel = NSTextField(frame: NSZeroRect)
+//                    subLabel.isBezeled = false
+//                    subLabel.isEditable = false
+//                    subLabel.backgroundColor = .clear
+//                    let paragraphStyle = NSMutableParagraphStyle()
+//                    paragraphStyle.lineSpacing = 22.0
+//                    subLabel.attributedStringValue = NSAttributedString(string: dict["Name"]! as String, attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])
+//                    subLabel.font = NSFont(name: "SFProText-Regular", size: 14)
+//                    subLabel.textColor = NSColor(hex: "#616469")
+//                    subLabel.sizeToFit()
+//                    subBox.addSubview(subLabel)
+//                    subLabel.mas_makeConstraints { (make) in
+//                        make?.left.equalTo()(subImageView.mas_right)?.offset()(10)
+//                        make?.centerY.equalTo()(0)
+//                    }
+//                }
+//
+//                pdfSeriesButtonVC.image = NSImage(named: "icon_btn_expand_lv2_down_false")!
+//                self.pdfProSeriesBoxHeightConstraint.constant = CGFloat(pdfProSeries.count) * 32.0
+//            }
+//        } else {
+//            pdfSeriesButtonVC.image = NSImage(named: "icon_btn_expand_lv2_right_false")!
+//            self.pdfProSeriesBox.contentView = NSView.init()
+//            self.pdfProSeriesBoxHeightConstraint.constant = 0.0
+//        }
+//
+//        if others.count > 0 {
+//            if (self.othersBoxHeightConstraint.constant == 0.0) || initialize {
+//                var height = CGFloat(others.count) * 32.0
+//                for name in others {
+//                    height -= 32.0
+//
+//                    let dict: Dictionary = self.productPromotionData[name] as! Dictionary<NSString, NSString>
+//                    let subBox = KMBox(frame: CGRect(x: 0, y: height, width: self.othersBox.frame.width, height: 32.0))
+//                    subBox.boxType = .custom
+//                    subBox.borderWidth = 0.0
+//                    self.othersBox.contentView?.addSubview(subBox)
+//                    subBox.downCallback = {(downEntered, mouseBox, event) -> Void in
+//                        if downEntered {
+//                            self.productPromotionClickAction(dict["Name"]!)
+//                        }
+//                    }
+//
+//                    let subImageView = NSImageView(frame: NSZeroRect)
+//                    subImageView.image = NSImage(named: dict["Image"]! as NSImage.Name)
+//                    subImageView.imageScaling = .scaleProportionallyDown
+//                    subImageView.imageAlignment = .alignCenter
+//                    subImageView.sizeToFit()
+//                    subBox.addSubview(subImageView)
+//                    subImageView.mas_makeConstraints { (make) in
+//                        make?.width.height().equalTo()(16)
+//                        make?.centerY.equalTo()(0)
+//                        make?.left.equalTo()(18)
+//                    }
+//
+//                    let subLabel = NSTextField(frame: NSZeroRect)
+//                    subLabel.isBezeled = false
+//                    subLabel.isEditable = false
+//                    subLabel.backgroundColor = .clear
+//                    let paragraphStyle = NSMutableParagraphStyle()
+//                    paragraphStyle.lineSpacing = 22.0
+//                    subLabel.attributedStringValue = NSAttributedString(string: dict["Name"]! as String, attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])
+//                    subLabel.font = NSFont(name: "SFProText-Regular", size: 14)
+//                    subLabel.textColor = NSColor(red: 0.38, green: 0.392, blue: 0.412, alpha: 1.0)
+//                    subLabel.sizeToFit()
+//                    subBox.addSubview(subLabel)
+//                    subLabel.mas_makeConstraints { (make) in
+//                        make?.left.equalTo()(subImageView.mas_right)?.offset()(10)
+//                        make?.centerY.equalTo()(0)
+//                    }
+//                }
+//
+//                self.pdfOthersButtonVC.image = NSImage(named: "icon_btn_expand_lv2_down_false")!
+//                self.othersBoxHeightConstraint.constant = CGFloat(others.count) * 32.0
+//            }
+//        } else {
+//            self.pdfOthersButtonVC.image = NSImage(named: "icon_btn_expand_lv2_right_false")!
+//            self.othersBox.contentView = NSView.init()
+//            self.othersBoxHeightConstraint.constant = 0.0
+//        }
+//
+//        pdfSeriesButtonVC.updateUI()
+//        pdfOthersButtonVC.updateUI()
     }
     
     func refreshRightBoxUI(_ state: KMHomeToolState) {

+ 3 - 3
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.xib

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -183,7 +183,7 @@ Gw
                                         </constraints>
                                         <color key="fillColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
                                     </box>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="TRt-mD-49a">
+                                    <box hidden="YES" boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="TRt-mD-49a">
                                         <rect key="frame" x="0.0" y="0.0" width="270" height="652"/>
                                         <view key="contentView" id="gKL-oe-inN">
                                             <rect key="frame" x="0.0" y="0.0" width="270" height="652"/>

+ 2 - 2
PDF Office/PDF Master/Class/Home/WindowController/KMHistoryFileDeleteWindowController.xib

@@ -83,7 +83,7 @@
                             <constraint firstAttribute="width" constant="64" id="2Bl-A7-mw4"/>
                             <constraint firstAttribute="height" constant="64" id="Xct-nV-zdw"/>
                         </constraints>
-                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Biochemistry" id="ohe-3M-dgU"/>
+                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMimageAppIcon" id="ohe-3M-dgU"/>
                     </imageView>
                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="D79-0i-D8F">
                         <rect key="frame" x="16" y="17" width="228" height="16"/>
@@ -115,6 +115,6 @@
         </window>
     </objects>
     <resources>
-        <image name="Biochemistry" width="612" height="783"/>
+        <image name="KMimageAppIcon" width="1024" height="1024"/>
     </resources>
 </document>

+ 6 - 6
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.xib

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="Named colors" minToolsVersion="9.0"/>
         <capability name="System colors introduced in macOS 10.13" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -456,20 +456,20 @@
                                         </textFieldCell>
                                     </textField>
                                     <slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="boX-yy-3DZ">
-                                        <rect key="frame" x="-2" y="0.0" width="356" height="28"/>
+                                        <rect key="frame" x="-2" y="0.0" width="344" height="28"/>
                                         <sliderCell key="cell" alignment="left" minValue="0.5" maxValue="18" doubleValue="0.5" tickMarkPosition="above" sliderType="linear" id="uiL-cC-yeG" customClass="KMPropertiesSliderCell"/>
                                         <connections>
                                             <action selector="borderWidthSliderAction:" target="-2" id="fbp-7j-nGS"/>
                                         </connections>
                                     </slider>
                                     <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="2bK-LP-P1I">
-                                        <rect key="frame" x="360" y="0.0" width="74" height="32"/>
+                                        <rect key="frame" x="348" y="0.0" width="86" height="32"/>
                                         <view key="contentView" id="oLX-rC-t03">
-                                            <rect key="frame" x="0.0" y="0.0" width="74" height="32"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="86" height="32"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         </view>
                                         <constraints>
-                                            <constraint firstAttribute="width" constant="74" id="8u4-a7-T0Q"/>
+                                            <constraint firstAttribute="width" constant="86" id="8u4-a7-T0Q"/>
                                             <constraint firstAttribute="height" constant="32" id="Fft-yn-Le9"/>
                                         </constraints>
                                         <color key="fillColor" red="0.92156862750000001" green="0.92156862750000001" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>