Browse Source

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

liujiajie 10 months ago
parent
commit
739a963e9a
21 changed files with 1609 additions and 2099 deletions
  1. 72 66
      PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift
  2. 2 2
      PDF Office/PDF Master/Class/ChromiumTabs/src/Tab Strip/CTTabStripModel.m
  3. 1 33
      PDF Office/PDF Master/Class/Common/Base/KMBaseViewController.swift
  4. 2 0
      PDF Office/PDF Master/Class/Common/KMCommonDefine.swift
  5. 16 0
      PDF Office/PDF Master/Class/Common/Tools/KMTools.swift
  6. 1 1
      PDF Office/PDF Master/Class/Document/KMMainDocument.swift
  7. 3 0
      PDF Office/PDF Master/Class/PDFTools/Compare/ViewController/ContentComplete/View/KMCompareContentView.swift
  8. 0 6
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift
  9. 0 122
      PDF Office/PDF Master/Class/PDFTools/Secure/View/KMSecureEncryptSuccessTipView.swift
  10. 0 7
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMThumbnailViewController.swift
  11. 2 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.h
  12. 20 10
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m
  13. 16 16
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift
  14. 7 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.swift
  15. 63 213
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  16. 24 47
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift
  17. 1048 80
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift
  18. 153 1461
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  19. 57 0
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/Model/KMMainModel.swift
  20. 16 8
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj
  21. 106 26
      PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+ 72 - 66
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -393,72 +393,78 @@ import Cocoa
                 return
             }
         }
