Browse Source

【总共】合并代码

niehaoyu 1 year ago
parent
commit
240814486d
14 changed files with 477 additions and 94 deletions
  1. 107 2
      PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  2. 3 3
      PDF Office/PDF Master/Class/AD/KMAdsManager.swift
  3. 2 2
      PDF Office/PDF Master/Class/PDFTools/Redact/View/KMRedactPDFView.swift
  4. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotation+PDFListView.swift
  5. 15 15
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m
  6. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFStampAnnotation+PDFListView.swift
  7. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/KMAnnotationSelfSignViewController.swift
  8. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift
  9. 35 0
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  10. 20 3
      PDF Office/PDF Master/Class/Preference/Controller/GeneralPreferences.xib
  11. 91 59
      PDF Office/PDF Master/Class/Preference/Controller/KMGeneralPreferences.swift
  12. 16 0
      PDF Office/PDF Master/Class/Preference/Tools/KMPreferenceEnum.swift
  13. 183 5
      PDF Office/PDF Master/Class/Preference/Tools/KMPreferenceManager.swift
  14. 1 1
      PDF Office/PDF Master/Third Pard Library/RemoteConfig /KMFirebaseRemoteConfig.swift

+ 107 - 2
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -112,6 +112,51 @@
                   endingLineNumber = "729"
                   endingLineNumber = "729"
                   offsetFromSymbolStart = "296">
                   offsetFromSymbolStart = "296">
                </Location>
                </Location>
+               <Location
+                  uuid = "770E4A49-AE8B-4D16-BE6A-9C03F79E1C27 - 7f6d6c511fd316ac"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "function signature specialization &lt;Arg[0] = Dead, Arg[1] = Dead, Arg[3] = Dead&gt; of PDF_Master_DMG.KMMainViewController.mainToolDidClicked(PDF_Master_DMG.KMToolbarController, PDF_Master_DMG.KMToolbarViewType, PDF_Master_DMG.KMToolbarViewType, PDF_Master_DMG.KMToolbarItemView, Swift.Array&lt;Swift.Int&gt;) -&gt; ()"
+                  moduleName = "PDF Master DMG"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "961"
+                  endingLineNumber = "961"
+                  offsetFromSymbolStart = "52">
+               </Location>
+               <Location
+                  uuid = "770E4A49-AE8B-4D16-BE6A-9C03F79E1C27 - 7f6d6c511fd316ac"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "function signature specialization &lt;Arg[0] = Dead, Arg[1] = Dead, Arg[3] = Dead&gt; of PDF_Master_DMG.KMMainViewController.mainToolDidClicked(PDF_Master_DMG.KMToolbarController, PDF_Master_DMG.KMToolbarViewType, PDF_Master_DMG.KMToolbarViewType, PDF_Master_DMG.KMToolbarItemView, Swift.Array&lt;Swift.Int&gt;) -&gt; ()"
+                  moduleName = "PDF Master DMG"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "961"
+                  endingLineNumber = "961"
+                  offsetFromSymbolStart = "116">
+               </Location>
+               <Location
+                  uuid = "770E4A49-AE8B-4D16-BE6A-9C03F79E1C27 - c7c9950d5bad6aa"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Master.KMMainViewController.loadOpenFileFunctionGuide(PDF_Master.KMGuideInfoType) -&gt; ()"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "727"
+                  endingLineNumber = "727"
+                  offsetFromSymbolStart = "5360">
+               </Location>
             </Locations>
             </Locations>
          </BreakpointContent>
          </BreakpointContent>
       </BreakpointProxy>
       </BreakpointProxy>
@@ -127,7 +172,7 @@
             endingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "651"
             startingLineNumber = "651"
             endingLineNumber = "651"
             endingLineNumber = "651"
-            landmarkName = "loadOpenFileFunctionGuide(_:)"
+            landmarkName = "exitRedact()"
             landmarkType = "7">
             landmarkType = "7">
             <Locations>
             <Locations>
                <Location
                <Location
@@ -175,6 +220,36 @@
                   endingLineNumber = "651"
                   endingLineNumber = "651"
                   offsetFromSymbolStart = "248">
                   offsetFromSymbolStart = "248">
                </Location>
                </Location>
+               <Location
+                  uuid = "903D6DDB-4B0A-46CE-AC26-BED5BBAC004A - eb56ed4accbfdf77"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Master_DMG.KMMainViewController.exitRedact() -&gt; ()"
+                  moduleName = "PDF Master DMG"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "654"
+                  endingLineNumber = "654"
+                  offsetFromSymbolStart = "692">
+               </Location>
+               <Location
+                  uuid = "903D6DDB-4B0A-46CE-AC26-BED5BBAC004A - 94d87cfcea612845"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Master.KMMainViewController.exitRedact() -&gt; ()"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "651"
+                  endingLineNumber = "651"
+                  offsetFromSymbolStart = "856">
+               </Location>
             </Locations>
             </Locations>
          </BreakpointContent>
          </BreakpointContent>
       </BreakpointProxy>
       </BreakpointProxy>
@@ -190,7 +265,7 @@
             endingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "644"
             startingLineNumber = "644"
             endingLineNumber = "644"
             endingLineNumber = "644"
-            landmarkName = "loadFunctionGuide()"
+            landmarkName = "exitRedact()"
             landmarkType = "7">
             landmarkType = "7">
             <Locations>
             <Locations>
                <Location
                <Location
@@ -223,6 +298,36 @@
                   endingLineNumber = "644"
                   endingLineNumber = "644"
                   offsetFromSymbolStart = "88">
                   offsetFromSymbolStart = "88">
                </Location>
                </Location>
+               <Location
+                  uuid = "DB0771E1-CC58-41E1-A794-02CDE3656544 - eb56ed4accbfdebd"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Master_DMG.KMMainViewController.exitRedact() -&gt; ()"
+                  moduleName = "PDF Master DMG"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "644"
+                  endingLineNumber = "644"
+                  offsetFromSymbolStart = "132">
+               </Location>
+               <Location
+                  uuid = "DB0771E1-CC58-41E1-A794-02CDE3656544 - 94d87cfcea61296c"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Master.KMMainViewController.exitRedact() -&gt; ()"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "644"
+                  endingLineNumber = "644"
+                  offsetFromSymbolStart = "160">
+               </Location>
             </Locations>
             </Locations>
          </BreakpointContent>
          </BreakpointContent>
       </BreakpointProxy>
       </BreakpointProxy>

+ 3 - 3
PDF Office/PDF Master/Class/AD/KMAdsManager.swift

@@ -57,9 +57,9 @@ class KMAdsManager: NSObject {
             return false
             return false
         }
         }
         
         
