Ver código fonte

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

tangchao 1 ano atrás
pai
commit
79012946b3
32 arquivos alterados com 979 adições e 34 exclusões
  1. 6 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Contents.json
  2. 6 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/Contents.json
  3. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_01.imageset/Contents.json
  4. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_01.imageset/form_set_ic_01.pdf
  5. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_02.imageset/Contents.json
  6. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_02.imageset/form_set_ic_02.pdf
  7. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_03.imageset/Contents.json
  8. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_03.imageset/form_set_ic_03.pdf
  9. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_01.imageset/Contents.json
  10. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_01.imageset/table_ic_01.pdf
  11. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_02.imageset/Contents.json
  12. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_02.imageset/table_ic_02.pdf
  13. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_03.imageset/Contents.json
  14. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_03.imageset/table_ic_03.pdf
  15. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_04.imageset/Contents.json
  16. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_04.imageset/table_ic_04.pdf
  17. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_05.imageset/Contents.json
  18. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_05.imageset/table_ic_05.pdf
  19. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_06.imageset/Contents.json
  20. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_06.imageset/table_ic_06.pdf
  21. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_add_hang.imageset/Contents.json
  22. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_add_hang.imageset/table_ic_add_hang.pdf
  23. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_add_lie.imageset/Contents.json
  24. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_add_lie.imageset/table_ic_add_lie.pdf
  25. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_move.imageset/Contents.json
  26. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_move.imageset/table_ic_move.pdf
  27. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_size.imageset/Contents.json
  28. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_size.imageset/table_ic_size.pdf
  29. 2 3
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Table/KMTableAnnotation.swift
  30. 746 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.swift
  31. 4 14
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.xib
  32. 59 17
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMPopUpButton.swift

+ 6 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 6 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_01.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_01.imageset/form_set_ic_01.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_02.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_02.imageset/form_set_ic_02.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_03.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/form_set_ic_03.imageset/form_set_ic_03.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_01.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_01.imageset/table_ic_01.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_02.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_02.imageset/table_ic_02.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_03.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_03.imageset/table_ic_03.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_04.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_04.imageset/table_ic_04.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_05.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_05.imageset/table_ic_05.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_06.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_06.imageset/table_ic_06.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_add_hang.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_add_hang.imageset/table_ic_add_hang.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_add_lie.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_add_lie.imageset/table_ic_add_lie.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_move.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_move.imageset/table_ic_move.pdf


+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_size.imageset/Contents.json

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Annotation/Table/table_ic_size.imageset/table_ic_size.pdf


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

@@ -858,7 +858,6 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         guard index >= 0, columnNumber > index else {
             return
         }
-
         let verticalLines = self.verticalLines
         
         let rect1 = self.verticalLines[index].bounds
@@ -920,8 +919,8 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         self.writeFormDataToContents()
     }
     
