Browse Source

【2025】【Edit】文字编辑补充

niehaoyu 6 days ago
parent
commit
e209c47441
17 changed files with 608 additions and 109 deletions
  1. 107 36
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorGroup.swift
  2. 0 16
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorGroup.xib
  3. 77 28
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorItem.swift
  4. 4 2
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorProperty.swift
  5. 3 4
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Edit.swift
  6. 2 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift
  7. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Center.imageset/Contents.json
  8. BIN
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Center.imageset/fontStyle_Center.pdf
  9. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Itality.imageset/Contents.json
  10. 95 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Itality.imageset/fontStyle_Itality.pdf
  11. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Underline.imageset/Contents.json
  12. 89 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Underline.imageset/fontStyle_Underline.pdf
  13. 12 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_bold.imageset/Contents.json
  14. 93 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_bold.imageset/fontStyle_bold.pdf
  15. 84 15
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/EditPDF/KMEditPDFTextPropertyViewController.swift
  16. 4 4
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/EditPDF/KMEditPDFTextPropertyViewController.xib
  17. 2 2
      PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+ 107 - 36
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorGroup.swift

@@ -7,17 +7,80 @@
 
 import Cocoa
 
+@objc public protocol ComponentCSelectorGroupDelegate: AnyObject {
+    
+    @objc optional func componentCSelectorGroupDidChoose(_ view: ComponentCSelectorGroup, _ item: ComponentCSelectorItem) 
+    
+}
+
 public class ComponentCSelectorGroup: ComponentBaseXibView {
 
     @IBOutlet var contendView: NSView!
-    @IBOutlet var contendBox: NSBox!
-
-    var csPropertyArr: [ComponentCSelectorProperty] = []
+ 
+    open var csPropertyArr: [ComponentCSelectorProperty] = []
+    
+    weak open var delegate: ComponentCSelectorGroupDelegate?
     
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
-
-        // Drawing code here.
+         
+        let fillColor: NSColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorFill-nor")
+        let borderWidth: CGFloat = 1
+        let borderColor: NSColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorBorder-nor")
+        
+        var cornerRadius_topLeft: CGFloat = 0
+        var cornerRadius_topRight: CGFloat = 0
+        var cornerRadius_bottomLeft: CGFloat = 0
+        var cornerRadius_bottomRight: CGFloat = 0
+        
+        if let value = ComponentLibrary.shared.getComponentValueFromKey("radius/xs") {
+            let currentValue = value as! CGFloat
+            cornerRadius_topLeft = currentValue
+            cornerRadius_topRight = currentValue
+            cornerRadius_bottomLeft = currentValue
+            cornerRadius_bottomRight = currentValue
+        }
+        
+        let drawBounds = bounds.insetBy(dx: 1, dy: 1)
+        
+        let path = NSBezierPath()
+        path.lineWidth = borderWidth + 1
+        
+        path.move(to: NSPoint(x: drawBounds.minX + cornerRadius_bottomLeft, y: drawBounds.minY))
+        if cornerRadius_bottomLeft > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.minX + cornerRadius_bottomLeft, y: drawBounds.minY), to: NSPoint(x: drawBounds.minX + cornerRadius_bottomLeft, y: drawBounds.minY), radius: cornerRadius_bottomLeft) //左下角
+        }
+        
+        if cornerRadius_bottomRight > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.maxX, y: drawBounds.minY), to: NSPoint(x: drawBounds.maxX, y: drawBounds.minY + cornerRadius_bottomRight), radius: cornerRadius_bottomRight) //右下角
+        } else {
+            path.line(to: NSPoint(x: drawBounds.maxX, y: drawBounds.minY))
+        }
+        
+        if cornerRadius_topRight > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.maxX, y: drawBounds.maxY), to: NSPoint(x: drawBounds.maxX - cornerRadius_topRight, y: drawBounds.maxY), radius: cornerRadius_topRight) // 右上角
+        } else {
+            path.line(to: NSPoint(x: drawBounds.maxX, y: drawBounds.maxY))
+        }
+        
+        if cornerRadius_topLeft > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.minX, y: drawBounds.maxY), to: NSPoint(x: drawBounds.minX, y: drawBounds.maxY - cornerRadius_topLeft), radius: cornerRadius_topLeft) //左上角
+        } else {
+            path.line(to: NSPoint(x: drawBounds.minX, y: drawBounds.maxY))
+        }
+        
+        if cornerRadius_bottomLeft > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.minX, y: drawBounds.minY), to: NSPoint(x: drawBounds.minX + cornerRadius_bottomLeft, y: drawBounds.minY), radius: cornerRadius_bottomLeft) //左下角
+        } else {
+            path.line(to: NSPoint(x: drawBounds.minX, y: drawBounds.minY))
+        }
+        
+        borderColor.setStroke()
+        path.stroke()
+        path.close()
+        fillColor.setFill()
+        path.fill()
+        
     }
     
     // MARK: 初始化
