Просмотр исходного кода

【注释】Table注释绘制崩溃修复、Table属性面板补充

wanjun 1 год назад
Родитель
Сommit
2876ac1e99
12 измененных файлов с 105 добавлено и 65 удалено
  1. 0 2
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Table/KMTableAnnotation.swift
  2. 2 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h
  3. 4 3
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Extension.m
  4. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Form.swift
  5. 8 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m
  6. 37 15
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.swift
  7. 21 27
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.xib
  8. 13 10
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMPopUpButton.swift
  9. 10 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.swift
  10. 6 6
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift
  11. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift
  12. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

+ 0 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Table/KMTableAnnotation.swift

@@ -448,13 +448,11 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
 //        self.border.lineWidth = 0.8
         for _ in 0..<row {
             var rowArray = [KMTableCellData]()
-            
             for _ in 0..<column {
                 let cell = KMTableCellData()
                 rowArray.append(cell)
             }
             self.rowDataList.append(rowArray)
-
         }
         
         self.currentCell.row = -1

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h

@@ -83,6 +83,8 @@ typedef NS_ENUM(NSInteger, CAnnotationType) {
     CAnnotationTypeSignDot,
     CAnnotationTypeSignConfig,
     CAnnotationTypeSignDate,
+    
+    CAnnotationTypeTable,
 };
 
 typedef NS_ENUM(NSInteger, CToolMode) {

+ 4 - 3
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Extension.m

@@ -272,7 +272,7 @@ CGFloat DEFAULT_SNAPSHOT_HEIGHT = 200.0;
         [self addAnnotation:newAnnotation toPage:page];
         [[self undoManager] setActionName:NSLocalizedString(@"Add Note", @"Undo action name")];
         
-        [self setActiveAnnotations:@[newAnnotation]];
+        [self setActiveAnnotations:[NSMutableArray arrayWithArray:@[newAnnotation]]];
     } else NSBeep();
 }
 
@@ -330,9 +330,11 @@ CGFloat DEFAULT_SNAPSHOT_HEIGHT = 200.0;
         [table createFormWithRow:4 andColumn:4];
         [self addAnnotation:table toPage:page];
         [table registerUserName];
-        [self setActiveAnnotations:@[table]];
+        [self setActiveAnnotations:[NSMutableArray arrayWithArray:@[table]]];
         
         [table drawLineWithPoint:CGPointMake(NSMinX(bounds) + 10, NSMaxY(bounds) - 10)];
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"KMPDFViewActiveAnnotationDidChangeNotification" object:self];
+
         [[NSNotificationCenter defaultCenter] postNotificationName:KMPDFViewTableAnnotationDidChangeNotification object:self userInfo:@{@"point":[NSValue valueWithPoint:CGPointMake(NSMinX(bounds) + 10, NSMaxY(bounds) - 10)]}];
         [[self undoManager] setActionName:NSLocalizedString(@"Add Note", @"Undo action name")];
     } else {
@@ -406,7 +408,6 @@ CGFloat DEFAULT_SNAPSHOT_HEIGHT = 200.0;
         
         self.lastAddAnnotationPoint = bounds.origin;
         
-//        KMAnnotationStamp *newAnnotation = [[KMAnnotationStamp alloc] initSkimNoteWithBounds:bounds];
         KMAnnotationStamp *newAnnotation = [[KMAnnotationStamp alloc] initWithBounds:bounds];
         if (stamp.needExchangeFontSize) {
             newAnnotation.needExchangeFontSize = YES;

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Form.swift

@@ -64,7 +64,7 @@ extension CPDFListView {
                     if result == 0 {
                         self.remove(editAnnotation)
                     } else {
-                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "SKPDFViewActiveAnnotationDidChangeNotification"), object: self)
+                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "KMPDFViewActiveAnnotationDidChangeNotification"), object: self)
                     }
                 }
             } else if let buttonWidget = editAnnotation as? CPDFButtonWidgetAnnotation {
@@ -99,7 +99,7 @@ extension CPDFListView {
                     if result == 0 {
                         self.remove(editAnnotation)
                     } else {
-                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "SKPDFViewActiveAnnotationDidChangeNotification"), object: self)
+                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "KMPDFViewActiveAnnotationDidChangeNotification"), object: self)
                     }
                 }
             } else if let buttonWidget = editAnnotation as? CPDFButtonWidgetAnnotation {

+ 8 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m

@@ -206,6 +206,8 @@
         }
     } else if ([annotation isKindOfClass:[CPDFStampAnnotation class]]) {
         self.titleLabel.stringValue = NSLocalizedString(@"Stamp", nil);
+    } else if ([annotation isKindOfClass:[KMTableAnnotation class]]) {
+        self.titleLabel.stringValue = NSLocalizedString(@"Table", nil);
     } else {
         self.titleLabel.stringValue = [annotation type].typeName;
     }
