Browse Source

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

tangchao 4 months ago
parent
commit
f52147c241
100 changed files with 3845 additions and 2813 deletions
  1. 44 41
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/Color/ComponentCColorCustom.swift
  2. 1 1
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/Color/ComponentCColorGroup.swift
  3. 5 1
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.swift
  4. 1 1
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentInput/ComponentInputProperty.swift
  5. 11 3
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/MenuItem/ComponentMenuitemProperty.swift
  6. 18 3
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Select/ComponentSelect.swift
  7. 9 2
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Select/SelectZoom/ComponentSelectZoom.swift
  8. 0 2
      PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController+PPTMode.swift
  9. 1 2
      PDF Office/PDF Master/Class/Document/KMMainDocument.swift
  10. 1 4
      PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/Model/KMBatchAddHeaderFooterOperation.swift
  11. 9 10
      PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/New/View/KMHeaderFooterView.swift
  12. 1 1
      PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/WindowComtroller/KMHeaderFooterManagerWindowController.swift
  13. 1 50
      PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.m
  14. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/ComPDFKit
  15. 7 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFDocument.h
  16. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKitConfig.h
  17. 23 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CTaskQueueManager.h
  18. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/ComPDFKit.h
  19. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Modules/module.modulemap
  20. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Assets.car
  21. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib/keyedobjects-101300.nib
  22. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib/keyedobjects.nib
  23. 7 7
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Info.plist
  24. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/default.metallib
  25. 34 23
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/_CodeSignature/CodeResources
  26. 106 106
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/LeftSideView.xib
  27. 52 242
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  28. 51 189
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift
  29. 12 104
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift
  30. 1 1
      PDF Office/PDF Master/KMClass/ComponentLibraryDemo/Demo/ControllerVC.swift
  31. 28 28
      PDF Office/PDF Master/KMClass/ImageToPDF/Base/KMBatchOperateLeftViewController.xib
  32. 9 9
      PDF Office/PDF Master/KMClass/KMHomeViewController/KMNHomeViewController.swift
  33. 34 30
      PDF Office/PDF Master/KMClass/KMHomeViewController/KMURLCreatePDFWindowController/KMURLCreatePDFWindowController.swift
  34. 35 38
      PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeQuickTools/KMNQuickToolWindowController.swift
  35. 1 1
      PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift
  36. 1 5
      PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/HeaderFooterView/KMHomeFilesHeaderView.swift
  37. 1 1
      PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/HistoryFilesItems/KMHistoryFileListItem.swift
  38. 9 9
      PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/HistoryFilesItems/KMHistoryFileListItem.xib
  39. 13 5
      PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/KMHomeRightView.swift
  40. 36 10
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFExtract/KMNExtractPDFWindowController.swift
  41. 79 12
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFInsert/KMNPDFInsertBlankWindowController.swift
  42. 81 10
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFInsert/KMNPDFInsertPDFWindowController.swift
  43. 97 26
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFSplit/KMNSplitPDFWindowController.swift
  44. 38 0
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNCustomCollectionViewLayout.swift
  45. 22 12
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNPageEditViewController.swift
  46. 24 0
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumDecorationView.swift
  47. 213 110
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController+Action.swift
  48. 13 3
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.swift
  49. 2 1
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.xib
  50. 8 1
      PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailCollectionView.swift
  51. 26 14
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Background/Background/KMBackgroundController.swift
  52. 24 24
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Background/Background/Views/KMBackgroundPropertyController.swift
  53. 6 6
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Background/Background/Views/KMBackgroundPropertyController.xib
  54. 0 251
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPreviewController.swift
  55. 0 22
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPreviewController.xib
  56. 0 130
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyController.swift
  57. 0 124
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyHomeController.swift
  58. 0 22
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyHomeController.xib
  59. 0 264
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyInfoController.swift
  60. 0 140
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyInfoController.xib
  61. 0 73
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMCreateBatesController.swift
  62. 0 19
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMCreateBatesController.xib
  63. 87 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/KMBatesController.swift
  64. 56 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/KMBatesController.xib
  65. 27 14
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Tools/KMBatesManager.swift
  66. 23 1
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Model/KMBatesModel.swift
  67. 0 22
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Tools/KMBatchQuickActionManager.swift
  68. 0 91
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/View/KMBatesPageInfoView.swift
  69. 0 91
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/View/KMBatesPrefixInfoView.swift
  70. 398 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesPropertyController.swift
  71. 498 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesPropertyController.xib
  72. 8 7
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHFTemplateController.swift
  73. 131 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesTemplateController.xib
  74. 17 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesTemplateItem.swift
  75. 3 3
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyController.xib
  76. 9 3
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMEditToolbarView.swift
  77. 2 6
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/SinglePagePDFController/KMEditDocumentController.swift
  78. 35 35
      PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Watermark/View/KMWatermarkPDFView.swift
  79. 27 27
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Base/KMDataVersionManager.swift
  80. 101 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterController.swift
  81. 8 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterManager.swift
  82. 0 45
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterModel.swift
  83. 157 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterObject.swift
  84. 203 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHFTemplateController.swift
  85. 0 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHFTemplateController.xib
  86. 234 64
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderPropertyController.swift
  87. 16 14
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderPropertyController.xib
  88. 0 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHeaderTemplateItem.swift
  89. 0 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHeaderTemplateItem.xib
  90. 184 185
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift
  91. 27 8
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMNDisplayViewController/KMNDisplayViewController.swift
  92. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginBottom.imageset/Contents.json
  93. 87 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginBottom.imageset/batesMarginBottom.pdf
  94. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginLeft.imageset/Contents.json
  95. 87 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginLeft.imageset/batesMarginLeft.pdf
  96. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginRight.imageset/Contents.json
  97. 87 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginRight.imageset/batesMarginRight.pdf
  98. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginTop.imageset/Contents.json
  99. 87 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginTop.imageset/batesMarginTop.pdf
  100. 0 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_TTS.imageset/toolbar_TTS.pdf

+ 44 - 41
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/Color/ComponentCColorCustom.swift

@@ -17,7 +17,7 @@ public class ComponentCColorCustom: ComponentBaseXibView {
     // MARK: Private Property
     private var _properties     : ComponentCColorProperty?
     
-    weak open var componentDelegate: ComponentCColorDelegate?
+    weak open var delegate: ComponentCColorDelegate?
     
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
@@ -41,8 +41,7 @@ public class ComponentCColorCustom: ComponentBaseXibView {
     
     public override func awakeFromNib() {
         super.awakeFromNib()
-       
-         
+        
     }
     
     // MARK: - Set & Get
@@ -55,12 +54,16 @@ public class ComponentCColorCustom: ComponentBaseXibView {
             if let property = _properties {
                 ComponentLibrary.shared.configCColorComponent(properties: property)
             }
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
+    public func reloadData() {
+        refreshUI()
+    }
+    
     //MARK: - SetupUI
     func setupUI() {
         
@@ -69,53 +72,53 @@ public class ComponentCColorCustom: ComponentBaseXibView {
     func refreshUI() {
         
         var fillColor: NSColor?
-        let borderWidth: CGFloat = self.properties?.propertyInfo.borderWidth ?? 0
+        let borderWidth: CGFloat = properties?.propertyInfo.borderWidth ?? 0
         var borderColor: NSColor?
         
-        if self.properties?.state == .normal {
-            fillColor = self.properties?.propertyInfo.color_nor
-            borderColor = self.properties?.propertyInfo.borderColor_nor
-        } else if self.properties?.state == .hover {
-            fillColor = self.properties?.propertyInfo.color_hov
-            borderColor = self.properties?.propertyInfo.borderColor_hov
-        } else if self.properties?.state == .pressed {
-            fillColor = self.properties?.propertyInfo.color_active
-            borderColor = self.properties?.propertyInfo.borderColor_active
+        if properties?.state == .normal {
+            fillColor = properties?.propertyInfo.color_nor
+            borderColor = properties?.propertyInfo.borderColor_nor
+        } else if properties?.state == .hover {
+            fillColor = properties?.propertyInfo.color_hov
+            borderColor = properties?.propertyInfo.borderColor_hov
+        } else if properties?.state == .pressed {
+            fillColor = properties?.propertyInfo.color_active
+            borderColor = properties?.propertyInfo.borderColor_active
         }
          
         if let color = fillColor {
-            self.contendBox.fillColor = color
+            contendBox.fillColor = color
         }
-        self.contendBox.borderWidth = borderWidth
+        contendBox.borderWidth = borderWidth
         
         if let color = borderColor {
-            self.contendBox.borderColor = color
+            contendBox.borderColor = color
         }
-        self.contendBox.cornerRadius = self.properties?.propertyInfo.cornerRadius ?? 0
+        contendBox.cornerRadius = properties?.propertyInfo.cornerRadius ?? 0
         
-        if let color = self.properties?.color {
-            self.colorBox.fillColor = color
+        if let color = properties?.color {
+            colorBox.fillColor = color
         } else {
-            self.colorBox.fillColor = NSColor.clear
+            colorBox.fillColor = NSColor.clear
         }
         
-        if let color = self.properties?.propertyInfo.colorBorderColor {
-            self.colorBox.borderColor = color
+        if let color = properties?.propertyInfo.colorBorderColor {
+            colorBox.borderColor = color
         } else {
-            self.colorBox.borderColor = NSColor.clear
+            colorBox.borderColor = NSColor.clear
         }
-        self.colorBox.borderWidth = 1
-        self.colorBox.cornerRadius = 10
+        colorBox.borderWidth = 1
+        colorBox.cornerRadius = 10
         
         
     }
      
     @objc func colorChoose(_ sender: Any) {
         let color = NSColorPanel.shared.color
-        self.properties?.color = color
-        self.refreshUI()
+        properties?.color = color
+        refreshUI()
          
-        self.componentDelegate?.componentCColorDidChooseColor?(self, self.properties?.color)
+        delegate?.componentCColorDidChooseColor?(self, properties?.color)
         
     }
     
@@ -123,10 +126,10 @@ public class ComponentCColorCustom: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties?.state != .pressed {
-            self.properties?.state = .hover
+        if properties?.state != .pressed {
+            properties?.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -137,11 +140,11 @@ public class ComponentCColorCustom: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties?.state != .pressed {
-            self.properties?.state = .normal
+        if properties?.state != .pressed {
+            properties?.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -152,25 +155,25 @@ public class ComponentCColorCustom: ComponentBaseXibView {
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
-        self.properties?.state = .pressed
+        properties?.state = .pressed
         
-        self.refreshUI()
+        refreshUI()
         
         let point = convert(event.locationInWindow, from: nil)
-        if CGRectContainsPoint(self.colorImage.frame, point) {
+        if CGRectContainsPoint(colorImage.frame, point) {
             if NSColorPanel.sharedColorPanelExists {
                 NSColorPanel.shared.setTarget(nil)
                 NSColorPanel.shared.setAction(nil)
             }
             NSColorPanel.shared.setTarget(self)
             NSColorPanel.shared.setAction(#selector(colorChoose(_:)))
-            if let color = self.properties?.color {
+            if let color = properties?.color {
                 NSColorPanel.shared.color = color
             }
             NSColorPanel.shared.orderFront(nil)
         }
         
-        self.componentDelegate?.componentCColorDidChooseColor?(self, self.properties?.color)
+        delegate?.componentCColorDidChooseColor?(self, properties?.color)
          
     }
     

+ 1 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/Color/ComponentCColorGroup.swift

@@ -44,7 +44,7 @@ public class ComponentCColorGroup: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
         
-        customColorItem.componentDelegate = self
+        customColorItem.delegate = self
         
     }
     

+ 5 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.swift

@@ -199,9 +199,13 @@ public class ComponentDropdownTool: ComponentBaseXibView {
             groupView = ComponentGroup.createFromNib(in: ComponentLibrary.shared.componentBundle())
         }
         var viewHeight: CGFloat = 8
+        var viewWidht: CGFloat = 20
         for item in items {
             if item.type == .normal {
+                ComponentLibrary.shared.configMenuItemComponent(properties: item)
+                
                 viewHeight += 36
+                viewWidht = max(viewWidht, item.propertyInfo.viewWidth)
             } else if item.type == .divider {
                 viewHeight += 8
             }
@@ -212,7 +216,7 @@ public class ComponentDropdownTool: ComponentBaseXibView {
         point.y -= 4
         
         groupView.groupDelegate = self
-        groupView?.frame = CGRectMake(0, 0, 232, viewHeight)
+        groupView?.frame = CGRectMake(0, 0, viewWidht, viewHeight)
         groupView.updateGroupInfo(items)
         groupView.showWithPoint(point, relativeTo: contendBox)
         

+ 1 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentInput/ComponentInputProperty.swift

@@ -126,7 +126,7 @@ extension ComponentLibrary {
         } else {
             properties.propertyInfo.color_active = NSColor.clear
         }
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("comp-field/colorFill-active") {
+        if let value = ComponentLibrary.shared.getComponentValueFromKey("comp-field/colorFill-dis") {
             let currentValue = value as! [String : Any]
             properties.propertyInfo.color_dis = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
         } else {

+ 11 - 3
PDF Office/KMComponentLibrary/KMComponentLibrary/View/MenuItem/ComponentMenuitemProperty.swift

@@ -155,6 +155,17 @@ extension ComponentLibrary {
             }
         }
         
+        var viewWidth = ComponentLibrary.shared.sizeOfString(properties.text , properties.propertyInfo.textFont, 500).width + 32
+        if let icon = properties.lefticon {
+            viewWidth += 24
+        }
+        if let icon = properties.righticon {
+            viewWidth += 24
+        }
+        if let string = properties.keyEquivalent {
+            viewWidth += 44
+        }
+        properties.propertyInfo.viewWidth = viewWidth
         
         //keyEquivalent_textColor
         if let value = ComponentLibrary.shared.getComponentValueFromKey("colorText/3") {
@@ -164,9 +175,6 @@ extension ComponentLibrary {
             properties.propertyInfo.color_active = NSColor.clear
         }
         
-        
-        
-        
     }
     
 }

+ 18 - 3
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Select/ComponentSelect.swift

@@ -144,8 +144,10 @@ public class ComponentSelect: ComponentBaseXibView {
         
         if properties.isDisabled == false {
             inputField.isEditable = true
+            inputField.isSelectable = true
             if properties.creatable == false {
                 inputField.isEditable = false
+                inputField.isSelectable = false
             }
         } else {
             inputField.isEditable = false
@@ -243,10 +245,15 @@ public class ComponentSelect: ComponentBaseXibView {
         var point = convert(contendBox.frame.origin, to: nil)
         point.y -= viewHeight
         
+        var viewWidth: CGFloat = 260
+        if viewWidth < CGRectGetWidth(self.frame) {
+            viewWidth = CGRectGetWidth(self.frame)
+        }
+        
         if groupView == nil {
             groupView = ComponentGroup.createFromNib(in: ComponentLibrary.shared.componentBundle())
         }
-        groupView?.frame = CGRectMake(310, 0, 260, viewHeight)
+        groupView?.frame = CGRectMake(310, 0, viewWidth, viewHeight)
         groupView?.reloadData()
         groupView.groupDelegate = self
         groupView.showWithPoint(point, relativeTo: contendBox)
@@ -338,8 +345,16 @@ public class ComponentSelect: ComponentBaseXibView {
         super.mouseUp(with: event)
         
         if properties.isDisabled == false {
-            let point = convert(event.locationInWindow, from: nil)
-            if CGRectContainsPoint(rightIconImage.frame, point) {
+            if properties.creatable == true {
+                let point = convert(event.locationInWindow, from: nil)
+                if CGRectContainsPoint(rightIconImage.frame, point) {
+                    window?.makeFirstResponder(rightIconImage)
+                    
+                    properties.state = .pressed
+                    
+                    showGroupView()
+                }
+            } else {
                 window?.makeFirstResponder(rightIconImage)
                 
                 properties.state = .pressed

+ 9 - 2
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Select/SelectZoom/ComponentSelectZoom.swift

@@ -164,6 +164,8 @@ public class ComponentSelectZoom: ComponentBaseXibView {
         }
         
         var viewHeight: CGFloat = 8.0
+        var viewWidht: CGFloat = 20
+
         for item in properties.menuItemArr {
             item.state = .normal
             item.itemSelected = false
@@ -171,18 +173,23 @@ public class ComponentSelectZoom: ComponentBaseXibView {
                 item.itemSelected = true
             }
             if item.type == .normal {
+                ComponentLibrary.shared.configMenuItemComponent(properties: item)
+                
                 viewHeight += 36
+                viewWidht = max(viewWidht, item.propertyInfo.viewWidth)
             } else if item.type == .divider {
                 viewHeight += 8
             }
         }
         
-        let point = convert(contendBox.frame.origin, to: nil)
+        var point = convert(contendBox.frame.origin, to: nil)
+        point.y -= viewHeight
+        point.y -= 6
          
         if groupView == nil {
             groupView = ComponentGroup.createFromNib(in: ComponentLibrary.shared.componentBundle())
         }
-        groupView?.frame = CGRectMake(310, 0, 260, viewHeight)
+        groupView?.frame = CGRectMake(310, 0, 180, viewHeight)
         groupView?.reloadData()
         groupView.groupDelegate = self
         groupView?.showWithPoint(point, relativeTo: contendBox)

+ 0 - 2
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController+PPTMode.swift

@@ -73,11 +73,9 @@ extension KMBrowserWindowController {
         if wasInteractionMode == .legacyFullScreen {
             let doc = self.document as? KMMainDocument
             view = doc?.mainViewController?.pdfSplitView
-            contentView = doc?.mainViewController?.centerContentView
         } else {
             let doc = self.document as? KMMainDocument
             view = doc?.mainViewController?.listView
-            contentView = doc?.mainViewController?.centerContentView
         }
  
 

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

@@ -915,9 +915,9 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
             if mainViewController != nil {
                 mainViewController?.savePdfAlertView()
                 if mainViewController?.document != nil {
-                    self.mainViewController?.commitEditingIfNeed()
 
                     
+                    
                     if (mainViewController!.needSave) {
                         if let options = self.mainViewController?.secureOptions, !options.isEmpty {
                             self.mainViewController!.document?.setDocumentAttributes(self.mainViewController?.documentAttribute)
@@ -986,7 +986,6 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
                             return
                         }
                         // 提交文本编辑的内容
-//                        self.mainViewController?.commitEditingIfNeed()
                         DispatchQueue.main.async {
                             NSPanel.savePanel(NSApp.mainWindow!, openAccessoryView, panel:{ panel in
                                 if (!self.isNewCreated) {

+ 1 - 4
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/Model/KMBatchAddHeaderFooterOperation.swift

@@ -22,10 +22,7 @@ class KMBatchAddHeaderFooterOperation: KMBatchOperation{
         
     }
     func currentParameter() -> KMBatchBaseParameter {
-        if headerFooter!.isBates{
-            return operateFile!.addBatesInfo
-        }
-        return operateFile!.addHeaderFooterInfo
+         return operateFile!.addHeaderFooterInfo
     }
     override func start() {
         self.pdfDocument = CPDFDocument(url: URL(fileURLWithPath: self.operateFile?.filePath ?? ""))

+ 9 - 10
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/New/View/KMHeaderFooterView.swift

@@ -203,7 +203,6 @@ class KMHeaderFooterView: BaseXibView, NSTextViewDelegate, NSComboBoxDelegate {
 //            } else {
 //                headerFooterObj.id = KMHeaderFooterManager.defaultManager.fetchHeaderFooterAvailableName()
 //            }
-            headerFooterObj.isBates = self.isBates
             self.reloadData()
         }
     }
@@ -526,15 +525,15 @@ class KMHeaderFooterView: BaseXibView, NSTextViewDelegate, NSComboBoxDelegate {
         self.batesBox.title = NSLocalizedString("Bates Settings", comment: "")
         self.prefixLabel.stringValue = String(format: "%@:", NSLocalizedString("Prefix", comment: ""))
         self.prefixLabel.toolTip = String(format: "%@:", NSLocalizedString("Prefix", comment: ""))
-        self.prefixTextField.stringValue = self.headerFooterObj.batesPrefixString
+//        self.prefixTextField.stringValue = self.headerFooterObj.batesPrefixString
 
         self.suffixLabel.stringValue = String(format: "%@:", NSLocalizedString("Suffix", comment: ""))
         self.suffixLabel.toolTip = String(format: "%@:", NSLocalizedString("Suffix", comment: ""))
-        self.suffixTextField.stringValue = self.headerFooterObj.batesSuffixString
+//        self.suffixTextField.stringValue = self.headerFooterObj.batesSuffixString
 
         self.batesNumberLabel.stringValue = String(format: "%@:", NSLocalizedString("Number of Digits", comment: ""))
-        self.batesNumberStepper.integerValue = self.headerFooterObj.batesDigits
-        self.batesNumberTextField.integerValue = self.headerFooterObj.batesDigits
+//        self.batesNumberStepper.integerValue = self.headerFooterObj.batesDigits
+//        self.batesNumberTextField.integerValue = self.headerFooterObj.batesDigits
 
     }
     
@@ -601,7 +600,7 @@ class KMHeaderFooterView: BaseXibView, NSTextViewDelegate, NSComboBoxDelegate {
     @objc func menuItem_InsertBates(_ sender: NSMenuItem) {
         guard let button = sender.representedObject as? NSButton else { return }
         self.window?.makeFirstResponder(self)
-        self.headerFooterObj.batesDigits = self.batesNumberTextField.integerValue
+//        self.headerFooterObj.batesDigits = self.batesNumberTextField.integerValue
         var tString = "<<#\((self.batesNumberTextField.integerValue))#\(self.batesStartpageCombobox.stringValue)"
         if !self.prefixTextField.stringValue.isEmpty {
             tString += "#\(self.prefixTextField.stringValue)"
@@ -1238,24 +1237,24 @@ extension KMHeaderFooterView {
     }
 
     @IBAction func batesprefixChanged(_ sender: NSTextField) {
-        headerFooterObj.batesPrefixString = sender.stringValue
+//        headerFooterObj.batesPrefixString = sender.stringValue
         self.updatePDFView()
     }
 
     @IBAction func batesSuffixChanged(_ sender: NSTextField) {
-        headerFooterObj.batesSuffixString = sender.stringValue
+//        headerFooterObj.batesSuffixString = sender.stringValue
         self.updatePDFView()
     }
 
     @IBAction func batesNumberChanged(_ sender: NSTextField) {
         batesNumberStepper.integerValue = sender.integerValue
-        headerFooterObj.batesDigits = sender.integerValue
+//        headerFooterObj.batesDigits = sender.integerValue
         self.updatePDFView()
     }
 
     @IBAction func bateNumberStepperAction(_ sender: NSStepper) {
         batesNumberTextField.integerValue = sender.integerValue
-        headerFooterObj.batesDigits = sender.integerValue
+//        headerFooterObj.batesDigits = sender.integerValue
         self.updatePDFView()
     }
 

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/WindowComtroller/KMHeaderFooterManagerWindowController.swift

@@ -23,7 +23,7 @@ class KMHeaderFooterManagerWindowController: NSWindowController{
     var pdfdocument: CPDFDocument?
     lazy var headerFooterObj: KMHeaderFooterObject? = {
         let obj = KMHeaderFooterObject()
-        obj.isBates = self.isBates
+//        obj.isBates = self.isBates
         if self.isBates {
 //            obj.id = KMHeaderFooterManager.defaultManager.fetchBatesAvailableName()
         }else {

+ 1 - 50
PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.m

@@ -1197,56 +1197,7 @@ static KMPDFEditAppendWindow *windowController = nil;
 }
 
 - (IBAction)doAppend {
-//    if (KMLightMemberManager.manager.purchaseState != KMPurchaseManagerStateSubscription && _files.count > 2) {
-////        [KMSubscribeWaterMarkWindowController showWithWindow: self.window isContinue: false limit type:KMSubscribeWaterMarkTypeMerge subscribeDidClick:^{
-////
-////        } completion:^(BOOL isSub, BOOL isWater, BOOL isClose) {
-////
-////        }];
-//        [KMSubscribeWaterMarkWindowController showWithWindow:self.window isContinue:false limit:[self mergeCountIsReach]  type:KMSubscribeWaterMarkTypeMerge subscribeDidClick:^{
-//                    
-//                } completion:^(BOOL, BOOL, BOOL) {
-//                    
-//                }];
-//        return;
-//    } else if (KMLightMemberManager.manager.purchaseState != KMPurchaseManagerStateSubscription && _files.count <= 2) {
-//        __weak typeof(self) weakSelf = self;
-////        [KMSubscribeWaterMarkWindowController showWithWindow: self.window isContinue:true type:KMSubscribeWaterMarkTypeMerge subscribeDidClick:^{
-////
-////        } completion:^(BOOL isSub, BOOL isWater, BOOL isClose) {
-////            if (isWater) {
-////                dispatch_async(dispatch_get_main_queue(), ^{
-////                    [weakSelf buttonItemClick_Append: sender];
-////                });
-////            }
-////        }];
-//        BOOL isContinue = YES;
-//        BOOL limit = [self mergeCountIsReach];
-//        if (limit) {
-//            isContinue = NO;
-//        }
-//        
-//        [KMSubscribeWaterMarkWindowController showWithWindow:self.window isContinue:isContinue limit:limit  type:KMSubscribeWaterMarkTypeMerge subscribeDidClick:^{
-//                    
-//                } completion:^(BOOL isSub, BOOL isWater, BOOL isClose) {
-//                    if (isClose) {
-//                        return;
-//                    }
-//                    if (isSub) {
-//                        dispatch_async(dispatch_get_main_queue(), ^{
-//                            [weakSelf buttonItemClick_Append: nil];
-//                        });
-//                        return;
-//                    }
-//                    if (isWater && !limit) {
-//                        dispatch_async(dispatch_get_main_queue(), ^{
-//                            [weakSelf buttonItemClick_Append: nil];
-//                        });
-//                        return;
-//                    }
-//                }];
-//        return;
-//    }
+
     
     [self buttonItemClick_Append: nil];
 }

BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/ComPDFKit


+ 7 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFDocument.h

@@ -325,6 +325,8 @@ extern CPDFDocumentWriteOption const CPDFDocumentAllowsFormFieldEntryOption;
  * A array of document’s bookmarks.
  */
 - (NSArray<CPDFBookmark *> *)bookmarks;
+
+- (void)bookmarksBlock:(void(^)(NSArray<CPDFBookmark *> *))block;
 /**
  * Add a bookmark at the specified index number.
  *
@@ -344,6 +346,7 @@ extern CPDFDocumentWriteOption const CPDFDocumentAllowsFormFieldEntryOption;
  */
 - (CPDFBookmark *)bookmarkForPageIndex:(NSUInteger)pageIndex;
 
+- (void)bookmarkForPageIndex:(NSUInteger)pageIndex block:(void (^)(CPDFBookmark *bookmark))block;
 #pragma mark - Watermark
 
 /**
@@ -483,7 +486,10 @@ extern CPDFDocumentWriteOption const CPDFDocumentAllowsFormFieldEntryOption;
  * @discussion This method raises an exception if either index value is out of bounds.
  */
 - (BOOL)importPages:(NSIndexSet *)indexSet fromDocument:(CPDFDocument *)document atIndex:(NSUInteger)index;
-
+/**
+ * Retrieve the page data
+ */
+- (void)refreshPageData;
 #pragma mark - Annotations
 
 /**

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKitConfig.h

@@ -13,6 +13,7 @@
 #import <Foundation/Foundation.h>
 #import <ComPDFKit/CPDFKitPlatform.h>
 #import <ComPDFKit/CPDFView.h>
+#import <ComPDFKit/CTaskQueueManager.h>
 
 #define CPDFKitShareConfig [CPDFKitConfig sharedInstance]
 

+ 23 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CTaskQueueManager.h

@@ -0,0 +1,23 @@
+//
+//  CTaskQueueManager.h
+//  ComPDFKit
+//
+//  Created by lizhe on 2024/11/5.
+//  Copyright © 2024 Kdan Mobile. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface CTaskQueueManager : NSObject
++ (instancetype)sharedManager;
+
+// 提交异步任务
+- (void)submitAsyncTask:(dispatch_block_t)task;
+
+// 提交同步任务(自动避免死锁)
+- (void)submitSyncTask:(dispatch_block_t)task;
+@end
+
+NS_ASSUME_NONNULL_END

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/ComPDFKit.h

@@ -14,6 +14,7 @@
 #import <ComPDFKit/CPDFKitPlatform.h>
 #import <ComPDFKit/CPDFKitConfig.h>
 #import <ComPDFKit/CPDFKitConfig+Private.h>
+#import <ComPDFKit/CTaskQueueManager.h>
 
 #import <ComPDFKit/CPDFDocument.h>
 #import <ComPDFKit/CPDFDocument+Protected.h>

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Modules/module.modulemap

@@ -1,6 +1,6 @@
 framework module ComPDFKit {
   umbrella header "ComPDFKit.h"
-
   export *
+
   module * { export * }
 }

BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Assets.car


BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib/keyedobjects-101300.nib


BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/CPDFUnlockViewController.nib/keyedobjects.nib


+ 7 - 7
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Info.plist

@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
 	<key>BuildMachineOSBuild</key>
-	<string>21G72</string>
+	<string>23A344</string>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>en</string>
 	<key>CFBundleExecutable</key>
@@ -27,19 +27,19 @@
 	<key>DTCompiler</key>
 	<string>com.apple.compilers.llvm.clang.1_0</string>
 	<key>DTPlatformBuild</key>
-	<string>14B47b</string>
+	<string></string>
 	<key>DTPlatformName</key>
 	<string>macosx</string>
 	<key>DTPlatformVersion</key>
-	<string>13.0</string>
+	<string>14.2</string>
 	<key>DTSDKBuild</key>
-	<string>22A372</string>
+	<string>23C53</string>
 	<key>DTSDKName</key>
-	<string>macosx13.0</string>
+	<string>macosx14.2</string>
 	<key>DTXcode</key>
-	<string>1410</string>
+	<string>1520</string>
 	<key>DTXcodeBuild</key>
-	<string>14B47b</string>
+	<string>15C500b</string>
 	<key>LSMinimumSystemVersion</key>
 	<string>10.11</string>
 </dict>

BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/default.metallib


+ 34 - 23
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/_CodeSignature/CodeResources

@@ -6,15 +6,15 @@
 	<dict>
 		<key>Resources/Assets.car</key>
 		<data>
-		KyEk4oxSvC32RjwMCvnVaepFm7Q=
+		UlWbqdfXO52si+nmlS2gVgXXEN4=
 		</data>
 		<key>Resources/CPDFUnlockViewController.nib/keyedobjects-101300.nib</key>
 		<data>
-		ULC3lJLcrnOnCBivTpSe8w8O/VQ=
+		WWbJH/mkNN2q0uLETXjvlNRlcAQ=
 		</data>
 		<key>Resources/CPDFUnlockViewController.nib/keyedobjects.nib</key>
 		<data>
-		0H15nmzgJVoRpoNxPw6ZO38r4Xs=
+		dRWDU96uUk0Hy6R6fw3WiuV5+Tc=
 		</data>
 		<key>Resources/Cert/0d264c89.0</key>
 		<data>
@@ -46,11 +46,11 @@
 		</data>
 		<key>Resources/Info.plist</key>
 		<data>
-		p7wBZGU82/JlEY1jvDNEA9abznE=
+		l06W1gff2/uygg0wyZnBzGkBRf4=
 		</data>
 		<key>Resources/default.metallib</key>
 		<data>
-		jzLBEgCveMkMFXwcYUGaOyq4TKI=
+		PWgVqT4CtBAWiJxWMT4peo9xRa4=
 		</data>
 		<key>Resources/empty_password.png</key>
 		<data>
@@ -449,11 +449,11 @@
 		<dict>
 			<key>hash</key>
 			<data>
-			rqqbWoI4dh2usPOtmoYvD8UahN4=
+			IRraHiEKIrpafzsIG6Nc0wSw2b0=
 			</data>
 			<key>hash2</key>
 			<data>
-			3is49wTM94aSCJKeuCpB4DBmOyT4ees6jCsX4CU5H/4=
+			xnuTrYCMEavy7c6F7BQBzV7K3VCbL18UHqFkRQYSYQw=
 			</data>
 		</dict>
 		<key>Headers/CPDFFont.h</key>
@@ -559,11 +559,11 @@
 		<dict>
 			<key>hash</key>
 			<data>
-			OBkRjNohyfKPhwG1Js5Jto1p/ZI=
+			OxEfUUaAJW5+1NQlhKPDDr3d0xI=
 			</data>
 			<key>hash2</key>
 			<data>
-			dvWbg/U+9mfpQu/PWX2bKzwntt2HVkKr1dt7zxaqdig=
+			B76IoMNcQSB8gKiVEFjSpGqAOLCjqxajfLqTCs+VP8g=
 			</data>
 		</dict>
 		<key>Headers/CPDFKitPlatform.h</key>
@@ -1039,59 +1039,70 @@
 			SL6gNtUQF57K98s8avS/iLaj4RY7uG1++xnAtUomrio=
 			</data>
 		</dict>
+		<key>Headers/CTaskQueueManager.h</key>
+		<dict>
+			<key>hash</key>
+			<data>
+			KkeLLP94uCu2UPcgFt9XQWQi+Bs=
+			</data>
+			<key>hash2</key>
+			<data>
+			7ZNcZGW7oTu8rNljut0usNSWF20GMAF/pWTHwS5pc84=
+			</data>
+		</dict>
 		<key>Headers/ComPDFKit.h</key>
 		<dict>
 			<key>hash</key>
 			<data>
-			CDRfV2dScLKYZSpYacqjHNsY9V0=
+			p5a1kEdDH3FuibZKLtll5J1dVpY=
 			</data>
 			<key>hash2</key>
 			<data>
-			S/mBV0Gpw6ZSbO2zQWXks+TnbSZEGPqDBBd47trbfpw=
+			18WmgRCd8NPfbBSrWbKY0VfBVs3WWkbQsjqUIXD7PZQ=
 			</data>
 		</dict>
 		<key>Modules/module.modulemap</key>
 		<dict>
 			<key>hash</key>
 			<data>
-			LiQoiZ0HQqg8PLvhYGe2l6sUM/Q=
+			GJse0j0x4wLzigM/YeAjcM+nZxQ=
 			</data>
 			<key>hash2</key>
 			<data>
-			AAkcPQ+8lTvgjXGHEKzmPSMjAW0mw1D0ReUK5G9YEwQ=
+			iQcHR0nTiFjwgQN3izRKSCofKuNTCmNsv4iXpEARTgc=
 			</data>
 		</dict>
 		<key>Resources/Assets.car</key>
 		<dict>
 			<key>hash</key>
 			<data>
-			KyEk4oxSvC32RjwMCvnVaepFm7Q=
+			UlWbqdfXO52si+nmlS2gVgXXEN4=
 			</data>
 			<key>hash2</key>
 			<data>
-			GfS4+ScTn233MwqT18qLBXcX4Y1TClZTntUE75vTPwY=
+			DzpiBgAOKtgBBasPN6omeqK0Twl09xqBD3H0phK1HcU=
 			</data>
 		</dict>
 		<key>Resources/CPDFUnlockViewController.nib/keyedobjects-101300.nib</key>
 		<dict>
 			<key>hash</key>
 			<data>
-			ULC3lJLcrnOnCBivTpSe8w8O/VQ=
+			WWbJH/mkNN2q0uLETXjvlNRlcAQ=
 			</data>
 			<key>hash2</key>
 			<data>
-			WE60TS6kbusEaTyP03p7VENFKl+sD8oqeeumuSb/Kyw=
+			VhdkFTWYOUDHoZdvkZgwIgVNDt8Vj7h0sUxpPKvyjGw=
 			</data>
 		</dict>
 		<key>Resources/CPDFUnlockViewController.nib/keyedobjects.nib</key>
 		<dict>
 			<key>hash</key>
 			<data>
-			0H15nmzgJVoRpoNxPw6ZO38r4Xs=
+			dRWDU96uUk0Hy6R6fw3WiuV5+Tc=
 			</data>
 			<key>hash2</key>
 			<data>
-			crpgU0SlPe67g5lOUe+Pn4AZLeVkBFKS9oSX5WNWDjo=
+			8puPkEjA9zB7vITJGCll+ZMXd+s8tKMT/p5YgHr/z3g=
 			</data>
 		</dict>
 		<key>Resources/Cert/0d264c89.0</key>
@@ -1175,22 +1186,22 @@
 		<dict>
 			<key>hash</key>
 			<data>
-			p7wBZGU82/JlEY1jvDNEA9abznE=
+			l06W1gff2/uygg0wyZnBzGkBRf4=
 			</data>
 			<key>hash2</key>
 			<data>
-			9LeVGnRWRPYSgb52Rk6dAllIecNijkAcWoSz+EyD+Qc=
+			JKxh92/g+tdQbh/croSj/Ua2nJqkEf6TsNg86gvvNEM=
 			</data>
 		</dict>
 		<key>Resources/default.metallib</key>
 		<dict>
 			<key>hash</key>
 			<data>
-			jzLBEgCveMkMFXwcYUGaOyq4TKI=
+			PWgVqT4CtBAWiJxWMT4peo9xRa4=
 			</data>
 			<key>hash2</key>
 			<data>
-			Jk0Hy+FQsbG3BwetLpjotIY/w8Oqm9cX+sP+Qc1ZOQw=
+			c9ASF45+FqyvK6yt+pau86rzg7KJekcYdRY7lglPRs4=
 			</data>
 		</dict>
 		<key>Resources/empty_password.png</key>

+ 106 - 106
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/LeftSideView.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment version="1070" identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="Named colors" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -116,7 +116,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameEmptySearch" id="iTU-Mu-Ivw"/>
                                             </imageView>
-                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="goc-q3-DCs">
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="goc-q3-DCs">
                                                 <rect key="frame" x="58" y="0.0" width="41" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="20" id="kF2-kX-RYZ"/>
@@ -200,7 +200,7 @@
                                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="VNq-HZ-C3b">
                                                             <rect key="frame" x="73" y="17" width="33" height="29"/>
                                                             <subviews>
-                                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Thb-0O-0yD">
+                                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Thb-0O-0yD">
                                                                     <rect key="frame" x="-2" y="0.0" width="37" height="15"/>
                                                                     <constraints>
                                                                         <constraint firstAttribute="height" constant="14.5" id="dsA-C5-hfY"/>
@@ -211,7 +211,7 @@
                                                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                     </textFieldCell>
                                                                 </textField>
-                                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qOa-Jf-kcJ">
+                                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qOa-Jf-kcJ">
                                                                     <rect key="frame" x="-2" y="15" width="37" height="14"/>
                                                                     <constraints>
                                                                         <constraint firstAttribute="height" constant="14.5" id="gtw-n0-cDW"/>
@@ -310,7 +310,7 @@
                                         <rect key="frame" x="11" y="0.0" width="255" height="40"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
-                                            <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Jau-cO-5Ol">
+                                            <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Jau-cO-5Ol">
                                                 <rect key="frame" x="0.0" y="13" width="211" height="15"/>
                                                 <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Table View Cell" id="2u5-pC-7K9">
                                                     <font key="font" metaFont="cellTitle"/>
@@ -321,7 +321,7 @@
                                                     </connections>
                                                 </textFieldCell>
                                             </textField>
-                                            <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="qjX-Uj-T3m">
+                                            <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="qjX-Uj-T3m">
                                                 <rect key="frame" x="212" y="13" width="43" height="15"/>
                                                 <constraints>
                                                     <constraint firstAttribute="width" constant="39" id="lYn-PW-tOw"/>
@@ -371,7 +371,7 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <clipView key="contentView" drawsBackground="NO" id="LIi-mQ-ZiW">
                 <rect key="frame" x="0.0" y="0.0" width="204" height="400"/>
-                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="40" viewBased="YES" id="111" customClass="KMBotaTableView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="204" height="400"/>
@@ -396,7 +396,7 @@
                                         <rect key="frame" x="10" y="1" width="128" height="40"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
-                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="QCf-DA-Ep5">
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="QCf-DA-Ep5">
                                                 <rect key="frame" x="-2" y="5" width="132" height="30"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="30" id="aeE-Zj-40Z"/>
@@ -435,7 +435,7 @@
                                         <rect key="frame" x="138" y="1" width="56" height="40"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
-                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aMp-rS-uGn">
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aMp-rS-uGn">
                                                 <rect key="frame" x="0.0" y="0.0" width="56" height="30"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                 <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="10000" id="fJk-rj-99q">
@@ -474,7 +474,7 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <clipView key="contentView" drawsBackground="NO" id="4hs-Ss-bnw">
                 <rect key="frame" x="0.0" y="0.0" width="223" height="400"/>
-                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" columnReordering="NO" columnResizing="NO" autosaveColumns="NO" typeSelect="NO" rowSizeStyle="automatic" viewBased="YES" id="128" customClass="KMBotaTableView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="223" height="400"/>
@@ -496,7 +496,7 @@
                                         <rect key="frame" x="11" y="1" width="122" height="17"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
-                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GUZ-oY-a1n">
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GUZ-oY-a1n">
                                                 <rect key="frame" x="0.0" y="1" width="122" height="16"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                 <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="lho-ux-z3n">
@@ -529,7 +529,7 @@
                                         <rect key="frame" x="136" y="1" width="54" height="17"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
-                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Wak-VN-Wb6">
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Wak-VN-Wb6">
                                                 <rect key="frame" x="0.0" y="1" width="54" height="16"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                 <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="f7e-Zk-8vT">
@@ -624,52 +624,52 @@
             <subviews>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GOJ-Qf-Ke3">
                     <rect key="frame" x="186" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarMoreNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="E0s-hP-bFq">
-                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
                     <constraints>
                         <constraint firstAttribute="width" constant="24" id="0SA-7D-AtK"/>
                         <constraint firstAttribute="height" constant="24" id="oCe-eC-P7g"/>
                     </constraints>
-                </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dAD-27-KvU">
-                    <rect key="frame" x="158" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarSearchNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="eiz-lk-Rph">
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarMoreNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="E0s-hP-bFq">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dAD-27-KvU">
+                    <rect key="frame" x="158" y="8" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="WBX-JR-jPB"/>
                         <constraint firstAttribute="width" constant="24" id="k1G-tK-0RS"/>
                     </constraints>
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarSearchNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="eiz-lk-Rph">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
                     <connections>
                         <action selector="snapshotNormalSearchButtonAction:" target="-2" id="f7f-uQ-mN8"/>
                     </connections>
                 </button>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NpN-wz-Vyd">
                     <rect key="frame" x="130" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoominNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="Wfh-ap-Fng">
-                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
                     <constraints>
                         <constraint firstAttribute="width" constant="24" id="Nnx-4K-Of5"/>
                         <constraint firstAttribute="height" constant="24" id="ZGK-s1-R6D"/>
                     </constraints>
-                </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DkM-JB-LDl">
-                    <rect key="frame" x="102" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoomoutNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="RO7-Gb-Amh">
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoominNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="Wfh-ap-Fng">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DkM-JB-LDl">
+                    <rect key="frame" x="102" y="8" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="MVd-g4-RdE"/>
                         <constraint firstAttribute="width" constant="24" id="UCK-4j-jfd"/>
                     </constraints>
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoomoutNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="RO7-Gb-Amh">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
                 </button>
-                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hab-Lm-vgq">
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hab-Lm-vgq">
                     <rect key="frame" x="14" y="12" width="4" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" id="5Os-Lo-Gi1">
                         <font key="font" metaFont="system" size="14"/>
@@ -677,7 +677,7 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <searchField wantsLayer="YES" focusRingType="none" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="irK-sg-vP0" customClass="KMLeftSideViewSearchField" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <searchField wantsLayer="YES" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="irK-sg-vP0" customClass="KMLeftSideViewSearchField" customModule="PDF_Reader_Pro" customModuleProvider="target">
                     <rect key="frame" x="16" y="10" width="148" height="20"/>
                     <searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="border" usesSingleLineMode="YES" id="kRD-Z2-HfO">
                         <font key="font" metaFont="system"/>
@@ -687,35 +687,35 @@
                 </searchField>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Eod-4a-bTt">
                     <rect key="frame" x="16" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoominNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="ctc-Rp-d2V">
-                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="9ad-UY-lwq"/>
                         <constraint firstAttribute="width" constant="24" id="vZ9-Hm-I6n"/>
                     </constraints>
-                </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bWl-Nk-NDn">
-                    <rect key="frame" x="44" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoomoutNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="hQs-MM-x0h">
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoominNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="ctc-Rp-d2V">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bWl-Nk-NDn">
+                    <rect key="frame" x="44" y="8" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="24" id="ab8-9d-R0k"/>
                         <constraint firstAttribute="height" constant="24" id="cqT-3l-Ykf"/>
                     </constraints>
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoomoutNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="hQs-MM-x0h">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
                 </button>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mmh-ag-0z9">
                     <rect key="frame" x="172" y="10" width="42" height="20"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="20" id="dFp-ir-p4o"/>
+                    </constraints>
                     <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="Tfj-vg-1m0">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="cellTitle"/>
                     </buttonCell>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="20" id="dFp-ir-p4o"/>
-                    </constraints>
                 </button>
             </subviews>
             <constraints>
@@ -748,41 +748,41 @@
             <subviews>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BWq-cj-uIQ">
                     <rect key="frame" x="186" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarMoreNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="QgH-GX-ag4">
-                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="arw-m8-Woh"/>
                         <constraint firstAttribute="width" constant="24" id="coU-Ui-Fjb"/>
                     </constraints>
-                </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Uob-fO-6Nz">
-                    <rect key="frame" x="158" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarAddNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="Sic-Pv-Oul">
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarMoreNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="QgH-GX-ag4">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Uob-fO-6Nz">
+                    <rect key="frame" x="158" y="8" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="24" id="cmV-HJ-q5H"/>
                         <constraint firstAttribute="height" constant="24" id="lyW-IA-ykE"/>
                     </constraints>
-                </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="H8c-UN-cUJ">
-                    <rect key="frame" x="130" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarSearchNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="NMQ-2N-WHy">
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarAddNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="Sic-Pv-Oul">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="H8c-UN-cUJ">
+                    <rect key="frame" x="130" y="8" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="LhX-Fg-rZI"/>
                         <constraint firstAttribute="width" constant="24" id="cEH-oN-yaR"/>
                     </constraints>
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarSearchNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="NMQ-2N-WHy">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
                     <connections>
                         <action selector="outlineNormalSearchButtonAction:" target="-2" id="aBj-lz-PpP"/>
                     </connections>
                 </button>
-                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aeg-9J-Ftu">
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aeg-9J-Ftu">
                     <rect key="frame" x="14" y="12" width="4" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" id="geD-uQ-hUf">
                         <font key="font" metaFont="system" size="14"/>
@@ -790,7 +790,7 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <searchField wantsLayer="YES" focusRingType="none" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AS4-Jb-aDv" customClass="KMLeftSideViewSearchField" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <searchField wantsLayer="YES" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AS4-Jb-aDv" customClass="KMLeftSideViewSearchField" customModule="PDF_Reader_Pro" customModuleProvider="target">
                     <rect key="frame" x="16" y="10" width="148" height="20"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="20" id="FCx-Tg-Y3q"/>
@@ -803,13 +803,13 @@
                 </searchField>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WcK-HN-UBv">
                     <rect key="frame" x="172" y="10" width="42" height="20"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="20" id="5by-2A-4Jk"/>
+                    </constraints>
                     <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="nnv-UC-Zqf">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="cellTitle"/>
                     </buttonCell>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="20" id="5by-2A-4Jk"/>
-                    </constraints>
                 </button>
             </subviews>
             <constraints>
@@ -836,41 +836,41 @@
             <subviews>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bER-7Y-Kx7">
                     <rect key="frame" x="186" y="32" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarMoreNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="3Tn-r6-YfJ">
-                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="LA5-nZ-RsR"/>
                         <constraint firstAttribute="width" constant="24" id="Y1E-YP-6Jl"/>
                     </constraints>
-                </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gnC-Ef-ofc">
-                    <rect key="frame" x="158" y="32" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarFilterNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="9zX-E3-KsO">
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarMoreNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="3Tn-r6-YfJ">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gnC-Ef-ofc">
+                    <rect key="frame" x="158" y="32" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="DQM-Wb-LJn"/>
                         <constraint firstAttribute="width" constant="24" id="P3e-XB-OWJ"/>
                     </constraints>
-                </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aJQ-Wk-XIN">
-                    <rect key="frame" x="126" y="32" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarSearchNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="2Ad-tv-8Kw">
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarFilterNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="9zX-E3-KsO">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aJQ-Wk-XIN">
+                    <rect key="frame" x="126" y="32" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="JH6-hQ-mtC"/>
                         <constraint firstAttribute="width" constant="24" id="KCc-LE-03R"/>
                     </constraints>
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarSearchNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="2Ad-tv-8Kw">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
                     <connections>
                         <action selector="noteSearchAction:" target="-2" id="Xvb-SD-gVg"/>
                     </connections>
                 </button>
-                <searchField wantsLayer="YES" focusRingType="none" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9hT-ge-tuO" customClass="KMLeftSideViewSearchField" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <searchField wantsLayer="YES" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9hT-ge-tuO" customClass="KMLeftSideViewSearchField" customModule="PDF_Reader_Pro" customModuleProvider="target">
                     <rect key="frame" x="16" y="34" width="148" height="20"/>
                     <searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="border" usesSingleLineMode="YES" id="iP2-TC-BR6">
                         <font key="font" metaFont="system"/>
@@ -878,7 +878,7 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </searchFieldCell>
                 </searchField>
-                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="prI-y8-teC">
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="prI-y8-teC">
                     <rect key="frame" x="14" y="36" width="4" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" id="ZKv-SY-CIA">
                         <font key="font" metaFont="system" size="14"/>
@@ -895,7 +895,7 @@
                                 <rect key="frame" x="0.0" y="0.0" width="51" height="24"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
-                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AP9-fE-Owg">
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AP9-fE-Owg">
                                         <rect key="frame" x="-2" y="5" width="39" height="15"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Label" id="Vdb-Yo-ulT">
                                             <font key="font" metaFont="cellTitle"/>
@@ -923,14 +923,14 @@
                         </box>
                         <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1iN-nw-tgx">
                             <rect key="frame" x="190" y="4" width="16" height="16"/>
-                            <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" image="KMImageNameBtnSidebarRankPositive" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="J6x-Dw-4uu">
-                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                <font key="font" metaFont="system"/>
-                            </buttonCell>
                             <constraints>
                                 <constraint firstAttribute="height" constant="16" id="60s-pY-OKe"/>
                                 <constraint firstAttribute="width" constant="16" id="e6a-BM-t0s"/>
                             </constraints>
+                            <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" image="KMImageNameBtnSidebarRankPositive" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="J6x-Dw-4uu">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
                             <connections>
                                 <action selector="noteSortAction:" target="-2" id="1Iz-gH-dPX"/>
                             </connections>
@@ -947,13 +947,13 @@
                 </customView>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TX7-cB-bnj">
                     <rect key="frame" x="172" y="34" width="42" height="20"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="20" id="4mo-xc-VFx"/>
+                    </constraints>
                     <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="6S5-6Y-Gjp">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="cellTitle"/>
                     </buttonCell>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="20" id="4mo-xc-VFx"/>
-                    </constraints>
                 </button>
             </subviews>
             <constraints>
@@ -983,27 +983,27 @@
             <subviews>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uAv-uK-Gpd">
                     <rect key="frame" x="186" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoominNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="G4E-Cs-Ymb">
-                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
                     <constraints>
                         <constraint firstAttribute="width" constant="24" id="JDS-gL-KWj"/>
                         <constraint firstAttribute="height" constant="24" id="yMb-7Y-dC7"/>
                     </constraints>
-                </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bce-SO-Ct8">
-                    <rect key="frame" x="158" y="8" width="24" height="24"/>
-                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoomoutNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="OLC-HS-7h4">
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoominNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="G4E-Cs-Ymb">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bce-SO-Ct8">
+                    <rect key="frame" x="158" y="8" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="Wvw-lr-sEH"/>
                         <constraint firstAttribute="width" constant="24" id="gRd-6B-0QT"/>
                     </constraints>
+                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="KMImageNameUXIconBtnSidebarZoomoutNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="OLC-HS-7h4">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
                 </button>
-                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4v1-rQ-o49">
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4v1-rQ-o49">
                     <rect key="frame" x="14" y="12" width="4" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" id="Yzf-Uc-Gp1">
                         <font key="font" metaFont="system" size="14"/>
@@ -1027,7 +1027,7 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="adc-31-u6a">
                 <rect key="frame" x="0.0" y="0.0" width="233" height="409"/>
-                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" tableStyle="plain" selectionHighlightStyle="none" columnReordering="NO" columnResizing="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="103" rowSizeStyle="automatic" viewBased="YES" id="EZk-9w-Qcv" customClass="KMBotaTableView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="233" height="409"/>
@@ -1061,7 +1061,7 @@
                                                             </constraints>
                                                             <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="wME-Iq-UtB"/>
                                                         </imageView>
-                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RPy-lg-w53">
+                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RPy-lg-w53">
                                                             <rect key="frame" x="99" y="16" width="33" height="16"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="height" constant="16" id="RXn-Cw-cHH"/>
@@ -1129,7 +1129,7 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="z3N-jy-sfp">
                 <rect key="frame" x="0.0" y="0.0" width="251" height="429"/>
-                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <outlineView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" tableStyle="plain" typeSelect="NO" autosaveName="KMNoteOutlineView" rowHeight="92" usesAutomaticRowHeights="YES" viewBased="YES" indentationPerLevel="16" outlineTableColumn="yso-Z1-ZNZ" id="ZeT-gb-jMM" customClass="KMNoteOutlineView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="251" height="429"/>
@@ -1164,7 +1164,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="Q6w-Zg-QPD"/>
                                                     </imageView>
-                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pnF-AX-GzW">
+                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pnF-AX-GzW">
                                                         <rect key="frame" x="57" y="4" width="37" height="16"/>
                                                         <constraints>
                                                             <constraint firstAttribute="width" constant="33" id="RUe-fo-jZ0"/>
@@ -1175,7 +1175,7 @@
                                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                         </textFieldCell>
                                                     </textField>
-                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nWk-O1-Rta">
+                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nWk-O1-Rta">
                                                         <rect key="frame" x="24" y="5" width="33" height="14"/>
                                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="7cB-pn-RJG">
                                                             <font key="font" metaFont="smallSystem"/>
@@ -1194,7 +1194,7 @@
                                                     <constraint firstItem="pnF-AX-GzW" firstAttribute="leading" secondItem="nWk-O1-Rta" secondAttribute="trailing" constant="4" id="mVE-4y-n0N"/>
                                                 </constraints>
                                             </customView>
-                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pnc-2Q-X2x">
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pnc-2Q-X2x">
                                                 <rect key="frame" x="179" y="62" width="34" height="15"/>
                                                 <constraints>
                                                     <constraint firstAttribute="width" constant="30" id="ns3-Zn-Vcw"/>
@@ -1210,14 +1210,14 @@
                                                 <subviews>
                                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8iM-cD-LbJ">
                                                         <rect key="frame" x="0.0" y="43" width="16" height="16"/>
-                                                        <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" image="KMImageNameBtnTriRightNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="RBQ-ie-wZI">
-                                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                                            <font key="font" metaFont="system"/>
-                                                        </buttonCell>
                                                         <constraints>
                                                             <constraint firstAttribute="width" constant="16" id="Abn-23-jdo"/>
                                                             <constraint firstAttribute="height" constant="16" id="eGm-Gc-P4u"/>
                                                         </constraints>
+                                                        <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" image="KMImageNameBtnTriRightNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="RBQ-ie-wZI">
+                                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                            <font key="font" metaFont="system"/>
+                                                        </buttonCell>
                                                         <connections>
                                                             <action selector="foldButtonAction:" target="3TS-lp-G7v" id="M0z-us-lv2"/>
                                                         </connections>
@@ -1228,7 +1228,7 @@
                                                             <rect key="frame" x="1" y="1" width="201" height="26"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                             <subviews>
-                                                                <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="hDI-gM-mdu">
+                                                                <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="hDI-gM-mdu">
                                                                     <rect key="frame" x="5" y="5" width="195" height="17"/>
                                                                     <constraints>
                                                                         <constraint firstAttribute="height" constant="17" id="KpE-VJ-Nbx"/>
@@ -1248,7 +1248,7 @@
                                                             </constraints>
                                                         </view>
                                                     </box>
-                                                    <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="ItP-E5-6eI">
+                                                    <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="ItP-E5-6eI">
                                                         <rect key="frame" x="14" y="44" width="196" height="17"/>
                                                         <constraints>
                                                             <constraint firstAttribute="width" constant="192" id="i3V-IY-30U"/>
@@ -1281,14 +1281,14 @@
                                             </imageView>
                                             <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="btZ-nY-HvQ" customClass="KMCoverButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                 <rect key="frame" x="219" y="83" width="20" height="20"/>
-                                                <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="fMn-4J-1vB">
-                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                                    <font key="font" metaFont="system"/>
-                                                </buttonCell>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="20" id="VQf-ZS-nJ6"/>
                                                     <constraint firstAttribute="width" constant="20" id="wWI-DF-xK0"/>
                                                 </constraints>
+                                                <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="fMn-4J-1vB">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="system"/>
+                                                </buttonCell>
                                             </button>
                                         </subviews>
                                         <constraints>

+ 52 - 242
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -345,17 +345,7 @@ extension KMMainViewController {
         _ = stypeMenu.addItem(withTitle: NSLocalizedString("Link", comment: ""), action: #selector(changeAnnotationMode_itemAction), target: self, tag: CAnnotationType.link.rawValue)
         
         stypItem.submenu = stypeMenu
-        if self.toolbarController.toolbarType == .Annatiton {
-            stypeMenu.item(at: 0)?.state = .on
-        } else if self.toolbarController.toolbarType == .Move {
-            stypeMenu.item(at: 1)?.state = .on
-        } else if self.toolbarController.toolbarType == .Magnify {
-            stypeMenu.item(at: 2)?.state = .on
-        } else if self.toolbarController.toolbarType == .Select {
-            stypeMenu.item(at: 3)?.state = .on
-        } else if self.toolbarController.toolbarType == .SelectZoom {
-            stypeMenu.item(at: 4)?.state = .on
-        }
+         
         return stypItem
     }
     
@@ -468,11 +458,7 @@ extension KMMainViewController {
         let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Rotate Left", comment: ""), action: #selector(rotateLeftAction), target: self, tag: 0)
         let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Rotate Right", comment: ""), action: #selector(rotateRightAction), target: self, tag: 1)
         stypItem.submenu = stypeMenu
-        if self.toolbarController.toolbarType == .Annatiton {
-            stypeMenu.item(at: 0)?.state = .on
-        } else if self.toolbarController.toolbarType == .Move {
-            stypeMenu.item(at: 1)?.state = .on
-        }
+        
         return stypItem
     }
     func setNextPageStype() -> NSMenuItem {
@@ -745,17 +731,10 @@ extension KMMainViewController {
         point = point2
         if sender.tag == 0 {
             KMPrint("添加文字")
-            let isSelect = self.toolbarController.findItem(KMToolbarAddTextEditPDFItemIdentifier)?.isSelected ?? false
-            if !isSelect {
-                self.toolbarController.selectItem(KMToolbarAddTextEditPDFItemIdentifier)
-            }
+           
             
         } else if sender.tag == 1 {
-            KMPrint("添加图片")
-            let isSelect = self.toolbarController.findItem(KMToolbarAddImageEditPDFItemIdentifier)?.isSelected ?? false
-            if !isSelect {
-                self.toolbarController.selectItem(KMToolbarAddImageEditPDFItemIdentifier)
-            }
+            
         } else if sender.tag == 2 {
             KMPrint("粘贴")
         }
@@ -913,8 +892,7 @@ extension KMMainViewController {
         default:
             break
         }
-        let item : KMToolbarItemView = (self.toolbarController.mainToolBarView?.toolbarItemFindItemIdentifiers(value: identifier))!
-        self.toolbarController.mainToolBarView?.delegate?.toolbarViewController?(self.toolbarController.mainToolBarView!, clickMode:model, toolbar: item, [])
+       
     }
     
     @objc func changeAnnotationMode_itemAction(sender : NSMenuItem) {
@@ -944,9 +922,6 @@ extension KMMainViewController {
         } else if sender.tag == CAnnotationType.link.rawValue {
             itemId = KMToolbarLinkAnnotationItemIdentifier
         }
-        if let data = itemId {
-            self.toolbarController.clickItem(data)
-        }
     }
     
     @objc func menuItemAnnotationClick_add(sender : NSMenuItem) {
@@ -994,7 +969,7 @@ extension KMMainViewController {
         
         // link
         let selection = self.listView.currentSelection
-        self.toolbarController.selectItem(KMToolbarLinkAnnotationItemIdentifier)
+        
         DispatchQueue.main.async {
             Task { @MainActor in
                 let annotation = self.listView.addAnnotation(with: annotationType, selection: selection, page: selection?.page, bounds: selection!.bounds)
@@ -1081,18 +1056,12 @@ extension KMMainViewController {
                 self.rightSideViewController.subViewType = .AnnotationProperts
             } else {
                 if (sender.tag == 7 || sender.tag == 8 || sender.tag == 9) { // Ink & Link & stamp & sign
-                    if(self.toolbarController.toolbarType == .None) {
-                        self.toolbarController.toolbarType = .Annatiton
-                    }
+                  
                     self.listView.toolMode = .noteToolMode
                 }
                 switch sender.tag {
                 case 0:
-                    self.toolbarController.ignoreCurrentAnnotationTypeChange = true
-                    self.model.rightMouseEventing = true
-                    if(self.toolbarController.toolbarType == .None) {
-                        self.toolbarController.toolbarType = .Annatiton
-                    }
+                     
                     self.listView.toolMode = .noteToolMode
                     
                     self.listView.annotationType = CAnnotationType.ink
@@ -2214,16 +2183,14 @@ extension KMMainViewController {
         self.model.leftPanelOpen = true
         applyLeftSideWidth(self.model.panelWidth+functionWidth, rightSideWidth: self.model.lastRightPanWidth)
         
-        self.toolbarController.findItem(KMLeftControlToolbarItemIdentifier)?.isSelected = true
-    }
+     }
     
     // 关闭左边栏
     @objc func closeLeftPane() -> Void {
         self.model.leftPanelOpen = false
         applyLeftSideWidth(functionWidth, rightSideWidth: self.model.lastRightPanWidth)
         
-        self.toolbarController.findItem(KMLeftControlToolbarItemIdentifier)?.isSelected = false
-    }
+     }
     
     // 开启/关闭右边栏
     @objc func toggleRightPane() -> Void {
@@ -2242,7 +2209,6 @@ extension KMMainViewController {
                 return
             }
             self.model.rightPanelIsOpen = true
-            self.toolbarController.selectItem(KMRightControlToolbarItemIdentifier)
             applyLeftSideWidth(self.model.lastLeftPanWidth, rightSideWidth: self.model.defaultRightWidth)
         }
     }
@@ -2250,8 +2216,7 @@ extension KMMainViewController {
     @objc func closeRightPane() -> Void {
         if (KMPreferenceManager.shared.autoExpandPropertyPanel) {
             self.model.rightPanelIsOpen = false
-            self.toolbarController.cancelSelected(KMRightControlToolbarItemIdentifier)
-            applyLeftSideWidth(self.model.lastLeftPanWidth, rightSideWidth: 0)
+             applyLeftSideWidth(self.model.lastLeftPanWidth, rightSideWidth: 0)
             cancelMeasureType()
         }
     }
@@ -2380,8 +2345,7 @@ extension KMMainViewController {
         }
         self.listView.setNeedsDisplayAnnotationViewForVisiblePages()
         
-        self.toolbarController.isShowAllAnnotations = !self.listView.hideNotes
-        
+ 
         self.leftSideViewController.note_reloadDataIfNeed()
     }
     
@@ -2473,15 +2437,13 @@ extension KMMainViewController {
         
         self.compressWIndowControllerNew?.itemClick = { [unowned self] in
             self.view.window?.endSheet((self.compressWIndowControllerNew?.window)!)
-            
-            self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
+             
         }
         
         self.compressWIndowControllerNew?.batchAction = { [unowned self] view, filePaths in
             self.view.window?.endSheet((self.compressWIndowControllerNew?.window)!)
             
-            self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
-            
+ 
             let batchWindowController = KMBatchOperateWindowController.sharedWindowController
             let batchOperateFile = KMBatchOperateFile(filePath: filePaths.first!.path, type: .Compress)
             batchWindowController.switchToOperateType(KMBatchOperationType.Compress, files: [batchOperateFile])
@@ -2491,8 +2453,7 @@ extension KMMainViewController {
         self.compressWIndowControllerNew?.resultCallback = { [unowned self] result, openDocument, fileURL, error in
             self.view.window?.endSheet((self.compressWIndowControllerNew?.window)!)
             if (result) {
-                self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
-                
+ 
                 if (openDocument) {
                     NSDocumentController.shared.openDocument(withContentsOf: fileURL, display: true) { document, result, error in }
                 } else {
@@ -2680,13 +2641,7 @@ extension KMMainViewController {
     func showOCRWindow() {
         if !IAPProductsManager.default().isAvailableAllFunction(){
             let winC = KMPurchaseCompareWindowController.sharedInstance()
-            let type = self.toolbarController.toolbarType ?? .None
-            if type == .Conversion {
-                winC?.kEventName = "Reading_Convert_OCR_BuyNow"
-            } else {
-                winC?.kEventName = "Reading_OCR_BuyNow"
-            }
-            winC?.showWindow(nil)
+             winC?.showWindow(nil)
             return
         }
         let com = KMOCRPDFWindowController(cpdfDocument: self.listView.document!, pwd: self.listView.document?.password ?? "")
@@ -2963,37 +2918,17 @@ extension KMMainViewController {
     @IBAction func secondaryViewOpenFile(_ sender: NSButton) -> Void {
         
     }
-    
-    @objc func removeSecondaryPdfContentView(_ sender: Notification?) {
-        if let _ = sender {
-            NotificationCenter.default.removeObserver(self, name: KMSplitView.animationDidEndNotification, object: self.newPDFSplitView)
-        }
-        self.secondaryPdfContentView?.removeFromSuperview()
-        self.newPDFSplitView.adjustSubviews()
-    }
+     
     
     func singlePageScreen(isSinglePage: Bool, doublePagesScreen isHorizontal: Bool) -> Void {
       
     }
      
-    
-    func lastSplitPDFHeightFloat(_ rect: NSRect) -> Float {
-        if (self.newPDFSplitView.isVertical) {
-            return Float(NSWidth(rect))
-        } else {
-            return Float(NSHeight(rect))
-        }
-    }
+     
     
     
     func updateBackAndForwardButtonState() {
-        let toItem = self.toolbarController.mainToolBarView?.toolbarItemFindItemIdentifiers(value: KMDocumentPreviousPageToolbarItemIdentifier)
-        if self.listView.km_canGoForward() {
-            toItem?.unEnabled = false
-        } else {
-            toItem?.unEnabled = true
-        }
-    }
+     }
 }
 
 // MARK: -
@@ -3003,7 +2938,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
     func changeModelAction(mode: CToolMode) {
         self.listView.toolMode = mode
         if mode == .editPDFToolMode {
-            self.childToolbarController.updateType(newType: .editPDF)
+
         }
     }
     
@@ -3098,59 +3033,12 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
     }
     
     func changePDFViewZoomInAction() {
-        let zoomSting = self.toolbarController.mainToolBarView?.zoomTextField.stringValue ?? "10"
-        var scale = CGFloat((NSString(string: zoomSting)).floatValue / 100.0)
-        switch scale {
-        case 0...0.25:
-            scale += 0.25
-        case 0.25...3:
-            scale += 0.25
-        case 3.1...10:
-            scale += 0.4
-        case 10.1...100:
-            scale += 1
-        default:
-            scale += 1
-        }
-        self.listView.scaleFactor = scale
-        // nearbyint
-        self.toolbarController.mainToolBarView?.zoomTextField.stringValue =  "\(Int(self.listView.scaleFactor*100))%"
+         
         
-        if self.digitalSignController?.pdfView != nil {
-            self.digitalSignController?.pdfView.scaleFactor = scale
-        }
-        if self.redactController?.redactPdfView != nil {
-            self.redactController?.redactPdfView.scaleFactor = scale
-        }
     }
     
     func changePDFViewZoomOutAction() {
-        let zoomSting = self.toolbarController.mainToolBarView?.zoomTextField.stringValue ?? "10"
-        var scale = CGFloat((NSString(string: zoomSting)).floatValue / 100.0)
-        switch scale {
-        case 0...0.25:
-            scale = 0
-        case 0.25...3:
-            scale -= 0.25
-        case 3.1...10:
-            scale -= 0.4
-        case 10.1...100:
-            scale -= 1
-        default:
-            scale -= 1
-        }
-        self.listView.scaleFactor = scale
-        // nearbyint
-        self.toolbarController.mainToolBarView?.zoomTextField.stringValue =  "\(Int(self.listView.scaleFactor*100))%"
-        
-        if self.digitalSignController?.pdfView != nil {
-            self.digitalSignController?.pdfView.scaleFactor = scale
-        }
-        if self.redactController?.redactPdfView != nil {
-            self.redactController?.redactPdfView.scaleFactor = scale
-        }
-        
-        self.savePageNumberIfNeed()
+         
         
         
     }
@@ -3272,8 +3160,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
             }
         }
         if item.itemIdentifier != KMDocumentViewDisplayToolbarItemIdentifier {
-            self.toolbarController.findItem(KMDocumentViewDisplayToolbarItemIdentifier)?.isSelected = false
-        }
+         }
         
         if(type != .Form) {
             self.removeFromAlertView()
@@ -3299,7 +3186,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
             let isEdited = self.listView.isEdited()
             let isPDFTextImageEdited =  self.model.isPDFTextImageEdited
             if isEdited || isPDFTextImageEdited {
-                self.commitEditingIfNeed()
                 
                 self.enterRedact()
             } else {
@@ -3459,8 +3345,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     return
                 }
                 if (index == 1) { /// 取消
-                    self.toolbarController.exitWatermarkAdjective()
-                    self.rightSideViewController.isHidden = true
+                     self.rightSideViewController.isHidden = true
                     self.rightSideViewController.subViewType = .None
                     self.closeRightPane()
                     return
@@ -3585,13 +3470,11 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                         let result = alert.runModal()
                         if (result == .alertFirstButtonReturn) {
                             self.listView.toolMode = .moveToolMode
-                            self.toolbarController.exitRedact()
-                        }
+                         }
                         return
                     }
                     self.listView.toolMode = .moveToolMode
-                    self.toolbarController.exitRedact()
-                    return
+                     return
                 }
                 if (index == 2) { /// 擦除
                     self.exeRedactConfirm(.eraserAll) {}
@@ -3612,12 +3495,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     
                     windowController.itemClick = { [weak self] index, value in
                         if (index == 1) {
-                            let topBarView = self?.toolbarController.fetchTopBarView()
-                            if (topBarView == nil || topBarView?.isKind(of: KMRedactTopToolBar.self) == false) {
-                                return
-                            }
-                            (topBarView as! KMRedactTopToolBar).selectItem(0)
-                            self?.view.window?.endSheet((self?.currentWindowController.window)!)
+                             self?.view.window?.endSheet((self?.currentWindowController.window)!)
                             self?.currentWindowController = nil
                             return
                         }
@@ -3697,7 +3575,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                             self.view.window?.endSheet((self.currentWindowController.window)!)
                             self.currentWindowController = nil
                             
-                            self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
                             
                             let baseWindowController = KMBatchOperateBaseWindowController(windowNibName: "KMBatchOperateBaseWindowController")
                             if #available(macOS 10.13, *) {
@@ -3822,20 +3699,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                 }
                 
                 if index == 1 {
-                    self.watermarkWindowController = KMWatermarkWindowController(windowNibName: "KMWatermarkWindowController")
-                    self.watermarkWindowController!.pdfDocument = self.document
-                    
-                    self.watermarkWindowController!.cancelAction = { [unowned self] controller in
-                        self.km_endSheet()
-                    }
-                    
-                    self.watermarkWindowController!.operateCallBack = { [unowned self] controller, watermark, countType in
-                        self.km_endSheet()
-                        
-                        let fpath = self.document?.documentURL?.path ?? ""
-                        self.showBatchWindow(type: .AddWatermark, filepaths: [fpath])
-                    }
-                    self.km_beginSheet(windowC: self.watermarkWindowController!)
+                     
                 } else if index == 2 {
                     let watermarks = self.listView.document.watermarks()
                     if (watermarks == nil || watermarks!.count <= 0) {
@@ -4019,7 +3883,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     distanceMeasureInfoWindowController?.xLabel.stringValue = ""
                     distanceMeasureInfoWindowController?.yLabel.stringValue = ""
                     
-                    self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = true
                     
                     _ = CustomAlertView.alertView(message: "ESC to exit continuous measuring mode.", fromView: self.view, withStyle: .black)
                     
@@ -4036,7 +3899,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     perimeterMeasureInfoWindowController?.lengthLabel.stringValue = ""
                     perimeterMeasureInfoWindowController?.angleLabel.stringValue = ""
                     
-                    self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = true
                     
                     _ = CustomAlertView.alertView(message: "Double-click to finish drawing. Press ESC to exit continuous measuring mode.", fromView: self.view, withStyle: .black)
                     
@@ -4053,7 +3915,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     areaMeasureInfoWindowController?.areaLabel.stringValue = ""
                     areaMeasureInfoWindowController?.angleLabel.stringValue = ""
                     
-                    self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = true
                     
                     _ = CustomAlertView.alertView(message: "Double-click to finish drawing. Press ESC to exit continuous measuring mode.", fromView: self.view, withStyle: .black)
                     
@@ -4070,8 +3931,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     areaMeasureInfoWindowController?.areaLabel.stringValue = ""
                     areaMeasureInfoWindowController?.angleLabel.stringValue = ""
                     
-                    self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = true
-                    
                     _ = CustomAlertView.alertView(message: "ESC to exit continuous measuring mode.", fromView: self.view, withStyle: .black)
                     
                     self.trackEvent(toolMode: .measureToolMode)
@@ -4084,7 +3943,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                         areaMeasureInfoWindowController?.hideFloatingWindow()
                     }
                     
-                    self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = false
                 }
                 
                 self.rightSideViewController.reloadDataWithPDFView(pdfView: listView, isShow: true)
@@ -4116,15 +3974,13 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     self.changePDFViewGoToPreviousPageAction()
                 } else if toolbarItem.itemIdentifier == KMDocumentViewDisplayToolbarItemIdentifier {
                     let isSelected = toolbarItem.isSelected
-                    self.toolbarController.toolbarType = isSelected ? .None : .viewSetting
-                    toolbarItem.isSelected = !isSelected
+                     toolbarItem.isSelected = !isSelected
                     if toolbarItem.isSelected {
                         FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_PageDisplay", withProperties: ["SubTbr_Btn": "Btn_SubTbr_PageDisplay_ViewSetting"])
                         self.rightSideViewController.isHidden = false
                         self.rightSideViewController.mainController = self
                         self.rightSideViewController.subViewType = .ViewSettings
                         
-                        self.toolbarController.findItem(KMToolbarViewSettingIdentifier)?.isSelected = true
                         self.openRightPane()
                     }else{
                         self.rightSideViewController.isHidden = true
@@ -4134,13 +3990,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     if toolbarItem.isSelected {
                         FMTrackEventManager.defaultManager.trackEvent(event: "Tbr", withProperties: ["Tbr_Btn": "Btn_Tbr_PageDisplay"])
                     }
-                    let rightItem = self.toolbarController.findItem(KMRightControlToolbarItemIdentifier)
-                    if isSelected {
-                        rightItem?.isSelected = false
-                    } else {
-                        rightItem?.isSelected = true
-                    }
-                } else if toolbarItem.itemIdentifier == KMLeftControlToolbarItemIdentifier {
+                 } else if toolbarItem.itemIdentifier == KMLeftControlToolbarItemIdentifier {
                     toolbarItem.isSelected = !toolbarItem.isSelected
                     self.leftSideViewController.showPanelView(show: toolbarItem.isSelected)
                 } else if toolbarItem.itemIdentifier == KMRightControlToolbarItemIdentifier {
@@ -4168,8 +4018,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                         return
                     }
                     toolbarItem.isSelected = !toolbarItem.isSelected
-                    self.toolbarController.lastItemBox = toolbarItem
-                    if toolbarItem.isSelected {
+                     if toolbarItem.isSelected {
                         FMTrackEventManager.defaultManager.trackEvent(event: "Tbr", withProperties: ["Tbr_Btn": "Btn_Tbr_DigitalSignature"])
                     }
                     self.enterDigitalSign()
@@ -4179,24 +4028,17 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     self.togglePresentation(nil)
                 } else if itemID == KMDocumentSignToolbarItemIdentifier {
                     let isSelected = toolbarItem.isSelected
-                    self.toolbarController.toolbarType = isSelected ? .None : .sign
-                    toolbarItem.isSelected = !isSelected
-                    self.toolbarController.lastItemBox = toolbarItem
-                }
+                     toolbarItem.isSelected = !isSelected
+                 }
             } else {
                 if toolbarItem.itemIdentifier == KMToolbarAnnotationSettingItemIdentifier {
                     toolbarItem.isSelected = false
                     let windowC = KMToolbarCustomWindowController()
-                    windowC.toolbar = self.toolbarController.childToolBarView?.toolbar
-                    windowC.resetCallback = { [weak self] in
-                        let toolbar = self?.toolbarController.childToolBarView?.toolbar
-                        toolbar?.reloadData()
-                    }
+                     windowC.resetCallback = { [weak self] in
+                     }
                     self.km_beginSheet(windowC: windowC) { [weak self] resp, obj in
                         if resp == .OK {
-                            let toolbar = self?.toolbarController.childToolBarView?.toolbar
-                            toolbar?.reloadData()
-                        }
+                         }
                     }
                 } else if toolbarItem.itemIdentifier == KMToolbarComparisonItemIdentifier {
                     Swift.debugPrint("KMToolbarComparisonItemIdentifier ...")
@@ -4225,8 +4067,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                         self.rightSideViewController.mainController = self
                         self.rightSideViewController.subViewType = .ViewSettings
                         
-                        self.toolbarController.findItem(KMToolbarViewSettingIdentifier)?.isSelected = true
-                        self.openRightPane()
+                         self.openRightPane()
                     }else{
                         self.rightSideViewController.isHidden = true
                         self.rightSideViewController.subViewType = .AnnotationProperts
@@ -4259,8 +4100,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                         return
                     }
                     toolbarItem.isSelected = !toolbarItem.isSelected
-                    self.toolbarController.lastItemBox = toolbarItem
-                    if toolbarItem.isSelected {
+                     if toolbarItem.isSelected {
                         FMTrackEventManager.defaultManager.trackEvent(event: "Tbr", withProperties: ["Tbr_Btn": "Btn_Tbr_DigitalSignature"])
                     }
                     self.enterDigitalSign()
@@ -4315,8 +4155,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
     
     func handleTabbingLogic() {
         self.browserWindowController?.browser?.selectTabContents(at: 0, userGesture: true)
-        self.toolbarController.findItem(KMDocumentHomeToolbarItemIdentifier)?.isSelected = false
-    }
+     }
     
     func showTTSWindow() {
         var lastPDFView: CPDFView?
@@ -4387,8 +4226,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
             } else if index == 4 { // Auto Crop – Combined
                 self.auto_cropAllPage()
             } else if index == 5 { // Select Area
-                self.toolbarController.clickItem(KMToolbarSelectToolModeItemIdentifier)
-            }
+             }
             FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_PageDisplay", withProperties: ["SubTbr_Btn": "Btn_SubTbr_PageDisplay_Crop"])
         } else if (toolbarItem.itemIdentifier == KMToolbarToolSecureItemIdentifier) {
             self.clickChildTool(type: .secure, index: index)
@@ -4404,8 +4242,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     if toolMode == .editPDFToolMode && isEditing {
                         
                     } else { // 进入内容编辑模式
-                        self?.toolbarController.clickItem(KMDocumentEditToolbarItemIdentifier)
-                    }
+                     }
                 }
                 let point = toolbarItem.convert(toolbarItem.frame.origin, to: nil)
                 let x = point.x + (toolbarItem.window?.frame.origin.x ?? 0) - 200
@@ -4429,8 +4266,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                 if toolMode == .editPDFToolMode && isEditing {
                     
                 } else { // 进入内容编辑模式
-                    self.toolbarController.clickItem(KMDocumentEditToolbarItemIdentifier)
-                }
+                 }
                 
                 self.trackEvent_replace()
                 let winC = KMSearchReplaceWindowController(with: self.listView, type: .replace)
@@ -4441,8 +4277,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     if toolMode == .editPDFToolMode && isEditing {
                         
                     } else { // 进入内容编辑模式
-                        self?.toolbarController.clickItem(KMDocumentEditToolbarItemIdentifier)
-                    }
+                     }
                 }
                 
                 let point = toolbarItem.convert(toolbarItem.frame.origin, to: nil)
@@ -4453,14 +4288,12 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                 
                 winC.startModal(nil)
             } else {
-                self.toolbarController.showFindBar()
-            }
+             }
         } else if toolbarItem.itemIdentifier == KMRightControlToolbarItemIdentifier {
             toolbarItem.isSelected = !toolbarItem.isSelected
             self.toggleRightPane()
         } else if toolbarItem.itemIdentifier == KMDocumentViewDisplayToolbarItemIdentifier {
-            self.toolbarController.toolbarType = .viewSetting
-        } else if toolbarItem.itemIdentifier == KMToolbarConversionOCRIdentifier {
+         } else if toolbarItem.itemIdentifier == KMToolbarConversionOCRIdentifier {
             self.showOCRWindow()
         } else if toolbarItem.itemIdentifier == KMToolbarAIItemIdentifier {
             if index == 1 {
@@ -4475,13 +4308,10 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
         } else if toolbarItem.itemIdentifier == KMDocumentScanOCRToolbarItemIdentifier {
             self.showOCRWindow()
         } else if toolbarItem.itemIdentifier == KMDocumentEditToolbarItemIdentifier {
-            self.toolbarController.toolbarType = .editPDF
-            self.enterEditPDF()
+             self.enterEditPDF()
         } else if toolbarItem.itemIdentifier == KMDocumentFillSginToolbarItemIdentifier {
-            self.toolbarController.toolbarType = .FillSign
-        } else if toolbarItem.itemIdentifier == KMDocumentFormToolbarItemIdentifier {
-            self.toolbarController.toolbarType = .Form
-        } else if itemId == KMDocumentDigitalSignToolbarItemIdentifier {
+         } else if toolbarItem.itemIdentifier == KMDocumentFormToolbarItemIdentifier {
+         } else if itemId == KMDocumentDigitalSignToolbarItemIdentifier {
             if self.canEnterDigitalSign() == false {
                 Task {
                     _ = await KMAlertTool.runModel(message: NSLocalizedString("This is a secured document. Editing is not permitted.", comment: ""))
@@ -4489,8 +4319,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                 return
             }
             toolbarItem.isSelected = !toolbarItem.isSelected
-            self.toolbarController.lastItemBox = toolbarItem
-            if toolbarItem.isSelected {
+             if toolbarItem.isSelected {
                 FMTrackEventManager.defaultManager.trackEvent(event: "Tbr", withProperties: ["Tbr_Btn": "Btn_Tbr_DigitalSignature"])
             }
             self.enterDigitalSign()
@@ -4502,8 +4331,7 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                 return
             }
             toolbarItem.isSelected = !toolbarItem.isSelected
-            self.toolbarController.lastItemBox = toolbarItem
-            if toolbarItem.isSelected {
+             if toolbarItem.isSelected {
                 FMTrackEventManager.defaultManager.trackEvent(event: "Tbr", withProperties: ["Tbr_Btn": "Btn_Tbr_DigitalSignature"])
             }
             self.enterDigitalSign()
@@ -4818,19 +4646,7 @@ extension KMMainViewController {
     }
 }
 
-extension KMMainViewController: KMPageNumberDisplayViewDelegate {
-    func gotoPageIndex(view: KMPageNumberDisplayView, pageIndex: Int) {
-        self.listView.go(toPageIndex: pageIndex, animated: true)
-    }
-    
-    func updateWidth(view: KMPageNumberDisplayView, width: CGFloat) {
-        
-    }
-    
-    func commitEditingIfNeed() {
-        self.editPDFHanddler.commitEditing()
-    }
-}
+ 
 
 
 
@@ -5073,8 +4889,6 @@ extension KMMainViewController {
             view.removeFromSuperview()
         }
         
-        self.PDFContendView.addSubview(compareContentView)
-        compareContentView.frame = self.PDFContendView.bounds
         compareContentView.autoresizingMask = [.width,.height]
     }
     
@@ -5100,9 +4914,6 @@ extension KMMainViewController {
             }
         }
         
-        
-        self.PDFContendView.addSubview(coveringView)
-        coveringView.frame = self.PDFContendView.bounds
         coveringView.autoresizingMask = [.width,.height]
     }
     
@@ -5223,8 +5034,7 @@ extension KMMainViewController {
     
     @objc func purchaseStateUpdateNoti() {
         if IAPProductsManager.default().isAvailableAllFunction() {
-            KMAdsManager.defaultManager.dismissSheetModal(for: self.readContentView)
-        }
+         }
     }
     
     //!!!: - CPDFFreeTextAnnotation 空注释时会删除,删除时sdk内部删除的,只能接受通知来刷选UI【正常的注释删除会走两遍】

+ 51 - 189
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift

@@ -10,11 +10,11 @@ import Foundation
 // MARK: File Menu
 extension KMMainViewController {
     @IBAction func menuItemClick_mergePDF(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .merge, index: 0)
+
     }
     
     @IBAction func menuItemClick_Compress(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .compress, index: 0)
+
     }
     
     @IBAction func menuItemClick_Convert(_ sender: Any) {
@@ -22,43 +22,43 @@ extension KMMainViewController {
     }
     
     @IBAction func menuItemAction_ConvertToWord(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .word, index: 0)
+
     }
     
     @IBAction func menuItemAction_ConvertToExcel(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .excel, index: 0)
+
     }
     
     @IBAction func menuItemAction_ConvertToPPT(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .ppt, index: 0)
+
     }
     
     @IBAction func menuItemAction_ConvertToRTF(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .rtf, index: 0)
+
     }
     
     @IBAction func menuItemAction_ConvertToHTML(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .html, index: 0)
+
     }
     
     @IBAction func menuItemAction_ConvertToText(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .conversion_text, index: 0)
+
     }
     
     @IBAction func menuItemAction_ConvertToCSV(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .csv, index: 0)
+
     }
     
     @IBAction func menuItemAction_ConvertToImage(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .conversion_image, index: 0)
+
     }
     
     @IBAction func menuItemClick_SettingPassword(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .secure, index: 1)
+
     }
     
     @IBAction func menuItemClick_RemovePassword(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .secure, index: 2)
+
     }
     
     @IBAction func menuItemAction_closeWindow(_ sender: Any) {
@@ -104,8 +104,6 @@ extension KMMainViewController {
 extension KMMainViewController: KMEditMenuProtocol {
     @IBAction func menuItemAction_find(_ sender: Any) {
         if (self.leftSideViewController.isShowPanel) {
-            self.toolbarController.cancelSelected(KMLeftControlToolbarItemIdentifier)
-            self.toolbarController.toolbarType = .None
             self.leftSideViewController.showPanelView(show: false)
         }
         let isSearch = self.leftSideViewController.type.methodType == .Search
@@ -253,12 +251,10 @@ extension KMMainViewController {
         if (self.leftSideViewController.type.methodType != .None) {
             self.leftSideViewController.selectType(self.leftSideViewController.type.methodType)
         } else {
-            self.toolbarController.selectItem(KMLeftControlToolbarItemIdentifier)
         }
     }
     
     @IBAction func menuItemAction_hiddenRightSide(_ sender: Any) {
-        self.toolbarController.selectItem(KMRightControlToolbarItemIdentifier)
     }
     
     @IBAction func menuItemAction_thumai(_ sender: Any) {
@@ -393,7 +389,7 @@ extension KMMainViewController {
     }
     
     @IBAction func toggleToolbarShow(_ sender: Any?) {
-        self.toolbarController.mainToolBarisVisable = !self.toolbarController.mainToolBarisVisable
+
     }
 }
 
@@ -431,25 +427,21 @@ extension KMMainViewController {
     @IBAction func menuItemAction_squre(_ sender: Any) {
         UserDefaults.standard.set(6, forKey: KMToolBarToolPDFShapeStyle)
         
-        self.toolbarController.clickItem(KMToolbarSquareAnnotationItemIdentifier)
     }
     
     @IBAction func menuItemAction_circle(_ sender: Any) {
         UserDefaults.standard.set(7, forKey: KMToolBarToolPDFShapeStyle)
         
-        self.toolbarController.clickItem(KMToolbarCircleAnnotationItemIdentifier)
     }
     
     @IBAction func menuItemAction_arrow(_ sender: Any) {
         UserDefaults.standard.set(5, forKey: KMToolBarToolPDFShapeStyle)
         
-        self.toolbarController.clickItem(KMToolbarArrowAnnotationItemIdentifier)
     }
     
     @IBAction func menuItemAction_line(_ sender: Any) {
         UserDefaults.standard.set(4, forKey: KMToolBarToolPDFShapeStyle)
         
-        self.toolbarController.clickItem(KMToolbarLineAnnotationItemIdentifier)
     }
     
     // link
@@ -501,11 +493,9 @@ extension KMMainViewController {
     }
     
     @IBAction func image(_ sender: Any?) {
-        self.toolbarController.clickItem(KMAnnotationImageToolbarItemIdentifier)
     }
     
     @IBAction func table(_ sender: Any?) {
-        self.toolbarController.clickItem(KMAnnotationTableToolbarItemIdentifier)
     }
     
     @IBAction func addForm(_ sender: Any?) {
@@ -532,7 +522,6 @@ extension KMMainViewController {
             identifiers = KMToolbarToolSignBoxIdentifier
         }
         if let itemID = identifiers {
-            self.toolbarController.clickItem(itemID)
         }
     }
     
@@ -555,10 +544,7 @@ extension KMMainViewController {
     }
     
     private func mainMenuUpdateAnnotationStyle(identifier : String) {
-        if self.toolbarController.toolbarType != .Annatiton {
-            self.toolbarController.clickItem(KMDocumentAnnotationToolbarItemIdentifier)
-        }
-        self.toolbarController.clickItem(identifier)
+        
     }
 }
 
@@ -636,10 +622,7 @@ extension KMMainViewController: KMSystemPDFMenuProtocol {
     }
     
     func doMarqueeZoomTool(_ sender: Any?) {
-        let isSelected = self.toolbarController.findItem(KMToolbarZoomToSelectionItemIdentifier)?.isSelected ?? false
-        if isSelected == false {
-            self.toolbarController.clickItem(KMToolbarZoomToSelectionItemIdentifier)
-        }
+        
     }
     
     func highlightFormFiled(_ sender: Any?) {
@@ -782,15 +765,12 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     }
     
     @IBAction func menuItemAction_scrolTool(_ sender: Any) {
-        self.toolbarController.selectItem(KMToolbarMoveToolModeItemIdentifier)
     }
     
     @IBAction func menuItemAction_zoomOutTool(_ sender: Any) {
-        self.toolbarController.selectItem(KMToolbarMagnifyToolModeItemIdentifier)
     }
     
     @IBAction func menuItemAction_selectTool(_ sender: Any) {
-        self.toolbarController.selectItem(KMToolbarSelectToolModeItemIdentifier)
     }
     
     func changeToolMode(_ sender: Any?) {
@@ -828,74 +808,57 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
         } else if aType == .link {
             itemId = KMToolbarLinkAnnotationItemIdentifier
         }
-        let isSelected = self.toolbarController.findItem(itemId)?.isSelected ?? false
-        if isSelected == false {
-            self.toolbarController.selectItem(itemId)
-        }
     }
     
     @IBAction func menuItemAction_redact(_ sender: Any) {
-        self.toolbarController.clickItem(KMDocumentRedactToolbarItemIdentifier)
-    }
+     }
     
     @IBAction func menuItemAction_warkmark(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .watermark, index: 0)
-    }
+     }
     
     @IBAction func menuItemAction_background(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .background, index: 0)
-    }
+     }
     
     @IBAction func menuItemAction_headerfooter(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .headerAndFooter, index: 0)
-    }
+     }
     
     @IBAction func menuItemAction_bates(_ sender: Any) {
-        self.toolbarController.delegate?.clickChildTool?(type: .bates, index: 0)
-    }
+     }
     
     @IBAction func menuItemAction_batch(_ sender: Any) {
     }
     
     func compression(_ sender: Any?) {
-        self.toolbarController.delegate?.clickChildTool?(type: .compress, index: 0)
-    }
+     }
     
     func merge(_ sender: Any?) {
-        self.toolbarController.delegate?.clickChildTool?(type: .merge, index: 0)
-    }
+     }
     
     func convert(_ sender: Any?) {
-        self.toolbarController.delegate?.clickChildTool?(type: .word, index: 0)
-    }
+     }
     
     func imageToPDF(_ sender: Any?) {
         KMApp.ShowImageToPDFWindow()
     }
     
     func ocr(_ sender: Any?) {
-        self.toolbarController.clickItem(KMDocumentScanOCRToolbarItemIdentifier)
-    }
+     }
     
     func extractImage(_ sender: Any?) {
         self.extractImageAction(num: 1)
     }
     
     func pageEdit(_ sender: Any?) {
-        self.toolbarController.clickItem(KMDocumentPageToolbarItemIdentifier)
-    }
+     }
     
     func textEditAction(_ sender: Any?) {
-        self.toolbarController.clickItem(KMDocumentEditToolbarItemIdentifier)
-    }
+     }
     
     func security(_ sender: Any?) {
-        self.toolbarController.delegate?.clickChildTool?(type: .secure, index: 1)
-    }
+     }
     
     func decryption(_ sender: Any?) {
-        self.toolbarController.delegate?.clickChildTool?(type: .secure, index: 2)
-    }
+     }
     
     func cropAll(_ sender: Any?) {
         self.cropAllPage()
@@ -920,8 +883,7 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     }
     
     func selectToolModel(_ sender: Any?) {
-        self.toolbarController.clickItem(KMToolbarSelectToolModeItemIdentifier)
-    }
+     }
     
     func takeSnapshot(_ sender: Any?) {
         self.listView.takeSnapshot(sender)
@@ -958,169 +920,69 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
                 itemId = KMToolbarLinkAnnotationItemIdentifier
             }
             if let data = itemId {
-                self.toolbarController.clickItem(data)
-            }
+             }
         }
     }
     
     func addWatermark(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolWatermarkItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolWatermarkItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 1, info: nil)
-    }
+     }
     
     func removeWatermark(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolWatermarkItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolWatermarkItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 2, info: nil)
-    }
+     }
     
     func batchAddWatermark(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolWatermarkItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolWatermarkItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 3, info: nil)
-    }
+      }
     
     func batchRemoveWatermark(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolWatermarkItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolWatermarkItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 4, info: nil)
-    }
+      }
     
     func templateWatermark(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolWatermarkItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolWatermarkItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 5, info: nil)
-    }
+      }
     
     func addBackground(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBackgroundItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBackgroundItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 1, info: nil)
-    }
+      }
     
     func removeBackground(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBackgroundItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBackgroundItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 2, info: nil)
-    }
+      }
     
     func batchAddBackground(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBackgroundItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBackgroundItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 3, info: nil)
-    }
+      }
     
     func batchRemoveBackground(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBackgroundItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBackgroundItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 4, info: nil)    }
+     }
     
     func templateBackground(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBackgroundItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBackgroundItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 5, info: nil)
-    }
+      }
     
     func addHeaderFooter(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolHeaderFooterItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolHeaderFooterItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 1, info: nil)
-    }
+      }
     
     func removeHeaderFooter(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolHeaderFooterItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolHeaderFooterItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 2, info: nil)
-    }
+      }
     
     func batchAddHeaderFooter(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolHeaderFooterItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolHeaderFooterItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 3, info: nil)
-    }
+      }
     
     func batchRemoveHeaderFooter(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolHeaderFooterItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolHeaderFooterItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 4, info: nil)
-    }
+      }
     
     func templateHeaderFooter(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolHeaderFooterItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolHeaderFooterItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 5, info: nil)
-    }
+      }
     
     func addHeaderFooterBates(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBatesItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBatesItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 1, info: nil)
-    }
+      }
     
     func removeHeaderFooterBates(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBatesItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBatesItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 2, info: nil)
-    }
+     }
     
     func batchAddBates(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBatesItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBatesItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 3, info: nil)
-    }
+     }
     
     func batchRemoveBates(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBatesItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBatesItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 4, info: nil)
-    }
+     }
     
     func templateBates(_ sender: Any?) {
-        var item = self.toolbarController.findItem(KMToolbarToolBatesItemIdentifier)
-        if item == nil {
-            item = KMToolbarItemView(itemIdentifier: KMToolbarToolBatesItemIdentifier)
-        }
-        self.toolbarController.toolbarViewController(self.toolbarController.childToolBarView!, menuItemDidClick: item!, index: 5, info: nil)
-    }
+     }
     
     func togglePoster(_ sender: Any?) {
         self.saveDocument()
@@ -1592,7 +1454,7 @@ extension KMMainViewController {
                     menuItem.state = self.listView.viewSplitMode == .disable ? .on : .off
                 }
             } else if action == KMSystemMenu.View.toggleToolbarShowSelector {
-                menuItem.title = self.toolbarController.mainToolBarisVisable ? KMLocalizedString("Hide Toolbar") : KMLocalizedString("Show Toolbar")
+
             }
         }
         

+ 12 - 104
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -72,49 +72,16 @@ extension KMMainViewController {
             self.listView.applyDefaultInterpolationQuality()
         }
         if info.keys.contains(KMPreference.markupColorHighlightKey) {
-            if let item = self.toolbarController.findItem(KMToolbarHighlightAnnotationItemIdentifier) {
-                if item.isSelected {
-                    let color = KMPreference.shared.markupHighlightColor
-                    let imageV = KMNoteTypeImageView()
-                    item.image = imageV.noteTypeImage(withType: SKNHighlightString, color: color)
-                }
-            }
-            
-            if let item = self.toolbarController.findItem(KMToolbarSquigglyAnnotationItemIdentifier) {
-                if item.isSelected {
-                    if let color = UserDefaults.standard.PDFListViewColor(forKey: CSquigglyNoteColorKey) {
-                        let imageV = KMNoteTypeImageView()
-                        item.image = imageV.noteTypeImage(withType: "Squiggly", color: color)
-                    }
-                }
-            }
+             
         }
         if info.keys.contains(KMPreference.markupColorUnderlineKey) {
-            if let item = self.toolbarController.findItem(KMToolbarUnderlineAnnotationItemIdentifier) {
-                if item.isSelected {
-                    let color = KMPreference.shared.markupUnderlineColor
-                    let imageV = KMNoteTypeImageView()
-                    item.image = imageV.noteTypeImage(withType: SKNUnderlineString, color: color)
-                }
-            }
+             
         }
         if info.keys.contains(KMPreference.markupColorStrikthroughKey) {
-            if let item = self.toolbarController.findItem(KMToolbarStrikeOutAnnotationItemIdentifier) {
-                if item.isSelected {
-                    let color = KMPreference.shared.markupStrikthroughColor
-                    let imageV = KMNoteTypeImageView()
-                    item.image = imageV.noteTypeImage(withType: SKNStrikeOutString, color: color)
-                }
-            }
+             
         }
         if info.keys.contains(KMPreference.markupColorPenKey) {
-            if let item = self.toolbarController.findItem(KMToolbarInkAnnotationItemIdentifier) {
-                if item.isSelected {
-                    let color = KMPreference.shared.markupPenColor
-                    let imageV = KMNoteTypeImageView()
-                    item.image = imageV.noteTypeImage(withType: SKNInkString, color: color)
-                }
-            }
+             
         }
         if info.keys.contains(KMPreference.editPDFPopWindowShowKey) {
             let show = KMPreference.shared.editPDFPopWindowIsShow
@@ -221,13 +188,7 @@ extension KMMainViewController {
         self.rightSideViewController.interfaceThemeDidChanged(appearance)
         
         self.pdfEditController?.interfaceThemeDidChanged(appearance)
-        
-        self.mianSplitView.superview?.wantsLayer = true
-         if KMAppearance.isDarkMode() {
-            self.mianSplitView.superview?.layer?.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1).cgColor
-         } else {
-            self.mianSplitView.superview?.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
-         }
+         
     }
 }
 
@@ -235,24 +196,7 @@ extension KMMainViewController {
 
 extension KMMainViewController: KMToolbarControllerDelegate {
     func toolbarController(_ viewController: KMToolbarController, heightOffsetChange heightOffset: Float, animated: Bool) {
-        let heightConst = (animated ? self.heightOffset.animator() : self.heightOffset)
-        if viewManager.isPDFReadMode {
-            if self.toolbarController.toolbarType == .Annatiton {
-                heightConst?.constant = CGFloat(heightOffset)
-            } else {
-                heightConst?.constant = CGFloat(0)
-            }
-        } else {
-            heightConst?.constant = CGFloat(heightOffset)
-        }
-        self.refreshListViewToolMode()
-        self.trackEvent(toolMode: self.listView.toolMode)
-        if self.listView.annotationType == .editTextImage ||
-            self.listView.annotationType == .addText ||
-            self.listView.annotationType == .addImage {
-            self.closeRightPane()
-        }
-        self.listView.annotationType = .unkown
+         
     }
     
     func changeAnnotationModeAction(item: KMToolbarClickButton) {
@@ -292,10 +236,7 @@ extension KMMainViewController: KMToolbarControllerDelegate {
         if (self.model.rightMouseEventing) {
             self.model.rightMouseEventing = false
         }
-        if (self.toolbarController.ignoreCurrentAnnotationTypeChange) {
-            self.toolbarController.ignoreCurrentAnnotationTypeChange = false
-        }
-        
+         
         var currentType = self.listView.annotationType
  
         let isSelected = (currentType == CAnnotationType(rawValue: item.tag) ?? CAnnotationType.unkown) && ((self.listView.toolMode == .noteToolMode) || (self.listView.toolMode == .selfSignMode) || (self.listView.toolMode == .formToolMode))
@@ -312,8 +253,7 @@ extension KMMainViewController: KMToolbarControllerDelegate {
             }
             let type = CAnnotationType(rawValue: item.tag) ?? CAnnotationType.unkown
             if type == .signature {
-                self.toolbarController.findItem(KMToolbarToolSignBoxIdentifier)?.isSelected = false
-                
+                 
                 if self.listView.toolMode == .formToolMode {
                     self.listView.toolMode = .noteToolMode
                 }
@@ -328,8 +268,7 @@ extension KMMainViewController: KMToolbarControllerDelegate {
                 if self.listView.toolMode != .formToolMode {
                     self.listView.toolMode = .formToolMode
                     
-                    self.toolbarController.findItem(KMToolbarToolSignBoxIdentifier)?.isSelected = true
-                }
+                 }
             }
             self.listView.annotationType = type
             
@@ -395,33 +334,7 @@ extension KMMainViewController: KMToolbarControllerDelegate {
     }
     
     func refreshListViewToolMode () {
-        if self.toolbarController.toolbarType == .Annatiton {
-           self.listView.toolMode = .noteToolMode
-        } else if self.toolbarController.toolbarType == .Move {
-            self.listView.toolMode = .moveToolMode
-        } else if self.toolbarController.toolbarType == .Magnify {
-            self.listView.toolMode = .magnifyToolMode
-        } else if self.toolbarController.toolbarType == .Select {
-            self.listView.toolMode = .selectToolMode
-        } else if self.toolbarController.toolbarType == .SelectZoom {
-            self.listView.toolMode = .selectZoomToolMode
-        } else if self.toolbarController.toolbarType == .Page {
-            
-        } else if self.toolbarController.toolbarType == .Form {
-            self.listView.toolMode = .formToolMode
-            self.rightSideViewController.subViewType = .AnnotationProperts
-        } else if self.toolbarController.toolbarType == .FillSign {
-            self.listView.toolMode = .selfSignMode
-            self.rightSideViewController.subViewType = .AnnotationProperts
-        } else if self.toolbarController.toolbarType == .editPDF {
-            self.listView.toolMode = .editPDFToolMode 
-             self.listView.setShouAddEdit([])
-        }else if self.toolbarController.toolbarType == .LeftPanel {
-            self.toggleLeftPane()
-            self.leftSideViewController.showPanelView(show: true)
-        }else {
-            self.listView.toolMode = .textToolMode
-        }
+         
     }
     
     func showPDFLayoutModeAction(show: Bool) {
@@ -443,9 +356,7 @@ extension KMMainViewController: KMLeftSideViewControllerDelegate {
     }
     
     func enterEditMode(_ obj: KMLeftSideViewController, _ pages: [Int]) {
-        let item : KMToolbarItemView = (self.toolbarController.mainToolBarView?.toolbarItemFindItemIdentifiers(value: KMDocumentPageToolbarItemIdentifier))!
-        self.toolbarController.mainToolBarView?.delegate?.toolbarViewController?(self.toolbarController.mainToolBarView!, clickMode: .Page, toolbar: item, pages)
-    }
+     }
     
     func searchAction(searchString: String,isCase:Bool) {
         self.search(searchString: searchString,isCase: isCase)
@@ -467,8 +378,7 @@ extension KMMainViewController: KMLeftSideViewControllerDelegate {
         } else if (itemKey == .cut || itemKey == .paste || itemKey == .delete || itemKey == .leftRotate || itemKey == .rightRotate) {
             self.recordIsPDFDocumentEdited(type: itemKey.toSubscribeWaterMarkType())
         } else if itemKey == .pageEdit {
-            self.toolbarController.clickItem(KMDocumentPageToolbarItemIdentifier)
-        } else if itemKey == .demote { // 大纲降级
+         } else if itemKey == .demote { // 大纲降级
             guard let currentOutline: CPDFOutline = controller.tocOutlineView.km.clickedItem() else {
                 return
             }
@@ -542,8 +452,6 @@ extension KMMainViewController {
     
     @objc func lookUpAction() {
         let label = self.listView.currentSelection?.string() ?? ""
-        self.toolbarController.showFindBar()
-        self.toolbarController.findSearchView.searchString(label)
  
     }
     

+ 1 - 1
PDF Office/PDF Master/KMClass/ComponentLibraryDemo/Demo/ControllerVC.swift

@@ -104,7 +104,7 @@ class ControllerVC: NSViewController {
         
         let customColorProperty: ComponentCColorProperty = ComponentCColorProperty(colorType: colorType, state: .normal, isCustom: true, color: NSColor.yellow)
         self.cCustomColorItem.properties = customColorProperty
-        self.cCustomColorItem.componentDelegate = self
+        self.cCustomColorItem.delegate = self
         
         //Color Group
         self.cColorGroup.delegate = self

+ 28 - 28
PDF Office/PDF Master/KMClass/ImageToPDF/Base/KMBatchOperateLeftViewController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" 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="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -32,29 +32,29 @@
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="yD5-qe-EWK">
-                    <rect key="frame" x="0.0" y="421" width="718" height="64"/>
+                    <rect key="frame" x="0.0" y="471" width="718" height="64"/>
                     <subviews>
-                        <button verticalHuggingPriority="750" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9ff-Qn-trv" customClass="KMLongerButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                        <button imageHugsTitle="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9ff-Qn-trv" customClass="KMLongerButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                             <rect key="frame" x="24" y="12" width="109" height="32"/>
-                            <constraints>
-                                <constraint firstAttribute="width" constant="109" id="B3Q-g0-yID"/>
-                                <constraint firstAttribute="height" constant="32" id="tvc-9W-44T"/>
-                            </constraints>
                             <buttonCell key="cell" type="square" title="Add File..." bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnAddHov" imagePosition="left" alignment="center" lineBreakMode="truncatingTail" inset="2" id="GI3-CE-S91" customClass="KMButtomCell">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                             </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="109" id="B3Q-g0-yID"/>
+                                <constraint firstAttribute="height" constant="32" id="tvc-9W-44T"/>
+                            </constraints>
                         </button>
                         <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0F7-Ym-8wO">
                             <rect key="frame" x="662" y="12" width="32" height="32"/>
-                            <constraints>
-                                <constraint firstAttribute="height" constant="32" id="I4I-Jh-3OK"/>
-                                <constraint firstAttribute="width" constant="32" id="nPO-97-IsQ"/>
-                            </constraints>
                             <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnDeletNor" imagePosition="only" alignment="center" alternateImage="KMImageNameUXIconBtnDeletHov" imageScaling="proportionallyDown" inset="2" id="F2E-HK-Xqi">
                                 <behavior key="behavior" lightByContents="YES"/>
                                 <font key="font" metaFont="system"/>
                             </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="32" id="I4I-Jh-3OK"/>
+                                <constraint firstAttribute="width" constant="32" id="nPO-97-IsQ"/>
+                            </constraints>
                             <connections>
                                 <action selector="buttonClicked_DeleteFile:" target="-2" id="Bv8-Ml-MTp"/>
                             </connections>
@@ -69,13 +69,13 @@
                     </constraints>
                 </customView>
                 <scrollView autohidesScrollers="YES" horizontalLineScroll="17" horizontalPageScroll="10" verticalLineScroll="17" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cSo-1J-C87">
-                    <rect key="frame" x="24" y="0.0" width="670" height="421"/>
-                    <clipView key="contentView" ambiguous="YES" id="5QZ-3D-5sN">
-                        <rect key="frame" x="1" y="1" width="668" height="419"/>
+                    <rect key="frame" x="24" y="0.0" width="670" height="471"/>
+                    <clipView key="contentView" id="5QZ-3D-5sN">
+                        <rect key="frame" x="1" y="1" width="668" height="454"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <tableView verticalHuggingPriority="750" ambiguous="YES" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="Mlr-rw-6rm" viewBased="YES" id="iqp-fI-b2v">
-                                <rect key="frame" x="0.0" y="0.0" width="859" height="394"/>
+                            <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="Mlr-rw-6rm" viewBased="YES" id="iqp-fI-b2v">
+                                <rect key="frame" x="0.0" y="0.0" width="859" height="429"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                 <color key="gridColor" red="1" green="0.64784158279075421" blue="0.26014074763814632" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -93,7 +93,7 @@
                                         <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                         <prototypeCellViews>
                                             <tableCellView id="mJ1-Fh-j8e">
-                                                <rect key="frame" x="0.0" y="0.0" width="45" height="17"/>
+                                                <rect key="frame" x="0.0" y="0.0" width="46" height="17"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             </tableCellView>
                                         </prototypeCellViews>
@@ -211,7 +211,7 @@
                                         <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                         <prototypeCellViews>
                                             <tableCellView id="nvT-ce-HBH" customClass="KMBatchTableCellView" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                                                <rect key="frame" x="689" y="0.0" width="168" height="17"/>
+                                                <rect key="frame" x="689" y="0.0" width="170" height="17"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             </tableCellView>
                                         </prototypeCellViews>
@@ -230,7 +230,7 @@
                         <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="670" id="LUW-2r-W1h"/>
                     </constraints>
                     <scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="RBU-7C-fCt">
-                        <rect key="frame" x="1" y="404" width="668" height="16"/>
+                        <rect key="frame" x="1" y="455" width="668" height="15"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </scroller>
                     <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="32b-Um-caF">
@@ -243,10 +243,10 @@
                     </tableHeaderView>
                 </scrollView>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="G6v-if-4fr" customClass="KMBlankView" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                    <rect key="frame" x="0.0" y="0.0" width="718" height="421"/>
+                    <rect key="frame" x="0.0" y="0.0" width="718" height="471"/>
                     <subviews>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="9GJ-Lf-bRA">
-                            <rect key="frame" x="222" y="116" width="275" height="190"/>
+                            <rect key="frame" x="222" y="141" width="275" height="190"/>
                             <subviews>
                                 <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="aT2-4b-2xG">
                                     <rect key="frame" x="67" y="50" width="140" height="140"/>
@@ -256,7 +256,7 @@
                                     </constraints>
                                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameEmptyListNor" id="ZKZ-Y3-Edy"/>
                                 </imageView>
-                                <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="6Hf-rN-RVl">
+                                <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="6Hf-rN-RVl">
                                     <rect key="frame" x="86" y="33" width="102" height="17"/>
                                     <textFieldCell key="cell" title="Multiline Label" id="ssO-57-xns">
                                         <font key="font" metaFont="systemSemibold" size="14"/>
@@ -264,7 +264,7 @@
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                     </textFieldCell>
                                 </textField>
-                                <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="tU6-rc-cEb">
+                                <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="tU6-rc-cEb">
                                     <rect key="frame" x="86" y="8" width="102" height="17"/>
                                     <textFieldCell key="cell" alignment="center" title="Multiline Label" id="7H4-19-ztf">
                                         <font key="font" metaFont="system" size="14"/>
@@ -274,14 +274,14 @@
                                 </textField>
                                 <button hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8eZ-ia-mtv">
                                     <rect key="frame" x="67" y="50" width="140" height="140"/>
-                                    <constraints>
-                                        <constraint firstAttribute="height" constant="140" id="FAQ-AI-aUg"/>
-                                        <constraint firstAttribute="width" constant="140" id="GF5-QU-DL3"/>
-                                    </constraints>
                                     <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" image="KMImageNameEmptyListNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="o8j-Uh-3Zt">
                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="system"/>
                                     </buttonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="140" id="FAQ-AI-aUg"/>
+                                        <constraint firstAttribute="width" constant="140" id="GF5-QU-DL3"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="blankViewAddFileAction:" target="-2" id="wjH-6m-Pc1"/>
                                     </connections>

+ 9 - 9
PDF Office/PDF Master/KMClass/KMHomeViewController/KMNHomeViewController.swift

@@ -1005,8 +1005,8 @@ extension KMNHomeViewController {
         DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
             var arr: Array<KMBatchOperateFile> = Array()
             for fileURL in urls {
-                let file = KMBatchOperateFile(filePath: fileURL.path, type: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddPassword : .RemovePassword)
-                arr.append(file)
+//                let file = KMBatchOperateFile(filePath: fileURL.path, type: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddPassword : .RemovePassword)
+//                arr.append(file)
             }
             let baseWindowController = KMBatchOperateBaseWindowController(windowNibName: "KMBatchOperateBaseWindowController")
             if #available(macOS 10.13, *) {
@@ -1015,7 +1015,7 @@ extension KMNHomeViewController {
                 baseWindowController.showWindow(nil)
             }
             if arr.count > 0 {
-                baseWindowController.checkNeedPasswordSwitchToOperateType(operateType: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddPassword : .RemovePassword, files: arr)
+//                baseWindowController.checkNeedPasswordSwitchToOperateType(operateType: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddPassword : .RemovePassword, files: arr)
             }
         }
     }
@@ -1109,8 +1109,8 @@ extension KMNHomeViewController {
                     return
                 }
                 
-                let file = KMBatchOperateFile(filePath: fileURL.path, type: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddWatermark : .RemoveWatermark)
-                arr.append(file)
+//                let file = KMBatchOperateFile(filePath: fileURL.path, type: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddWatermark : .RemoveWatermark)
+//                arr.append(file)
             }
             let baseWindowController = KMBatchOperateBaseWindowController(windowNibName: "KMBatchOperateBaseWindowController")
             if #available(macOS 10.13, *) {
@@ -1119,7 +1119,7 @@ extension KMNHomeViewController {
                 baseWindowController.showWindow(nil)
             }
             if arr.count > 0 {
-                baseWindowController.checkNeedPasswordSwitchToOperateType(operateType: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddWatermark : .RemoveWatermark, files: arr)
+//                baseWindowController.checkNeedPasswordSwitchToOperateType(operateType: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddWatermark : .RemoveWatermark, files: arr)
             }
         }
     }
@@ -1155,8 +1155,8 @@ extension KMNHomeViewController {
                     return
                 }
                 
-                let file = KMBatchOperateFile(filePath: fileURL.path, type: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddBackground : .RemoveBackground)
-                arr.append(file)
+//                let file = KMBatchOperateFile(filePath: fileURL.path, type: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddBackground : .RemoveBackground)
+//                arr.append(file)
             }
             let baseWindowController = KMBatchOperateBaseWindowController(windowNibName: "KMBatchOperateBaseWindowController")
             if #available(macOS 10.13, *) {
@@ -1165,7 +1165,7 @@ extension KMNHomeViewController {
                 baseWindowController.showWindow(nil)
             }
             if arr.count > 0 {
-                baseWindowController.checkNeedPasswordSwitchToOperateType(operateType: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddBackground : .RemoveBackground, files: arr)
+//                baseWindowController.checkNeedPasswordSwitchToOperateType(operateType: KMBatchQuickActionManager.defaultManager.actionType == .add ? .AddBackground : .RemoveBackground, files: arr)
             }
         }
     }

+ 34 - 30
PDF Office/PDF Master/KMClass/KMHomeViewController/KMURLCreatePDFWindowController/KMURLCreatePDFWindowController.swift

@@ -11,14 +11,14 @@ import KMComponentLibrary
 let kUrlToPDFFolderPath = (try? FileManager.default.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true).appendingPathComponent(Bundle.main.bundleIdentifier ?? "").appendingPathComponent("WebPage"))?.path ?? ""
 
 @objc protocol KMURLCreatePDFWindowControllerDelegate: AnyObject {
-     
+    
     //选择打开文件
     @objc optional func urlCreateWCDidChooseFileToOpen(_ vc: KMURLCreatePDFWindowController, _ fileURL: URL)
- 
+    
 }
 
 class KMURLCreatePDFWindowController: NSWindowController {
-
+    
     @IBOutlet var contendBox: NSBox!
     
     @IBOutlet var titleLabel: NSTextField!
@@ -44,12 +44,12 @@ class KMURLCreatePDFWindowController: NSWindowController {
     
     var choosedFilePath: String?
     var filePath: String?
-
+    
     weak open var delegate: KMURLCreatePDFWindowControllerDelegate?
-
+    
     override func windowDidLoad() {
         super.windowDidLoad()
-
+        
         // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
         
         setUpProperty()
@@ -82,9 +82,9 @@ class KMURLCreatePDFWindowController: NSWindowController {
         urlRadio.setTarget(self, action: #selector(typeRadioChanged(_:)))
         
         fileRadio.properties = ComponentCheckBoxProperty(size: .s,
-                                                        state: .normal,
-                                                        text: NSLocalizedString("File", comment: ""),
-                                                        checkboxType: .normal)
+                                                         state: .normal,
+                                                         text: NSLocalizedString("File", comment: ""),
+                                                         checkboxType: .normal)
         fileRadio.setTarget(self, action: #selector(typeRadioChanged(_:)))
         
         inputView.properties = ComponentInputProperty(size: .s,
@@ -111,7 +111,7 @@ class KMURLCreatePDFWindowController: NSWindowController {
                                                                 iconImage: NSImage(named: "file_icon"))
         fileInputAddon.setTarget(self, action: #selector(chooseURLAction(_ :)))
         
-  
+        
         cancelButton.properties = ComponentButtonProperty(type: .default_tertiary,
                                                           size: .s,
                                                           state: .normal,
@@ -119,9 +119,9 @@ class KMURLCreatePDFWindowController: NSWindowController {
         cancelButton.setTarget(self, action: #selector(cancelButtonClicked(_ :)))
         
         openButton.properties = ComponentButtonProperty(type: .primary,
-                                                          size: .s,
-                                                          state: .normal,
-                                                          buttonText: NSLocalizedString("Open", comment: ""))
+                                                        size: .s,
+                                                        state: .normal,
+                                                        buttonText: NSLocalizedString("Open", comment: ""))
         openButton.setTarget(self, action: #selector(openButtonClicked(_ :)))
         
     }
@@ -132,7 +132,7 @@ class KMURLCreatePDFWindowController: NSWindowController {
         
         fileInputBGView.isHidden = isFromURL ? true : false
         inputView.isHidden = isFromURL ? false : true
-         
+        
         cancelButton.properties.state = .normal
         openButton.properties.state = .normal
         
@@ -165,11 +165,11 @@ class KMURLCreatePDFWindowController: NSWindowController {
         urlRadio.reloadData()
         
         fileRadio.reloadData()
-         
+        
         cancelButton.reloadData()
         
         openButton.reloadData()
-    
+        
         fileInputView.reloadData()
         
     }
@@ -187,7 +187,9 @@ class KMURLCreatePDFWindowController: NSWindowController {
         
         choosedFilePath = nil
         inputView.properties.text = ""
-             
+        
+        hideWaitting()
+        
         reloadData()
         
         KMURLToPDF.shareInstance.stopLoading()
@@ -207,13 +209,13 @@ class KMURLCreatePDFWindowController: NSWindowController {
         openPanel.allowedFileTypes = ["html", "HTML"]
         openPanel.allowsMultipleSelection = false
         openPanel.beginSheetModal(for: self.window!) { [weak self] result in
-             if result == NSApplication.ModalResponse.OK {
-                 if let url = openPanel.url {
-                     self?.choosedFilePath = url.path
-                     
-                     self?.reloadData()
-                     
-                 }
+            if result == NSApplication.ModalResponse.OK {
+                if let url = openPanel.url {
+                    self?.choosedFilePath = url.path
+                    
+                    self?.reloadData()
+                    
+                }
             }
         }
     }
@@ -239,7 +241,7 @@ class KMURLCreatePDFWindowController: NSWindowController {
                 url = URL(fileURLWithPath: choosedFilePath)
             }
         }
-
+        
         if let url = url {
             showWaitting()
             
@@ -264,7 +266,7 @@ class KMURLCreatePDFWindowController: NSWindowController {
                             alert.alertStyle = .critical
                             alert.messageText = NSLocalizedString("Conversion Failed", comment: "")
                             alert.beginSheetModal(for: window) { [weak self] result in
-                                 
+                                
                             }
                         }
                     }
@@ -290,7 +292,7 @@ class KMURLCreatePDFWindowController: NSWindowController {
                             alert.alertStyle = .critical
                             alert.messageText = NSLocalizedString("Conversion Failed", comment: "")
                             alert.beginSheetModal(for: window) { [weak self] result in
-                                 
+                                
                             }
                         }
                     }
@@ -307,7 +309,7 @@ class KMURLCreatePDFWindowController: NSWindowController {
         }
         contendBox.contentView?.addSubview(posterMaskView!, positioned: .below, relativeTo: self.cancelButton)
     }
-
+    
     func hideWaitting() {
         posterMaskView?.removeFromSuperview()
     }
@@ -324,7 +326,9 @@ class KMURLCreatePDFWindowController: NSWindowController {
             
             choosedFilePath = nil
             self.handler = handler
-         
+            
+            hideWaitting()
+            
             reloadData()
         }
         
@@ -358,7 +362,7 @@ class KMURLCreatePDFWindowController: NSWindowController {
         let urlTest = NSPredicate(format: "SELF MATCHES %@", urlRegex)
         return urlTest.evaluate(with: url)
     }
- 
+    
     func urlValueEncode(_ str: String) -> String? {
         let allowedCharacterSet = CharacterSet(charactersIn: "!*'();:@&=+$,?%#[]{}").inverted
         return str.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet)

+ 35 - 38
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeQuickTools/KMNQuickToolWindowController.swift

@@ -15,7 +15,7 @@ protocol KMNQuickToolWindowDelegate: AnyObject {
 }
 
 //MARK: - KMNQuickToolWindowController
-class KMNQuickToolWindowController: NSWindowController, NSCollectionViewDelegate, NSCollectionViewDataSource,NSCollectionViewDelegateFlowLayout {
+class KMNQuickToolWindowController: KMNBaseWindowController, NSCollectionViewDelegate, NSCollectionViewDataSource,NSCollectionViewDelegateFlowLayout {
     weak open var delegate: KMNQuickToolWindowDelegate?
     
     @IBOutlet var viewBackBox: NSBox!
@@ -32,10 +32,7 @@ class KMNQuickToolWindowController: NSWindowController, NSCollectionViewDelegate
 
     @IBOutlet var cancelWidthButton:NSLayoutConstraint!
     @IBOutlet var applyWidthButton:NSLayoutConstraint!
-    
-    private var parentWindow: NSWindow?
-    private var handler: ((String?) -> Void)!
-    
+        
     var quickToolsItemMutableArray: [Int] = []
         
     var draggedItemIndexPath: IndexPath?
@@ -51,16 +48,11 @@ class KMNQuickToolWindowController: NSWindowController, NSCollectionViewDelegate
         return fullDatas
     }()
 
-    deinit {
-        KMPrint("KMNQuickToolWindowController 释放")
-    }
-
     override func windowDidLoad() {
         super.windowDidLoad()
         
         quickToolsItemMutableArray = KMNHomeQuickToolManager.defaultManager.quickToolsItemMutableArray
         
-        setUpProperty()
         updateButtonState()
         
         showCollectionView.delegate = self
@@ -75,45 +67,51 @@ class KMNQuickToolWindowController: NSWindowController, NSCollectionViewDelegate
     }
     
     func reloadData() {
-        self.showCollectionView.reloadData()
+        showCollectionView.reloadData()
     }
     
-    func own_beginSheetModal(for window: NSWindow?, completionHandler handler: ((String?) -> Void)?) {
-        if window != nil {
-            parentWindow = window
-            window!.beginSheet(self.window!) { ModalResponse in
-                self.handler?(nil)
-            }
-            self.reloadData()
-        }
-        self.handler = handler
-    }
-    
-    private func setUpProperty() {        
-        titleLabel.stringValue = KMLocalizedString("Manage Quick Tools")
+    override func initContentView() {
         titleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
         
-        titleBox.fillColor = ComponentLibrary.shared.getComponentColorFromKey("colorFill/3-default")
-        titleBox.borderColor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/3-default")
-        
-        titleSubLabel.stringValue = KMLocalizedString("Select a maximum of 8 tools. You can drag and drop to reorder the tools display.")
         titleSubLabel.font = ComponentLibrary.shared.getFontFromKey ("mac/body-xs-regular")
-        titleSubLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
-                
+        
         applyButton.properties = ComponentButtonProperty(type: .primary,
-                                                          size: .s,
-                                                          state: .normal,
-                                                          buttonText: KMLocalizedString("Apply"))
+                                                         size: .s,
+                                                         state: .normal,
+                                                         buttonText: KMLocalizedString("Apply"))
         applyButton.setTarget(self, action: #selector(applyButtonClicked(_ :)))
-        applyWidthButton.constant = applyButton.properties.propertyInfo.viewWidth
         
         cancelButton.properties = ComponentButtonProperty(type: .default_tertiary,
                                                           size: .s,
                                                           state: .normal,
                                                           buttonText: KMLocalizedString("Cancel"))
         cancelButton.setTarget(self, action: #selector(cancelButtonClicked(_ :)))
+    }
+    
+    override func updateUIThemeColor() {
+        window?.contentView?.wantsLayer = true
+        window?.contentView?.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/popUp").cgColor
+
+        titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        
+        titleBox.fillColor = ComponentLibrary.shared.getComponentColorFromKey("colorFill/3-default")
+        titleBox.borderColor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/3-default")
+        titleSubLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+
+        cancelButton.reloadData()
+        applyButton.reloadData()
+    }
+    
+    override func updateUILanguage() {
+        titleSubLabel.stringValue = KMLocalizedString("Select a maximum of 8 tools. You can drag and drop to reorder the tools display.")
+        titleLabel.stringValue = KMLocalizedString("Manage Quick Tools")
+
+        showCollectionView.reloadData()
+        cancelButton.properties.buttonText = KMLocalizedString("Cancel")
+        applyButton.properties.buttonText = KMLocalizedString("Apply")
+        
         cancelWidthButton.constant = cancelButton.properties.propertyInfo.viewWidth
+        applyWidthButton.constant = applyButton.properties.propertyInfo.viewWidth
     }
     
     private func updateButtonState() {
@@ -147,7 +145,7 @@ class KMNQuickToolWindowController: NSWindowController, NSCollectionViewDelegate
     
     //MARK: - Action
     @objc func cancelButtonClicked(_ sender: NSView) {
-        parentWindow?.endSheet(self.window!)
+        own_closeEndSheet()
     }
     
     @objc func applyButtonClicked(_ sender: NSView) {
@@ -169,7 +167,7 @@ class KMNQuickToolWindowController: NSWindowController, NSCollectionViewDelegate
 
         self.delegate?.quickToolWindowControllerUpdate()
         
-        parentWindow?.endSheet(self.window!)
+        own_closeEndSheet()
     }
     
     //MARK: - NSCollectionViewDataSource
@@ -297,5 +295,4 @@ class KMNQuickToolWindowController: NSWindowController, NSCollectionViewDelegate
         resetCellOpacity()
     }
     
-    
 }

+ 1 - 1
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift

@@ -80,7 +80,7 @@ public class KMHomeQuickToolsView: BaseXibView {
         
         titleLabel.stringValue = KMLocalizedString("Advanced Editing Tools")
         titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
-        titleLabel.font = ComponentLibrary.shared.font(forToken: "mac/body-l-bold")
+        titleLabel.font = ComponentLibrary.shared.font(forToken: "mac/body-m-bold")
         
         moreButton.properties = ComponentButtonProperty(type: .text_gray,
                                                         size: .xxs,

+ 1 - 5
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/HeaderFooterView/KMHomeFilesHeaderView.swift

@@ -95,11 +95,7 @@ public class KMHomeFilesHeaderView: BaseXibView {
     }
     
     func updateDeleteButtonState() {
-        if HistoryFilesManager.manager.selectFiles.count > 0 {
-            deleteButton.properties.isDisabled = false
-        } else {
-            deleteButton.properties.isDisabled = true
-        }
+        deleteButton.properties.isDisabled = false
         deleteButton.reloadData()
     }
     

+ 1 - 1
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/HistoryFilesItems/KMHistoryFileListItem.swift

@@ -54,7 +54,7 @@ public class KMHistoryFileListItem: NSCollectionViewItem {
         
         updateTrackingAreas()
         
-        moreButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, onlyIcon: true)
+        moreButton.properties = ComponentButtonProperty(type: .text_gray, size: .s, onlyIcon: true, keepPressState: false)
         moreButton.properties.propertyInfo.leftIcon_nor = NSImage(named: "filelist_more")
         moreButton.reloadData()
         moreButton.setTarget(self, action: #selector(morebuttonClicked(_:)))

+ 9 - 9
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/HistoryFilesItems/KMHistoryFileListItem.xib

@@ -37,13 +37,12 @@
                                 </constraints>
                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="test" id="0a9-Rx-feb"/>
                             </imageView>
-                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zKu-lm-fyn">
-                                <rect key="frame" x="70" y="24" width="249" height="16"/>
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NTN-kq-Yvv">
+                                <rect key="frame" x="531" y="24" width="84" height="16"/>
                                 <constraints>
-                                    <constraint firstAttribute="height" relation="lessThanOrEqual" constant="40" id="2fQ-an-Qkg"/>
-                                    <constraint firstAttribute="width" relation="lessThanOrEqual" constant="536" id="dDV-7O-phh"/>
+                                    <constraint firstAttribute="width" constant="80" id="cKm-AT-sGq"/>
                                 </constraints>
-                                <textFieldCell key="cell" title="--" id="70S-Wn-1Cy">
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="0Bl-Ug-WTf">
                                     <font key="font" metaFont="system"/>
                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -60,12 +59,13 @@
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                 </textFieldCell>
                             </textField>
-                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NTN-kq-Yvv">
-                                <rect key="frame" x="531" y="24" width="84" height="16"/>
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zKu-lm-fyn">
+                                <rect key="frame" x="70" y="24" width="249" height="16"/>
                                 <constraints>
-                                    <constraint firstAttribute="width" constant="80" id="cKm-AT-sGq"/>
+                                    <constraint firstAttribute="height" relation="lessThanOrEqual" constant="40" id="2fQ-an-Qkg"/>
+                                    <constraint firstAttribute="width" relation="lessThanOrEqual" constant="536" id="dDV-7O-phh"/>
                                 </constraints>
-                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="0Bl-Ug-WTf">
+                                <textFieldCell key="cell" title="--" id="70S-Wn-1Cy">
                                     <font key="font" metaFont="system"/>
                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>

+ 13 - 5
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/KMHomeRightView.swift

@@ -419,18 +419,26 @@ extension KMHomeRightView: KMHomeFilesHeaderViewDelegate {
         }
         let alert = NSAlert()
         alert.alertStyle = .informational
-        alert.informativeText = NSLocalizedString("Remove Selected Files from your Recent Files?", comment: "")
-        alert.messageText = NSLocalizedString("The file will disappear from the recent list.", comment: "")
-        alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
-        alert.addButton(withTitle: NSLocalizedString("Delete", comment: ""))
+        if HistoryFilesManager.manager.selectFiles.count > 0 {
+            alert.informativeText = KMLocalizedString("Remove Selected Files from your Recent Files?")
+        } else {
+            alert.informativeText = KMLocalizedString("Remove Files from your Recent Files?")
+        }
+        alert.messageText = KMLocalizedString("The file will disappear from the recent list.")
+        alert.addButton(withTitle: KMLocalizedString("Delete"))
+        alert.addButton(withTitle: KMLocalizedString("Cancel"))
         alert.showsSuppressionButton = true
         let response = alert.runModal()
-        if response.rawValue == 1001 {
+        if response.rawValue == 1000 {
             var selects: [URL] = []
             if HistoryFilesManager.manager.selectFiles.count > 0 {
                 for selecturl in HistoryFilesManager.manager.selectFiles {
                     selects.append(selecturl)
                 }
+            } else {
+                for selecturl in HistoryFilesManager.manager.files {
+                    selects.append(selecturl)
+                }
             }
             HistoryFilesManager.manager.historyFileDeleteAction(selects)
             self.reloadData()

+ 36 - 10
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFExtract/KMNExtractPDFWindowController.swift

@@ -26,11 +26,44 @@ class KMNExtractPDFWindowController: KMNBaseWindowController {
     
     var callback: ((Bool, Bool)->Void)?
     
-    private func setUpProperty() {
-        titleLabel.stringValue = KMLocalizedString("Extract")
-        titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
+    override func updateUIThemeColor() {
+        super.updateUIThemeColor()
+
+        window?.contentView?.wantsLayer = true
+        window?.contentView?.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/popUp").cgColor
         titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
         
+        deleteButton.reloadData()
+        eachButton.reloadData()
+        
+        cancelButton.reloadData()
+        extractButton.reloadData()
+    }
+    
+    override func updateUILanguage() {
+        super.updateUILanguage()
+        
+        titleLabel.stringValue = KMLocalizedString("Extract")
+        eachButton.properties.text = KMLocalizedString("Each page in a separate file")
+        deleteButton.properties.text = KMLocalizedString("Delete pages after extraction")
+        
+        deleteButton.reloadData()
+        eachButton.reloadData()
+
+        cancelButton.properties.buttonText = KMLocalizedString("Cancel")
+        extractButton.properties.buttonText = KMLocalizedString("Extract")
+        
+        cancelButton.reloadData()
+        extractButton.reloadData()
+        
+        cancelWidthButton.constant = cancelButton.properties.propertyInfo.viewWidth
+        extractWidthButton.constant = extractButton.properties.propertyInfo.viewWidth
+    }
+    
+    override func initContentView() {
+        super.initContentView()
+
+        titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
         
         eachButton.properties = ComponentCheckBoxProperty(size: .s,
                                                                 state: .normal,
@@ -52,26 +85,19 @@ class KMNExtractPDFWindowController: KMNBaseWindowController {
                                                           isDisable: false,
                                                           buttonText: KMLocalizedString("Extract"))
         extractButton.setTarget(self, action: #selector(extractButtonClicked(_ :)))
-        extractWidthButton.constant = extractButton.properties.propertyInfo.viewWidth
         
         cancelButton.properties = ComponentButtonProperty(type: .default_tertiary,
                                                           size: .s,
                                                           state: .normal,
                                                           buttonText: KMLocalizedString("Cancel"))
         cancelButton.setTarget(self, action: #selector(cancelButtonClicked(_ :)))
-        cancelWidthButton.constant = cancelButton.properties.propertyInfo.viewWidth
         
         eachButton.setTarget(self, action: #selector(eachPDFAction(_:)))
         deleteButton.setTarget(self, action: #selector(deletePDFAction(_:)))
-
-        cancelWidthButton.constant = cancelButton.properties.propertyInfo.viewWidth
-        extractWidthButton.constant = extractButton.properties.propertyInfo.viewWidth
     }
 
     override func windowDidLoad() {
         super.windowDidLoad()
-
-        setUpProperty()
         
         if(selectionIndexPaths.count == orgDocument?.pageCount ?? 0) {
             deleteButton.properties.isDisabled = true

+ 79 - 12
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFInsert/KMNPDFInsertBlankWindowController.swift

@@ -107,28 +107,97 @@ class KMNPDFInsertBlankWindowController: KMNBaseWindowController {
         
         standardSelect.updateMenuItemsArr(menuItemArr)
     }
+    
+    override func updateUIThemeColor() {
+        super.updateUIThemeColor()
+        
+        window?.contentView?.wantsLayer = true
+        window?.contentView?.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/popUp").cgColor
+        
+        titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        sizeLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        directionLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        positionLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
 
+        currentRadioButton.reloadData()
+        standardRadioButton.reloadData()
+        customizationRadioButton.reloadData()
+        
+        firstRadioButton.reloadData()
+        lastRadioButton.reloadData()
+        pageRadioButton.reloadData()
+        
+        insertButton.reloadData()
+        cancelButton.reloadData()
+        
+        unitSelect.reloadData()
+        standardSelect.reloadData()
+        positionSelect.reloadData()
+    }
 
-    private func setUpProperty() {
+    override func updateUILanguage() {
+        super.updateUILanguage()
+        
         titleLabel.stringValue = KMLocalizedString("Insert Blank Page")
+        
+        sizeLabel.stringValue = KMLocalizedString("Page Size")
+
+        directionLabel.stringValue = KMLocalizedString("Direction")
+
+        positionLabel.stringValue = KMLocalizedString("Where to insert?")
+        
+        currentRadioButton.properties.text = KMLocalizedString("Current Size")
+        
+        standardRadioButton.properties.text = KMLocalizedString("Standard")
+        
+        customizationRadioButton.properties.text = KMLocalizedString("Custom")
+
+        firstRadioButton.properties.text = KMLocalizedString("First")
+        lastRadioButton.properties.text = KMLocalizedString(("Last"))
+        pageRadioButton.properties.text = KMLocalizedString("Page")
+
+        verticalRadioButton.properties.text = KMLocalizedString("Landscape pages")
+        horizontalRadioButton.properties.text = KMLocalizedString("Portrait pages")
+        
+        setUpPositionSelctProperty()
+        setUpUnitSelctProperty()
+        setUpPageSizeSelctProperty()
+        
+        insertButton.properties.buttonText = KMLocalizedString("Insert")
+        cancelButton.properties.buttonText = KMLocalizedString("Cancel")
+    
+        let positionSelectIndex = positionSelect.indexOfSelect()
+        if positionSelectIndex == 0 {
+            positionSelect.properties.text = KMLocalizedString("After")
+        } else {
+            positionSelect.properties.text = KMLocalizedString("Before")
+        }
+        
+        currentRadioButton.reloadData()
+        standardRadioButton.reloadData()
+        customizationRadioButton.reloadData()
+        
+        firstRadioButton.reloadData()
+        lastRadioButton.reloadData()
+        pageRadioButton.reloadData()
+        
+        insertButton.reloadData()
+        cancelButton.reloadData()
+        positionSelect.reloadData()
+        
+    }
+
+    override func initContentView() {
+        super.initContentView()
         titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
         
-        sizeLabel.stringValue = KMLocalizedString("Form File")
         sizeLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        sizeLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         
-        directionLabel.stringValue = KMLocalizedString("Direction")
         directionLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        directionLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         
-        sizeLabel.stringValue = KMLocalizedString("Page Size")
         sizeLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        sizeLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         
-        positionLabel.stringValue = KMLocalizedString("Where to insert?")
         positionLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        positionLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         var currentPageDex = 0
         
         if(selectionIndexPaths?.count ?? 0 > 0) {
@@ -312,8 +381,6 @@ class KMNPDFInsertBlankWindowController: KMNBaseWindowController {
 
     override func windowDidLoad() {
         super.windowDidLoad()
-
-        setUpProperty()
         
         positionSelect.selectItemAtIndex(0)
         unitSelect.selectItemAtIndex(0)

+ 81 - 10
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFInsert/KMNPDFInsertPDFWindowController.swift

@@ -66,8 +66,6 @@ class KMNPDFInsertPDFWindowController: KMNBaseWindowController {
                insertDocument?.unlock(withPassword: insertPDFPassword)
             }
         }
-             
-        setUpProperty()
     }
     
     override func beginSheetFinish() {
@@ -138,22 +136,95 @@ class KMNPDFInsertPDFWindowController: KMNBaseWindowController {
         positionSelect.updateMenuItemsArr(menuItemArr)
     }
     
-    private func setUpProperty() {
-        titleLabel.stringValue = KMLocalizedString("Insert File")
-        titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
+    override func updateUIThemeColor() {
+        super.updateUIThemeColor()
+        
+        window?.contentView?.wantsLayer = true
+        window?.contentView?.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/popUp").cgColor
+        
         titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        fileLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        pageRangeLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-nor")
+        
+        positionLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+
+        firstRadioButton.reloadData()
+        lastRadioButton.reloadData()
+        pageRadioButton.reloadData()
+        
+        insertButton.reloadData()
+        cancelButton.reloadData()
+        
+        selectFileInput.reloadData()
+        pageRangeSelect.reloadData()
+        positionSelect.reloadData()
+    }
+    
+    override func updateUILanguage() {
+        super.updateUILanguage()
         
+        titleLabel.stringValue = KMLocalizedString("Insert File")
         fileLabel.stringValue = KMLocalizedString("From PDF")
+        pageRangeLabel.stringValue = KMLocalizedString("Page Range:")
+
+        positionLabel.stringValue = KMLocalizedString("Where to insert?")
+        
+        firstRadioButton.properties.text = KMLocalizedString("First")
+        lastRadioButton.properties.text = KMLocalizedString("Last")
+        pageRadioButton.properties.text = KMLocalizedString("Page")
+        
+        firstRadioButton.reloadData()
+        lastRadioButton.reloadData()
+        pageRadioButton.reloadData()
+
+        insertButton.properties.buttonText = KMLocalizedString("Insert")
+        cancelButton.properties.buttonText = KMLocalizedString("Cancel")
+        
+        insertButton.reloadData()
+        cancelButton.reloadData()
+        
+        selectFileInput.properties.text = KMLocalizedString("Browse")
+        selectFileInput.reloadData()
+        
+        setUpPageSelctProperty()
+        setUpPositionSelctProperty()
+        
+        let pageRangeSelectIndex = pageRangeSelect.indexOfSelect()
+    
+        if pageRangeSelectIndex == 0 {
+            pageRangeSelect.properties.text = KMLocalizedString("All Pages")
+        } else if(pageRangeSelectIndex == 1) {
+            pageRangeSelect.properties.text = KMLocalizedString("Odd Pages Only")
+        } else {
+            if(orgDocument?.pageCount ?? 0 > 1 && pageRangeSelectIndex == 2) {
+                pageRangeSelect.properties.text = KMLocalizedString("Even Pages Only")
+            }
+        }
+        
+        let positionSelectIndex = positionSelect.indexOfSelect()
+        if positionSelectIndex == 0 {
+            positionSelect.properties.text = KMLocalizedString("After")
+        } else {
+            positionSelect.properties.text = KMLocalizedString("Before")
+        }
+
+        pageRangeSelect.reloadData()
+        positionSelect.reloadData()
+        
+        pageRadioWidthButton.constant = pageRadioButton.properties.propertyInfo.viewWidth
+        cancelWidthButton.constant = cancelButton.properties.propertyInfo.viewWidth
+        insertWidthButton.constant = insertButton.properties.propertyInfo.viewWidth
+    }
+    
+    override func initContentView() {
+        super.initContentView()
+        titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
+        
         fileLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        fileLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         
-        pageRangeLabel.stringValue = KMLocalizedString("Page Range:")
         pageRangeLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
-        pageRangeLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-nor")
         
-        positionLabel.stringValue = KMLocalizedString("Where to insert?")
         positionLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        positionLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         
         firstRadioButton.properties = ComponentCheckBoxProperty(size: .s,
                                                                 state: .normal,

+ 97 - 26
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNPDFSplit/KMNSplitPDFWindowController.swift

@@ -53,19 +53,94 @@ class KMNSplitPDFWindowController: KMNBaseWindowController {
         let url = URL(fileURLWithPath: filePath)
         workspace.activateFileViewerSelecting([url])
     }
+    
+    override func updateUIThemeColor() {
+        super.updateUIThemeColor()
+        
+        window?.contentView?.wantsLayer = true
+        window?.contentView?.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/popUp").cgColor
+        
+        averagePerRadio.reloadData()
+        averageSplitRadio.reloadData()
+        splitRangeRadio.reloadData()
+        
+        precedeCheckBox.reloadData()
+        tagCheckBox.reloadData()
+        separatorCheckBox.reloadData()
+        
+        cancelButton.reloadData()
+        splitButton.reloadData()
 
-    private func setUpProperty() {
-        titleLabel.stringValue = KMLocalizedString("Split")
-        titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
         titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        methodLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        fileTitleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        averagePernLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
+        fileNameBox.fillColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
+        updateButton()
         
+    }
+    
+    override func updateUILanguage() {
+        super.updateUILanguage()
+
+        titleLabel.stringValue = KMLocalizedString("Split")
         methodLabel.stringValue = KMLocalizedString("Split Method")
+        fileTitleLabel.stringValue = KMLocalizedString("File Name")
+        
+        averagePerRadio.properties.text = KMLocalizedString("Split by every")
+        averageSplitRadio.properties.text = KMLocalizedString("Split averagely to")
+        splitRangeRadio.properties.text = KMLocalizedString("Split by page range")
+        
+        averagePerRadio.reloadData()
+        averageSplitRadio.reloadData()
+        splitRangeRadio.reloadData()
+
+        averagePernLabel.stringValue = KMLocalizedString("page(s)")
+        
+        precedeCheckBox.properties.text = KMLocalizedString("Keep the current file name in front of labels")
+        tagCheckBox.properties.text = KMLocalizedString("Label")
+        separatorCheckBox.properties.text = KMLocalizedString("Separator")
+        
+        precedeCheckBox.reloadData()
+        tagCheckBox.reloadData()
+        separatorCheckBox.reloadData()
+        
+        setUpPageSelctProperty()
+        
+        cancelButton.properties.buttonText = KMLocalizedString("Cancel")
+        splitButton.properties.buttonText = KMLocalizedString("Split")
+        
+        cancelButton.reloadData()
+        splitButton.reloadData()
+        
+        averagePerRadioWidthButton.constant = averagePerRadio.properties.propertyInfo.viewWidth
+        averageSplitRadioWidthButton.constant = averageSplitRadio.properties.propertyInfo.viewWidth
+        splitRangeRadioWidthButton.constant = splitRangeRadio.properties.propertyInfo.viewWidth
+        tagCheckWidthButton.constant = tagCheckBox.properties.propertyInfo.viewWidth
+        separatorCheckWidthButton.constant = separatorCheckBox.properties.propertyInfo.viewWidth
+        cancelWidthButton.constant = cancelButton.properties.propertyInfo.viewWidth
+        splitWidthButton.constant = splitButton.properties.propertyInfo.viewWidth
+        
+        let pageRangeSelectIndex = splitRangeSelect.indexOfSelect()
+    
+        if pageRangeSelectIndex == 0 {
+            splitRangeSelect.properties.text = KMLocalizedString("Odd Pages Only")
+        } else {
+            if(orgDocument?.pageCount ?? 0 > 1 && pageRangeSelectIndex == 1) {
+                splitRangeSelect.properties.text = KMLocalizedString("Even Pages Only")
+            }
+        }
+
+    }
+
+    override func initContentView() {
+        super.initContentView()
+        
+        titleLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
+        
         methodLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        methodLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         
-        fileTitleLabel.stringValue = KMLocalizedString("File Name")
         fileTitleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium")
-        fileTitleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         
         averagePerRadio.properties = ComponentCheckBoxProperty(size: .s,
                                                                state: .normal,
@@ -73,8 +148,6 @@ class KMNSplitPDFWindowController: KMNBaseWindowController {
                                                                showhelp: false,
                                                                text: KMLocalizedString("Split by every"),
                                                                checkboxType: .normal)
-        averagePernLabel.stringValue = KMLocalizedString("page(s)")
-        averagePernLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
         averagePernLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
 
         averageSplitRadio.properties = ComponentCheckBoxProperty(size: .s,
@@ -84,10 +157,8 @@ class KMNSplitPDFWindowController: KMNBaseWindowController {
                                                                  text: KMLocalizedString("Split averagely to"),
                                                                  checkboxType: .normal)
         averageSplitLabel.stringValue = KMLocalizedString("PDF files")
-        averageSplitLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
         averageSplitLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
         
-        fileNameLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         fileNameLabel.font =  ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
 
         splitRangeRadio.properties = ComponentCheckBoxProperty(size: .s,
@@ -184,17 +255,13 @@ class KMNSplitPDFWindowController: KMNBaseWindowController {
                                                          isDisable: false,
                                                          buttonText: KMLocalizedString("Split"))
         splitButton.setTarget(self, action: #selector(splitButtonClicked(_ :)))
-        splitWidthButton.constant = splitButton.properties.propertyInfo.viewWidth
         
         cancelButton.properties = ComponentButtonProperty(type: .default_tertiary,
                                                           size: .s,
                                                           state: .normal,
                                                           buttonText: KMLocalizedString("Cancel"))
         cancelButton.setTarget(self, action: #selector(cancelButtonClicked(_ :)))
-        cancelWidthButton.constant = cancelButton.properties.propertyInfo.viewWidth
-        
-        fileNameBox.fillColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
-        
+                
         averagePerRadio.setTarget(self, action: #selector(splitMethodClicked(_:)))
         averageSplitRadio.setTarget(self, action: #selector(splitMethodClicked(_:)))
         splitRangeRadio.setTarget(self, action: #selector(splitMethodClicked(_:)))
@@ -206,16 +273,22 @@ class KMNSplitPDFWindowController: KMNBaseWindowController {
         setUpPageSelctProperty()
         
         splitRangeSelect.delegate = self
-        
-        averagePerRadioWidthButton.constant = averagePerRadio.properties.propertyInfo.viewWidth
-        averageSplitRadioWidthButton.constant = averageSplitRadio.properties.propertyInfo.viewWidth
-        splitRangeRadioWidthButton.constant = splitRangeRadio.properties.propertyInfo.viewWidth
-        tagCheckWidthButton.constant = tagCheckBox.properties.propertyInfo.viewWidth
-        separatorCheckWidthButton.constant = separatorCheckBox.properties.propertyInfo.viewWidth
-        cancelWidthButton.constant = cancelButton.properties.propertyInfo.viewWidth
-        splitWidthButton.constant = splitButton.properties.propertyInfo.viewWidth
     }
     
+    func updateButton() {
+        if(averageSplitRadio.properties.checkboxType == .selected) {
+            averagePernLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
+            averageSplitLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+        } else if (splitRangeRadio.properties.checkboxType == .selected) {
+            averagePernLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
+            averageSplitLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
+        } else if (averagePerRadio.properties.checkboxType == .selected) {
+            averagePernLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
+            averageSplitLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-dis")
+        }
+    }
+
+    
     private func setUpPageSelctProperty() {
         var menuItemString:[String] = [KMLocalizedString("Odd Pages Only"),
                                        KMLocalizedString("Even Pages Only"),
@@ -239,9 +312,7 @@ class KMNSplitPDFWindowController: KMNBaseWindowController {
 
     override func windowDidLoad() {
         super.windowDidLoad()
-        
-        setUpProperty()
-        
+                
         var isEditIndex:Int = 2
         
         if(orgDocument?.pageCount ?? 0 <= 1) {

+ 38 - 0
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNCustomCollectionViewLayout.swift

@@ -0,0 +1,38 @@
+//
+//  KMNCustomCollectionViewLayout.swift
+//  PDF Reader Pro
+//
+//  Created by 丁林圭 on 2024/11/9.
+//
+
+import Cocoa
+
+class KMNThumCustomCollectionViewFlowLayout: NSCollectionViewFlowLayout {
+    var lineAttributes: NSCollectionViewLayoutAttributes?
+    var lineColor: NSColor = .systemBlue
+    var lineHeight: CGFloat = 4.0
+    
+    override func layoutAttributesForElements(in rect: NSRect) -> [NSCollectionViewLayoutAttributes] {
+        var attributes = super.layoutAttributesForElements(in: rect)
+        
+        // 将指示线添加到布局属性中
+        if let lineAttributes = lineAttributes {
+            attributes.append(lineAttributes)
+        }
+        
+        return attributes
+    }
+    
+    func showLine(at indexPath: IndexPath, below rect: NSRect) {
+        let lineAttributes = NSCollectionViewLayoutAttributes(forDecorationViewOfKind: NSUserInterfaceItemIdentifier("Line").rawValue, with: indexPath)
+
+        lineAttributes.frame = NSRect(x: rect.origin.x, y: rect.origin.y, width: rect.width, height: lineHeight)
+        self.lineAttributes = lineAttributes
+        invalidateLayout()
+    }
+    
+    func hideLine() {
+        lineAttributes = nil
+        invalidateLayout()
+    }
+}

+ 22 - 12
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNPageEditViewController.swift

@@ -22,23 +22,33 @@ class KMNPageEditViewController: KMNThumbnailBaseViewController {
 
      override func viewDidLoad() {
         super.viewDidLoad()
-         
-         backViewBox.fillColor = ComponentLibrary.shared.getComponentColorFromKey("colorBg/layout-pdfView")
-         
-         collectionView.menuClickedAction = { point in
-             let menuStruct = self.clickMenu(point: point)
-             if self.groupView != nil {
-                 self.groupView?.clickedAutoHide = false
-                 self.groupView?.groupDelegate = self
-                 self.groupView?.frame = CGRectMake(0, 0, 180, menuStruct.viewHeight)
-                 self.groupView?.updateGroupInfo(menuStruct.menuitems)
+                  
+         collectionView.menuClickedAction = {[weak self] point in
+             let menuStruct = self?.clickMenu(point: point)
+             if self?.groupView != nil {
+                 self?.groupView?.clickedAutoHide = false
+                 self?.groupView?.groupDelegate = self
+                 self?.groupView?.frame = CGRectMake(0, 0, 180, menuStruct?.viewHeight ?? 0)
+                 self?.groupView?.updateGroupInfo(menuStruct?.menuitems ?? [])
                  
-                 self.groupView?.showWithPoint(CGPoint(x: point.x, y: point.y - menuStruct.viewHeight), relativeTo: self.collectionView)
+                 self?.groupView?.showWithPoint(CGPoint(x: point.x, y: point.y - (menuStruct?.viewHeight ?? 0)), relativeTo: self?.collectionView)
              }
              return NSMenu()
          }
     }
     
+    override func updateUIThemeColor() {
+        super.updateUIThemeColor()
+        
+        backViewBox.fillColor = ComponentLibrary.shared.getComponentColorFromKey("colorBg/layout-pdfView")
+    }
+    
+    override func updateUILanguage() {
+        super.updateUILanguage()
+        
+        self.groupView?.reloadData()
+    }
+    
     private func insertFilePath(filePath:String,pdfPassword:String?) {
         let selectedIndexPaths = collectionView.selectionIndexPaths
         
@@ -123,7 +133,7 @@ extension KMNPageEditViewController: ComponentGroupDelegate {
             cutMenuItemAciton()
         } else if (menuItemProperty?.identifier == ThumbnailMenuIdentifier_Paste) {
             if(menuItemProperty != nil) {
-//                pastMenuItemAciton(menuitemProperty: menuItemProperty!)
+                pastMenuItemAciton(menuitemProperty: menuItemProperty!)
             }
         } else if (menuItemProperty?.identifier == ThumbnailMenuIdentifier_Delete) {
             cutMenuItemAciton()

+ 24 - 0
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumDecorationView.swift

@@ -0,0 +1,24 @@
+//
+//  KMNThumDecorationView.swift
+//  PDF Reader Pro
+//
+//  Created by 丁林圭 on 2024/11/9.
+//
+
+import Cocoa
+
+class KMNThumDecorationView: NSView {
+
+    override func draw(_ dirtyRect: NSRect) {
+        super.draw(dirtyRect)
+        
+        NSColor.systemBlue.setStroke()
+        let path = NSBezierPath()
+        path.move(to: CGPoint(x: dirtyRect.origin.x, y: dirtyRect.origin.y))
+        path.line(to: CGPoint(x: dirtyRect.origin.x + dirtyRect.size.width, y: dirtyRect.origin.y))
+        path.lineWidth = 2.0
+        path.stroke()
+        
+    }
+    
+}

+ 213 - 110
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController+Action.swift

@@ -7,61 +7,114 @@
 
 import Foundation
 
+import KMComponentLibrary
+
 extension KMNThumbnailBaseViewController {
     
+    private func insertImageFilePath(imagePath:String,pageDex:Int)->Bool{
+        var isSuccessFul:Bool = false
+        if (FileManager.default.fileExists(atPath: imagePath)) {
+            if let image = NSImage(contentsOfFile: imagePath) {
+                isSuccessFul = showDocument?.km_insertPage(image.size, withImage: imagePath, at: UInt(pageDex)) == true
+            }
+        }
+        return isSuccessFul
+    }
+    
     private func undoDeleteIndexPaths(deleteIndexPath: Set<IndexPath>) {
         var changeIndex:IndexSet = []
-        for targetIndexPath in deleteIndexPath {
-            changeIndex.insert(targetIndexPath.item)
+        var deletePages:[CPDFPage] = []
+        
+        let pageIndexs = KMNTools.indexpathsToIndexs(indexpaths: deleteIndexPath)
+        for i in pageIndexs {
+            if let page = showDocument?.page(at: UInt(i)) {
+                deletePages.append(page)
+                changeIndex.insert(i)
+            }
         }
-        showDocument?.removePage(at: changeIndex)
+        
+        showDocument?.removePage(at: pageIndexs)
         refreshDatas()
         collectionView.reloadData()
+        
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.undoInsertPages(insertPages: deletePages, indexs: pageIndexs)
+        }
     }
     
-    private func undoInsertPages(insertPages:[CPDFPage],deleteIndexs: [Int]) {
+    private func undoInsertPages(insertPages:[CPDFPage],indexs: IndexSet) {
         var indexpaths = Set<IndexPath>()
-        for (i, page) in insertPages.enumerated() {
-            let index = deleteIndexs[i]
-            showDocument?.insertPageObject(page, at: UInt(index))
+        var count: Int = 0
+        for index in indexs {
+            guard let pageCount = showDocument?.pageCount, index <= pageCount, count < insertPages.count, index != -1 else {
+                KMPrint("index invalid. index: \(index)")
+                break
+            }
+            
+            showDocument?.insertPageObject(insertPages[count], at: UInt(index))
             indexpaths.insert(IndexPath(item: index, section: 0))
+            count += 1
         }
+        
         refreshDatas()
         collectionView.reloadData()
         collectionView.scrollToItems(at: indexpaths, scrollPosition: .centeredVertically)
         collectionView.selectionIndexPaths = indexpaths
+        
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.deletePages(indexpaths: indexpaths)
+        }
     }
     
-    private func undoRotatePages(indexPaths: Set<IndexPath>, rotateAngle: Int) {
-        var tIndexPaths: Set<IndexPath> = []
-        tIndexPaths = indexPaths
-        for targetIndexPath in indexPaths {
-            if let page = showDocument?.page(at: UInt(targetIndexPath.item)) {
-                var pageRotate = page.rotation + rotateAngle
-                if(pageRotate  == -90) {
-                    pageRotate = 270
-                } else if (pageRotate == 450) {
-                    pageRotate = 90
-                    
-                }
-                page.rotation = pageRotate
+    private func undoReplacePages(of targetIndexpaths: Set<IndexPath>, with documents: [CPDFDocument],insertIndexSet:IndexSet,orgPages:[CPDFPage],orgIndexs: IndexSet) {
+        
+        showDocument?.removePage(at: insertIndexSet)
+        
+        var indexpaths = Set<IndexPath>()
+        var count: Int = 0
+        for index in orgIndexs {
+            guard let pageCount = showDocument?.pageCount, index <= pageCount, count < orgPages.count, index != -1 else {
+                KMPrint("index invalid. index: \(index)")
+                break
             }
+            
+            showDocument?.insertPageObject(orgPages[count], at: UInt(index))
+            indexpaths.insert(IndexPath(item: index, section: 0))
+            count += 1
         }
         
-        collectionView.reloadItems(at: tIndexPaths) // Ensure correct type conversion
-        collectionView.selectionIndexPaths = tIndexPaths
-    }
-    
-    private func undoReplacePages(replacePages:[CPDFPage],orgPages:[CPDFPage]) {
+        refreshDatas()
+        collectionView.reloadData()
+        collectionView.scrollToItems(at: indexpaths, scrollPosition: .centeredVertically)
+        collectionView.selectionIndexPaths = indexpaths
         
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.replacePages(of: targetIndexpaths, with: documents)
+        }
     }
     
-    private func undomovePages(movePages:[CPDFPage],orgIndexs:[Int]) {
+    private func undoMovePages(movePages:[CPDFPage],destinationDex:Int,orgPages:[CPDFPage],orgPageDexs:[Int]) {
         
-    }
-    
-    private func undoReversePages(indexs: IndexSet) {
+        for (i, page) in orgPages.enumerated() {
+            let dragIndex = page.pageIndex()
+            let index:UInt = UInt(orgPageDexs[i])
+            showDocument?.movePage(at: dragIndex, withPageAt: index)
+        }
         
+        var indexpaths = Set<IndexPath>()
+        for (_, page) in movePages.enumerated() {
+            let index = page.pageIndex()
+            indexpaths.insert(IndexPath(item: Int(index), section: 0))
+        }
+
+        refreshDatas()
+        collectionView.reloadData()
+        collectionView.scrollToItems(at: indexpaths, scrollPosition: .centeredVertically)
+        collectionView.selectionIndexPaths = indexpaths
+        
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.movePages(dragPages: movePages, destinationDex: destinationDex)
+        }
     }
     
     func insertFileComplete(newSelectIndexs: Set<IndexPath>){
@@ -74,6 +127,10 @@ extension KMNThumbnailBaseViewController {
         
         let firstIndexPath = newSelectIndexs.first
         collectionView.scrollToItems(at: [firstIndexPath ?? IndexPath(item: 0, section: 0)], scrollPosition: .top)
+        
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.undoDeleteIndexPaths(deleteIndexPath: newSelectIndexs)
+        }
     }
     
     public func insertFormPages(insertPages: [CPDFPage],pageDex:Int) {
@@ -107,6 +164,10 @@ extension KMNThumbnailBaseViewController {
         collectionView.reloadData()
         collectionView.scrollToItems(at: indexpaths, scrollPosition: .centeredVertically)
         collectionView.selectionIndexPaths = indexpaths
+                
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.undoDeleteIndexPaths(deleteIndexPath: indexpaths)
+        }
     }
     
     public func insertBlankSize(pageSize: CGSize,pageDex:Int) {
@@ -120,16 +181,10 @@ extension KMNThumbnailBaseViewController {
         collectionView.reloadData()
         collectionView.scrollToItems(at: indexpaths, scrollPosition: .centeredVertically)
         collectionView.selectionIndexPaths = indexpaths
-    }
-    
-    public func insertImageFilePath(imagePath:String,pageDex:Int)->Bool{
-        var isSuccessFul:Bool = false
-        if (FileManager.default.fileExists(atPath: imagePath)) {
-            if let image = NSImage(contentsOfFile: imagePath) {
-                isSuccessFul = showDocument?.km_insertPage(image.size, withImage: imagePath, at: UInt(pageDex)) == true
-            }
+        
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.undoDeleteIndexPaths(deleteIndexPath: indexpaths)
         }
-        return isSuccessFul
     }
     
     public func rotatePages(indexPaths: Set<IndexPath>, rotateAngle: Int) {
@@ -155,6 +210,10 @@ extension KMNThumbnailBaseViewController {
         
         collectionView.reloadItems(at: tIndexPaths) // Ensure correct type conversion
         collectionView.selectionIndexPaths = tIndexPaths
+        
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.rotatePages(indexPaths: tIndexPaths, rotateAngle: -rotateAngle)
+        }
     }
     
     public func reversePages(indexs: IndexSet) {
@@ -185,6 +244,10 @@ extension KMNThumbnailBaseViewController {
                 collectionView.reloadItems(at: selected_indexpaths)
                 
                 collectionView.selectionIndexPaths = selected_indexpaths
+                
+                currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+                    self?.reversePages(indexs: indexs)
+                }
             }
         }
     }
@@ -195,18 +258,25 @@ extension KMNThumbnailBaseViewController {
             return
         }
         var index = targetIndexpaths.sorted().first!.item
-        var tIndexPaths: Set<IndexPath> = []
         
-        let indexSet = KMNTools.indexpathsToIndexs(indexpaths: targetIndexpaths)
+        var deletePages:[CPDFPage] = []
         
+        let indexSet = KMNTools.indexpathsToIndexs(indexpaths: targetIndexpaths)
+        for i in indexSet {
+            if let page = showDocument?.page(at: UInt(i)) {
+                deletePages.append(page)
+            }
+        }
         showDocument?.removePage(at: indexSet)
         
+        var tIndexPaths: Set<IndexPath> = []
         for document in documents {
             for i in 0 ..< document.pageCount {
-                let page = document.page(at: i)
-                showDocument?.insertPageObject(page, at: UInt(index))
-                tIndexPaths.insert(IndexPath(item: index, section: 0))
-                index += 1
+                if let page = document.page(at: i) {
+                    showDocument?.insertPageObject(page, at: UInt(index))
+                    tIndexPaths.insert(IndexPath(item: index, section: 0))
+                    index += 1
+                }
             }
             thumbnailBaseViewDelegate?.insertPDFThumbnailViewControlle?(pageEditVC: self, pdfDocment: document)
         }
@@ -214,25 +284,54 @@ extension KMNThumbnailBaseViewController {
         refreshDatas()
         collectionView.reloadData()
         collectionView.selectionIndexPaths = tIndexPaths
+        
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.undoReplacePages(of: targetIndexpaths, with: documents, insertIndexSet: KMNTools.indexpathsToIndexs(indexpaths: tIndexPaths), orgPages: deletePages,orgIndexs: indexSet)
+        }
     }
     
     public func deletePages(indexpaths:Set<IndexPath>) {
         var changeIndex:IndexSet = []
         var deletePages:[CPDFPage] = []
         
-        for targetIndexPath in indexpaths {
-            deletePages.append(showDocument?.page(at: UInt(targetIndexPath.item)) ?? CPDFPage())
-            changeIndex.insert(targetIndexPath.item)
+        let pageIndexs = KMNTools.indexpathsToIndexs(indexpaths: indexpaths)
+        for i in pageIndexs {
+            if let page = showDocument?.page(at: UInt(i)) {
+                deletePages.append(page)
+                changeIndex.insert(i)
+            }
         }
         showDocument?.removePage(at: changeIndex)
+        collectionView.selectionIndexPaths = []
         refreshDatas()
         collectionView.reloadData()
+
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.undoInsertPages(insertPages: deletePages, indexs: pageIndexs)
+        }
     }
     
-    public func movePages(pages:[CPDFPage],destinationDex:Int) {
+    public func movePages(dragPages:[CPDFPage],destinationDex:Int) {
+        guard !dragPages.isEmpty else { return }
+        
         var destinationIndex = destinationDex
+        let maxDragPageIndex = dragPages.last?.pageIndex() ?? 0
+        let minDragPageIndex = dragPages.first?.pageIndex() ?? 0
         
-        for dragPage in dragLocalityPages {
+        let rangeStart = min(Int(minDragPageIndex), destinationIndex)
+        let rangeEnd = max(Int(maxDragPageIndex), destinationIndex)
+    
+        var changePages:[CPDFPage] = []
+        var changePageIndexs:[Int] = []
+
+        for index in (rangeStart...rangeEnd) {
+            if let changePage = showDocument?.page(at: UInt(index)) {
+                changePages.append(changePage)
+                changePageIndexs.append(index)
+            }
+        }
+
+        for dragPage in dragPages {
             let dragIndex = dragPage.pageIndex()
             if destinationIndex > dragIndex {
                 destinationIndex -= 1
@@ -245,7 +344,7 @@ extension KMNThumbnailBaseViewController {
         
         var selectIndexPaths: Set<IndexPath> = []
         
-        for dragPage in dragLocalityPages {
+        for dragPage in dragPages {
             let dragIndex = dragPage.pageIndex()
             selectIndexPaths.insert(IndexPath(item: Int(dragIndex), section: 0))
         }
@@ -256,6 +355,10 @@ extension KMNThumbnailBaseViewController {
         if selectIndexPaths.isEmpty { return }
         let firstIndexPath = selectIndexPaths.first
         collectionView.scrollToItems(at: [firstIndexPath ?? IndexPath(item: 0, section: 0)], scrollPosition: .top)
+        
+        currentUndoManager?.registerUndo(withTarget: self) { [weak self] targetType in
+            self?.undoMovePages(movePages: dragPages, destinationDex: destinationDex, orgPages: changePages, orgPageDexs: changePageIndexs)
+        }
     }
     
     public func insertFromFilePath(fileNames:[String],formDex:Int,indexDex:UInt,selectIndexs:Set<IndexPath>,completionBlock:@escaping (Set<IndexPath>)->Void)-> Void {
@@ -460,66 +563,66 @@ extension KMNThumbnailBaseViewController {
         }
     }
     
-//    @objc public func pastMenuItemAciton(menuitemProperty:ComponentMenuitemProperty) {
-//        if IAPProductsManager.default().isAvailableAllFunction() == false {
-//            let winC = KMPurchaseCompareWindowController.sharedInstance()
-//            winC?.showWindow(nil)
-//            return
-//        }
-//        
-//        var pastIndex = 1
-//        let point = menuitemProperty.representedObject as? NSPoint
-//        
-//        if(point != nil) {
-//            let pointInCollectionView = collectionView.convert(point!, from: nil)
-//            
-//            let visibleItems = collectionView.visibleItems()
-//            let mouseX = pointInCollectionView.x
-//            let mouseY = pointInCollectionView.y
-//            
-//            // 获取当前行的所有 cell
-//            let currentRowItems = visibleItems.filter { item in
-//                if let indexPath = collectionView.indexPath(for: item),
-//                   let cellAttributes = collectionView.layoutAttributesForItem(at: indexPath) {
-//                    return cellAttributes.frame.minY <= mouseY && cellAttributes.frame.maxY >= mouseY
-//                }
-//                return false
-//            }
-//            if(mouseX < 24) { //点击区域在最左边
-//                // 找到最近右边的 cell
-//                let rightMostCell = currentRowItems.compactMap { collectionView.indexPath(for: $0) }
-//                    .filter { indexPath in
-//                        let cellRect = collectionView.layoutAttributesForItem(at: indexPath)?.frame
-//                        return cellRect?.minX ?? 0 > mouseX // 只选择右侧的 cell
-//                    }
-//                    .sorted { ($0.item < $1.item) } // 按 item 的顺序排列
-//                    .first // 选择第一个,即最右边的 cell
-//                pastIndex = (rightMostCell?.item ?? (Int(showDocument?.pageCount ?? 1)))
-//            } else {
-//                // 找到最近右边的 cell
-//                let leftMostCell = currentRowItems.compactMap { collectionView.indexPath(for: $0) }
-//                    .filter { indexPath in
-//                        let cellRect = collectionView.layoutAttributesForItem(at: indexPath)?.frame
-//                        return cellRect?.maxX ?? 0 < mouseX // 只选择左侧的 cell
-//                    }
-//                    .sorted { $0.item > $1.item } // 按 item 的逆序排列,以选择最近的左侧 cell
-//                    .first // 选择第一个,即最近的左边的 cell
-//                
-//                pastIndex = (leftMostCell?.item ?? (Int(showDocument?.pageCount ?? 1)) - 1) + 1
-//            }
-//        } else {
-//            let selectedIndexPaths = collectionView.selectionIndexPaths
-//            if(selectedIndexPaths.count > 0) {
-//                let maxmumIndexPath = selectedIndexPaths.max(by: { $0 < $1 })
-//                pastIndex = ((maxmumIndexPath?.item ?? 0) + 1)
-//            } else {
-//                pastIndex = Int(showDocument?.pageCount ?? 0)
-//            }
-//        }
-//        let copyPages = KMNThumbnailManager.manager.copyPages
-//        
-//        insertFormPages(insertPages: copyPages, pageDex: pastIndex)
-//    }
+    @objc public func pastMenuItemAciton(menuitemProperty:ComponentMenuitemProperty) {
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.showWindow(nil)
+            return
+        }
+        
+        var pastIndex = 1
+        let point = menuitemProperty.representedObject as? NSPoint
+        
+        if(point != nil) {
+            let pointInCollectionView = collectionView.convert(point!, from: nil)
+            
+            let visibleItems = collectionView.visibleItems()
+            let mouseX = pointInCollectionView.x
+            let mouseY = pointInCollectionView.y
+            
+            // 获取当前行的所有 cell
+            let currentRowItems = visibleItems.filter { item in
+                if let indexPath = collectionView.indexPath(for: item),
+                   let cellAttributes = collectionView.layoutAttributesForItem(at: indexPath) {
+                    return cellAttributes.frame.minY <= mouseY && cellAttributes.frame.maxY >= mouseY
+                }
+                return false
+            }
+            if(mouseX < 24) { //点击区域在最左边
+                // 找到最近右边的 cell
+                let rightMostCell = currentRowItems.compactMap { collectionView.indexPath(for: $0) }
+                    .filter { indexPath in
+                        let cellRect = collectionView.layoutAttributesForItem(at: indexPath)?.frame
+                        return cellRect?.minX ?? 0 > mouseX // 只选择右侧的 cell
+                    }
+                    .sorted { ($0.item < $1.item) } // 按 item 的顺序排列
+                    .first // 选择第一个,即最右边的 cell
+                pastIndex = (rightMostCell?.item ?? (Int(showDocument?.pageCount ?? 1)))
+            } else {
+                // 找到最近右边的 cell
+                let leftMostCell = currentRowItems.compactMap { collectionView.indexPath(for: $0) }
+                    .filter { indexPath in
+                        let cellRect = collectionView.layoutAttributesForItem(at: indexPath)?.frame
+                        return cellRect?.maxX ?? 0 < mouseX // 只选择左侧的 cell
+                    }
+                    .sorted { $0.item > $1.item } // 按 item 的逆序排列,以选择最近的左侧 cell
+                    .first // 选择第一个,即最近的左边的 cell
+                
+                pastIndex = (leftMostCell?.item ?? (Int(showDocument?.pageCount ?? 1)) - 1) + 1
+            }
+        } else {
+            let selectedIndexPaths = collectionView.selectionIndexPaths
+            if(selectedIndexPaths.count > 0) {
+                let maxmumIndexPath = selectedIndexPaths.max(by: { $0 < $1 })
+                pastIndex = ((maxmumIndexPath?.item ?? 0) + 1)
+            } else {
+                pastIndex = Int(showDocument?.pageCount ?? 0)
+            }
+        }
+        let copyPages = KMNThumbnailManager.manager.copyPages
+        
+        insertFormPages(insertPages: copyPages, pageDex: pastIndex)
+    }
     
     @objc public func cutMenuItemAciton() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {

+ 13 - 3
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.swift

@@ -61,7 +61,8 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
     @IBOutlet var backViewBox: NSBox!
     @IBOutlet var scrollView: NSScrollView!
     @IBOutlet var collectionView: KMNThumbnailCollectionView!
-    
+    @IBOutlet var flowLayout: KMNThumCustomCollectionViewFlowLayout!
+
     private var currentDocument:CPDFDocument?
     private var isChangeIndexPaths = false
     
@@ -233,7 +234,6 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
     
     override func viewDidLoad() {
         super.viewDidLoad()
-        let zzz =  self.view.undoManager
 
         collectionView.delegate = self
         collectionView.dataSource = self
@@ -249,6 +249,16 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
         collectionView.setDraggingSourceOperationMask(.every, forLocal: false)
         collectionView.setDraggingSourceOperationMask(.every, forLocal: true)
         
+        collectionView.collectionSelectChanges = {[weak self] in
+            if self?.isChangeIndexPaths == false {
+                let indexpathsz = self?.collectionView.selectionIndexPaths
+                let dex:IndexSet = KMNTools.indexpathsToIndexs(indexpaths: indexpathsz ?? [])
+                let selectedIndexPathsString = KMNTools.parseIndexSet(indexSet: dex)
+                
+                self?.thumbnailBaseViewDelegate?.changeIndexPathsThumbnailViewControlle?(pageEditVC: self, selectionIndexPaths: indexpathsz ?? [], selectionStrings: selectedIndexPathsString)
+            }
+        }
+        
         refreshDatas()
     }
     
@@ -549,7 +559,7 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
                         dropOperation: NSCollectionView.DropOperation) -> Bool {
         let pboard = draggingInfo.draggingPasteboard
         if dragLocalityPages.count != 0 {
-            movePages(pages: dragLocalityPages, destinationDex: indexPath.item)
+            movePages(dragPages: dragLocalityPages, destinationDex: indexPath.item)
             return true
         } else if ((pboard.availableType(from: [.fileURL])) != nil) {
             let index = indexPath.item

+ 2 - 1
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.xib

@@ -10,6 +10,7 @@
             <connections>
                 <outlet property="backViewBox" destination="CuB-Dn-dzz" id="dxa-1R-qFC"/>
                 <outlet property="collectionView" destination="zKK-EM-MTi" id="9vL-hb-IJk"/>
+                <outlet property="flowLayout" destination="s08-Bd-SKp" id="KYi-DU-mrx"/>
                 <outlet property="scrollView" destination="MtL-9j-REw" id="0rS-ia-yAU"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
             </connections>
@@ -35,7 +36,7 @@
                                         <collectionView id="zKK-EM-MTi" customClass="KMNThumbnailCollectionView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                             <rect key="frame" x="0.0" y="0.0" width="861" height="158"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
-                                            <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="s08-Bd-SKp">
+                                            <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="s08-Bd-SKp" customClass="KMNThumCustomCollectionViewFlowLayout" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                 <size key="itemSize" width="50" height="50"/>
                                             </collectionViewFlowLayout>
                                             <color key="primaryBackgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>

+ 8 - 1
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailCollectionView.swift

@@ -10,7 +10,8 @@ import Cocoa
 class KMNThumbnailCollectionView: NSCollectionView {
     var menuClickedAction: ((_ clickPoint: NSPoint) -> NSMenu)?
     
-    
+    var collectionSelectChanges: (() -> Void)?
+
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
         
@@ -46,4 +47,10 @@ class KMNThumbnailCollectionView: NSCollectionView {
         return super.menu(for: event)
     }
     
+    override var selectionIndexPaths: Set<IndexPath> {
+        didSet {
+            collectionSelectChanges?()
+        }
+    }
+    
 }

+ 26 - 14
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Background/Background/KMBackgroundController.swift

@@ -22,17 +22,17 @@ class KMBackgroundController: NSViewController {
     
     @IBOutlet var preInfoView: NSView!
     @IBOutlet var propertyInfoView: NSView!
-     
+    
     var documentPreview: KMEditDocumentController = KMEditDocumentController.init()
     var propertyController: KMBackgroundPropertyController = KMBackgroundPropertyController.init()
     var templatesController: KMBGTemplateController = KMBGTemplateController()
-  
+    
     var saveTemplateMessage: ComponentMessage = ComponentMessage()
     
     var pdfDocument: CPDFDocument?
-        
+    
     var backgroundModel: KMBackgroundModel?
-
+    
     var editSubType: KMPDFEditSubModeType = .none
     
     weak open var delegate: KMBackgroundControllerDelegate?
@@ -62,7 +62,7 @@ class KMBackgroundController: NSViewController {
     
     func setupProperty() {
         saveTemplateMessage.properties = ComponentMessageProperty(messageType: .success, title: KMLocalizedString("Saved Template"))
-         
+        
     }
     
     func reloadData() {
@@ -85,9 +85,7 @@ class KMBackgroundController: NSViewController {
             propertyController.view.isHidden = false
             propertyController.editSubType = editSubType
             
-            
         }
-        
         documentPreview.pdfDocument = pdfDocument
         documentPreview.reloadData()
         
@@ -95,28 +93,32 @@ class KMBackgroundController: NSViewController {
     
     func updatePDFDocumentBackground() {
         if let data = backgroundModel {
-            
             let cPDFBackground = documentPreview.pdfDocument?.background()
-            
             cPDFBackground?.type = data.type
-            cPDFBackground?.color = data.color
+            if cPDFBackground?.type == .color {
+                cPDFBackground?.color = data.color
+            } else if cPDFBackground?.type == .image {
+                if data.imagePath != nil {
+                    cPDFBackground?.setImage(data.image())
+                } else {
+                    cPDFBackground?.setImage(nil)
+                }
+            }
             cPDFBackground?.scale =  data.scale
             cPDFBackground?.rotation = data.rotation
             cPDFBackground?.opacity = data.opacity
-            
             cPDFBackground?.verticalAlignment = UInt(data.verticalMode)
             cPDFBackground?.horizontalAlignment = UInt(data.horizontalMode)
             cPDFBackground?.xOffset = data.horizontalSpace
             cPDFBackground?.yOffset = data.verticalSpace
-            
+            cPDFBackground?.pageString = "0"
             cPDFBackground?.isAllowsView = true
             cPDFBackground?.update()
             
-            self.documentPreview.refreshUI(true)
+            self.documentPreview.refreshUI()
             
         } else {
             pdfDocument?.background().clear()
-            
             documentPreview.refreshUI()
         }
     }
@@ -131,6 +133,16 @@ extension KMBackgroundController: KMBackgroundPropertyControllerDelegate {
         updatePDFDocumentBackground()
     }
     
+    func backgroundPropertyControllerDidChangetoTemplate(_ controller: KMBackgroundPropertyController) {
+        editSubType = .template
+        
+        backgroundModel = nil
+        
+        updatePDFDocumentBackground()
+        
+        reloadData()
+    }
+    
     func backgroundPropertyControllerSaveTemplateSuccess(_ controller: KMBackgroundPropertyController, _ data: KMBackgroundModel) {
         editSubType = .template
         

+ 24 - 24
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Background/Background/Views/KMBackgroundPropertyController.swift

@@ -13,10 +13,10 @@ import KMComponentLibrary
     //水印数据有更新
     @objc optional func backgroundPropertyControllerDidUpdate(_ controller: KMBackgroundPropertyController)
     
-//    //切换到模板界面
-//    @objc optional func watermarkPropertyControllerDidChangetoTemplate(_ controller: KMNWatermarkPropertyController)
-// 
-//    //成功保存到模板
+    //切换到模板界面
+    @objc optional func backgroundPropertyControllerDidChangetoTemplate(_ controller: KMBackgroundPropertyController)
+ 
+    //成功保存到模板
     @objc optional func backgroundPropertyControllerSaveTemplateSuccess(_ controller: KMBackgroundPropertyController, _ data: KMBackgroundModel)
 //
 //    //取消修改模板信息
@@ -281,7 +281,7 @@ class KMBackgroundPropertyController: NSViewController {
     }
     
     @objc func templateButtonClicked(_ sender: ComponentButton) {
-//        delegate?.watermarkPropertyControllerDidChangetoTemplate?(self)
+        delegate?.backgroundPropertyControllerDidChangetoTemplate?(self)
     }
     
     @objc func checkBoxClicked(_ sender: ComponentCheckBox) {
@@ -334,21 +334,21 @@ class KMBackgroundPropertyController: NSViewController {
                     guard !pdf!.isEncrypted else { return }
                     
                     if let image = self.generateThumbnail(for: url) {
-//                        let outFolder = KMWatermarkManager.defaultManager.watermarkFolderPath?.stringByAppendingPathComponent(("temp/" + self.watermarkData.tag))
-//                        if (FileManager.default.fileExists(atPath: outFolder!) == false) {
-//                            try?FileManager.default.createDirectory(atPath: outFolder!, withIntermediateDirectories: true)
-//                        }
-//                        let fileName = filePath.getLastComponentDeleteExtension
-//                        if let outFolderPath = outFolder?.stringByAppendingPathComponent(fileName + ".png") {
-//                            try?image.pngData()?.write(to: URL(fileURLWithPath: outFolderPath))
-//                            
-//                            if FileManager.default.fileExists(atPath: outFolderPath) {
-//                                self.watermarkData.imagePath = outFolderPath
-//                                self.delegate?.watermarkPropertyControllerDidUpdate?(self)
-//                                
-//                                self.reloadData()
-//                            }
-//                        }
+                        let outFolder = KMBackgroundManager.defaultManager.kBackgroundFolderPath?.stringByAppendingPathComponent(("temp/" + self.backgroundData.backgroundID))
+                        if (FileManager.default.fileExists(atPath: outFolder!) == false) {
+                            try?FileManager.default.createDirectory(atPath: outFolder!, withIntermediateDirectories: true)
+                        }
+                        let fileName = filePath.getLastComponentDeleteExtension
+                        if let outFolderPath = outFolder?.stringByAppendingPathComponent(fileName + ".png") {
+                            try?image.pngData()?.write(to: URL(fileURLWithPath: outFolderPath))
+                            
+                            if FileManager.default.fileExists(atPath: outFolderPath) {
+                                self.backgroundData.imagePath = outFolderPath
+                                self.delegate?.backgroundPropertyControllerDidUpdate?(self)
+                                
+                                self.reloadData()
+                            }
+                        }
                     }
                 } else {
                     let image = NSImage(contentsOfFile: url.path)
@@ -367,7 +367,7 @@ class KMBackgroundPropertyController: NSViewController {
                     }
                     self.backgroundData.imagePath = url.path
 
-//                    self.delegate?.watermarkPropertyControllerDidUpdate?(self)
+                    self.delegate?.backgroundPropertyControllerDidUpdate?(self)
                     
                     self.reloadData()
 
@@ -421,7 +421,7 @@ extension KMBackgroundPropertyController: ComponentTabsDelegate {
         }
         reloadData()
         
-//        delegate?.watermarkPropertyControllerDidUpdate?(self)
+        delegate?.backgroundPropertyControllerDidUpdate?(self)
     }
 }
 
@@ -492,11 +492,11 @@ extension KMBackgroundPropertyController: ComponentCPositionDelegate {
     func componentCPositionDidChoose(_ view: NSView, _ row: Int, _ column: Int) {
         if view == positionItemView {
             if row == 0 {
-                backgroundData.verticalMode = 0
+                backgroundData.verticalMode = 2
             } else if row == 1 {
                 backgroundData.verticalMode = 1
             } else if row == 2 {
-                backgroundData.verticalMode = 2
+                backgroundData.verticalMode = 0
             }
             
             if column == 0 {

+ 6 - 6
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Background/Background/Views/KMBackgroundPropertyController.xib

@@ -55,7 +55,7 @@
                                         <constraint firstAttribute="width" constant="24" id="mhU-Ee-fIE"/>
                                     </constraints>
                                 </customView>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wwm-pR-ypi">
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wwm-pR-ypi">
                                     <rect key="frame" x="92" y="12" width="98" height="16"/>
                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Add Watermark" id="r1J-ly-gkd">
                                         <font key="font" usesAppearanceFont="YES"/>
@@ -116,7 +116,7 @@
                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="5Sz-4h-cCv">
                                             <rect key="frame" x="0.0" y="32" width="232" height="40"/>
                                             <subviews>
-                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ncu-VP-FCF">
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ncu-VP-FCF">
                                                     <rect key="frame" x="-2" y="12" width="37" height="16"/>
                                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Color" id="T9y-tS-1zc">
                                                         <font key="font" usesAppearanceFont="YES"/>
@@ -182,7 +182,7 @@
                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="qqz-0x-e9m">
                                             <rect key="frame" x="0.0" y="112" width="232" height="40"/>
                                             <subviews>
-                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zL5-lV-raj">
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zL5-lV-raj">
                                                     <rect key="frame" x="-2" y="12" width="77" height="16"/>
                                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Appearance" id="5JU-lb-hpL">
                                                         <font key="font" usesAppearanceFont="YES"/>
@@ -279,7 +279,7 @@
                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="4nv-va-3Dv">
                                             <rect key="frame" x="0.0" y="72" width="232" height="40"/>
                                             <subviews>
-                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jjK-lW-PAY">
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jjK-lW-PAY">
                                                     <rect key="frame" x="-2" y="12" width="85" height="16"/>
                                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Position(mm)" id="PwP-u8-dzG">
                                                         <font key="font" usesAppearanceFont="YES"/>
@@ -301,7 +301,7 @@
                                                 <constraint firstAttribute="width" constant="72" id="g8S-vW-SnO"/>
                                             </constraints>
                                         </customView>
-                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="57e-Ta-egR">
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="57e-Ta-egR">
                                             <rect key="frame" x="119" y="48" width="17" height="16"/>
                                             <textFieldCell key="cell" lineBreakMode="clipping" title="X:" id="Ozf-In-RTz">
                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -316,7 +316,7 @@
                                                 <constraint firstAttribute="width" constant="96" id="mqd-0a-QWf"/>
                                             </constraints>
                                         </customView>
-                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TNt-Cv-pwd">
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TNt-Cv-pwd">
                                             <rect key="frame" x="120" y="8" width="16" height="16"/>
                                             <textFieldCell key="cell" lineBreakMode="clipping" title="Y:" id="L0W-dl-tga">
                                                 <font key="font" usesAppearanceFont="YES"/>

+ 0 - 251
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPreviewController.swift

@@ -1,251 +0,0 @@
-//
-//  KMBatesPreviewController.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/12/28.
-//
-
-import Cocoa
-
-/// Bates码 预览控制器
-class KMBatesPreviewController: KMWatermarkAdjectivePreViewBaseController {
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        
-        let itemTitles = [[NSLocalizedString("Add Bates Number", comment: ""), NSLocalizedString("Delete Bates Number", comment: "")], [NSLocalizedString("Batch", comment: "")]]
-        var itemModels: Array<Array<KMWatermarkAdjectiveTopBarItemModel>> = []
-        for items in itemTitles {
-            var array: Array<KMWatermarkAdjectiveTopBarItemModel> = []
-            for title in items {
-                let model = KMWatermarkAdjectiveTopBarItemModel()
-                model.iconName = ""
-                model.itemTitle = title
-                array.append(model)
-            }
-            itemModels.append(array)
-        }
-        
-        self.topBarView.initItemData(itemArrays: itemModels)
-        self.topBarView.selectTopItem(index: 0)
-        
-        let preView: KMWatermarkPDFView_OC = KMWatermarkPDFView_OC()
-        self.preView = preView
-        self.preView.frame = self.preViewBox.contentView!.bounds
-        self.preView.autoresizingMask = [.width, .height]
-        self.preViewBox.contentView?.addSubview(self.preView)
-        self.preView.setDisplay(.singlePage)
-        
-        let controller = KMBatesPropertyHomeController()
-        controller.view.frame = self.rightBox.contentView!.bounds
-        controller.view.autoresizingMask = [.width, .height]
-        self.right_gotoViewController(viewController: controller)
-        controller.modelDidChange = { [weak self] model in
-//            if (model == nil || (model! as! KMHeaderFooterObject).hasVaild == false) {
-//                self!.topBarView.isCanApply(can: false)
-//                self?.model = nil
-//            } else {
-//                self!.topBarView.isCanApply(can: true)
-//                self!.model = model as! KMWatermarkAdjectiveBaseModel
-//                self!.model?.pageCount = Int((self?.preView.document.pageCount)!)
-//            }
-            
-            (self?.preView as! KMWatermarkPDFView_OC).model = model
-        }
-    }
-    
-    override func viewDidAppear() {
-        super.viewDidAppear()
-        
-        (self.rightViewController as! KMBatesPropertyHomeController).pageCount = Int(self.preView.document.pageCount)
-    }
-    
-    override func topItemClick(index: Int) {
-        if (index == 0) { /// 添加
-            return
-        }
-        if (index == 2) { /// 批量
-//            KMBatchWindowController.openFile(nil, .BatesCode)
-            return
-        }
-        
-        /// 移除
-        self.beginLoading()
-        self.deleteBates(toPath: self.preView.document.documentURL.path) {
-            result in
-            
-            self.endLoading()
-            if (result) {
-                DispatchQueue.main.async {
-                    self.preView.document = CPDFDocument(url: self.preView.document.documentURL)
-                }
-            } else {
-                let alert = NSAlert()
-                alert.alertStyle = .critical
-                alert.messageText = NSLocalizedString("Failure", comment: "")
-                alert.runModal()
-            }
-        }
-    }
-    
-    override func applyAction() {
-        self.view.window?.makeFirstResponder(nil)
-        
-        if (self.model == nil) {
-            let alert = NSAlert()
-            alert.alertStyle = .critical
-            alert.messageText = NSLocalizedString("Failure", comment: "")
-            alert.runModal()
-            return
-        }
-        
-//        if ((self.model as! KMHeaderFooterObject).hasVaild == false) {
-//            let alert = NSAlert()
-//            alert.alertStyle = .critical
-//            alert.messageText = NSLocalizedString("Failure", comment: "")
-//            alert.runModal()
-//            return
-//        }
-        
-        self.beginLoading()
-//        self.addBates(model: self.model! as! KMHeaderFooterObject, toPath: self.preView.document.documentURL.path, completion: {
-//            result in
-//            DispatchQueue.main.async {
-//                self.preView.layoutDocumentView()
-//                self.preView.setNeedsDisplayForVisiblePages()
-//            }
-//            self.endLoading()
-//            if (result) {
-//                guard let callback = self.itemClick else {
-//                    return
-//                }
-//                callback(1, nil)
-//            } else {
-//                let alert = NSAlert()
-//                alert.alertStyle = .critical
-//                alert.messageText = NSLocalizedString("Failure", comment: "")
-//                alert.runModal()
-//            }
-//        })
-    }
-    
-    private func addBates(model: KMHeaderFooterObject, toPath: String, completion: @escaping (_ result: Bool) -> ()) {
-        DispatchQueue.global().async {
-            let document: CPDFDocument = self.applyDocument!
-            var property = document.bates()
-            
-            var fontSize = 0.0
-            var fontName: String = ""
-            switch self.model!.textFont {
-            case .font(name: let name, size: let size):
-                fontName = name
-                fontSize = size
-                break
-            default:
-                break
-            }
-            
-            let font = NSFont.boldSystemFont(ofSize:fontSize)
-            let style = NSMutableParagraphStyle()
-            style.alignment = .center
-            style.lineBreakMode = .byCharWrapping
-            let size: NSSize = "text".boundingRect(with: NSSize(width: 1000, height: 1000), options: NSString.DrawingOptions(rawValue: 3), attributes: [NSAttributedString.Key.font : font, NSAttributedString.Key.paragraphStyle : style]).size
-            
-            property?.margin = NSEdgeInsetsMake(max(CGFloat(model.topMargin)-size.height, 0), CGFloat(model.leftMargin), max(CGFloat(model.bottomMargin)-size.height, 0), CGFloat(model.rightMargin))
-            
-            let strings = [model.topLeftString, model.topCenterString, model.topRightString, model.bottomLeftString, model.bottomCenterString, model.bottomRightString]
-            var count: Int = 0
-            
-            var color: NSColor!
-//            switch model.textColor {
-//            case .color(red: let red, green: let green, blue: let blue, alpha: let alpha):
-//                color = NSColor(red: red, green: green, blue: blue, alpha: alpha)
-//            default:
-//                break
-//            }
-            
-            if (color == nil) {
-                color = NSColor.black
-            }
-            
-            for text in strings {
-                property?.setText(text, at: UInt(count))
-                property?.setTextColor(color, at: UInt(count))
-                property?.setFontSize(fontSize, at: UInt(count))
-                property?.setFontName(fontName, at: UInt(count))
-                count += 1
-            }
-            
-//            let pagesString = self.findPagesString(model)
-//            if (pagesString.isEmpty) {
-//                property?.pageString = "0-\(document.pageCount-1)"
-//            } else {
-//                property?.pageString = pagesString
-//            }
-           
-            property?.update()
-            
-            /// 保存到临时路径
-            let documentPath = NSTemporaryDirectory()
-            let tempPath: String = "\(documentPath)/\(toPath.lastPathComponent)"
-            if (FileManager.default.fileExists(atPath: tempPath)) {
-                try?FileManager.default.removeItem(atPath: tempPath)
-            }
-            
-            let result = document.write(to: URL(fileURLWithPath: tempPath))
-            if (result) {
-                if (FileManager.default.fileExists(atPath: toPath)) {
-                    try?FileManager.default.removeItem(atPath: toPath)
-                }
-                
-                try?FileManager.default.moveItem(atPath: tempPath, toPath: toPath)
-            } else {
-                try?FileManager.default.removeItem(atPath: tempPath)
-            }
-            
-            DispatchQueue.main.async {
-                completion(result)
-            }
-        }
-    }
-    
-    func deleteBates(toPath: String, completion: @escaping (_ result: Bool) -> ()) {
-        if (self.preView.document.allowsPrinting == false || self.preView.document.allowsCopying == false) {
-            let alert = NSAlert()
-            alert.alertStyle = .critical
-            alert.messageText = NSLocalizedString("This PDF document's user permissions does not allow modifying, content copying and printing.", comment: "")
-            alert.runModal()
-            
-            completion(false)
-            return
-        }
-        
-        DispatchQueue.global().async {
-            let document: CPDFDocument = self.preView.document
-            var property = document.bates()
-            property?.clear()
-            
-            /// 保存到临时路径
-            let documentPath = NSTemporaryDirectory()
-            let tempPath: String = "\(documentPath)/\(toPath.lastPathComponent)"
-            if (FileManager.default.fileExists(atPath: tempPath)) {
-                try?FileManager.default.removeItem(atPath: tempPath)
-            }
-            
-            let result = document.write(to: URL(fileURLWithPath: tempPath))
-            if (result) {
-                if (FileManager.default.fileExists(atPath: toPath)) {
-                    try?FileManager.default.removeItem(atPath: toPath)
-                }
-                
-                try?FileManager.default.moveItem(atPath: tempPath, toPath: toPath)
-            } else {
-                try?FileManager.default.removeItem(atPath: tempPath)
-            }
-            
-            DispatchQueue.main.async {
-                completion(result)
-            }
-        }
-    }
-}

+ 0 - 22
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPreviewController.xib

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
-    <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBatesPreviewController" customModule="PDF_Office" customModuleProvider="target">
-            <connections>
-                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
-            </connections>
-        </customObject>
-        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
-        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <customView id="Hz6-mo-xeY">
-            <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-            <point key="canvasLocation" x="27" y="-36"/>
-        </customView>
-    </objects>
-</document>

+ 0 - 130
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyController.swift

@@ -1,130 +0,0 @@
-//
-//  KMBatesPropertyController.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/12/28.
-//
-
-import Cocoa
-
-typealias KMBatesPropertyTemplateDidSelected = (_ model: KMHeaderFooterObject,_ isSelected: Bool)->()
-typealias KMBatesPropertyTemplateMenuItemClick = (_ itemIndex: Int,  _ model: KMHeaderFooterObject)->()
-class KMBatesPropertyController: KMWatermarkAdjectivePropertyBaseController {
-
-    var templateDidSelected: KMBatesPropertyTemplateDidSelected!
-    var menuItemClick: KMBatesPropertyTemplateMenuItemClick!
-    
-    var controller = KMHeaderFooterListController()
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        
-        self.showBack(show: false)
-        self.titleLabel.stringValue = NSLocalizedString("Bates Number", comment: "")
-        self.segementControl.isHidden = true
-        self.segementControlHeightConst.constant = 0
-        
-        let item = NSTabViewItem(identifier: "tabID")
-        item.label = "tab1";
-        let controller = self.controller
-        item.viewController = controller
-        controller.emptyView.despLabel.stringValue = NSLocalizedString("Click the Add button in the upper right corner to create a new header & footer.", comment: "")
-        controller.delegate = self
-        
-        self.tabView.addTabViewItem(item)
-        
-        childViewController.append(controller)
-        
-        reloadDatas()
-    }
-    
-    func reloadDatas () {
-        let controller: KMHeaderFooterListController = childViewController[0] as! KMHeaderFooterListController
-        controller.initDatas(datas: KMHeaderFooterManager.defaultManager.headFooterObjects)
-    }
-    
-    func deleteTemplateModel(_ templateModel: KMHeaderFooterObject) -> Bool {
-        return KMHeaderFooterManager.defaultManager.addHeaderFooter(templateModel)
-    }
-    
-    func deleteTemplateModel(in controller: KMHeaderFooterListController, index: Int) {
-        if (index >= controller.datas.count) {
-            return
-        }
-        
-        let templateModel: KMHeaderFooterObject = controller.datas[index] as! KMHeaderFooterObject
-        if (deleteTemplateModel(templateModel)) { /// 删除成功,刷新数据
-            reloadDatas()
-        }
-    }
-    
-    func deleteAllTemplateModel(in controller: KMHeaderFooterListController) {
-        if (KMHeaderFooterManager.defaultManager.removeAllHeaderFooter()) {
-            reloadDatas()
-        }
-    }
-    
-    func findTemplateModel(in controller: KMHeaderFooterListController, index: Int) -> KMHeaderFooterObject? {
-        if (index >= controller.datas.count) {
-            return nil
-        }
-        
-        return (controller.datas[index] as! KMHeaderFooterObject)
-    }
-    
-}
-
-extension KMBatesPropertyController: KMWatermarkAdjectiveListControllerDelegate {
-    func controller(controller: KMWatermarkAdjectiveListController, shouldSelectAtRow: Int) -> Bool {
-        return true
-    }
-    func controller(controller: KMWatermarkAdjectiveListController, didSelectAtRow: Int) {
-        guard let callback = templateDidSelected else {
-            return
-        }
-
-        let isSelected = controller.selectedTemplateID.isEmpty == false
-        callback(findTemplateModel(in: controller as! KMHeaderFooterListController, index: didSelectAtRow)!, isSelected)
-    }
-    
-    func controller(controller: KMWatermarkAdjectiveListController, didRemoveAtRow: Int) {
-        deleteTemplateModel(in: controller as! KMHeaderFooterListController, index: didRemoveAtRow)
-    }
-    
-    func controller(controller: KMWatermarkAdjectiveListController, didEditAtRow: Int) {
-        guard let callback = menuItemClick else {
-            return
-        }
-
-        callback(2, findTemplateModel(in: controller as! KMHeaderFooterListController, index: didEditAtRow)!)
-    }
-    
-    func controller(controller: KMWatermarkAdjectiveListController, item: NSMenuItem, itemIndex: Int) {
-        if (itemIndex == 1) { /// 删除
-            deleteTemplateModel(in: controller as! KMHeaderFooterListController, index: item.tag)
-            return
-        }
-        
-        if (itemIndex == 2) { /// 删除全部
-            let alert = NSAlert()
-            alert.messageText = "确认删除全部模板吗?"
-            alert.addButton(withTitle: "删除")
-            alert.addButton(withTitle: "取消")
-            let result = alert.runModal()
-            if (result == .alertSecondButtonReturn) { /// 取消
-                return
-            }
-            
-            deleteAllTemplateModel(in: controller as! KMHeaderFooterListController)
-            return
-        }
-        
-        /// 编辑
-        guard let callback = menuItemClick else {
-            return
-        }
-        
-        callback(2, findTemplateModel(in: controller as! KMHeaderFooterListController, index: item.tag)!)
-    }
-}
-

+ 0 - 124
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyHomeController.swift

@@ -1,124 +0,0 @@
-//
-//  KMBatesPropertyHomeController.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/12/28.
-//
-
-import Cocoa
-
-/// Bates 属性主控制器
-class KMBatesPropertyHomeController: KMWatermarkAdjectivePropertyMainController {
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-    }
-    
-    override func gotoHomeController(_ selectedModelID: String) {
-        let controller = KMBatesPropertyController()
-        controller.controller.selectedTemplateID = selectedModelID
-        self.showController(controller)
-        
-        controller.rightButtonClick = { [weak self] index in
-            self!.gotoCreateController()
-        }
-        
-        controller.menuItemClick = { [weak self] index, model in
-            if (index == 2) { /// 编辑
-//                self!.gotoEditController(model)
-            }
-        }
-        
-        controller.templateDidSelected = { [weak self] model, selected in
-            if (selected) { /// 模板已选中,
-//                self!.model = model
-            } else { /// 模板取消选中
-                self!.model = nil
-            }
-            
-            guard let callback = self!.modelDidChange else {
-                return
-            }
-
-            callback(self?.model)
-        }
-    }
-    
-    override func gotoCreateController() {
-        let controller = KMCreateBatesController()
-        let model: KMHeaderFooterObject = KMHeaderFooterObject()
-//        model.type = .bates
-//        model.pageCount = self.pageCount
-        controller.model = model
-        
-        self.showController(controller)
-        
-        controller.backClick = { [weak self] in
-            self?.gotoHomeController("")
-        }
-        
-        controller.rightButtonClick = { [weak self] index in
-            /// 保存到模板
-            let createController: KMCreateBatesController = self!.currentController as! KMCreateBatesController
-            if (createController.model != nil) {
-                let model: KMHeaderFooterObject = createController.model as! KMHeaderFooterObject
-//                if (!model.hasVaild) {
-//                    let alert = NSAlert()
-//                    alert.alertStyle = .warning
-//                    alert.messageText = NSLocalizedString("Failure", comment: "")
-//                    alert.runModal()
-//                    return
-//                }
-                let result = KMHeaderFooterManager.defaultManager.addHeaderFooter(model)
-                if (result) {
-                    guard let callback = self!.modelDidChange else {
-                        return
-                    }
-
-//                    self?.model = model
-                    callback(self?.model)
-                    
-//                    self?.gotoHomeController(model.id)
-                }
-            }
-        }
-        
-        controller.modelDidChange = { [weak self] model in
-//            self?.model = model
-//            guard let callback = self!.modelDidChange else {
-//                return
-//            }
-//
-//            callback(self?.model)
-        }
-    }
-    
-    override func gotoEditController(_ model: KMWatermarkAdjectiveBaseModel) {
-        let controller = KMCreateBatesController()
-        controller.isEdit = true
-        model.pageCount = self.pageCount
-        controller.model = model
-        controller.flagModel = model.copy() as AnyObject
-        
-        self.showController(controller)
-        
-        controller.backClick = { [weak self] in
-            let editController: KMCreateBatesController = self!.currentController as! KMCreateBatesController
-            if (editController.isEdited) {
-                /// 更新模板
-                let result = KMHeaderFooterManager.defaultManager.store()
-//                if (result) {
-                    
-                self!.gotoHomeController("")
-//                }
-            } else {
-                self!.gotoHomeController("")
-            }
-        }
-        controller.rightButtonClick = { [weak self] index in
-            let editController: KMCreateBatesController = self!.currentController as! KMCreateBatesController
-            editController.resume()
-        }
-    }
-    
-}

+ 0 - 22
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyHomeController.xib

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
-    <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBatesPropertyHomeController" customModule="PDF_Office" customModuleProvider="target">
-            <connections>
-                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
-            </connections>
-        </customObject>
-        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
-        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <customView id="Hz6-mo-xeY">
-            <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-            <point key="canvasLocation" x="28" y="-36"/>
-        </customView>
-    </objects>
-</document>

+ 0 - 264
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyInfoController.swift

@@ -1,264 +0,0 @@
-//
-//  KMBatesPropertyInfoController.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/12/28.
-//
-
-import Cocoa
-/// Bates 属性控制器
-class KMBatesPropertyInfoController: NSViewController {
-
-    @IBOutlet weak var scrollView: NSScrollView!
-    
-    @IBOutlet weak var fontBox: NSBox!
-    @IBOutlet weak var marginBox: NSBox!
-    @IBOutlet weak var preSufFixBox: NSBox!
-    @IBOutlet weak var pageBox: NSBox!
-    @IBOutlet weak var contentBox: NSBox!
-    @IBOutlet weak var pageRangeBox: NSBox!
-    
-    var fontView = KMHeaderFooterFontInfoView()
-    var marginView = KMHeaderFooterMarginInfoView()
-    var preFixView = KMBatesPrefixInfoView()
-    var pageView = KMBatesPageInfoView()
-    var contentView = KMHeaderFooterContentInfoView()
-    var pagePageView = KMConvertPageRangeSettingItemView.createFromNib()
-    
-    weak var delegate: KMWatermarkAdjectivePropertyDelegate!
-    
-    init() {
-        super.init(nibName: "KMBatesPropertyInfoController", bundle: nil)
-    }
-    
-    required init?(coder: NSCoder) {
-        super.init(nibName: "KMBatesPropertyInfoController", bundle: nil)
-    }
-    
-    private var myModel: KMHeaderFooterObject!
-    var model: KMHeaderFooterObject {
-        get {
-            return myModel
-        }
-        set {
-            myModel = newValue
-            
-//            self.fontView.model = newValue
-//            self.marginView.model = newValue
-//            self.preFixView.model = newValue
-//            
-//            self.pageView.leftStepper.value = Double(newValue.batesDigits)
-//            self.pageView.rightComboBox.removeAllItems()
-//            for i in 0 ..< newValue.pageCount {
-//                self.pageView.rightComboBox.addItem(withObjectValue: i+1)
-//            }
-//            self.pageView.rightComboBox.stringValue = newValue.startString
-//            
-//            self.contentView.model = newValue
-        }
-    }
-    
-    override func viewWillAppear() {
-        super.viewWillAppear()
-        
-        /// 滚动到顶部
-        DispatchQueue.main.async {
-            let contentView = self.scrollView.contentView;
-            contentView.scroll(to: NSMakePoint(0, NSHeight(self.scrollView.documentView!.frame)-NSHeight(contentView.frame)))
-        }
-    }
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        
-        let fontView = self.fontView
-        fontView.frame = self.fontBox.contentView!.bounds
-        fontView.autoresizingMask = NSView.AutoresizingMask(rawValue: 18)
-        self.fontBox.contentView?.addSubview(fontView)
-        fontView.itemClick = { [weak self] (index: Int, value: Any) in
-            if (index == 1) { /// 字体名称
-//                switch self!.model.textFont {
-//                case .font(name: _, size: let size):
-//                    self!.model.textFont = .font(name: value as! String, size: size)
-//                default:
-//                    break
-//                }
-                
-                if (self!.delegate != nil) {
-                    self!.delegate.propertyInfoDidChange(model: self!.model)
-                }
-            } else if (index == 2) { /// 字体大小
-//                switch self!.model.textFont {
-//                case .font(name: let name, size: _):
-//                    self!.model.textFont = .font(name: name, size: CGFloat(value as! Int))
-//                default:
-//                    break
-//                }
-                
-                if (self!.delegate != nil) {
-                    self!.delegate.propertyInfoDidChange(model: self!.model)
-                }
-            } else if (index == 3) { /// 字体颜色
-                let panel = NSColorPanel.shared
-                panel.setTarget(self)
-                panel.setAction(#selector(self!.colorPanelAction))
-                panel.orderFront(nil)
-            }
-        }
-        
-        let marginView = self.marginView
-        marginView.frame = self.marginBox.contentView!.bounds
-        marginView.autoresizingMask = NSView.AutoresizingMask(rawValue: 18)
-        self.marginBox.contentView?.addSubview(marginView)
-        marginView.itemClick = { [unowned self] (index: Int, value: Any) in
-            if (index == 1) { /// top
-                self.model.topMargin = value as! Int
-            } else if (index == 2) { /// bottom
-                self.model.bottomMargin = value as! Int
-            } else if (index == 3) { /// left
-                self.model.leftMargin = value as! Int
-            } else if (index == 4) { /// right
-                self.model.rightMargin = value as! Int
-            }
-            
-            if (self.delegate != nil) {
-                self.delegate.propertyInfoDidChange(model: self.model)
-            }
-        }
-        
-        let preFixView = self.preFixView
-        preFixView.frame = self.preSufFixBox.contentView!.bounds
-        preFixView.autoresizingMask = NSView.AutoresizingMask(rawValue: 18)
-        self.preSufFixBox.contentView?.addSubview(preFixView)
-        preFixView.itemClick = { [weak self] (index: Int, value: Any) in
-            if (index == 1) {
-                self!.model.batesPrefixString = value as! String
-            } else if (index == 2) {
-                self!.model.batesSuffixString = value as! String
-            }
-
-            if (self!.delegate != nil) {
-                self!.delegate.propertyInfoDidChange(model: self!.model)
-            }
-        }
-        
-        let pageView = self.pageView
-        pageView.frame = self.pageBox.contentView!.bounds
-        pageView.autoresizingMask = NSView.AutoresizingMask(rawValue: 18)
-        self.pageBox.contentView?.addSubview(pageView)
-        pageView.itemClick = { [weak self] (index: Int, value: Any) in
-            if (index == 1) { /// 位数
-                self!.model.batesDigits = Int(value as! Double)
-            } else if (index == 2) { /// 起始页
-                self!.model.startString = "\(value as! Int+1)"
-            }
-            
-            if (self!.delegate != nil) {
-                self!.delegate.propertyInfoDidChange(model: self!.model)
-            }
-        }
-        
-        let contentView = self.contentView
-        contentView.frame = self.contentBox.contentView!.bounds
-        contentView.autoresizingMask = NSView.AutoresizingMask(rawValue: 18)
-        self.contentBox.contentView?.addSubview(contentView)
-        contentView.addAction = { [self]
-            (index: Int, sender: NSButton) in
-            
-            var string: String = "<<#\(self.model.batesDigits)"
-            string.append("#\(self.model.startString)")
-            
-            if (!self.model.batesPrefixString.isEmpty) {
-                string.append("#\(self.model.batesPrefixString)")
-            } else if (!self.model.batesSuffixString.isEmpty) {
-                string.append("#")
-            }
-            
-            if (!self.model.batesSuffixString.isEmpty) {
-                string.append("#\(self.model.batesSuffixString)")
-            }
-            string.append(">>")
-            
-            self.contentView.textView.string = "\(self.contentView.textView.string)".appending(string)
-            
-            self.updateModelForContentInfo(index: index, value: self.contentView.textView.string)
-        }
-        contentView.itemClick = { [weak self] (index: Int, value: Any) in
-            self!.updateModelForContentInfo(index: index, value: value as! String)
-        }
-        
-        let pageRangeView = self.pagePageView
-        pageRangeView?.frame = self.pageRangeBox.contentView!.bounds
-        pageRangeView?.autoresizingMask = NSView.AutoresizingMask(rawValue: 18)
-        self.pageRangeBox.contentView?.addSubview(pageRangeView!)
-        pageRangeView!.pageSizeComboBox.removeAllItems()
-        pageRangeView!.pageSizeComboBox.addItems(withObjectValues: [NSLocalizedString("All Pages", comment: ""), NSLocalizedString("Odd Pages", comment: ""), NSLocalizedString("Even Pages", comment: ""), NSLocalizedString("Customized", comment: "")])
-        pageRangeView!.pageSizeComboBox.selectItem(at: 0)
-        
-        pageRangeView?.isTextDidEndCallback = true
-        
-        pageRangeView?.itemClick = { [unowned self] index, _ in
-//            self.model.pageRangeType = KMWatermarkeModelPageRangeType(rawValue: index)!
-            
-            if (self.delegate != nil) {
-                self.delegate.propertyInfoDidChange(model: self.model)
-            }
-        }
-        
-        pageRangeView?.textDidEndEditingCallback = { [weak self] (textString: String) in
-//            let array = KMPageRangeTools.findSelectPage(pageRangeString: textString, pageCount: self!.model.pageCount)
-//            if (array.count <= 0) {
-//                let alert = NSAlert()
-//                alert.alertStyle = .warning
-//                alert.messageText = NSLocalizedString("Invalid page range or the page number is out of range. Please try again.", comment: "")
-//                alert.runModal()
-//                return
-//            }
-
-            var pageString: String = ""
-//            for i in 0 ..< array.count {
-//                pageString.append("\(array[i]-1)")
-//
-//                if (i != array.count-1) {
-//                    pageString.append(",")
-//                }
-//            }
-//            self!.model.pageRangeString = pageString
-            
-            if (self!.delegate != nil) {
-                self!.delegate.propertyInfoDidChange(model: self!.model)
-            }
-        }
-    }
-    
-    @objc private func colorPanelAction(sender: NSColorPanel) {
-        let color = KMWatermarkAdjectiveTools.parseColor(color: sender.color)
-//        self.model.textColor = .color(red: color.red, green: color.green, blue: color.blue, alpha: color.alpha)
-        
-        self.fontView.colorView.layer?.backgroundColor = sender.color.cgColor
-        if (self.delegate != nil) {
-            self.delegate.propertyInfoDidChange(model: self.model)
-        }
-    }
-    
-    private func updateModelForContentInfo(index: Int, value: String) {
-        if (index == 1) {
-            self.model.topLeftString = value
-        } else if (index == 2) {
-            self.model.topCenterString = value
-        } else if (index == 3) {
-            self.model.topRightString = value
-        } else if (index == 4) {
-            self.model.bottomLeftString = value
-        } else if (index == 5) {
-            self.model.bottomCenterString = value
-        } else if (index == 6) {
-            self.model.bottomRightString = value
-        }
-        
-        if (self.delegate != nil) {
-            self.delegate.propertyInfoDidChange(model: self.model)
-        }
-    }
-    
-}

+ 0 - 140
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyInfoController.xib

@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
-    <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBatesPropertyInfoController" customModule="PDF_Office" customModuleProvider="target">
-            <connections>
-                <outlet property="contentBox" destination="KLZ-Zm-iql" id="OEw-4T-MM7"/>
-                <outlet property="fontBox" destination="h5L-wB-8ys" id="uvl-iH-lEK"/>
-                <outlet property="marginBox" destination="7xV-gp-Z22" id="ISN-qU-yBn"/>
-                <outlet property="pageBox" destination="Bfe-Ao-VrL" id="jq5-n9-PEA"/>
-                <outlet property="pageRangeBox" destination="w9B-XO-bKj" id="tXK-Bd-8cW"/>
-                <outlet property="preSufFixBox" destination="jAn-qr-A68" id="5ao-aT-l2x"/>
-                <outlet property="scrollView" destination="17J-dq-HTC" id="tza-Ju-Rlb"/>
-                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
-            </connections>
-        </customObject>
-        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
-        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <customView id="Hz6-mo-xeY">
-            <rect key="frame" x="0.0" y="0.0" width="260" height="620"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-            <subviews>
-                <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="17J-dq-HTC">
-                    <rect key="frame" x="0.0" y="0.0" width="260" height="620"/>
-                    <clipView key="contentView" drawsBackground="NO" id="onM-Cp-X6F">
-                        <rect key="frame" x="0.0" y="0.0" width="260" height="620"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <subviews>
-                            <view id="5lT-1V-M5O">
-                                <rect key="frame" x="0.0" y="0.0" width="260" height="710"/>
-                                <autoresizingMask key="autoresizingMask"/>
-                                <subviews>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="h5L-wB-8ys">
-                                        <rect key="frame" x="0.0" y="590" width="260" height="120"/>
-                                        <view key="contentView" id="KvF-nW-sd6">
-                                            <rect key="frame" x="0.0" y="0.0" width="260" height="120"/>
-                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        </view>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="120" id="6kx-pv-ub8"/>
-                                        </constraints>
-                                    </box>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="7xV-gp-Z22">
-                                        <rect key="frame" x="0.0" y="460" width="260" height="130"/>
-                                        <view key="contentView" id="HdG-x0-cdE">
-                                            <rect key="frame" x="0.0" y="0.0" width="260" height="130"/>
-                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        </view>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="130" id="nQo-6K-aS7"/>
-                                        </constraints>
-                                    </box>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="jAn-qr-A68">
-                                        <rect key="frame" x="0.0" y="330" width="260" height="130"/>
-                                        <view key="contentView" id="ffU-9p-si3">
-                                            <rect key="frame" x="0.0" y="0.0" width="260" height="130"/>
-                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        </view>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="130" id="zlW-bY-XxN"/>
-                                        </constraints>
-                                    </box>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Bfe-Ao-VrL">
-                                        <rect key="frame" x="0.0" y="260" width="260" height="70"/>
-                                        <view key="contentView" id="qTF-k0-pfp">
-                                            <rect key="frame" x="0.0" y="0.0" width="260" height="70"/>
-                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        </view>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="70" id="fac-L8-dqA"/>
-                                        </constraints>
-                                    </box>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="KLZ-Zm-iql">
-                                        <rect key="frame" x="0.0" y="100" width="260" height="160"/>
-                                        <view key="contentView" id="P7w-yG-iRu">
-                                            <rect key="frame" x="0.0" y="0.0" width="260" height="160"/>
-                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        </view>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="160" id="K57-ke-hTa"/>
-                                        </constraints>
-                                    </box>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="w9B-XO-bKj">
-                                        <rect key="frame" x="0.0" y="20" width="260" height="70"/>
-                                        <view key="contentView" id="4l9-d3-xgY">
-                                            <rect key="frame" x="0.0" y="0.0" width="260" height="70"/>
-                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        </view>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="70" id="vGm-Bk-z4F"/>
-                                        </constraints>
-                                    </box>
-                                </subviews>
-                                <constraints>
-                                    <constraint firstItem="KLZ-Zm-iql" firstAttribute="leading" secondItem="5lT-1V-M5O" secondAttribute="leading" id="4x0-aI-axO"/>
-                                    <constraint firstAttribute="trailing" secondItem="jAn-qr-A68" secondAttribute="trailing" id="5I1-bP-V2N"/>
-                                    <constraint firstItem="jAn-qr-A68" firstAttribute="top" secondItem="7xV-gp-Z22" secondAttribute="bottom" id="A73-3G-fqY"/>
-                                    <constraint firstItem="7xV-gp-Z22" firstAttribute="leading" secondItem="5lT-1V-M5O" secondAttribute="leading" id="D6f-R0-tx1"/>
-                                    <constraint firstItem="Bfe-Ao-VrL" firstAttribute="top" secondItem="jAn-qr-A68" secondAttribute="bottom" id="Lhc-m2-RR3"/>
-                                    <constraint firstItem="KLZ-Zm-iql" firstAttribute="top" secondItem="Bfe-Ao-VrL" secondAttribute="bottom" id="NkN-t8-Hkl"/>
-                                    <constraint firstAttribute="trailing" secondItem="h5L-wB-8ys" secondAttribute="trailing" id="O4S-uV-LDS"/>
-                                    <constraint firstAttribute="trailing" secondItem="w9B-XO-bKj" secondAttribute="trailing" id="OLV-Rw-ipV"/>
-                                    <constraint firstItem="w9B-XO-bKj" firstAttribute="top" secondItem="KLZ-Zm-iql" secondAttribute="bottom" constant="10" id="PR6-hx-L5b"/>
-                                    <constraint firstAttribute="trailing" secondItem="7xV-gp-Z22" secondAttribute="trailing" id="bIb-cx-LjL"/>
-                                    <constraint firstAttribute="trailing" secondItem="Bfe-Ao-VrL" secondAttribute="trailing" id="cN0-xw-LoF"/>
-                                    <constraint firstAttribute="trailing" secondItem="KLZ-Zm-iql" secondAttribute="trailing" id="gTK-fv-30T"/>
-                                    <constraint firstItem="Bfe-Ao-VrL" firstAttribute="leading" secondItem="5lT-1V-M5O" secondAttribute="leading" id="kpz-2g-tFi"/>
-                                    <constraint firstItem="7xV-gp-Z22" firstAttribute="top" secondItem="h5L-wB-8ys" secondAttribute="bottom" id="mxQ-SN-ccP"/>
-                                    <constraint firstItem="w9B-XO-bKj" firstAttribute="leading" secondItem="5lT-1V-M5O" secondAttribute="leading" id="n0R-x7-KQZ"/>
-                                    <constraint firstItem="jAn-qr-A68" firstAttribute="leading" secondItem="5lT-1V-M5O" secondAttribute="leading" id="nIp-6M-D1h"/>
-                                    <constraint firstItem="h5L-wB-8ys" firstAttribute="top" secondItem="5lT-1V-M5O" secondAttribute="top" id="px6-tH-kM1"/>
-                                    <constraint firstItem="h5L-wB-8ys" firstAttribute="leading" secondItem="5lT-1V-M5O" secondAttribute="leading" id="zch-UW-mzj"/>
-                                </constraints>
-                            </view>
-                        </subviews>
-                    </clipView>
-                    <scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="gPb-bB-5pT">
-                        <rect key="frame" x="0.0" y="604" width="260" height="16"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                    </scroller>
-                    <scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="6H3-at-qlx">
-                        <rect key="frame" x="244" y="0.0" width="16" height="620"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                    </scroller>
-                </scrollView>
-            </subviews>
-            <constraints>
-                <constraint firstAttribute="bottom" secondItem="17J-dq-HTC" secondAttribute="bottom" id="1gd-de-tki"/>
-                <constraint firstAttribute="trailing" secondItem="17J-dq-HTC" secondAttribute="trailing" id="6Rm-Ik-JyU"/>
-                <constraint firstItem="17J-dq-HTC" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="dxx-Sg-gDA"/>
-                <constraint firstItem="17J-dq-HTC" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="mBS-ro-jA9"/>
-            </constraints>
-            <point key="canvasLocation" x="62" y="-34"/>
-        </customView>
-    </objects>
-</document>

+ 0 - 73
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMCreateBatesController.swift

@@ -1,73 +0,0 @@
-//
-//  KMCreateBatesController.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/12/28.
-//
-
-import Cocoa
-
-typealias KMCreateBatesModelDidChange = (_ model: KMHeaderFooterObject) -> ()
-class KMCreateBatesController: KMWatermarkAdjectivePropertyBaseController {
-    
-    /// 是否是编辑类型
-    var isEdit: Bool = false
-    /// 是否已编辑
-    var isEdited: Bool = false
-    
-    var modelDidChange: KMCreateBatesModelDidChange!
-    
-    override func viewWillAppear() {
-        super.viewWillAppear()
-        
-        let controller: KMBatesPropertyInfoController = childViewController[0] as! KMBatesPropertyInfoController
-        controller.model = self.model as! KMHeaderFooterObject
-    }
-
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        
-        self.backButtton.title = NSLocalizedString("", comment: "")
-        self.showBack(show: true)
-        if (self.isEdit) {
-            self.titleLabel.stringValue = NSLocalizedString("Edit Bates Number", comment: "")
-            self.addButton.attributedTitle = NSAttributedString(string: NSLocalizedString("", comment: ""), attributes: [NSAttributedString.Key.foregroundColor : NSColor(red: 24.0/255.0, green: 160.0/255.0, blue: 251.0/255.0, alpha: 1.0),NSAttributedString.Key.font : NSFont.systemFont(ofSize: 12), NSAttributedString.Key.underlineStyle : true])
-        } else {
-            self.titleLabel.stringValue = NSLocalizedString("Add Bates Number", comment: "")
-            self.addButton.attributedTitle = NSAttributedString(string: NSLocalizedString("", comment: ""), attributes: [NSAttributedString.Key.foregroundColor : NSColor(red: 24.0/255.0, green: 160.0/255.0, blue: 251.0/255.0, alpha: 1.0),NSAttributedString.Key.font : NSFont.systemFont(ofSize: 12), NSAttributedString.Key.underlineStyle : true])
-        }
-        
-        self.segementControl.isHidden = true
-        self.segementControlHeightConst.constant = 0
-        
-        let item = NSTabViewItem(identifier: "tabID")
-        item.label = "tab1";
-        let controller = KMBatesPropertyInfoController()
-        item.viewController = controller
-        controller.delegate = self
-
-        self.tabView.addTabViewItem(item)
-
-        childViewController.append(controller)
-    }
-    
-    override func resume() {
-        if (self.needResume() == false) {
-            return
-        }
-        
-        (childViewController[0] as! KMBatesPropertyInfoController).model = self.flagModel?.copy() as! KMHeaderFooterObject
-    }
-}
-
-extension KMCreateBatesController: KMWatermarkAdjectivePropertyDelegate {
-    func propertyInfoDidChange(model: AnyObject) {
-        self.isEdited = true
-        
-        guard let callback = modelDidChange else {
-            return
-        }
-        
-        callback(model as! KMHeaderFooterObject)
-    }
-}

+ 0 - 19
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMCreateBatesController.xib

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
-    <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
-    </dependencies>
-    <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMCreateBatesController" customModuleProvider="target">
-            <connections>
-                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
-            </connections>
-        </customObject>
-        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
-        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <customView id="Hz6-mo-xeY">
-            <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-        </customView>
-    </objects>
-</document>

+ 87 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/KMBatesController.swift

@@ -0,0 +1,87 @@
+//
+//  KMBatesController.swift
+//  PDF Reader Pro
+//
+//  Created by Niehaoyu on 2024/11/8.
+//
+
+import Cocoa
+import KMComponentLibrary
+
+class KMBatesController: NSViewController {
+    
+    @IBOutlet var contendView: NSView!
+    
+    @IBOutlet var preInfoView: NSView!
+    @IBOutlet var propertyInfoView: NSView!
+    
+    var documentPreview: KMEditDocumentController = KMEditDocumentController.init()
+    var propertyController: KMBatesPropertyController = KMBatesPropertyController.init()
+    var templatesController: KMBatesTemplateController = KMBatesTemplateController()
+    
+    var saveTemplateMessage: ComponentMessage = ComponentMessage()
+     
+    var totalPDFCount: Int = 1
+    var pdfDocument: CPDFDocument?
+    
+    var editSubType: KMPDFEditSubModeType = .none
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        documentPreview.view.frame = preInfoView.bounds
+        documentPreview.view.autoresizingMask = [.width, .height]
+        preInfoView.addSubview(documentPreview.view)
+        
+        propertyController.view.frame = propertyInfoView.bounds
+        propertyController.view.autoresizingMask = [.width, .height]
+//        propertyController.delegate = self
+        propertyController.view.isHidden = true
+        propertyInfoView.addSubview(propertyController.view)
+        
+        templatesController.view.frame = propertyInfoView.bounds
+        templatesController.view.autoresizingMask = [.width, .height]
+//        templatesController.delegate = self
+        templatesController.view.isHidden = true
+        propertyInfoView.addSubview(templatesController.view)
+        
+        setupProperty()
+    }
+    
+    func setupProperty() {
+        saveTemplateMessage.properties = ComponentMessageProperty(messageType: .success, title: KMLocalizedString("Saved Template"))
+         
+    }
+    
+    func resetUI() {
+        propertyController.view.isHidden = true
+        templatesController.view.isHidden = true
+        
+        if editSubType == .template {
+            templatesController.view.isHidden = false
+            templatesController.reloadData()
+            
+        } else if editSubType == .add {
+            propertyController.view.isHidden = false
+            propertyController.reloadData()
+            
+        } else if editSubType == .edit {
+            propertyController.view.isHidden = false
+            propertyController.reloadData()
+            
+        }
+    }
+    
+    func reloadData() {
+        resetUI()
+        
+        propertyController.totalPDFCount = totalPDFCount
+        propertyController.reloadData()
+        
+        documentPreview.pdfDocument = pdfDocument
+        documentPreview.reloadData()
+        
+        
+    }
+}

+ 56 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/KMBatesController.xib

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBatesController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="contendView" destination="Sb8-Fw-WDm" id="LPm-cw-Lce"/>
+                <outlet property="preInfoView" destination="1ND-mc-dDF" id="Gh4-73-RDY"/>
+                <outlet property="propertyInfoView" destination="fiD-Ys-jnb" id="FU5-JA-1QJ"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="Sb8-Fw-WDm">
+                    <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+                    <subviews>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="1ND-mc-dDF">
+                            <rect key="frame" x="0.0" y="0.0" width="216" height="272"/>
+                        </customView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="fiD-Ys-jnb">
+                            <rect key="frame" x="216" y="0.0" width="264" height="272"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="264" id="dSi-HY-qEe"/>
+                            </constraints>
+                        </customView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="fiD-Ys-jnb" secondAttribute="trailing" id="53B-Nu-OaB"/>
+                        <constraint firstItem="1ND-mc-dDF" firstAttribute="top" secondItem="Sb8-Fw-WDm" secondAttribute="top" id="dgs-Jb-9eB"/>
+                        <constraint firstItem="fiD-Ys-jnb" firstAttribute="top" secondItem="Sb8-Fw-WDm" secondAttribute="top" id="iw8-GX-GWA"/>
+                        <constraint firstItem="1ND-mc-dDF" firstAttribute="leading" secondItem="Sb8-Fw-WDm" secondAttribute="leading" id="rqK-gl-PRC"/>
+                        <constraint firstAttribute="bottom" secondItem="fiD-Ys-jnb" secondAttribute="bottom" id="tYY-aq-chb"/>
+                        <constraint firstAttribute="bottom" secondItem="1ND-mc-dDF" secondAttribute="bottom" id="tfm-Oz-ngL"/>
+                        <constraint firstItem="fiD-Ys-jnb" firstAttribute="leading" secondItem="1ND-mc-dDF" secondAttribute="trailing" id="wIa-ey-7qF"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="Sb8-Fw-WDm" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="9Q4-ma-vQH"/>
+                <constraint firstItem="Sb8-Fw-WDm" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="iKw-Js-hW4"/>
+                <constraint firstAttribute="bottom" secondItem="Sb8-Fw-WDm" secondAttribute="bottom" id="vJW-Of-ll9"/>
+                <constraint firstAttribute="trailing" secondItem="Sb8-Fw-WDm" secondAttribute="trailing" id="wfo-ql-RmO"/>
+            </constraints>
+            <point key="canvasLocation" x="132" y="-72"/>
+        </customView>
+    </objects>
+</document>

+ 27 - 14
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Tools/KMBatesManager.swift

@@ -13,7 +13,7 @@ class KMBatesManager: NSObject {
     
     static let defaultManager = KMBatesManager()
     
-    var datas: Array<KMHeaderFooterObject> = []
+    var datas: Array<KMBatesModel> = []
     
     override init() {
         super.init()
@@ -38,7 +38,7 @@ class KMBatesManager: NSObject {
         }
     }
     
-    func addTemplate(_ model: KMHeaderFooterObject) -> Bool {
+    func addTemplate(_ model: KMBatesModel) -> Bool {
         if (!FileManager.default.fileExists(atPath: kFolderPath!)) {
             let create: ()? = try?FileManager.default.createDirectory(atPath: kFolderPath!, withIntermediateDirectories: false)
             if (create == nil) {
@@ -78,7 +78,7 @@ class KMBatesManager: NSObject {
         return result
     }
     
-    func deleteTemplate(_ model: KMHeaderFooterObject) -> Bool {
+    func deleteTemplate(_ model: KMBatesModel) -> Bool {
 //        if (model.id.isEmpty) {
 //            return false
 //        }
@@ -130,7 +130,7 @@ class KMBatesManager: NSObject {
         return result
     }
     
-    func updateTemplate(_ model: KMHeaderFooterObject) -> Bool {
+    func updateTemplate(_ model: KMBatesModel) -> Bool {
         if (!FileManager.default.fileExists(atPath: kFolderPath!)) {
             let create = try?FileManager.default.createDirectory(atPath: kFolderPath!, withIntermediateDirectories: false)
             if (create == nil) {
@@ -145,7 +145,7 @@ class KMBatesManager: NSObject {
             }
         }
         
-        var flagModel: KMHeaderFooterObject!
+        var flagModel: KMBatesModel!
         for model_ in self.datas {
 //            if (model_.id == model.id) {
 //                flagModel = model_
@@ -179,7 +179,7 @@ class KMBatesManager: NSObject {
     /**
         `Private Methods`
      */
-    private func parseModel(model: KMHeaderFooterObject) -> Dictionary<String, Any> {
+    private func parseModel(model: KMBatesModel) -> Dictionary<String, Any> {
         var dict: [String : Any] = [:]
         /// 字体相关
 //        switch model.textFont {
@@ -212,9 +212,9 @@ class KMBatesManager: NSObject {
         dict["bottomCenterString"] = model.bottomCenterString
         dict["bottomRightString"] = model.bottomRightString
         
-        dict["prefixString"] = model.batesPrefixString
-        dict["suffixString"] = model.batesSuffixString
-        dict["digits"] = model.batesDigits
+//        dict["prefixString"] = model.batesPrefixString
+//        dict["suffixString"] = model.batesSuffixString
+//        dict["digits"] = model.batesDigits
         dict["startString"] = model.startString
         
 //        dict["pageRangeType"] = model.pageRangeType
@@ -223,8 +223,8 @@ class KMBatesManager: NSObject {
         return dict
     }
     
-    private func parseDictionary(dict: NSDictionary) -> KMHeaderFooterObject {
-        let model = KMHeaderFooterObject()
+    private func parseDictionary(dict: NSDictionary) -> KMBatesModel {
+        let model = KMBatesModel()
         
         /// 字体相关
 //        model.textFont = .font(name: dict["fontName"] as! String, size: dict["fontSize"] as! CGFloat)
@@ -244,9 +244,9 @@ class KMBatesManager: NSObject {
         model.bottomCenterString = dict["bottomCenterString"] as! String
         model.bottomRightString = dict["bottomRightString"] as! String
         
-        model.batesPrefixString = dict["prefixString"] as! String
-        model.batesSuffixString = dict["suffixString"] as! String
-        model.batesDigits = dict["digits"] as! Int
+//        model.batesPrefixString = dict["prefixString"] as! String
+//        model.batesSuffixString = dict["suffixString"] as! String
+//        model.batesDigits = dict["digits"] as! Int
         model.startString = dict["startString"] as! String
         
 //        model.pageRangeType = KMWatermarkeModelPageRangeType(rawValue: dict["pageRangeType"] as! Int)!
@@ -265,4 +265,17 @@ class KMBatesManager: NSObject {
         
         return result
     }
+    
+    func fetchBatesAvailableName() -> String {
+        var availableIndex = 0
+        for item in datas {
+            if item.name.hasPrefix("Bates") {
+                if let index = Int(item.name.dropFirst("Bates".count)), index >= availableIndex {
+                    availableIndex = index + 1
+                }
+            }
+        }
+        return "Bates\(availableIndex)"
+    }
+    
 }

+ 23 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Model/KMBatesModel.swift

@@ -7,11 +7,33 @@
 
 import Cocoa
 
-@objcMembers class KMBatesModel: KMHeaderFooterAdjectiveModel {
+@objcMembers class KMBatesModel: NSObject {
+    
+    var fontName: String = "Helvetica"
+    var fontsize: CGFloat = 12
+    var color: NSColor = NSColor.black
+    
+    var leftMargin: Int = 30
+    var rightMargin: Int = 30
+    var bottomMargin: Int = 30
+    var topMargin: Int = 30
+    
+    var topLeftString: String = ""
+    var topCenterString: String = ""
+    var topRightString: String = ""
+    var bottomLeftString: String = ""
+    var bottomCenterString: String = ""
+    var bottomRightString: String = ""
+    
     
     var prefixString: String = ""
     var suffixString: String = ""
     var digits: Int = 1
+    var startString: String = "1"
+    
+    var name: String = ""
+    
+    var tag: String = ""
     
     override init() {
         super.init()

+ 0 - 22
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Tools/KMBatchQuickActionManager.swift

@@ -1,22 +0,0 @@
-//
-//  File.swift
-//  PDF Reader Pro
-//
-//  Created by liujiajie on 2023/12/29.
-//
-
-import Foundation
-
-enum KMBatchQuickActionType: Int {
-    case add = 0
-    case remove
-}
-
-class KMBatchQuickActionManager: NSObject{
-    
-    static let defaultManager = KMBatchQuickActionManager()
-    var actionType: KMBatchQuickActionType = .add
-    
-}
-
-

+ 0 - 91
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/View/KMBatesPageInfoView.swift

@@ -1,91 +0,0 @@
-//
-//  KMBatesPageInfoView.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/12/28.
-//
-
-import Cocoa
-
-class KMBatesPageInfoView: KMHeaderFooterAdjectiveInfoBaseView {
-
-    var leftLabel = NSTextField(labelWithString: "")
-    var leftStepper = KMWatermarkAdjectiveStepper()
-    private var rigthLabel = NSTextField(labelWithString: "")
-    var rightComboBox = NSComboBox()
-    
-    override func initSubviews() {
-        super.initSubviews()
-        
-        self.addSubview(self.leftLabel)
-        self.addSubview(self.leftStepper)
-        self.addSubview(self.rigthLabel)
-        self.addSubview(self.rightComboBox)
-        
-        self.titleLabel.isHidden = true
-        self.leftLabel.stringValue = NSLocalizedString("Numbers of Digits:", comment: "")
-        self.rigthLabel.stringValue = NSLocalizedString("Start Page:", comment: "")
-        
-        self.leftStepper.wantsLayer = true
-        self.leftStepper.layer?.borderWidth = 1
-        self.leftStepper.layer?.borderColor = NSColor.black.cgColor
-        self.leftStepper.stepper.minValue = 1
-        self.leftStepper.stepper.maxValue = 99
-        self.leftStepper.valueDidChange = {
-            (value: Double) in
-            
-            guard let callback = self.itemClick else {
-                return
-            }
-            
-            callback(1, value)
-        }
-        
-        self.rightComboBox.isEditable = false
-        self.rightComboBox.delegate = self
-    }
-    
-    override func layout() {
-        super.layout()
-        
-        let width: CGFloat = NSWidth(self.bounds)
-        let hSpace: CGFloat = 10
-        
-        let leftMargin = self.contentInset.left
-        let labelWidth: CGFloat = (width-leftMargin*2-hSpace)*0.5
-        let labelHeight: CGFloat = 16
-        self.leftLabel.frame = NSMakeRect(leftMargin, 0, labelWidth, labelHeight)
-        self.rigthLabel.frame = NSMakeRect(self.rigthLabel.frame.maxX+hSpace, 0, labelWidth, labelHeight)
-        
-        let comboBoxY: CGFloat = self.leftLabel.frame.maxY+6
-        let comboBoxSize: NSSize = NSMakeSize(labelWidth, 22)
-        self.leftStepper.frame = NSMakeRect(leftMargin, comboBoxY, comboBoxSize.width, 30)
-        self.rightComboBox.frame = NSMakeRect(self.leftStepper.frame.maxX+hSpace, comboBoxY, comboBoxSize.width, comboBoxSize.height)
-    }
-    
-    override var model: KMHeaderFooterAdjectiveModel {
-        get {
-            super.model
-        }
-        set {
-            super.model = newValue
-        }
-    }
-}
-
-extension KMBatesPageInfoView: NSComboBoxDelegate {
-    func comboBoxSelectionDidChange(_ notification: Notification) {
-        if (self.rightComboBox.isEqual(to: notification.object)) {
-            guard let callback = self.itemClick else {
-                return
-            }
-            
-            var index: Int = self.rightComboBox.indexOfSelectedItem
-            if (index < 0) {
-                index = 0
-            }
-            
-            callback(2, index)
-        }
-    }
-}

+ 0 - 91
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/View/KMBatesPrefixInfoView.swift

@@ -1,91 +0,0 @@
-//
-//  KMBatesPrefixInfoView.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/12/28.
-//
-
-import Cocoa
-
-class KMBatesPrefixInfoView: KMHeaderFooterAdjectiveInfoBaseView {
-
-    var preFixBox = NSView()
-    var preFixTextField = NSTextField()
-    var sufFixLabel = NSTextField(labelWithString: "")
-    var sufFixBox = NSView()
-    var sufFixTextField = NSTextField()
-    
-    override func initSubviews() {
-        super.initSubviews()
-        
-        self.addSubview(self.preFixBox)
-        self.addSubview(self.preFixTextField)
-        self.addSubview(self.sufFixLabel)
-        self.addSubview(self.sufFixBox)
-        self.addSubview(self.sufFixTextField)
-        
-        self.titleLabel.stringValue = NSLocalizedString("Prefix:", comment: "")
-        self.sufFixLabel.stringValue = NSLocalizedString("Suffix:", comment: "")
-        for box in [self.preFixBox, self.sufFixBox] {
-            box.wantsLayer = true
-            box.layer?.borderWidth = 1
-            box.layer?.borderColor = NSColor.black.cgColor
-        }
-        
-        for textField in [self.preFixTextField, self.sufFixTextField] {
-            textField.focusRingType = .none
-            textField.backgroundColor = NSColor.clear
-            textField.cell?.isBordered = false
-            textField.delegate = self
-        }
-    }
-    
-    override func layout() {
-        super.layout()
-        
-        let leftMargin: CGFloat = self.contentInset.left
-        let contentWidth: CGFloat = NSWidth(self.bounds)-leftMargin-self.contentInset.right
-        
-        let boxH: CGFloat = 30
-        let textFieldH: CGFloat = 20
-        
-        self.preFixBox.frame = NSMakeRect(leftMargin, self.titleLabel.frame.maxY+2, contentWidth, boxH)
-        self.preFixTextField.frame = NSMakeRect(leftMargin+4, self.preFixBox.frame.minY+5, contentWidth, textFieldH)
-        
-        self.sufFixLabel.frame = NSMakeRect(leftMargin, self.preFixBox.frame.maxY+12, contentWidth, 18)
-        self.sufFixBox.frame = NSMakeRect(leftMargin, self.sufFixLabel.frame.maxY+2, contentWidth, boxH)
-        self.sufFixTextField.frame = NSMakeRect(leftMargin+4, self.sufFixBox.frame.minY+5, contentWidth, textFieldH)
-    }
-    
-    override var model: KMHeaderFooterAdjectiveModel {
-        get {
-            return super.model
-        }
-        set {
-            super.model = newValue
-            
-            let myModel: KMHeaderFooterObject = newValue as! KMHeaderFooterObject
-            self.preFixTextField.stringValue = myModel.batesPrefixString
-            self.sufFixTextField.stringValue = myModel.batesSuffixString
-        }
-    }
-}
-
-extension KMBatesPrefixInfoView: NSTextFieldDelegate {
-    func controlTextDidChange(_ obj: Notification) {
-        if (self.preFixTextField.isEqual(to:obj.object ) || self.sufFixTextField.isEqual(to: obj.object)) {
-            guard let callback = self.itemClick else {
-                return
-            }
-            
-            var index: Int = 1
-            var sender = self.preFixTextField
-            if (self.sufFixTextField.isEqual(to: obj.object)) {
-                index = 2
-                sender = self.sufFixTextField
-            }
-            
-            callback(index, sender.stringValue)
-        }
-    }
-}

+ 398 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesPropertyController.swift

@@ -0,0 +1,398 @@
+//
+//  KMBatesPropertyController.swift
+//  PDF Reader Pro
+//
+//  Created by Niehaoyu on 2024/11/8.
+//
+
+import Cocoa
+import KMComponentLibrary
+
+@objc protocol KMBatesPropertyControllerDelegate: AnyObject {
+    
+    //水印数据有更新
+    @objc optional func batesPropertyControllerDidUpdate(_ controller: KMBatesPropertyController)
+    
+    //切换到模板界面
+    @objc optional func batesPropertyControllerDidChangetoTemplate(_ controller: KMBatesPropertyController)
+    
+    //成功保存到模板
+    @objc optional func batesPropertyControllerSaveTemplateSuccess(_ controller: KMBatesPropertyController, _ data: KMBatesModel)
+    
+    //取消修改模板信息
+    //    @objc optional func headerFooterPropertyControllerCancelTemplateEdit(_ controller: KMNWatermarkPropertyController)
+    
+}
+
+class KMBatesPropertyController: NSViewController {
+    
+    @IBOutlet var contendView: NSView!
+    
+    @IBOutlet var titleLabel: NSTextField!
+    @IBOutlet var templateButton: ComponentButton!
+    
+    //Font
+    @IBOutlet var fontBGView: NSView!
+    @IBOutlet var fontLabel: NSTextField!
+    @IBOutlet var fontNameSelect: ComponentSelect!
+    @IBOutlet var fontSizeSelect: ComponentSelect!
+    @IBOutlet var fontColorView: ComponentCColorCustom!
+    
+    //Margin
+    @IBOutlet var marginBGView: NSView!
+    @IBOutlet var marginLabel: NSTextField!
+    @IBOutlet var marginLeftInput: ComponentInputNumber!
+    @IBOutlet var marginTopInput: ComponentInputNumber!
+    @IBOutlet var marginRightInput: ComponentInputNumber!
+    @IBOutlet var marginBottomInput: ComponentInputNumber!
+    
+    //Display
+    @IBOutlet var displayBGView: NSView!
+    @IBOutlet var displayLabel: NSTextField!
+    @IBOutlet var prefixLabel: NSTextField!
+    @IBOutlet var prefixInput: ComponentInput!
+    @IBOutlet var suffixLabel: NSTextField!
+    @IBOutlet var suffixInput: ComponentInput!
+    @IBOutlet var digitsLabel: NSTextField!
+    @IBOutlet var digitsInputNumber: ComponentInputNumber!
+    @IBOutlet var startPageLabel: NSTextField!
+    @IBOutlet var startPageSelect: ComponentSelect!
+    
+    //Layout&Content
+    @IBOutlet var layoutBGView: NSView!
+    @IBOutlet var layoutLabel: NSTextField!
+    @IBOutlet var layoutInsertButton: ComponentButton!
+    @IBOutlet var layoutPosition: ComponentCPosition!
+    @IBOutlet var layoutTextarea: ComponentTextarea!
+    
+    //Save
+    @IBOutlet var saveTemplateBGView: NSView!
+    @IBOutlet var saveButton: ComponentButton!
+    
+    var groupView: ComponentGroup!
+    
+    private var familyNames = CPDFFont.familyNames
+    
+    var totalPDFCount: Int = 1
+    var batesModel: KMBatesModel = KMBatesModel()
+    
+    weak open var delegate: KMBatesPropertyControllerDelegate?
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        setupProperty()
+        
+        reloadData()
+    }
+    
+    func setupProperty() {
+        contendView.wantsLayer = true
+        contendView.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBg/layout-middle").cgColor
+        
+        titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        titleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-bold")
+        titleLabel.stringValue = KMLocalizedString("Add Bates")
+        
+        templateButton.properties = ComponentButtonProperty(type: .text_gray, size: .xxs, onlyIcon: true, icon: NSImage(named: "icon_wm_template"), keepPressState: false)
+        templateButton.setTarget(self, action: #selector(componentButtonClicked(_:)))
+        
+        //Font
+        fontLabel.stringValue = KMLocalizedString("Font")
+        fontLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        fontLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
+        
+        fontNameSelect.properties = ComponentSelectProperties(size: .s,
+                                                              state: .normal,
+                                                              text: "")
+        
+        var menuItemArr: [ComponentMenuitemProperty] = []
+        for string in familyNames {
+            let item = ComponentMenuitemProperty(type: .normal, text: string, identifier: string)
+            menuItemArr.append(item)
+        }
+        fontNameSelect.updateMenuItemsArr(menuItemArr)
+        fontNameSelect.delegate = self
+        
+        fontSizeSelect.properties = ComponentSelectProperties(size: .s,
+                                                              state: .normal,
+                                                              creatable: true,
+                                                              text: "12 pt",
+                                                              regexString: "0123456789 pt")
+        if true {
+            var sizeItemArr: [ComponentMenuitemProperty] = []
+            for string in KMHeaderFooterManager.getFontSize() {
+                let item = ComponentMenuitemProperty(type: .normal, text: string, identifier: string)
+                sizeItemArr.append(item)
+            }
+            fontSizeSelect.updateMenuItemsArr(sizeItemArr)
+        }
+        fontSizeSelect.delegate = self
+        
+        fontColorView.properties = ComponentCColorProperty(colorType: .colorPanel, state: .normal, isCustom: true, color: NSColor.black)
+        
+        //Margin
+        marginLabel.stringValue = KMLocalizedString("Margin (mm)")
+        marginLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        marginLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
+        
+        marginLeftInput.properties = ComponentInputNumberProperty(alignment: .left,
+                                                                  size: .s,
+                                                                  minSize: 0,
+                                                                  maxSize: 1000,
+                                                                  text: "0")
+        marginLeftInput.delegate = self
+        
+        marginTopInput.properties = ComponentInputNumberProperty(alignment: .left,
+                                                                 size: .s,
+                                                                 minSize: 0,
+                                                                 maxSize: 1000,
+                                                                 text: "0")
+        marginTopInput.delegate = self
+        marginRightInput.properties = ComponentInputNumberProperty(alignment: .left,
+                                                                   size: .s,
+                                                                   minSize: 0,
+                                                                   maxSize: 1000,
+                                                                   text: "0")
+        marginRightInput.delegate = self
+        
+        marginBottomInput.properties = ComponentInputNumberProperty(alignment: .left,
+                                                                    size: .s,
+                                                                    minSize: 0,
+                                                                    maxSize: 1000,
+                                                                    text: "0")
+        marginBottomInput.delegate = self
+        
+        
+        //Display
+        displayLabel.stringValue = KMLocalizedString("Display")
+        displayLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        displayLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
+        
+        prefixLabel.stringValue = KMLocalizedString("Prefix: ")
+        prefixLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-nor")
+        prefixLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
+        
+        prefixInput.properties = ComponentInputProperty(size: .s, text: "")
+        prefixInput.delegate = self
+        
+        suffixLabel.stringValue = KMLocalizedString("Suffix: ")
+        suffixLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-nor")
+        suffixLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
+        
+        suffixInput.properties = ComponentInputProperty(size: .s, text: "")
+        suffixInput.delegate = self
+        
+        digitsLabel.stringValue = KMLocalizedString("Numbers of Digits: ")
+        digitsLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-nor")
+        digitsLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
+        
+        digitsInputNumber.properties = ComponentInputNumberProperty(alignment: .left, size: .s, minSize: 0, maxSize: 99, valueType: .intType)
+        digitsInputNumber.delegate = self
+        
+        startPageLabel.stringValue = KMLocalizedString("Start Page:")
+        startPageLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorText-filled-nor")
+        startPageLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
+        
+        startPageSelect.properties = ComponentSelectProperties(size: .s,
+                                                               state: .normal,
+                                                               creatable: false,
+                                                               text: "1")
+        startPageSelect.delegate = self
+        
+        //Layout&Content
+        layoutLabel.stringValue = KMLocalizedString("Layout & Content")
+        layoutLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+        layoutLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
+        
+        layoutInsertButton.properties = ComponentButtonProperty(type: .text_gray, size: .xxs, onlyIcon: true, icon: NSImage(named: "watermark_template_add"), keepPressState: false)
+        layoutInsertButton.setTarget(self, action: #selector(componentButtonClicked(_:)))
+        
+        //Save
+        saveTemplateBGView.wantsLayer = true
+        saveTemplateBGView.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBg/layout-middle").cgColor
+        saveButton.properties = ComponentButtonProperty(type: .default_tertiary, size: .m, showLeftIcon: true, buttonText: KMLocalizedString("Save as Template"), icon: NSImage(named: "icon_wm_template_save"), keepPressState: false)
+        saveButton.setTarget(self, action: #selector(componentButtonClicked(_:)))
+        
+    }
+    
+    func reloadData() {
+        //Font
+        if let index = familyNames.firstIndex(of: batesModel.fontName){
+            fontNameSelect.selectItemAtIndex(index)
+        }
+        fontNameSelect.properties.text = batesModel.fontName
+        fontNameSelect.reloadData()
+        
+        let fontSizeStr = String(format: "%.0f", batesModel.fontsize)
+        if let index = KMHeaderFooterManager.getFontSize().firstIndex(of: fontSizeStr) {
+            fontSizeSelect.selectItemAtIndex(index)
+        }
+        fontSizeSelect.properties.text = String(format: "%.0f", batesModel.fontsize) + " pt"
+        fontSizeSelect.reloadData()
+        
+        fontColorView.properties?.color = batesModel.color
+        fontColorView.reloadData()
+        
+        //Margin
+        marginLeftInput.properties.text = String(format: "%d", batesModel.leftMargin)
+        marginLeftInput.reloadData()
+        
+        marginTopInput.properties.text = String(format: "%d", batesModel.topMargin)
+        marginTopInput.reloadData()
+        
+        marginRightInput.properties.text = String(format: "%d", batesModel.rightMargin)
+        marginRightInput.reloadData()
+        
+        marginBottomInput.properties.text = String(format: "%d", batesModel.bottomMargin)
+        marginBottomInput.reloadData()
+        
+        //Display
+        prefixInput.properties.text = batesModel.prefixString
+        suffixInput.properties.text = batesModel.suffixString
+        
+        digitsInputNumber.properties.text = String(format: "%d", batesModel.digits)
+        
+        if true {
+            var sizeItemArr: [ComponentMenuitemProperty] = []
+            var indexArr: [String] = []
+            for index in 0...totalPDFCount {
+                indexArr.append(String(format: "%ld", index))
+            }
+            for string in indexArr {
+                let item = ComponentMenuitemProperty(type: .normal, text: string, identifier: string)
+                sizeItemArr.append(item)
+            }
+            startPageSelect.updateMenuItemsArr(sizeItemArr)
+        }
+        
+        if let index = KMHeaderFooterManager.getPageFormats().firstIndex(of: batesModel.startString) {
+            startPageSelect.selectItemAtIndex(index)
+        }
+        startPageSelect.properties.text = batesModel.startString
+        startPageSelect.reloadData()
+        
+        //Layout
+        
+        
+    }
+    
+    //MARK: - Action
+    
+    @objc func componentButtonClicked(_ sender: ComponentButton) {
+        if sender == templateButton {
+            delegate?.batesPropertyControllerDidChangetoTemplate?(self)
+            
+        } else if sender == layoutInsertButton {
+            var menuItemArr: [ComponentMenuitemProperty] = []
+            var items: [(String, String)] = [("Insert Page Number", "InsertPageNumberKey"),
+                                             ("Insert Date", "InsertDateKey")]
+            
+            for (i, value) in items {
+                let properties_Menuitem: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false,
+                                                                                               itemSelected: false,
+                                                                                               isDisabled: false,
+                                                                                               keyEquivalent: nil,
+                                                                                               text: KMLocalizedString(i),
+                                                                                               identifier: value)
+                menuItemArr.append(properties_Menuitem)
+            }
+            
+            if groupView == nil {
+                groupView = ComponentGroup.createFromNib(in: ComponentLibrary.shared.componentBundle())
+            }
+            groupView.groupDelegate = self
+            groupView?.frame = CGRectMake(0, 0, 160, 80)
+            groupView.updateGroupInfo(menuItemArr)
+            if let point: CGPoint = sender.superview?.convert(sender.frame.origin, to: self.view.window?.contentView) {
+                groupView.showWithPoint(CGPoint(x: point.x, y: point.y - CGRectGetHeight(groupView.frame)-4), relativeTo: self.view)
+            }
+        } else if sender == saveButton {
+            batesModel.prefixString = prefixInput.properties.text
+            batesModel.suffixString = suffixInput.properties.text
+            
+            let saveWindow: KMWatermarkSaveWindow = KMWatermarkSaveWindow(windowNibName: "KMWatermarkSaveWindow")
+            saveWindow.nameValue = KMBatesManager.defaultManager.fetchBatesAvailableName()
+            
+            saveWindow.saveHandler = {[weak self] string in
+                guard let weakSelf = self else { return }
+                DispatchQueue.main.async {
+                    weakSelf.batesModel.name = string ?? ""
+                    if KMBatesManager.defaultManager.addTemplate(weakSelf.batesModel){
+                        weakSelf.delegate?.batesPropertyControllerSaveTemplateSuccess?(weakSelf, weakSelf.batesModel)
+                    }
+                }
+            }
+            saveWindow.own_beginSheetModal(for: view.window) { string in
+                
+            }
+        }
+    }
+    
+}
+
+//MARK: - ComponentInputNumberDelegate
+extension KMBatesPropertyController: ComponentInputNumberDelegate {
+    func componentInputNumberDidValueChanged(inputNumber: ComponentInputNumber?) {
+        if inputNumber == marginLeftInput {
+            if let text = inputNumber?.properties.text {
+                batesModel.leftMargin = Int(text) ?? 30
+            }
+        } else if inputNumber == marginTopInput {
+            if let text = inputNumber?.properties.text {
+                batesModel.topMargin = Int(text) ?? 30
+            }
+        } else if inputNumber == marginRightInput {
+            if let text = inputNumber?.properties.text {
+                batesModel.rightMargin = Int(text) ?? 30
+            }
+        } else if inputNumber == marginBottomInput {
+            if let text = inputNumber?.properties.text {
+                batesModel.bottomMargin = Int(text) ?? 30
+            }
+        } else if inputNumber == digitsInputNumber {
+            if let text = inputNumber?.properties.text {
+                batesModel.digits = Int(text) ?? 1
+            }
+        }
+        reloadData()
+        
+        delegate?.batesPropertyControllerDidUpdate?(self)
+    }
+}
+
+//MARK: - ComponentInputDelegate
+extension KMBatesPropertyController: ComponentInputDelegate {
+    
+}
+
+//MARK: - ComponentSelectDelegate
+extension KMBatesPropertyController: ComponentSelectDelegate {
+    func componentSelectDidSelect(view: ComponentSelect?, menuItemProperty: ComponentMenuitemProperty?) {
+        if view == fontNameSelect {
+            batesModel.fontName = menuItemProperty?.text ?? ""
+        } else if view == fontSizeSelect {
+            if let text = menuItemProperty?.text {
+                let result = text.stringByDeleteCharString(" pt")
+                batesModel.fontsize = result.stringToCGFloat()
+            }
+        } else if view == startPageSelect {
+            if let text = menuItemProperty?.text {
+                batesModel.startString = text
+            }
+        }
+        
+        reloadData()
+        
+        delegate?.batesPropertyControllerDidUpdate?(self)
+    }
+    
+}
+
+//MARK: - ComponentGroupDelegate
+extension KMBatesPropertyController: ComponentGroupDelegate {
+    func componentGroupDidSelect(group: ComponentGroup?, menuItemProperty: ComponentMenuitemProperty?) {
+        
+    }
+}

+ 498 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesPropertyController.xib

@@ -0,0 +1,498 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBatesPropertyController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="contendView" destination="3hL-Nl-y5w" id="IGL-kT-CrM"/>
+                <outlet property="digitsInputNumber" destination="tZj-L9-Vho" id="V9C-oY-aNF"/>
+                <outlet property="digitsLabel" destination="8sX-hO-zGM" id="Yj5-lk-ZUX"/>
+                <outlet property="displayBGView" destination="ekq-0Q-3AG" id="cbu-I1-dIh"/>
+                <outlet property="displayLabel" destination="oi2-aL-CZI" id="ptn-HR-Yed"/>
+                <outlet property="fontBGView" destination="JTC-8R-qXC" id="7Dk-CH-Os0"/>
+                <outlet property="fontColorView" destination="yzq-c8-tQs" id="M9a-32-h1C"/>
+                <outlet property="fontLabel" destination="oXn-XY-wkk" id="Gdl-Rw-HNE"/>
+                <outlet property="fontNameSelect" destination="mqg-hg-M3U" id="Dh3-gO-uT4"/>
+                <outlet property="fontSizeSelect" destination="TjO-PX-wSR" id="Z0m-0U-b04"/>
+                <outlet property="layoutBGView" destination="LEX-y5-nEd" id="heo-vo-R1K"/>
+                <outlet property="layoutInsertButton" destination="NbK-pb-ue2" id="PIP-wt-Fbh"/>
+                <outlet property="layoutLabel" destination="GFB-ba-xZF" id="ZGo-IA-qTv"/>
+                <outlet property="layoutPosition" destination="DWX-yy-Go7" id="KNB-bG-BUf"/>
+                <outlet property="layoutTextarea" destination="LsP-FL-G4W" id="C90-mh-Jz4"/>
+                <outlet property="marginBGView" destination="TJy-wt-qBY" id="Ps8-VM-kpC"/>
+                <outlet property="marginBottomInput" destination="zzh-Lv-dWe" id="0Ou-Ik-rUk"/>
+                <outlet property="marginLabel" destination="fp5-OG-xQL" id="Qty-AW-6Vi"/>
+                <outlet property="marginLeftInput" destination="ATw-XX-vdj" id="ocb-J0-Pqi"/>
+                <outlet property="marginRightInput" destination="6MF-S3-J2X" id="brA-ht-4Qb"/>
+                <outlet property="marginTopInput" destination="l3a-BQ-xxx" id="dqO-9H-FSd"/>
+                <outlet property="prefixInput" destination="vU6-Tk-Tz2" id="5ZQ-M8-wG1"/>
+                <outlet property="prefixLabel" destination="XBB-h0-ukM" id="rY3-av-BHc"/>
+                <outlet property="saveButton" destination="x8w-w5-18O" id="EhV-tt-drg"/>
+                <outlet property="saveTemplateBGView" destination="8js-xx-jBj" id="obC-SQ-qSa"/>
+                <outlet property="startPageLabel" destination="Yf2-7T-WIb" id="AaG-92-zLS"/>
+                <outlet property="startPageSelect" destination="L8U-n0-xU2" id="bCS-8V-f9h"/>
+                <outlet property="suffixInput" destination="bQg-7s-jbL" id="JuJ-a7-xRQ"/>
+                <outlet property="suffixLabel" destination="sQk-r3-m2Y" id="JCj-9y-HLp"/>
+                <outlet property="templateButton" destination="kE5-gY-d9o" id="PUx-sB-yf5"/>
+                <outlet property="titleLabel" destination="P8U-H2-bhU" id="Q7y-BN-pIY"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="300" height="777"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="3hL-Nl-y5w">
+                    <rect key="frame" x="0.0" y="0.0" width="300" height="777"/>
+                    <subviews>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="rT8-vR-Jg5">
+                            <rect key="frame" x="0.0" y="737" width="300" height="40"/>
+                            <subviews>
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P8U-H2-bhU">
+                                    <rect key="frame" x="84" y="12" width="132" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Add Header &amp; Footer" id="bby-fh-BkC">
+                                        <font key="font" usesAppearanceFont="YES"/>
+                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="kE5-gY-d9o" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                    <rect key="frame" x="268" y="8" width="24" height="24"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="24" id="dny-ME-hlD"/>
+                                        <constraint firstAttribute="height" constant="24" id="qS1-vK-wfK"/>
+                                    </constraints>
+                                </customView>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="coz-u2-B90" customClass="ComponentDivider" customModule="KMComponentLibrary">
+                                    <rect key="frame" x="0.0" y="0.0" width="300" height="1"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="1" id="9le-PX-nVC"/>
+                                    </constraints>
+                                </customView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="trailing" secondItem="coz-u2-B90" secondAttribute="trailing" id="7k2-Mc-Ade"/>
+                                <constraint firstAttribute="trailing" secondItem="kE5-gY-d9o" secondAttribute="trailing" constant="8" id="85O-7i-3Eu"/>
+                                <constraint firstItem="kE5-gY-d9o" firstAttribute="centerY" secondItem="rT8-vR-Jg5" secondAttribute="centerY" id="L08-DP-fA9"/>
+                                <constraint firstAttribute="bottom" secondItem="coz-u2-B90" secondAttribute="bottom" id="WW5-ga-PvO"/>
+                                <constraint firstItem="P8U-H2-bhU" firstAttribute="centerY" secondItem="rT8-vR-Jg5" secondAttribute="centerY" id="Ywj-Ti-Upq"/>
+                                <constraint firstItem="P8U-H2-bhU" firstAttribute="centerX" secondItem="rT8-vR-Jg5" secondAttribute="centerX" id="sDY-CK-V4q"/>
+                                <constraint firstItem="coz-u2-B90" firstAttribute="leading" secondItem="rT8-vR-Jg5" secondAttribute="leading" id="wQK-DZ-q4k"/>
+                                <constraint firstAttribute="height" constant="40" id="yel-iW-dN3"/>
+                            </constraints>
+                        </customView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="fGA-DJ-xaA">
+                            <rect key="frame" x="0.0" y="71" width="300" height="666"/>
+                            <subviews>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="JTC-8R-qXC">
+                                    <rect key="frame" x="34" y="554" width="232" height="112"/>
+                                    <subviews>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="5at-Bi-ZIu">
+                                            <rect key="frame" x="0.0" y="72" width="232" height="40"/>
+                                            <subviews>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oXn-XY-wkk">
+                                                    <rect key="frame" x="-2" y="12" width="32" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Font" id="zUB-65-GE2">
+                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="oXn-XY-wkk" firstAttribute="centerY" secondItem="5at-Bi-ZIu" secondAttribute="centerY" id="1FW-f0-8DR"/>
+                                                <constraint firstAttribute="height" constant="40" id="3uM-Mz-9TG"/>
+                                                <constraint firstItem="oXn-XY-wkk" firstAttribute="leading" secondItem="5at-Bi-ZIu" secondAttribute="leading" id="fzK-JC-wir"/>
+                                            </constraints>
+                                        </customView>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="mqg-hg-M3U" customClass="ComponentSelect" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="0.0" y="40" width="232" height="32"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="32" id="FYO-bw-KR6"/>
+                                            </constraints>
+                                        </customView>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="TjO-PX-wSR" customClass="ComponentSelect" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="0.0" y="0.0" width="168" height="32"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="32" id="5zS-jq-jNT"/>
+                                                <constraint firstAttribute="width" constant="168" id="q3t-FH-BBV"/>
+                                            </constraints>
+                                        </customView>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="yzq-c8-tQs" customClass="ComponentCColorCustom" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="176" y="0.0" width="56" height="32"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="32" id="8Ek-rn-6uR"/>
+                                                <constraint firstAttribute="width" constant="56" id="AkO-Wk-HvF"/>
+                                            </constraints>
+                                        </customView>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="112" id="4Kp-DT-ZPZ"/>
+                                        <constraint firstAttribute="width" constant="232" id="7De-xf-ycR"/>
+                                        <constraint firstItem="5at-Bi-ZIu" firstAttribute="leading" secondItem="JTC-8R-qXC" secondAttribute="leading" id="CSA-qi-SIk"/>
+                                        <constraint firstAttribute="trailing" secondItem="mqg-hg-M3U" secondAttribute="trailing" id="HTQ-dk-HPr"/>
+                                        <constraint firstItem="yzq-c8-tQs" firstAttribute="top" secondItem="mqg-hg-M3U" secondAttribute="bottom" constant="8" id="S5E-Aq-Iv7"/>
+                                        <constraint firstItem="5at-Bi-ZIu" firstAttribute="top" secondItem="JTC-8R-qXC" secondAttribute="top" id="XUQ-4x-bhX"/>
+                                        <constraint firstAttribute="trailing" secondItem="yzq-c8-tQs" secondAttribute="trailing" id="g6U-1w-Qm6"/>
+                                        <constraint firstItem="TjO-PX-wSR" firstAttribute="leading" secondItem="JTC-8R-qXC" secondAttribute="leading" id="gzt-RI-6d7"/>
+                                        <constraint firstItem="mqg-hg-M3U" firstAttribute="top" secondItem="5at-Bi-ZIu" secondAttribute="bottom" id="kmn-xW-WmW"/>
+                                        <constraint firstAttribute="trailing" secondItem="5at-Bi-ZIu" secondAttribute="trailing" id="lC5-dq-Eym"/>
+                                        <constraint firstItem="mqg-hg-M3U" firstAttribute="leading" secondItem="JTC-8R-qXC" secondAttribute="leading" id="n4n-yi-E89"/>
+                                        <constraint firstItem="TjO-PX-wSR" firstAttribute="top" secondItem="mqg-hg-M3U" secondAttribute="bottom" constant="8" id="y0h-ZU-wcX"/>
+                                    </constraints>
+                                </customView>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="TJy-wt-qBY">
+                                    <rect key="frame" x="34" y="426" width="232" height="112"/>
+                                    <subviews>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="UU4-Pb-4Nv">
+                                            <rect key="frame" x="0.0" y="72" width="232" height="40"/>
+                                            <subviews>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fp5-OG-xQL">
+                                                    <rect key="frame" x="-2" y="12" width="82" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Margin (mm)" id="xqa-hL-MYs">
+                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="fp5-OG-xQL" firstAttribute="leading" secondItem="UU4-Pb-4Nv" secondAttribute="leading" id="fWM-yr-7Ny"/>
+                                                <constraint firstAttribute="height" constant="40" id="rE4-eB-OaL"/>
+                                                <constraint firstItem="fp5-OG-xQL" firstAttribute="centerY" secondItem="UU4-Pb-4Nv" secondAttribute="centerY" id="xRb-hD-JOp"/>
+                                            </constraints>
+                                        </customView>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="Kfn-SC-gfk">
+                                            <rect key="frame" x="0.0" y="0.0" width="232" height="72"/>
+                                            <subviews>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="J6t-Z0-Ckj">
+                                                    <rect key="frame" x="0.0" y="48" width="16" height="16"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="16" id="8Ss-Gz-Ccq"/>
+                                                        <constraint firstAttribute="height" constant="16" id="U9u-gZ-VCw"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="batesMarginLeft" id="fmq-vE-4uw"/>
+                                                </imageView>
+                                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="ATw-XX-vdj" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
+                                                    <rect key="frame" x="20" y="40" width="92" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="32" id="0FM-g3-u82"/>
+                                                        <constraint firstAttribute="width" constant="92" id="q11-vx-0xJ"/>
+                                                    </constraints>
+                                                </customView>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="iOG-ef-LWa">
+                                                    <rect key="frame" x="120" y="48" width="16" height="16"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="16" id="bSF-YP-MeH"/>
+                                                        <constraint firstAttribute="height" constant="16" id="hpI-CA-whb"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="batesMarginTop" id="WaK-6Q-wt4"/>
+                                                </imageView>
+                                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="l3a-BQ-xxx" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
+                                                    <rect key="frame" x="140" y="40" width="92" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="32" id="Xnl-o1-nni"/>
+                                                        <constraint firstAttribute="width" constant="92" id="uuH-Fl-e1H"/>
+                                                    </constraints>
+                                                </customView>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="z4f-96-fCS">
+                                                    <rect key="frame" x="0.0" y="8" width="16" height="16"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="16" id="7G8-sm-Un9"/>
+                                                        <constraint firstAttribute="height" constant="16" id="ome-4I-fDk"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="batesMarginRight" id="xH4-gD-pZr"/>
+                                                </imageView>
+                                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="6MF-S3-J2X" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
+                                                    <rect key="frame" x="20" y="0.0" width="92" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="32" id="1W2-8E-oFw"/>
+                                                        <constraint firstAttribute="width" constant="92" id="Ikn-Ri-bhs"/>
+                                                    </constraints>
+                                                </customView>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="4fd-vj-LED">
+                                                    <rect key="frame" x="120" y="8" width="16" height="16"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="16" id="7GC-ZE-pNE"/>
+                                                        <constraint firstAttribute="width" constant="16" id="kN7-OG-CXK"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="batesMarginBottom" id="u5E-uZ-YkF"/>
+                                                </imageView>
+                                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="zzh-Lv-dWe" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
+                                                    <rect key="frame" x="140" y="0.0" width="92" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="92" id="h2A-Qi-TVk"/>
+                                                        <constraint firstAttribute="height" constant="32" id="zQ7-Ql-bwc"/>
+                                                    </constraints>
+                                                </customView>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="z4f-96-fCS" firstAttribute="centerY" secondItem="6MF-S3-J2X" secondAttribute="centerY" id="0nZ-Mz-W9n"/>
+                                                <constraint firstItem="z4f-96-fCS" firstAttribute="leading" secondItem="Kfn-SC-gfk" secondAttribute="leading" id="148-VT-hEf"/>
+                                                <constraint firstItem="zzh-Lv-dWe" firstAttribute="centerY" secondItem="4fd-vj-LED" secondAttribute="centerY" id="2NG-Xx-o2e"/>
+                                                <constraint firstItem="l3a-BQ-xxx" firstAttribute="leading" secondItem="iOG-ef-LWa" secondAttribute="trailing" constant="4" id="AJu-RU-BaY"/>
+                                                <constraint firstItem="iOG-ef-LWa" firstAttribute="leading" secondItem="ATw-XX-vdj" secondAttribute="trailing" constant="8" id="DUS-pc-lHV"/>
+                                                <constraint firstItem="6MF-S3-J2X" firstAttribute="leading" secondItem="z4f-96-fCS" secondAttribute="trailing" constant="4" id="Fp2-q4-FGw"/>
+                                                <constraint firstAttribute="height" constant="72" id="Jbq-rY-Zv6"/>
+                                                <constraint firstItem="l3a-BQ-xxx" firstAttribute="centerY" secondItem="iOG-ef-LWa" secondAttribute="centerY" id="YU6-wf-Rxb"/>
+                                                <constraint firstItem="J6t-Z0-Ckj" firstAttribute="leading" secondItem="Kfn-SC-gfk" secondAttribute="leading" id="Z8p-aA-diQ"/>
+                                                <constraint firstItem="zzh-Lv-dWe" firstAttribute="top" secondItem="l3a-BQ-xxx" secondAttribute="bottom" constant="8" id="ZDj-yB-XeC"/>
+                                                <constraint firstItem="4fd-vj-LED" firstAttribute="leading" secondItem="6MF-S3-J2X" secondAttribute="trailing" constant="8" id="avC-4Z-hwp"/>
+                                                <constraint firstItem="J6t-Z0-Ckj" firstAttribute="centerY" secondItem="ATw-XX-vdj" secondAttribute="centerY" id="avz-Be-Q7o"/>
+                                                <constraint firstItem="l3a-BQ-xxx" firstAttribute="top" secondItem="Kfn-SC-gfk" secondAttribute="top" id="gPY-dk-kHe"/>
+                                                <constraint firstItem="ATw-XX-vdj" firstAttribute="leading" secondItem="J6t-Z0-Ckj" secondAttribute="trailing" constant="4" id="t43-MZ-DXe"/>
+                                                <constraint firstItem="ATw-XX-vdj" firstAttribute="top" secondItem="Kfn-SC-gfk" secondAttribute="top" id="wM6-Vu-j98"/>
+                                                <constraint firstItem="6MF-S3-J2X" firstAttribute="top" secondItem="ATw-XX-vdj" secondAttribute="bottom" constant="8" id="xoz-BV-QQG"/>
+                                                <constraint firstItem="zzh-Lv-dWe" firstAttribute="leading" secondItem="4fd-vj-LED" secondAttribute="trailing" constant="4" id="z7u-sz-Eux"/>
+                                            </constraints>
+                                        </customView>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstItem="UU4-Pb-4Nv" firstAttribute="top" secondItem="TJy-wt-qBY" secondAttribute="top" id="IR8-eU-rUf"/>
+                                        <constraint firstAttribute="width" constant="232" id="NoS-dm-uMW"/>
+                                        <constraint firstAttribute="trailing" secondItem="Kfn-SC-gfk" secondAttribute="trailing" id="doj-dD-5dr"/>
+                                        <constraint firstAttribute="trailing" secondItem="UU4-Pb-4Nv" secondAttribute="trailing" id="epx-tp-dGj"/>
+                                        <constraint firstAttribute="height" constant="112" id="pX9-Ud-2dM"/>
+                                        <constraint firstItem="UU4-Pb-4Nv" firstAttribute="leading" secondItem="TJy-wt-qBY" secondAttribute="leading" id="qyP-5S-qUC"/>
+                                        <constraint firstItem="Kfn-SC-gfk" firstAttribute="leading" secondItem="TJy-wt-qBY" secondAttribute="leading" id="t7l-Z7-USm"/>
+                                        <constraint firstItem="Kfn-SC-gfk" firstAttribute="top" secondItem="UU4-Pb-4Nv" secondAttribute="bottom" id="ujL-xs-IgS"/>
+                                    </constraints>
+                                </customView>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="ekq-0Q-3AG">
+                                    <rect key="frame" x="34" y="218" width="232" height="192"/>
+                                    <subviews>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="UJJ-R3-5lg">
+                                            <rect key="frame" x="0.0" y="152" width="232" height="40"/>
+                                            <subviews>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oi2-aL-CZI">
+                                                    <rect key="frame" x="-2" y="12" width="49" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Display" id="Jko-GY-8Js">
+                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="oi2-aL-CZI" firstAttribute="centerY" secondItem="UJJ-R3-5lg" secondAttribute="centerY" id="Y9P-UV-0u7"/>
+                                                <constraint firstAttribute="height" constant="40" id="aNu-U7-UXZ"/>
+                                                <constraint firstItem="oi2-aL-CZI" firstAttribute="leading" secondItem="UJJ-R3-5lg" secondAttribute="leading" id="cgm-dh-dl4"/>
+                                            </constraints>
+                                        </customView>
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XBB-h0-ukM">
+                                            <rect key="frame" x="-2" y="128" width="47" height="16"/>
+                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Prefix: " id="aMU-bS-b5l">
+                                                <font key="font" usesAppearanceFont="YES"/>
+                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            </textFieldCell>
+                                        </textField>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="vU6-Tk-Tz2" customClass="ComponentInput" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="45" y="120" width="187" height="32"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="32" id="KY5-4h-2Du"/>
+                                            </constraints>
+                                        </customView>
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sQk-r3-m2Y">
+                                            <rect key="frame" x="-2" y="88" width="47" height="16"/>
+                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Suffix: " id="aRj-qE-zXq">
+                                                <font key="font" usesAppearanceFont="YES"/>
+                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            </textFieldCell>
+                                        </textField>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="bQg-7s-jbL" customClass="ComponentInput" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="45" y="80" width="187" height="32"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="32" id="dMK-PL-xax"/>
+                                            </constraints>
+                                        </customView>
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8sX-hO-zGM">
+                                            <rect key="frame" x="-2" y="48" width="121" height="16"/>
+                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Numbers of Digits: " id="7Qg-ow-zmA">
+                                                <font key="font" usesAppearanceFont="YES"/>
+                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            </textFieldCell>
+                                        </textField>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="tZj-L9-Vho" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="119" y="40" width="113" height="32"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="32" id="R2p-zM-67I"/>
+                                            </constraints>
+                                        </customView>
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Yf2-7T-WIb">
+                                            <rect key="frame" x="-2" y="8" width="75" height="16"/>
+                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Start Page: " id="OaO-0M-DgG">
+                                                <font key="font" usesAppearanceFont="YES"/>
+                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            </textFieldCell>
+                                        </textField>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="L8U-n0-xU2" customClass="ComponentSelect" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="73" y="0.0" width="159" height="32"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="32" id="8zL-SK-zoY"/>
+                                            </constraints>
+                                        </customView>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstItem="Yf2-7T-WIb" firstAttribute="leading" secondItem="ekq-0Q-3AG" secondAttribute="leading" id="0vs-le-wdi"/>
+                                        <constraint firstAttribute="trailing" secondItem="L8U-n0-xU2" secondAttribute="trailing" id="11m-eq-4aW"/>
+                                        <constraint firstAttribute="trailing" secondItem="tZj-L9-Vho" secondAttribute="trailing" id="3Pp-Sb-4ib"/>
+                                        <constraint firstAttribute="trailing" secondItem="vU6-Tk-Tz2" secondAttribute="trailing" id="8Sn-zY-mqy"/>
+                                        <constraint firstAttribute="height" constant="192" id="9Ae-DC-f5n"/>
+                                        <constraint firstItem="XBB-h0-ukM" firstAttribute="leading" secondItem="ekq-0Q-3AG" secondAttribute="leading" id="AKT-l2-PfR"/>
+                                        <constraint firstItem="UJJ-R3-5lg" firstAttribute="leading" secondItem="ekq-0Q-3AG" secondAttribute="leading" id="B4I-DF-J1q"/>
+                                        <constraint firstItem="UJJ-R3-5lg" firstAttribute="top" secondItem="ekq-0Q-3AG" secondAttribute="top" id="BEn-aw-SOu"/>
+                                        <constraint firstItem="L8U-n0-xU2" firstAttribute="top" secondItem="tZj-L9-Vho" secondAttribute="bottom" constant="8" id="Dt1-kj-830"/>
+                                        <constraint firstItem="sQk-r3-m2Y" firstAttribute="centerY" secondItem="bQg-7s-jbL" secondAttribute="centerY" id="E1k-3h-NIP"/>
+                                        <constraint firstItem="bQg-7s-jbL" firstAttribute="leading" secondItem="sQk-r3-m2Y" secondAttribute="trailing" constant="2" id="F0Q-a0-hWc"/>
+                                        <constraint firstItem="L8U-n0-xU2" firstAttribute="leading" secondItem="Yf2-7T-WIb" secondAttribute="trailing" constant="2" id="FYg-s3-VjB"/>
+                                        <constraint firstItem="Yf2-7T-WIb" firstAttribute="centerY" secondItem="L8U-n0-xU2" secondAttribute="centerY" id="I6f-0k-Wxs"/>
+                                        <constraint firstItem="tZj-L9-Vho" firstAttribute="leading" secondItem="8sX-hO-zGM" secondAttribute="trailing" constant="2" id="NIr-X6-fXe"/>
+                                        <constraint firstItem="vU6-Tk-Tz2" firstAttribute="centerY" secondItem="XBB-h0-ukM" secondAttribute="centerY" id="NVW-mF-wG1"/>
+                                        <constraint firstItem="8sX-hO-zGM" firstAttribute="leading" secondItem="ekq-0Q-3AG" secondAttribute="leading" id="R0j-9b-7VA"/>
+                                        <constraint firstAttribute="trailing" secondItem="bQg-7s-jbL" secondAttribute="trailing" id="WX5-Ym-I1P"/>
+                                        <constraint firstItem="vU6-Tk-Tz2" firstAttribute="top" secondItem="UJJ-R3-5lg" secondAttribute="bottom" id="aEg-9z-QW8"/>
+                                        <constraint firstItem="tZj-L9-Vho" firstAttribute="top" secondItem="bQg-7s-jbL" secondAttribute="bottom" constant="8" id="e9c-Cc-oAx"/>
+                                        <constraint firstAttribute="trailing" secondItem="UJJ-R3-5lg" secondAttribute="trailing" id="efJ-Ys-XZA"/>
+                                        <constraint firstItem="sQk-r3-m2Y" firstAttribute="leading" secondItem="ekq-0Q-3AG" secondAttribute="leading" id="iZm-6R-Gk5"/>
+                                        <constraint firstItem="bQg-7s-jbL" firstAttribute="top" secondItem="vU6-Tk-Tz2" secondAttribute="bottom" constant="8" id="mQf-PU-5oT"/>
+                                        <constraint firstItem="8sX-hO-zGM" firstAttribute="centerY" secondItem="tZj-L9-Vho" secondAttribute="centerY" id="mwa-tl-NqS"/>
+                                        <constraint firstAttribute="width" constant="232" id="ppV-qb-WIM"/>
+                                        <constraint firstItem="vU6-Tk-Tz2" firstAttribute="leading" secondItem="XBB-h0-ukM" secondAttribute="trailing" constant="2" id="uTI-7J-tmJ"/>
+                                    </constraints>
+                                </customView>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="LEX-y5-nEd">
+                                    <rect key="frame" x="34" y="42" width="232" height="160"/>
+                                    <subviews>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="vJX-wh-hma">
+                                            <rect key="frame" x="0.0" y="120" width="232" height="40"/>
+                                            <subviews>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GFB-ba-xZF">
+                                                    <rect key="frame" x="-2" y="12" width="110" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Layout &amp; Content" id="LSi-cM-ab6">
+                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="NbK-pb-ue2" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                                    <rect key="frame" x="208" y="8" width="24" height="24"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="cwt-oI-Z3m"/>
+                                                        <constraint firstAttribute="height" constant="24" id="sMh-qY-6Pq"/>
+                                                    </constraints>
+                                                </customView>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="40" id="81A-8O-6U3"/>
+                                                <constraint firstItem="NbK-pb-ue2" firstAttribute="centerY" secondItem="vJX-wh-hma" secondAttribute="centerY" id="8nJ-jW-d8n"/>
+                                                <constraint firstItem="GFB-ba-xZF" firstAttribute="centerY" secondItem="vJX-wh-hma" secondAttribute="centerY" id="TbP-3v-5gn"/>
+                                                <constraint firstAttribute="trailing" secondItem="NbK-pb-ue2" secondAttribute="trailing" id="hVd-lD-eln"/>
+                                                <constraint firstItem="GFB-ba-xZF" firstAttribute="leading" secondItem="vJX-wh-hma" secondAttribute="leading" id="yN8-yT-z7f"/>
+                                            </constraints>
+                                        </customView>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="DWX-yy-Go7" customClass="ComponentCPosition" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="0.0" y="72" width="232" height="48"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="48" id="F9E-q9-YGF"/>
+                                            </constraints>
+                                        </customView>
+                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="LsP-FL-G4W" customClass="ComponentTextarea" customModule="KMComponentLibrary">
+                                            <rect key="frame" x="0.0" y="0.0" width="232" height="64"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="64" id="c1A-dK-NAw"/>
+                                            </constraints>
+                                        </customView>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstItem="DWX-yy-Go7" firstAttribute="top" secondItem="vJX-wh-hma" secondAttribute="bottom" id="1it-Dd-w8c"/>
+                                        <constraint firstAttribute="trailing" secondItem="vJX-wh-hma" secondAttribute="trailing" id="CgB-tE-wMe"/>
+                                        <constraint firstAttribute="trailing" secondItem="LsP-FL-G4W" secondAttribute="trailing" id="cci-dS-zJj"/>
+                                        <constraint firstAttribute="height" constant="160" id="dSF-yn-0Nd"/>
+                                        <constraint firstItem="DWX-yy-Go7" firstAttribute="leading" secondItem="LEX-y5-nEd" secondAttribute="leading" id="g94-JL-Zd8"/>
+                                        <constraint firstItem="vJX-wh-hma" firstAttribute="leading" secondItem="LEX-y5-nEd" secondAttribute="leading" id="lXY-q1-eIv"/>
+                                        <constraint firstItem="LsP-FL-G4W" firstAttribute="top" secondItem="DWX-yy-Go7" secondAttribute="bottom" constant="8" id="oKN-1r-JpQ"/>
+                                        <constraint firstItem="LsP-FL-G4W" firstAttribute="leading" secondItem="LEX-y5-nEd" secondAttribute="leading" id="q5A-Tv-z2L"/>
+                                        <constraint firstItem="vJX-wh-hma" firstAttribute="top" secondItem="LEX-y5-nEd" secondAttribute="top" id="ugA-5J-qyE"/>
+                                        <constraint firstAttribute="trailing" secondItem="DWX-yy-Go7" secondAttribute="trailing" id="y39-4u-JM6"/>
+                                        <constraint firstAttribute="width" constant="232" id="zIh-iX-psd"/>
+                                    </constraints>
+                                </customView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="JTC-8R-qXC" firstAttribute="top" secondItem="fGA-DJ-xaA" secondAttribute="top" id="Cds-HK-EcT"/>
+                                <constraint firstItem="TJy-wt-qBY" firstAttribute="centerX" secondItem="fGA-DJ-xaA" secondAttribute="centerX" id="Fgi-W5-Lr9"/>
+                                <constraint firstItem="TJy-wt-qBY" firstAttribute="top" secondItem="JTC-8R-qXC" secondAttribute="bottom" constant="16" id="KyJ-Ms-x7s"/>
+                                <constraint firstAttribute="height" constant="666" id="LsX-fQ-svH"/>
+                                <constraint firstItem="JTC-8R-qXC" firstAttribute="centerX" secondItem="fGA-DJ-xaA" secondAttribute="centerX" id="Srs-YR-XYq"/>
+                                <constraint firstItem="ekq-0Q-3AG" firstAttribute="top" secondItem="TJy-wt-qBY" secondAttribute="bottom" constant="16" id="avp-39-7yc"/>
+                                <constraint firstItem="LEX-y5-nEd" firstAttribute="top" secondItem="ekq-0Q-3AG" secondAttribute="bottom" constant="16" id="fFT-e7-QG3"/>
+                                <constraint firstItem="LEX-y5-nEd" firstAttribute="centerX" secondItem="fGA-DJ-xaA" secondAttribute="centerX" id="kH3-zM-1QB"/>
+                                <constraint firstItem="ekq-0Q-3AG" firstAttribute="centerX" secondItem="fGA-DJ-xaA" secondAttribute="centerX" id="ntU-mi-SSL"/>
+                            </constraints>
+                        </customView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="8js-xx-jBj">
+                            <rect key="frame" x="0.0" y="0.0" width="300" height="72"/>
+                            <subviews>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="wU9-8C-TFY" customClass="ComponentDivider" customModule="KMComponentLibrary">
+                                    <rect key="frame" x="0.0" y="71" width="300" height="1"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="1" id="qEV-sl-Agh"/>
+                                    </constraints>
+                                </customView>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="x8w-w5-18O" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                    <rect key="frame" x="34" y="16" width="232" height="40"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="40" id="5oD-r4-On3"/>
+                                        <constraint firstAttribute="width" constant="232" id="ttL-RH-HuZ"/>
+                                    </constraints>
+                                </customView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="72" id="Eqm-8v-KPD"/>
+                                <constraint firstItem="x8w-w5-18O" firstAttribute="centerY" secondItem="8js-xx-jBj" secondAttribute="centerY" id="aUz-gB-Xc4"/>
+                                <constraint firstItem="wU9-8C-TFY" firstAttribute="leading" secondItem="8js-xx-jBj" secondAttribute="leading" id="jRx-za-cJL"/>
+                                <constraint firstAttribute="trailing" secondItem="wU9-8C-TFY" secondAttribute="trailing" id="mZj-sv-RwD"/>
+                                <constraint firstItem="wU9-8C-TFY" firstAttribute="top" secondItem="8js-xx-jBj" secondAttribute="top" id="xUF-9G-d6T"/>
+                                <constraint firstItem="x8w-w5-18O" firstAttribute="centerX" secondItem="8js-xx-jBj" secondAttribute="centerX" id="yzJ-Xd-fEt"/>
+                            </constraints>
+                        </customView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="rT8-vR-Jg5" firstAttribute="top" secondItem="3hL-Nl-y5w" secondAttribute="top" id="4u6-Mk-mAi"/>
+                        <constraint firstAttribute="trailing" secondItem="rT8-vR-Jg5" secondAttribute="trailing" id="8qW-Ez-gdi"/>
+                        <constraint firstItem="rT8-vR-Jg5" firstAttribute="leading" secondItem="3hL-Nl-y5w" secondAttribute="leading" id="BKH-kz-uPP"/>
+                        <constraint firstAttribute="trailing" secondItem="fGA-DJ-xaA" secondAttribute="trailing" id="M0d-UF-0jD"/>
+                        <constraint firstItem="fGA-DJ-xaA" firstAttribute="leading" secondItem="3hL-Nl-y5w" secondAttribute="leading" id="MVJ-so-Alp"/>
+                        <constraint firstItem="fGA-DJ-xaA" firstAttribute="top" secondItem="rT8-vR-Jg5" secondAttribute="bottom" id="P8Q-42-68W"/>
+                        <constraint firstAttribute="bottom" secondItem="8js-xx-jBj" secondAttribute="bottom" id="Vtm-3h-Nac"/>
+                        <constraint firstAttribute="trailing" secondItem="8js-xx-jBj" secondAttribute="trailing" id="oh5-MJ-3Yo"/>
+                        <constraint firstItem="8js-xx-jBj" firstAttribute="leading" secondItem="3hL-Nl-y5w" secondAttribute="leading" id="vES-RK-ckE"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstAttribute="bottom" secondItem="3hL-Nl-y5w" secondAttribute="bottom" id="3Gb-7a-ulF"/>
+                <constraint firstItem="3hL-Nl-y5w" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="QnE-w1-r55"/>
+                <constraint firstAttribute="trailing" secondItem="3hL-Nl-y5w" secondAttribute="trailing" id="SD8-9M-tDJ"/>
+                <constraint firstItem="3hL-Nl-y5w" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="v4b-lI-u9v"/>
+            </constraints>
+            <point key="canvasLocation" x="42" y="180.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="batesMarginBottom" width="16" height="16"/>
+        <image name="batesMarginLeft" width="16" height="16"/>
+        <image name="batesMarginRight" width="16" height="16"/>
+        <image name="batesMarginTop" width="16" height="16"/>
+    </resources>
+</document>

+ 8 - 7
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHFTemplateController.swift

@@ -1,5 +1,5 @@
 //
-//  KMHFTemplateController.swift
+//  KMBatesTemplateController.swift
 //  PDF Reader Pro
 //
 //  Created by Niehaoyu on 2024/11/8.
@@ -8,7 +8,8 @@
 import Cocoa
 import KMComponentLibrary
 
-class KMHFTemplateController: NSViewController {
+class KMBatesTemplateController: NSViewController {
+  
     @IBOutlet var contendView: NSView!
     @IBOutlet var titleLabel: NSTextField!
     @IBOutlet var addButton: ComponentButton!
@@ -115,7 +116,7 @@ class KMHFTemplateController: NSViewController {
 }
 
 //MARK: - NSCollectionViewDelegate, NSCollectionViewDataSource
-extension KMHFTemplateController: NSCollectionViewDelegate, NSCollectionViewDataSource, NSCollectionViewDelegateFlowLayout {
+extension KMBatesTemplateController: NSCollectionViewDelegate, NSCollectionViewDataSource, NSCollectionViewDelegateFlowLayout {
     
     public func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
         return KMBackgroundManager.defaultManager.datas.count
@@ -165,13 +166,13 @@ extension KMHFTemplateController: NSCollectionViewDelegate, NSCollectionViewData
 }
 
 //MARK: - kmNWatermarkTemplateItemDelegate
-extension KMHFTemplateController: KMBGTemplateItemDelegate {
+extension KMBatesTemplateController: KMBGTemplateItemDelegate {
 //    func kmNBGTemplateItemDidEdit(_ view: KMBGTemplateItem) {
 //        if let data = view.backgroundModel {
 //            delegate?.templateControllerDidEditData?(self, data)
 //        }
 //    }
-//    
+//
 //    func kmNBGTemplateItemDidDelete(_ view: KMBGTemplateItem) {
 //        if let data = view.backgroundModel {
 //            let alert = NSAlert()
@@ -179,11 +180,11 @@ extension KMHFTemplateController: KMBGTemplateItemDelegate {
 //            alert.messageText = String(format: KMLocalizedString("Are you sure you want to remove the background?"))
 //            alert.addButton(withTitle: KMLocalizedString("Delete"))
 //            alert.addButton(withTitle: KMLocalizedString("Cancel"))
-//            
+//
 //            alert.beginSheetModal(for: NSApp.mainWindow!) { (response) in
 //                if response == .alertFirstButtonReturn {
 //                    let _ = KMBackgroundManager.defaultManager.deleteTemplate(model: data)
-//                    
+//
 //                    self.reloadData()
 //                }
 //            }

+ 131 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesTemplateController.xib

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBatesTemplateController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="addButton" destination="lXg-eE-lSQ" id="Blj-DO-KsF"/>
+                <outlet property="collectionView" destination="QB3-rL-uHX" id="3lU-pH-cFA"/>
+                <outlet property="contendView" destination="MiB-Yl-n1S" id="UKI-tj-vBF"/>
+                <outlet property="emptyView" destination="akr-er-3Ml" id="4Nv-a0-WvR"/>
+                <outlet property="scrollView" destination="FzK-lA-zWu" id="UtW-fE-6dx"/>
+                <outlet property="titleLabel" destination="oIx-tw-YLY" id="XKe-Lf-NDF"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="MiB-Yl-n1S">
+                    <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+                    <subviews>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="uSu-3z-23I">
+                            <rect key="frame" x="0.0" y="232" width="480" height="40"/>
+                            <subviews>
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oIx-tw-YLY">
+                                    <rect key="frame" x="207" y="12" width="67" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Templates" id="RtO-Hg-mOK">
+                                        <font key="font" usesAppearanceFont="YES"/>
+                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="lXg-eE-lSQ" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                    <rect key="frame" x="448" y="8" width="24" height="24"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="24" id="R2E-F4-CJa"/>
+                                        <constraint firstAttribute="height" constant="24" id="YFN-5W-Oli"/>
+                                    </constraints>
+                                </customView>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="LSa-P9-S6K" customClass="ComponentDivider" customModule="KMComponentLibrary">
+                                    <rect key="frame" x="0.0" y="0.0" width="480" height="1"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="1" id="kmA-dc-7iJ"/>
+                                    </constraints>
+                                </customView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="trailing" secondItem="lXg-eE-lSQ" secondAttribute="trailing" constant="8" id="Ass-RK-Rdx"/>
+                                <constraint firstItem="LSa-P9-S6K" firstAttribute="leading" secondItem="uSu-3z-23I" secondAttribute="leading" id="LVs-l9-Z0R"/>
+                                <constraint firstAttribute="bottom" secondItem="LSa-P9-S6K" secondAttribute="bottom" id="hnq-n0-8gN"/>
+                                <constraint firstItem="lXg-eE-lSQ" firstAttribute="centerY" secondItem="uSu-3z-23I" secondAttribute="centerY" id="kmB-Zi-ijh"/>
+                                <constraint firstItem="oIx-tw-YLY" firstAttribute="centerY" secondItem="uSu-3z-23I" secondAttribute="centerY" id="mj8-dC-gML"/>
+                                <constraint firstAttribute="height" constant="40" id="pkS-NQ-pcE"/>
+                                <constraint firstItem="oIx-tw-YLY" firstAttribute="centerX" secondItem="uSu-3z-23I" secondAttribute="centerX" id="vU7-zQ-T17"/>
+                                <constraint firstAttribute="trailing" secondItem="LSa-P9-S6K" secondAttribute="trailing" id="zER-2F-2zn"/>
+                            </constraints>
+                        </customView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="lvP-wo-8Hm">
+                            <rect key="frame" x="0.0" y="0.0" width="480" height="232"/>
+                            <subviews>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="akr-er-3Ml" customClass="ComponentEmpty" customModule="KMComponentLibrary">
+                                    <rect key="frame" x="124" y="24" width="232" height="184"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="232" id="5dY-b9-qzu"/>
+                                        <constraint firstAttribute="height" constant="184" id="Ifj-Fi-Hxt"/>
+                                    </constraints>
+                                </customView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="akr-er-3Ml" firstAttribute="centerX" secondItem="lvP-wo-8Hm" secondAttribute="centerX" id="P5x-cD-IH9"/>
+                                <constraint firstItem="akr-er-3Ml" firstAttribute="centerY" secondItem="lvP-wo-8Hm" secondAttribute="centerY" id="ZUO-8i-Q1Z"/>
+                            </constraints>
+                        </customView>
+                        <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FzK-lA-zWu">
+                            <rect key="frame" x="0.0" y="0.0" width="480" height="232"/>
+                            <clipView key="contentView" id="96W-na-Q49">
+                                <rect key="frame" x="0.0" y="0.0" width="465" height="232"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <collectionView selectable="YES" allowsMultipleSelection="YES" id="QB3-rL-uHX">
+                                        <rect key="frame" x="0.0" y="0.0" width="465" height="307"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
+                                        <collectionViewFlowLayout key="collectionViewLayout" id="B9c-an-nh3">
+                                            <size key="itemSize" width="1" height="1"/>
+                                        </collectionViewFlowLayout>
+                                        <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </collectionView>
+                                </subviews>
+                            </clipView>
+                            <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="iN7-fx-zRL">
+                                <rect key="frame" x="-100" y="-100" width="233" height="15"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                            </scroller>
+                            <scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="KRS-Eu-ZWQ">
+                                <rect key="frame" x="465" y="0.0" width="15" height="232"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                            </scroller>
+                        </scrollView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="FzK-lA-zWu" secondAttribute="trailing" id="D3L-er-S9G"/>
+                        <constraint firstItem="uSu-3z-23I" firstAttribute="top" secondItem="MiB-Yl-n1S" secondAttribute="top" id="FVo-HV-XnS"/>
+                        <constraint firstItem="lvP-wo-8Hm" firstAttribute="top" secondItem="uSu-3z-23I" secondAttribute="bottom" id="FjE-s9-rlC"/>
+                        <constraint firstAttribute="bottom" secondItem="FzK-lA-zWu" secondAttribute="bottom" id="Kf6-5o-4tq"/>
+                        <constraint firstItem="uSu-3z-23I" firstAttribute="leading" secondItem="MiB-Yl-n1S" secondAttribute="leading" id="Kx0-ZY-VeT"/>
+                        <constraint firstItem="FzK-lA-zWu" firstAttribute="leading" secondItem="MiB-Yl-n1S" secondAttribute="leading" id="LRF-t6-QJr"/>
+                        <constraint firstItem="FzK-lA-zWu" firstAttribute="top" secondItem="uSu-3z-23I" secondAttribute="bottom" id="Ys6-LV-NsU"/>
+                        <constraint firstAttribute="trailing" secondItem="uSu-3z-23I" secondAttribute="trailing" id="eRd-a1-Ms8"/>
+                        <constraint firstAttribute="bottom" secondItem="lvP-wo-8Hm" secondAttribute="bottom" id="geM-In-fJo"/>
+                        <constraint firstItem="lvP-wo-8Hm" firstAttribute="leading" secondItem="MiB-Yl-n1S" secondAttribute="leading" id="n70-UW-eIi"/>
+                        <constraint firstAttribute="trailing" secondItem="lvP-wo-8Hm" secondAttribute="trailing" id="ztK-LF-cVz"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="MiB-Yl-n1S" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="026-gU-7vY"/>
+                <constraint firstAttribute="bottom" secondItem="MiB-Yl-n1S" secondAttribute="bottom" id="D3h-Rs-lCy"/>
+                <constraint firstItem="MiB-Yl-n1S" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="dY0-pL-5wN"/>
+                <constraint firstAttribute="trailing" secondItem="MiB-Yl-n1S" secondAttribute="trailing" id="zCw-Fm-FvB"/>
+            </constraints>
+            <point key="canvasLocation" x="132" y="-72"/>
+        </customView>
+    </objects>
+</document>

+ 17 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesTemplateItem.swift

@@ -0,0 +1,17 @@
+//
+//  KMBatesTemplateItem.swift
+//  PDF Reader Pro
+//
+//  Created by Niehaoyu on 2024/11/8.
+//
+
+import Cocoa
+
+class KMBatesTemplateItem: NSViewController {
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+    }
+    
+}

+ 3 - 3
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Controller/KMBatesPropertyController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" 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="21507"/>
+        <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="KMBatesPropertyController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBatesTemplateItem" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
             </connections>

+ 9 - 3
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/KMEditToolbarView.swift

@@ -133,12 +133,16 @@ class KMEditToolbarView: BaseXibView {
             
         } else if editType == .watermark {
             titleLabel.stringValue = KMLocalizedString("Add Watermark")
+            addButton.properties.buttonText = KMLocalizedString("Add Watermark")
         } else if editType == .background {
             titleLabel.stringValue = KMLocalizedString("Add Background")
+            addButton.properties.buttonText = KMLocalizedString("Add Background")
         } else if editType == .header_Footer {
             titleLabel.stringValue = KMLocalizedString("Add Header & Footer")
+            addButton.properties.buttonText = KMLocalizedString("Add Header & Footer")
         } else if editType == .bates {
             titleLabel.stringValue = KMLocalizedString("Add Bates")
+            addButton.properties.buttonText = KMLocalizedString("Add Bates")
         }
         
         if editSubType == .template {
@@ -149,11 +153,13 @@ class KMEditToolbarView: BaseXibView {
             addButton.properties.state = .pressed
         }
         templateButton.reloadData()
-        addButton.reloadData()
-         
+        
+        addButton.properties = addButton.properties
+        addButtonWidthConst.constant = addButton.properties.propertyInfo.viewWidth
+
         applyButton.properties.isDisabled = !applyEnable
         applyButton.reloadData()
-         
+        
     }
     
     func getSelectedPageString(_ document: CPDFDocument, _ pageIndexs: [Int]) -> String {

+ 2 - 6
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/SinglePagePDFController/KMEditDocumentController.swift

@@ -32,13 +32,9 @@ class KMEditDocumentController: NSViewController {
          
     }
     
-    func refreshUI(_ refresh: Bool = false) {
+    func refreshUI() {
+        pdfView.document.refreshPageData()
         pdfView.layoutDocumentView()
-        
-        if refresh {
-            pdfView.updateRender(true)
-        }
     }
     
-    
 }

+ 35 - 35
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Watermark/View/KMWatermarkPDFView.swift

@@ -477,41 +477,41 @@ class KMWatermarkPDFView: CPDFView {
         let startString = self.headerFooter?.startString ?? ""
         var newPage = ""
         
-        if let isBates = self.headerFooter?.isBates, isBates {
-            let pattern = "<<#\\d*?#\\d*#.*?>>|<<#\\d*?#\\d*?>>"
-            if let dates = match(pattern, in: oldString) {
-                for result in dates {
-                    let resultStr = (oldString as NSString).substring(with: result.range) 
-                    let newResultStr = (resultStr as NSString).substring(with: NSMakeRange(2, resultStr.count - 4))
-                    let array = newResultStr.components(separatedBy: "#")
-                    
-                    if array.count > 1 {
-                        let batesDigits = array[1]
-                        
-                        if array.count > 2 {
-                            let firstString = array[2]
-                            newPage = String(format: "%0*ld", batesDigits.count, page + (firstString as NSString).integerValue)
-                        }
-                        
-                        if array.count > 3 {
-                            newPage = "\(array[3])\(newPage)"
-                        }
-                        
-                        if array.count > 4 {
-                            newPage += array[4]
-                        }
-                        
-                        newString = newString.replacingOccurrences(of: resultStr, with: newPage)
-                    }
-                }
-            }
-        } else {
-            newPage = "\(page + (startString as NSString).integerValue)"
-            
-            if !startString.isEmpty {
-                newString = KMWatermarkPDFView.convertViewPageFormat(newString, currentPage: newPage, pageCount: "\(self.document?.pageCount ?? UInt(0 + (startString as NSString).integerValue - 1))")
-            }
-        }
+//        if let isBates = self.headerFooter?.isBates, isBates {
+//            let pattern = "<<#\\d*?#\\d*#.*?>>|<<#\\d*?#\\d*?>>"
+//            if let dates = match(pattern, in: oldString) {
+//                for result in dates {
+//                    let resultStr = (oldString as NSString).substring(with: result.range) 
+//                    let newResultStr = (resultStr as NSString).substring(with: NSMakeRange(2, resultStr.count - 4))
+//                    let array = newResultStr.components(separatedBy: "#")
+//                    
+//                    if array.count > 1 {
+//                        let batesDigits = array[1]
+//                        
+//                        if array.count > 2 {
+//                            let firstString = array[2]
+//                            newPage = String(format: "%0*ld", batesDigits.count, page + (firstString as NSString).integerValue)
+//                        }
+//                        
+//                        if array.count > 3 {
+//                            newPage = "\(array[3])\(newPage)"
+//                        }
+//                        
+//                        if array.count > 4 {
+//                            newPage += array[4]
+//                        }
+//                        
+//                        newString = newString.replacingOccurrences(of: resultStr, with: newPage)
+//                    }
+//                }
+//            }
+//        } else {
+//            newPage = "\(page + (startString as NSString).integerValue)"
+//            
+//            if !startString.isEmpty {
+//                newString = KMWatermarkPDFView.convertViewPageFormat(newString, currentPage: newPage, pageCount: "\(self.document?.pageCount ?? UInt(0 + (startString as NSString).integerValue - 1))")
+//            }
+//        }
         
         newString = KMWatermarkPDFView.convertDateFormat(newString)
         return newString

+ 27 - 27
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Base/KMDataVersionManager.swift

@@ -24,17 +24,17 @@ class KMDataVersionManager: NSObject{
             return nil
         }
         var str: String 
-        if bates?.batesDigits ?? 0 > 0 {
-            str = String(format: "%@<<%@,%ld>>%@", bates!.batesPrefixString, bates!.startString, bates!.batesDigits, bates!.batesSuffixString)
-        } else {
-            str =  String(format: "%@<<%@>>%@", bates!.batesPrefixString, bates!.startString, bates!.batesSuffixString)
-        }
-        bates!.topLeftString = KMDataVersionManager.newBateString(oldString: bates!.topLeftString, bates: bates!, match: str)
-        bates!.topCenterString = KMDataVersionManager.newBateString(oldString: bates!.topCenterString, bates: bates!, match: str)
-        bates!.topRightString = KMDataVersionManager.newBateString(oldString: bates!.topRightString, bates: bates!, match: str)
-        bates!.bottomLeftString = KMDataVersionManager.newBateString(oldString: bates!.bottomLeftString, bates: bates!, match: str)
-        bates!.bottomCenterString = KMDataVersionManager.newBateString(oldString: bates!.bottomCenterString, bates: bates!, match: str)
-        bates!.bottomRightString = KMDataVersionManager.newBateString(oldString: bates!.bottomRightString, bates: bates!, match: str)
+//        if bates?.batesDigits ?? 0 > 0 {
+//            str = String(format: "%@<<%@,%ld>>%@", bates!.batesPrefixString, bates!.startString, bates!.batesDigits, bates!.batesSuffixString)
+//        } else {
+//            str =  String(format: "%@<<%@>>%@", bates!.batesPrefixString, bates!.startString, bates!.batesSuffixString)
+//        }
+//        bates!.topLeftString = KMDataVersionManager.newBateString(oldString: bates!.topLeftString, bates: bates!, match: str)
+//        bates!.topCenterString = KMDataVersionManager.newBateString(oldString: bates!.topCenterString, bates: bates!, match: str)
+//        bates!.topRightString = KMDataVersionManager.newBateString(oldString: bates!.topRightString, bates: bates!, match: str)
+//        bates!.bottomLeftString = KMDataVersionManager.newBateString(oldString: bates!.bottomLeftString, bates: bates!, match: str)
+//        bates!.bottomCenterString = KMDataVersionManager.newBateString(oldString: bates!.bottomCenterString, bates: bates!, match: str)
+//        bates!.bottomRightString = KMDataVersionManager.newBateString(oldString: bates!.bottomRightString, bates: bates!, match: str)
         return bates
     }
     class func newBateString(oldString: String, bates: KMHeaderFooterObject, match: String) -> String {
@@ -44,22 +44,22 @@ class KMDataVersionManager: NSObject{
         for object in results {
             let range = object.range 
             var tString: String
-            if bates.batesDigits > 0 {
-                tString = "<<#(bates.batesDigits)#(bates.startString)"
-            } else {
-                tString = "<<#(bates.startString)"
-            }
-            if bates.batesPrefixString.count > 0 {
-                tString += "#\(bates.batesPrefixString)"
-            } else if bates.batesPrefixString.count < 1 && bates.batesSuffixString.count > 0 {
-                tString += "#"
-            }
-            if bates.batesSuffixString.count > 0 {
-                tString += "#\(bates.batesSuffixString)"
-            }
-            tString += ">>"
-            let resultStr = (oldString as NSString).substring(with: range) 
-            newString = newString.replacingOccurrences(of: resultStr, with: tString)
+//            if bates.batesDigits > 0 {
+//                tString = "<<#(bates.batesDigits)#(bates.startString)"
+//            } else {
+//                tString = "<<#(bates.startString)"
+//            }
+//            if bates.batesPrefixString.count > 0 {
+//                tString += "#\(bates.batesPrefixString)"
+//            } else if bates.batesPrefixString.count < 1 && bates.batesSuffixString.count > 0 {
+//                tString += "#"
+//            }
+//            if bates.batesSuffixString.count > 0 {
+//                tString += "#\(bates.batesSuffixString)"
+//            }
+//            tString += ">>"
+//            let resultStr = (oldString as NSString).substring(with: range) 
+//            newString = newString.replacingOccurrences(of: resultStr, with: tString)
         }
         return newString
     }

+ 101 - 2
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterController.swift

@@ -23,6 +23,7 @@ class KMHeaderFooterController: NSViewController {
      
     var totalPDFCount: Int = 1
     var pdfDocument: CPDFDocument?
+    var headerFooterModel: KMHeaderFooterObject?
     
     var editSubType: KMPDFEditSubModeType = .none
     
@@ -36,13 +37,13 @@ class KMHeaderFooterController: NSViewController {
         
         propertyController.view.frame = propertyInfoView.bounds
         propertyController.view.autoresizingMask = [.width, .height]
-//        propertyController.delegate = self
+        propertyController.delegate = self
         propertyController.view.isHidden = true
         propertyInfoView.addSubview(propertyController.view)
         
         templatesController.view.frame = propertyInfoView.bounds
         templatesController.view.autoresizingMask = [.width, .height]
-//        templatesController.delegate = self
+        templatesController.delegate = self
         templatesController.view.isHidden = true
         propertyInfoView.addSubview(templatesController.view)
         
@@ -76,9 +77,107 @@ class KMHeaderFooterController: NSViewController {
     func reloadData() {
         resetUI()
         
+        propertyController.totalPDFCount = totalPDFCount
+        propertyController.reloadData()
+        
         documentPreview.pdfDocument = self.pdfDocument
         documentPreview.reloadData()
+         
+    }
+    
+    func updatePDFDocumentHeaderFooter() {
+        if let data = headerFooterModel {
+            let cPDFHeaderFooter = documentPreview.pdfDocument?.headerFooter()
+            cPDFHeaderFooter?.pageString = "0"
+            
+            var fontSize = data.fontsize
+            var fontName: String = data.fontName
+
+            let font = NSFont.boldSystemFont(ofSize:fontSize)
+            let style = NSMutableParagraphStyle()
+            style.alignment = .center
+            style.lineBreakMode = .byCharWrapping
+            let size: NSSize = "text".boundingRect(with: NSSize(width: 1000, height: 1000), options: NSString.DrawingOptions(rawValue: 3), attributes: [NSAttributedString.Key.font : font, NSAttributedString.Key.paragraphStyle : style]).size
+            
+            cPDFHeaderFooter?.margin = NSEdgeInsetsMake(max(CGFloat(data.topMargin)-size.height, 0), CGFloat(data.leftMargin), max(CGFloat(data.bottomMargin)-size.height, 0), CGFloat(data.rightMargin))
+             
+            let strings = KMHeaderFooterObject.parseModel(model: data, pageCount: totalPDFCount)
+            var count: Int = 0
+            var color = data.color
+            
+            for text in ["<<1>>", "<<1>>", "<<1>>", "<<1>>", "<<1>>", "<<1>>"] {
+                cPDFHeaderFooter?.setText(text, at: UInt(count))
+                cPDFHeaderFooter?.setTextColor(color, at: UInt(count))
+                cPDFHeaderFooter?.setFontSize(fontSize, at: UInt(count))
+                cPDFHeaderFooter?.setFontName(fontName, at: UInt(count))
+                count += 1
+            }
+            
+            cPDFHeaderFooter?.update()
+            
+            self.documentPreview.refreshUI()
+        } else {
+            pdfDocument?.headerFooter().clear()
+            documentPreview.refreshUI()
+        }
         
+    }
+ 
+    
+}
+
+//MARK: - KMHeaderPropertyControllerDelegate
+extension KMHeaderFooterController: KMHeaderPropertyControllerDelegate {
+    func headerFooterPropertyControllerDidUpdate(_ controller: KMHeaderPropertyController) {
+        headerFooterModel = controller.headerFooterModel
+        
+        updatePDFDocumentHeaderFooter()
+
+    }
+    
+    func headerFooterPropertyControllerDidChangetoTemplate(_ controller: KMHeaderPropertyController) {
+        editSubType = .template
+        
+        headerFooterModel = nil
+        
+        updatePDFDocumentHeaderFooter()
         
+        reloadData()
     }
+    
+    func headerFooterPropertyControllerSaveTemplateSuccess(_ controller: KMHeaderPropertyController, _ data: KMHeaderFooterObject) {
+        editSubType = .template
+        
+        reloadData()
+    }
+}
+
+
+//MARK: - KMHFTemplateControllerDelegate
+extension KMHeaderFooterController: KMHFTemplateControllerDelegate {
+//    func templateControllerDidSelectedChanged(_ controller: KMBGTemplateController) {
+//        backgroundModel = controller.selectedBackground
+//        
+//        updatePDFDocumentBackground()
+//    }
+//    
+//    func templateControllerDidAddData(_ controller: KMBGTemplateController) {
+//        editSubType = .add
+//        
+//        propertyController.backgroundData = KMBackgroundModel.defaultData()
+//        
+//        reloadData()
+//        
+//        delegate?.kmBackgroundControllerDidUpdateMode?(self)
+//    }
+//    
+//    func templateControllerDidEditData(_ controller: KMBGTemplateController, _ data: KMBackgroundModel) {
+//        editSubType = .add
+//        
+//        propertyController.backgroundData = data
+//        
+//        reloadData()
+//        
+//        delegate?.kmBackgroundControllerDidUpdateMode?(self)
+//    }
 }

+ 8 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterManager.swift

@@ -173,4 +173,12 @@ extension KMHeaderFooterManager {
                 "Page 1 of n"]
     }
     
+    class func getFontSize() -> [String] {
+        return ["6","8","10","12","14",
+                "16","18","20","22","24",
+                "26","28","30","32","34",
+                "36","40","48","64","80",
+                "96","112"]
+    }
+    
 }

+ 0 - 45
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterModel.swift

@@ -1,45 +0,0 @@
-//
-//  KMHeaderFooterObject.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2022/12/27.
-//
-
-import Cocoa
-
-class KMHeaderFooterObject: NSObject {
-    
-    var fontsize: CGFloat = 10
-    var color: NSColor = NSColor.black
-    
-    var leftMargin: Int = 30
-    var rightMargin: Int = 30
-    var bottomMargin: Int = 30
-    var topMargin: Int = 30
-    
-    var topLeftString: String = ""
-    var topCenterString: String = ""
-    var topRightString: String = ""
-    var bottomLeftString: String = ""
-    var bottomCenterString: String = ""
-    var bottomRightString: String = ""
-    
-    var dateFormatString: String = KMHeaderFooterManager.getdateFormatArray().first!
-    var pageFormatString: String = KMHeaderFooterManager.getPageFormats().first!
-    var startString: String = "1"
-    
-    var batesDigits: Int = 1
-    var isBates: Bool = false
-    
-    var name: String = ""
-    
-    var batesPrefixString: String = ""
-    var batesSuffixString: String = ""
-    
-    override init() {
-        super.init()
-        
-        self.name = ""
-    }
-     
-}

+ 157 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterObject.swift

@@ -0,0 +1,157 @@
+//
+//  KMHeaderFooterObject.swift
+//  PDF Reader Pro
+//
+//  Created by tangchao on 2022/12/27.
+//
+
+import Cocoa
+
+class KMHeaderFooterObject: NSObject {
+    
+    var fontName: String = "Helvetica"
+    var fontsize: CGFloat = 12
+    var color: NSColor = NSColor.black
+    
+    var leftMargin: Int = 30
+    var rightMargin: Int = 30
+    var bottomMargin: Int = 30
+    var topMargin: Int = 30
+    
+    var topLeftString: String = ""
+    var topCenterString: String = ""
+    var topRightString: String = ""
+    var bottomLeftString: String = ""
+    var bottomCenterString: String = ""
+    var bottomRightString: String = ""
+    
+    var dateFormatString: String = KMHeaderFooterManager.getdateFormatArray().first!
+    var pageFormatString: String = KMHeaderFooterManager.getPageFormats().first!
+    var startString: String = "1"
+
+    var name: String = ""
+    var tag: String = ""
+      
+    override init() {
+        super.init()
+        
+        self.name = ""
+    }
+     
+    class func defaultData() -> KMHeaderFooterObject {
+        let data = KMHeaderFooterObject()
+        
+//        data.type = .color
+// 
+//        if let color = KMPDFWatermarkData.watermarkDefaultColors().first {
+//            data.color = color
+//        }
+//        
+//        data.imagePath = nil
+//        data.rotation = 0
+//        data.opacity = 1
+//        
+//        data.isScale = false
+//        data.scale = 1
+//      
+//        data.verticalMode = 1
+//        data.horizontalMode = 1
+//        
+//        data.verticalSpace = 0
+//        data.horizontalSpace = 0
+//        
+//        data.backgroundID = NSString.tagString()
+//        data.name = KMBackgroundManager.defaultManager.fetchAvailableBackgroundName()
+        
+        return data
+    }
+    
+    static func parseModel(model: KMHeaderFooterObject, pageCount: Int) -> [String] {
+        var topLeftString: String = ""
+        if (!model.topLeftString.isEmpty) {
+            var string = KMHeaderFooterObject.parsePageFormat(formatString: model.topLeftString, startPage: model.startString, pageCount: "\(pageCount)")
+            string = KMHeaderFooterObject.parseDateFormat(formatString: string)
+            topLeftString = string
+        }
+        
+        var topCenterString: String = ""
+        if (!model.topCenterString.isEmpty) {
+            var string = KMHeaderFooterObject.parsePageFormat(formatString: model.topCenterString, startPage: model.startString, pageCount: "\(pageCount)")
+            string = KMHeaderFooterObject.parseDateFormat(formatString: string)
+            topCenterString = string
+        }
+        
+        var topRightString: String = ""
+        if (!model.topRightString.isEmpty) {
+            var string = KMHeaderFooterObject.parsePageFormat(formatString: model.topRightString, startPage: model.startString, pageCount: "\(pageCount)")
+            string = KMHeaderFooterObject.parseDateFormat(formatString: string)
+            topRightString = string
+        }
+        
+        var bottomLeftString: String = ""
+        if (!model.bottomLeftString.isEmpty) {
+            var string = KMHeaderFooterObject.parsePageFormat(formatString: model.bottomLeftString, startPage: model.startString, pageCount: "\(pageCount)")
+            string = KMHeaderFooterObject.parseDateFormat(formatString: string)
+            bottomLeftString = string
+        }
+        var bottomCenterString: String = ""
+        if (!model.bottomCenterString.isEmpty) {
+            var string = KMHeaderFooterObject.parsePageFormat(formatString: model.bottomCenterString, startPage: model.startString, pageCount: "\(pageCount)")
+            string = KMHeaderFooterObject.parseDateFormat(formatString: string)
+            bottomCenterString = string
+        }
+        var bottomRightString: String = ""
+        if (!model.bottomRightString.isEmpty) {
+            var string = KMHeaderFooterObject.parsePageFormat(formatString: model.bottomRightString, startPage: model.startString, pageCount: "\(pageCount)")
+            string = KMHeaderFooterObject.parseDateFormat(formatString: string)
+            bottomRightString = string
+        }
+        
+        return [topLeftString, topCenterString, topRightString, bottomLeftString, bottomCenterString, bottomRightString]
+    }
+    
+    class func parsePageFormat(formatString: String, startPage: String, pageCount: String) -> String {
+        var result = formatString
+        for pageFormat in KMHeaderFooterManager.getPageFormats() {
+            let string = "<<\(pageFormat)>>"
+            if (result.contains(string)) {
+                var tempString = ""
+                if (string == "<<1>>") {
+                    tempString.append("<<\(startPage)>>")
+                } else if (string == "<<1 of n>>") {
+                    tempString.append("<<\(startPage)>>")
+                    tempString.append(" of \(pageCount)")
+                } else if (string == "<<1/n>>") {
+                    tempString.append("<<\(startPage)>>")
+                    tempString.append("/\(pageCount)")
+                } else if (string == "<<Page 1>>") {
+                    tempString.append("Page \(startPage)")
+                } else if (string == "<<Page 1 of n>>") {
+                    tempString.append("Page \(startPage)")
+                    tempString.append("of \(pageCount)")
+                }
+                result = result.replacingOccurrences(of: string, with: tempString)
+            }
+        }
+        
+        return result
+    }
+    
+    class func parseDateFormat(formatString: String) -> String {
+        var result: String = formatString
+        for dateFormat in KMHeaderFooterManager.getdateFormatArray() {
+            if (result.contains(dateFormat)) {
+                var formatString: String = dateFormat.replacingOccurrences(of: "m", with: "M")
+                var replace = "<<\(dateFormat)>>"
+                
+                let date = Date()
+                let dateFormatter = DateFormatter()
+                dateFormatter.dateFormat = formatString
+                var dateString = dateFormatter.string(from: date)
+                result = result.replacingOccurrences(of: replace, with: dateString)
+            }
+        }
+        return result
+    }
+    
+}

+ 203 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHFTemplateController.swift

@@ -0,0 +1,203 @@
+//
+//  KMHFTemplateController.swift
+//  PDF Reader Pro
+//
+//  Created by Niehaoyu on 2024/11/8.
+//
+
+import Cocoa
+import KMComponentLibrary
+
+@objc protocol KMHFTemplateControllerDelegate: AnyObject {
+    
+    @objc optional func templateControllerDidAddData(_ controller: KMHFTemplateController)
+    
+    @objc optional func templateControllerDidEditData(_ controller: KMHFTemplateController, _ data: KMHeaderFooterObject)
+ 
+    //选中内容切换
+    @objc optional func templateControllerDidSelectedChanged(_ controller: KMHFTemplateController)
+    
+}
+
+class KMHFTemplateController: NSViewController {
+    @IBOutlet var contendView: NSView!
+    @IBOutlet var titleLabel: NSTextField!
+    @IBOutlet var addButton: ComponentButton!
+    
+    @IBOutlet var emptyView: ComponentEmpty!
+    
+    @IBOutlet var scrollView: NSScrollView!
+    @IBOutlet var collectionView: NSCollectionView!
+    
+    weak open var delegate: KMHFTemplateControllerDelegate?
+
+    var selectedBackground: KMBackgroundModel?
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        configUI()
+     
+        setupProperty()
+        
+        reloadData()
+    }
+    
+    func setupProperty() {
+        
+        addButton.properties = ComponentButtonProperty(type: .text_gray, size: .xxs, onlyIcon: true, icon: NSImage(named: "watermark_template_add"), keepPressState: false)
+        addButton.setTarget(self, action: #selector(buttonClicked(_:)))
+        
+        emptyView.properties = ComponentEmptyProperty(emptyType: .noWatermark, text: KMLocalizedString("No Template"), subText: KMLocalizedString("Here is the description."))
+    }
+      
+    func configUI() {
+        
+        view.wantsLayer = true
+        view.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBg/layout-middle").cgColor
+         
+        collectionView.backgroundColors = [NSColor.clear]
+        collectionView.wantsLayer = true
+        collectionView.layer?.backgroundColor = NSColor.clear.cgColor
+        collectionView.delegate = self
+        collectionView.dataSource = self
+        collectionView.allowsEmptySelection = true
+        collectionView.allowsMultipleSelection = false
+        
+        collectionView.register(KMBGTemplateItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMBGTemplateItem"))
+     }
+    
+    //刷新所有数据
+    public func reloadData() {
+         
+        if KMBackgroundManager.defaultManager.datas.count == 0 {
+            collectionView.isHidden = true
+            emptyView.isHidden = false
+            
+        } else {
+            emptyView.isHidden = true
+            
+            collectionView.isHidden = false
+            collectionView.reloadData()
+            
+        }
+    }
+    
+    public func updateSelectedState() {
+        if let selData = selectedBackground {
+            if let index = KMBackgroundManager.defaultManager.datas.firstIndex(of: selData) {
+                
+                let indexpath = IndexPath(item: index, section: 0)
+                var set = Set<IndexPath>()
+                set.insert(indexpath)
+                
+                collectionView.selectItems(at: set, scrollPosition: .top)
+            }
+        }
+    }
+     
+    private func collectionViewSelectedChanged() {
+        let indexs = collectionView.selectionIndexPaths
+        
+        if indexs.count > 0 {
+            for index in indexs {
+                let data = KMBackgroundManager.defaultManager.datas[index.item]
+                selectedBackground = data
+            }
+        } else {
+            selectedBackground = nil
+        }
+        
+        delegate?.templateControllerDidSelectedChanged?(self)
+    }
+    
+    //MARK: - action
+    @objc func buttonClicked(_ sender: ComponentButton) {
+        if sender == addButton {
+            
+            selectedBackground = nil
+            reloadData()
+            delegate?.templateControllerDidSelectedChanged?(self)
+            
+            delegate?.templateControllerDidAddData?(self)
+        }
+    }
+}
+
+//MARK: - NSCollectionViewDelegate, NSCollectionViewDataSource
+extension KMHFTemplateController: NSCollectionViewDelegate, NSCollectionViewDataSource, NSCollectionViewDelegateFlowLayout {
+    
+    public func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
+        return KMBackgroundManager.defaultManager.datas.count
+    }
+     
+    public func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
+        if indexPath.item >= KMBackgroundManager.defaultManager.datas.count {
+            return NSCollectionViewItem()
+        }
+        
+        let item: KMBGTemplateItem = collectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMBGTemplateItem"), for: indexPath) as! KMBGTemplateItem
+//        item.delegate = self
+        item.backgroundModel = KMBackgroundManager.defaultManager.datas[indexPath.item]
+        if let selData = selectedBackground {
+            if item.backgroundModel == selData {
+                item.isSelected = true
+            }
+        }
+        return item
+    }
+    
+    public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
+
+        return CGSize(width: 168, height: 237)
+    }
+     
+    func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
+        return 8
+    }
+    
+    func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
+        return 8
+    }
+    
+    func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, insetForSectionAt section: Int) -> NSEdgeInsets {
+        return NSEdgeInsets(top: 8, left: 0, bottom: 8, right: 0)
+    }
+    
+    public func collectionView(_ collectionView: NSCollectionView, didSelectItemsAt indexPaths: Set<IndexPath>) {
+        collectionViewSelectedChanged()
+    }
+    
+    public func collectionView(_ collectionView: NSCollectionView, didDeselectItemsAt indexPaths: Set<IndexPath>) {
+        collectionViewSelectedChanged()
+    }
+    
+}
+
+//MARK: - kmNWatermarkTemplateItemDelegate
+extension KMHFTemplateController: KMBGTemplateItemDelegate {
+//    func kmNBGTemplateItemDidEdit(_ view: KMBGTemplateItem) {
+//        if let data = view.backgroundModel {
+//            delegate?.templateControllerDidEditData?(self, data)
+//        }
+//    }
+//    
+//    func kmNBGTemplateItemDidDelete(_ view: KMBGTemplateItem) {
+//        if let data = view.backgroundModel {
+//            let alert = NSAlert()
+//            alert.alertStyle = .critical
+//            alert.messageText = String(format: KMLocalizedString("Are you sure you want to remove the background?"))
+//            alert.addButton(withTitle: KMLocalizedString("Delete"))
+//            alert.addButton(withTitle: KMLocalizedString("Cancel"))
+//            
+//            alert.beginSheetModal(for: NSApp.mainWindow!) { (response) in
+//                if response == .alertFirstButtonReturn {
+//                    let _ = KMBackgroundManager.defaultManager.deleteTemplate(model: data)
+//                    
+//                    self.reloadData()
+//                }
+//            }
+//        }
+//    }
+}

PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHFTemplateController.xib → PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHFTemplateController.xib


+ 234 - 64
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderPropertyController.swift

@@ -8,14 +8,30 @@
 import Cocoa
 import KMComponentLibrary
 
-class KMHeaderPropertyController: NSViewController {
+@objc protocol KMHeaderPropertyControllerDelegate: AnyObject {
+    
+    //水印数据有更新
+    @objc optional func headerFooterPropertyControllerDidUpdate(_ controller: KMHeaderPropertyController)
+    
+    //切换到模板界面
+    @objc optional func headerFooterPropertyControllerDidChangetoTemplate(_ controller: KMHeaderPropertyController)
+ 
+    //成功保存到模板
+    @objc optional func headerFooterPropertyControllerSaveTemplateSuccess(_ controller: KMHeaderPropertyController, _ data: KMHeaderFooterObject)
+
+    //取消修改模板信息
+//    @objc optional func headerFooterPropertyControllerCancelTemplateEdit(_ controller: KMNWatermarkPropertyController)
 
+}
+
+class KMHeaderPropertyController: NSViewController {
+    
     @IBOutlet var contendView: NSView!
     
     @IBOutlet var titleLabel: NSTextField!
     @IBOutlet var templateButton: ComponentButton!
     
-   //Font
+    //Font
     @IBOutlet var fontBGView: NSView!
     @IBOutlet var fontLabel: NSTextField!
     @IBOutlet var fontNameSelect: ComponentSelect!
@@ -46,17 +62,29 @@ class KMHeaderPropertyController: NSViewController {
     @IBOutlet var layoutInsertButton: ComponentButton!
     @IBOutlet var layoutPosition: ComponentCPosition!
     @IBOutlet var layoutTextarea: ComponentTextarea!
-     
+    
     //Save
     @IBOutlet var saveTemplateBGView: NSView!
     @IBOutlet var saveButton: ComponentButton!
     
+    var groupView: ComponentGroup!
+    
+    private var familyNames = CPDFFont.familyNames
     
+    var totalPDFCount: Int = 1
+    var headerFooterModel: KMHeaderFooterObject = KMHeaderFooterObject()
+    
+    weak open var delegate: KMHeaderPropertyControllerDelegate?
+     
+    var editSubType: KMPDFEditSubModeType = .none
+
     override func viewDidLoad() {
         super.viewDidLoad()
         // Do view setup here.
         
         setupProperty()
+        
+        reloadData()
     }
     
     func setupProperty() {
@@ -65,10 +93,10 @@ class KMHeaderPropertyController: NSViewController {
         
         titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         titleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-bold")
-         
+        
         templateButton.properties = ComponentButtonProperty(type: .text_gray, size: .xxs, onlyIcon: true, icon: NSImage(named: "icon_wm_template"), keepPressState: false)
         templateButton.setTarget(self, action: #selector(componentButtonClicked(_:)))
-          
+        
         //Font
         fontLabel.stringValue = KMLocalizedString("Font")
         fontLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
@@ -79,12 +107,11 @@ class KMHeaderPropertyController: NSViewController {
                                                               text: "")
         
         var menuItemArr: [ComponentMenuitemProperty] = []
-        for string in CPDFFont.familyNames {
+        for string in familyNames {
             let item = ComponentMenuitemProperty(type: .normal, text: string, identifier: string)
             menuItemArr.append(item)
         }
         fontNameSelect.updateMenuItemsArr(menuItemArr)
-        fontNameSelect.selectItemAtIndex(0)
         fontNameSelect.delegate = self
         
         fontSizeSelect.properties = ComponentSelectProperties(size: .s,
@@ -94,31 +121,27 @@ class KMHeaderPropertyController: NSViewController {
                                                               regexString: "0123456789 pt")
         if true {
             var sizeItemArr: [ComponentMenuitemProperty] = []
-            for string in ["6","8","10","12","14",
-                           "16","18","20","22","24",
-                           "26","28","30","32","34",
-                           "36","40","48","64","80",
-                           "96","112"] {
+            for string in KMHeaderFooterManager.getFontSize() {
                 let item = ComponentMenuitemProperty(type: .normal, text: string, identifier: string)
                 sizeItemArr.append(item)
             }
             fontSizeSelect.updateMenuItemsArr(sizeItemArr)
         }
-        fontSizeSelect.selectItemAtIndex(0)
         fontSizeSelect.delegate = self
         
         fontColorView.properties = ComponentCColorProperty(colorType: .colorPanel, state: .normal, isCustom: true, color: NSColor.black)
+        fontColorView.delegate = self
         
         //Margin
         marginLabel.stringValue = KMLocalizedString("Margin (mm)")
         marginLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         marginLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
-         
+        
         marginLeftInput.properties = ComponentInputNumberProperty(alignment: .left,
-                                                                 size: .s,
-                                                                 minSize: 0,
-                                                                 maxSize: 1000,
-                                                                 text: "0")
+                                                                  size: .s,
+                                                                  minSize: 0,
+                                                                  maxSize: 1000,
+                                                                  text: "0")
         marginLeftInput.delegate = self
         
         marginTopInput.properties = ComponentInputNumberProperty(alignment: .left,
@@ -128,17 +151,17 @@ class KMHeaderPropertyController: NSViewController {
                                                                  text: "0")
         marginTopInput.delegate = self
         marginRightInput.properties = ComponentInputNumberProperty(alignment: .left,
-                                                                 size: .s,
-                                                                 minSize: 0,
-                                                                 maxSize: 1000,
-                                                                 text: "0")
+                                                                   size: .s,
+                                                                   minSize: 0,
+                                                                   maxSize: 1000,
+                                                                   text: "0")
         marginRightInput.delegate = self
         
         marginBottomInput.properties = ComponentInputNumberProperty(alignment: .left,
-                                                                 size: .s,
-                                                                 minSize: 0,
-                                                                 maxSize: 1000,
-                                                                 text: "0")
+                                                                    size: .s,
+                                                                    minSize: 0,
+                                                                    maxSize: 1000,
+                                                                    text: "0")
         marginBottomInput.delegate = self
         
         
@@ -146,7 +169,7 @@ class KMHeaderPropertyController: NSViewController {
         displayLabel.stringValue = KMLocalizedString("Display")
         displayLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         displayLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
-         
+        
         dateSelect.properties = ComponentSelectProperties(size: .s,
                                                           state: .normal,
                                                           creatable: false,
@@ -178,28 +201,20 @@ class KMHeaderPropertyController: NSViewController {
         pageSelect.delegate = self
         
         startPageSelect.properties = ComponentSelectProperties(size: .s,
-                                                          state: .normal,
-                                                          creatable: false,
-                                                          text: "1")
-        if true {
-            var sizeItemArr: [ComponentMenuitemProperty] = []
-            for string in ["1", "2", "3", "4", "5"] {
-                let item = ComponentMenuitemProperty(type: .normal, text: string, identifier: string)
-                sizeItemArr.append(item)
-            }
-            startPageSelect.updateMenuItemsArr(sizeItemArr)
-        }
-        startPageSelect.selectItemAtIndex(0)
+                                                               state: .normal,
+                                                               creatable: false,
+                                                               text: "1")
+       
         startPageSelect.delegate = self
         
         //Layout&Content
         layoutLabel.stringValue = KMLocalizedString("Layout & Content")
         layoutLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
         layoutLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
-          
+        
         layoutInsertButton.properties = ComponentButtonProperty(type: .text_gray, size: .xxs, onlyIcon: true, icon: NSImage(named: "watermark_template_add"), keepPressState: false)
         layoutInsertButton.setTarget(self, action: #selector(componentButtonClicked(_:)))
-
+        
         //Save
         saveTemplateBGView.wantsLayer = true
         saveTemplateBGView.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBg/layout-middle").cgColor
@@ -210,47 +225,202 @@ class KMHeaderPropertyController: NSViewController {
     
     func reloadData() {
         
+        //Font
+        if let index = familyNames.firstIndex(of: headerFooterModel.fontName) {
+            fontNameSelect.selectItemAtIndex(index)
+        }
+        fontNameSelect.properties.text = headerFooterModel.fontName
+        fontNameSelect.reloadData()
+        
+        let fontSizeStr = String(format: "%.0f", headerFooterModel.fontsize)
+        if let index = KMHeaderFooterManager.getFontSize().firstIndex(of: fontSizeStr) {
+            fontSizeSelect.selectItemAtIndex(index)
+        }
+        fontSizeSelect.properties.text = String(format: "%.0f", headerFooterModel.fontsize) + " pt"
+        fontSizeSelect.reloadData()
+        
+        fontColorView.properties?.color = headerFooterModel.color
+        fontColorView.reloadData()
+        
+        //Margin
+        marginLeftInput.properties.text = String(format: "%d", headerFooterModel.leftMargin)
+        marginLeftInput.reloadData()
+        
+        marginTopInput.properties.text = String(format: "%d", headerFooterModel.topMargin)
+        marginTopInput.reloadData()
+        
+        marginRightInput.properties.text = String(format: "%d", headerFooterModel.rightMargin)
+        marginRightInput.reloadData()
+        
+        marginBottomInput.properties.text = String(format: "%d", headerFooterModel.bottomMargin)
+        marginBottomInput.reloadData()
+        
+        //Display
+        if let index = KMHeaderFooterManager.getdateFormatArray().firstIndex(of: headerFooterModel.dateFormatString) {
+            dateSelect.selectItemAtIndex(index)
+        } else {
+            dateSelect.properties.text = headerFooterModel.dateFormatString
+        }
+        dateSelect.reloadData()
+        
+        if let index = KMHeaderFooterManager.getPageFormats().firstIndex(of: headerFooterModel.pageFormatString) {
+            pageSelect.selectItemAtIndex(index)
+        } else {
+            pageSelect.properties.text = headerFooterModel.pageFormatString
+        }
+        pageSelect.reloadData()
+         
+        if true {
+            var sizeItemArr: [ComponentMenuitemProperty] = []
+            var indexArr: [String] = []
+            for index in 0...totalPDFCount {
+                indexArr.append(String(format: "%ld", index))
+            }
+            for string in indexArr {
+                let item = ComponentMenuitemProperty(type: .normal, text: string, identifier: string)
+                sizeItemArr.append(item)
+            }
+            startPageSelect.updateMenuItemsArr(sizeItemArr)
+        }
+        
+        if let index = KMHeaderFooterManager.getPageFormats().firstIndex(of: headerFooterModel.startString) {
+            startPageSelect.selectItemAtIndex(index)
+        } else {
+            startPageSelect.properties.text = headerFooterModel.startString
+        }
+        startPageSelect.reloadData()
+        
+        //Layout
+        
         
     }
     
-    
     //MARK: - Action
     
     @objc func componentButtonClicked(_ sender: ComponentButton) {
-        
+        if sender == templateButton {
+            delegate?.headerFooterPropertyControllerDidChangetoTemplate?(self)
+        } else if sender == layoutInsertButton {
+            var menuItemArr: [ComponentMenuitemProperty] = []
+            var items: [(String, String)] = [("Insert Page Number", "InsertPageNumberKey"),
+                                             ("Insert Date", "InsertDateKey")]
+            
+            for (i, value) in items {
+                let properties_Menuitem: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false,
+                                                                                               itemSelected: false,
+                                                                                               isDisabled: false,
+                                                                                               keyEquivalent: nil,
+                                                                                               text: KMLocalizedString(i),
+                                                                                               identifier: value)
+                menuItemArr.append(properties_Menuitem)
+            }
+            
+            if groupView == nil {
+                groupView = ComponentGroup.createFromNib(in: ComponentLibrary.shared.componentBundle())
+            }
+            groupView.groupDelegate = self
+            groupView?.frame = CGRectMake(0, 0, 160, 80)
+            groupView.updateGroupInfo(menuItemArr)
+            if let point: CGPoint = sender.superview?.convert(sender.frame.origin, to: self.view.window?.contentView) {
+                groupView.showWithPoint(CGPoint(x: point.x, y: point.y - CGRectGetHeight(groupView.frame)-4), relativeTo: self.view)
+            }
+         
+        } else if sender == saveButton {
+            let saveWindow: KMWatermarkSaveWindow = KMWatermarkSaveWindow(windowNibName: "KMWatermarkSaveWindow")
+            saveWindow.nameValue = KMHeaderFooterManager.defaultManager.fetchHeaderFooterAvailableName()
+            
+            saveWindow.saveHandler = {[weak self] string in
+                guard let weakSelf = self else { return }
+                DispatchQueue.main.async {
+                    weakSelf.headerFooterModel.name = string ?? ""
+                    if KMHeaderFooterManager.defaultManager.addHeaderFooter(weakSelf.headerFooterModel) {
+                        weakSelf.delegate?.headerFooterPropertyControllerSaveTemplateSuccess?(weakSelf, weakSelf.headerFooterModel)
+                    }
+                }
+            }
+            saveWindow.own_beginSheetModal(for: view.window) { string in
+                
+            }
+        }
     }
     
 }
 
+//MARK: - ComponentCColorDelegate
+extension KMHeaderPropertyController: ComponentCColorDelegate {
+    func componentCColorDidChooseColor(_ view: NSView, _ color: NSColor?) {
+        if view == fontColorView {
+            headerFooterModel.color = color ?? NSColor.clear
+        }
+        reloadData()
+        
+        delegate?.headerFooterPropertyControllerDidUpdate?(self)
+    }
+}
+
 //MARK: - ComponentInputNumberDelegate
 extension KMHeaderPropertyController: ComponentInputNumberDelegate {
     func componentInputNumberDidValueChanged(inputNumber: ComponentInputNumber?) {
-//        if inputNumber == positionXInput {
-//            if let text = inputNumber?.properties.text {
-//                watermarkData.tx = text.stringToCGFloat()
-//            }
-//        } else if inputNumber == positionYInput {
-//            if let text = inputNumber?.properties.text {
-//                watermarkData.ty = text.stringToCGFloat()
-//            }
-//        } else if inputNumber == positionTileHoriInput {
-//            if let text = inputNumber?.properties.text {
-//                watermarkData.horizontalSpacing = text.stringToCGFloat()
-//            }
-//        } else if inputNumber == positionTileVertInput {
-//            if let text = inputNumber?.properties.text {
-//                watermarkData.verticalSpacing = text.stringToCGFloat()
-//            }
-//        }
-//        reloadData()
-//        
-//        isEditModeChanged = true
-//        delegate?.watermarkPropertyControllerDidUpdate?(self)
+        if inputNumber == marginLeftInput {
+            if let text = inputNumber?.properties.text {
+                headerFooterModel.leftMargin = Int(text) ?? 30
+            }
+        } else if inputNumber == marginTopInput {
+            if let text = inputNumber?.properties.text {
+                headerFooterModel.topMargin = Int(text) ?? 30
+            }
+        } else if inputNumber == marginRightInput {
+            if let text = inputNumber?.properties.text {
+                headerFooterModel.rightMargin = Int(text) ?? 30
+            }
+        } else if inputNumber == marginBottomInput {
+            if let text = inputNumber?.properties.text {
+                headerFooterModel.bottomMargin = Int(text) ?? 30
+            }
+        }
+        reloadData()
+        
+        delegate?.headerFooterPropertyControllerDidUpdate?(self)
+        
     }
 }
 
 
 //MARK: - ComponentSelectDelegate
 extension KMHeaderPropertyController: ComponentSelectDelegate {
+    func componentSelectDidSelect(view: ComponentSelect?, menuItemProperty: ComponentMenuitemProperty?) {
+        if view == fontNameSelect {
+            headerFooterModel.fontName = menuItemProperty?.text ?? ""
+        } else if view == fontSizeSelect {
+            if let text = menuItemProperty?.text {
+                let result = text.stringByDeleteCharString(" pt")
+                headerFooterModel.fontsize = result.stringToCGFloat()
+            }
+        } else if view == dateSelect {
+            if let text = menuItemProperty?.text {
+                headerFooterModel.dateFormatString = text
+            }
+        } else if view == pageSelect {
+            if let text = menuItemProperty?.text {
+                headerFooterModel.pageFormatString = text
+            }
+        } else if view == startPageSelect {
+            if let text = menuItemProperty?.text {
+                headerFooterModel.startString = text
+            }
+        }
+        
+        reloadData()
+        
+        delegate?.headerFooterPropertyControllerDidUpdate?(self)
+        
+    }
     
 }
+
+//MARK: - ComponentGroupDelegate
+extension KMHeaderPropertyController: ComponentGroupDelegate {
+    func componentGroupDidSelect(group: ComponentGroup?, menuItemProperty: ComponentMenuitemProperty?) {
+        
+    }
+}

+ 16 - 14
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderPropertyController.xib

@@ -52,7 +52,7 @@
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="oDv-te-osP">
                             <rect key="frame" x="0.0" y="791" width="320" height="40"/>
                             <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XcY-yp-Dg5">
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XcY-yp-Dg5">
                                     <rect key="frame" x="94" y="12" width="132" height="16"/>
                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Add Header &amp; Footer" id="5aw-vJ-O3w">
                                         <font key="font" usesAppearanceFont="YES"/>
@@ -94,7 +94,7 @@
                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="COI-6x-UXb">
                                             <rect key="frame" x="0.0" y="72" width="232" height="40"/>
                                             <subviews>
-                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bpS-cS-091">
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bpS-cS-091">
                                                     <rect key="frame" x="-2" y="12" width="32" height="16"/>
                                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Font" id="rZY-dw-5M0">
                                                         <font key="font" usesAppearanceFont="YES"/>
@@ -151,7 +151,7 @@
                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="WET-Do-OrY">
                                             <rect key="frame" x="0.0" y="72" width="232" height="40"/>
                                             <subviews>
-                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fMm-Yh-O6N">
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fMm-Yh-O6N">
                                                     <rect key="frame" x="-2" y="12" width="82" height="16"/>
                                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Margin (mm)" id="UcQ-3y-2HK">
                                                         <font key="font" usesAppearanceFont="YES"/>
@@ -175,7 +175,7 @@
                                                         <constraint firstAttribute="width" constant="16" id="0TH-aT-PBv"/>
                                                         <constraint firstAttribute="height" constant="16" id="M4f-fo-9c9"/>
                                                     </constraints>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="edit_rotateRight" id="P3D-Vr-onr"/>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="batesMarginLeft" id="P3D-Vr-onr"/>
                                                 </imageView>
                                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="DQZ-fe-sp4" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
                                                     <rect key="frame" x="20" y="40" width="92" height="32"/>
@@ -190,7 +190,7 @@
                                                         <constraint firstAttribute="width" constant="16" id="f3f-v7-uzS"/>
                                                         <constraint firstAttribute="height" constant="16" id="rid-BP-OY8"/>
                                                     </constraints>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="edit_ocapity" id="43e-LQ-W74"/>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="batesMarginTop" id="43e-LQ-W74"/>
                                                 </imageView>
                                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="ezQ-jW-JtC" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
                                                     <rect key="frame" x="140" y="40" width="92" height="32"/>
@@ -205,7 +205,7 @@
                                                         <constraint firstAttribute="width" constant="16" id="9gD-aB-nUH"/>
                                                         <constraint firstAttribute="height" constant="16" id="c8n-YY-ibR"/>
                                                     </constraints>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="edit_rotateRight" id="Cmv-BE-BAx"/>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="batesMarginRight" id="Cmv-BE-BAx"/>
                                                 </imageView>
                                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="Eny-li-mN6" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
                                                     <rect key="frame" x="20" y="0.0" width="92" height="32"/>
@@ -220,7 +220,7 @@
                                                         <constraint firstAttribute="width" constant="16" id="4Bl-qD-CpS"/>
                                                         <constraint firstAttribute="height" constant="16" id="B4Q-q1-Ze0"/>
                                                     </constraints>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="edit_ocapity" id="AAL-93-xHg"/>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="batesMarginBottom" id="AAL-93-xHg"/>
                                                 </imageView>
                                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="v1E-X3-hce" customClass="ComponentInputNumber" customModule="KMComponentLibrary">
                                                     <rect key="frame" x="140" y="0.0" width="92" height="32"/>
@@ -268,7 +268,7 @@
                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="lDc-1g-lQL">
                                             <rect key="frame" x="0.0" y="112" width="232" height="40"/>
                                             <subviews>
-                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Gmb-UW-4Dx">
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Gmb-UW-4Dx">
                                                     <rect key="frame" x="-2" y="12" width="49" height="16"/>
                                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Display" id="mR2-q4-DPD">
                                                         <font key="font" usesAppearanceFont="YES"/>
@@ -283,7 +283,7 @@
                                                 <constraint firstItem="Gmb-UW-4Dx" firstAttribute="centerY" secondItem="lDc-1g-lQL" secondAttribute="centerY" id="JLb-nz-FbX"/>
                                             </constraints>
                                         </customView>
-                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TNS-KG-jRl">
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TNS-KG-jRl">
                                             <rect key="frame" x="-2" y="88" width="37" height="16"/>
                                             <textFieldCell key="cell" lineBreakMode="clipping" title="Date:" id="yng-gX-MHn">
                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -297,7 +297,7 @@
                                                 <constraint firstAttribute="height" constant="32" id="xiM-uk-RKG"/>
                                             </constraints>
                                         </customView>
-                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VCq-Ro-Dfg">
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VCq-Ro-Dfg">
                                             <rect key="frame" x="-2" y="48" width="42" height="16"/>
                                             <textFieldCell key="cell" lineBreakMode="clipping" title="Page: " id="hkj-dn-rz8">
                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -311,7 +311,7 @@
                                                 <constraint firstAttribute="height" constant="32" id="8WU-xb-NwW"/>
                                             </constraints>
                                         </customView>
-                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iYo-cq-cCE">
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iYo-cq-cCE">
                                             <rect key="frame" x="-2" y="8" width="75" height="16"/>
                                             <textFieldCell key="cell" lineBreakMode="clipping" title="Start Page: " id="v5L-Rc-Xgp">
                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -355,7 +355,7 @@
                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="6Ox-DM-ufe">
                                             <rect key="frame" x="0.0" y="120" width="232" height="40"/>
                                             <subviews>
-                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Xg1-2G-aDD">
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Xg1-2G-aDD">
                                                     <rect key="frame" x="-2" y="12" width="110" height="16"/>
                                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Layout &amp; Content" id="Led-Ha-rjq">
                                                         <font key="font" usesAppearanceFont="YES"/>
@@ -469,7 +469,9 @@
         </customView>
     </objects>
     <resources>
-        <image name="edit_ocapity" width="16" height="16"/>
-        <image name="edit_rotateRight" width="16" height="16"/>
+        <image name="batesMarginBottom" width="16" height="16"/>
+        <image name="batesMarginLeft" width="16" height="16"/>
+        <image name="batesMarginRight" width="16" height="16"/>
+        <image name="batesMarginTop" width="16" height="16"/>
     </resources>
 </document>

PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderTemplateItem.swift → PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHeaderTemplateItem.swift


PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderTemplateItem.xib → PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHeaderTemplateItem.xib


+ 184 - 185
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -67,29 +67,17 @@ import KMComponentLibrary
     var backgroundViewController: KMBackgroundController?
     //Header&Footer
     var headerFooterViewController: KMHeaderFooterController?
+    //Bates
+    var batesViewController: KMBatesController?
     
     //左边
     var botaViewController: KMNLeftSideViewController?
     
     //MARK: - 旧代码,有需要用到的拿出来,写好备注
-    @IBOutlet var PDFContendView: NSView!
-    @IBOutlet var centerContentView: NSView!
     
-    @IBOutlet weak var readContentView: NSView!
-    @IBOutlet weak var tipCurrentPageBox: KMBox!
-    @IBOutlet weak var rightView: NSView!
+      @IBOutlet weak var rightView: NSView!
     @IBOutlet weak var leftView: NSView!
-    @IBOutlet weak var mianSplitView: KMSplitView!
-    @IBOutlet weak var newPDFSplitView: KMSplitView!
-    @IBOutlet weak var pdfContentView: NSView!
-    
-    @IBOutlet var childToolbarController: KMToolbarViewController!
-    @IBOutlet var toolbarController: KMToolbarController!
-    @IBOutlet weak var heightOffset: NSLayoutConstraint!
-    
-    //页码显示器
-    @IBOutlet weak var pageNumberDisplayView: KMPageNumberDisplayView!
-    
+     
     var model = KMMainModel()
     
     //自动滚动
@@ -106,15 +94,11 @@ import KMComponentLibrary
     //对比
     var isCompareModel: Bool = false {
         didSet {
-            self.toolbarController.updataItemVisible()
-        }
+         }
     }
     //合并
     var mergeWindowController: KMMergeWindowController?
-    //水印
-    var watermarkWindowController: KMWatermarkWindowController?
-    
-    
+ 
     //密码弹窗
     var passwordWindow: KMPasswordInputWindow?
     //对比
@@ -185,9 +169,7 @@ import KMComponentLibrary
     
     var pageNumber: UInt?
     
-    var secondaryPdfContentView: NSView?
-    var lastSplitPDFHeight: Float = 0.0
-    var pdfEditController: KMPDFEditViewController? {
+     var pdfEditController: KMPDFEditViewController? {
         get {
             return self.getPDFEditController()
         }
@@ -204,8 +186,7 @@ import KMComponentLibrary
         let vc = KMNHomeViewController()
         return vc
     }()
-    private var background_mask: NSView?
-    
+ 
     fileprivate var _secureOptions: [CPDFDocumentWriteOption : Any]?
     var secureOptions: [CPDFDocumentWriteOption : Any]? {
         get {
@@ -500,6 +481,10 @@ import KMComponentLibrary
             pageEditViewController?.thumbnailBaseViewDelegate = self
             pageEditViewController?.selectionIndexPaths = [IndexPath(item: listView.currentPageIndex, section: 0)]
             pageEditViewController?.view.autoresizingMask = [.width,.height]
+            pageEditViewController?.currentUndoManager = listView.undoManager
+            toolbarManager.page_pageInfo_Property.text = String(listView.currentPageIndex + 1)
+            pdfToolbarController?.refreshSecondToolbarItemsState()
+
         }
     }
     
@@ -523,6 +508,15 @@ import KMComponentLibrary
         
         view.window?.makeFirstResponder(listView)
         
+        var readModeMessage: ComponentMessage = ComponentMessage()
+        readModeMessage.properties = ComponentMessageProperty(messageType: .normal_custom, title: KMLocalizedString("Read Mode On"))
+        readModeMessage.frame = CGRectMake((CGRectGetWidth(self.view.frame) - readModeMessage.properties.propertyInfo.viewWidth)/2,
+                                           CGRectGetHeight(self.view.frame) - readModeMessage.properties.propertyInfo.viewHeight - 8,
+                                           readModeMessage.properties.propertyInfo.viewWidth,
+                                           readModeMessage.properties.propertyInfo.viewHeight)
+        readModeMessage.reloadData()
+        readModeMessage.show(inView: self.view, autoHideSeconde: 2)
+        
     }
     
     func exitPDFReadMode() {
@@ -717,11 +711,9 @@ import KMComponentLibrary
             setupSplitPDFController()
             
             if listView.viewSplitMode == .horizontal {
-                pdfSplitView.isVertical = true
-                
-            } else if listView.viewSplitMode == .vertical {
                 pdfSplitView.isVertical = false
-                
+            } else if listView.viewSplitMode == .vertical {
+                pdfSplitView.isVertical = true
             }
         }
     }
@@ -938,6 +930,7 @@ import KMComponentLibrary
         }
         headerFooterViewController?.view.frame = CGRectMake(44, 0, CGRectGetWidth(bottomContendBox.frame)-44, CGRectGetHeight(bottomContendBox.frame))
         headerFooterViewController?.view.autoresizingMask = [.maxXMargin, .width, .height]
+        headerFooterViewController?.totalPDFCount = Int(listView.document.pageCount)
 //        headerFooterViewController?.delegate = self
         bottomContendBox.addSubview(headerFooterViewController!.view)
         headerFooterViewController?.editSubType = editToolbarView?.editSubType ?? .template
@@ -967,16 +960,15 @@ import KMComponentLibrary
         editToolbarView?.removeFromSuperview()
         editToolbarView = nil
         
-        backgroundViewController?.view.removeFromSuperview()
-        backgroundViewController = nil
+        headerFooterViewController?.view.removeFromSuperview()
+        headerFooterViewController = nil
         
         refreshToolbarView()
         toolbarBox.contentView = pdfToolbarController?.view
     }
     
     func removePDFHeaderFooter() {
-        let background = listView.document.background()
-        background?.clear()
+        
     }
     
     func batchAddHeaderFooter() {
@@ -988,7 +980,72 @@ import KMComponentLibrary
     }
     
     //MARK: - Bates
+    func showBatesController() {
+        listView.isHidden = true
+        
+        viewManager.editType = .bates
+        
+        showEditToolbarView()
+        editToolbarView?.editType = viewManager.editType
+        if KMBatesManager.defaultManager.datas.count == 0 {
+            editToolbarView?.editSubType = .add
+        } else {
+            editToolbarView?.editSubType = .template
+        }
+        editToolbarView?.reloadData()
+        
+        if batesViewController == nil {
+            batesViewController = KMBatesController.init()
+        }
+        batesViewController?.view.frame = CGRectMake(44, 0, CGRectGetWidth(bottomContendBox.frame)-44, CGRectGetHeight(bottomContendBox.frame))
+        batesViewController?.view.autoresizingMask = [.maxXMargin, .width, .height]
+//        headerFooterViewController?.delegate = self
+        bottomContendBox.addSubview(batesViewController!.view)
+        batesViewController?.editSubType = editToolbarView?.editSubType ?? .template
+        
+        updateBatesDocument()
+    }
     
+    func updateBatesDocument() {
+        guard let controller = batesViewController else { return }
+        
+        controller.pdfDocument = nil
+        
+        let editDocument = CPDFDocument.init()
+        
+        let page = listView.document.page(at: UInt(listView.currentPageIndex))
+        editDocument?.insertPageObject(page, at: 0)
+        
+        batesViewController?.pdfDocument = editDocument
+        batesViewController?.reloadData()
+        
+    }
+    
+    func exitBatesController() {
+        listView.isHidden = false
+        viewManager.editType = .none
+        
+        editToolbarView?.removeFromSuperview()
+        editToolbarView = nil
+        
+        batesViewController?.view.removeFromSuperview()
+        batesViewController = nil
+        
+        refreshToolbarView()
+        toolbarBox.contentView = pdfToolbarController?.view
+    }
+    
+    func removePDFBates() {
+        
+    }
+    
+    func batchAddBates() {
+        
+    }
+    
+    func batchRemoveBates() {
+        
+    }
     
 }
 
@@ -1075,6 +1132,7 @@ extension KMMainViewController: KMPDFToolbarControllerDelegate {
         
         print("toolbar点击", itemIdentifier)
         if itemIdentifier == KMPDFToolbar_ViewDisplay_Identifier {
+            //Display
             updatePDFDisplaySettingView()
         } else if itemIdentifier == KMPDFToolbar_PageEdit_Identifier {
             if viewManager.isPageEditMode == true {
@@ -1082,6 +1140,20 @@ extension KMMainViewController: KMPDFToolbarControllerDelegate {
             } else {
                 exitPageEditMode()
             }
+        } else if itemIdentifier == KMPDFToolbar_Markup_Identifier {
+            
+        } else if itemIdentifier == KMPDFToolbar_Edit_Identifier {
+            
+        } else if itemIdentifier == KMPDFToolbar_Form_Identifier {
+            
+        } else if itemIdentifier == KMPDFToolbar_Fill_Identifier {
+            
+        } else if itemIdentifier == KMPDFToolbar_Convert_Identifier {
+            
+        } else if itemIdentifier == KMPDFToolbar_Protect_Identifier {
+            
+        } else if itemIdentifier == KMPDFToolbar_Tools_Identifier {
+           
         } else if itemIdentifier == KMPDFToolbar_convert_word_Identifier {
             let winC = KMConvertWordWindowController()
             let model = KMDocumentModel(url: listView.document.documentURL)
@@ -1243,6 +1315,18 @@ extension KMMainViewController: KMPDFToolbarControllerDelegate {
             batchAddHeaderFooter()
         } else if itemIdentifier == KMPDFToolbar_edit_batchRemoveHF_Identifier {
             batchRemoveHeaderFooter()
+        } else if itemIdentifier == KMPDFToolbar_edit_addBates_Identifier {
+            showBatesController()
+        } else if itemIdentifier == KMPDFToolbar_edit_removeBates_Identifier {
+            removePDFBates()
+        } else if itemIdentifier == KMPDFToolbar_edit_batch_AddBates_Identifier {
+            batchAddBates()
+        } else if itemIdentifier == KMPDFToolbar_edit_batchRemoveBates_Identifier {
+            batchRemoveBates()
+        } else if(itemIdentifier == KMPDFToolbar_undo_Identifier) {
+            listView.undoManager?.undo()
+        } else if(itemIdentifier == KMPDFToolbar_redo_Identifier) {
+            listView.undoManager?.redo()
         } else {
             print("click else")
         }
@@ -1259,7 +1343,39 @@ extension KMMainViewController: KMPDFToolbarControllerDelegate {
     }
     
     func kmPDFToolbarControllerDidSelectTextDidEndEditing(_ controller: KMPDFToolbarController, _ view: ComponentSelect) {
-        
+        if view.properties == toolbarManager.page_pageInfo_Property {
+            if viewManager.isPageEditMode == true {
+                let fileAttribute = KMNFileAttribute()
+                fileAttribute.password = listView.document?.password ?? ""
+                fileAttribute.pdfDocument = listView.document
+                fileAttribute.filePath =  listView.document?.documentURL.path ?? ""
+                fileAttribute.bAllPage = false
+                fileAttribute.pagesType = .PagesString
+                fileAttribute.pagesString = view.properties.text ?? ""
+
+                let fetchSelectPages = fileAttribute.fetchSelectPages()
+                if (fetchSelectPages.isEmpty) {
+                    let alert = NSAlert()
+                    alert.alertStyle = .critical
+                    alert.messageText = String(format: "%@ %@", fileAttribute.filePath.lastPathComponent, KMLocalizedString("Invalid page range or the page number is out of range. Please try again."))
+                    alert.runModal()
+                    toolbarManager.page_pageInfo_Property.text = ""
+                    controller.refreshSecondToolbarItemsState()
+                } else {
+                    var tIndexPaths: Set<IndexPath> = []
+                    for i in 0 ..< fetchSelectPages.count {
+                        tIndexPaths.insert(IndexPath(item: (fetchSelectPages[i] - 1), section: 0))
+                    }
+                    pageEditViewController?.selectionIndexPaths = tIndexPaths
+
+                }
+
+            }
+        }
+    }
+    
+    func kmPDFToolbarControllerDidExitPageEditMode(_ controller: KMPDFToolbarController) {
+        exitPageEditMode()
     }
 }
 
@@ -1351,8 +1467,6 @@ extension KMMainViewController: KMInteractionProviderProtocol {
             if wasInteractionMode == .legacyFullScreen {
                 self.enterPresentationMode()
                 
-                self.pdfSplitView.frame = CGRect(x: 0, y: 0, width: NSWidth(centerContentView.bounds), height: NSHeight(centerContentView.bounds)-1)
-                self.centerContentView.addSubview(pdfSplitView)
                 self.listView.frame = (self.view.window?.contentView?.bounds)!
                 self.view.window?.contentView?.addSubview(listView)
                 
@@ -1529,6 +1643,8 @@ extension KMMainViewController: KMEditToolbarViewDelegate {
             exitBackgroundController()
         } else if view.editType == .header_Footer {
             exitHeaderFooterController()
+        } else if view.editType == .bates {
+            exitBatesController()
         }
     }
 }
@@ -2248,17 +2364,14 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
         if self.listView.toolMode == .moveToolMode {
             self.listView.toolMode = .textToolMode
             self.listView.annotationType = .unkown
-            self.toolbarController.toolbarType = .Annatiton
+
         }
         if (self.model.rightMouseEventing) {
             self.model.rightMouseEventing = false
             
-            if (self.toolbarController.ignoreCurrentAnnotationTypeChange && self.listView.annotationType == .ink) {
-                self.listView.toolMode = .textToolMode
-                self.listView.annotationType = .unkown
-            }
+          
+            
         }
-        self.toolbarController.ignoreCurrentAnnotationTypeChange = false
         self.leftSideViewController.refreshUIForAddAnnotation(annos: annotations, page: pdfPage)
     }
     
@@ -2566,7 +2679,6 @@ extension KMMainViewController {
     func awakeFromNibFunction() {
         self.addBackgroundMaskView()
         
-        self.PDFContendView.backgroundColor(NSColor.km_init(hex: "FFFFFF"))
         
         listView.delegate = self
         listView.pdfListViewDelegate = self
@@ -2583,12 +2695,9 @@ extension KMMainViewController {
         
         self.initPDFLeftViewVC()
         self.initRightSideView()
-        self.toolbarController.listView = self.listView
-        self.toolbarController.mainViewController = self
         self.leftSideViewController.mainViewController = self
         
-        self.newPDFSplitView.delegate = self
-    }
+     }
     
     func viewDidAppearFunction() {
         //春季活动
@@ -2680,7 +2789,6 @@ extension KMMainViewController {
     
     func viewDidLoadOld() {
         mwcFlags.settingUpWindow = 1
-        toolbarController.delegate = self
         self.editPDFHanddler.viewC = self
         self.srHanddler.pdfView = self.listView
         
@@ -2694,11 +2802,6 @@ extension KMMainViewController {
             UserDefaults.standard.set(256, forKey: CPDFOfficeRightSidePaneWidthKey)
             UserDefaults.standard.synchronize()
         }
-        let position = mianSplitView.maxPossiblePositionOfDivider(at: 1)
-        mianSplitView.setPosition(position, ofDividerAt: 0)
-        mianSplitView.setPosition(mianSplitView.minPossiblePositionOfDivider(at: 0), ofDividerAt: 0)
-        
-        pdfSplitView.setPosition(mianSplitView.maxPossiblePositionOfDivider(at: 1), ofDividerAt: 0)
         
         if (KMPreferenceManager.shared.openLastUnlockedDocumentWhenAppStart) {
             if (self.listView.document != nil) {
@@ -2719,17 +2822,8 @@ extension KMMainViewController {
             self._goToFirstPageForFristAppear()
         }
         
-        pageNumberDisplayView.delegate = self
-        
-        tipCurrentPageBox.moveCallback = { [unowned self] mouseEntered, mouseBox in
-            if !viewManager.isPDFReadMode {
-                if mouseEntered {
-                    self.pageNumberDisplayView.hover = true
-                } else {
-                    self.pageNumberDisplayView.hover = false
-                }
-            }
-        }
+ 
+     
         
         NotificationCenter.default.addObserver(self, selector: #selector(rename(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerRename"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(closeTab(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerCloseTabs"), object: nil)
@@ -2754,7 +2848,6 @@ extension KMMainViewController {
             self.addAutoSaveEvent()
         }
         
-        self.toolbarController.selectItem(KMDocumentAnnotationToolbarItemIdentifier)
         self.closeRightPane()
         
         self.addKeyEventMonitor()
@@ -2833,10 +2926,7 @@ extension KMMainViewController {
                 return
             }
             if !document.isLocked {
-                KMAdsManager.defaultManager.beginSheetModalForView(self.readContentView, directions: .down, adPosY: 30, animated: false) { pageIndex in
-                    
-                }
-            }
+             }
             NotificationCenter.default.addObserver(self, selector: #selector(purchaseStateUpdateNoti), name: NSNotification.Name(rawValue: "KMIAPProductPurchasedNotification"), object: nil)
             NotificationCenter.default.addObserver(self, selector: #selector(purchaseStateUpdateNoti), name: NSNotification.Name(rawValue: "kDeviceActivateNotification"), object: nil)
             
@@ -2872,15 +2962,11 @@ extension KMMainViewController {
         
         DispatchQueue.main.async {
             self.leftSideViewController.showThumbnail()
-            self.toolbarController.findItem(KMLeftControlToolbarItemIdentifier)?.isSelected = true
         }
     }
     
     func applyLeftSideWidth(_ leftSideWidth: CGFloat, rightSideWidth: CGFloat) -> Void {
-        mianSplitView.setPosition(leftSideWidth, ofDividerAt: 0)
-        mianSplitView.setPosition(mianSplitView.maxPossiblePositionOfDivider(at: 1) - mianSplitView.dividerThickness - rightSideWidth, ofDividerAt: 1)
-        self.model.lastLeftPanWidth = leftSideWidth
-        self.model.lastRightPanWidth = rightSideWidth
+        
     }
     
     
@@ -2901,7 +2987,6 @@ extension KMMainViewController {
     @objc func cancelMeasureType() {
         self.hideMeasureFloatingWindows()
         
-        self.toolbarController?.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = false
     }
     
     func hideMeasureFloatingWindows() {
@@ -2954,8 +3039,6 @@ extension KMMainViewController {
             return
         }
         
-        self.commitEditingIfNeed()
-        
         self.leftSideViewController.thumbnailTableView.isEnabled = false
         self.leftSideViewController.tocOutlineView.isEnabled = false
         self.leftSideViewController.noteOutlineView.isEnabled = false
@@ -2975,8 +3058,6 @@ extension KMMainViewController {
         
         redactController = KMPDFRedactViewController(url: self.listView.document!.documentURL, password: self.listView.document?.password)
         self.addChild(redactController)
-        self.PDFContendView.addSubview(redactController.view)
-        redactController.view.frame = self.PDFContendView.bounds
         redactController.view.autoresizingMask = [.width, .height]
         self.listView.isHidden = true
         
@@ -3028,7 +3109,6 @@ extension KMMainViewController {
             }
         }
         NSColorPanel.shared.showsAlpha = true
-        self.toolbarController.findItem(KMDocumentRedactToolbarItemIdentifier)?.isSelected = false
         controller?.redactPdfView.resignMonitor()
         
         controller?.view.removeFromSuperview()
@@ -3120,25 +3200,15 @@ extension KMMainViewController {
     
     func loadOpenFileFunctionGuide(_ showType: KMGuideInfoType) -> Void {
         if showType == .openFileNormal && KMGuideInfoWindowController.availableShow(.openFileNormal) {
-            let leftPanelItem:KMToolbarItemView = self.toolbarController.findItem("KMLeftControlToolbarItemIdentifier")!
-            
+ 
             self.guideInfoWindowController = KMGuideInfoWindowController.currentWC()
             guard let guideWC = self.guideInfoWindowController else { return }
             
             guideWC.type = .openFileNormal
-            guideWC.openPanelRect = (self.view.window?.contentView?.convert(leftPanelItem.frame, from: leftPanelItem.superview)) ?? .zero
+//            guideWC.openPanelRect = (self.view.window?.contentView?.convert(leftPanelItem.frame, from: leftPanelItem.superview)) ?? .zero
             guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
             guideWC.normalGuideFinishHandle = { [weak self] windowVC in
-                let rightPanelItem = self?.toolbarController.findItem(KMRightControlToolbarItemIdentifier)
-                let digitalPanelItem = self?.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier)
-                
-                if let data = rightPanelItem, data.isHidden {
-                    let view = self?.toolbarController.mainToolBarView?.toolbar?.moreButton
-                    windowVC.rightPanelRect = (self?.view.window?.contentView?.convert(view?.frame ?? .zero, from: view?.superview)) ?? .zero
-                } else {
-                    windowVC.rightPanelRect = (self?.view.window?.contentView?.convert(rightPanelItem?.frame ?? .zero, from: rightPanelItem?.superview)) ?? .zero
-                }
-                guideWC.digitalBoxRect = (self?.view.window?.contentView?.convert(digitalPanelItem?.frame ?? .zero, from: digitalPanelItem?.superview)) ?? .zero
+ 
                 
             }
             guideWC.finishHandle = { [weak self] windowVC, type in
@@ -3162,11 +3232,8 @@ extension KMMainViewController {
             guard let guideWC = self.guideInfoWindowController else { return }
             
             guideWC.type = .digitalSignGuide
-            guard let digitalPanelItem = self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier) else {
-                return
-            }
-            guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview))!
-            guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
+            
+             guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
             guideWC.finishHandle = { [weak self] windowVC, type in
                 self?.checkFirstTrialController()
             }
@@ -3185,17 +3252,11 @@ extension KMMainViewController {
                 
                 guideWC.type = .pdfCompareGuide
                 
-                guard let digitalPanelItem = self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier) else {
-                    return
-                }
+                 
                 guard let win = self.view.window else {
                     return
                 }
-                guideWC.digitalBoxRect = (win.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview)) ?? .zero
-                
-                let compareItem = self.toolbarController.findItem(KMToolbarComparisonItemIdentifier)
-                guideWC.compareItemRect = (win.contentView?.convert(compareItem?.frame ?? .zero, from: compareItem?.superview)) ?? .zero
-                
+ 
                 guideWC.finishHandle = { [weak self] winC, type in
                     if type == .windowNewFinish {
                         DispatchQueue.main.async {
@@ -3224,14 +3285,6 @@ extension KMMainViewController {
                 
                 guideWC.type = .measureGuide
                 
-                guard let digitalPanelItem = self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier) else {
-                    return
-                }
-                guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview)) ?? .zero
-                
-                let compareItem:KMToolbarItemView = self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)!
-                guideWC.compareItemRect = (self.view.window?.contentView?.convert(compareItem.frame, from: compareItem.superview)) ?? .zero
-                
                 guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
                 var rect = self.view.window?.frame ?? .zero
                 rect.size.height -= 20
@@ -3247,14 +3300,10 @@ extension KMMainViewController {
                 guard let guideWC = self.guideInfoWindowController else { return }
                 
                 guideWC.type = .convertGuide
-                guard let digitalPanelItem = self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier) else {
+                 guard let win = self.view.window else {
                     return
                 }
-                guard let win = self.view.window else {
-                    return
-                }
-                guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview)) ?? .zero
-                guideWC.purchaseHandle = { [weak self] windowVC in
+                 guideWC.purchaseHandle = { [weak self] windowVC in
 #if VERSION_DMG
                     if IAPProductsManager.default().isAvailableAllFunction() {
                         if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
@@ -3346,14 +3395,7 @@ extension KMMainViewController {
             return
         }
         
-        if (self.toolbarController != nil && self.toolbarController.mainToolBarView != nil) {
-            let toolBarView: KMToolbarViewController = self.toolbarController.mainToolBarView!
-            for (key, value) in toolBarView.toolbarItems {
-                if (key == KMRightControlToolbarItemIdentifier || key == KMLeftControlToolbarItemIdentifier) {
-                    (value as! KMToolbarItemView).unEnabled = true
-                }
-            }
-        }
+        
         
         self.editPDFHanddler.clearData()
         
@@ -3362,8 +3404,7 @@ extension KMMainViewController {
         controller.selectedPages = tPages
         controller.listView = self.listView
         self.addChild(controller)
-        self.PDFContendView.addSubview(controller.view)
-        controller.view.frame = self.PDFContendView.bounds
+     
         controller.view.autoresizingMask = [.width,.height]
         self.listView.isHidden = true
         
@@ -3393,16 +3434,7 @@ extension KMMainViewController {
     }
     
     open func exitPageEdit() {
-        if (self.toolbarController != nil && self.toolbarController.mainToolBarView != nil) {
-            let toolBarView: KMToolbarViewController = self.toolbarController.mainToolBarView!
-            for (key, value) in toolBarView.toolbarItems {
-                if (key == KMRightControlToolbarItemIdentifier || key == KMLeftControlToolbarItemIdentifier) {
-                    (value as! KMToolbarItemView).unEnabled = false
-                }
-            }
-        }
         
-        self.toolbarController.findItem(KMDocumentPageToolbarItemIdentifier)?.isSelected = false
         let editController = getPDFEditController()
         if (editController == nil) {
             return
@@ -3478,7 +3510,6 @@ extension KMMainViewController {
         self.digitalSignController?.view.removeFromSuperview()
         
         // KMDocumentDigitalSignToolbarItemIdentifier
-        self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier)?.isSelected = false
     }
     
     func showDigitalSignWindow(withFilePathURL fileURL: URL) {
@@ -3496,8 +3527,7 @@ extension KMMainViewController {
         var currentPageIndex = listView.document?.index(for: listView.currentPage()) ?? 0
         var password: String = ""
         
-        self.toolbarController.toolbarType = .None
-        password = listView.document?.password ?? ""
+         password = listView.document?.password ?? ""
         
         digitalSignController = KMPDFDigitalSignViewController()
         
@@ -3518,14 +3548,7 @@ extension KMMainViewController {
                 self?.exitDigitalSign()
             }
         }
-        
-        if let digitalSignView = digitalSignController?.view, let splitViewSuperview = mianSplitView.superview {
-            digitalSignView.frame = splitViewSuperview.bounds
-            digitalSignView.autoresizingMask = [.width, .height]
-            splitViewSuperview.addSubview(digitalSignView)
-            
-            digitalSignController?.setCurrentPageIndex(Int(currentPageIndex))
-        }
+         
     }
     
     // MARK: - Toolbar
@@ -3547,7 +3570,7 @@ extension KMMainViewController {
             }
         }
         if toolbarItem.itemIdentifier != KMDocumentEditToolbarItemIdentifier && toolbarItem.itemIdentifier != KMRightControlToolbarItemIdentifier && toolbarItem.itemIdentifier != KMLeftControlToolbarItemIdentifier {
-            self.commitEditingIfNeed()
+
         }
     }
     
@@ -3578,20 +3601,11 @@ extension KMMainViewController {
     private func addBackgroundMaskView() {
         self.removeBackgroundMaskView()
         
-        if let superview = self.mianSplitView.superview {
-            let view = NSView()
-            superview.addSubview(view)
-            view.frame = superview.bounds
-            view.autoresizingMask = [.width, .height]
-            view.wantsLayer = true
-            view.layer?.backgroundColor = .white
-            self.background_mask = view
-        }
+        
     }
     
     private func removeBackgroundMaskView() {
-        self.background_mask?.removeFromSuperview()
-        self.background_mask = nil
+       
     }
     
     private func _goToFirstPageForFristAppear() {
@@ -3785,8 +3799,7 @@ extension KMMainViewController {
             self.mergeWindowController!.mergeAction = { [unowned self] controller, filePath in
                 self.view.window?.endSheet(mergeWindowController!.window!)
             }
-            self.toolbarController.cancelSelected(KMToolbarToolMergeItemIdentifier)
-            
+ 
             self.view.window?.beginSheet(self.mergeWindowController!.window!)
         }
     }
@@ -3801,8 +3814,7 @@ extension KMMainViewController {
         securityWindowController.batchAction = { [unowned self] controller, files in
             self.view.window?.endSheet((securityWindowController.window)!)
             
-            self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
-            
+ 
             let batchWindowController = KMBatchOperateWindowController.sharedWindowController
             let batchOperateFile = KMBatchOperateFile(filePath: self.document?.documentURL.path ?? "", type: .AddPassword)
             batchWindowController.switchToOperateType(.AddPassword, files: [batchOperateFile])
@@ -4144,11 +4156,7 @@ extension KMMainViewController {
                             } else if self!.listView.editingAreas().count > 0 {
                                 if self?.listView.annotationType == .addImage ||
                                     self?.listView.annotationType == .addText {
-                                    let textItem = self?.toolbarController.findItem(KMToolbarAddTextEditPDFItemIdentifier)
-                                    let imageItem = self?.toolbarController.findItem(KMToolbarAddImageEditPDFItemIdentifier)
-                                    textItem?.isSelected = false
-                                    imageItem?.isSelected = false
-                                }
+                                 }
                                 self?.rightSideViewController.isHidden = true
                                 self?.listView.endEditIsRemoveBlock(with: self!.listView.editingAreas().first as? CPDFEditArea)
                                 self?.listView.updateEditing([])
@@ -4162,11 +4170,7 @@ extension KMMainViewController {
                             } else if(self?.listView.annotationType == .addImage || self!.listView.annotationType == .addText) {
                                 if self?.listView.annotationType == .addImage ||
                                     self?.listView.annotationType == .addText {
-                                    let textItem = self?.toolbarController.findItem(KMToolbarAddTextEditPDFItemIdentifier)
-                                    let imageItem = self?.toolbarController.findItem(KMToolbarAddImageEditPDFItemIdentifier)
-                                    textItem?.isSelected = false
-                                    imageItem?.isSelected = false
-                                }
+                                 }
                                 self?.rightSideViewController.isHidden = true
                                 self?.listView.setShouAddEdit([])
                                 self?.listView.change([.text, .image])
@@ -4177,11 +4181,7 @@ extension KMMainViewController {
                         } else {
                             if self?.listView.annotationType == .addImage ||
                                 self?.listView.annotationType == .addText {
-                                let textItem = self?.toolbarController.findItem(KMToolbarAddTextEditPDFItemIdentifier)
-                                let imageItem = self?.toolbarController.findItem(KMToolbarAddImageEditPDFItemIdentifier)
-                                textItem?.isSelected = false
-                                imageItem?.isSelected = false
-                            }
+                             }
                         }
                     }
                 }
@@ -4442,8 +4442,7 @@ extension KMMainViewController {
         }
         if self.listView.toolMode == .editPDFToolMode {
             if editSelectd {
-                self.toolbarController.cancelSelected(KMToolbarAddTextEditPDFItemIdentifier)
-            }
+             }
         }
     }
     

+ 27 - 8
PDF Office/PDF Master/KMClass/KMPDFViewController/KMNDisplayViewController/KMNDisplayViewController.swift

@@ -102,9 +102,16 @@ class KMNDisplayViewController: NSViewController {
                 scrollViewHeightConst.constant = min(boxHeightConst.constant+5, self.view.frame.size.height)
             }
         }
+        
+        if view.window?.styleMask.contains(.fullScreen) == true {
+            fullScreenSelector.properties.state = .pressed
+        } else {
+            fullScreenSelector.properties.state = .normal
+        }
+        fullScreenSelector.reloadData()
+        
     }
     
-    
     override func viewDidLoad() {
         super.viewDidLoad()
         // Do view setup here.
@@ -296,7 +303,7 @@ class KMNDisplayViewController: NSViewController {
             let softColor = NSColor(deviceRed: 238.0/255.0, green: 232.0/255.0, blue: 216.0/255.0, alpha: 1.0)
             let nightColor = NSColor.black
             let greenColor = NSColor(deviceRed: 153.0/255.0, green: 207.0/255.0, blue: 161.0/255.0, alpha: 1.0)
-            themesArray = [normalColor, softColor, nightColor, greenColor]
+            themesArray = [normalColor, softColor, greenColor, nightColor]
         }
         setUpThemesItems()
         
@@ -336,10 +343,10 @@ class KMNDisplayViewController: NSViewController {
             scrollViewHeightConst.constant = min(boxHeightConst.constant, self.view.frame.size.height)
         } else {
             if let url = viewManager?.splitPDFFileURL {
-                boxHeightConst.constant = 614
+                boxHeightConst.constant = 658 + 12
                 scrollViewHeightConst.constant = min(boxHeightConst.constant, self.view.frame.size.height)
             } else {
-                boxHeightConst.constant = 658
+                boxHeightConst.constant = 614 + 12
                 scrollViewHeightConst.constant = min(boxHeightConst.constant, self.view.frame.size.height)
             }
         }
@@ -484,10 +491,15 @@ class KMNDisplayViewController: NSViewController {
             delegate?.displayViewControllerDidReadModeUpdated?(self)
             
         } else if sender == fullScreenSelector {
-            fullScreenSelector.properties.state = .normal
-            
             view.window?.toggleFullScreen(nil)
             
+            if view.window?.styleMask.contains(.fullScreen) == true {
+                fullScreenSelector.properties.state = .pressed
+            } else {
+                fullScreenSelector.properties.state = .normal
+            }
+            fullScreenSelector.reloadData()
+            
         } else if sender == slideShowSelector {
             slideShowSelector.properties.state = .normal
             
@@ -680,13 +692,20 @@ extension KMNDisplayViewController: ComponentCColorDelegate {
             }
         }
         
-        
         let subviews = themesContendView.subviews
         let index = subviews.firstIndex(of: view) ?? 0
         
         var model: KMPDFViewMode = .normal
         if index <= 3 {
-            model = KMPDFViewMode(rawValue: UInt(index)) ?? .normal
+            if index == 0 {
+                model = .normal
+            } else if index == 1 {
+                model = .soft
+            } else if index == 2 {
+                model = .green
+            } else if index == 3 {
+                model = .night
+            }
         } else {
             model = .other
         }

+ 12 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginBottom.imageset/Contents.json

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

+ 87 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginBottom.imageset/batesMarginBottom.pdf

@@ -0,0 +1,87 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 0.000000 1.375000 cm
+0.250980 0.274510 0.325490 scn
+4.500000 4.750000 m
+4.500000 11.750000 l
+11.500000 11.750000 l
+11.500000 4.750000 l
+4.500000 4.750000 l
+h
+3.000000 12.250000 m
+3.000000 12.802284 3.447715 13.250000 4.000000 13.250000 c
+12.000000 13.250000 l
+12.552284 13.250000 13.000000 12.802284 13.000000 12.250000 c
+13.000000 4.250000 l
+13.000000 3.697716 12.552285 3.250000 12.000000 3.250000 c
+4.000000 3.250000 l
+3.447716 3.250000 3.000000 3.697715 3.000000 4.250000 c
+3.000000 12.250000 l
+h
+0.000000 0.000000 m
+16.000000 0.000000 l
+16.000000 1.500000 l
+0.000000 1.500000 l
+0.000000 0.000000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  679
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000769 00000 n
+0000000791 00000 n
+0000000964 00000 n
+0000001038 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1097
+%%EOF

+ 12 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginLeft.imageset/Contents.json

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

+ 87 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginLeft.imageset/batesMarginLeft.pdf

@@ -0,0 +1,87 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 1.000000 0.000000 cm
+0.250980 0.274510 0.325490 scn
+0.000000 16.000000 m
+0.000000 0.000000 l
+1.500000 0.000000 l
+1.500000 16.000000 l
+0.000000 16.000000 l
+h
+5.250000 4.500000 m
+5.250000 11.500000 l
+12.250000 11.500000 l
+12.250000 4.500000 l
+5.250000 4.500000 l
+h
+3.750000 12.000000 m
+3.750000 12.552284 4.197715 13.000000 4.750000 13.000000 c
+12.750000 13.000000 l
+13.302284 13.000000 13.750000 12.552284 13.750000 12.000000 c
+13.750000 4.000000 l
+13.750000 3.447716 13.302285 3.000000 12.750000 3.000000 c
+4.750000 3.000000 l
+4.197715 3.000000 3.750000 3.447715 3.750000 4.000000 c
+3.750000 12.000000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  680
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000770 00000 n
+0000000792 00000 n
+0000000965 00000 n
+0000001039 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1098
+%%EOF

+ 12 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginRight.imageset/Contents.json

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

+ 87 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginRight.imageset/batesMarginRight.pdf

@@ -0,0 +1,87 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 1.000000 0.000000 cm
+0.250980 0.274510 0.325490 scn
+12.250000 16.000000 m
+12.250000 0.000000 l
+13.750000 0.000000 l
+13.750000 16.000000 l
+12.250000 16.000000 l
+h
+1.500000 4.500000 m
+1.500000 11.500000 l
+8.500000 11.500000 l
+8.500000 4.500000 l
+1.500000 4.500000 l
+h
+0.000000 12.000000 m
+0.000000 12.552284 0.447715 13.000000 1.000000 13.000000 c
+9.000000 13.000000 l
+9.552284 13.000000 10.000000 12.552284 10.000000 12.000000 c
+10.000000 4.000000 l
+10.000000 3.447716 9.552285 3.000000 9.000000 3.000000 c
+1.000000 3.000000 l
+0.447715 3.000000 0.000000 3.447715 0.000000 4.000000 c
+0.000000 12.000000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  679
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000769 00000 n
+0000000791 00000 n
+0000000964 00000 n
+0000001038 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1097
+%%EOF

+ 12 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginTop.imageset/Contents.json

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

+ 87 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/batesMarginTop.imageset/batesMarginTop.pdf

@@ -0,0 +1,87 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 0.000000 1.250305 cm
+0.250980 0.274510 0.325490 scn
+0.000000 11.999634 m
+16.000000 11.999634 l
+16.000000 13.499634 l
+0.000000 13.499634 l
+0.000000 11.999634 l
+h
+4.500000 1.500000 m
+4.500000 8.500000 l
+11.500000 8.500000 l
+11.500000 1.500000 l
+4.500000 1.500000 l
+h
+3.000000 9.000000 m
+3.000000 9.552284 3.447715 10.000000 4.000000 10.000000 c
+12.000000 10.000000 l
+12.552284 10.000000 13.000000 9.552284 13.000000 9.000000 c
+13.000000 1.000000 l
+13.000000 0.447716 12.552285 0.000000 12.000000 0.000000 c
+4.000000 0.000000 l
+3.447716 0.000000 3.000000 0.447715 3.000000 1.000000 c
+3.000000 9.000000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  677
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000767 00000 n
+0000000789 00000 n
+0000000962 00000 n
+0000001036 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1095
+%%EOF

+ 0 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_TTS.imageset/toolbar_TTS.pdf


Some files were not shown because too many files changed in this diff