@@ -44,59 +107,67 @@ public class ComponentCSelectorGroup: ComponentBaseXibView {
     public func updateItemProperty(_ propertys: [ComponentCSelectorProperty]) {
         csPropertyArr = propertys
         
-        reloadData()
+        display()
+        
+        refreshData()
     }
     
-    func reloadData() {
+    public func reloadData() {
+        for property in csPropertyArr {
+            let subviews = contendView.subviews
+            for view in subviews {
+                if view is ComponentCSelectorItem {
+                    (view as! ComponentCSelectorItem).reloadData()
+                }
+            }
+        }
+    }
+    
+    func refreshData() {
         if csPropertyArr.count == 0 {
             return
         }
-        contendView.layer?.borderWidth = 1
-        contendView.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorFill-nor").cgColor
-        contendView.layer?.borderColor = ComponentLibrary.shared.getComponentColorFromKey("comp-field/colorBorder-nor").cgColor
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("radius/xs") {
-            let currentValue = value as! CGFloat
-            contendView.layer?.cornerRadius = currentValue
-        }
         
-        if let subviews = contendBox.contentView?.subviews {
-            for view in subviews {
-                if view is ComponentCSelectorItem {
-                    view.removeFromSuperview()
-                }
+        let subviews = contendView.subviews
+        for view in subviews {
+            if view is ComponentCSelectorItem {
+                view.removeFromSuperview()
             }
         }
         
+        var cornerRadius: CGFloat = 0
+        if let value = ComponentLibrary.shared.getComponentValueFromKey("radius/xs") {
+            cornerRadius = value as! CGFloat
+         }
+        
         var itemXValue: CGFloat = 0
         let viewWidth: CGFloat = CGRectGetWidth(bounds)/CGFloat(csPropertyArr.count)
         for i in 0...csPropertyArr.count - 1 {
             let itemProperty = csPropertyArr[i]
             let item = ComponentCSelectorItem.init()
-            item.frame = CGRectMake(itemXValue, 0, viewWidth, CGRectGetHeight(contendBox.contentView!.bounds))
             item.properties = itemProperty
-            item.autoresizingMask = [.maxXMargin, .height]
+            
+            item.frame = CGRectMake(itemXValue, 0, viewWidth, CGRectGetHeight(self.frame)-1)
+            if i == 0 {
+                item.properties.propertyInfo.cornerRadius_topLeft = cornerRadius
+                item.properties.propertyInfo.cornerRadius_bottomLeft = cornerRadius
+                item.reloadData()
+            } else if i == csPropertyArr.count - 1 {
+                item.properties.propertyInfo.cornerRadius_topRight = cornerRadius
+                item.properties.propertyInfo.cornerRadius_bottomRight = cornerRadius
+                item.reloadData()
+            }
+            item.autoresizingMask = [.maxXMargin, .maxYMargin]
             item.setTarget(self, action: #selector(cSelectorItemClicked(_:)))
-            contendBox.contentView?.addSubview(item)
+            contendView.addSubview(item)
             
             itemXValue += viewWidth
         }
-        
     }
     
     @objc func cSelectorItemClicked(_ item: ComponentCSelectorItem) {
-        let property = item.properties
-        
-        if let subviews = contendBox.contentView?.subviews {
-            for view in subviews {
-                if view is ComponentCSelectorItem {
-                    let itemView = view as! ComponentCSelectorItem
-                    if itemView.properties != property {
-                        itemView.properties.state = .normal
-                        itemView.refreshUI()
-                    }
-                }
-            }
-        }
+ 
+        delegate?.componentCSelectorGroupDidChoose?(self, item)
     }
     
 }

+ 0 - 16
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorGroup.xib

@@ -8,7 +8,6 @@
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="ComponentCSelectorGroup" customModule="KMComponentLibrary" customModuleProvider="target">
             <connections>
-                <outlet property="contendBox" destination="I5v-gf-gRb" id="8bV-6K-Baj"/>
                 <outlet property="contendView" destination="tA7-3x-bbE" id="NMh-p9-aRs"/>
             </connections>
         </customObject>
@@ -20,21 +19,6 @@
             <subviews>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="tA7-3x-bbE">
                     <rect key="frame" x="0.0" y="0.0" width="191" height="38"/>
-                    <subviews>
-                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="I5v-gf-gRb">
-                            <rect key="frame" x="1" y="1" width="189" height="36"/>
-                            <view key="contentView" id="lAk-SY-Xh7">
-                                <rect key="frame" x="0.0" y="0.0" width="189" height="36"/>
-                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                            </view>
-                        </box>
-                    </subviews>
-                    <constraints>
-                        <constraint firstAttribute="bottom" secondItem="I5v-gf-gRb" secondAttribute="bottom" constant="1" id="0D6-Du-5IG"/>
-                        <constraint firstItem="I5v-gf-gRb" firstAttribute="top" secondItem="tA7-3x-bbE" secondAttribute="top" constant="1" id="P95-Oh-3ez"/>
-                        <constraint firstAttribute="trailing" secondItem="I5v-gf-gRb" secondAttribute="trailing" constant="1" id="nFe-vh-lrg"/>
-                        <constraint firstItem="I5v-gf-gRb" firstAttribute="leading" secondItem="tA7-3x-bbE" secondAttribute="leading" constant="1" id="w9c-6f-SVU"/>
-                    </constraints>
                 </customView>
             </subviews>
             <constraints>

+ 77 - 28
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorItem.swift

@@ -7,7 +7,7 @@
 
 import Cocoa
 
-class ComponentCSelectorItem: ComponentBaseXibView {
+public class ComponentCSelectorItem: ComponentBaseXibView {
     
     @IBOutlet var iconBox: NSBox!
     @IBOutlet var iconImage: NSImageView!
@@ -24,8 +24,72 @@ class ComponentCSelectorItem: ComponentBaseXibView {
     
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
-
-        // Drawing code here.
+        
+        var fillColor: NSColor = NSColor.clear
+        var borderWidth: CGFloat = 0
+        var borderColor: NSColor = NSColor.clear
+        
+        if properties.state == .normal {
+            fillColor = properties.propertyInfo.color_nor
+            borderWidth = 0
+            borderColor = properties.propertyInfo.borderColor_nor
+            
+        } else if properties.state == .hover {
+            fillColor = properties.propertyInfo.color_hov
+            borderWidth = properties.propertyInfo.borderWidth
+            borderColor = properties.propertyInfo.borderColor_hov
+            
+        } else if properties.state == .pressed {
+            fillColor = properties.propertyInfo.color_active
+            borderWidth = properties.propertyInfo.borderWidth
+            borderColor = properties.propertyInfo.borderColor_active
+        }
+        
+        let cornerRadius_topLeft: CGFloat = properties.propertyInfo.cornerRadius_topLeft
+        let cornerRadius_topRight: CGFloat = properties.propertyInfo.cornerRadius_topRight
+        let cornerRadius_bottomLeft: CGFloat = properties.propertyInfo.cornerRadius_bottomLeft
+        let cornerRadius_bottomRight: CGFloat = properties.propertyInfo.cornerRadius_bottomRight
+        
+        let drawBounds = bounds.insetBy(dx: 1, dy: 1)
+        
+        let path = NSBezierPath()
+        path.lineWidth = borderWidth + 1
+        
+        path.move(to: NSPoint(x: drawBounds.minX + cornerRadius_bottomLeft, y: drawBounds.minY))
+        if cornerRadius_bottomLeft > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.minX + cornerRadius_bottomLeft, y: drawBounds.minY), to: NSPoint(x: drawBounds.minX + cornerRadius_bottomLeft, y: drawBounds.minY), radius: cornerRadius_bottomLeft) //左下角
+        }
+        
+        if cornerRadius_bottomRight > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.maxX, y: drawBounds.minY), to: NSPoint(x: drawBounds.maxX, y: drawBounds.minY + cornerRadius_bottomRight), radius: cornerRadius_bottomRight) //右下角
+        } else {
+            path.line(to: NSPoint(x: drawBounds.maxX, y: drawBounds.minY))
+        }
+        
+        if cornerRadius_topRight > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.maxX, y: drawBounds.maxY), to: NSPoint(x: drawBounds.maxX - cornerRadius_topRight, y: drawBounds.maxY), radius: cornerRadius_topRight) // 右上角
+        } else {
+            path.line(to: NSPoint(x: drawBounds.maxX, y: drawBounds.maxY))
+        }
+        
+        if cornerRadius_topLeft > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.minX, y: drawBounds.maxY), to: NSPoint(x: drawBounds.minX, y: drawBounds.maxY - cornerRadius_topLeft), radius: cornerRadius_topLeft) //左上角
+        } else {
+            path.line(to: NSPoint(x: drawBounds.minX, y: drawBounds.maxY))
+        }
+        
+        if cornerRadius_bottomLeft > 0 {
+            path.appendArc(from: NSPoint(x: drawBounds.minX, y: drawBounds.minY), to: NSPoint(x: drawBounds.minX + cornerRadius_bottomLeft, y: drawBounds.minY), radius: cornerRadius_bottomLeft) //左下角
+        } else {
+            path.line(to: NSPoint(x: drawBounds.minX, y: drawBounds.minY))
+        }
+        
+        borderColor.setStroke()
+        path.stroke()
+        path.close()
+        fillColor.set()
+        path.fill()
+        
     }
     
     // MARK: 初始化
