|
@@ -1510,6 +1510,8 @@ extension KMMainViewController {
|
|
|
KMPrintWindowController.printImage(image: image)
|
|
|
}
|
|
|
|
|
|
+ // MARK: - Measure
|
|
|
+
|
|
|
@objc func menuItemActionMeasureProperty(sender: NSMenuItem) {
|
|
|
guard let anno = sender.representedObject as? CPDFAnnotation else {
|
|
|
return
|
|
@@ -1540,9 +1542,14 @@ extension KMMainViewController {
|
|
|
}
|
|
|
|
|
|
self.listView.updateActiveAnnotations([anno])
|
|
|
- self.pdfListViewAnnotationMeasureInfoChange(self.listView, with: anno)
|
|
|
- self.pdfListViewChangeatioActiveAnnotations(self.listView, forActiveAnnotations: [anno], isRightMenu: false)
|
|
|
self.listView.setNeedsDisplayForVisiblePages()
|
|
|
+ if let data = anno as? CPDFLineAnnotation, data.isMeasure {
|
|
|
+ self.showMeasureDistanceSettingWindow(measureInfo: data.measureInfo)
|
|
|
+ } else if let data = anno as? CPDFPolylineAnnotation {
|
|
|
+ self.showMeasurePerimeterSettingWindow(measureInfo: data.measureInfo)
|
|
|
+ } else if let data = anno as? CPDFPolygonAnnotation {
|
|
|
+ self.showMeasureAreaSettingWindow(measureInfo: data.measureInfo)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@objc func menuItemActionMeasureDelete(sender: NSMenuItem) {
|
|
@@ -1553,6 +1560,42 @@ extension KMMainViewController {
|
|
|
self.listView.remove(anno)
|
|
|
}
|
|
|
|
|
|
+ func showMeasureDistanceSettingWindow(measureInfo: CPDFDistanceMeasureInfo?, hideInfoWindow: Bool = true) {
|
|
|
+ guard let mInfo = measureInfo else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let winC = CDistanceSettingWindowController(distanceMeasureInfo: mInfo)
|
|
|
+ if hideInfoWindow {
|
|
|
+ self.distanceMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
+ }
|
|
|
+ winC.delegate = self
|
|
|
+ winC.startModal("")
|
|
|
+ }
|
|
|
+
|
|
|
+ func showMeasurePerimeterSettingWindow(measureInfo: CPDFPerimeterMeasureInfo?, hideInfoWindow: Bool = true) {
|
|
|
+ guard let mInfo = measureInfo else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let winC = CDistanceSettingWindowController(perimeterMeasureInfo: mInfo)
|
|
|
+ if hideInfoWindow {
|
|
|
+ self.perimeterMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
+ }
|
|
|
+ winC.delegate = self
|
|
|
+ winC.startModal("")
|
|
|
+ }
|
|
|
+
|
|
|
+ func showMeasureAreaSettingWindow(measureInfo: CPDFAreaMeasureInfo?, hideInfoWindow: Bool = true) {
|
|
|
+ guard let mInfo = measureInfo else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let winC = CAreaSettingWindowController(measureInfo: mInfo)
|
|
|
+ if hideInfoWindow {
|
|
|
+ self.areaMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
+ }
|
|
|
+ winC.delegate = self
|
|
|
+ winC.startModal("")
|
|
|
+ }
|
|
|
+
|
|
|
func splitView(withTag tag: Int) {
|
|
|
if tag == 0 {
|
|
|
self.listView.viewSplitMode = KMPDFViewSplitMode.horizontal
|