-        if self.browser != nil {
-            let activeInt = self.browser.activeTabIndex()
-            let activeTab = self.browser.activeTabContents()
-            
-            self.browser.closeTab(at: activeInt, makeHistory: false)
-            
-            let browser: KMBrowser = KMBrowser.init()
-            browser.windowController = KMBrowserWindowController.init(browser: browser)
-            browser.addHomeTabContents()
-            browser.windowController.showWindow(self)
-            
-//            browser.add(activeTab, inForeground: false)
-//            browser.selectTab(at: 1)
-            if activeTab?.fileURL == nil {
-                return
-            }
-            let pdfDoc = CPDFDocument.init(url: (activeTab?.fileURL)!)
-            let document = NSDocumentController.shared.document(for: (activeTab?.fileURL)!)
-            KMMainDocument().tryToUnlockDocument(pdfDoc!)
-            
-            if ((pdfDoc?.isLocked)! == true) {
-                KMPasswordInputWindow.openWindow(window: self.window!, url: (activeTab?.fileURL)!) { result, password in
-                    if result == .cancel { /// 关闭
-                        return
-                    }
-                    /// 解密成功
-                    var selectDocument: KMMainDocument? = nil
-                    if ((document?.isKind(of: KMMainDocument.self)) != nil) {
-                        selectDocument = (document as! KMMainDocument)
-                    }
-                    if selectDocument != nil {
-                        let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
-                        selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
-                        if (selectDocument?.browser.window.isVisible)! as Bool {
-                            selectDocument?.browser.window.orderFront(nil)
-                        } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
-                            selectDocument?.browser.window.orderFront(nil)
-                        }
-                    } else {
-                        NSDocumentController.shared.km_safe_openDocument(withContentsOf: (activeTab?.fileURL)!, display: true) { document, _, error in
-                            if (error == nil) {
-                                (document as! KMMainDocument).mainViewController?.password = password
-                            }
-                        }
-                    }
-                }
-            } else {
-                var selectDocument: KMMainDocument? = nil
-                if ((document?.isKind(of: KMMainDocument.self)) != nil) {
-                    selectDocument = (document as! KMMainDocument)
-                }
-                if selectDocument != nil {
-                    let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
-                    selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
-                    if (selectDocument?.browser.window.isVisible)! as Bool {
-                        selectDocument?.browser.window.orderFront(nil)
-                    } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
-                        selectDocument?.browser.window.orderFront(nil)
-                    }
-                } else {
-                    NSDocumentController.shared.km_safe_openDocument(withContentsOf: (activeTab?.fileURL)!, display: true) { _, _, _ in
-                        
-                    }
-                }
-            }
-        }
+        
+        // 分离 Tab
+        let windowC = self.detachTab(toNewWindow: self.activeTabView() as? CTTabView)
+        // 新增 home Tab
+        (windowC as? CTBrowserWindowController)?.browser.addHomeTabContentsWithDrag()
+        windowC?.showWindow(nil)
+//        if self.browser != nil {
+//            let activeInt = self.browser.activeTabIndex()
+//            let activeTab = self.browser.activeTabContents()
+//
+//            self.browser.closeTab(at: activeInt, makeHistory: false)
+//
+//            let browser: KMBrowser = KMBrowser.init()
+//            browser.windowController = KMBrowserWindowController.init(browser: browser)
+//            browser.addHomeTabContents()
+//            browser.windowController.showWindow(self)
+//
+////            browser.add(activeTab, inForeground: false)
+////            browser.selectTab(at: 1)
+//            if activeTab?.fileURL == nil {
+//                return
+//            }
+//            let pdfDoc = CPDFDocument.init(url: (activeTab?.fileURL)!)
+//            let document = NSDocumentController.shared.document(for: (activeTab?.fileURL)!)
+//            KMMainDocument().tryToUnlockDocument(pdfDoc!)
+//
+//            if ((pdfDoc?.isLocked)! == true) {
+//                KMPasswordInputWindow.openWindow(window: self.window!, url: (activeTab?.fileURL)!) { result, password in
+//                    if result == .cancel { /// 关闭
+//                        return
+//                    }
+//                    /// 解密成功
+//                    var selectDocument: KMMainDocument? = nil
+//                    if ((document?.isKind(of: KMMainDocument.self)) != nil) {
+//                        selectDocument = (document as! KMMainDocument)
+//                    }
+//                    if selectDocument != nil {
+//                        let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
+//                        selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
+//                        if (selectDocument?.browser.window.isVisible)! as Bool {
+//                            selectDocument?.browser.window.orderFront(nil)
+//                        } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
+//                            selectDocument?.browser.window.orderFront(nil)
+//                        }
+//                    } else {
+//                        NSDocumentController.shared.km_safe_openDocument(withContentsOf: (activeTab?.fileURL)!, display: true) { document, _, error in
+//                            if (error == nil) {
+//                                (document as! KMMainDocument).mainViewController?.model.password = password
+//                            }
+//                        }
+//                    }
+//                }
+//            } else {
+//                var selectDocument: KMMainDocument? = nil
+//                if ((document?.isKind(of: KMMainDocument.self)) != nil) {
+//                    selectDocument = (document as! KMMainDocument)
+//                }
+//                if selectDocument != nil {
+//                    let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
+//                    selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
+//                    if (selectDocument?.browser.window.isVisible)! as Bool {
+//                        selectDocument?.browser.window.orderFront(nil)
+//                    } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
+//                        selectDocument?.browser.window.orderFront(nil)
+//                    }
+//                } else {
+//                    NSDocumentController.shared.km_safe_openDocument(withContentsOf: (activeTab?.fileURL)!, display: true) { _, _, _ in
+//
+//                    }
+//                }
+//            }
+//        }
     }
     
     func canMergeAllWindow() -> Bool {

+ 2 - 2
PDF Office/PDF Master/Class/ChromiumTabs/src/Tab Strip/CTTabStripModel.m

@@ -766,7 +766,7 @@ const int kNoTab = NSNotFound;
         KMMainDocument *doc = (KMMainDocument *)content;
         if ([doc.mainViewController isKindOfClass:[KMMainViewController class]]) {
             KMMainViewController *mainViewCtrl = doc.mainViewController;
-            isShow = mainViewCtrl.isShowQuickTour;
+            isShow = mainViewCtrl.model.isShowQuickTour;
             if (isShow) break;
         }
         if ([doc.homeViewController isKindOfClass:[KMHomeViewController class]]) {
@@ -811,7 +811,7 @@ const int kNoTab = NSNotFound;
         KMMainDocument *doc = (KMMainDocument *)content;
         if ([doc.mainViewController isKindOfClass:[KMMainViewController class]]) {
             KMMainViewController *mainViewCtrl = doc.mainViewController;
-            isShow = mainViewCtrl.isShowQuickTour;
+            isShow = mainViewCtrl.model.isShowQuickTour;
             if (isShow) break;
         }
         if ([doc.homeViewController isKindOfClass:[KMHomeViewController class]]) {

+ 1 - 33
PDF Office/PDF Master/Class/Common/Base/KMBaseViewController.swift

@@ -9,7 +9,6 @@ import Cocoa
 
 // 基类 [抽象类]
 class KMBaseViewController: NSViewController {
-    
     // 是否需要菜单
     var needMenu = false {
         didSet {
@@ -21,11 +20,6 @@ class KMBaseViewController: NSViewController {
         }
     }
     
-    // 是否能使用高级功能
-    var canUseAdvanced = false
-    // 是否能使用付费功能
-    var canPayFunction = false
-    
     deinit {
         Swift.debugPrint(self.className + " 已释放")
         
@@ -42,37 +36,11 @@ class KMBaseViewController: NSViewController {
         }
         
         self.addNotifations()
-        self._reloadAdvancedData()
-    }
-    
-    // Advanced
-    
-    @objc fileprivate func _advancedDidChange() {
-        self._reloadAdvancedData()
-    }
-    
-    fileprivate func _reloadAdvancedData() {
-//        Task { @MainActor in
-//            if await (KMLightMemberManager.manager.canUseAdvanced() == false) {
-//                self.canUseAdvanced = false
-//            } else {
-//                self.canUseAdvanced = true
-//            }
-//            if (KMLightMemberManager.manager.canPayFunction() == false) {
-//                self.canPayFunction = false
-//            } else {
-//                self.canPayFunction = true
-//            }
-//        }
     }
     
     // Noti
     
-    func addNotifations() {
-        NotificationCenter.default.addObserver(self, selector: #selector(_advancedDidChange), name: NSNotification.Name(rawValue: ADVANCED_NOTIFICATION), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(_advancedDidChange), name: NSNotification.Name(rawValue: USER_INFO_CHANGE_NOTIFICATION), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(_advancedDidChange), name: NSNotification.Name(rawValue: USER_LOGINSTATE_NOTIFICATION), object: nil)
-    }
+    func addNotifations() { }
     
     func removeNotifations() {
         NotificationCenter.default.removeObserver(self)

+ 2 - 0
PDF Office/PDF Master/Class/Common/KMCommonDefine.swift

@@ -60,6 +60,8 @@ let kHTTPPrefix = "http://"
 let kFTPPrefix = "ftp://"
 let kEmailPrefix = "mailto:"
 
+let kWindowFrameKey                     = "windowFrame"
+
 // ColumnID
 
 let kPageColumnId = NSUserInterfaceItemIdentifier(rawValue: "page")

+ 16 - 0
PDF Office/PDF Master/Class/Common/Tools/KMTools.swift

@@ -751,6 +751,22 @@ extension KMTools {
         return dateFormatter_?.string(from: date) ?? ""
     }
     
+    @objc class func isFileGreaterThan10MB(atPath filePath: String) -> Bool {
+        let fileManager = FileManager.default
+
+        do {
+            let fileAttributes = try fileManager.attributesOfItem(atPath: filePath)
+            if let fileSize = fileAttributes[.size] as? UInt64 {
+                let megabyteSize = fileSize / (1024 * 1024)
+                return megabyteSize >= 10
+            }
+        } catch {
+            KMPrint("Error: \(error)")
+        }
+
+        return false
+    }
+    
     // MARK: - Private Methods
     
     @objc fileprivate class func _documentAddWatermark(document: CPDFDocument) -> CPDFDocument? {

+ 1 - 1
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -664,7 +664,7 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
             if (password != nil) {
                 self.isUnlockFromKeychain = true
 //                document.unlock(withPassword: password! as String)
-                self.mainViewController?.password = password as String?
+                self.mainViewController?.model.password = password as String?
             }
         }
         

+ 3 - 0
PDF Office/PDF Master/Class/PDFTools/Compare/ViewController/ContentComplete/View/KMCompareContentView.swift

@@ -245,6 +245,9 @@ class KMCompareContentView: KMBaseXibView, CPDFViewDelegate, KMCompareToolbarDel
         
         refreshCompareColorView()
         refreshCompareTypeInfo()
+        
+        pdfOldView.documentView().hasHorizontalScroller = false
+        pdfNewView.documentView().hasHorizontalScroller = false
     }
     
     func showImageController() {

+ 0 - 6
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -73,12 +73,6 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         }
     }
     
-    override var canPayFunction: Bool {
-        didSet {
-            self.thumbnailView.limit = !self.canPayFunction
-        }
-    }
-    
     private var fileAttri_: KMFileAttribute?
     private var popOver_: NSPopover?
     

+ 0 - 122
PDF Office/PDF Master/Class/PDFTools/Secure/View/KMSecureEncryptSuccessTipView.swift

@@ -1,122 +0,0 @@
-//
-//  KMSecureEncryptSuccessTipView.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/11/28.
-//
-
-import Cocoa
-
-typealias KMSecureEncryptSuccessTipViewItemClick = () ->()
-class KMSecureEncryptSuccessTipView: NSView {
-
-    private var iconImageView = NSImageView()
-    private var iconSelectImageView = NSImageView()
-    private var despLabel = NSTextField(wrappingLabelWithString: "")
-    private var titleLabel = NSTextField(labelWithString: "")
-    private var closeButton = NSButton()
-    
-    private var knowButtonVC: KMDesignButton?
-    
-    var itemClick: KMSecureEncryptSuccessTipViewItemClick!
-    
-    private var knowButtonSize: NSSize = NSMakeSize(140, 32)
-    
-    override init(frame frameRect: NSRect) {
-        super.init(frame: frameRect)
-
-        self.initSubViews()
-    }
-    
-    required init?(coder: NSCoder) {
-        super.init(coder: coder)
-        
-        self.initSubViews()
-    }
-    
-    override var isFlipped: Bool {
-        return true
-    }
-    
-    func initSubViews() {
-        wantsLayer = true
-        layer?.backgroundColor = NSColor.km_init(hex: "#E8F5FF").cgColor
-        layer?.cornerRadius = 8
-        self.shadow = NSShadow()
-        self.layer?.shadowColor = NSColor.km_init(hex: "#00000029").cgColor
-        self.layer?.shadowOpacity = 1
-        self.layer?.shadowRadius = 8
-        self.layer?.shadowOffset = CGSize(width: 0, height: -3)
-        
-        self.addSubview(self.titleLabel)
-        self.addSubview(self.closeButton)
-        addSubview(iconImageView)
-        addSubview(despLabel)
-        
-        self.knowButtonVC = KMDesignButton(withType: .Text)
-        self.addSubview(self.knowButtonVC!.view)
-        
-        self.iconImageView.addSubview(self.iconSelectImageView)
-        
-        self.titleLabel.stringValue = NSLocalizedString("Set password successfully", comment: "")
-        self.titleLabel.font = NSFont.SFProTextRegularFont(14)
-        self.titleLabel.textColor = NSColor.titleColor()
-        self.closeButton.isBordered = false
-        self.closeButton.image = NSImage(named: "KMImageNameWhiteClose")
-        self.closeButton.target = self
-        self.closeButton.action = #selector(knowButtonAction)
-        iconImageView.wantsLayer = true
-        iconImageView.image = NSImage(named: "KMImageNameTipSelectedBackgroud")
-        self.iconSelectImageView.image = NSImage(named: "KMImageNameTipSelected")
-        
-        self.despLabel.isSelectable = false
-        despLabel.stringValue = NSLocalizedString("The security settings won't take effect until the document is saved. You can change the security settings before closing the file.", comment: "")
-        let ps = NSMutableParagraphStyle()
-        ps.lineSpacing = 7
-        despLabel.attributedStringValue = NSAttributedString(string: despLabel.stringValue, attributes: [.foregroundColor : NSColor.despColor(),
-            .font : NSFont.SFProTextRegularFont(14),
-            .paragraphStyle : ps
-        ])
-        
-        self.knowButtonVC?.stringValue = NSLocalizedString("Got it", comment: "")
-        self.knowButtonVC?.button(type: .Ghost, size: .m)
-        self.knowButtonVC?.target = self
-        self.knowButtonVC?.action = #selector(knowButtonAction)
-        let size = self.knowButtonVC?.stringValue.boundingRect(with: NSMakeSize(1000, self.knowButtonSize.height), options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [.foregroundColor : NSColor.buttonTitleColor(), .font : NSFont.SFProTextRegularFont(14)]).size
-        if (size == nil || size!.width < 40) {
-            self.knowButtonSize.width = 70
-        } else {
-            self.knowButtonSize.width = size!.width + 34
-        }
-    }
-    
-    override func layout() {
-        super.layout()
-        
-        let width: CGFloat = NSWidth(self.bounds)
-        let height: CGFloat = NSHeight(self.bounds)
-        
-        let iconSize: CGFloat = 20
-        iconImageView.frame = NSMakeRect(18, 18, iconSize, iconSize)
-        self.iconSelectImageView.frame = self.iconImageView.bounds
-        
-        self.titleLabel.frame = NSMakeRect(self.iconImageView.frame.maxX+10, 16, 295, 22)
-        self.closeButton.frame = NSMakeRect(width-34, 10, 24, 24)
-        
-        let despX: CGFloat = iconImageView.frame.maxX+12
-        let despY: CGFloat = self.titleLabel.frame.maxY+8
-        despLabel.frame = NSMakeRect(despX, despY, width-despX-8, height-despY-45)
-        
-        let knowSize = self.knowButtonSize
-        self.knowButtonVC?.view.frame = NSMakeRect(width-knowSize.width-16, height-knowSize.height-16, knowSize.width, knowSize.height)
-    }
-    
-    @objc func knowButtonAction() {
-        guard let callback = itemClick else {
-            return
-        }
-        
-        callback()
-    }
-    
-}

+ 0 - 7
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMThumbnailViewController.swift

@@ -35,15 +35,8 @@ class KMThumbnailViewController: KMBaseViewController {
         }
     }
     
-    override var canPayFunction: Bool {
-        didSet {
-            self.thumbnailView.limit = !self.canPayFunction
-        }
-    }
-    
     deinit {
         NotificationCenter.default.removeObserver(self)
-        Swift.debugPrint("KMThumbnailViewController 释放")
     }
     
     override func viewWillAppear() {

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.h

@@ -22,6 +22,7 @@ typedef NS_ENUM(NSInteger, KMOpenPropertiesType) {
 @class KMMainViewController;
 
 typedef void(^PageDisplayReaderMode)(BOOL isReaderMode);
+typedef void(^AnnotationTypeDidChange)(CPDFAnnotation *anno);
 
 @interface KMAnnotationPropertiesViewController : NSViewController
 
@@ -38,6 +39,7 @@ typedef void(^PageDisplayReaderMode)(BOOL isReaderMode);
 @property (nonatomic, assign) KMOpenPropertiesType openPropertiesType;
 
 @property (nonatomic, copy) PageDisplayReaderMode pageDisplayReaderMode;
+@property (nonatomic, copy) AnnotationTypeDidChange annoTypeDidChange;
 
 @property (nonatomic, assign) IBOutlet KMMainViewController *mainController;
 

+ 20 - 10
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m

@@ -339,17 +339,22 @@
             vc.annotationModel = annotationModel;
             self.propertiesBox.contentView = vc.view;
             self.contentViewController = vc;
+            __weak typeof (self) weakSelf = self;
             vc.callBack = ^(CAnnotationType type) {
                 if (type == CAnnotationTypeSignFalse) {
-                    self.titleLabel.stringValue = NSLocalizedString(@"X", nil);
+                    weakSelf.titleLabel.stringValue = NSLocalizedString(@"X", nil);
                 } else if (type == CAnnotationTypeSignTure) {
-                    self.titleLabel.stringValue = NSLocalizedString(@"Check mark", nil);
+                    weakSelf.titleLabel.stringValue = NSLocalizedString(@"Check mark", nil);
                 } else if (type == CAnnotationTypeSignCircle) {
-                    self.titleLabel.stringValue = NSLocalizedString(@"Rectangle", nil);
+                    weakSelf.titleLabel.stringValue = NSLocalizedString(@"Rectangle", nil);
                 } else if (type == CAnnotationTypeSignLine) {
-                    self.titleLabel.stringValue = NSLocalizedString(@"Line", nil);
+                    weakSelf.titleLabel.stringValue = NSLocalizedString(@"Line", nil);
                 } else if (type == CAnnotationTypeSignDot) {
-                    self.titleLabel.stringValue = NSLocalizedString(@"Dot", nil);
+                    weakSelf.titleLabel.stringValue = NSLocalizedString(@"Dot", nil);
+                }
+                
+                if (weakSelf.annoTypeDidChange != nil) {
+                    weakSelf.annoTypeDidChange(annotation);
                 }
             };
         } else if (newAnnotation.annotationType == CAnnotationTypeSignText ||
@@ -612,17 +617,22 @@
         vc.annotationModel = annotationModel;
         self.propertiesBox.contentView = vc.view;
         self.contentViewController = vc;
+        __weak typeof(self) weakSelf = self;
         vc.callBack = ^(CAnnotationType type) {
             if (type == CAnnotationTypeSignFalse) {
-                self.titleLabel.stringValue = NSLocalizedString(@"X", nil);
+                weakSelf.titleLabel.stringValue = NSLocalizedString(@"X", nil);
             } else if (type == CAnnotationTypeSignTure) {
-                self.titleLabel.stringValue = NSLocalizedString(@"Check mark", nil);
+                weakSelf.titleLabel.stringValue = NSLocalizedString(@"Check mark", nil);
             } else if (type == CAnnotationTypeSignCircle) {
-                self.titleLabel.stringValue = NSLocalizedString(@"Rectangle", nil);
+                weakSelf.titleLabel.stringValue = NSLocalizedString(@"Rectangle", nil);
             } else if (type == CAnnotationTypeSignLine) {
-                self.titleLabel.stringValue = NSLocalizedString(@"Line", nil);
+                weakSelf.titleLabel.stringValue = NSLocalizedString(@"Line", nil);
             } else if (type == CAnnotationTypeSignDot) {
-                self.titleLabel.stringValue = NSLocalizedString(@"Dot", nil);
+                weakSelf.titleLabel.stringValue = NSLocalizedString(@"Dot", nil);
+            }
+            
+            if (weakSelf.annoTypeDidChange != nil) {
+                weakSelf.annoTypeDidChange(weakSelf.annotations.firstObject);
             }
         };
     } else if (annotationMode == CAnnotationTypeSignText ||

+ 16 - 16
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift

@@ -1669,22 +1669,22 @@ let KMColorPickerViewHeight: CGFloat = 64
                 } else {
                     annotationModel?.setOpacity(opacity)
                     annotationModel?.setColor(textColor)
-//                    if let model = self.annotationModel {
-//                        if (model.annotation == nil || CPDFListViewConfig.defaultManager.isSaveDefault) && self.isannotationMode {
-//                            if self.annotationType.isMarkup() {
-//                                let type = self.annotationType
-//                                if type == .highlight {
-//                                    KMPreferenceManager.shared.markupHighlightColor = textColor
-//                                } else if type == .underline {
-//                                    KMPreferenceManager.shared.markupUnderlineColor = textColor
-//                                } else if type == .strikeOut {
-//                                    KMPreferenceManager.shared.markupStrikthroughColor = textColor
-//                                } else if type == .ink {
-//                                    KMPreferenceManager.shared.markupPenColor = textColor
-//                                }
-//                            }
-//                        }
-//                    }
+                    if let model = self.annotationModel {
+                        if (model.annotation == nil || CPDFListViewConfig.defaultManager.isSaveDefault) && self.isannotationMode {
+                            if self.annotationType.isMarkup() {
+                                let type = self.annotationType
+                                if type == .highlight {
+                                    KMPreferenceManager.shared.markupHighlightColor = textColor
+                                } else if type == .underline {
+                                    KMPreferenceManager.shared.markupUnderlineColor = textColor
+                                } else if type == .strikeOut {
+                                    KMPreferenceManager.shared.markupStrikthroughColor = textColor
+                                } else if type == .ink {
+                                    KMPreferenceManager.shared.markupPenColor = textColor
+                                }
+                            }
+                        }
+                    }
                 }
             }
             

+ 7 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.swift

@@ -238,6 +238,12 @@ class KMRightSideViewController: NSViewController,CipherTextViewDelegate {
         self.annotationProperties.pdfView = self.listView
         self.annotationProperties.view.autoresizingMask = [.height,.maxXMargin]
         self.contextBox.contentView = self.annotationProperties.view
+        self.annotationProperties.annoTypeDidChange = { [weak self] anno in
+            guard let callback = self?.propertyDidChange else {
+                return
+            }
+            callback(anno)
+        }
         if self.listView.toolMode == .noteToolMode || self.listView.toolMode == .formToolMode
             || self.listView.toolMode == .selfSignMode {
             self.reloadDataWithPDFView(pdfView: self.listView, isShow: true)
@@ -343,7 +349,7 @@ class KMRightSideViewController: NSViewController,CipherTextViewDelegate {
     
     @objc func signatureSelectedNotification(_ notification: Notification) {
         let editAnnotation: CPDFAnnotation = notification.object as! CPDFAnnotation
-        if self.mainController?.rightPanelIsOpen == false {
+        if self.mainController?.model.rightPanelIsOpen == false {
             self.mainController?.toggleRightPane() 
         }
         self.annotationProperties.mainController = self.mainController

+ 63 - 213
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -734,9 +734,9 @@ extension KMMainViewController {
     
     func enterPresentationMode() {
         let scrollView = listView.documentView().enclosingScrollView
-        savedNormalSetup.setValue(scrollView?.hasHorizontalScroller, forKey: HASHORIZONTALSCROLLER_KEY)
-        savedNormalSetup.setValue(scrollView?.hasVerticalScroller, forKey: HASVERTICALSCROLLER_KEY)
-        savedNormalSetup.setValue(scrollView?.autohidesScrollers, forKey: AUTOHIDESSCROLLERS_KEY)
+        savedNormalSetup.setValue(scrollView?.hasHorizontalScroller, forKey: KMMainModel.Key.kHasHorizontalScroller)
+        savedNormalSetup.setValue(scrollView?.hasVerticalScroller, forKey: KMMainModel.Key.kHasVerticalsCroller)
+        savedNormalSetup.setValue(scrollView?.autohidesScrollers, forKey: KMMainModel.Key.kAutoHidesScrollers)
         // Set up presentation mode
 //        if RUNNING(version: 10_12) {
 //            pdfView.setBackgroundColor(NSColor.black)
@@ -791,24 +791,24 @@ extension KMMainViewController {
     }
     
     func applyPDFSettings(_ setup: NSDictionary) {
-        if let data = setup.object(forKey: AUTOSCALES_KEY) as? NSNumber {
+        if let data = setup.object(forKey: KMMainModel.Key.kAutoScales) as? NSNumber {
             self.listView.autoScales = data.boolValue
         }
         if self.listView.autoScales == false {
-            if let data = setup.object(forKey: SCALEFACTOR_KEY) as? NSNumber {
+            if let data = setup.object(forKey: KMMainModel.Key.kScaleFactor) as? NSNumber {
                 self.listView.scaleFactor = data.floatValue.cgFloat
             }
         }
-        if let data = setup.object(forKey: DISPLAYSPAGEBREAKS_KEY) as? NSNumber {
+        if let data = setup.object(forKey: KMMainModel.Key.kDisplaysPageBreaks) as? NSNumber {
             self.listView.displaysPageBreaks = data.boolValue
         }
-        if let data = setup.object(forKey: DISPLAYSASBOOK_KEY) as? NSNumber {
+        if let data = setup.object(forKey: KMMainModel.Key.kDisplaysAsBook) as? NSNumber {
             self.listView.displaysAsBook = data.boolValue
         }
-        if let data = setup.object(forKey: DISPLAYMODE_KEY) as? NSNumber {
+        if let data = setup.object(forKey: KMMainModel.Key.kDisplayMode) as? NSNumber {
             self.listView.displayMode = CPDFDisplayMode(rawValue: data.intValue) ?? .normal
         }
-        if let data = setup.object(forKey: DISPLAYBOX_KEY) as? NSNumber {
+        if let data = setup.object(forKey: KMMainModel.Key.kDisplayBox) as? NSNumber {
             self.listView.displayBox = CPDFDisplayBox(rawValue: data.intValue) ?? .cropBox
         }
     }
@@ -825,12 +825,12 @@ extension KMMainViewController {
     
     func currentPDFSettings() -> NSDictionary {
         var setup = NSMutableDictionary()
-        setup[DISPLAYSPAGEBREAKS_KEY] = NSNumber(value: listView.displaysPageBreaks)
-        setup[DISPLAYSASBOOK_KEY] = NSNumber(value: listView.displaysAsBook)
-        setup[DISPLAYBOX_KEY] = NSNumber(value: listView.displayBox.rawValue)
-        setup[SCALEFACTOR_KEY] = NSNumber(value: listView.scaleFactor)
-        setup[AUTOSCALES_KEY] = NSNumber(value: listView.autoScales)
-        setup[DISPLAYMODE_KEY] = NSNumber(value: listView.displayMode.rawValue)
+        setup[KMMainModel.Key.kDisplaysPageBreaks] = NSNumber(value: listView.displaysPageBreaks)
+        setup[KMMainModel.Key.kDisplaysAsBook] = NSNumber(value: listView.displaysAsBook)
+        setup[KMMainModel.Key.kDisplayBox] = NSNumber(value: listView.displayBox.rawValue)
+        setup[KMMainModel.Key.kScaleFactor] = NSNumber(value: listView.scaleFactor)
+        setup[KMMainModel.Key.kAutoScales] = NSNumber(value: listView.autoScales)
+        setup[KMMainModel.Key.kDisplayMode] = NSNumber(value: listView.displayMode.rawValue)
         
         return setup
     }
@@ -1118,7 +1118,7 @@ extension KMMainViewController {
 //            let parent = current.parent ?? CPDFOutline()
 //            let index = current.index + 1
 //            parent.insertChild(newOutline, at: index)
-            if self.leftPanelOpen == false || self.leftSideViewController.type.methodType != .Outline {
+            if self.model.leftPanelOpen == false || self.leftSideViewController.type.methodType != .Outline {
                 self.leftSideViewController.refreshMethodType(methodType: .Outline)
             }
 //            self.leftSideViewController.outlineViewController.addItemAction()
@@ -1249,7 +1249,7 @@ extension KMMainViewController {
                 switch sender.tag {
                 case 0:
                     self.toolbarController.ignoreCurrentAnnotationTypeChange = true
-                    self.rightMouseEventing = true
+                    self.model.rightMouseEventing = true
                     if(self.toolbarController.toolbarType == .None) {
                         self.toolbarController.toolbarType = .Annatiton
                     }
@@ -1375,7 +1375,7 @@ extension KMMainViewController {
         if self.isReadMode {
             
         } else {
-            if self.leftPanelOpen == false || self.leftSideViewController.type.methodType != .BookMark {
+            if self.model.leftPanelOpen == false || self.leftSideViewController.type.methodType != .BookMark {
                 self.leftSideViewController.refreshMethodType(methodType: .BookMark)
             }
             let bookMark = self.listView.document.bookmark(forPageIndex: UInt(self.listView.currentPageIndex))
@@ -1420,7 +1420,7 @@ extension KMMainViewController {
                     return
                 }
                 // 解除权限
-                self?.isSaveKeyChain = false
+                self?.model.isSaveKeyChain = false
                 self?.listView.document.unlock(withPassword: password)
                 // 隐藏提示
                 self?.hiddenSecureLimitTip()
@@ -1455,7 +1455,7 @@ extension KMMainViewController {
             self.view.window?.makeFirstResponder(nil)
         }
         
-        self._mainWindow = self.view.window
+        self.mainWindow = self.view.window
         let fullScreenWindow = KMFullScreenWindow(screen: (self.mainWindow?.screen ?? NSScreen.main)!, bgColor: backgroundColor, level: NSWindow.Level.popUpMenu.rawValue, isMain: true)
         fullScreenWindow.interactionParent = self.view.window
         
@@ -1925,21 +1925,15 @@ extension KMMainViewController {
 //        progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#ffffff").cgColor
 //        progress.progressField.textColor = NSColor.black
         progress.message = NSLocalizedString("Converting...", comment: "")
-        progressController = progress
-        progressController?.message = message
+        self.progressC = progress
+        self.progressC?.message = message
         if maxValue > 0 {
-            progressController?.indeterminate = false
-            progressController?.maxValue = Double(maxValue)
+            progressC?.indeterminate = false
+            progressC?.maxValue = Double(maxValue)
         } else {
-            progressController?.indeterminate = true
+            progressC?.indeterminate = true
         }
-        if maxValue > 0 {
-            progressController?.indeterminate = false
-            progressController?.maxValue = Double(maxValue)
-        } else {
-            progressController?.indeterminate = true
-        }
-        self.km_beginSheet(windowC: progressController!)
+        self.km_beginSheet(windowC: progressC!)
     }
     
     // 白边距
@@ -1954,8 +1948,8 @@ extension KMMainViewController {
        beginProgressSheet(with: KMLocalizedString("Cropping Pages", "Message for progress sheet"), maxValue: min(18, self.listView.document.pageCount))
        var rectArray: Array<NSRect> = []
         for i in 0 ..< self.listView.document.pageCount {
-            progressController?.increment(by: Double(i))
-            progressController?.doubleValue = Double(i)
+            progressC?.increment(by: Double(i))
+            progressC?.doubleValue = Double(i)
             let page = self.listView.document.page(at: i)
             var rect = KMCropTools.getPageForegroundBox(page!)
             let bounds: NSRect = (page?.bounds(for: .mediaBox))!
@@ -2004,8 +1998,8 @@ extension KMMainViewController {
         beginProgressSheet(with: KMLocalizedString("Cropping Pages", "Message for progress sheet"), maxValue: min(18, self.listView.document.pageCount))
         var rectArray: Array<NSRect> = []
          for i in 0 ..< self.listView.document.pageCount {
-             progressController?.increment(by: Double(i))
-             progressController?.doubleValue = Double(i)
+             progressC?.increment(by: Double(i))
+             progressC?.doubleValue = Double(i)
              let page = self.listView.document.page(at: i)
              var rect = KMCropTools.getPageForegroundBox(page!)
              let bounds: NSRect = (page?.bounds(for: .mediaBox))!
@@ -2058,12 +2052,12 @@ extension KMMainViewController {
                 if let page = self.listView.document.page(at: 0) {
                     rect[0] = KMCropTools.getPageForegroundBox(page)
                 }
-                progressController?.increment(by: 1)
+                progressC?.increment(by: 1)
             } else if (count < 19) {
                 for i in 0 ..< 19 {
                     if let page = self.listView.document.page(at: UInt(i)) {
                         rect[i % 2] = NSUnionRect(rect[i % 2], KMCropTools.getPageForegroundBox(page))
-                        progressController?.increment(by: Double(i))
+                        progressC?.increment(by: Double(i))
                     }
                 }
             } else {
@@ -2075,7 +2069,7 @@ extension KMMainViewController {
                         if let page = self.listView.document.page(at: UInt(k)) {
                             rect[k % 2] = NSUnionRect(rect[k % 2], KMCropTools.getPageForegroundBox(page))
                             cnt += 1
-                            progressController?.increment(by: Double(cnt))
+                            progressC?.increment(by: Double(cnt))
                         }
                     }
                 }
@@ -2132,150 +2126,6 @@ extension KMMainViewController {
         }
     }
     
-    private func cropCustomArea() {
-        self.listView.toolMode = .selectToolMode
-        
-        self.listView.autoScales = true
-        self.listView.autoScales = false
-        var pageHeight: CGFloat = NSHeight(self.listView.currentPage().bounds(for: self.listView.displayBox))
-        if (self.listView.displaysPageBreaks) {
-            pageHeight += 8
-        }
-        
-        var scaleFactor: CGFloat = fmax(self.listView.minimumScaleFactor, NSHeight(self.listView.frame)/pageHeight)
-//        if (scaleFactor < self.preView.scaleFactor) {
-            self.listView.scaleFactor = scaleFactor
-//        }
-        
-        let tipView = KMCropTipView()
-        tipView.setString(string: "请框选裁剪区域")
-        tipView.frame = self.topTipBox.contentView!.frame
-        tipView.autoresizingMask = NSView.AutoresizingMask(rawValue: 18)
-        self.addTopTip(tipView)
-        
-        tipView.enterAction = {
-            () in
-            var rect = NSIntegralRect(self.listView.currentSelectionRect())
-            if (NSIsEmptyRect(rect)) {
-                return
-            }
-            
-            let window = KMCropSettingWindowController(windowNibName: "KMCropSettingWindowController")
-            self.view.window?.beginSheet(window.window!)
-            self.cropSettingWindowController = window
-            
-            window.itemClick = { [self]
-                (index: Int) in
-                if (index == 1) { /// 取消
-                    self.view.window?.endSheet((self.cropSettingWindowController?.window)!)
-                    self.cropSettingWindowController = nil
-                    return
-                }
-                let pageRangeType = self.cropSettingWindowController.pageRangeIndex
-                let pageCount: Int = Int(self.listView.document.pageCount)
-                var pages: Array<Int> = []
-                if (pageRangeType == 0) { /// 当前页面
-                    pages.append(self.listView.currentPageIndex)
-                } else if (pageRangeType == 1) { /// 全部页面
-                    for i in 0 ..< pageCount {
-                        pages.append(i)
-                    }
-                } else if (pageRangeType == 2) { /// 奇数页面
-                    var string: String = ""
-                    for i in 0 ..< pageCount {
-                        if (i % 2 == 1) {
-                            continue
-                        }
-                        
-                        pages.append(i)
-                    }
-                } else if (pageRangeType == 3) { /// 偶数页面
-                    var string: String = ""
-                    for i in 0 ..< pageCount {
-                        if (i % 2 == 0) {
-                            continue
-                        }
-                        
-                        pages.append(i)
-                    }
-                } else { /// 自定义
-                    for i in self.cropSettingWindowController.pageRangePages {
-                        pages.append(i)
-                    }
-                }
-                
-                if (pages.count < 0) {
-                    let alert = NSAlert()
-                    alert.messageText = "请选择页面"
-                    alert.runModal()
-                    return
-                }
-                
-                var pageSize: NSSize = NSZeroSize
-                if (self.cropSettingWindowController.pageSize == "None") {
-                    
-                } else {
-                    pageSize = KMCropTools.getPageSizeValue(self.cropSettingWindowController.pageSize)
-                }
-                
-                for i in pages {
-                    var page: CPDFPage = self.listView.document.page(at: UInt(i))
-                    var rect = NSIntegralRect(self.listView.selectionRect)
-
-                    if (NSIsEmptyRect(rect)) {
-                        rect = KMCropTools.getPageForegroundBox(page)
-                    }
-                    
-                    var newRect = NSIntersectionRect(rect, (page.bounds(for: .mediaBox)))
-                    page.setBounds(newRect, for: .cropBox)
-                    
-                    if (pageSize.width == 0 && pageSize.height == 0) {
-                        
-                    } else {
-//                        let tiffData = page.pdfListViewTIFFData(for: rect)
-                        let index: UInt = (page.pageIndex())
-//                        let newPage: CPDFPage = nil
-//                        self.listView.document.removePage(at: index)
-//                        newPage.setBounds(NSMakeRect(0, 0, pageSize.width, pageSize.height), for: .cropBox)
-                        //        let result = self.preView.document.insertPageObject(newPage, at: index)
-                        let result = self.listView.document.insertPage(pageSize, at: index)
-                    }
-                }
-                
-                /// 保存到临时路径
-                let toPath: String = self.listView.document.documentURL.path
-                let documentPath = NSTemporaryDirectory()
-                let tempPath: String = "\(documentPath)/\(toPath.lastPathComponent)"
-                if (FileManager.default.fileExists(atPath: tempPath)) {
-                    try?FileManager.default.removeItem(atPath: tempPath)
-                }
-
-                let result = self.listView.document.write(to: URL(fileURLWithPath: tempPath))
-                if (result) {
-                    if (FileManager.default.fileExists(atPath: toPath)) {
-                        try?FileManager.default.removeItem(atPath: toPath)
-                    }
-                    
-                    try?FileManager.default.moveItem(atPath: tempPath, toPath: toPath)
-                } else {
-                    try?FileManager.default.removeItem(atPath: tempPath)
-                }
-                DispatchQueue.main.async {
-                    self.listView.toolMode = .textToolMode
-
-                    /// 刷新预览视图
-                    self.listView.layoutDocumentView()
-                    
-                    self.listView.displayBox = .cropBox
-                }
-                
-                self.view.window?.endSheet((self.cropSettingWindowController?.window)!)
-                self.cropSettingWindowController = nil
-                self.addTopTip(nil)
-            }
-        }
-    }
-    
     @objc private func shareDocument(sender:KMToolbarViewController, limit: Bool = false) {
         if (limit) {
             var doucumentURL : URL = self.listView.document.documentURL
@@ -2456,8 +2306,8 @@ extension KMMainViewController {
     // 开启/关闭左边栏
     @objc func toggleLeftPane() -> Void {
 //        if lastLeftPanWidth >= functionWidth {
-            leftPanelOpen = true
-            applyLeftSideWidth(panelWidth+functionWidth, rightSideWidth: lastRightPanWidth)
+        self.model.leftPanelOpen = true
+        applyLeftSideWidth(self.model.panelWidth+functionWidth, rightSideWidth: self.model.lastRightPanWidth)
 //        } else {
 //            leftPanelOpen = false
 //            applyLeftSideWidth(functionWidth, rightSideWidth: lastRightPanWidth)
@@ -2466,47 +2316,47 @@ extension KMMainViewController {
     
     // 开启左边栏
     @objc func openLeftPane() -> Void {
-        leftPanelOpen = true
-        applyLeftSideWidth(panelWidth+functionWidth, rightSideWidth: lastRightPanWidth)
+        self.model.leftPanelOpen = true
+        applyLeftSideWidth(self.model.panelWidth+functionWidth, rightSideWidth: self.model.lastRightPanWidth)
         
         self.toolbarController.findItem(KMLeftControlToolbarItemIdentifier)?.isSelected = true
     }
     
     // 关闭左边栏
     @objc func closeLeftPane() -> Void {
-        leftPanelOpen = false
-        applyLeftSideWidth(functionWidth, rightSideWidth: lastRightPanWidth)
+        self.model.leftPanelOpen = false
+        applyLeftSideWidth(functionWidth, rightSideWidth: self.model.lastRightPanWidth)
         
         self.toolbarController.findItem(KMLeftControlToolbarItemIdentifier)?.isSelected = false
     }
     
     // 开启/关闭右边栏
     @objc func toggleRightPane() -> Void {
-        if lastRightPanWidth > 5 {
-            self.rightPanelIsOpen = false
-            applyLeftSideWidth(lastLeftPanWidth, rightSideWidth: 0)
+        if self.model.lastRightPanWidth > 5 {
+            self.model.rightPanelIsOpen = false
+            applyLeftSideWidth(self.model.lastLeftPanWidth, rightSideWidth: 0)
         } else {
-            self.rightPanelIsOpen = true
-            applyLeftSideWidth(lastLeftPanWidth, rightSideWidth: defaultRightWidth)
+            self.model.rightPanelIsOpen = true
+            applyLeftSideWidth(self.model.lastLeftPanWidth, rightSideWidth: self.model.defaultRightWidth)
         }
     }
     
     @objc func openRightPane() -> Void {
         if (KMPreferenceManager.shared.autoExpandPropertyPanel) {
-            if self.rightPanelIsOpen {
+            if self.model.rightPanelIsOpen {
                 return
             }
-            self.rightPanelIsOpen = true
+            self.model.rightPanelIsOpen = true
             self.toolbarController.selectItem(KMRightControlToolbarItemIdentifier)
-            applyLeftSideWidth(lastLeftPanWidth, rightSideWidth: defaultRightWidth)
+            applyLeftSideWidth(self.model.lastLeftPanWidth, rightSideWidth: self.model.defaultRightWidth)
         }
     }
     
     @objc func closeRightPane() -> Void {
         if (KMPreferenceManager.shared.autoExpandPropertyPanel) {
-            self.rightPanelIsOpen = false
+            self.model.rightPanelIsOpen = false
             self.toolbarController.cancelSelected(KMRightControlToolbarItemIdentifier)
-            applyLeftSideWidth(lastLeftPanWidth, rightSideWidth: 0)
+            applyLeftSideWidth(self.model.lastLeftPanWidth, rightSideWidth: 0)
         }
     }
     
@@ -2552,7 +2402,7 @@ extension KMMainViewController {
                     tabController?.title = outputSavePanel.url!.lastPathComponent
                     
                     if let newPdfDocument = CPDFDocument(url: newFileURL) {
-                        self.isSaveKeyChain = false
+                        self.model.isSaveKeyChain = false
                         newPdfDocument.unlock(withPassword: self.document?.password)
                         if (newPdfDocument.pageCount > 0) {
                             self.setDocument = newPdfDocument
@@ -3115,21 +2965,21 @@ extension KMMainViewController {
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
         progress.message = NSLocalizedString("Converting...", comment: "")
-        progressController = progress
-        progressController?.message = message
+        progressC = progress
+        progressC?.message = message
         if maxValue > 0 {
-            progressController?.indeterminate = false
-            progressController?.maxValue = Double(maxValue)
+            progressC?.indeterminate = false
+            progressC?.maxValue = Double(maxValue)
         } else {
-            progressController?.indeterminate = true
+            progressC?.indeterminate = true
         }
-        self.km_beginSheet(windowC: progressController!)
+        self.km_beginSheet(windowC: progressC!)
     }
     
     func dismissProgressSheet() {
-        progressController?.stopAnimation()
+        progressC?.stopAnimation()
         self.km_endSheet()
-        progressController = nil
+        progressC = nil
     }
     
     func converFilesToPath(files: Array<KMBatchOperateFile>) -> [String] {
@@ -3699,7 +3549,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
     
     private func _aiTranslationPDFFileAction() {
         let isExceedsLimit = self.isPDFPageCountExceedsLimit(filePath: (self.document?.documentURL.path)!)
-        if self.isFileGreaterThan10MB(atPath: (self.document?.documentURL.path)!) {
+        if KMTools.isFileGreaterThan10MB(atPath: (self.document?.documentURL.path)!) {
             let alert = NSAlert()
             alert.alertStyle = .critical
             alert.messageText = NSLocalizedString("The uploaded file size cannot exceed 10MB", comment: "")
@@ -3992,7 +3842,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                     guard let _url =  KMTools.saveWatermarkDocumentToTemp(document: self.listView.document, secureOptions: self.secureOptions, removePWD: self.removeSecureFlag) else {
                         return
                     }
-                    self.showMergeWindow(url: _url, password)
+                    self.showMergeWindow(url: _url, self.model.password)
                     return
                 }
                 
@@ -4162,7 +4012,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 }
                 
                 if (index == 1) { /// 取消
-                    if (self.hasAddRedact) {
+                    if (self.model.hasAddRedact) {
                         let alert = NSAlert()
                         alert.messageText = NSLocalizedString("You can save a document with unapplied cipher text and edit it again. If you do not save, all changes will be lost.", comment: "")
                         alert.addButton(withTitle: NSLocalizedString("Don’t Save", comment: ""))
@@ -4333,7 +4183,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                                         
                                         /// 删除安全性设置
                                         if (!self.listView.document!.allowsCopying || !self.listView.document!.allowsPrinting) {
-                                            self.isSaveKeyChain = false
+                                            self.model.isSaveKeyChain = false
                                             self.listView.document.unlock(withPassword: resultPassword)
                                         }
                                         
@@ -5112,7 +4962,7 @@ extension KMMainViewController: KMPageNumberDisplayViewDelegate {
     
     func commitEditingIfNeed() {
         let isEdited = self.listView?.isEdited() ?? false
-        if isEdited || self.isPDFTextImageEdited {
+        if isEdited || self.model.isPDFTextImageEdited {
             self.listView.commitEditing()
         }
     }

+ 24 - 47
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift

@@ -159,12 +159,9 @@ extension KMMainViewController: KMEditMenuProtocol {
     }
 }
 
-// MARK: View Menu
+// MARK: - View Menu
 
 extension KMMainViewController {
-    
-    // scale
-    
     @IBAction func menuItemAction_adjustWidth(_ sender: Any) {
         self.selectZoom(.width)
     }
@@ -340,7 +337,6 @@ extension KMMainViewController {
             self.exitFullScreen("")
         } else if self.canEnterPresentation(){
             self.enterPresentation()
-//            self.browserWindowController?.enterPresentation()
         }
     }
     
@@ -363,10 +359,7 @@ extension KMMainViewController {
     }
     @IBAction func chooseAutoFlowSetting(_ sender: Any?) {
         autoFlowOptionsSheetController = KMAutoFlowOptionsSheetController(windowNibName: "KMAutoFlowOptionsSheetController")
-        
-        NSWindow.currentWindow().beginSheet((autoFlowOptionsSheetController?.window)!) { responce in
-            
-        }
+        NSWindow.currentWindow().beginSheet((autoFlowOptionsSheetController?.window)!) { responce in }
     }
     
     @IBAction func toggleReadingBar(_ sender: Any?) {
@@ -374,7 +367,7 @@ extension KMMainViewController {
     }
     
     @IBAction func toggleLeftSidePane(_ sender: Any?) {
-        if self.leftPanelOpen {
+        if self.model.leftPanelOpen {
             self.closeLeftPane()
         } else {
             self.openLeftPane()
@@ -395,24 +388,17 @@ extension KMMainViewController {
         guard let item = sender as? NSMenuItem else {
             return
         }
-//        let index = item.tag
-        
+
         if item.tag < 2 && IAPProductsManager.default().isAvailableAllFunction() == false {
             KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
             return
         }
-        
-//        if (toolbarViewController.splitScreenPopover != nil) {
-//            [toolbarViewController.splitScreenPopover close];
-//        }
-        
         self.splitView(withTag: item.tag)
-//        [[NSNotificationCenter defaultCenter] postNotificationName:@"kKMToolsItemSelectStateChange" object:self.pdfView];
     }
     
     @IBAction func themesColor(_ sender: Any?) {
         guard let item = sender as? NSMenuItem else {
-            __NSBeep()
+            NSSound.beep()
             return
         }
         let mode = item.tag
@@ -448,9 +434,6 @@ extension KMMainViewController {
         
         self.listView.layoutDocumentView()
         self.listView.setNeedsDisplayForVisiblePages()
-        
-//        [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:mode] forKey:@"kPDFViewModeKey"];
-//        [[NSUserDefaults standardUserDefaults] synchronize];
         UserDefaults.standard.set(mode, forKey: "kPDFViewModeKey")
         UserDefaults.standard.synchronize()
     }
@@ -464,7 +447,7 @@ extension KMMainViewController {
     }
 }
 
-// MARK: Annotation Menu
+// MARK: - Annotation Menu
 
 extension KMMainViewController {
     @IBAction func menuItemAction_highlight(_ sender: Any) {
@@ -619,11 +602,9 @@ extension KMMainViewController {
     
     private func mainMenuUpdateAnnotationStyle(identifier : String) {
         if self.toolbarController.toolbarType != .Annatiton {
-            let item : KMToolbarItemView = (self.toolbarController.mainToolBarView?.toolbarItemFindItemIdentifiers(value: KMDocumentAnnotationToolbarItemIdentifier))!
-            self.toolbarController.mainToolBarView?.delegate?.toolbarViewController?(self.toolbarController.mainToolBarView!, clickMode: .Annatiton, toolbar: item, [])
+            self.toolbarController.clickItem(KMDocumentAnnotationToolbarItemIdentifier)
         }
-        let childitem : KMToolbarItemView = (self.toolbarController.childToolBarView?.toolbarItemFindItemIdentifiers(value: identifier))!
-        self.toolbarController.mainToolBarView?.delegate?.changeAnnotationModeAction?(item: childitem.clickButton)
+        self.toolbarController.clickItem(identifier)
     }
 }
 
@@ -735,7 +716,7 @@ extension KMMainViewController: KMSystemPDFMenuProtocol {
     }
 }
 
-// MARK: goto Menu
+// MARK: - goto Menu
 
 extension KMMainViewController {
     @IBAction func menuItemAction_nextPage(_ sender: Any) {
@@ -805,25 +786,22 @@ extension KMMainViewController {
             NSSound.beep()
             return
         }
-//        if (markedPageIndex == NSNotFound || [pdfDoc isLocked] || [pdfDoc pageCount] == 0) {
-//            NSBeep();
-//        } else if (beforeMarkedPageIndex != NSNotFound) {
-        if self.beforeMarkedPageIndex != NSNotFound {
-            self.listView.goToPage(at: min(UInt(self.beforeMarkedPageIndex), pdfDoc.pageCount-1), point: self.beforeMarkedPagePoint)
-        } else if (currentPageIndex != self.markedPageIndex) {
+        if self.model.beforeMarkedPageIndex != NSNotFound {
+            self.listView.goToPage(at: min(UInt(self.model.beforeMarkedPageIndex), pdfDoc.pageCount-1), point: self.model.beforeMarkedPagePoint)
+        } else if (currentPageIndex != self.model.markedPageIndex) {
 //            NSUInteger lastPageIndex = [pdfView currentPageIndexAndPoint:&beforeMarkedPagePoint rotated:NULL];
-            let lastPageIndex = self.listView.currentPageIndexAndPoint(&self.beforeMarkedPagePoint, rotated: nil)
-            self.listView.goToPage(at: min(UInt(self.markedPageIndex), pdfDoc.pageCount-1), point: self.markedPagePoint)
-            self.beforeMarkedPageIndex = Int(lastPageIndex)
+            let lastPageIndex = self.listView.currentPageIndexAndPoint(&self.model.beforeMarkedPagePoint, rotated: nil)
+            self.listView.goToPage(at: min(UInt(self.model.markedPageIndex), pdfDoc.pageCount-1), point: self.model.markedPagePoint)
+            self.model.beforeMarkedPageIndex = Int(lastPageIndex)
         }
     }
     @IBAction func markPage(_ sender: Any?) {
-        self.markedPageIndex = Int(self.listView.currentPageIndexAndPoint(&self.markedPagePoint, rotated: nil))
-        self.beforeMarkedPageIndex = NSNotFound
+        self.model.markedPageIndex = Int(self.listView.currentPageIndexAndPoint(&self.model.markedPagePoint, rotated: nil))
+        self.model.beforeMarkedPageIndex = NSNotFound
     }
 }
 
-// MARK: tool Menu
+// MARK: - tool Menu
 
 extension KMMainViewController: KMSystemToolMenuProtocol {
     func getInfo(_ sender: Any?) {
@@ -831,7 +809,6 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     }
     
     @IBAction func menuItemAction_textTool(_ sender: Any) {
-//        self.toolbarController.selectItem(KMToolbarZoomToSelectionItemIdentifier)
         self.listView?.toolMode = .textToolMode
         self.listView?.annotationType = .unkown
     }
@@ -1241,7 +1218,7 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     }
 }
 
-// MARK: window Menu
+// MARK: - window Menu
 
 extension KMMainViewController {
     @IBAction func menuItemAction_showForwardTagPage(_ sender: Any) {
@@ -1336,8 +1313,8 @@ extension KMMainViewController {
     }
 }
 
-extension KMMainViewController: NSMenuItemValidation, NSMenuDelegate {
-    func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
+extension KMMainViewController {
+    override func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
         if (menuItem.action == #selector(menuItemAction_currentWindowName)) {
             menuItem.title = (self.myDocument?.fileURL!.lastPathComponent)!
             return true
@@ -1367,14 +1344,14 @@ extension KMMainViewController: NSMenuItemValidation, NSMenuDelegate {
             }
         }
         if (menuItem.action == #selector(menuItemAction_hiddenLeftSide)) {
-            if (self.leftPanelOpen) {
+            if (self.model.leftPanelOpen) {
                 menuItem.title = NSLocalizedString("Hide Left Side Panel", comment: "")
             } else {
                 menuItem.title = NSLocalizedString("Show Left Side Panel", comment: "")
             }
         }
         if (menuItem.action == #selector(menuItemAction_hiddenRightSide)) {
-            if (self.rightPanelIsOpen) {
+            if (self.model.rightPanelIsOpen) {
                 menuItem.title = NSLocalizedString("Hide Right Side Panel", comment: "")
             } else {
                 menuItem.title = NSLocalizedString("Show Right Side Panel", comment: "")
@@ -1511,7 +1488,7 @@ extension KMMainViewController: NSMenuItemValidation, NSMenuDelegate {
         }
         if KMSystemMenu.isViewSelector(sel: action) {
             if action == KMSystemMenu.View.toggleLeftSidePaneSelector {
-                if self.leftPanelOpen {
+                if self.model.leftPanelOpen {
                     menuItem.title = NSLocalizedString("Hide Panel", comment: "Menu item title")
                 } else {
                     menuItem.title = NSLocalizedString("Show Panel", comment: "Menu item title")

File diff suppressed because it is too large
+ 1048 - 80
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift


File diff suppressed because it is too large
+ 153 - 1461
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift


+ 57 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/Model/KMMainModel.swift

@@ -0,0 +1,57 @@
+//
+//  KMMainModel.swift
+//  PDF Reader Pro
+//
+//  Created by tangchao on 2024/4/30.
+//
+
+import Cocoa
+
+extension KMMainModel.Key {
+    static let kLeftSidePaneWidth            = "leftSidePaneWidth"
+    static let kRightSidePaneWidth           = "rightSidePaneWidth"
+    static let kSnapshots                    = "snapshots"
+    
+    static let kDisplaysPageBreaks           = "displaysPageBreaks"
+    static let kDisplaysAsBook               = "displaysAsBook"
+    static let kDisplayMode                  = "displayMode"
+    static let kDisplayBox                   = "displayBox"
+    static let kHasHorizontalScroller        = "hasHorizontalScroller"
+    static let kHasVerticalsCroller          = "hasVerticalScroller"
+    static let kAutoHidesScrollers           = "autoHidesScrollers"
+    static let kScaleFactor                  = "scaleFactor"
+    static let kAutoScales                   = "autoScales"
+    
+    static let pageIndex  = "pageIndex"
+    static let scrollPoint  = "scrollPoint"
+    static let locked  = "locked"
+}
+
+@objcMembers class KMMainModel: NSObject {
+    struct Key {}
+    
+    // 标识 pdf 已编辑
+    var isPDFDocumentEdited = false
+    // 标识 pdf文字图片已编辑
+    var isPDFTextImageEdited = false
+    
+    var password: String?
+    var isShowQuickTour = false
+    var isSaveKeyChain = true
+    var rightMouseEventing = false
+    
+    var hasAddRedact: Bool = false
+    var isShowBOTA: Bool = false
+    
+    let panelWidth = 212.0
+    let defaultRightWidth = 260.0
+    var lastLeftPanWidth = 0.0
+    var lastRightPanWidth = 0.0
+    var leftPanelOpen: Bool = false
+    var rightPanelIsOpen = false
+    
+    var beforeMarkedPageIndex = NSNotFound
+    var markedPageIndex = NSNotFound
+    var beforeMarkedPagePoint = NSPoint.zero
+    var markedPagePoint = NSPoint.zero
+}

+ 16 - 8
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -3436,6 +3436,9 @@
 		BB46CF4C2AFBB34900281EDF /* AutoSaveManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB46CF4B2AFBB34800281EDF /* AutoSaveManager.swift */; };
 		BB46CF4D2AFBB34900281EDF /* AutoSaveManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB46CF4B2AFBB34800281EDF /* AutoSaveManager.swift */; };
 		BB46CF4E2AFBB34900281EDF /* AutoSaveManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB46CF4B2AFBB34800281EDF /* AutoSaveManager.swift */; };
+		BB48F8712BE07DAA002DA996 /* KMMainModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB48F8702BE07DAA002DA996 /* KMMainModel.swift */; };
+		BB48F8722BE07DAA002DA996 /* KMMainModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB48F8702BE07DAA002DA996 /* KMMainModel.swift */; };
+		BB48F8732BE07DAA002DA996 /* KMMainModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB48F8702BE07DAA002DA996 /* KMMainModel.swift */; };
 		BB493F952B3E9805003E6175 /* KMBatchQuickActionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB493F942B3E9805003E6175 /* KMBatchQuickActionManager.swift */; };
 		BB493F962B3E9805003E6175 /* KMBatchQuickActionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB493F942B3E9805003E6175 /* KMBatchQuickActionManager.swift */; };
 		BB493F972B3E9805003E6175 /* KMBatchQuickActionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB493F942B3E9805003E6175 /* KMBatchQuickActionManager.swift */; };
@@ -3792,9 +3795,6 @@
 		BB6DD821293497B6001F0544 /* KMSecureEncryptModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD820293497B6001F0544 /* KMSecureEncryptModel.swift */; };
 		BB6DD822293497B6001F0544 /* KMSecureEncryptModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD820293497B6001F0544 /* KMSecureEncryptModel.swift */; };
 		BB6DD823293497B6001F0544 /* KMSecureEncryptModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD820293497B6001F0544 /* KMSecureEncryptModel.swift */; };
-		BB6DD8252934D056001F0544 /* KMSecureEncryptSuccessTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD8242934D056001F0544 /* KMSecureEncryptSuccessTipView.swift */; };
-		BB6DD8262934D056001F0544 /* KMSecureEncryptSuccessTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD8242934D056001F0544 /* KMSecureEncryptSuccessTipView.swift */; };
-		BB6DD8272934D056001F0544 /* KMSecureEncryptSuccessTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD8242934D056001F0544 /* KMSecureEncryptSuccessTipView.swift */; };
 		BB6EA2942B70AF48000D4490 /* KMConvertCompareViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB6EA28E2B70AF43000D4490 /* KMConvertCompareViewController.xib */; };
 		BB6EA2952B70AF48000D4490 /* KMConvertCompareViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB6EA28E2B70AF43000D4490 /* KMConvertCompareViewController.xib */; };
 		BB6EA2962B70AF48000D4490 /* KMConvertCompareViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB6EA28E2B70AF43000D4490 /* KMConvertCompareViewController.xib */; };
@@ -6574,6 +6574,7 @@
 		BB42C7EB2B46421B003FF2D4 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
 		BB46CF472AFB7E5C00281EDF /* InitialUserDefaults.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = InitialUserDefaults.plist; sourceTree = "<group>"; };
 		BB46CF4B2AFBB34800281EDF /* AutoSaveManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoSaveManager.swift; sourceTree = "<group>"; };
+		BB48F8702BE07DAA002DA996 /* KMMainModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMMainModel.swift; sourceTree = "<group>"; };
 		BB493F942B3E9805003E6175 /* KMBatchQuickActionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBatchQuickActionManager.swift; sourceTree = "<group>"; };
 		BB49ECDB293EED6100C82CA2 /* KMConvertWordWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMConvertWordWindowController.swift; sourceTree = "<group>"; };
 		BB49ECDC293EED6100C82CA2 /* KMConvertWordWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMConvertWordWindowController.xib; sourceTree = "<group>"; };
@@ -6726,7 +6727,6 @@
 		BB6DD81729348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureEncryptComboBoxCellView.swift; sourceTree = "<group>"; };
 		BB6DD81B29348F31001F0544 /* KMSecureTextFiled.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureTextFiled.swift; sourceTree = "<group>"; };
 		BB6DD820293497B6001F0544 /* KMSecureEncryptModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureEncryptModel.swift; sourceTree = "<group>"; };
-		BB6DD8242934D056001F0544 /* KMSecureEncryptSuccessTipView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureEncryptSuccessTipView.swift; sourceTree = "<group>"; };
 		BB6EA28E2B70AF43000D4490 /* KMConvertCompareViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMConvertCompareViewController.xib; sourceTree = "<group>"; };
 		BB6EA28F2B70AF44000D4490 /* KMConvertCompareViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMConvertCompareViewController.h; sourceTree = "<group>"; };
 		BB6EA2902B70AF45000D4490 /* KMConvertCompareViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMConvertCompareViewController.m; sourceTree = "<group>"; };
@@ -8432,6 +8432,7 @@
 		9FDD0F58294AB3E7000C4DAD /* ViewController */ = {
 			isa = PBXGroup;
 			children = (
+				BB48F86F2BE07D7B002DA996 /* Model */,
 				ADE8BC2329F7CA5900570F89 /* Views */,
 				9FDD0F62294AB645000C4DAD /* KMMainViewController.swift */,
 				9FDD0F63294AB645000C4DAD /* KMMainViewController.xib */,
@@ -11703,6 +11704,14 @@
 			path = Resource;
 			sourceTree = "<group>";
 		};
+		BB48F86F2BE07D7B002DA996 /* Model */ = {
+			isa = PBXGroup;
+			children = (
+				BB48F8702BE07DAA002DA996 /* KMMainModel.swift */,
+			);
+			path = Model;
+			sourceTree = "<group>";
+		};
 		BB49ECE3293EF50800C82CA2 /* View */ = {
 			isa = PBXGroup;
 			children = (
@@ -12038,7 +12047,6 @@
 				BB6DD81729348A00001F0544 /* KMSecureEncryptComboBoxCellView.swift */,
 				BB6DD81B29348F31001F0544 /* KMSecureTextFiled.swift */,
 				BB8115FE2992682F0008F536 /* KMSecureLimitAlertView.swift */,
-				BB6DD8242934D056001F0544 /* KMSecureEncryptSuccessTipView.swift */,
 				BBA8B7A92935DC120097D183 /* KMRemovePasswordResultTipView.swift */,
 				BB8115FA29924A5F0008F536 /* KMSecureEncryptCheckCellView.swift */,
 				ADFA8F102B60E01C002595A4 /* KMSecureAlertView.swift */,
@@ -15683,6 +15691,7 @@
 				89752E1D2942CB03003FF08E /* KMSearchMode.swift in Sources */,
 				AD3A3587294C11ED00D72802 /* KMPrintPreviewPresenter.swift in Sources */,
 				BB1B0AC52B4FC6E900889528 /* KMGuideInfoWindow.swift in Sources */,
+				BB48F8712BE07DAA002DA996 /* KMMainModel.swift in Sources */,
 				AD199DF82B26A36500D56FEE /* KMPrintPosterPreviewView.swift in Sources */,
 				BB3AD6F929935483004FC1AE /* Reachability.m in Sources */,
 				AD1FE84C2BD920C300AA4A9B /* TextFieldFormatter.m in Sources */,
@@ -16438,7 +16447,6 @@
 				9F69DBBA2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift in Sources */,
 				BBE9D0972AF0CECB002E83CE /* KMBatchOperateCompressViewController.swift in Sources */,
 				BB74DA772AC41182006EDFE7 /* NSFont+KMExtension.swift in Sources */,
-				BB6DD8252934D056001F0544 /* KMSecureEncryptSuccessTipView.swift in Sources */,
 				BB6B43662A04919200E02B54 /* KMBaseViewController.swift in Sources */,
 				AD3AAD412B0B7B6C00DE5FE7 /* KMCompareManager.swift in Sources */,
 				AD055EB92B8843FD0035F824 /* SKToolbarItem.m in Sources */,
@@ -16808,7 +16816,6 @@
 				ADAFDA3A2AE8EEFF00F084BC /* KMAdvertisementRequestServer.swift in Sources */,
 				BBC745EB295F067B0072C2ED /* KMCropSettingWindowController.swift in Sources */,
 				ADDEEA7B2AD3F4C800EF675D /* KMPopUpButton.swift in Sources */,
-				BB6DD8262934D056001F0544 /* KMSecureEncryptSuccessTipView.swift in Sources */,
 				BB853C702AF879C1009C20C1 /* KMBatchRemoveWatermarkOperation.swift in Sources */,
 				9FBC48B9299B44C600CA39D7 /* KMSecondaryViewController.m in Sources */,
 				ADDF832D2B391A5C00A81A4E /* NSEvent+PDFListView.m in Sources */,
@@ -16946,6 +16953,7 @@
 				AD2D74AE29F0CEB300EDC5E4 /* KMCancellationWindowController.swift in Sources */,
 				BB146FD9299DC0D100784A6A /* GTLRFramework.m in Sources */,
 				BB4EEF3D29764578003A3537 /* KMRedactPropertyContentView.swift in Sources */,
+				BB48F8722BE07DAA002DA996 /* KMMainModel.swift in Sources */,
 				BBFEF7242B3A78BC00C28AC0 /* KMSystemGotoMenu.swift in Sources */,
 				BB147024299DC0D100784A6A /* OIDResponseTypes.m in Sources */,
 				BB162E93294FFE020088E9D1 /* KMWatermarkModel.swift in Sources */,
@@ -18043,6 +18051,7 @@
 				BBFCCE0A2B56988C003742B3 /* KMPreferenceCommon.swift in Sources */,
 				BB2F9AB12AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift in Sources */,
 				BB2F615A2966B69D001CB369 /* KMWatermarkPropertyHomeController.swift in Sources */,
+				BB48F8732BE07DAA002DA996 /* KMMainModel.swift in Sources */,
 				89752E1F2942CB04003FF08E /* KMSearchMode.swift in Sources */,
 				BB147049299DC0D200784A6A /* OIDServiceConfiguration.m in Sources */,
 				AD1FE84E2BD920C300AA4A9B /* TextFieldFormatter.m in Sources */,
@@ -18880,7 +18889,6 @@
 				BB0353CA2B2987C40048A16C /* KMSnapshotWindow.swift in Sources */,
 				BB328B6C2B565BEC00B382C6 /* iVersion.m in Sources */,
 				AD3AAD2E2B0B6FFA00DE5FE7 /* KMCompareCoveringView.swift in Sources */,
-				BB6DD8272934D056001F0544 /* KMSecureEncryptSuccessTipView.swift in Sources */,
 				ADAFDA782AEB5FCD00F084BC /* KMHomeHistoryCollectionItem.swift in Sources */,
 				ADAFDA052AE8BD5C00F084BC /* KMConvertURLToPDF.m in Sources */,
 				9FCFECAA2AD243C900EAD2CB /* KMBlankView.swift in Sources */,

+ 106 - 26
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -132,22 +132,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "6B9373DD-1A2D-449E-8B52-CAB5C3223C22"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "356"
-            endingLineNumber = "356"
-            landmarkName = "commandDispatch(_:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -302,8 +286,8 @@
             filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "366"
-            endingLineNumber = "366"
+            startingLineNumber = "371"
+            endingLineNumber = "371"
             landmarkName = "-setAnnotations:"
             landmarkType = "7">
          </BreakpointContent>
@@ -318,8 +302,8 @@
             filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "376"
-            endingLineNumber = "376"
+            startingLineNumber = "381"
+            endingLineNumber = "381"
             landmarkName = "-setAnnotations:"
             landmarkType = "7">
          </BreakpointContent>
@@ -334,8 +318,8 @@
             filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "376"
-            endingLineNumber = "376"
+            startingLineNumber = "381"
+            endingLineNumber = "381"
             landmarkName = "-setAnnotations:"
             landmarkType = "7">
          </BreakpointContent>
@@ -462,8 +446,8 @@
             filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3518"
-            endingLineNumber = "3518"
+            startingLineNumber = "3368"
+            endingLineNumber = "3368"
             landmarkName = "changeModelAction(mode:)"
             landmarkType = "7">
          </BreakpointContent>
@@ -478,11 +462,107 @@
             filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "3813"
-            endingLineNumber = "3813"
+            startingLineNumber = "3663"
+            endingLineNumber = "3663"
             landmarkName = "mainToolDidClicked(_:_:_:_:_:)"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "C7678A42-CF3B-45B2-98FE-D482016561A5"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "4711"
+            endingLineNumber = "4711"
+            landmarkName = "toolbarViewController(_:menuItemDidClick:index:info:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "AC55B4D0-B22C-4B02-9564-9EE9ED576363"
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "4562"
+            endingLineNumber = "4562"
+            landmarkName = "toolbarViewController(_:itemDidClick:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "6CF63E20-BB2D-48FC-8418-0508501CFE39"
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "174"
+            endingLineNumber = "174"
+            landmarkName = "subViewType"
+            landmarkType = "24">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "F75A96BF-D169-4294-860E-D87BC0554D56"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1939"
+            endingLineNumber = "1939"
+            landmarkName = "annotationsAttributeHasChange(_:)"
+            landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "F75A96BF-D169-4294-860E-D87BC0554D56 - d7c6bc251e6b2862"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.annotationsAttributeHasChange(Foundation.Notification) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "1939"
+                  endingLineNumber = "1939"
+                  offsetFromSymbolStart = "385">
+               </Location>
+               <Location
+                  uuid = "F75A96BF-D169-4294-860E-D87BC0554D56 - d7c6bc251e6b2862"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.annotationsAttributeHasChange(Foundation.Notification) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "1939"
+                  endingLineNumber = "1939"
+                  offsetFromSymbolStart = "634">
+               </Location>
+            </Locations>
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>