-        if !checkTheDate() {
-            return false
-        }
+//        if !checkTheDate() {
+//            return false
+//        }
         
         
         if !checkNetworkAvailable() {
         if !checkNetworkAvailable() {
             return false
             return false

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Redact/View/KMRedactPDFView.swift

@@ -284,7 +284,7 @@ private let KMPDFViewRedactAnnotationAcross = "KMPDFViewRedactAnnotationAcross"
                     let page = self.currentSelection.page
                     let page = self.currentSelection.page
                     let annotation = self.addRedactPDFSelection(self.currentSelection)
                     let annotation = self.addRedactPDFSelection(self.currentSelection)
                     annotation?.setModificationDate(Date())
                     annotation?.setModificationDate(Date())
-                    let userName = UserDefaults.standard.string(forKey: "SKUserName")
+                    let userName = KMPreference.shared.author
                     annotation?.setUserName(userName ?? NSFullUserName())
                     annotation?.setUserName(userName ?? NSFullUserName())
                     
                     
                     annotation?.borderWidth = 10
                     annotation?.borderWidth = 10
@@ -360,7 +360,7 @@ private let KMPDFViewRedactAnnotationAcross = "KMPDFViewRedactAnnotationAcross"
                 annotation?.setQuadrilateralPoints(quadrilateralPoints as! [Any])
                 annotation?.setQuadrilateralPoints(quadrilateralPoints as! [Any])
                                         
                                         
                 annotation?.setModificationDate(Date())
                 annotation?.setModificationDate(Date())
-                let userName = UserDefaults.standard.string(forKey: "SKUserName") ?? NSFullUserName()
+                let userName = KMPreference.shared.author
                 annotation?.setUserName(userName)
                 annotation?.setUserName(userName)
 
 
 //                if ([annotation isKindOfClass:[CPDFRedactAnnotation class]]) {
 //                if ([annotation isKindOfClass:[CPDFRedactAnnotation class]]) {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotation+PDFListView.swift

@@ -128,7 +128,7 @@ import Foundation
     }
     }
     
     
     func registerUserName() -> Void {
     func registerUserName() -> Void {
-        let userName = UserDefaults.standard.string(forKey: "SKUserName") ?? ""
+        let userName = KMPreference.shared.author
         setUserName(userName)
         setUserName(userName)
         
         
         if !UserDefaults.standard.bool(forKey: "SKDisableModificationDate") {
         if !UserDefaults.standard.bool(forKey: "SKDisableModificationDate") {

+ 15 - 15
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m

@@ -293,19 +293,19 @@
                 color = [userDefaults PDFListViewColorForKey:CInkNoteColorKey];
                 color = [userDefaults PDFListViewColorForKey:CInkNoteColorKey];
                 break;
                 break;
             case CAnnotationTypeSignFalse:
             case CAnnotationTypeSignFalse:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignFalseColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignFalseColorKey] ? : NSColor.blackColor;
                 break;
                 break;
             case CAnnotationTypeSignTure:
             case CAnnotationTypeSignTure:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignTureColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignTureColorKey] ? : NSColor.blackColor;
                 break;
                 break;
             case CAnnotationTypeSignCircle:
             case CAnnotationTypeSignCircle:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignCircleColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignCircleColorKey] ? : NSColor.blackColor;
                 break;
                 break;
             case CAnnotationTypeSignLine:
             case CAnnotationTypeSignLine:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignLineColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignLineColorKey] ? : NSColor.blackColor;
                 break;
                 break;
             case CAnnotationTypeSignDot:
             case CAnnotationTypeSignDot:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignDotColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignDotColorKey] ? : NSColor.blackColor;
                 break;
                 break;
             case CAnnotationTypeRedact:
             case CAnnotationTypeRedact:
                 color = [userDefaults PDFListViewColorForKey:CAnnotationRedactBorderColorKey];
                 color = [userDefaults PDFListViewColorForKey:CAnnotationRedactBorderColorKey];
@@ -899,19 +899,19 @@
                 width = [userDefaults floatForKey:CDefaultSignatureNoteWidthKey];
                 width = [userDefaults floatForKey:CDefaultSignatureNoteWidthKey];
                 break;
                 break;
             case CAnnotationTypeSignFalse:
             case CAnnotationTypeSignFalse:
-                width = [userDefaults floatForKey:CDefaultSignFalseNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignFalseNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignFalseNoteWidthKey];
                 break;
                 break;
             case CAnnotationTypeSignTure:
             case CAnnotationTypeSignTure:
-                width = [userDefaults floatForKey:CDefaultSignTureNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignTureNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignTureNoteWidthKey];
                 break;
                 break;
             case CAnnotationTypeSignCircle:
             case CAnnotationTypeSignCircle:
-                width = [userDefaults floatForKey:CDefaultSignCircleNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignCircleNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignCircleNoteWidthKey];
                 break;
                 break;
             case CAnnotationTypeSignLine:
             case CAnnotationTypeSignLine:
-                width = [userDefaults floatForKey:CDefaultSignLineNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignLineNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignLineNoteWidthKey];
                 break;
                 break;
             case CAnnotationTypeSignDot:
             case CAnnotationTypeSignDot:
-                width = [userDefaults floatForKey:CDefaultSignDotNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignDotNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignDotNoteWidthKey];
                 break;
                 break;
             default:
             default:
                 width = [userDefaults floatForKey:CDefaultNoteWidthKey];
                 width = [userDefaults floatForKey:CDefaultNoteWidthKey];
@@ -1012,19 +1012,19 @@
                 height = [userDefaults floatForKey:CDefaultSignatureNoteHeightKey];
                 height = [userDefaults floatForKey:CDefaultSignatureNoteHeightKey];
                 break;
                 break;
             case CAnnotationTypeSignFalse:
             case CAnnotationTypeSignFalse:
-                height = [userDefaults floatForKey:CDefaultSignFalseNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignFalseNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignFalseNoteHeightKey];
                 break;
                 break;
             case CAnnotationTypeSignTure:
             case CAnnotationTypeSignTure:
-                height = [userDefaults floatForKey:CDefaultSignTureNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignTureNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignTureNoteHeightKey];
                 break;
                 break;
             case CAnnotationTypeSignCircle:
             case CAnnotationTypeSignCircle:
-                height = [userDefaults floatForKey:CDefaultSignCircleNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignCircleNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignCircleNoteHeightKey];
                 break;
                 break;
             case CAnnotationTypeSignLine:
             case CAnnotationTypeSignLine:
-                height = [userDefaults floatForKey:CDefaultSignLineNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignLineNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignLineNoteHeightKey];
                 break;
                 break;
             case CAnnotationTypeSignDot:
             case CAnnotationTypeSignDot:
-                height = [userDefaults floatForKey:CDefaultSignDotNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignDotNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignDotNoteHeightKey];
                 break;
                 break;
             default:
             default:
                 height = [userDefaults floatForKey:CDefaultNoteHeightKey];
                 height = [userDefaults floatForKey:CDefaultNoteHeightKey];

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFStampAnnotation+PDFListView.swift

@@ -36,7 +36,7 @@ import Foundation
             context?.setStrokeColor(paintColor.cgColor)
             context?.setStrokeColor(paintColor.cgColor)
             context?.setFillColor(paintColor.cgColor)
             context?.setFillColor(paintColor.cgColor)
             context?.strokePath()
             context?.strokePath()