@@ -338,6 +340,12 @@
         vc.annotationModel = annotationModel;
         self.propertiesBox.contentView = vc.view;
         self.contentViewController = vc;
+    } else if ([annotation isKindOfClass:[KMTableAnnotation class]]) {
+        KMAnnotationTableViewController *vc = [[KMAnnotationTableViewController alloc] init];
+        vc.pdfView = self.pdfView;
+        vc.annotationModel = annotationModel;
+        self.propertiesBox.contentView = vc.view;
+        self.contentViewController = vc;
     } else {
         KMGeneralAnnotationViewController *vc = [[KMGeneralAnnotationViewController alloc] init];
         vc.pdfView = self.pdfView;

+ 37 - 15
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.swift

@@ -18,10 +18,13 @@ class KMLineStyleButtonCell: NSButtonCell {
     }
 }
 
+@objcMembers
 class KMAnnotationTableViewController: NSViewController {
     var annotation: KMTableAnnotation?
     weak var pdfView: CPDFListView?
-    
+    var _annotationModel: CPDFAnnotationModel?
+    var _annotations: [KMTableAnnotation] = []
+
     var point: NSPoint = NSPoint.zero
 
     @IBOutlet weak var styleLabel: NSTextField!
@@ -69,15 +72,6 @@ class KMAnnotationTableViewController: NSViewController {
     var notUpdateBackgroundColor: Bool = false
     var lineStyleCount: Int = 0
     
-//    override init() {
-//        super.init()
-//        NotificationCenter.default.addObserver(self, selector: #selector(PDFViewTableAnnotationDidChangeNotification(_:)), name: Notification.Name(KMPDFViewTableAnnotationDidChangeNotification), object: nil)
-//    }
-    
-    required init?(coder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-    
     deinit {
         NotificationCenter.default.removeObserver(self)
         DistributedNotificationCenter.default().removeObserver(self)
@@ -226,7 +220,7 @@ class KMAnnotationTableViewController: NSViewController {
         self.headerPopUpButton.type = .table;
         
         self.footerPopUpButton.buttonImage = NSImage(named: KMImageNameUXIconPropertybarTableBottom)
-        self.headerPopUpButton.type = .table;
+        self.footerPopUpButton.type = .table;
 
         self.cellWidthTextField.backgroundColor = KMAppearance.Layout.l1Color()
         self.cellHeightTextField.backgroundColor = KMAppearance.Layout.l1Color()
@@ -253,12 +247,40 @@ class KMAnnotationTableViewController: NSViewController {
 
         self.updateViewColor()
 //
+        NotificationCenter.default.addObserver(self, selector: #selector(PDFViewTableAnnotationDidChangeNotification(_:)), name: Notification.Name("KMPDFViewTableAnnotationDidChangeNotification"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(controlTextDidEndEditingNotification(_:)), name: NSControl.textDidEndEditingNotification, object: self.cellWidthTextField)
         NotificationCenter.default.addObserver(self, selector: #selector(controlTextDidEndEditingNotification(_:)), name: NSControl.textDidEndEditingNotification, object: self.cellHeightTextField)
         DistributedNotificationCenter.default().addObserver(self, selector: #selector(themeChanged(_:)), name: Notification.Name(rawValue: "AppleInterfaceThemeChangedNotification"), object: nil)
     }
     
-    //MARK: Private Methods
+    // MARK: Set & Get
+    
+    var annotations: [KMTableAnnotation] {
+        set {
+            _annotations = newValue
+            
+            self.annotation = newValue.first
+        }
+        get {
+            return _annotations
+        }
+    }
+        
+    var annotationModel: CPDFAnnotationModel {
+        get {
+            return _annotationModel!
+        }
+        set {
+            _annotationModel = newValue
+            if _annotationModel?.annotations != nil {
+                if annotationModel.annotations.count > 0 {
+                    annotations = _annotationModel?.annotations as! [KMTableAnnotation]
+                }
+            }
+        }
+    }
+    
+    // MARK: Private Methods
     
     func reloadData(with point: NSPoint) {
         let rect = annotation!.isInCell(with: point)
@@ -377,7 +399,7 @@ class KMAnnotationTableViewController: NSViewController {
             table?.afreshDrawLine()
         }
 
-        self.pdfView?.needsDisplay = true
+        pdfView?.needsDisplay = true
     }
     
     func colorWithCGColor(_ cgColor: CGColor?) -> NSColor? {
@@ -519,7 +541,7 @@ class KMAnnotationTableViewController: NSViewController {
         if self.notUpdateBackgroundColor {
             self.notUpdateBackgroundColor = false
         }
-        self.pdfView!.needsDisplay = true
+        pdfView!.needsDisplay = true
     }
 
     @IBAction func titleEndTablePopUpButtonAction(_ sender: NSPopUpButton) {
@@ -669,7 +691,7 @@ class KMAnnotationTableViewController: NSViewController {
     //MARK: Notification
     
     @objc func PDFViewTableAnnotationDidChangeNotification(_ notification: Notification) {
-        if let pdfView = notification.object as? CPDFListView, pdfView == self.pdfView {
+        if let pdfView = notification.object as? CPDFListView, pdfView == pdfView {
             self.notUpdateBackgroundColor = true
             if let pointValue = notification.userInfo?["point"] as? NSValue {
                 let point = pointValue.pointValue

+ 21 - 27
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationTableViewController">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationTableViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="alternateColorBox" destination="zIF-Jm-IKq" id="csh-pO-60J"/>
                 <outlet property="alternateColorButton" destination="16a-dF-BSq" id="pKp-vc-196"/>
@@ -79,7 +79,7 @@
                                             <rect key="frame" x="0.0" y="0.0" width="309" height="108"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
-                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="RdL-Ai-FJT" customClass="KMBox">
+                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="RdL-Ai-FJT" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                     <rect key="frame" x="0.0" y="56" width="100" height="52"/>
                                                     <view key="contentView" id="Baa-mG-d7K">
                                                         <rect key="frame" x="0.0" y="0.0" width="100" height="52"/>
@@ -109,7 +109,7 @@
                                                         <constraint firstItem="hKw-5E-Ops" firstAttribute="centerX" secondItem="RdL-Ai-FJT" secondAttribute="centerX" id="aK2-pP-y6r"/>
                                                     </constraints>
                                                 </box>
-                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Yaq-ru-jPL" customClass="KMBox">
+                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Yaq-ru-jPL" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                     <rect key="frame" x="104" y="56" width="101" height="52"/>
                                                     <view key="contentView" id="gL7-ET-cC1">
                                                         <rect key="frame" x="0.0" y="0.0" width="101" height="52"/>
@@ -138,7 +138,7 @@
                                                         <constraint firstItem="eIX-DO-hHd" firstAttribute="centerX" secondItem="Yaq-ru-jPL" secondAttribute="centerX" id="gF1-5G-slt"/>
                                                     </constraints>
                                                 </box>
-                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="a2y-CU-aGm" customClass="KMBox">
+                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="a2y-CU-aGm" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                     <rect key="frame" x="209" y="56" width="100" height="52"/>
                                                     <view key="contentView" id="kjI-um-2AB">
                                                         <rect key="frame" x="0.0" y="0.0" width="100" height="52"/>
@@ -167,7 +167,7 @@
                                                         <constraint firstItem="Vkd-zT-7Pn" firstAttribute="centerX" secondItem="a2y-CU-aGm" secondAttribute="centerX" id="8zy-at-6eH"/>
                                                     </constraints>
                                                 </box>
-                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="SSS-5Y-bqp" customClass="KMBox">
+                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="SSS-5Y-bqp" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                     <rect key="frame" x="104" y="0.0" width="101" height="52"/>
                                                     <view key="contentView" id="0Xz-ve-r0E">
                                                         <rect key="frame" x="0.0" y="0.0" width="101" height="52"/>
@@ -196,7 +196,7 @@
                                                         <constraint firstItem="izd-C0-i9E" firstAttribute="centerX" secondItem="SSS-5Y-bqp" secondAttribute="centerX" id="egj-nr-dSH"/>
                                                     </constraints>
                                                 </box>
-                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="WMs-Gy-kCt" customClass="KMBox">
+                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="WMs-Gy-kCt" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                     <rect key="frame" x="209" y="0.0" width="100" height="52"/>
                                                     <view key="contentView" id="Upm-x1-GCg">
                                                         <rect key="frame" x="0.0" y="0.0" width="100" height="52"/>
@@ -225,7 +225,7 @@
                                                         <constraint firstItem="X7D-WK-dAr" firstAttribute="centerX" secondItem="WMs-Gy-kCt" secondAttribute="centerX" id="92k-D6-aHJ"/>
                                                     </constraints>
                                                 </box>
-                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="XhI-it-pUs" customClass="KMBox">
+                                                <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="XhI-it-pUs" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                     <rect key="frame" x="0.0" y="0.0" width="100" height="52"/>
                                                     <view key="contentView" id="NpU-HD-wXY">
                                                         <rect key="frame" x="0.0" y="0.0" width="100" height="52"/>
@@ -298,7 +298,7 @@
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="szc-wb-YTG">
                                 <rect key="frame" x="10" y="359" width="309" height="87"/>
                                 <subviews>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mzr-tF-8Sa" customClass="KMTextField">
+                                    <textField focusRingType="none" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mzr-tF-8Sa">
                                         <rect key="frame" x="221" y="29" width="70" height="20"/>
                                         <constraints>
                                             <constraint firstAttribute="width" constant="70" id="3Qo-Jr-bx3"/>
@@ -309,9 +309,6 @@
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
-                                        <connections>
-                                            <outlet property="_textFieldDelegate" destination="-2" id="nAs-BT-tsH"/>
-                                        </connections>
                                     </textField>
                                     <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" tag="201" translatesAutoresizingMaskIntoConstraints="NO" id="xVh-Kg-fjh">
                                         <rect key="frame" x="293" y="25" width="19" height="28"/>
@@ -320,7 +317,7 @@
                                             <action selector="stepperAction:" target="-2" id="gXB-FV-Je2"/>
                                         </connections>
                                     </stepper>
-                                    <textField focusRingType="none" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DJN-rH-heq" customClass="KMTextField">
+                                    <textField focusRingType="none" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DJN-rH-heq">
                                         <rect key="frame" x="221" y="1" width="70" height="20"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="20" id="BPP-id-KM4"/>
@@ -331,9 +328,6 @@
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
-                                        <connections>
-                                            <outlet property="_textFieldDelegate" destination="-2" id="10O-2S-kQl"/>
-                                        </connections>
                                     </textField>
                                     <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" tag="202" translatesAutoresizingMaskIntoConstraints="NO" id="Ugh-hX-9QX">
                                         <rect key="frame" x="293" y="-3" width="19" height="28"/>
@@ -393,7 +387,7 @@
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="GEF-sO-Ltx">
                                 <rect key="frame" x="10" y="285" width="309" height="64"/>
                                 <subviews>
-                                    <popUpButton tag="100" translatesAutoresizingMaskIntoConstraints="NO" id="CJd-EH-CDa" customClass="KMPopUpButton">
+                                    <popUpButton tag="100" translatesAutoresizingMaskIntoConstraints="NO" id="CJd-EH-CDa" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="0.0" width="100" height="24"/>
                                         <popUpButtonCell key="cell" type="squareTextured" title="0" bezelStyle="texturedSquare" alignment="left" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" selectedItem="H1Z-Ig-Dqf" id="ZyT-qK-jNM">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -416,7 +410,7 @@
                                             <action selector="titleEndTablePopUpButtonAction:" target="-2" id="RbC-11-kXp"/>
                                         </connections>
                                     </popUpButton>
-                                    <popUpButton tag="101" translatesAutoresizingMaskIntoConstraints="NO" id="tbd-4X-Om1" customClass="KMPopUpButton">
+                                    <popUpButton tag="101" translatesAutoresizingMaskIntoConstraints="NO" id="tbd-4X-Om1" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="104" y="0.0" width="101" height="24"/>
                                         <popUpButtonCell key="cell" type="squareTextured" title="0" bezelStyle="texturedSquare" alignment="left" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" selectedItem="BV0-Bl-FRq" id="nj9-nA-D2T">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -447,7 +441,7 @@
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <popUpButton tag="102" translatesAutoresizingMaskIntoConstraints="NO" id="0NY-DA-xWe" customClass="KMPopUpButton">
+                                    <popUpButton tag="102" translatesAutoresizingMaskIntoConstraints="NO" id="0NY-DA-xWe" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="209" y="0.0" width="100" height="24"/>
                                         <popUpButtonCell key="cell" type="squareTextured" title="0" bezelStyle="texturedSquare" alignment="left" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" selectedItem="If6-Dl-Sw6" id="IvP-oh-JwL">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -532,7 +526,7 @@
                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="rh4-gm-a6v" customClass="KMBox">
+                                    <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="rh4-gm-a6v" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="237" y="201" width="72" height="24"/>
                                         <view key="contentView" id="y3u-qq-Z68">
                                             <rect key="frame" x="1" y="1" width="70" height="22"/>
@@ -566,7 +560,7 @@
                                             <constraint firstAttribute="width" constant="72" id="hkY-cQ-jcU"/>
                                         </constraints>
                                     </box>
-                                    <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="iAo-Mk-RsN" customClass="KMBox">
+                                    <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="iAo-Mk-RsN" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="237" y="137" width="72" height="24"/>
                                         <view key="contentView" id="Qft-ZO-GKe">
                                             <rect key="frame" x="1" y="1" width="70" height="22"/>
@@ -600,7 +594,7 @@
                                             <constraint firstAttribute="width" constant="72" id="uX4-v0-Kdr"/>
                                         </constraints>
                                     </box>
-                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="PY0-aW-akF" customClass="KMPopUpButton">
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="PY0-aW-akF" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="232" y="75" width="77" height="24"/>
                                         <popUpButtonCell key="cell" type="squareTextured" title="Item 1" bezelStyle="texturedSquare" alignment="left" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" arrowPosition="noArrow" selectedItem="Cvb-6t-ubu" id="Czl-UK-jZd">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -634,7 +628,7 @@
                                             <constraint firstAttribute="height" constant="1" id="jfY-1E-rsk"/>
                                         </constraints>
                                     </box>
-                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wsz-na-ywf" customClass="KMButton" customModule="PDF_Master" customModuleProvider="target">
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wsz-na-ywf" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="10" width="97" height="24"/>
                                         <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="MNh-PS-pEB">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -647,7 +641,7 @@
                                             <action selector="lineTypeButtonAction:" target="-2" id="Lqx-SD-w5h"/>
                                         </connections>
                                     </button>
-                                    <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TIh-Hf-r3t" customClass="KMButton" customModule="PDF_Master" customModuleProvider="target">
+                                    <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TIh-Hf-r3t" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="106" y="10" width="97" height="24"/>
                                         <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="TS6-KL-atu">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -660,7 +654,7 @@
                                             <action selector="lineTypeButtonAction:" target="-2" id="Hn2-oH-Dwo"/>
                                         </connections>
                                     </button>
-                                    <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4Ia-e7-5At" customClass="KMButton" customModule="PDF_Master" customModuleProvider="target">
+                                    <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4Ia-e7-5At" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="212" y="10" width="97" height="24"/>
                                         <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="nla-v2-J1E">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -673,7 +667,7 @@
                                             <action selector="lineTypeButtonAction:" target="-2" id="AbG-Ey-2zo"/>
                                         </connections>
                                     </button>
-                                    <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="zIF-Jm-IKq" customClass="KMBox">
+                                    <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="zIF-Jm-IKq" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="237" y="169" width="72" height="24"/>
                                         <view key="contentView" id="7iq-dT-Wnn">
                                             <rect key="frame" x="1" y="1" width="70" height="22"/>

+ 13 - 10
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMPopUpButton.swift

@@ -61,19 +61,22 @@ import Cocoa
                 titleFloat += tableImg.size.width + 9.0
 
                 // 对选中的item设置勾选
-                if let selectedItem = selectedItem {
-                    for item in itemArray {
-                        (item).state = (item == selectedItem) ? .on : .off
+                for item in super.itemArray {
+                    if item == selectedItem {
+                        item.state = .on
+                    } else {
+                        item.state = .off
                     }
+                }
 
-                    var title = selectedItem.title
+                let title = selectedItem?.title as NSString? ?? ""
+                let titleSize = title.size(withAttributes: [NSAttributedString.Key.font: font as Any])
 
-                    // 获取字符串的宽度和高度
-                    let titleSize = title.size(withAttributes: [NSAttributedString.Key.font: font!]) 
-                    let titleY = frameSize.origin.y + (frameSize.size.height - titleSize.height) / 2
-                    let rectTitle = NSRect(origin: NSPoint(x: titleFloat, y: titleY), size: CGSize(width: titleSize.width, height: titleSize.height))
-                    title.draw(in: rectTitle, withAttributes: [.foregroundColor: KMAppearance.Layout.h0Color])
-                }
+                let titleY = frameSize.origin.y + (frameSize.size.height - titleSize.height) / 2
+                var rectTitle = frameSize
+                rectTitle.origin = NSPoint(x: titleFloat, y: titleY)
+                rectTitle.size.height = titleSize.height
+                title.draw(in: rectTitle, withAttributes: [NSAttributedString.Key.foregroundColor: KMAppearance.Layout.h0Color()])
             }
         case .arrowDown:
             image = NSImage(named: KMImageNameUXIconBtnArrowDown)

+ 10 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.swift

@@ -49,6 +49,8 @@ class KMRightSideViewController: NSViewController,CipherTextViewDelegate {
         emptyVC = KMRightSideEmptyVC.init(nibName: "KMRightSideEmptyVC", bundle: nil)
         contextBox.contentView = emptyVC.view
         self.emptyVC_link = KMLinkAnnotationPropertyEmptyController()
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(PDFViewActiveAnnotationDidChangeNotification(_:)), name: NSNotification.Name("KMPDFViewActiveAnnotationDidChangeNotification"), object: nil)
     }
     
     public func reloadDataWithPDFView(pdfView:CPDFListView,isShow:Bool) {
@@ -367,6 +369,14 @@ class KMRightSideViewController: NSViewController,CipherTextViewDelegate {
         }
     }
     
+    // MARK: NSNotification Methods
+    
+    @objc func PDFViewActiveAnnotationDidChangeNotification(_ notification: Notification) {
+        if let pdfView = notification.object as? CPDFListView {
+            reloadDataWithPDFView(pdfView: pdfView, isShow: true)
+        }
+    }
+
 }
 
 extension KMRightSideViewController: KMEditImagePropertyViewControllerDelegate {

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

@@ -230,12 +230,12 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
     
     var stampType: KMCreateStampType {
         set {
-//            if !IAPProductsManager.defaultManager().isAvailableAllFunction() {
-//                if stampType == .custom || stampType == .dynamic {
-//                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
-//                    return
-//                }
-//            }
+            if !IAPProductsManager.default().isAvailableAllFunction() {
+                if stampType == .custom || stampType == .dynamic {
+                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    return
+                }
+            }
 
             _stampType = newValue
             reloadCustomEmptyState(false)

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift

@@ -1505,6 +1505,7 @@ extension KMToolbarViewController {
         } else if identifier == KMAnnotationTableToolbarItemIdentifier {
             item?.image = NSImage(named: KMImageNameUXIconSubtoolbarMytoolsTable)
             item?.target = self
+            item?.btnTag = CAnnotationType.table.rawValue
             item?.titleName = NSLocalizedString("Table", comment: "")
             item?.toolTip = NSLocalizedString("Table", comment: "")
             item?.boxImagePosition = .imageOnly

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

@@ -3118,6 +3118,7 @@ extension KMMainViewController {
             return
         }
         listView.addAnnotationWithTable()
+        openRightPane()
     }
     
     func isDamageImage(_ image: NSImage, imagePath path: String) -> Bool {