|
@@ -204,6 +204,8 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ var handdler: KMEditPDfHanddler?
|
|
|
+
|
|
|
deinit {
|
|
|
KMPrint("KMEditPDFTextPropertyViewController 已释放.")
|
|
|
NSColorPanel.shared.setTarget(nil)
|
|
@@ -341,7 +343,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
self.fontItalicVC?.pagination()
|
|
|
self.fontItalicVC?.initDefaultValue()
|
|
|
|
|
|
- fontSizeVC = KMDesignSelect.init(withType: .PopButton)
|
|
|
+ fontSizeVC = KMDesignSelect.init(withType: .Combox)
|
|
|
fontSizeBox.contentView = fontSizeVC?.view
|
|
|
fontSizeBox.fillColor = NSColor.clear
|
|
|
fontSizeVC?.removeAllItems()
|
|
@@ -359,6 +361,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
fontSizeVC?.popViewControllerTextColor = KMAppearance.Layout.h0Color()
|
|
|
fontSizeVC?.popViewControllerEnterFillColor = KMAppearance.Interactive.s0Color()
|
|
|
fontSizeVC?.updateUI()
|
|
|
+ self.fontSizeVC?.editable = true
|
|
|
|
|
|
self.fontAddVC = KMDesignButton(withType: .Image)
|
|
|
self.fontAddBox.contentView = self.fontAddVC?.view
|
|
@@ -589,6 +592,55 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
sliderView?.doubleValue = Double(opacity)
|
|
|
self.opacitVC?.stringValue = String(format: "%0.f%%", opacity*100)
|
|
|
}
|
|
|
+ } else if self.selectAreas.count > 1 {
|
|
|
+ if let data = self.handdler?.editAreasFontNameIsEqual(), data {
|
|
|
+ if let area = self.handdler?.editingTextAreas.first {
|
|
|
+ let font = self.listView.editingSelectionCFont(with: area)
|
|
|
+ self.fontNameVC?.stringValue = font?.familyName ?? ""
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ self.fontNameVC?.stringValue = "--"
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = self.handdler?.editAreasFontStyleIsEqual(), data {
|
|
|
+ if let area = self.handdler?.editingTextAreas.first {
|
|
|
+ let font = self.listView.editingSelectionCFont(with: area)
|
|
|
+ self.fontStyleVC?.stringValue = font?.styleName ?? ""
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ self.fontStyleVC?.stringValue = "--"
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = self.handdler?.editAreasFontBoldIsEqual(), data {
|
|
|
+ self.fontBoldVC?.state = .Act
|
|
|
+ } else {
|
|
|
+ self.fontBoldVC?.state = .Disabled
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = self.handdler?.editAreasFontItalicIsEqual(), data {
|
|
|
+ self.fontItalicVC?.state = .Act
|
|
|
+ } else {
|
|
|
+ self.fontItalicVC?.state = .Disabled
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = self.handdler?.editAreasFontSizeIsEqual(), data {
|
|
|
+ if let area = self.handdler?.editingTextAreas.first {
|
|
|
+ let data = self.listView.editingSelectionFontSize(with: area)
|
|
|
+ self.fontSizeVC?.stringValue = String(format: "%.0fpt", data)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ self.fontSizeVC?.stringValue = "--"
|
|
|
+ self.fontAddVC?.state = .Disabled
|
|
|
+ self.fontReduceVC?.state = .Disabled
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = self.handdler?.editAreasTextAlignmentIsEqual(), data {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ self.leftAlignmentVC?.state = .Disabled
|
|
|
+ self.centerAlignmentVC?.state = .Disabled
|
|
|
+ self.rightAlignmentVC?.state = .Disabled
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -879,6 +931,23 @@ extension KMEditPDFTextPropertyViewController: KMSelectPopButtonDelegate {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func km_controlTextDidChange(_ obj: KMDesignSelect) {
|
|
|
+ if obj == self.fontSizeVC {
|
|
|
+ let format = NumberFormatter()
|
|
|
+ format.numberStyle = .decimal
|
|
|
+ let size = Float((obj.stringValue.replacingOccurrences(of: "pt", with: ""))) ?? 0
|
|
|
+ self.fontSizeVC?.stringValue = format.string(from: NSNumber(value: size)) ?? ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func km_controlTextDidEndEditing(_ obj: KMDesignSelect) {
|
|
|
+ if obj == self.fontSizeVC {
|
|
|
+ let size = CGFloat(Float((obj.stringValue.replacingOccurrences(of: "pt", with: ""))) ?? 12)
|
|
|
+ self.fontSizeVC?.stringValue = String(format: "%.0fpt", size)
|
|
|
+ self.updateFontSize(size: size)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
func km_cellViewWillShow(_ obj: KMDesignSelect, _ cellView: KMBox, _ index: Int) {
|
|
|
if obj.isEqual(to: self.textPresuppositionVC) == false {
|
|
|
return
|