-    func insertColumn(at index: Int, before indexBefore: Int, withLineJoinStyle lineJoinStyle: NSBezierPath.LineJoinStyle) {
-        guard (0 <= index && indexBefore >= 0 && indexBefore < columnNumber) else {
+    func insertColumn(atIndexBefore index: Int, withLineJoinStyle lineJoinStyle: NSBezierPath.LineJoinStyle) {
+        guard (0 <= index && index < columnNumber) else {
             return
         }
 

+ 746 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.swift

@@ -7,13 +7,759 @@
 
 import Cocoa
 
+class KMLineStyleButtonCell: NSButtonCell {
+    override func highlight(_ flag: Bool, withFrame cellFrame: NSRect, in controlView: NSView) {
+        if flag {
+            print("111")
+            controlView.layer?.backgroundColor = KMAppearance.Status.selColor().cgColor
+        } else {
+            print("111")
+        }
+    }
+}
+
 class KMAnnotationTableViewController: NSViewController {
     var annotation: KMTableAnnotation?
     weak var pdfView: CPDFListView?
+    
+    var point: NSPoint = NSPoint.zero
+
+    @IBOutlet weak var styleLabel: NSTextField!
+    @IBOutlet weak var styleBox0: KMBox!
+    @IBOutlet weak var styleBox1: KMBox!
+    @IBOutlet weak var styleBox2: KMBox!
+    @IBOutlet weak var styleBox3: KMBox!
+    @IBOutlet weak var styleBox4: KMBox!
+    @IBOutlet weak var styleBox5: KMBox!
+
+    @IBOutlet weak var cellSizeLabel: NSTextField!
+    @IBOutlet weak var cellWidthLabel: NSTextField!
+    @IBOutlet weak var cellHeightLabel: NSTextField!
+    @IBOutlet weak var cellWidthTextField: NSTextField!
+    @IBOutlet weak var cellHeightTextField: NSTextField!
+    @IBOutlet weak var cellWidthStepper: NSStepper!
+    @IBOutlet weak var cellHeightStepper: NSStepper!
+
+    @IBOutlet weak var titleEndTableLabel: NSTextField!
+    @IBOutlet weak var sidebarPopUpButton: KMPopUpButton!
+    @IBOutlet weak var headerPopUpButton: KMPopUpButton!
+    @IBOutlet weak var footerPopUpButton: KMPopUpButton!
+
+    @IBOutlet weak var bordersAndColorsLabel: NSTextField!
+    @IBOutlet weak var backgroundColorLabel: NSTextField!
+    @IBOutlet weak var backgroudColorBox: KMBox!
+    @IBOutlet weak var backgrourdColorView: NSView!
+    @IBOutlet weak var borderColorLabel: NSTextField!
+    @IBOutlet weak var borderColorBox: KMBox!
+    @IBOutlet weak var borderColorView: NSView!
+    @IBOutlet weak var widthLabel: NSTextField!
+    @IBOutlet weak var widthSlider: NSSlider!
+    @IBOutlet weak var widthPopUpButton: KMPopUpButton!
+    @IBOutlet weak var lineStyleLabel: NSTextField!
+    @IBOutlet weak var lineStyleButton: KMButton!
+    @IBOutlet weak var dottedLineStyleButton: KMButton!
+    @IBOutlet weak var rightArrowStyleButton: KMButton!
+
+    @IBOutlet weak var alternateColorButton: NSButton!
+    @IBOutlet weak var alternateColorLabel: NSTextField!
+    @IBOutlet weak var alternateColorBox: KMBox!
+    @IBOutlet weak var alternateColorView: NSView!
+
+    var backgroudColorBoxIsEnabled: Bool = false
+    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)
+    }
 
     override func viewDidLoad() {
         super.viewDidLoad()
         // Do view setup here.
+        
+        self.styleLabel.stringValue = NSLocalizedString("Table Styles", comment: "")
+        self.styleLabel.textColor = KMAppearance.Layout.h0Color()
+        self.cellSizeLabel.stringValue = NSLocalizedString("Cell Size", comment: "")
+        self.cellSizeLabel.textColor = KMAppearance.Layout.h0Color()
+        self.cellWidthLabel.stringValue = "\(NSLocalizedString("Cell Width", comment: ""))(cm)"
+        self.cellWidthLabel.toolTip = "\(NSLocalizedString("Cell Width", comment: ""))(cm)"
+        self.cellWidthLabel.allowsExpansionToolTips = true
+        self.cellWidthLabel.textColor = KMAppearance.Layout.h1Color()
+        self.cellHeightLabel.stringValue = "\(NSLocalizedString("Cell Height", comment: ""))(cm)"
+        self.cellHeightLabel.toolTip = "\(NSLocalizedString("Cell Height", comment: ""))(cm)"
+        self.cellHeightLabel.allowsExpansionToolTips = true
+        self.cellHeightLabel.textColor = KMAppearance.Layout.h1Color()
+        self.titleEndTableLabel.stringValue = NSLocalizedString("Headers & Footers", comment: "")
+        self.titleEndTableLabel.textColor = KMAppearance.Layout.h0Color()
+        self.bordersAndColorsLabel.stringValue = NSLocalizedString("Borders & Colors", comment: "")
+        self.bordersAndColorsLabel.textColor = KMAppearance.Layout.h0Color()
+        self.backgroundColorLabel.stringValue = NSLocalizedString("Background Color", comment: "")
+        self.backgroundColorLabel.textColor = KMAppearance.Layout.h1Color()
+        self.borderColorLabel.stringValue = NSLocalizedString("Border Color", comment: "")
+        self.borderColorLabel.textColor = KMAppearance.Layout.h1Color()
+        self.widthLabel.stringValue = NSLocalizedString("Line Width", comment: "")
+        self.widthLabel.textColor = KMAppearance.Layout.h1Color()
+        self.lineStyleLabel.stringValue = NSLocalizedString("Line Style", comment: "")
+        self.lineStyleLabel.textColor = KMAppearance.Layout.h1Color()
+
+        self.alternateColorLabel.stringValue = NSLocalizedString("Alternate", comment: "")
+        self.alternateColorLabel.textColor = KMAppearance.Layout.h0Color()
+
+        let styleBoxArr: [KMBox] = [self.styleBox0, self.styleBox1, self.styleBox2, self.styleBox3, self.styleBox4, self.styleBox5]
+        for box in styleBoxArr {
+            box.moveCallback = { mouseEntered, mouseBox in
+                if mouseEntered {
+                    mouseBox.fillColor = KMAppearance.Status.selColor()
+                } else {
+                    mouseBox.fillColor = NSColor.clear
+                }
+            }
+        }
+
+        self.widthPopUpButton.removeAllItems()
+        self.widthPopUpButton.addItems(withTitles: ["0.1 pt","0.2 pt","0.3 pt","0.4 pt","0.5 pt","0.6 pt","0.7 pt","0.8 pt","0.9 pt","1.0 pt","1.1 pt","1.2 pt","1.3 pt","1.4 pt","1.5 pt","1.6 pt","1.7 pt","1.8 pt","1.9 pt","2.0 pt","2.1 pt","2.2 pt","2.3 pt","2.4 pt","2.5 pt","2.6 pt","2.7 pt","2.8 pt","2.9 pt","3.0 pt"])
+        self.widthPopUpButton.type = .arrowDown
+
+        self.backgroudColorBox.borderWidth = 1.0
+        self.backgroudColorBox.borderColor = KMAppearance.Interactive.s0Color()
+        self.backgroudColorBox.fillColor = KMAppearance.Layout.l1Color()
+        self.backgroudColorBox.cornerRadius = 1.0
+        self.backgroudColorBox.downCallback = {downEntered, mouseBox, event in
+            if downEntered {
+                if self.backgroudColorBoxIsEnabled {
+                    NSColorPanel.shared.setTarget(self)
+                    NSColorPanel.shared.setAction(#selector(self.backgroudColorPanelColorDidChange(_:)))
+                    NSColorPanel.shared.orderFront(nil)
+                } else {
+                    NSSound.beep()
+                }
+            }
+        }
+        self.backgrourdColorView.wantsLayer = true
+        self.borderColorView.wantsLayer = true
+        self.alternateColorView.wantsLayer = true
+        self.backgrourdColorView.layer?.backgroundColor = NSColor.white.cgColor
+        self.backgrourdColorView.layer?.borderWidth = 0.5
+        self.borderColorView.layer?.borderWidth = 0.5
+        self.alternateColorView.layer?.borderWidth = 0.5
+        
+        self.backgrourdColorView.layer?.borderColor = KMAppearance.Interactive.s0Color().cgColor
+        self.borderColorView.layer?.borderColor = KMAppearance.Interactive.s0Color().cgColor
+        self.alternateColorView.layer?.borderColor = KMAppearance.Interactive.s0Color().cgColor
+        self.borderColorBox.borderWidth = 1.0
+        self.borderColorBox.borderColor = KMAppearance.Interactive.s0Color()
+        self.borderColorBox.fillColor = KMAppearance.Layout.l1Color()
+        self.borderColorBox.cornerRadius = 1.0
+        self.borderColorBox.downCallback = { downEntered, mouseBox, event in
+            if downEntered {
+                NSColorPanel.shared.setTarget(self)
+                NSColorPanel.shared.setAction(#selector(self.borderColorPanelColorDidChange(_:)))
+                NSColorPanel.shared.orderFront(nil)
+            }
+        }
+        self.alternateColorBox.borderWidth = 1.0
+        self.alternateColorBox.borderColor = KMAppearance.Interactive.s0Color()
+        self.alternateColorBox.fillColor = KMAppearance.Layout.l1Color()
+        self.alternateColorBox.cornerRadius = 1.0
+        self.alternateColorBox.downCallback = { downEntered, mouseBox, event in
+            if downEntered {
+                NSColorPanel.shared.setTarget(self)
+                NSColorPanel.shared.setAction(#selector(self.alternateColorPanelColorDidChange(_:)))
+                NSColorPanel.shared.orderFront(nil)
+            }
+        }
+
+        self.lineStyleButton.image = self.borderStyleSolid(isSelect: false)
+        self.lineStyleButton.wantsLayer = true
+        self.dottedLineStyleButton.image = self.borderStyleDashed(isSelect: false)
+        self.dottedLineStyleButton.wantsLayer = true
+        self.rightArrowStyleButton.image = self.borderStyleDashed(isSelect: false)
+        self.rightArrowStyleButton.wantsLayer = true
+        let buttonArray: [KMButton] = [self.lineStyleButton, self.dottedLineStyleButton, self.rightArrowStyleButton]
+        for button in buttonArray {
+            button.layer?.borderColor = KMAppearance.Interactive.s0Color().cgColor
+            button.layer?.borderWidth = 1.0
+            button.layer?.cornerRadius = 1.0
+            if button.tag == self.lineStyleCount {
+                button.layer?.backgroundColor = KMAppearance.Status.selColor().cgColor
+            } else {
+                button.layer?.backgroundColor = KMAppearance.Layout.l1Color().cgColor
+            }
+            button.mouseMoveCallback = {[weak self] mouseEntered in
+                if button.tag == self?.lineStyleCount {
+                    return
+                }
+                if mouseEntered {
+                    button.layer?.backgroundColor = KMAppearance.Status.selColor().cgColor
+                    button.layer?.borderWidth = 0.0
+                    if button.tag == 0 {
+                        self?.lineStyleButton.image = self?.borderStyleSolid(isSelect: true)
+                    } else if button.tag == 1 {
+                        self?.dottedLineStyleButton.image = self?.borderStyleDashed(isSelect: true)
+                    }
+                } else {
+                    button.layer?.backgroundColor = KMAppearance.Layout.l1Color().cgColor
+                    button.layer?.borderWidth = 1.0
+                    if button.tag == 0 {
+                        self?.lineStyleButton.image = self?.borderStyleSolid(isSelect: false)
+                    } else {
+                        self?.dottedLineStyleButton.image = self?.borderStyleDashed(isSelect: false)
+                    }
+                }
+            }
+        }
+        self.rightArrowStyleButton.isHidden = true
+        
+        self.sidebarPopUpButton.buttonImage = NSImage(named: KMImageNameUXIconPropertybarTableTitleLeft)
+        self.sidebarPopUpButton.type = .table
+        self.headerPopUpButton.buttonImage = NSImage(named: KMImageNameUXIconPropertybarTableTitleAbove)
+        self.headerPopUpButton.type = .table;
+        
+        self.footerPopUpButton.buttonImage = NSImage(named: KMImageNameUXIconPropertybarTableBottom)
+        self.headerPopUpButton.type = .table;
+
+        self.cellWidthTextField.backgroundColor = KMAppearance.Layout.l1Color()
+        self.cellHeightTextField.backgroundColor = KMAppearance.Layout.l1Color()
+
+        self.cellWidthTextField.wantsLayer = true
+        self.cellHeightTextField.wantsLayer = true
+        self.sidebarPopUpButton.wantsLayer = true
+        self.widthPopUpButton.wantsLayer = true
+        self.headerPopUpButton.wantsLayer = true
+        self.footerPopUpButton.wantsLayer = true
+
+        self.cellWidthTextField.layer!.borderWidth = 1.0
+        self.cellHeightTextField.layer?.borderWidth = 1.0
+        self.sidebarPopUpButton.layer!.borderWidth = 1.0
+        self.widthPopUpButton.layer!.borderWidth = 1.0
+        self.headerPopUpButton.layer!.borderWidth = 1.0
+        self.footerPopUpButton.layer!.borderWidth = 1.0
+        
+        self.cellWidthTextField.layer?.cornerRadius = 1.0
+        self.cellHeightTextField.layer?.cornerRadius = 1.0
+        self.sidebarPopUpButton.layer?.cornerRadius = 1.0
+        self.widthPopUpButton.layer?.cornerRadius = 1.0
+        self.headerPopUpButton.layer?.cornerRadius = 1.0
+
+        self.updateViewColor()
+//
+        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
+    
+    func reloadData(with point: NSPoint) {
+        let rect = annotation!.isInCell(with: point)
+        if !NSEqualRects(rect, NSRectFromCGRect(CGRect.zero)) {
+            var color = annotation?.getCellData(row: annotation!.currentCell.row, column: annotation!.currentCell.column).backgroundColor
+            
+            var maxWidth: CGFloat = 10
+            let minHeight: CGFloat = 10
+            
+            if annotation!.currentCell.column == annotation!.columnNumber - 1 {
+                maxWidth = CGFloat(MAXFLOAT)
+            } else {
+                if let rect1 = annotation?.getCellBounds(row: annotation!.currentCell.row, column: annotation!.currentCell.column + 1) {
+                    maxWidth = rect1.size.width + rect.size.width - 10
+                }
+            }
+            
+            cellWidthStepper.maxValue = Double(maxWidth)
+            cellHeightStepper.minValue = Double(minHeight)
+            
+            if color == nil {
+                color = NSColor(deviceRed: 1, green: 1, blue: 1, alpha: 1)
+            }
+            
+            backgroudColorBoxIsEnabled = true
+            backgrourdColorView.wantsLayer = true
+            backgrourdColorView.layer?.backgroundColor = color!.cgColor
+        } else {
+            backgroudColorBoxIsEnabled = false
+            backgrourdColorView.wantsLayer = true
+            backgrourdColorView.layer?.backgroundColor = NSColor.white.cgColor
+        }
+        
+        self.setCell(width: rect.size.width, height: rect.size.height)
+        widthSlider.floatValue = Float((annotation?.border.lineWidth)!)
+        
+        let sliderString = String(format: "%.1f pt", (annotation?.border.lineWidth)!)
+        
+        if widthPopUpButton.itemTitles.contains(sliderString) {
+            if let index = widthPopUpButton.itemTitles.firstIndex(of: sliderString) {
+                widthPopUpButton.selectItem(at: index)
+            }
+        }
+        
+        widthSlider.toolTip = sliderString
+        
+        lineStyleCount = 0
+        
+        if annotation?.border.style == .solid {
+            lineStyleButton.layer?.backgroundColor = KMAppearance.Status.selColor().cgColor
+            lineStyleButton.layer?.borderWidth = 0.0
+            lineStyleButton.image = borderStyleSolid(isSelect: true)
+            dottedLineStyleButton.layer?.backgroundColor = KMAppearance.Layout.l1Color().cgColor
+            dottedLineStyleButton.layer?.borderWidth = 1.0
+            dottedLineStyleButton.image = borderStyleSolid(isSelect: false)
+        } else if annotation?.border.style == .dashed {
+            dottedLineStyleButton.layer?.backgroundColor = KMAppearance.Status.selColor().cgColor
+            dottedLineStyleButton.layer?.borderWidth = 0.0
+            dottedLineStyleButton.image = borderStyleDashed(isSelect: true)
+            
+            lineStyleButton.layer?.backgroundColor = KMAppearance.Layout.l1Color().cgColor
+            lineStyleButton.layer?.borderWidth = 1.0
+            lineStyleButton.image = borderStyleSolid(isSelect: false)
+            
+            lineStyleCount = 1
+        }
+        
+        borderColorView.wantsLayer = true
+        borderColorView.layer?.backgroundColor = annotation?.color.cgColor
+        
+        if let alternateColor = annotation?.alternatingColor {
+            alternateColorView.wantsLayer = true
+            alternateColorView.layer?.backgroundColor = alternateColor.cgColor
+        }
+        
+        alternateColorButton.state = annotation!.isAlternateColor ? .on : .off
+        
+        sidebarPopUpButton.selectItem(at: (annotation?.sidebarCount())!)
+        headerPopUpButton.selectItem(at: (annotation?.headerCount())!)
+        footerPopUpButton.selectItem(at: (annotation?.footerCount())!)
+    }
+
+    func setCell(width cellWidth: CGFloat, height cellHeight: CGFloat) {
+        if cellWidth == 0 && cellHeight == 0 {
+            cellWidthStepper.isEnabled = false
+            cellHeightStepper.isEnabled = false
+            cellWidthTextField.isEnabled = false
+            cellHeightTextField.isEnabled = false
+        } else {
+            cellWidthStepper.isEnabled = true
+            cellHeightStepper.isEnabled = true
+            cellWidthTextField.isEnabled = true
+            cellHeightTextField.isEnabled = true
+        }
+        
+        let widthText = String(format: "%0.2f", cellWidth * 0.04)
+        cellWidthTextField.stringValue = widthText
+        cellWidthStepper.doubleValue = Double(cellWidth)
+        
+        let heightText = String(format: "%0.2f", cellHeight * 0.04)
+        cellHeightTextField.stringValue = heightText
+        cellHeightStepper.doubleValue = Double(cellHeight)
+    }
+            
+    func reloadDataStepper(_ stepper: NSStepper) {
+        let table = self.annotation
+        if (table?.currentCell.row)! >= 0 && (table?.currentCell.column)! >= 0 {
+            let row = table?.currentCell.row
+            let column = table?.currentCell.column
+            if stepper == cellWidthStepper {
+                table?.moveVerticalLineOfIndex(column!+1, withDistance: self.cellWidthStepper.doubleValue - (table?.getCellBounds(row: row!, column: column!).size.width)!)
+            } else {
+                table?.moveCrossLineOfIndex(table!.rowNumber - row! - 1, withDistance: (table?.getCellBounds(row: row!, column: column!).size.height)! - self.cellHeightStepper.doubleValue)
+                table?.setOldRowHeights()
+            }
+            table?.afreshDrawLine()
+        }
+
+        self.pdfView?.needsDisplay = true
+    }
+    
+    func colorWithCGColor(_ cgColor: CGColor?) -> NSColor? {
+        guard let cgColor = cgColor else { return nil }
+        return NSColor(cgColor: cgColor)
+    }
+    
+    func borderStyleSolid(isSelect: Bool) -> NSImage {
+        let size = NSSize(width: 49.0, height: 12.0)
+        
+        let image = NSImage.image(with: size) { rect in
+            let path = NSBezierPath(rect: NSRect(x: 15.0, y: 5.0, width: 20.0, height: 1.0))
+            path.lineWidth = 2.0
+            if isSelect {
+                KMAppearance.KM_273C62_ColorDarkChanged02().setStroke()
+            } else {
+                KMAppearance.Layout.h2Color().setStroke()
+            }
+            path.stroke()
+            return true
+        }
+        return image
+    }
+            
+    func borderStyleDashed(isSelect: Bool) -> NSImage {
+        let size = NSSize(width: 49.0, height: 12.0)
+        let image = NSImage(size: size) { rect in
+            let path = NSBezierPath()
+            path.move(to: NSPoint(x: 15.0, y: 5.0))
+            path.line(to: NSPoint(x: 19.0, y: 5.0))
+            path.move(to: NSPoint(x: 23.0, y: 5.0))
+            path.line(to: NSPoint(x: 27.0, y: 5.0))
+            path.move(to: NSPoint(x: 31.0, y: 5.0))
+            path.line(to: NSPoint(x: 35.0, y: 5.0))
+            path.lineWidth = 2.0
+            if isSelect {
+                KMAppearance.KM_273C62_ColorDarkChanged02().setStroke()
+            } else {
+                KMAppearance.Layout.h2Color().setStroke()
+            }
+            path.stroke()
+            return true
+        }
+        return image!
+    }
+    
+    //MARK: Button Actions
+            
+    @IBAction func styleButtonAction(_ sender: NSButton) {
+        var tableStyle: KMTableStyle = .Default
+        if let button = sender as? NSButton {
+            switch button.tag {
+            case 300:
+                tableStyle = .Default
+            case 301:
+                tableStyle = .Style1
+            case 302:
+                tableStyle = .Style2
+            case 303:
+                tableStyle = .Style3
+            case 304:
+                tableStyle = .Style4
+            case 305:
+                tableStyle = .Style5
+            default:
+                break
+            }
+        }
+        
+        annotation?.changeTableStyle(tableStyle)
+        reloadData(with: point)
+        pdfView?.needsDisplay = true
+    }
+    
+    @IBAction func stepperAction(_ sender: Any) {
+        guard let stepper = sender as? NSStepper else {
+            return
+        }
+
+        var text: String
+
+        switch stepper.tag {
+        case 201:
+            text = String(format: "%0.2f", self.cellWidthStepper.doubleValue * 0.04)
+            self.cellWidthTextField.stringValue = text
+            self.reloadDataStepper(self.cellWidthStepper)
+        case 202:
+            text = String(format: "%0.2f", self.cellHeightStepper.doubleValue * 0.04)
+            self.cellHeightTextField.stringValue = text
+            self.reloadDataStepper(self.cellHeightStepper)
+        default:
+            break
+        }
+    }
+    
+    @IBAction func colorWellAction(_ sender: Any) {
+        guard let table = self.annotation else {
+            return
+        }
+        
+//        table.border.lineWidth = CGFloat(self.widthSlider.floatValue)
+        let sliderString = String(format: "%.1f pt", self.widthSlider.floatValue)
+        if widthPopUpButton.itemTitles.contains(sliderString) {
+            if let index = self.widthPopUpButton.itemTitles.firstIndex(of: sliderString) {
+                self.widthPopUpButton.selectItem(at: index)
+            }
+        }
+        table.color = self.colorWithCGColor(self.borderColorView.layer!.backgroundColor)
+        
+        if table.currentCell.row >= 0 && table.currentCell.column >= 0 {
+            if self.backgroudColorBoxIsEnabled {
+                if !self.notUpdateBackgroundColor {
+                    table.getCellData(row: table.currentCell.row, column: table.currentCell.column).backgroundColor = self.colorWithCGColor(self.backgrourdColorView.layer?.backgroundColor)
+                } else {
+                    var color = self.annotation?.getCellData(row: self.annotation!.currentCell.row, column: self.annotation!.currentCell.column).backgroundColor
+                    if color == nil {
+                        color = NSColor(deviceRed: 1, green: 1, blue: 1, alpha: 1)
+                    }
+                    self.backgrourdColorView.layer?.backgroundColor = color?.cgColor
+                }
+            }
+        }
+        
+        table.isAlternateColor = self.alternateColorButton.state == .on
+        table.alternatingColor = self.colorWithCGColor(self.alternateColorView.layer!.backgroundColor)
+        table.writeFormDataToContents()
+        
+        if let tableInk = table as? CPDFAnnotation {
+            if lineStyleCount == 1 {
+                let lineType = tableInk.border.dashPattern ?? []
+                if lineType.count == 0 {
+                    let number = NSNumber(value: Float(4))
+                    tableInk.setDashPattern([number])
+                }
+            }
+            tableInk.setBorderStyle(CPDFBorderStyle(rawValue: lineStyleCount) ?? .solid)
+        }
+        
+        if self.notUpdateBackgroundColor {
+            self.notUpdateBackgroundColor = false
+        }
+        self.pdfView!.needsDisplay = true
+    }
+
+    @IBAction func titleEndTablePopUpButtonAction(_ sender: NSPopUpButton) {
+        guard let table = self.annotation else {
+            return
+        }
+        
+        let bounds = self.annotation!.bounds
+        guard let popButton = sender as? NSPopUpButton else {
+            return
+        }
+        
+        switch popButton.tag {
+        case 100:
+            let count = (popButton.titleOfSelectedItem as NSString?)?.integerValue ?? 0 - table.sidebarCount()
+            if count > 0 {
+                for _ in 0..<count {
+                    table.insertColumn(atIndexBefore: 0, withLineJoinStyle: .round)
+                }
+            } else if count < 0 {
+                for _ in count..<0 {
+                    table.removeColumn(at: 0)
+                }
+            }
+            table.bounds.origin.x -= (bounds.size.width - table.bounds.size.width)
+        case 101:
+            let count = (popButton.titleOfSelectedItem as NSString?)?.integerValue ?? 0 - table.headerCount()
+            if count > 0 {
+                for _ in 0..<count {
+                    table.insertColumn(atIndexBefore: 0, withLineJoinStyle: .round)
+                }
+            } else if count < 0 {
+                for _ in count..<0 {
+                    table.removeRow(at: 0)
+                }
+            }
+            table.bounds.origin.y -= (table.bounds.size.height - bounds.size.height)
+        case 102:
+            let count = (popButton.titleOfSelectedItem as NSString?)?.integerValue ?? 0 - table.footerCount()
+            if count > 0 {
+                for _ in 0..<count {
+                    table.insertColumn(atIndexBefore: table.rowNumber - 1, withLineJoinStyle: .bevel)
+                }
+            } else if count < 0 {
+                for _ in count..<0 {
+                    table.removeRowBehindLine(at: table.rowNumber - 1)
+                }
+            }
+        default:
+            break
+        }
+        
+        table.drawLine(point: self.point)
+        reloadData(with: self.point)
+        pdfView!.needsDisplay = true
+    }
+    
+    @IBAction func widthPopUpButtonAction(_ sender: NSPopUpButton) {
+        if let widthString = sender.titleOfSelectedItem, let width = Float(widthString.prefix(3)) {
+            widthSlider.floatValue = width
+        }
+        
+        colorWellAction(sender)
+    }
+
+    @objc func backgroudColorPanelColorDidChange(_ sender: Any) {
+        guard NSColorPanel.sharedColorPanelExists, NSColorPanel.shared.isVisible else {
+            return
+        }
+        
+        if let color = (sender as? NSColorPanel)?.color {
+            var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
+//            if let rgbColor = color.usingColorSpace(NSColorSpace.sRGB) {
+//                rgbColor.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
+//            }
+            color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)?.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
+
+            backgrourdColorView.wantsLayer = true
+            backgrourdColorView.layer?.backgroundColor = color.cgColor
+            
+            colorWellAction(sender)
+        }
+    }
+    
+    @objc func borderColorPanelColorDidChange(_ sender: Any) {
+        guard NSColorPanel.sharedColorPanelExists, NSColorPanel.shared.isVisible else {
+            return
+        }
+
+        if let color = (sender as? NSColorPanel)?.color {
+            var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
+            color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)?.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
+
+            borderColorView.wantsLayer = true
+            borderColorView.layer?.backgroundColor = color.cgColor
+
+            colorWellAction(sender)
+        }
     }
+
+    @objc func alternateColorPanelColorDidChange(_ sender: Any) {
+        if let color = (sender as? NSColorPanel)?.color {
+            var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
+            color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)?.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
+
+            alternateColorView.wantsLayer = true
+            alternateColorView.layer?.backgroundColor = color.cgColor
+
+            colorWellAction(sender)
+        }
+    }
+    
+    @IBAction func lineTypeButtonAction(_ sender: NSButton) {
+        let tag = sender.tag
+        
+        switch tag {
+        case 0:
+            lineStyleCount = 0
+            lineStyleButton.layer?.backgroundColor = KMAppearance.Status.selColor().cgColor
+            lineStyleButton.layer?.borderWidth = 0.0
+            dottedLineStyleButton.layer?.backgroundColor = KMAppearance.Layout.l1Color().cgColor
+            dottedLineStyleButton.layer?.borderWidth = 1.0
+            
+            lineStyleButton.image = borderStyleSolid(isSelect: true)
+            dottedLineStyleButton.image = borderStyleDashed(isSelect: false)
+            colorWellAction(sender)
+            
+        case 1:
+            lineStyleCount = 1
+            lineStyleButton.layer?.backgroundColor = KMAppearance.Layout.l1Color().cgColor
+            lineStyleButton.layer?.borderWidth = 1.0
+            dottedLineStyleButton.layer?.backgroundColor = KMAppearance.Status.selColor().cgColor
+            dottedLineStyleButton.layer?.borderWidth = 0.0
+            
+            lineStyleButton.image = borderStyleSolid(isSelect: false)
+            dottedLineStyleButton.image = borderStyleDashed(isSelect: true)
+            colorWellAction(sender)
+            
+        case 3:
+            break
+            
+        default:
+            break
+        }
+    }
+    
+    //MARK: Notification
     
+    @objc func PDFViewTableAnnotationDidChangeNotification(_ notification: Notification) {
+        if let pdfView = notification.object as? CPDFListView, pdfView == self.pdfView {
+            self.notUpdateBackgroundColor = true
+            if let pointValue = notification.userInfo?["point"] as? NSValue {
+                let point = pointValue.pointValue
+                self.point = point
+                if NSColorPanel.sharedColorPanelExists {
+                    NSColorPanel.shared.close()
+                }
+                self.reloadData(with: point)
+            }
+        }
+    }
+    
+    @objc func controlTextDidEndEditingNotification(_ notification: Notification) {
+        guard let textField = notification.object as? NSTextField else {
+            return
+        }
+
+        if textField == cellWidthTextField {
+            let width = (textField.stringValue as NSString).doubleValue / 0.04
+            if fabs(width - cellWidthStepper.doubleValue) < 0.01 {
+                return
+            }
+
+            if width <= 0 {
+                let text = String(format: "%0.2f", cellWidthStepper.doubleValue * 0.04)
+                cellWidthTextField.stringValue = text
+            } else if width > 0 && width < cellWidthStepper.minValue {
+                let text = String(format: "%0.2f", cellWidthStepper.minValue * 0.04)
+                cellWidthTextField.stringValue = text
+                cellWidthStepper.doubleValue = cellWidthStepper.minValue
+                reloadDataStepper(cellWidthStepper)
+            } else if width >= cellWidthStepper.minValue && width <= cellWidthStepper.maxValue {
+                let text = String(format: "%0.2f", (textField.stringValue as NSString).doubleValue)
+                cellWidthTextField.stringValue = text
+                cellWidthStepper.doubleValue = width
+                reloadDataStepper(cellWidthStepper)
+            } else {
+                let text = String(format: "%0.2f", cellWidthStepper.maxValue * 0.04)
+                cellWidthTextField.stringValue = text
+                cellWidthStepper.doubleValue = cellWidthStepper.maxValue
+                reloadDataStepper(cellWidthStepper)
+            }
+        } else if textField == cellHeightTextField {
+            let height = (textField.stringValue as NSString).doubleValue / 0.04
+            if height == cellHeightStepper.doubleValue {
+                return
+            }
+
+            if height <= 0 {
+                let text = String(format: "%0.2f", cellHeightStepper.doubleValue * 0.04)
+                cellHeightTextField.stringValue = text
+            } else if height > 0 && height < cellHeightStepper.minValue {
+                let text = String(format: "%0.2f", cellHeightStepper.minValue * 0.04)
+                cellHeightTextField.stringValue = text
+                cellHeightStepper.doubleValue = cellHeightStepper.minValue
+                reloadDataStepper(cellHeightStepper)
+            } else {
+                let text = String(format: "%0.2f", (textField.stringValue as NSString).doubleValue)
+                cellHeightTextField.stringValue = text
+                cellHeightStepper.doubleValue = height
+                reloadDataStepper(cellHeightStepper)
+            }
+        }
+    }
+    
+    @objc func themeChanged(_ notification: Notification) {
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
+            self?.updateViewColor()
+        }
+    }
+
+    func updateViewColor() {
+        if KMAppearance.isDarkMode() {
+            widthPopUpButton.layer?.backgroundColor = NSColor(red: 57/255.0, green: 60/255.0, blue: 62/255.0, alpha: 1.0).cgColor
+
+            cellWidthTextField.layer?.borderColor = NSColor(red: 86/255.0, green: 88/255.0, blue: 90/255.0, alpha: 1.0).cgColor
+            cellHeightTextField.layer?.borderColor = NSColor(red: 86/255.0, green: 88/255.0, blue: 90/255.0, alpha: 1.0).cgColor
+            sidebarPopUpButton.layer?.borderColor = NSColor(red: 86/255.0, green: 88/255.0, blue: 90/255.0, alpha: 1.0).cgColor
+            widthPopUpButton.layer?.borderColor = NSColor(red: 86/255.0, green: 88/255.0, blue: 90/255.0, alpha: 1.0).cgColor
+            headerPopUpButton.layer?.borderColor = NSColor(red: 86/255.0, green: 88/255.0, blue: 90/255.0, alpha: 1.0).cgColor
+            footerPopUpButton.layer?.borderColor = NSColor(red: 86/255.0, green: 88/255.0, blue: 90/255.0, alpha: 1.0).cgColor
+        } else {
+            widthPopUpButton.layer?.backgroundColor = NSColor.white.cgColor
+
+            cellWidthTextField.layer?.borderColor = NSColor(red: 218/255.0, green: 219/255.0, blue: 222/255.0, alpha: 1.0).cgColor
+            cellHeightTextField.layer?.borderColor = NSColor(red: 218/255.0, green: 219/255.0, blue: 222/255.0, alpha: 1.0).cgColor
+            sidebarPopUpButton.layer?.borderColor = NSColor(red: 218/255.0, green: 219/255.0, blue: 222/255.0, alpha: 1.0).cgColor
+            widthPopUpButton.layer?.borderColor = NSColor(red: 218/255.0, green: 219/255.0, blue: 222/255.0, alpha: 1.0).cgColor
+            headerPopUpButton.layer?.borderColor = NSColor(red: 218/255.0, green: 219/255.0, blue: 222/255.0, alpha: 1.0).cgColor
+            footerPopUpButton.layer?.borderColor = NSColor(red: 218/255.0, green: 219/255.0, blue: 222/255.0, alpha: 1.0).cgColor
+        }
+    }
 }

+ 4 - 14
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.xib

@@ -108,7 +108,6 @@
                                                         <constraint firstAttribute="height" constant="52" id="PCt-uJ-lWz"/>
                                                         <constraint firstItem="hKw-5E-Ops" firstAttribute="centerX" secondItem="RdL-Ai-FJT" secondAttribute="centerX" id="aK2-pP-y6r"/>
                                                     </constraints>
-                                                    <font key="titleFont" metaFont="smallSystem"/>
                                                 </box>
                                                 <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Yaq-ru-jPL" customClass="KMBox">
                                                     <rect key="frame" x="104" y="56" width="101" height="52"/>
@@ -138,7 +137,6 @@
                                                     <constraints>
                                                         <constraint firstItem="eIX-DO-hHd" firstAttribute="centerX" secondItem="Yaq-ru-jPL" secondAttribute="centerX" id="gF1-5G-slt"/>
                                                     </constraints>
-                                                    <font key="titleFont" metaFont="smallSystem"/>
                                                 </box>
                                                 <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="a2y-CU-aGm" customClass="KMBox">
                                                     <rect key="frame" x="209" y="56" width="100" height="52"/>
@@ -168,7 +166,6 @@
                                                     <constraints>
                                                         <constraint firstItem="Vkd-zT-7Pn" firstAttribute="centerX" secondItem="a2y-CU-aGm" secondAttribute="centerX" id="8zy-at-6eH"/>
                                                     </constraints>
-                                                    <font key="titleFont" metaFont="smallSystem"/>
                                                 </box>
                                                 <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="SSS-5Y-bqp" customClass="KMBox">
                                                     <rect key="frame" x="104" y="0.0" width="101" height="52"/>
@@ -198,7 +195,6 @@
                                                     <constraints>
                                                         <constraint firstItem="izd-C0-i9E" firstAttribute="centerX" secondItem="SSS-5Y-bqp" secondAttribute="centerX" id="egj-nr-dSH"/>
                                                     </constraints>
-                                                    <font key="titleFont" metaFont="smallSystem"/>
                                                 </box>
                                                 <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="WMs-Gy-kCt" customClass="KMBox">
                                                     <rect key="frame" x="209" y="0.0" width="100" height="52"/>
@@ -228,7 +224,6 @@
                                                     <constraints>
                                                         <constraint firstItem="X7D-WK-dAr" firstAttribute="centerX" secondItem="WMs-Gy-kCt" secondAttribute="centerX" id="92k-D6-aHJ"/>
                                                     </constraints>
-                                                    <font key="titleFont" metaFont="smallSystem"/>
                                                 </box>
                                                 <box boxType="custom" borderWidth="0.0" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="XhI-it-pUs" customClass="KMBox">
                                                     <rect key="frame" x="0.0" y="0.0" width="100" height="52"/>
@@ -258,7 +253,6 @@
                                                     <constraints>
                                                         <constraint firstItem="JcV-A2-4RJ" firstAttribute="centerX" secondItem="XhI-it-pUs" secondAttribute="centerX" id="ucH-T0-krh"/>
                                                     </constraints>
-                                                    <font key="titleFont" metaFont="smallSystem"/>
                                                 </box>
                                             </subviews>
                                             <constraints>
@@ -290,7 +284,6 @@
                                         <constraints>
                                             <constraint firstAttribute="height" constant="108" id="se2-K7-kbr"/>
                                         </constraints>
-                                        <font key="titleFont" metaFont="smallSystem"/>
                                     </box>
                                 </subviews>
                                 <constraints>
@@ -551,7 +544,7 @@
                                                         <constraint firstAttribute="width" constant="16" id="HbL-ls-8Nh"/>
                                                         <constraint firstAttribute="height" constant="16" id="WYx-SB-5rH"/>
                                                     </constraints>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="view_color" id="Diq-TY-cqg"/>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSColorPanel" id="Diq-TY-cqg"/>
                                                 </imageView>
                                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="YbY-oz-gRs">
                                                     <rect key="frame" x="0.0" y="0.0" width="48" height="22"/>
@@ -572,7 +565,6 @@
                                             <constraint firstAttribute="height" constant="24" id="R0G-ep-QYh"/>
                                             <constraint firstAttribute="width" constant="72" id="hkY-cQ-jcU"/>
                                         </constraints>
-                                        <font key="titleFont" metaFont="smallSystem"/>
                                     </box>
                                     <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="iAo-Mk-RsN" customClass="KMBox">
                                         <rect key="frame" x="237" y="137" width="72" height="24"/>
@@ -586,7 +578,7 @@
                                                         <constraint firstAttribute="width" constant="16" id="TCn-a8-Wnu"/>
                                                         <constraint firstAttribute="height" constant="16" id="Wgj-Ck-k3L"/>
                                                     </constraints>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="view_color" id="K7R-Mg-5SH"/>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSColorPanel" id="K7R-Mg-5SH"/>
                                                 </imageView>
                                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="PNK-gb-Jcc">
                                                     <rect key="frame" x="0.0" y="0.0" width="48" height="22"/>
@@ -607,7 +599,6 @@
                                             <constraint firstItem="rkv-8b-Hy9" firstAttribute="centerY" secondItem="iAo-Mk-RsN" secondAttribute="centerY" id="rdg-vK-Y3X"/>
                                             <constraint firstAttribute="width" constant="72" id="uX4-v0-Kdr"/>
                                         </constraints>
-                                        <font key="titleFont" metaFont="smallSystem"/>
                                     </box>
                                     <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="PY0-aW-akF" customClass="KMPopUpButton">
                                         <rect key="frame" x="232" y="75" width="77" height="24"/>
@@ -694,7 +685,7 @@
                                                         <constraint firstAttribute="height" constant="16" id="4PH-L4-YnY"/>
                                                         <constraint firstAttribute="width" constant="16" id="exj-QQ-q7f"/>
                                                     </constraints>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="view_color" id="Q6r-gY-T5t"/>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSColorPanel" id="Q6r-gY-T5t"/>
                                                 </imageView>
                                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="pkm-MP-XDd">
                                                     <rect key="frame" x="0.0" y="0.0" width="48" height="22"/>
@@ -715,7 +706,6 @@
                                             <constraint firstItem="cvy-TI-qd5" firstAttribute="centerY" secondItem="zIF-Jm-IKq" secondAttribute="centerY" id="4ke-3l-5wK"/>
                                             <constraint firstAttribute="width" constant="72" id="wxj-0Q-LjS"/>
                                         </constraints>
-                                        <font key="titleFont" metaFont="smallSystem"/>
                                     </box>
                                     <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="vhL-YS-qDV">
                                         <rect key="frame" x="16" y="174" width="117" height="15"/>
@@ -818,12 +808,12 @@
         </scrollView>
     </objects>
     <resources>
+        <image name="NSColorPanel" width="32" height="32"/>
         <image name="table_ic_01" width="70" height="49"/>
         <image name="table_ic_02" width="70" height="49"/>
         <image name="table_ic_03" width="70" height="49"/>
         <image name="table_ic_04" width="70" height="49"/>
         <image name="table_ic_05" width="70" height="49"/>
         <image name="table_ic_06" width="70" height="49"/>
-        <image name="view_color" width="38" height="38"/>
     </resources>
 </document>

+ 59 - 17
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMPopUpButton.swift

@@ -15,6 +15,7 @@ import Cocoa
 }
 
 @objcMembers class KMPopUpButton: NSPopUpButton {
+    var buttonImage: NSImage?
     var type: KMPopUpButtonType = .arrowUpDown {
         didSet {
             switch type {
@@ -33,26 +34,67 @@ import Cocoa
     
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
-        
-        var imageName = "KMImageNameUXIconBtnArrowDown"
-        if type == .arrowUpDown {
-            imageName = "KMImageNameUXIconBtnArrowUpdown"
-        }
-        
-        if type != .noArrow {
-            if let image = NSImage(named: imageName) {
-                let rect = NSZeroRect
-                var p = dirtyRect.origin
-                p.x += dirtyRect.size.width - image.size.width - 1
-                p.y += (dirtyRect.size.height - image.size.height) / 2
-                
-                if type == .noArrow {
-                    p.x = (dirtyRect.size.width - image.size.width) / 2
+
+        var frameSize = bounds
+        var image = NSImage(named: KMImageNameUXIconBtnArrowUpdown)
+        var titleFloat: CGFloat = 8.0
+
+        switch type {
+        case .table:
+            KMAppearance.Layout.l1Color().setFill()
+            frameSize.fill()
+            
+
+            if let tableImg = self.buttonImage {
+                var tableRect = NSZeroRect
+                tableRect.size = tableImg.size
+                var p1 = frameSize.origin
+                p1.x += frameSize.size.width - tableImg.size.width - 8
+                p1.y += (frameSize.size.height - tableImg.size.height) / 2
+                tableImg.draw(in: NSMakeRect(8, 4, tableImg.size.width, tableImg.size.height),
+                              from: tableRect,
+                              operation: .sourceOver,
+                              fraction: 1.0,
+                              respectFlipped: true,
+                              hints: nil)
+
+                titleFloat += tableImg.size.width + 9.0
+
+                // 对选中的item设置勾选
+                if let selectedItem = selectedItem {
+                    for item in itemArray {
+                        (item).state = (item == selectedItem) ? .on : .off
+                    }
+
+                    var title = selectedItem.title
+
+                    // 获取字符串的宽度和高度
+                    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])
                 }
-                
-                image.draw(in: NSRect(origin: NSMakePoint(p.x, p.y), size: image.size), from: rect, operation: .sourceOver, fraction: 1.0, respectFlipped: true, hints: nil)
             }
+        case .arrowDown:
+            image = NSImage(named: KMImageNameUXIconBtnArrowDown)
+        case .arrowUpDown:
+            // Handle ArrowUpDown case
+            break
+        default:
+            break
         }
+
+        var rect = NSRect.zero
+        rect.size = CGSize(width: 16.0, height: 16.0)
+        var p = frameSize.origin
+        p.x += frameSize.size.width - 17
+        p.y += (frameSize.size.height - 16) / 2
+        image?.draw(in: NSMakeRect(p.x, p.y, 16.0, 16.0),
+                    from: rect,
+                    operation: .sourceOver,
+                    fraction: 1.0,
+                    respectFlipped: true,
+                    hints: nil)
     }
 }