Browse Source

【2025】【Layout-Toolbar】Toolbar搭建

niehaoyu 4 months ago
parent
commit
035bca340f
34 changed files with 820 additions and 124 deletions
  1. 1 1
      PDF Office/KMComponentLibrary/KMComponentLibrary.xcodeproj/project.pbxproj
  2. 107 66
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.swift
  3. 2 1
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.xib
  4. 10 5
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownToolProperty.swift
  5. 30 0
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/GroupItem/ComponentGroup.swift
  6. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift
  7. 15 2
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  8. 1 3
      PDF Office/PDF Master/KMClass/ComponentLibraryDemo/Demo/DropdownDemoVC.swift
  9. 1 1
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/KMLinkViewController.swift
  10. 25 1
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMPDFConfig.swift
  11. 6 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/Contents.json
  12. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Page.imageset/Contents.json
  13. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Page.imageset/toolbar_Page.pdf
  14. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_content.imageset/Contents.json
  15. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_content.imageset/toolbar_Tools_content.pdf
  16. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_magnify.imageset/Contents.json
  17. 59 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_magnify.imageset/toolbar_Tools_magnify.pdf
  18. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_scroll.imageset/Contents.json
  19. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_scroll.imageset/toolbar_Tools_scroll.pdf
  20. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_select.imageset/Contents.json
  21. 82 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_select.imageset/toolbar_Tools_select.pdf
  22. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_zoom.imageset/Contents.json
  23. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_zoom.imageset/toolbar_Tools_zoom.pdf
  24. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_View.imageset/Contents.json
  25. 99 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_View.imageset/toolbar_View.pdf
  26. 0 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFSecToolbarController.swift
  27. 0 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFSecToolbarController.xib
  28. 84 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFToolbarController.swift
  29. 131 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFToolbarController.xib
  30. 69 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFToolbarManager.swift
  31. 0 17
      PDF Office/PDF Master/KMClass/PDFView/Toolbar/KMPDFToolbarController.swift
  32. 0 22
      PDF Office/PDF Master/KMClass/PDFView/Toolbar/KMPDFToolbarController.xib
  33. 2 1
      PDF Office/PDF Master/KMClass/Tools/NSWindowController+Extension/NSWindowController+Extension.swift
  34. 11 3
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

+ 1 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary.xcodeproj/project.pbxproj