@@ -50,7 +114,7 @@ class ComponentCSelectorItem: ComponentBaseXibView {
     // MARK: - Set & Get
     public var properties : ComponentCSelectorProperty {
         get {
-           return _properties
+            return _properties
         }
         set {
             _properties = newValue
@@ -63,7 +127,6 @@ class ComponentCSelectorItem: ComponentBaseXibView {
     
     //MARK: - SetupUI
     func setupUI() {
-        
         if properties.size == .s {
             iconImgWidthConst.constant = 16
         } else {
@@ -72,41 +135,27 @@ class ComponentCSelectorItem: ComponentBaseXibView {
     }
     
     func refreshUI() {
-        
-        var fillColor: NSColor?
-        var borderWidth: CGFloat = 0
-        var borderColor: NSColor?
-        
         var iconImage = properties.iconImage
         
         if properties.state == .normal {
-            fillColor = properties.propertyInfo.color_nor
-            borderWidth = 0
-            borderColor = properties.propertyInfo.borderColor_nor
+            
         } else if properties.state == .hover {
-            fillColor = properties.propertyInfo.color_hov
-            borderWidth = properties.propertyInfo.borderWidth
-            borderColor = properties.propertyInfo.borderColor_hov
             if let image = properties.icon_hov_Image {
                 iconImage = image
             }
         } else if properties.state == .pressed {
-            fillColor = properties.propertyInfo.color_active
-            borderWidth = properties.propertyInfo.borderWidth
-            borderColor = properties.propertyInfo.borderColor_active
+            
         }
         
         self.iconImage.image = iconImage
         
-        if let color = fillColor {
-            iconBox.fillColor = color
-        }
-        iconBox.borderWidth = borderWidth
+        iconBox.fillColor = NSColor.clear
+        iconBox.borderWidth = 0
+        iconBox.borderColor = NSColor.clear
         
-        if let color = borderColor {
-            iconBox.borderColor = color
+        DispatchQueue.main.async {
+            self.display()
         }
-        
     }
     
     public func setTarget(_ target: AnyObject?, action: Selector?) {
@@ -124,7 +173,7 @@ class ComponentCSelectorItem: ComponentBaseXibView {
     //MARK: - MouseEvent
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
-         
+        
         if properties.state != .pressed {
             properties.state = .hover
         }
@@ -136,7 +185,7 @@ class ComponentCSelectorItem: ComponentBaseXibView {
         super.mouseMoved(with: event)
         
     }
-     
+    
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         

+ 4 - 2
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorProperty.swift

@@ -15,6 +15,7 @@ import Cocoa
     public var text: String?                      //文字信息
     public var iconImage: NSImage?
     public var icon_hov_Image: NSImage?
+    public var identifier: String = ""
     
     public var propertyInfo = CSelectorPropertyInfo()
     
@@ -22,14 +23,15 @@ import Cocoa
                 state: ComponentState = .normal,
                 text: String? = nil,
                 iconImage: NSImage? = nil,
-                icon_hov_Image: NSImage? = nil) {
+                icon_hov_Image: NSImage? = nil,
+                identifier: String = "") {
 
         self.size = size
         self.state = state
         self.text = text
         self.iconImage = iconImage
         self.icon_hov_Image = icon_hov_Image
-        
+        self.identifier = identifier
     }
 }
 

+ 3 - 4
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Edit.swift

@@ -137,7 +137,6 @@ extension CPDFListView {
         for area in textAreas {
             let data = self.currentSelectionAlignment(byRangeEdit: area)
             datas.append(data)
-            
         }
         return datas
     }
@@ -241,7 +240,7 @@ extension CPDFListView {
         }
     }
     
-    func fontBoldAction() {
+    func setEditingTextarea_Bold() {
         let areas = self.km_editingTextAreas()
         for area in areas {
             let data = self.isBoldCurrentSelection(byRangeEdit: area)
@@ -249,7 +248,7 @@ extension CPDFListView {
         }
     }
     
-    func fontItalicAction() {
+    func setEditingTextarea_Italic() {
         let areas = self.km_editingTextAreas()
         for area in areas {
             let data = self.isItalicCurrentSelection(byRangeEdit: area)
@@ -257,7 +256,7 @@ extension CPDFListView {
         }
     }
     
-    func textAlignmentAction(align: NSTextAlignment) {
+    func setEditingTextarea_Alignment(align: NSTextAlignment) {
         let areas = self.km_editingTextAreas()
         for area in areas {
             self.setCurrentSelectionAlignment(align, with: area)

+ 2 - 2
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -2050,12 +2050,12 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
         KMPrint(theEvent.keyCode)
         if self.listView.isEditing() == true {
             if control && theEvent.keyCode == 11 { // ctr + b
-                self.listView.fontBoldAction()
+                self.listView.setEditingTextarea_Bold()
                 rightSideController?.reloadEditingAreas()
                 
                 return false
             } else if control && theEvent.keyCode == 34 { // ctr +i
-                self.listView.fontItalicAction()
+                self.listView.setEditingTextarea_Italic()
                 rightSideController?.reloadEditingAreas()
                 
                 return false

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

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

BIN
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Center.imageset/fontStyle_Center.pdf


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

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

+ 95 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Itality.imageset/fontStyle_Itality.pdf

@@ -0,0 +1,95 @@
+%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 5.625000 3.095705 cm
+0.062745 0.094118 0.156863 scn
+2.031250 -0.133204 m
+4.531250 13.958593 l
+6.718750 13.958593 l
+4.218750 -0.133204 l
+2.031250 -0.133204 l
+h
+f
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 5.625000 15.312502 cm
+0.062745 0.094118 0.156863 scn
+8.750000 0.000000 m
+2.500000 0.000000 l
+2.500000 1.875000 l
+8.750000 1.875000 l
+8.750000 0.000000 l
+h
+f*
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 5.625000 15.312502 cm
+0.062745 0.094118 0.156863 scn
+6.250000 -12.500000 m
+0.000000 -12.500000 l
+0.000000 -10.625000 l
+6.250000 -10.625000 l
+6.250000 -12.500000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  644
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000002 ]
+     /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
+0000000734 00000 n
+0000000756 00000 n
+0000000929 00000 n
+0000001003 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1062
+%%EOF

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

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

+ 89 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_Underline.imageset/fontStyle_Underline.pdf

@@ -0,0 +1,89 @@
+%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.750000 4.658203 cm
+0.062745 0.094118 0.156863 scn
+6.250000 0.000002 m
+2.714844 0.000002 0.537109 2.099611 0.537109 5.195314 c
+0.537109 12.841799 l
+2.724609 12.841799 l
+2.724609 5.361330 l
+2.724609 3.320314 4.003906 1.933596 6.250000 1.933596 c
+8.496094 1.933596 9.765625 3.320314 9.765625 5.361330 c
+9.765625 12.841799 l
+11.953125 12.841799 l
+11.953125 5.195314 l
+11.953125 2.099611 9.794922 0.000002 6.250000 0.000002 c
+h
+f
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 3.750000 15.625002 cm
+0.062745 0.094118 0.156863 scn
+0.000000 -11.875000 m
+12.500000 -11.875000 l
+12.500000 -13.750000 l
+0.000000 -13.750000 l
+0.000000 -11.875000 l
+h
+f
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  710
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000002 ]
+     /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
+0000000800 00000 n
+0000000822 00000 n
+0000000995 00000 n
+0000001069 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1128
+%%EOF

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

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

+ 93 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFImages.xcassets/PDF_Edit/fontStyle_bold.imageset/fontStyle_bold.pdf

@@ -0,0 +1,93 @@
+%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 5.058594 2.500000 cm
+0.062745 0.094118 0.156863 scn
+0.000000 0.000002 m
+0.000000 14.091799 l
+5.664062 14.091799 l
+8.310547 14.091799 9.902344 12.744143 9.902344 10.585939 c
+9.902344 10.566408 l
+9.902344 9.101564 8.818359 7.783205 7.431641 7.548830 c
+7.431641 7.382814 l
+9.335938 7.177736 10.605469 5.830080 10.605469 3.994143 c
+10.605469 3.974611 l
+10.605469 1.503908 8.798828 0.000002 5.791016 0.000002 c
+0.000000 0.000002 l
+h
+5.156250 12.304689 m
+2.187500 12.304689 l
+2.187500 8.095705 l
+4.785156 8.095705 l
+6.718750 8.095705 7.724609 8.818361 7.724609 10.185549 c
+7.724609 10.205080 l
+7.724609 11.533205 6.777344 12.304689 5.156250 12.304689 c
+h
+5.224609 6.425783 m
+2.187500 6.425783 l
+2.187500 1.787111 l
+5.351562 1.787111 l
+7.324219 1.787111 8.369141 2.597658 8.369141 4.111330 c
+8.369141 4.130861 l
+8.369141 5.644533 7.285156 6.425783 5.224609 6.425783 c
+h
+f
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  936
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000002 ]
+     /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
+0000001026 00000 n
+0000001048 00000 n
+0000001221 00000 n
+0000001295 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1354
+%%EOF

+ 84 - 15
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/EditPDF/KMEditPDFTextPropertyViewController.swift

@@ -30,7 +30,17 @@ class KMEditPDFTextPropertyViewController: NSViewController {
     @IBOutlet var colorOpacitySelect: ComponentSelect!
      
     private var familyNames = CPDFFont.familyNames
-     
+    
+    private let fontStyle_boldItem: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: "fontStyle_bold"), identifier: "fontStyle_bold")
+    private let fontStyle_ItalityItem: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: "fontStyle_Itality"), identifier: "fontStyle_Itality")
+    private let fontStyle_CenterItem: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: "fontStyle_Center"), identifier: "fontStyle_Center")
+    private let fontStyle_Underline: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: "fontStyle_Underline"), identifier: "fontStyle_Underline")
+    
+    private let fontAlign_leftItem: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: "fontAlign_left"), identifier: "fontAlign_left")
+    private let fontAlign_centerItem: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: "fontAlign_center"), identifier: "fontAlign_center")
+    private let fontAlign_rightItem: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: "fontAlign_right"), identifier: "fontAlign_right")
+    private let fontAlign_justifyItem: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: "fontAlign_justify"), identifier: "fontAlign_justify")
+    
     var pdfView: CPDFListView?
      
     var currentArea: CPDFEditTextArea?
