Browse Source

【fix】【BOTA】右侧属性面板更改填充符号,左侧注释列表未同步变化

tangchao 10 months ago
parent
commit
05cdb1f788

+ 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 ||

+ 6 - 0
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)

+ 11 - 38
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -423,7 +423,7 @@ import Cocoa
         }
         if let cnt = snapshotSetups?.count, cnt > 0 {
             if let data = self.listView?.document?.isLocked, data {
-                self.savedNormalSetup.setObject(snapshotSetups, forKey: "snapshots" as NSCopying)
+                self.savedNormalSetup.setObject(snapshotSetups as Any, forKey: "snapshots" as NSCopying)
             } else {
                 self.showSnapshots(setups: snapshotSetups)
             }
@@ -457,34 +457,9 @@ import Cocoa
         self.rightSideViewController.isHidden = true
         self.rightSideViewController.delegate = self
         self.rightView.addSubview(self.rightSideViewController.view)
-        self.rightSideViewController.propertyDidChange = {
-            [weak self] (model: AnyObject?) in
-            let topBarView = self?.toolbarController.fetchTopBarView()
-            if (topBarView == nil || ((topBarView?.isKind(of: KMWatermarkAdjectiveTopBarView.self)) == false)) {
-                return
-            }
-            
-            /// Bates码、页眉页脚、背景、水印
-            if (model == nil) {
-                (topBarView as! KMWatermarkAdjectiveTopBarView).isCanApply(can: false)
-            } else {
-                if ((model?.isKind(of: KMHeaderFooterObject.self))!) {
-                    if ((model as! KMHeaderFooterObject).hasVaild) {
-                        (topBarView as! KMWatermarkAdjectiveTopBarView).isCanApply(can: true)
-                    } else {
-                        (topBarView as! KMWatermarkAdjectiveTopBarView).isCanApply(can: false)
-                    }
-                } else if ((model?.isKind(of: KMHeaderFooterObject.self))!) {
-                    if ((model as! KMHeaderFooterObject).hasVaild) {
-                        (topBarView as! KMWatermarkAdjectiveTopBarView).isCanApply(can: true)
-                    } else {
-                        (topBarView as! KMWatermarkAdjectiveTopBarView).isCanApply(can: false)
-                    }
-                } else if ((model?.isKind(of: KMBackgroundModel.self))!) {
-                    (topBarView as! KMWatermarkAdjectiveTopBarView).isCanApply(can: true)
-                } else if ((model?.isKind(of: KMWatermarkModel.self))!) {
-                    (topBarView as! KMWatermarkAdjectiveTopBarView).isCanApply(can: true)
-                }
+        self.rightSideViewController.propertyDidChange = { [weak self] model in
+            if let anno = model as? CSelfSignAnnotation {
+                self?.leftSideViewController.refreshUIForAnnoAttributeDidChange(anno, attributes: nil)
             }
         }
     }
@@ -714,7 +689,7 @@ import Cocoa
             self.aiTipView.clickHandle = { [weak self] view in
                 self?.showAITypeChooseView()
             }
-            self.aiTipView.rightClickHandle = { [weak self] view in
+            self.aiTipView.rightClickHandle = { view in
                 AIInfoManager.default().showAIIcon = false
                 NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kAIIconShowStateChangeNotification"), object: nil)
             }
@@ -768,8 +743,8 @@ import Cocoa
             string = NSLocalizedString("AI Translate", comment: "")
         }
          
-        let font = NSFont.SFProTextRegularFont(13)
-        var style = NSMutableParagraphStyle.init()
+        _ = NSFont.SFProTextRegularFont(13)
+        let style = NSMutableParagraphStyle.init()
         style.alignment = .center
         style.lineBreakMode = .byCharWrapping
         let size: NSSize = string.boundingRect(with: NSSize(width: 1000, height: 100),
@@ -929,7 +904,7 @@ import Cocoa
                             self?.showAllConvertWindow(convertT: .Word)
                         } else {
                             let limitWC = KMPurchaseLimitWindowController.currentLimitWC()
-                            limitWC.continueBlock = { [weak self] windowController in
+                            limitWC.continueBlock = { windowController in
                                 
                             }
                             limitWC.window?.center()
@@ -972,8 +947,7 @@ import Cocoa
         if VerificationManager.default().status == .none {
             let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
             let lastVersion = UserDefaults.standard.object(forKey: "SKLastTrialVersionMainDocumentLaunchedKey") as? String ?? ""
-            if lastVersion == nil ||
-                lastVersion != appVersion {
+            if lastVersion.isEmpty || lastVersion != appVersion {
                 UserDefaults.standard.setValue(appVersion, forKey: "SKLastTrialVersionMainDocumentLaunchedKey")
                 UserDefaults.standard.synchronize()
                 KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
@@ -1046,7 +1020,7 @@ import Cocoa
             self?.recordIsPDFDocumentEdited()
         }
         
-        controller.selectionDidChange = { [weak self] selectedIndexs in
+        controller.selectionDidChange = { selectedIndexs in
             var indexSet = IndexSet()
             for indexPath in selectedIndexs {
                 indexSet.insert(indexPath.item)
@@ -1256,7 +1230,7 @@ import Cocoa
             NSSound.beep()
             return
         }
-        KMPasswordInputWindow.openWindow(window: self.view.window!, type: .owner, url: doc.documentURL) { [weak self] result, password in
+        _ = KMPasswordInputWindow.openWindow(window: self.view.window!, type: .owner, url: doc.documentURL) { [weak self] result, password in
             if result == .cancel { /// 关闭
                 return
             }
@@ -2071,7 +2045,6 @@ import Cocoa
         if interactionMode == .presentation {
             let backgroundColor = NSColor.black
             let level = UserDefaults.standard.bool(forKey: "SKUseNormalLevelForPresentationKey") ? NSWindow.Level.normal : NSWindow.Level.popUpMenu
-            let page = self.listView.currentPage()
             
             let wasInteractionMode = self.interactionMode
             if wasInteractionMode == .normal {

+ 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>