-        } else if (annotationModel.stampAnnotationType() == .signature) {
+        } else if (annotationModel.stampAnnotationType() == .signTure) {
             context?.move(to: CGPoint(x: CGRectGetMinX(bounds) + lineWidth/2, y: CGRectGetMidY(bounds) + lineWidth/2))
             context?.move(to: CGPoint(x: CGRectGetMinX(bounds) + lineWidth/2, y: CGRectGetMidY(bounds) + lineWidth/2))
             context?.addLine(to: CGPoint(x: CGRectGetMinX(bounds) + CGRectGetWidth(bounds)/3.0, y: CGRectGetMinY(bounds) + lineWidth/2))
             context?.addLine(to: CGPoint(x: CGRectGetMinX(bounds) + CGRectGetWidth(bounds)/3.0, y: CGRectGetMinY(bounds) + lineWidth/2))
             context?.addLine(to: CGPoint(x: CGRectGetMaxX(bounds) - lineWidth/2, y: CGRectGetMaxY(bounds) - lineWidth/2))
             context?.addLine(to: CGPoint(x: CGRectGetMaxX(bounds) - lineWidth/2, y: CGRectGetMaxY(bounds) - lineWidth/2))

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/KMAnnotationSelfSignViewController.swift

@@ -89,7 +89,7 @@ typealias KMAnnotationSelfSignViewControllerCallBack = (CAnnotationType) -> Void
         color?.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green: nil, blue: nil, alpha: &opacity)
         color?.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green: nil, blue: nil, alpha: &opacity)
         opacityComboBox.stringValue = "\(Int(opacity * 100))%"
         opacityComboBox.stringValue = "\(Int(opacity * 100))%"
         opacitySlider.floatValue = Float(opacity)
         opacitySlider.floatValue = Float(opacity)
-        imageView.image = drawImage(with: selfSignType)
+        imageView.image = annotationModel?.annotationImage
 
 
         // ComboBox Configuration
         // ComboBox Configuration
         opacityComboBox.type = .none
         opacityComboBox.type = .none

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift

@@ -566,7 +566,7 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
         dynamicStampNeedsAuthor = !isNeedAuthor
         dynamicStampNeedsAuthor = !isNeedAuthor
         selectButton.state = dynamicStampNeedsAuthor ? .on : .off
         selectButton.state = dynamicStampNeedsAuthor ? .on : .off
         
         
-        let author = UserDefaults.standard.string(forKey: "SKUserName") ?? NSFullUserName()
+        let author = KMPreference.shared.author
         
         
         if dynamicStampNeedsAuthor {
         if dynamicStampNeedsAuthor {
             authorTextField.isEditable = true
             authorTextField.isEditable = true

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

@@ -363,6 +363,8 @@ import Cocoa
 
 
         self.addKeyEventMonitor()
         self.addKeyEventMonitor()
         
         
+        self.addAdsBannerView()
+        
         //检测OCR包是否需要更新
         //检测OCR包是否需要更新
         #if VERSION_DMG
         #if VERSION_DMG
         KMResourceDownloadManager.manager.checkDocumentAIVersion()
         KMResourceDownloadManager.manager.checkDocumentAIVersion()
@@ -429,6 +431,39 @@ import Cocoa
         }
         }
     }
     }
     
     