@@ -516,9 +516,9 @@
 		BB5A9BB42CB64D4700F64C1F /* ComponentDropdownTool */ = {
 			isa = PBXGroup;
 			children = (
-				BB5A9BB52CB64D4700F64C1F /* ComponentDropdownTool.xib */,
 				BB5A9BB62CB64D4700F64C1F /* ComponentDropdownToolProperty.swift */,
 				BB5A9BB72CB64D4700F64C1F /* ComponentDropdownTool.swift */,
+				BB5A9BB52CB64D4700F64C1F /* ComponentDropdownTool.xib */,
 			);
 			path = ComponentDropdownTool;
 			sourceTree = "<group>";

+ 107 - 66
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.swift

@@ -8,6 +8,12 @@
 import Cocoa
 import AppKit
 
+@objc public protocol ComponentDropdownToolDelegate: AnyObject {
+    
+    @objc optional func componentDropdownToolDidClicked(_ view: ComponentDropdownTool, menuItem: ComponentMenuitemProperty?)
+ 
+}
+
 public class ComponentDropdownTool: ComponentBaseXibView {
 
     @IBOutlet var contendBox: NSBox!
@@ -15,11 +21,12 @@ public class ComponentDropdownTool: ComponentBaseXibView {
     @IBOutlet var dropImage: NSImageView!
     @IBOutlet var titleLabel: NSTextField!
      
-    private var _properties : ComponentDropdownToolProperties = ComponentDropdownToolProperties()
-      
-    private var action: Selector?   // 点击事件
-    private weak var target: AnyObject? // 对象目标
-    
+    private var _properties : ComponentDropdownToolProperty = ComponentDropdownToolProperty()
+       
+    private var groupView: ComponentGroup!
+
+    weak open var delegate: ComponentDropdownToolDelegate?
+
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
  
@@ -47,7 +54,7 @@ public class ComponentDropdownTool: ComponentBaseXibView {
     }
     
     //MARK: - Setter and Getter
-    public var properties : ComponentDropdownToolProperties {
+    public var properties : ComponentDropdownToolProperty {
         get {
            return _properties
         }
@@ -56,98 +63,99 @@ public class ComponentDropdownTool: ComponentBaseXibView {
             
             ComponentLibrary.shared.configDropdownToolComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
      
     
     //MARK: - SetupUI
     func setupUI() {
-
-        if let image = self.properties.leftIcon {
-            self.iconImage.image = image
-            self.iconImage.isHidden = false
+        
+        if let image = properties.leftIcon {
+            iconImage.image = image
+            iconImage.isHidden = false
         } else {
-            self.iconImage.isHidden = true
+            iconImage.isHidden = true
         }
         
-        if self.properties.showDropdown == true {
-            self.dropImage.isHidden = false
+        if properties.showDropdown == true {
+            dropImage.isHidden = false
         } else {
-            self.dropImage.isHidden = true
+            dropImage.isHidden = true
         }
         
-        self.titleLabel.stringValue = self.properties.text
-        
-        self.titleLabel.sizeToFit()
-        var labelRect = self.titleLabel.frame
-        if self.iconImage.isHidden {
-            labelRect.origin.x = 4
+        if let text = properties.text {
+            titleLabel.stringValue = text
+            titleLabel.isHidden = false
+            
+            titleLabel.sizeToFit()
+            var labelRect = titleLabel.frame
+            if iconImage.isHidden {
+                labelRect.origin.x = 4
+            } else {
+                labelRect.origin.x = 28
+            }
+            labelRect.origin.y = CGRectGetHeight(frame)/2 - CGRectGetHeight(labelRect)/2
+             titleLabel.frame = labelRect
+            
         } else {
-            labelRect.origin.x = 28
+            titleLabel.isHidden = true
         }
-        labelRect.origin.y = CGRectGetHeight(self.frame)/2 - CGRectGetHeight(labelRect)/2
-        self.titleLabel.frame = labelRect
         
     }
     
     func refreshUI() {
         
-        self.contendBox.cornerRadius = self.properties.propertyInfo.cornerRadius
-        self.contendBox.borderWidth = self.properties.propertyInfo.borderWidth
-        self.contendBox.borderColor = self.properties.propertyInfo.borderColor_nor
+        contendBox.cornerRadius = properties.propertyInfo.cornerRadius
+        contendBox.borderWidth = properties.propertyInfo.borderWidth
+        contendBox.borderColor = properties.propertyInfo.borderColor_nor
         
         var fillColor: NSColor?
         var textColor: NSColor?
         
-        if self.properties.state == .normal {
-            fillColor = self.properties.propertyInfo.color_nor
-            textColor = self.properties.propertyInfo.textColor
-        } else if self.properties.state == .hover {
-            fillColor = self.properties.propertyInfo.color_hov
-            textColor = self.properties.propertyInfo.textColor_hov
-        } else if self.properties.state == .pressed {
-            fillColor = self.properties.propertyInfo.color_active
-            textColor = self.properties.propertyInfo.textColor_Active
+        if properties.state == .normal {
+            fillColor = properties.propertyInfo.color_nor
+            textColor = properties.propertyInfo.textColor
+        } else if properties.state == .hover {
+            fillColor = properties.propertyInfo.color_hov
+            textColor = properties.propertyInfo.textColor_hov
+        } else if properties.state == .pressed {
+            fillColor = properties.propertyInfo.color_active
+            textColor = properties.propertyInfo.textColor_Active
         }
-        if self.properties.isDisabled == true {
-            fillColor = self.properties.propertyInfo.color_dis
-            textColor = self.properties.propertyInfo.textColor_dis
+        if properties.isDisabled == true {
+            fillColor = properties.propertyInfo.color_dis
+            textColor = properties.propertyInfo.textColor_dis
         }
         
         if let color = fillColor {
-            self.contendBox.fillColor = color
+            contendBox.fillColor = color
         }
         if let color = textColor {
-            self.titleLabel.textColor = color
+            titleLabel.textColor = color
         }
-        self.titleLabel.font = properties.propertyInfo.textFont
-        
-        
-        
+        titleLabel.font = properties.propertyInfo.textFont
+         
     }
     
     //MARK: - Public Method
     public func reloadData() {
-        self.refreshUI()
+        setupUI()
+        
+        refreshUI()
         
     }
-    
-    public func setTarget(_ target: AnyObject?, action: Selector?) {
-        self.target = target!
-        self.action = action!
-    }
-    
+     
     //MARK: - MouseEvent
     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) {
@@ -158,34 +166,67 @@ public class ComponentDropdownTool: 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) {
         super.mouseDown(with: event)
         
-        if self.properties.state != .pressed {
-            self.properties.state = .pressed
+        if properties.state != .pressed {
+            properties.state = .pressed
         } else {
-            self.properties.state = .hover
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
         
     }
     
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
-        if self.properties.isDisabled == false {
-            if let target = target, let action = action {
-                _ = target.perform(action, with: self)
+        guard let items = properties.menuItemArr else {
+            return
+        }
+        
+        if groupView == nil {
+            groupView = ComponentGroup.createFromNib(in: ComponentLibrary.shared.componentBundle())
+        }
+        var viewHeight: CGFloat = 8
+        for item in items {
+            if item.type == .normal {
+                viewHeight += 36
+            } else if item.type == .divider {
+                viewHeight += 8
             }
         }
+        
+        var point = convert(contendBox.frame.origin, to: window?.contentView)
+        point.y -= viewHeight
+        point.y -= 4
+        
+        groupView.groupDelegate = self
+        groupView?.frame = CGRectMake(0, 0, 232, viewHeight)
+        groupView.updateGroupInfo(items)
+        groupView.showWithPoint(point, relativeTo: contendBox)
+        
     }
     
     
 }
+
+//MARK: - ComponentGroupDelegate
+extension ComponentDropdownTool: ComponentGroupDelegate {
+    public func componentGroupDidDismiss(group: ComponentGroup?) {
+        properties.state = .normal
+        
+        refreshUI()
+    }
+    
+    public func componentGroupDidSelect(group: ComponentGroup?, menuItemProperty: ComponentMenuitemProperty?) {
+        delegate?.componentDropdownToolDidClicked?(self, menuItem: menuItemProperty)
+    }
+}

+ 2 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.xib

@@ -40,7 +40,7 @@
                                     <constraint firstAttribute="height" constant="16" id="EIa-U3-aEN"/>
                                     <constraint firstAttribute="width" constant="16" id="gYx-uH-r0e"/>
                                 </constraints>
-                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="test" id="Zeh-ld-kXN"/>
+                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="suffix" id="Zeh-ld-kXN"/>
                             </imageView>
                             <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lEZ-As-k9B">
                                 <rect key="frame" x="31" y="5" width="37" height="16"/>
@@ -71,6 +71,7 @@
         </customView>
     </objects>
     <resources>
+        <image name="suffix" width="16" height="16"/>
         <image name="test" width="200" height="200"/>
     </resources>
 </document>

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

@@ -10,18 +10,20 @@ import AppKit
 
 //MARK: - Menu
 @objcMembers
-public class ComponentDropdownToolProperties: NSObject {
+public class ComponentDropdownToolProperty: NSObject {
     
     public var state: ComponentState = .normal //状态
-    public var text: String = "" //文字信息
+    public var text: String? = nil //文字信息
     public var showDropdown: Bool = false //显示下拉icon
     public var leftIcon: NSImage? //左侧icon
     public var isDisabled: Bool = false //禁用状态
     
     public var propertyInfo = DropDownPropertyInfo()
     
+    public var menuItemArr: [ComponentMenuitemProperty]? = nil
+    
     public init(state: ComponentState = .normal,
-                text: String = "",
+                text: String? = nil,
                 disabled: Bool = false,
                 leftIcon: NSImage? = nil,
                 showDropdown: Bool = false) {
@@ -43,7 +45,7 @@ extension ComponentLibrary {
     
     // MARK: - Dropdown
     
-    func configDropdownToolComponent(properties: ComponentDropdownToolProperties) -> Void {
+    func configDropdownToolComponent(properties: ComponentDropdownToolProperty) -> Void {
         
         properties.propertyInfo.borderWidth = 0
         if let value = ComponentLibrary.shared.getComponentValueFromKey("comp-button/size2XS-radius") {
@@ -102,7 +104,10 @@ extension ComponentLibrary {
         // 高度
         properties.propertyInfo.viewHeight = 28
         
-        let textSize = self.sizeOfString(properties.text, properties.propertyInfo.textFont ?? NSFont.systemFont(ofSize: 14), 300)
+        var textSize = CGSizeZero
+        if let text = properties.text {
+            textSize = sizeOfString(text, properties.propertyInfo.textFont, 300)
+        }
         var viewWidth = textSize.width + 4 + 8
         if properties.leftIcon != nil {
             viewWidth += 28

+ 30 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/GroupItem/ComponentGroup.swift

@@ -203,12 +203,42 @@ public class ComponentGroup: NSView, NibLoadable {
         
     }
     
+    public func showWithPoint(_ point: CGPoint, relativeTo positioningView: NSView?) {
+         
+        let screenRect = NSScreen.main!.frame
+        let contentWindow: NSWindow = NSWindow(contentRect: screenRect,
+                                               styleMask: [.borderless],
+                                               backing: .buffered, defer: false)
+        contentWindow.level = .statusBar
+        contentWindow.backgroundColor = NSColor.clear
+        contentWindow.makeKeyAndOrderFront(nil)
+        
+        if let subView = positioningView {
+            var rect = self.frame
+            rect.origin.x = point.x
+            rect.origin.y = point.y
+            rect.origin.x += subView.window?.frame.origin.x ?? 0
+            rect.origin.y += subView.window?.frame.origin.y ?? 0
+            
+            self.frame = rect
+            
+            contentWindow.contentView?.addSubview(self)
+            
+            self.clearMonitor()
+            
+            self.addMonitor()
+         }
+        
+    }
+    
     public func removeGroupView() {
         self.superBGView.removeFromSuperview()
         
         self.removeFromSuperview()
         
         self.clearMonitor()
+        
+        self.window?.close()
     }
     
     //MARK: - subGroupView

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

@@ -1154,7 +1154,7 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
     }
     
     func pdfViewScaleDidChanged(_ pdfView: CPDFView!) {
-        self.toolbarController.mainToolBarView?.zoomTextField.stringValue = "\(Int(self.listView.scaleFactor * 100))%"
+//        self.toolbarController.mainToolBarView?.zoomTextField.stringValue = "\(Int(self.listView.scaleFactor * 100))%"
         
         self.toolbarController.mainToolBarView?.zoomDidChange(pdfView: pdfView)
     }

+ 15 - 2
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -91,13 +91,14 @@ import Cocoa
     //引导
     var guideInfoWindowController: KMGuideInfoWindowController?
     
-    var pdflinkController: KMLinkViewController!
-    
     var presentationTopViewController: KMPresentationTopViewController?
 
     //春季活动
     var recommondPopWindowVC: KMRecommondPopWindow?
     
+    //工具栏
+    var pdfToolbarController: KMPDFToolbarController?
+    
     private var _needSave = false
     var needSave: Bool {
         set {
@@ -377,6 +378,9 @@ import Cocoa
         
         //TODO: 先让项目运行,看后面怎么调整这段逻辑,目前最外层是 KMBrowserWindowController
         toolbarBox.contentView = toolbarController.view
+        
+//        self.initToolbar()
+        
         if (UserDefaults.standard.object(forKey: CPDFOfficeLeftSidePaneWidthKey) != nil) {
             UserDefaults.standard.set(256, forKey: CPDFOfficeLeftSidePaneWidthKey)
             UserDefaults.standard.synchronize()
@@ -505,6 +509,15 @@ import Cocoa
         
     }
     
+    //MARK: - 工具栏
+    func initToolbar() {
+        if pdfToolbarController == nil {
+            pdfToolbarController = KMPDFToolbarController.init()
+        }
+        toolbarBox.contentView = pdfToolbarController?.view
+        
+    }
+    
     //MARK: - PDFListView
     
     func initPDFLeftViewVC() {

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

@@ -49,7 +49,7 @@ class DropdownDemoVC: NSViewController, ComponentGroupDelegate, ComponentDropdow
 
     let properties_Menuitem: ComponentMenuitemProperty = ComponentMenuitemProperty(type: .normal, multipleSelect: false, itemSelected: false, isDisabled: false, keyEquivalent: nil, text: "menu item")
 
-    let dropdownToolProperty: ComponentDropdownToolProperties = ComponentDropdownToolProperties(state: .normal, text: "Dropdown Tool", disabled: false, leftIcon: nil, showDropdown: false)
+    let dropdownToolProperty: ComponentDropdownToolProperty = ComponentDropdownToolProperty(state: .normal, text: "Dropdown Tool", disabled: false, leftIcon: nil, showDropdown: false)
     
     var groupView: ComponentGroup!
     
@@ -59,8 +59,6 @@ class DropdownDemoVC: NSViewController, ComponentGroupDelegate, ComponentDropdow
         
         dropdownView.componentDelegate = self
         
-        dropdownTool.setTarget(self, action: #selector(buttonAction_test(_:)))
-        
         self.reloadData()
         
         self.menuitemReload()

+ 1 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/KMLinkViewController/KMLinkViewController.swift

@@ -125,7 +125,7 @@ import KMComponentLibrary
     }
     
     //MARK: - func
-    func reloadData() {
+    public func reloadData() {
         
         if annotations.count > 1 {
             

+ 25 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/KMPDFConfig.swift

@@ -7,7 +7,8 @@
 
 import Cocoa
 
-@objc public enum KMAnnotationsAlignmentType: Int, CaseIterable{
+//注释对齐方式
+@objc public enum KMAnnotationsAlignmentType: Int, CaseIterable {
     case None = 0
     case Left
     case XCenter
@@ -18,3 +19,26 @@ import Cocoa
     case Horizontal
     case Vertical
 }
+
+//工具类型
+@objc public enum KMPDFViewToolsType: Int, CaseIterable {
+    case Select = 0
+    case Scroll
+    case Content_Selection
+    case Magnify
+    case AreaZoom
+}
+
+//PDF模式
+@objc public enum KMPDFToolsMode: Int, CaseIterable {
+    case PageEdit = 0
+    case View_Tools
+    case Markup
+    case Edit
+    case Form
+    case Fill
+    case Convert
+    case Protect
+    case Tools
+    
+}

+ 6 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/Contents.json

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

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

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

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Page.imageset/toolbar_Page.pdf


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

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

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_content.imageset/toolbar_Tools_content.pdf


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

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

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

@@ -0,0 +1,59 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Filter /FlateDecode
+     /Length 3 0 R
+  >>
+stream
+xu’AN$1E÷9EÖ#M°ÇŽ·3#Í8B©	!q~~ª»’’h¼i÷KüýíÔÝ¿§Ï×þôðÿOüûîÖ¿þÞ'Ú"ÒžüžÙá¬áGIa¢ê±Ÿ®i6©€äÂÜ�pÕ¦%~ô·Àœª�ˆ-µæ¸Ï¨)—æV£'©äªQ]®éÖ
m'éA‹S)‹åÝÜTšd6ìa²ÑYÈÉ¡p•â’ôrov\¨‡ilÁ!ó°?²‹ÜÈ@Àm_SgŠ%±2™c|H’å6ÌK+Ô†U˜©u�ë\ÓË$=”D"�[;ß"ÖÄE„¶WØ’ÓÆdœ“J3¸¹JqݧšêÃEŒ?)qué-vè» ¥LÕZÞ̤À±ªhâäVT
O"6zŒRIž…	S1W,ë4ôÄ X.S²Û€ß7|Ââ뜆wßç}7yÂ'€¸Él±Y{‹éþ §€c�’�ùÚÍwvð‚cT¢ö[ÃÌáKxþÞÂ}ø¸hË
+endstream
+endobj
+
+3 0 obj
+  384
+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
+0000000502 00000 n
+0000000524 00000 n
+0000000697 00000 n
+0000000771 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+830
+%%EOF

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

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

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_scroll.imageset/toolbar_Tools_scroll.pdf


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

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

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

@@ -0,0 +1,82 @@
+%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 3.600098 0.704102 cm
+0.062745 0.094118 0.156863 scn
+5.778640 5.572783 m
+7.735923 1.502983 l
+7.829127 1.274343 7.735922 0.999973 7.502912 0.908517 c
+5.825243 0.131140 l
+5.592233 0.039683 5.312621 0.131140 5.219417 0.359780 c
+3.215534 4.521037 l
+0.792233 2.143176 l
+0.699029 2.051720 0.605825 2.005992 0.466019 2.005992 c
+0.186407 2.005992 0.000000 2.188904 0.000000 2.463273 c
+0.000000 14.032482 l
+0.000000 14.123939 0.046602 14.261123 0.139805 14.352579 c
+0.326213 14.535491 0.605825 14.535491 0.792233 14.398307 c
+9.460195 6.670258 l
+9.553399 6.578802 9.600000 6.487346 9.600000 6.350162 c
+9.600000 6.075793 9.413592 5.892880 9.180583 5.847152 c
+5.778640 5.572783 l
+h
+f
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  742
+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
+0000000832 00000 n
+0000000854 00000 n
+0000001027 00000 n
+0000001101 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1160
+%%EOF

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

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

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/Toolbar/toolbar_Tools_zoom.imageset/toolbar_Tools_zoom.pdf


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

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

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

@@ -0,0 +1,99 @@
+%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 2.000000 cm
+0.062745 0.094118 0.156863 scn
+2.000000 2.000000 m
+2.000000 14.000000 l
+8.999959 14.000000 l
+8.999959 2.000000 l
+2.000000 2.000000 l
+h
+10.999959 2.000000 m
+18.000000 2.000000 l
+18.000000 14.000000 l
+10.999959 14.000000 l
+10.999959 2.000000 l
+h
+0.000000 14.833333 m
+0.000000 15.477665 0.522334 16.000000 1.166667 16.000000 c
+18.833334 16.000000 l
+19.477667 16.000000 20.000000 15.477666 20.000000 14.833333 c
+20.000000 1.166667 l
+20.000000 0.522335 19.477665 0.000000 18.833334 0.000000 c
+1.166666 0.000000 l
+0.522333 0.000000 0.000000 0.522334 0.000000 1.166667 c
+0.000000 14.833333 l
+h
+3.749959 11.500000 m
+7.499959 11.500000 l
+7.499959 9.500000 l
+3.749959 9.500000 l
+3.749959 11.500000 l
+h
+7.499959 7.750000 m
+3.749959 7.750000 l
+3.749959 5.750000 l
+7.499959 5.750000 l
+7.499959 7.750000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  889
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 20.000000 20.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
+0000000979 00000 n
+0000001001 00000 n
+0000001174 00000 n
+0000001248 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1307
+%%EOF

PDF Office/PDF Master/KMClass/PDFView/Toolbar/KMPDFSecToolbarController.swift → PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFSecToolbarController.swift


PDF Office/PDF Master/KMClass/PDFView/Toolbar/KMPDFSecToolbarController.xib → PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFSecToolbarController.xib


+ 84 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFToolbarController.swift

@@ -0,0 +1,84 @@
+//
+//  KMPDFToolbarController.swift
+//  PDF Reader Pro
+//
+//  Created by Niehaoyu on 2024/10/8.
+//
+
+import Cocoa
+import KMComponentLibrary
+
+@objc public protocol KMPDFToolbarControllerDelegate: AnyObject {
+    
+//    @objc optional func kmPDFToolbarControllerDidClicked(_ controller: KMPDFToolbarController, )
+ 
+}
+
+class KMPDFToolbarController: NSViewController {
+
+    @IBOutlet var viewButton: ComponentButton!
+    @IBOutlet var pageButton: ComponentButton!
+    @IBOutlet var toolsView: ComponentDropdownTool!
+    @IBOutlet var dividerView: ComponentDivider!
+    @IBOutlet var selectZoom: ComponentSelectZoom!
+    @IBOutlet var tabsView: ComponentTabs!
+    
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        
+        self.setUpProperty()
+    }
+    
+    func setUpProperty() {
+        
+        viewButton.properties = KMPDFToolbarManager.manager.viewProperty
+        
+        pageButton.properties = KMPDFToolbarManager.manager.pageProperty
+        
+        dividerView.properties = ComponentDividerProperty(type: .vertical, dash: false)
+        
+        toolsView.properties = KMPDFToolbarManager.manager.toolsProperty
+        toolsView.delegate = self
+        
+    }
+    
+    func reloadData() {
+        
+        reloadToolsData()
+    }
+    
+    // 刷新tools工具
+    func reloadToolsData() {
+        KMPDFToolbarManager.manager.reloadToolsData()
+        
+        toolsView.reloadData()
+    }
+    
+}
+
+//MARK: - ComponentDropdownToolDelegate
+extension KMPDFToolbarController: ComponentDropdownToolDelegate {
+    func componentDropdownToolDidClicked(_ view: ComponentDropdownTool, menuItem: ComponentMenuitemProperty?) {
+        for item in KMPDFToolbarManager.manager.toolsProperty.menuItemArr ?? [] {
+            item.itemSelected = false
+            item.state = .normal
+        }
+        
+        menuItem?.itemSelected = true
+        if menuItem == KMPDFToolbarManager.manager.tools_selectProperty {
+            KMPDFToolbarManager.manager.toolsType = .Select
+        } else if menuItem == KMPDFToolbarManager.manager.tools_scrollProperty {
+            KMPDFToolbarManager.manager.toolsType = .Scroll
+        } else if menuItem == KMPDFToolbarManager.manager.tools_contentProperty {
+            KMPDFToolbarManager.manager.toolsType = .Content_Selection
+        } else if menuItem == KMPDFToolbarManager.manager.tools_magnifyProperty {
+            KMPDFToolbarManager.manager.toolsType = .Magnify
+        } else if menuItem == KMPDFToolbarManager.manager.tools_areaProperty {
+            KMPDFToolbarManager.manager.toolsType = .AreaZoom
+        }
+        reloadToolsData()
+    }
+}

+ 131 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFToolbarController.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="KMPDFToolbarController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="dividerView" destination="4K3-lv-es0" id="j6G-RS-Y7x"/>
+                <outlet property="pageButton" destination="kZ4-rC-iP5" id="cX3-tT-bq9"/>
+                <outlet property="selectZoom" destination="sWP-oz-Pbl" id="RQl-q0-ySD"/>
+                <outlet property="tabsView" destination="DP5-Ar-1dm" id="abj-MZ-mze"/>
+                <outlet property="toolsView" destination="Jlg-Qt-Zb3" id="F11-kM-j9E"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+                <outlet property="viewButton" destination="mWq-6Q-Jeb" id="AG8-bL-4ea"/>
+            </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="726" height="80"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+            <subviews>
+                <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="uo1-lg-iPw">
+                    <rect key="frame" x="0.0" y="0.0" width="726" height="80"/>
+                    <view key="contentView" id="NTQ-x4-FA0">
+                        <rect key="frame" x="1" y="1" width="724" height="78"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="ZQN-TX-rwt">
+                                <rect key="frame" x="0.0" y="38" width="724" height="40"/>
+                                <subviews>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="mWq-6Q-Jeb" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="0.0" y="6" width="28" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="c2o-rc-JBl"/>
+                                            <constraint firstAttribute="width" constant="28" id="fqq-1y-X82"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="kZ4-rC-iP5" customClass="ComponentButton" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="36" y="6" width="28" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="28" id="oKu-vQ-NUd"/>
+                                            <constraint firstAttribute="height" constant="28" id="u71-Rg-DQa"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="Jlg-Qt-Zb3" customClass="ComponentDropdownTool" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="72" y="6" width="46" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="OVa-Bu-Hys"/>
+                                            <constraint firstAttribute="width" constant="46" id="bmE-WQ-Qde"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="4K3-lv-es0" customClass="ComponentDivider" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="125" y="12" width="1" height="16"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="16" id="eMB-wA-GVY"/>
+                                            <constraint firstAttribute="width" constant="1" id="o04-4y-Vb4"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="sWP-oz-Pbl" customClass="ComponentSelectZoom" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="134" y="6" width="124" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="j89-SL-qUS"/>
+                                            <constraint firstAttribute="width" constant="124" id="pXh-Xb-fnf"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="DP5-Ar-1dm" customClass="ComponentTabs" customModule="KMComponentLibrary">
+                                        <rect key="frame" x="300" y="6" width="124" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="Xin-8s-s71"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="u0U-bP-RVi">
+                                        <rect key="frame" x="516" y="6" width="200" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="SA6-3g-YQW"/>
+                                            <constraint firstAttribute="width" constant="200" id="dh8-di-9PV"/>
+                                        </constraints>
+                                    </customView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="kZ4-rC-iP5" firstAttribute="centerY" secondItem="ZQN-TX-rwt" secondAttribute="centerY" id="5Z2-vz-Xa3"/>
+                                    <constraint firstItem="mWq-6Q-Jeb" firstAttribute="centerY" secondItem="ZQN-TX-rwt" secondAttribute="centerY" id="6Qa-zf-nV9"/>
+                                    <constraint firstItem="DP5-Ar-1dm" firstAttribute="centerX" secondItem="ZQN-TX-rwt" secondAttribute="centerX" id="Cvh-z8-qXj"/>
+                                    <constraint firstItem="DP5-Ar-1dm" firstAttribute="centerY" secondItem="ZQN-TX-rwt" secondAttribute="centerY" id="FIk-LQ-Ujl"/>
+                                    <constraint firstItem="sWP-oz-Pbl" firstAttribute="leading" secondItem="4K3-lv-es0" secondAttribute="trailing" constant="8" id="Gxt-nt-IVL"/>
+                                    <constraint firstItem="4K3-lv-es0" firstAttribute="centerY" secondItem="ZQN-TX-rwt" secondAttribute="centerY" id="U5W-na-Oer"/>
+                                    <constraint firstItem="DP5-Ar-1dm" firstAttribute="leading" secondItem="ZQN-TX-rwt" secondAttribute="leading" constant="300" id="YFP-Lc-Xp4"/>
+                                    <constraint firstItem="kZ4-rC-iP5" firstAttribute="leading" secondItem="mWq-6Q-Jeb" secondAttribute="trailing" constant="8" id="YdR-Yc-OaP"/>
+                                    <constraint firstAttribute="trailing" secondItem="DP5-Ar-1dm" secondAttribute="trailing" constant="300" id="afG-kR-SD5"/>
+                                    <constraint firstAttribute="height" constant="40" id="boZ-Z5-9Qp"/>
+                                    <constraint firstItem="4K3-lv-es0" firstAttribute="leading" secondItem="Jlg-Qt-Zb3" secondAttribute="trailing" constant="7" id="gaV-G9-9Em"/>
+                                    <constraint firstItem="u0U-bP-RVi" firstAttribute="centerY" secondItem="ZQN-TX-rwt" secondAttribute="centerY" id="jCL-1y-JKs"/>
+                                    <constraint firstItem="Jlg-Qt-Zb3" firstAttribute="centerY" secondItem="ZQN-TX-rwt" secondAttribute="centerY" id="jtu-dI-6fg"/>
+                                    <constraint firstAttribute="trailing" secondItem="u0U-bP-RVi" secondAttribute="trailing" constant="8" id="nRL-Lv-nVt"/>
+                                    <constraint firstItem="mWq-6Q-Jeb" firstAttribute="leading" secondItem="ZQN-TX-rwt" secondAttribute="leading" id="rF7-dc-NXG"/>
+                                    <constraint firstItem="sWP-oz-Pbl" firstAttribute="centerY" secondItem="ZQN-TX-rwt" secondAttribute="centerY" id="yGM-eT-daa"/>
+                                    <constraint firstItem="Jlg-Qt-Zb3" firstAttribute="leading" secondItem="kZ4-rC-iP5" secondAttribute="trailing" constant="8" id="zFb-ad-zrz"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="l3n-KG-leC">
+                                <rect key="frame" x="0.0" y="-2" width="724" height="40"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="40" id="Ozq-pX-UxL"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="trailing" secondItem="l3n-KG-leC" secondAttribute="trailing" id="6md-cg-ToV"/>
+                            <constraint firstItem="ZQN-TX-rwt" firstAttribute="top" secondItem="NTQ-x4-FA0" secondAttribute="top" id="IcO-Xm-u5k"/>
+                            <constraint firstItem="l3n-KG-leC" firstAttribute="top" secondItem="ZQN-TX-rwt" secondAttribute="bottom" id="SUj-Dq-td4"/>
+                            <constraint firstAttribute="trailing" secondItem="ZQN-TX-rwt" secondAttribute="trailing" id="hje-ke-ySI"/>
+                            <constraint firstItem="l3n-KG-leC" firstAttribute="leading" secondItem="NTQ-x4-FA0" secondAttribute="leading" id="rNs-UE-pvC"/>
+                            <constraint firstItem="ZQN-TX-rwt" firstAttribute="leading" secondItem="NTQ-x4-FA0" secondAttribute="leading" id="uUT-TU-eMl"/>
+                        </constraints>
+                    </view>
+                </box>
+            </subviews>
+            <constraints>
+                <constraint firstAttribute="trailing" secondItem="uo1-lg-iPw" secondAttribute="trailing" id="4f1-T5-FOD"/>
+                <constraint firstItem="uo1-lg-iPw" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="9J9-Zh-7kP"/>
+                <constraint firstItem="uo1-lg-iPw" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="kOR-tx-ejO"/>
+                <constraint firstAttribute="bottom" secondItem="uo1-lg-iPw" secondAttribute="bottom" id="sbJ-74-vBg"/>
+            </constraints>
+            <point key="canvasLocation" x="193" y="67"/>
+        </customView>
+    </objects>
+</document>

+ 69 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFToolbarManager.swift

@@ -0,0 +1,69 @@
+//
+//  KMPDFToolbarManager.swift
+//  PDF Reader Pro
+//
+//  Created by Niehaoyu on 2024/10/22.
+//
+
+import Foundation
+import KMComponentLibrary
+
+class KMPDFToolbarManager: NSObject {
+    @objc public static let manager = KMPDFToolbarManager()
+    
+    var toolsType: KMPDFViewToolsType = .Select
+    
+    var viewProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true)
+    
+    var pageProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true)
+   
+    var toolsProperty: ComponentDropdownToolProperty = ComponentDropdownToolProperty(state: .normal, leftIcon: NSImage(named: "toolbar_Tools_select"), showDropdown: true)
+    var tools_selectProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_select"), keyEquivalent: KMLocalizedString("⌘ 1"), text: KMLocalizedString("Select"))
+     var tools_scrollProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_scroll"), keyEquivalent: KMLocalizedString("⌘ 2"), text: KMLocalizedString("Scroll"))
+     var tools_contentProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_content"), keyEquivalent: KMLocalizedString("⌘ 3"), text: KMLocalizedString("Content Selection"))
+     var tools_magnifyProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_magnify"), keyEquivalent: KMLocalizedString("⌘ 4"), text: KMLocalizedString("Magnify"))
+     var tools_areaProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_zoom"), keyEquivalent: KMLocalizedString("⌘ 5"), text: KMLocalizedString("Area Zoom"))
+    
+    var selectZoomProperty: ComponentSelectZoomProperty = ComponentSelectZoomProperty(state: .normal, isDisabled: false, text: "100%")
+    
+    override init() {
+        super.init()
+         
+        self.initData()
+        
+    }
+    
+    func initData() {
+        viewProperty.propertyInfo.leftIcon_nor = NSImage(named: "toolbar_View")
+        
+        pageProperty.propertyInfo.leftIcon_nor = NSImage(named: "toolbar_Page")
+        
+        reloadToolsData()
+        var menuItemArr: [ComponentMenuitemProperty] = []
+        if true {
+            menuItemArr.append(tools_selectProperty)
+            menuItemArr.append(tools_scrollProperty)
+            menuItemArr.append(tools_contentProperty)
+            menuItemArr.append(tools_magnifyProperty)
+            menuItemArr.append(tools_areaProperty)
+            toolsProperty.menuItemArr = menuItemArr
+        }
+         
+    }
+    
+    
+    //MARK: - 刷新tools工具
+    func reloadToolsData() {
+        if toolsType == .Select {
+            toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_select")
+        } else if toolsType == .Scroll {
+            toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_scroll")
+        } else if toolsType == .Content_Selection {
+            toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_content")
+        } else if toolsType == .Magnify {
+            toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_magnify")
+        } else if toolsType == .AreaZoom {
+            toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_zoom")
+        }
+    }
+}

+ 0 - 17
PDF Office/PDF Master/KMClass/PDFView/Toolbar/KMPDFToolbarController.swift

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

+ 0 - 22
PDF Office/PDF Master/KMClass/PDFView/Toolbar/KMPDFToolbarController.xib

@@ -1,22 +0,0 @@
-<?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="KMPDFToolbarController" customModule="PDF_Reader_Pro" 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="706" height="80"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-            <point key="canvasLocation" x="193" y="67"/>
-        </customView>
-    </objects>
-</document>

+ 2 - 1
PDF Office/PDF Master/KMClass/Tools/NSWindowController+Extension/NSWindowController+Extension.swift

@@ -9,10 +9,11 @@ import Foundation
 
 extension NSWindowController {
     
-    //show方法,确保居中显示
     
+    //MARK: - show方法,确保居中显示
     func showKMWindow(_ sender: Any?) {
         self.window?.center()
+        
         self.showWindow(sender)
     }
     

+ 11 - 3
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -2660,6 +2660,9 @@
 		BB003035298D356E002DD1A0 /* KMPreferenceMarkupColorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB003034298D356E002DD1A0 /* KMPreferenceMarkupColorView.swift */; };
 		BB003036298D356E002DD1A0 /* KMPreferenceMarkupColorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB003034298D356E002DD1A0 /* KMPreferenceMarkupColorView.swift */; };
 		BB003037298D356E002DD1A0 /* KMPreferenceMarkupColorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB003034298D356E002DD1A0 /* KMPreferenceMarkupColorView.swift */; };
+		BB0308562CC7443100F4AAC7 /* KMPDFToolbarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0308552CC7443100F4AAC7 /* KMPDFToolbarManager.swift */; };
+		BB0308572CC7443100F4AAC7 /* KMPDFToolbarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0308552CC7443100F4AAC7 /* KMPDFToolbarManager.swift */; };
+		BB0308582CC7443100F4AAC7 /* KMPDFToolbarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0308552CC7443100F4AAC7 /* KMPDFToolbarManager.swift */; };
 		BB031B5A2C47BB080099F7AD /* KMUserFbHelpPopController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB031B432C47BB070099F7AD /* KMUserFbHelpPopController.xib */; };
 		BB031B5B2C47BB080099F7AD /* KMUserFbHelpPopController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB031B432C47BB070099F7AD /* KMUserFbHelpPopController.xib */; };
 		BB031B5C2C47BB080099F7AD /* KMUserFbHelpPopController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB031B432C47BB070099F7AD /* KMUserFbHelpPopController.xib */; };
@@ -6842,6 +6845,7 @@
 		BB00301C298CB799002DD1A0 /* KMPreferenceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPreferenceManager.swift; sourceTree = "<group>"; };
 		BB003020298CEBED002DD1A0 /* KMPreferenceStepper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPreferenceStepper.swift; sourceTree = "<group>"; };
 		BB003034298D356E002DD1A0 /* KMPreferenceMarkupColorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPreferenceMarkupColorView.swift; sourceTree = "<group>"; };
+		BB0308552CC7443100F4AAC7 /* KMPDFToolbarManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPDFToolbarManager.swift; sourceTree = "<group>"; };
 		BB031B432C47BB070099F7AD /* KMUserFbHelpPopController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMUserFbHelpPopController.xib; sourceTree = "<group>"; };
 		BB031B442C47BB070099F7AD /* KMUserFbHelpPopController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMUserFbHelpPopController.swift; sourceTree = "<group>"; };
 		BB031B462C47BB070099F7AD /* KMUserFeekbackWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMUserFeekbackWindowController.swift; sourceTree = "<group>"; };
@@ -12834,6 +12838,7 @@
 				BB8AA5422CC6711B0084F183 /* KMPDFConfig.swift */,
 				BB52F5632CC22FE8007418DB /* KMPDFViewController.swift */,
 				BB52F5642CC22FE8007418DB /* KMPDFViewController.xib */,
+				BB5A9D6D2CB6522700F64C1F /* PDFView */,
 				BB52F54E2CC1FA8F007418DB /* KMLinkViewController */,
 			);
 			path = KMPDFViewController;
@@ -12925,7 +12930,6 @@
 				BB52F54C2CC1FA69007418DB /* KMPDFViewController */,
 				BBE7884A2CBD2450008086E2 /* ComponentLibraryDemo */,
 				F3D395632CBD2BE7000C6729 /* Tools */,
-				BB5A9D6D2CB6522700F64C1F /* PDFView */,
 				BB5A9D262CB6520100F64C1F /* KMHomeViewController */,
 				BB5A9D3F2CB6521300F64C1F /* Settings */,
 			);
@@ -13002,10 +13006,11 @@
 		BB5A9D472CB6521400F64C1F /* Toolbar */ = {
 			isa = PBXGroup;
 			children = (
+				BB0308552CC7443100F4AAC7 /* KMPDFToolbarManager.swift */,
+				BB5A9D4B2CB6521400F64C1F /* KMPDFToolbarController.swift */,
 				BB5A9D482CB6521400F64C1F /* KMPDFToolbarController.xib */,
-				BB5A9D492CB6521400F64C1F /* KMPDFSecToolbarController.xib */,
 				BB5A9D4A2CB6521400F64C1F /* KMPDFSecToolbarController.swift */,
-				BB5A9D4B2CB6521400F64C1F /* KMPDFToolbarController.swift */,
+				BB5A9D492CB6521400F64C1F /* KMPDFSecToolbarController.xib */,
 			);
 			path = Toolbar;
 			sourceTree = "<group>";
@@ -17487,6 +17492,7 @@
 				9FDD0F77294FEF64000C4DAD /* KMConvertPDFManager.swift in Sources */,
 				9F8539D62943180000DF644E /* KMTabAppearance.swift in Sources */,
 				BB5DF1E92959C5CB0025CDA1 /* KMHeaderFooterPreviewController.swift in Sources */,
+				BB0308562CC7443100F4AAC7 /* KMPDFToolbarManager.swift in Sources */,
 				9FCFEC702AC40F9B00EAD2CB /* CStampSignatureObject.swift in Sources */,
 				9FDD0F6B294AD12C000C4DAD /* KMMainViewController+UI.swift in Sources */,
 				BBF811E02B07178F0074874F /* KMExtractImageWindowController.swift in Sources */,
@@ -19544,6 +19550,7 @@
 				BBF729BC2B19717200576AC5 /* KMBatchRemoveBackgroundOperation.swift in Sources */,
 				ADB5E51A2A3711CB007110A8 /* KMSubscribeWaterMarkView.swift in Sources */,
 				BB8F456E295AC1220037EA22 /* KMHeaderFooterAdjectiveModel.swift in Sources */,
+				BB0308572CC7443100F4AAC7 /* KMPDFToolbarManager.swift in Sources */,
 				AD7D5C822B8ECD09006562CD /* KMPDFSynchronizer.swift in Sources */,
 				F3599174292B62F5000D25DE /* CStringConstants.m in Sources */,
 				BB6D2DA82B674A6300624C24 /* CPDFOutline+KMExtension.swift in Sources */,
@@ -20657,6 +20664,7 @@
 				AD9527EC2955520C0039D2BC /* KMBaseTextFieldModel.swift in Sources */,
 				BBF729A52B19624500576AC5 /* KMAddBackgroundOperationQueue.swift in Sources */,
 				BB19A73C2CB7B4C9008204DC /* KMHomeRightView.swift in Sources */,
+				BB0308582CC7443100F4AAC7 /* KMPDFToolbarManager.swift in Sources */,
 				BBF38A5C294F2B760086D025 /* KMWatermarkPositionView.swift in Sources */,
 				AD5999402AD7E88600412F8B /* KMStampManager.swift in Sources */,
 				AD199DDF2B200FA300D56FEE /* KMPrintPosterView.swift in Sources */,