Browse Source

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

dinglingui 2 months ago
parent
commit
b90ac504e3

+ 68 - 35
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Measure/KMMeasureController.swift

@@ -8,13 +8,6 @@
 import Cocoa
 import KMComponentLibrary
 
-enum KMMeasureType: Int, CaseIterable {
-    case Line = 0
-    case Multi_line
-    case Polygon
-    case Rectangle
-}
-
 class KMMeasureController: NSViewController {
     
     @IBOutlet var typeSegmented: ComponentSegmented!
@@ -27,6 +20,8 @@ class KMMeasureController: NSViewController {
     @IBOutlet var fillColorGroup: ComponentCColorGroup!
     @IBOutlet var opacitySlider: ComponentSlider!
     @IBOutlet var opacitySelect: ComponentSelect!
+    @IBOutlet var colorBGViewHeightConst: NSLayoutConstraint!
+    @IBOutlet var opacityViewHeightConst: NSLayoutConstraint!
     
     //Line
     @IBOutlet var lineBGView: NSView!
@@ -37,6 +32,7 @@ class KMMeasureController: NSViewController {
     @IBOutlet var linedashInfoView: NSView!
     @IBOutlet var lineDashSlider: ComponentSlider!
     @IBOutlet var lineDashSelect: ComponentSelect!
+    @IBOutlet var lineBGViewHeightConst: NSLayoutConstraint!
     
     //Font
     @IBOutlet var fontBGView: NSView!
@@ -51,7 +47,6 @@ class KMMeasureController: NSViewController {
     @IBOutlet var displayLengthCheckBox: ComponentCheckBox!
     @IBOutlet var displayArea_CheckBox: ComponentCheckBox!
     
-    
     private let line_Property = ComponentSegmentedProperty(size: .s, active: false, iconImage: NSImage(named: "measure_line_gray"), iconImage_active: NSImage(named: "measure_line"))
     private let multiLine_Property = ComponentSegmentedProperty(size: .s, active: false, iconImage: NSImage(named: "measure_multiLine_gray"), iconImage_active: NSImage(named: "measure_multiLine"))
     private let polygon_Property = ComponentSegmentedProperty(size: .s, active: false, iconImage: NSImage(named: "measure_polygon_gray"), iconImage_active: NSImage(named: "measure_polygon"))
@@ -63,8 +58,8 @@ class KMMeasureController: NSViewController {
     private let dashProperty = ComponentCSelectorProperty.init(size: .s, state: .normal, text: "", iconImage: NSImage(named: "lineStyle_dash"))
     
     private var annotations: [CPDFFreeTextAnnotation] = []
-    
-    var measureType: KMMeasureType = .Line
+     
+    var annotationType: CAnnotationType = .measureLine
     
     var pdfView: CPDFListView?
     
@@ -231,14 +226,14 @@ class KMMeasureController: NSViewController {
         multiLine_Property.active = false
         polygon_Property.active = false
         rectangle_Property.active = false
-        
-        if measureType == .Line {
+         
+        if annotationType == .measureLine {
             line_Property.active = true
-        } else if measureType == .Multi_line {
+        } else if annotationType == .measurePolyLine {
             multiLine_Property.active = true
-        } else if measureType == .Polygon {
+        } else if annotationType == .measurePolyGon {
             polygon_Property.active = true
-        } else if measureType == .Rectangle {
+        } else if annotationType == .measureSquare {
             rectangle_Property.active = true
         }
         typeSegmented.reloadData()
@@ -292,22 +287,29 @@ class KMMeasureController: NSViewController {
             firstAnnotation = annotations.first
         }
         
-//        //Font
-//        var fontNameString: String?
-//        var fontStyleString: String?
-//        var fontSize: CGFloat?
-//        
-//        //Color
-//        var fontColor: NSColor?
-//        var borderColor: NSColor?
-//        var fillColor: NSColor?
-//        var opacity: CGFloat?
-//        
-//        //Line
-//        var lineStyle: CPDFBorderStyle?
-//        var lineWidth: CGFloat?
-//        var dashPattern: CGFloat?
-//        
+        //Color
+        var fontColor: NSColor?
+        var borderColor: NSColor?
+        var fillColor: NSColor?
+        var opacity: CGFloat?
+        
+        //Font
+        var fontNameString: String?
+        var fontStyleString: String?
+        var fontSize: CGFloat?
+        
+        //Line
+        var lineStyle: CPDFBorderStyle?
+        var lineWidth: CGFloat?
+        var dashPattern: CGFloat?
+        var startLineStyle = CPDFLineAnnotation.defaultArrow_StartLineStyle()
+        var endLineStyle = CPDFLineAnnotation.defaultArrow_EndLineStyle()
+        
+        //Display Label
+        var displayLength: Bool = false
+        var displayArea: Bool = false
+        
+  //
 //        if annotations.count == 0 {
 //            //Font
 //            fontNameString = CPDFFreeTextAnnotation.defaultFontName()
@@ -552,6 +554,36 @@ class KMMeasureController: NSViewController {
 //            lineDashSelect.resetText("-")
 //        }
         
+        //Color
+//        @IBOutlet var colorBGView: NSView!
+//        @IBOutlet var colorLabel: NSTextField!
+//        @IBOutlet var fontColorGroup: ComponentCColorGroup!
+//        @IBOutlet var borderColorGroup: ComponentCColorGroup!
+//        @IBOutlet var fillColorGroup: ComponentCColorGroup!
+//        @IBOutlet var opacitySlider: ComponentSlider!
+//        @IBOutlet var opacitySelect: ComponentSelect!
+//        @IBOutlet var colorBGViewHeightConst: NSLayoutConstraint!
+//        @IBOutlet var opacityViewHeightConst: NSLayoutConstraint!
+//
+//        //Line
+//        @IBOutlet var lineBGView: NSView!
+//        @IBOutlet var lineLabel: NSTextField!
+//        @IBOutlet var lineTypeSelector: ComponentCSelectorGroup!
+//        @IBOutlet var lineWidthSlider: ComponentSlider!
+//        @IBOutlet var lineWidthSelect: ComponentSelect!
+//        @IBOutlet var linedashInfoView: NSView!
+//        @IBOutlet var lineDashSlider: ComponentSlider!
+//        @IBOutlet var lineDashSelect: ComponentSelect!
+//        @IBOutlet var lineBGViewHeightConst: NSLayoutConstraint!
+//
+//        //Font
+//        @IBOutlet var fontBGView: NSView!
+//        @IBOutlet var fontLabel: NSTextField!
+//        @IBOutlet var fontNameSelect: ComponentSelect!
+//        @IBOutlet var fontStyleSelect: ComponentSelect!
+//        @IBOutlet var fontSizeSelect: ComponentSelect!
+//
+        
         
         
     }
@@ -694,14 +726,15 @@ extension KMMeasureController: ComponentCSelectorGroupDelegate {
 extension KMMeasureController: ComponentSegmentedDelegate {
     func componentSegmentedDidSelected(_ view: ComponentSegmented, item: ComponentSegmentedItem) {
         if item.properties == line_Property {
-            measureType = .Line
+            annotationType = .measureLine
         } else if item.properties == multiLine_Property {
-            measureType = .Multi_line
+            annotationType = .measurePolyLine
         } else if item.properties == polygon_Property {
-            measureType = .Polygon
+            annotationType = .measurePolyGon
         } else if item.properties == rectangle_Property {
-            measureType = .Rectangle
+            annotationType = .measureSquare
         }
+        
         reloadData()
     }
 }

+ 3 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Measure/KMMeasureController.xib

@@ -10,6 +10,7 @@
             <connections>
                 <outlet property="borderColorGroup" destination="a9a-PJ-4Td" id="yAg-Ji-Dtn"/>
                 <outlet property="colorBGView" destination="moc-e3-iov" id="KN8-sN-wVh"/>
+                <outlet property="colorBGViewHeightConst" destination="fBn-mF-b8z" id="gZ6-G0-ln6"/>
                 <outlet property="colorLabel" destination="HUW-YQ-eYX" id="wva-Ni-4AV"/>
                 <outlet property="displayArea_CheckBox" destination="ZaS-RE-wJS" id="aJn-fu-Ldn"/>
                 <outlet property="displayBGView" destination="YIb-gX-lur" id="L4K-fC-yPv"/>
@@ -23,6 +24,7 @@
                 <outlet property="fontSizeSelect" destination="2Pt-Pj-O42" id="5xs-w1-Aby"/>
                 <outlet property="fontStyleSelect" destination="3wR-it-IKE" id="4zM-G3-qV3"/>
                 <outlet property="lineBGView" destination="K7K-a3-aZr" id="YyA-WW-2wE"/>
+                <outlet property="lineBGViewHeightConst" destination="vKE-1F-QYu" id="Ha2-1O-fjU"/>
                 <outlet property="lineDashSelect" destination="nUG-xn-B8f" id="Q6w-BD-yNc"/>
                 <outlet property="lineDashSlider" destination="8Av-lC-XF8" id="gY7-6I-Hnm"/>
                 <outlet property="lineLabel" destination="omp-d0-Qii" id="QUh-IL-1Aq"/>
@@ -32,6 +34,7 @@
                 <outlet property="linedashInfoView" destination="gBk-8s-FgR" id="gvN-6B-dzj"/>
                 <outlet property="opacitySelect" destination="FQ5-7Z-Y91" id="aVG-UW-ARa"/>
                 <outlet property="opacitySlider" destination="SBZ-oI-zM3" id="6vf-P0-31Y"/>
+                <outlet property="opacityViewHeightConst" destination="9Xm-TI-Zo4" id="fiC-1N-rU6"/>
                 <outlet property="typeSegmented" destination="fq5-aJ-Npn" id="sFH-St-2oQ"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
             </connections>
@@ -180,7 +183,6 @@
                                         <constraint firstItem="kzR-hW-1k9" firstAttribute="centerY" secondItem="a9a-PJ-4Td" secondAttribute="centerY" id="UQW-Ix-cuF"/>
                                         <constraint firstAttribute="trailing" secondItem="66x-lq-wad" secondAttribute="trailing" id="WJF-WH-Q8m"/>
                                         <constraint firstItem="2XE-Pj-P5j" firstAttribute="centerY" secondItem="fk6-wE-F6y" secondAttribute="centerY" id="Whn-5o-GJG"/>
-                                        <constraint firstItem="66x-lq-wad" firstAttribute="top" secondItem="2XE-Pj-P5j" secondAttribute="bottom" constant="8" id="b2f-Fc-g5i"/>
                                         <constraint firstAttribute="trailing" secondItem="a9a-PJ-4Td" secondAttribute="trailing" id="cQ8-EP-DrB"/>
                                         <constraint firstItem="2XE-Pj-P5j" firstAttribute="leading" secondItem="moc-e3-iov" secondAttribute="leading" constant="24" id="enO-Le-6bk"/>
                                         <constraint firstAttribute="height" constant="192" id="fBn-mF-b8z"/>