@@ -98,21 +108,23 @@ class KMEditPDFTextPropertyViewController: NSViewController {
         if true {
             var sizeItemArr: [ComponentMenuitemProperty] = []
             for string in KMHeaderFooterManager.getFontSize() {
-                let item = ComponentMenuitemProperty(type: .normal, text: string, identifier: string)
+                let item = ComponentMenuitemProperty(type: .normal, text: string + " pt", identifier: string)
                 sizeItemArr.append(item)
             }
             fontSizeSelect.updateMenuItemsArr(sizeItemArr)
         }
         fontSizeSelect.delegate = self
-        
+         
+        if true {
+            let itemArr: [ComponentCSelectorProperty] = [fontStyle_boldItem, fontStyle_ItalityItem, fontStyle_CenterItem, fontStyle_Underline]
+            fontStyleGroup.updateItemProperty(itemArr)
+            fontStyleGroup.delegate = self
+        }
         
         if true {
-            var itemArr: [ComponentCSelectorProperty] = []
-            for string in ["fontAlign_left", "fontAlign_center", "fontAlign_right", "fontAlign_justify"] {
-                let propertyItem: ComponentCSelectorProperty = ComponentCSelectorProperty.init(size: .m, state: .normal, iconImage: NSImage(named: string))
-                itemArr.append(propertyItem)
-            }
+            let itemArr: [ComponentCSelectorProperty] = [fontAlign_leftItem, fontAlign_centerItem, fontAlign_rightItem, fontAlign_justifyItem]
             fontAlignmentGroup.updateItemProperty(itemArr)
+            fontAlignmentGroup.delegate = self
         }
         
         //Color
@@ -195,27 +207,49 @@ class KMEditPDFTextPropertyViewController: NSViewController {
             
             if let fontSizes = pdfView?.km_editTextAreasFontSizes([area]) {
                 if let fontSize = fontSizes.first {
-                    
+                    fontSizeSelect.properties.text = String(format: "%.0f", fontSize)
+                    fontSizeSelect.reloadData()
                 }
             }
             
             if let bolds = pdfView?.km_editTextAreasFontBolds([area]) {
-                if let bold = bolds.first {
-                    
+                if let bold = bolds.first, bold == true {
+                    fontStyle_boldItem.state = .pressed
+                } else {
+                    fontStyle_boldItem.state = .normal
                 }
             }
             
             if let italitys = pdfView?.km_editTextAreasFontItalics([area]) {
-                if let itality = italitys.first {
-                    
+                if let itality = italitys.first, itality == true {
+                    fontStyle_ItalityItem.state = .pressed
+                } else {
+                    fontStyle_ItalityItem.state = .normal
                 }
-                
             }
-           
+            fontStyle_CenterItem.state = .normal
+            fontStyle_Underline.state = .normal
+            
+            fontStyleGroup.reloadData()
             
             if let alignments = pdfView?.km_editTextAreasTextAlignments([area]) {
                 if let alignment = alignments.first {
                     
+                    fontAlign_leftItem.state = .normal
+                    fontAlign_centerItem.state = .normal
+                    fontAlign_rightItem.state = .normal
+                    fontAlign_justifyItem.state = .normal
+                    
+                    if alignment == .left {
+                        fontAlign_leftItem.state = .pressed
+                    } else if alignment == .center {
+                        fontAlign_centerItem.state = .pressed
+                    } else if alignment == .right {
+                        fontAlign_rightItem.state = .pressed
+                    } else if alignment == .justified {
+                        fontAlign_justifyItem.state = .pressed
+                    }
+                    fontAlignmentGroup.reloadData()
                 }
             }
            
@@ -250,6 +284,11 @@ class KMEditPDFTextPropertyViewController: NSViewController {
         
     }
     
+    override func mouseDown(with event: NSEvent) {
+        super.mouseDown(with: event)
+        
+        view.window?.makeFirstResponder(nil)
+    }
 }
 
 
@@ -319,3 +358,33 @@ extension KMEditPDFTextPropertyViewController: ComponentSliderDelegate {
         
     }
 }
+
+//MARK: - ComponentCSelectorGroupDelegate
+extension KMEditPDFTextPropertyViewController: ComponentCSelectorGroupDelegate {
+    func componentCSelectorGroupDidChoose(_ view: ComponentCSelectorGroup, _ item: ComponentCSelectorItem) {
+         if view == fontStyleGroup {
+            if item.properties.identifier == "fontStyle_bold" {
+                pdfView?.setEditingTextarea_Bold()
+            } else if item.properties.identifier == "fontStyle_Itality" {
+                pdfView?.setEditingTextarea_Italic()
+            } else if item.properties.identifier == "fontStyle_Center" {
+                
+            } else if item.properties.identifier == "fontStyle_Underline" {
+                
+            }
+        } else if view == fontAlignmentGroup {
+            if item.properties.identifier == "fontAlign_left" {
+                pdfView?.setEditingTextarea_Alignment(align: .left)
+            } else if item.properties.identifier == "fontAlign_center" {
+                pdfView?.setEditingTextarea_Alignment(align: .center)
+            } else if item.properties.identifier == "fontAlign_right" {
+                pdfView?.setEditingTextarea_Alignment(align: .right)
+            } else if item.properties.identifier == "fontAlign_justify" {
+                pdfView?.setEditingTextarea_Alignment(align: .justified)
+            }
+        }
+        
+        reloadData()
+        
+    }
+}

+ 4 - 4
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/EditPDF/KMEditPDFTextPropertyViewController.xib

@@ -97,17 +97,17 @@
                                         <rect key="frame" x="0.0" y="80" width="232" height="32"/>
                                         <subviews>
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="mPz-nE-yzM" customClass="ComponentSelect" customModule="KMComponentLibrary">
-                                                <rect key="frame" x="0.0" y="0.0" width="168" height="32"/>
+                                                <rect key="frame" x="0.0" y="0.0" width="144" height="32"/>
                                                 <constraints>
-                                                    <constraint firstAttribute="width" constant="168" id="4jJ-hZ-qvK"/>
+                                                    <constraint firstAttribute="width" constant="144" id="4jJ-hZ-qvK"/>
                                                     <constraint firstAttribute="height" constant="32" id="TqS-dt-JgS"/>
                                                 </constraints>
                                             </customView>
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="Btz-lC-Xbq" customClass="ComponentSelect" customModule="KMComponentLibrary">
-                                                <rect key="frame" x="176" y="0.0" width="56" height="32"/>
+                                                <rect key="frame" x="152" y="0.0" width="80" height="32"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="32" id="Dbb-UM-GgB"/>
-                                                    <constraint firstAttribute="width" constant="56" id="ijT-CL-R4L"/>
+                                                    <constraint firstAttribute="width" constant="80" id="ijT-CL-R4L"/>
                                                 </constraints>
                                             </customView>
                                         </subviews>

+ 2 - 2
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -3296,8 +3296,8 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "2043"
             endingLineNumber = "2043"
-            landmarkName = "KMMainViewController"
-            landmarkType = "21">
+            landmarkName = "pdfViewEditingDoubleClick(_:imageArea:)"
+            landmarkType = "7">
             <Locations>
                <Location
                   uuid = "BACB85CB-4643-458B-8AE5-1F468C92C60D - 680781a5883eb184"