+    func addAdsBannerView() {
+#if VERSION_FREE
+//        if !self.listView.document.isLocked {
+            KMAdsManager.defaultManager.beginSheetModalForView(self.readContentView, directions: .down, adPosY: 30, animated: false) { pageIndex in
+                
+            }
+//        }
+#endif
+        //加载底部banner
+    //    - (void)loadingAdsManager {
+    //    #if VERSION_FREE
+    //            if(![self.pdfDocument isLocked]) {
+    //                if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+    //                    [[KMAdsManager defaultManager] beginSheetModalForView:self.pdfView
+    //                                                               directions:KMADViewDirectionsDown
+    //                                                                 animated:NO
+    //                                                        completionHandler:nil];
+    //                }
+    //                [[NSNotificationCenter defaultCenter] addObserverForName:KMIAPProductPurchasedNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note){
+    //                    if ([IAPProductsManager defaultManager].isAvailableAllFunction) {
+    //                        [[KMAdsManager defaultManager] dismissSheetModalForView:self.pdfView];
+    //                    }
+    //                }];
+    //                [[NSNotificationCenter defaultCenter] addObserverForName:kDeviceActivateStatusChangeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note){
+    //                    if ([IAPProductsManager defaultManager].isAvailableAllFunction) {
+    //                        [[KMAdsManager defaultManager] dismissSheetModalForView:self.pdfView];
+    //                    }
+    //                }];
+    //            }
+    //    #endif
+    //    }
+    }
+    
     // MARK: Private Methods
     // MARK: Private Methods
     
     
     internal func removeNotifications() {
     internal func removeNotifications() {

+ 20 - 3
PDF Office/PDF Master/Class/Preference/Controller/GeneralPreferences.xib

@@ -12,16 +12,21 @@
                 <outlet property="authorTextField" destination="Pi4-Gm-XJ3" id="jjy-qG-sCq"/>
                 <outlet property="authorTextField" destination="Pi4-Gm-XJ3" id="jjy-qG-sCq"/>
                 <outlet property="autoSaveInfoBtn" destination="cFS-gz-76C" id="Tbf-O5-ie1"/>
                 <outlet property="autoSaveInfoBtn" destination="cFS-gz-76C" id="Tbf-O5-ie1"/>
                 <outlet property="autoSaveLbl" destination="ZL9-Lh-TU6" id="x6x-wf-IHZ"/>
                 <outlet property="autoSaveLbl" destination="ZL9-Lh-TU6" id="x6x-wf-IHZ"/>
+                <outlet property="autoSaveNotesBackupButton" destination="12" id="JPy-Ij-KCO"/>
                 <outlet property="autoSaveSlider" destination="lhd-Ip-SPl" id="TBt-xk-IJ2"/>
                 <outlet property="autoSaveSlider" destination="lhd-Ip-SPl" id="TBt-xk-IJ2"/>
                 <outlet property="defaultOpenButton" destination="Va1-PC-V4S" id="xHW-Ke-qfy"/>
                 <outlet property="defaultOpenButton" destination="Va1-PC-V4S" id="xHW-Ke-qfy"/>
                 <outlet property="fullScreenButton" destination="13" id="rwP-bT-LWq"/>
                 <outlet property="fullScreenButton" destination="13" id="rwP-bT-LWq"/>
+                <outlet property="keepSnapshotOnTopButton" destination="4" id="bht-be-yAj"/>
                 <outlet property="normalButton" destination="14" id="2S5-K4-kkj"/>
                 <outlet property="normalButton" destination="14" id="2S5-K4-kkj"/>
                 <outlet property="openFilesLabelField" destination="16" id="78"/>
                 <outlet property="openFilesLabelField" destination="16" id="78"/>
                 <outlet property="openFilesMatrix" destination="17" id="77"/>
                 <outlet property="openFilesMatrix" destination="17" id="77"/>
                 <outlet property="openTabButton" destination="A68-ez-c6M" id="72V-76-LRe"/>
                 <outlet property="openTabButton" destination="A68-ez-c6M" id="72V-76-LRe"/>
                 <outlet property="openTabLabel" destination="FPU-E1-Wj1" id="vuU-vq-0hl"/>
                 <outlet property="openTabLabel" destination="FPU-E1-Wj1" id="vuU-vq-0hl"/>
+                <outlet property="rememberSnapshotButton" destination="18" id="o9x-Lr-Cj5"/>
+                <outlet property="reopenLastOpenFilesButton" destination="2" id="bGZ-Pm-RIH"/>
                 <outlet property="savePasswordsMatrix" destination="21" id="75"/>
                 <outlet property="savePasswordsMatrix" destination="21" id="75"/>
                 <outlet property="showConvertMenuButton" destination="AVa-Al-8gG" id="XPN-Cp-dpt"/>
                 <outlet property="showConvertMenuButton" destination="AVa-Al-8gG" id="XPN-Cp-dpt"/>
+                <outlet property="showLeftSideButton" destination="3" id="dqO-V9-G0B"/>
                 <outlet property="updateIntervalLabelField" destination="7" id="76"/>
                 <outlet property="updateIntervalLabelField" destination="7" id="76"/>
                 <outlet property="updateIntervalPopUpButton" destination="9" id="74"/>
                 <outlet property="updateIntervalPopUpButton" destination="9" id="74"/>
                 <outlet property="view" destination="1" id="56"/>
                 <outlet property="view" destination="1" id="56"/>
@@ -50,9 +55,6 @@
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                     </textFieldCell>
-                    <connections>
-                        <action selector="authorTextFieldAction:" target="-2" id="Tbl-1N-Otd"/>
-                    </connections>
                 </textField>
                 </textField>
                 <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="fVJ-Td-OI7">
                 <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="fVJ-Td-OI7">
                     <rect key="frame" x="12" y="617" width="356" height="5"/>
                     <rect key="frame" x="12" y="617" width="356" height="5"/>
@@ -111,6 +113,9 @@
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <font key="font" metaFont="system"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
                     </buttonCell>
+                    <connections>
+                        <action selector="reopenLastOpenFilesAtStartupAction:" target="-2" id="ABg-kl-8FM"/>
+                    </connections>
                 </button>
                 </button>
                 <button toolTip="Remember and reopen files from a previous run" fixedFrame="YES" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cFS-gz-76C">
                 <button toolTip="Remember and reopen files from a previous run" fixedFrame="YES" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cFS-gz-76C">
                     <rect key="frame" x="18" y="468" width="344" height="18"/>
                     <rect key="frame" x="18" y="468" width="344" height="18"/>
@@ -190,6 +195,9 @@
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <font key="font" metaFont="system"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
                     </buttonCell>
+                    <connections>
+                        <action selector="showLeftSideAction:" target="-2" id="0rO-X8-nXC"/>
+                    </connections>
                 </button>
                 </button>
                 <button toolTip="Reopen the last viewed snapshots when opening a file" fixedFrame="YES" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="18">
                 <button toolTip="Reopen the last viewed snapshots when opening a file" fixedFrame="YES" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="18">
                     <rect key="frame" x="18" y="313" width="344" height="18"/>
                     <rect key="frame" x="18" y="313" width="344" height="18"/>
@@ -198,6 +206,9 @@
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <font key="font" metaFont="system"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
                     </buttonCell>
+                    <connections>
+                        <action selector="rememberSnapshotAction:" target="-2" id="i0F-9D-0X8"/>
+                    </connections>
                 </button>
                 </button>
                 <textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="15">
                 <textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="15">
                     <rect key="frame" x="17" y="290" width="346" height="17"/>
                     <rect key="frame" x="17" y="290" width="346" height="17"/>
@@ -247,6 +258,9 @@
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <font key="font" metaFont="system"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
                     </buttonCell>
+                    <connections>
+                        <action selector="autoSaveNoteBackupAction:" target="-2" id="h4T-oT-uCu"/>
+                    </connections>
                 </button>
                 </button>
                 <button toolTip="Always keep snapshot windows on top of other windows" fixedFrame="YES" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4">
                 <button toolTip="Always keep snapshot windows on top of other windows" fixedFrame="YES" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4">
                     <rect key="frame" x="18" y="139" width="344" height="18"/>
                     <rect key="frame" x="18" y="139" width="344" height="18"/>
@@ -255,6 +269,9 @@
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <font key="font" metaFont="system"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
                     </buttonCell>
+                    <connections>
+                        <action selector="keepSnapshotOnTopAction:" target="-2" id="NEa-h1-Q05"/>
+                    </connections>
                 </button>
                 </button>
                 <box hidden="YES" verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="6">
                 <box hidden="YES" verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="6">
                     <rect key="frame" x="12" y="123" width="356" height="5"/>
                     <rect key="frame" x="12" y="123" width="356" height="5"/>

+ 91 - 59
PDF Office/PDF Master/Class/Preference/Controller/KMGeneralPreferences.swift

@@ -8,39 +8,42 @@
 import Cocoa
 import Cocoa
 
 
 class KMGeneralPreferences: NSViewController {
 class KMGeneralPreferences: NSViewController {
-    
     /*
     /*
      #define  @""
      #define  @""
      #define AUTOMATICALLYCHECKSFORUPDATES_KEY @"automaticallyChecksForUpdates"
      #define AUTOMATICALLYCHECKSFORUPDATES_KEY @"automaticallyChecksForUpdates"
      #define UPDATECHECKINTERVAL_KEY @"updateCheckInterval"
      #define UPDATECHECKINTERVAL_KEY @"updateCheckInterval"
-
-     
      */
      */
     private let UPDATEINTERVAL_KEY = "updateInterval"
     private let UPDATEINTERVAL_KEY = "updateInterval"
     private let SUScheduledCheckIntervalKey = "SUScheduledCheckInterval"
     private let SUScheduledCheckIntervalKey = "SUScheduledCheckInterval"
     
     
-    @IBOutlet var updateIntervalPopUpButton: NSPopUpButton!
+    @IBOutlet weak var authorLabel: NSTextField!
+    @IBOutlet weak var authorTextField: NSTextField!
     
     
-    @IBOutlet var openFilesLabelField: NSTextField!
-    @IBOutlet var openFilesMatrix: NSMatrix!
-    @IBOutlet var updateIntervalLabelField: NSTextField!
+    @IBOutlet weak var openTabLabel: NSTextField!
+    @IBOutlet weak var openTabButton: NSPopUpButton!
+    @IBOutlet weak var showConvertMenuButton: NSButton!
+    @IBOutlet weak var defaultOpenButton: NSButton!
+    @IBOutlet weak var reopenLastOpenFilesButton: NSButton!
+    @IBOutlet weak var autoSaveLbl: NSTextField!
+    @IBOutlet weak var autoSaveInfoBtn: NSButton!
+    @IBOutlet weak var autoSaveSlider: NSSlider!
     
     
-    @IBOutlet var savePasswordsMatrix: NSMatrix!
-    @IBOutlet var authorLabel: NSTextField!
-    @IBOutlet var authorTextField: NSTextField!
+    @IBOutlet weak var openFilesLabelField: NSTextField!
+    @IBOutlet weak var openFilesMatrix: NSMatrix!
+    @IBOutlet weak var showLeftSideButton: NSButton!
+    @IBOutlet weak var rememberSnapshotButton: NSButton!
+    @IBOutlet weak var normalButton: NSButton!
+    @IBOutlet weak var fullScreenButton: NSButton!
     
     
-    @IBOutlet var defaultOpenButton: NSButton!
-    @IBOutlet var openTabLabel: NSTextField!
-    @IBOutlet var openTabButton: NSPopUpButton!
+    @IBOutlet weak var autoSaveNotesBackupButton: NSButton!
     
     
-    @IBOutlet var showConvertMenuButton: NSButton!
-    @IBOutlet var autoSaveInfoBtn: NSButton!
-    @IBOutlet var autoSaveSlider: NSSlider!
+    @IBOutlet weak var keepSnapshotOnTopButton: NSButton!
     
     
-    @IBOutlet var autoSaveLbl: NSTextField!
+    @IBOutlet var savePasswordsMatrix: NSMatrix!
+    
+    @IBOutlet var updateIntervalPopUpButton: NSPopUpButton!
+    @IBOutlet var updateIntervalLabelField: NSTextField!
     
     
-    @IBOutlet weak var normalButton: NSButton!
-    @IBOutlet weak var fullScreenButton: NSButton!
     var revertPDFSettingsButtons: [NSButton] = []
     var revertPDFSettingsButtons: [NSButton] = []
     
     
     var updateInterval: Int = 0 {
     var updateInterval: Int = 0 {
@@ -90,20 +93,53 @@ class KMGeneralPreferences: NSViewController {
     
     
     override func loadView() {
     override func loadView() {
         super.loadView()
         super.loadView()
+
+    //    self.showConvertMenuButton.state = [KMStatusBar systemStatusBar].isShow ? NSControlStateValueOn : NSControlStateValueOff;
         
         
-        let userName = UserDefaults.standard.string(forKey: "SKUserName")
-        self.authorTextField.stringValue = userName != nil ? userName! : NSFullUserName()
-    //    self.defaultOpenButton.state = [[KMHomeWindowController homeWindow] isDefaultOpenForPDF] ? NSControlStateValueOn : NSControlStateValueOff;
+    #if VERSION_FREE
+    //        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+    //            [[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"KMOpenDocumentInTab"];
+    //        }
+    #endif
+
+        
+    //    [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeys:[NSArray arrayWithObjects:SKStringConstants.defaultPDFDisplaySettingsKey, SKStringConstants.defaultFullScreenPDFDisplaySettingsKey, nil] context:&KMGeneralPreferencesDefaultsObservationContext];
+    //    [NSUserDefaultsController sharedUserDefaultsController]
+    #if VERSION_DMG
+//        [[SUUpdater sharedUpdater] addObserver:self forKeyPath:AUTOMATICALLYCHECKSFORUPDATES_KEY options:0 context:&KMGeneralPreferencesUpdaterObservationContext];
+//        [[SUUpdater sharedUpdater] addObserver:self forKeyPath:UPDATECHECKINTERVAL_KEY options:0 context:&KMGeneralPreferencesUpdaterObservationContext];
+    #endif
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
         
         
         self.authorLabel.stringValue = KMLocalizedString("Author:", nil)
         self.authorLabel.stringValue = KMLocalizedString("Author:", nil)
-        self.defaultOpenButton.title = KMLocalizedString("Set PDF Reader Pro as the default PDF viewer", nil)
+        self.authorTextField.delegate = self
+        self.authorTextField.stringValue = KMPreferenceManager.shared.author
+        
         self.openTabLabel.stringValue = String(format: "%@:", KMLocalizedString("Open a document in", nil))
         self.openTabLabel.stringValue = String(format: "%@:", KMLocalizedString("Open a document in", nil))
         for item in self.openTabButton.itemArray {
         for item in self.openTabButton.itemArray {
             item.title = KMLocalizedString(item.title, nil)
             item.title = KMLocalizedString(item.title, nil)
         }
         }
-        
         self.showConvertMenuButton.title = KMLocalizedString("Show PDF Reader Pro in menu bar", nil)
         self.showConvertMenuButton.title = KMLocalizedString("Show PDF Reader Pro in menu bar", nil)
-    //    self.showConvertMenuButton.state = [KMStatusBar systemStatusBar].isShow ? NSControlStateValueOn : NSControlStateValueOff;
+        self.defaultOpenButton.title = KMLocalizedString("Set PDF Reader Pro as the default PDF viewer", nil)
+        self.defaultOpenButton.state = KMPreference.shared.setDefaultPDFReader ? .on : .off
+        self.reopenLastOpenFilesButton.state = KMPreference.shared.openLastUnclosedDocumentWhenAppStart ? .on : .off
+        self.autoSaveInfoBtn.title = KMLocalizedString("Autosave Documents", nil)
+        self.autoSaveInfoBtn.state = AutoSaveManager.manager.autoSaveEnabled ? .on : .off
+        self.autoSaveSlider.isEnabled = AutoSaveManager.manager.autoSaveEnabled
+        if (AutoSaveManager.manager.timeInterval > 1) {
+            self.autoSaveSlider.floatValue = Float((AutoSaveManager.manager.timeInterval - 1) / 19)
+        } else {
+            self.autoSaveSlider.floatValue = 0
+        }
+        self.autoSaveLbl.stringValue = String(format: "%.0f %@", AutoSaveManager.manager.timeInterval, KMLocalizedString("minute(s)", nil))
+        
+        self.showLeftSideButton.state = KMPreference.shared.showLeftSideBar ? .on : .off
+        self.rememberSnapshotButton.state = KMPreference.shared.rememberSnapshot ? .on : .off
+        self.autoSaveNotesBackupButton.state = KMPreference.shared.autoSaveNoteBackup ? .on : .off
+        self.keepSnapshotOnTopButton.state = KMPreference.shared.keepSnapshotWindowToTop ? .on : .off
         
         
         self.authorLabel.sizeToFit()
         self.authorLabel.sizeToFit()
         var frame = self.authorTextField.frame
         var frame = self.authorTextField.frame
@@ -113,13 +149,8 @@ class KMGeneralPreferences: NSViewController {
         frame = self.openTabButton.frame
         frame = self.openTabButton.frame
         frame.origin.x = CGRectGetMaxX(self.openTabLabel.frame)+5
         frame.origin.x = CGRectGetMaxX(self.openTabLabel.frame)+5
         self.openTabButton.frame = frame
         self.openTabButton.frame = frame
-        
         self.openTabButton.isEnabled = true
         self.openTabButton.isEnabled = true
-    #if VERSION_FREE
-    //        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-    //            [[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"KMOpenDocumentInTab"];
-    //        }
-    #endif
+        
         self.revertPDFSettingsButtons = [self.normalButton, self.fullScreenButton]
         self.revertPDFSettingsButtons = [self.normalButton, self.fullScreenButton]
         KMAutoSizeButtons(self.revertPDFSettingsButtons, rightAlign: false)
         KMAutoSizeButtons(self.revertPDFSettingsButtons, rightAlign: false)
         _ = KMAutoSizeLabelFields([openFilesLabelField], [openFilesMatrix], false)
         _ = KMAutoSizeLabelFields([openFilesLabelField], [openFilesMatrix], false)
@@ -130,29 +161,6 @@ class KMGeneralPreferences: NSViewController {
         
         
         self._synchronizeUpdateInterval()
         self._synchronizeUpdateInterval()
         self._updateRevertButtons()
         self._updateRevertButtons()
-        
-    //    [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeys:[NSArray arrayWithObjects:SKStringConstants.defaultPDFDisplaySettingsKey, SKStringConstants.defaultFullScreenPDFDisplaySettingsKey, nil] context:&KMGeneralPreferencesDefaultsObservationContext];
-    //    [NSUserDefaultsController sharedUserDefaultsController]
-    #if VERSION_DMG
-//        [[SUUpdater sharedUpdater] addObserver:self forKeyPath:AUTOMATICALLYCHECKSFORUPDATES_KEY options:0 context:&KMGeneralPreferencesUpdaterObservationContext];
-//        [[SUUpdater sharedUpdater] addObserver:self forKeyPath:UPDATECHECKINTERVAL_KEY options:0 context:&KMGeneralPreferencesUpdaterObservationContext];
-    #endif
-        
-        self.autoSaveInfoBtn.title = KMLocalizedString("Autosave Documents", nil)
-        self.autoSaveInfoBtn.state = AutoSaveManager.manager.autoSaveEnabled ? .on : .off
-        self.autoSaveSlider.isEnabled = AutoSaveManager.manager.autoSaveEnabled
-        
-        if (AutoSaveManager.manager.timeInterval > 1) {
-            self.autoSaveSlider.floatValue = Float((AutoSaveManager.manager.timeInterval - 1) / 19)
-        } else {
-            self.autoSaveSlider.floatValue = 0;
-        }
-        self.autoSaveLbl.stringValue = String(format: "%.0f %@", AutoSaveManager.manager.timeInterval, KMLocalizedString("minute(s)", nil))
-    }
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        // Do view setup here.
     }
     }
     
     
     @IBAction func revertPDFViewSettings(_ sender: AnyObject?) {
     @IBAction func revertPDFViewSettings(_ sender: AnyObject?) {
@@ -170,11 +178,7 @@ class KMGeneralPreferences: NSViewController {
     }
     }
     
     
     @IBAction func defaultOpenButtonAction(_ sender: AnyObject?) {
     @IBAction func defaultOpenButtonAction(_ sender: AnyObject?) {
-//        if ([self.defaultOpenButton state]) {
-    //        [[KMHomeWindowController homeWindow] setDefaultOpenForPDF:YES];
-//        } else {
-    //        [[KMHomeWindowController homeWindow] setDefaultOpenForPDF:NO];
-//        }
+        KMPreference.shared.setDefaultPDFReader = self.defaultOpenButton.state == .on
     }
     }
     
     
     @IBAction func openTabButtonAction(_ sender: AnyObject?) {
     @IBAction func openTabButtonAction(_ sender: AnyObject?) {
@@ -208,6 +212,26 @@ class KMGeneralPreferences: NSViewController {
 //        } else {
 //        } else {
 //            //        [KMStatusBar systemStatusBar].isShow = NO;
 //            //        [KMStatusBar systemStatusBar].isShow = NO;
 //        }
 //        }
+        KMPreference.shared.showInMenuBar = self.showConvertMenuButton.state == .on
+    }
+    
+    @IBAction func reopenLastOpenFilesAtStartupAction(_ sender: NSButton) {
+        KMPreference.shared.openLastUnclosedDocumentWhenAppStart = sender.state == .on
+    }
+    
+    @IBAction func showLeftSideAction(_ sender: Any) {
+        KMPreference.shared.showLeftSideBar = self.showLeftSideButton.state == .on
+    }
+    
+    @IBAction func rememberSnapshotAction(_ sender: Any) {
+        KMPreference.shared.rememberSnapshot = self.rememberSnapshotButton.state == .on
+    }
+    
+    @IBAction func autoSaveNoteBackupAction(_ sender: Any) {
+        KMPreference.shared.autoSaveNoteBackup = self.autoSaveNotesBackupButton.state == .on
+    }
+    @IBAction func keepSnapshotOnTopAction(_ sender: Any) {
+        KMPreference.shared.keepSnapshotWindowToTop = self.keepSnapshotOnTopButton.state == .on
     }
     }
     
     
     @IBAction func autoSaveButtonAction(_ sender: AnyObject?) {
     @IBAction func autoSaveButtonAction(_ sender: AnyObject?) {
@@ -311,3 +335,11 @@ extension KMGeneralPreferences: KMPreferencePane {
     #endif
     #endif
     }
     }
 }
 }
+
+extension KMGeneralPreferences: NSTextFieldDelegate {
+    func controlTextDidChange(_ obj: Notification) {
+        if self.authorTextField.isEqual(to: obj.object) { // 作者
+            KMPreference.shared.author = self.authorTextField.stringValue
+        }
+    }
+}

+ 16 - 0
PDF Office/PDF Master/Class/Preference/Tools/KMPreferenceEnum.swift

@@ -16,6 +16,22 @@ enum KMPreferenceCloseFilePromptType: Int {
     case noPromp = 1
     case noPromp = 1
 }
 }
 
 
+enum KMPreferenceOpenDocumentType: Int {
+    case inSameWindow = 0
+    case newWindow = 1
+}
+
+enum KMPreferenceOpenFileType: Int {
+    case `default` = 0
+    case maxim = 1
+    case fit = 2
+}
+
+enum KMPreferenceRevertInitSettingType: Int {
+    case normal = 0
+    case fullScreen = 1
+}
+
 enum KMPreferenceSavePasswordType: Int {
 enum KMPreferenceSavePasswordType: Int {
     case always = 0
     case always = 0
     case never = 1
     case never = 1

+ 183 - 5
PDF Office/PDF Master/Class/Preference/Tools/KMPreferenceManager.swift

@@ -29,6 +29,17 @@ private let KMSetDefaultPDFReaderKey: KMPreferenceKey = "KMSetDefaultPDFReaderKe
 private let KMSavePasswordTypeKey: KMPreferenceKey = "KMSavePasswordTypeKey"
 private let KMSavePasswordTypeKey: KMPreferenceKey = "KMSavePasswordTypeKey"
 private let KMGeneralAuthorNameKey: KMPreferenceKey = "KMGeneralAuthorNameKey"
 private let KMGeneralAuthorNameKey: KMPreferenceKey = "KMGeneralAuthorNameKey"
 
 
+// Tip: 新补充
+
+private let KMOpenDocumentTypeKey: KMPreferenceKey = "KMOpenDocumentTypeKey"
+private let KMGeneralShowInMenuBarKey: KMPreferenceKey = "KMGeneralShowInMenuBarKey"
+private let KMOpenFileTypeKey: KMPreferenceKey = "KMOpenFileTypeKey"
+private let KMShowLeftSideBarKey: KMPreferenceKey = "KMShowLeftSideBarKey"
+private let KMRememberSnapshotKey: KMPreferenceKey = "KMRememberSnapshotKey"
+private let KMRevertInitPDFViewSettingTypeKey: KMPreferenceKey = "KMRevertInitPDFViewSettingTypeKey"
+private let KMAutoSaveNoteBackupKey: KMPreferenceKey = "KMAutoSaveNoteBackupKey"
+private let KMKeepSnapshotWindowToTopKey: KMPreferenceKey = "KMKeepSnapshotWindowToTopKey"
+
 /// display
 /// display
 private let KMViewPageDisplayTypeKey: KMPreferenceKey = "KMViewPageDisplayTypeKey"
 private let KMViewPageDisplayTypeKey: KMPreferenceKey = "KMViewPageDisplayTypeKey"
 private let KMViewZoomScaleTypeKey: KMPreferenceKey = "KMViewZoomScaleTypeKey"
 private let KMViewZoomScaleTypeKey: KMPreferenceKey = "KMViewZoomScaleTypeKey"
@@ -92,6 +103,16 @@ typealias KMPreference = KMPreferenceManager
     public static let savePasswordTypeKey                       = KMSavePasswordTypeKey
     public static let savePasswordTypeKey                       = KMSavePasswordTypeKey
     public static let generalAuthorNameKey                      = KMGeneralAuthorNameKey
     public static let generalAuthorNameKey                      = KMGeneralAuthorNameKey
     
     
+    // Tip: 新补充
+    public static let openDocumentTypeKey                       = KMOpenDocumentTypeKey
+    public static let showInMenuBarKey                          = KMGeneralShowInMenuBarKey
+    public static let openFileTypeKey                           = KMOpenFileTypeKey
+    public static let showLeftSideBarKey                        = KMShowLeftSideBarKey
+    public static let rememberSnapshotKey                       = KMRememberSnapshotKey
+    public static let revertInitPDFViewSettingTypeKey           = KMRevertInitPDFViewSettingTypeKey
+    public static let autoSaveNoteBackupKey                     = KMAutoSaveNoteBackupKey
+    public static let keepSnapshotWindowToTopKey                = KMKeepSnapshotWindowToTopKey
+    
     /// display
     /// display
     public static let viewPageDisplayTypeKey                    = KMViewPageDisplayTypeKey
     public static let viewPageDisplayTypeKey                    = KMViewPageDisplayTypeKey
     public static let viewZoomScaleTypeKey                      = KMViewZoomScaleTypeKey
     public static let viewZoomScaleTypeKey                      = KMViewZoomScaleTypeKey
@@ -263,7 +284,10 @@ typealias KMPreference = KMPreferenceManager
                     KMOpenImageFileTypeKey,
                     KMOpenImageFileTypeKey,
                     KMSetDefaultPDFReaderKey,
                     KMSetDefaultPDFReaderKey,
                     KMSavePasswordTypeKey,
                     KMSavePasswordTypeKey,
-                    KMGeneralAuthorNameKey]
+                    KMGeneralAuthorNameKey,
+                    // Tip: 新补充
+                    KMOpenDocumentTypeKey, KMGeneralShowInMenuBarKey, KMOpenFileTypeKey, KMShowLeftSideBarKey,
+                    KMRememberSnapshotKey, KMRevertInitPDFViewSettingTypeKey, KMAutoSaveNoteBackupKey, KMKeepSnapshotWindowToTopKey]
         } else if (group == .display) {
         } else if (group == .display) {
             return [KMViewPageDisplayTypeKey,
             return [KMViewPageDisplayTypeKey,
                     KMViewZoomScaleTypeKey,
                     KMViewZoomScaleTypeKey,
@@ -297,7 +321,7 @@ typealias KMPreference = KMPreferenceManager
         }
         }
         return []
         return []
     }
     }
-    
+
     private func getDefaultInfo() -> Dictionary<String, Dictionary<String, Any>> {
     private func getDefaultInfo() -> Dictionary<String, Dictionary<String, Any>> {
         return [KMPreferenceGroup.general.rawValue : [KMOpenLastUnclosedDocumentWhenAppStartKey : false,
         return [KMPreferenceGroup.general.rawValue : [KMOpenLastUnclosedDocumentWhenAppStartKey : false,
                                                       KMOpenLastUnlockedDocumentWhenAppStartKey : true,
                                                       KMOpenLastUnlockedDocumentWhenAppStartKey : true,
@@ -308,7 +332,16 @@ typealias KMPreference = KMPreferenceManager
                                                                          KMOpenImageFileTypeKey : 0,
                                                                          KMOpenImageFileTypeKey : 0,
                                                                        KMSetDefaultPDFReaderKey : true,
                                                                        KMSetDefaultPDFReaderKey : true,
                                                                           KMSavePasswordTypeKey : 2,
                                                                           KMSavePasswordTypeKey : 2,
-                                                                         KMGeneralAuthorNameKey : NSFullUserName()],
+                                                                         KMGeneralAuthorNameKey : NSFullUserName(),
+                                                      // Tip: 新补充
+                                                                          KMOpenDocumentTypeKey : self.openDocumentTypeDefaultValue.rawValue,
+                                                                      KMGeneralShowInMenuBarKey : self.showInMenuBarDefaultValue,
+                                                                              KMOpenFileTypeKey : self.openFileTypeDefaultValue.rawValue,
+                                                                           KMShowLeftSideBarKey : self.showLeftSideBarDefaultValue,
+                                                                          KMRememberSnapshotKey : self.rememberSnapshotDefaultValue,
+                                                              KMRevertInitPDFViewSettingTypeKey : self.revertInitPDFViewSettingTypeDefaultValue.rawValue,
+                                                                        KMAutoSaveNoteBackupKey : self.autoSaveNoteBackupDefaultValue,
+                                                                   KMKeepSnapshotWindowToTopKey : self.keepSnapshotWindowToTopDefaultValue()],
                 KMPreferenceGroup.display.rawValue : [KMViewPageDisplayTypeKey : 1,
                 KMPreferenceGroup.display.rawValue : [KMViewPageDisplayTypeKey : 1,
                                                         KMViewZoomScaleTypeKey : 0,
                                                         KMViewZoomScaleTypeKey : 0,
                                                       KMLeftSideDisplayTypeKey : 0,
                                                       KMLeftSideDisplayTypeKey : 0,
@@ -343,10 +376,55 @@ typealias KMPreference = KMPreferenceManager
     
     
 }
 }
 
 
+// MARK: - 默认值
+
+extension KMPreferenceManager {
+    var openDocumentTypeDefaultValue: KMPreferenceOpenDocumentType {
+        get {
+            return .inSameWindow
+        }
+    }
+    var showInMenuBarDefaultValue: Bool {
+        get {
+            return false
+        }
+    }
+    var openFileTypeDefaultValue: KMPreferenceOpenFileType {
+        get {
+            return .default
+        }
+    }
+    var showLeftSideBarDefaultValue: Bool {
+        get {
+            return true
+        }
+    }
+    var rememberSnapshotDefaultValue: Bool {
+        get {
+            return true
+        }
+    }
+    var revertInitPDFViewSettingTypeDefaultValue: KMPreferenceRevertInitSettingType {
+        get {
+            return .normal
+        }
+    }
+    var autoSaveNoteBackupDefaultValue: Bool {
+        get {
+            return false
+        }
+    }
+    
+    // 内联函数
+    @inline (__always) func keepSnapshotWindowToTopDefaultValue() -> Bool {
+        return true
+    }
+}
+
 //protocol KMPreferenceManagerColorPart: NSObjectProtocol {
 //protocol KMPreferenceManagerColorPart: NSObjectProtocol {
 //    var markupHighlightColorValues: [Double] { get }
 //    var markupHighlightColorValues: [Double] { get }
 //}
 //}
-// MARK: 扩展 颜色
+// MARK: - 扩展 颜色
 extension KMPreferenceManager {
 extension KMPreferenceManager {
     fileprivate var displayBackgroundNormalColorValues: [Double] {
     fileprivate var displayBackgroundNormalColorValues: [Double] {
         get {
         get {
@@ -564,6 +642,106 @@ extension KMPreferenceManager {
             }
             }
         }
         }
     }
     }
+    
+    var openDocumentType: KMPreferenceOpenDocumentType {
+        get {
+            guard let type = self.getData(forKey: KMOpenDocumentTypeKey) as? Int else {
+                return self.openDocumentTypeDefaultValue
+            }
+            if type == 1 {
+                return .newWindow
+            }
+            return .inSameWindow
+        }
+        set {
+            if (newValue == .inSameWindow || newValue == .newWindow) {
+                let _ = self.setData(data: newValue.rawValue, forKey: KMOpenDocumentTypeKey)
+            }
+        }
+    }
+    
+    var showInMenuBar: Bool {
+        get {
+            return self.getData(forKey: KMGeneralShowInMenuBarKey) as? Bool ?? self.showInMenuBarDefaultValue
+        }
+        set {
+            _ = self.setData(data: newValue, forKey: KMGeneralShowInMenuBarKey)
+        }
+    }
+    
+    var openFileType: KMPreferenceOpenFileType {
+        get {
+            guard let type = self.getData(forKey: KMOpenFileTypeKey) as? Int else {
+                return .default
+            }
+            
+            if type == 1 {
+                return .maxim
+            } else if type == 2 {
+                return .fit
+            }
+            return .default
+        }
+        set {
+            if (newValue == .default || newValue == .maxim || newValue == .fit) {
+                let _ = self.setData(data: newValue.rawValue, forKey: KMOpenFileTypeKey)
+            }
+        }
+    }
+    
+    var showLeftSideBar: Bool {
+        get {
+            return self.getData(forKey: KMShowLeftSideBarKey) as? Bool ?? self.showLeftSideBarDefaultValue
+        }
+        set {
+            _ = self.setData(data: newValue, forKey: KMShowLeftSideBarKey)
+        }
+    }
+    
+    var rememberSnapshot: Bool {
+        get {
+            return self.getData(forKey: KMRememberSnapshotKey) as? Bool ?? self.rememberSnapshotDefaultValue
+        }
+        set {
+            _ = self.setData(data: newValue, forKey: KMRememberSnapshotKey)
+        }
+    }
+    
+    var revertInitPDFViewSettingType: KMPreferenceRevertInitSettingType {
+        get {
+            guard let type = self.getData(forKey: KMRevertInitPDFViewSettingTypeKey) as? Int else {
+                return self.revertInitPDFViewSettingTypeDefaultValue
+            }
+            
+            if type == 1 {
+                return .fullScreen
+            }
+            return .normal
+        }
+        set {
+            if (newValue == .normal || newValue == .fullScreen) {
+                let _ = self.setData(data: newValue.rawValue, forKey: KMRevertInitPDFViewSettingTypeKey)
+            }
+        }
+    }
+    
+    var autoSaveNoteBackup: Bool {
+        get {
+            return self.getData(forKey: KMAutoSaveNoteBackupKey) as? Bool ?? self.autoSaveNoteBackupDefaultValue
+        }
+        set {
+            _ = self.setData(data: newValue, forKey: KMAutoSaveNoteBackupKey)
+        }
+    }
+    
+    var keepSnapshotWindowToTop: Bool {
+        get {
+            return self.getData(forKey: KMKeepSnapshotWindowToTopKey) as? Bool ?? self.keepSnapshotWindowToTopDefaultValue()
+        }
+        set {
+            _ = self.setData(data: newValue, forKey: KMKeepSnapshotWindowToTopKey)
+        }
+    }
 }
 }
 
 
 // MARK: 扩展 Display
 // MARK: 扩展 Display
@@ -1053,7 +1231,7 @@ extension KMPreferenceManager {
     }
     }
     
     
     public func initDataForAppLaunch() {
     public func initDataForAppLaunch() {
-        KMPreferenceManager.shared.author = NSFullUserName()
+//        KMPreferenceManager.shared.author = NSFullUserName()
         if (KMPreferenceManager.shared.autoSave) {
         if (KMPreferenceManager.shared.autoSave) {
             Task { @MainActor in
             Task { @MainActor in
                 if await KMLightMemberManager.manager.canPayFunction() == false {
                 if await KMLightMemberManager.manager.canPayFunction() == false {

+ 1 - 1
PDF Office/PDF Master/Third Pard Library/RemoteConfig /KMFirebaseRemoteConfig.swift

@@ -125,7 +125,7 @@ class KMKdanRemoteConfig: NSObject {
     }
     }
 
 
     func refreshAdsDate() -> Int {
     func refreshAdsDate() -> Int {
-        var adsDate = userInfo[kRefreshAdsDateDayKey] as? Int ?? 0
+        var adsDate = userInfo[kRefreshAdsDateDayKey] as? Int ?? 180
         if let value = remoteConfigDatas[kRefreshAdsDateDayKey] as? Int {
         if let value = remoteConfigDatas[kRefreshAdsDateDayKey] as? Int {
             adsDate = value
             adsDate = value
         }
         }