|
@@ -181,7 +181,8 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
if self.fontNameVC!.items.contains(fontName) {
|
|
|
self.fontNameVC?.stringValue = fontName
|
|
|
} else {
|
|
|
- self.fontNameVC?.stringValue = "Helvetica"
|
|
|
+// self.fontNameVC?.stringValue = "Helvetica"
|
|
|
+ self.fontNameVC?.stringValue = fontName
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -332,7 +333,6 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
self.fontBoldVC?.image = NSImage(named: "KMImageNameEditPDFFontBold")!
|
|
|
self.fontBoldVC?.pagination()
|
|
|
self.fontBoldVC?.initDefaultValue()
|
|
|
- fontBoldVC?.state = .Act
|
|
|
|
|
|
self.fontItalicVC = KMDesignButton(withType: .Image)
|
|
|
self.fontItalicBox.contentView = self.fontItalicVC?.view
|
|
@@ -599,7 +599,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
} 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)
|
|
|
+ let font = self.listView.editingSelectionCFont(byRangeEdit: area)
|
|
|
self.fontNameVC?.stringValue = font?.familyName ?? ""
|
|
|
}
|
|
|
} else {
|
|
@@ -608,21 +608,34 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
|
|
|
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 ?? ""
|
|
|
+ if let styleName = self.listView.editingSelectionCFont(byRangeEdit: area)?.styleName, styleName.isEmpty == false {
|
|
|
+ self.fontStyleVC?.stringValue = styleName
|
|
|
+ } else {
|
|
|
+ self.fontStyleVC?.stringValue = "--"
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
self.fontStyleVC?.stringValue = "--"
|
|
|
}
|
|
|
|
|
|
if let data = self.handdler?.editAreasFontBoldIsEqual(), data {
|
|
|
- self.fontBoldVC?.state = .Act
|
|
|
+ if let area = self.handdler?.editingTextAreas.first {
|
|
|
+ let value = self.listView.isBoldCurrentSelection(byRangeEdit: area)
|
|
|
+ self.fontBoldVC?.state = value ? .Act : .Norm
|
|
|
+ } else {
|
|
|
+ self.fontBoldVC?.state = .Disabled
|
|
|
+ }
|
|
|
} else {
|
|
|
self.fontBoldVC?.state = .Disabled
|
|
|
}
|
|
|
|
|
|
if let data = self.handdler?.editAreasFontItalicIsEqual(), data {
|
|
|
- self.fontItalicVC?.state = .Act
|
|
|
+ if let area = self.handdler?.editingTextAreas.first {
|
|
|
+ let value = self.listView.isItalicCurrentSelection(byRangeEdit: area)
|
|
|
+ self.fontItalicVC?.state = value ? .Act : .Norm
|
|
|
+ } else {
|
|
|
+ self.fontItalicVC?.state = .Disabled
|
|
|
+ }
|
|
|
} else {
|
|
|
self.fontItalicVC?.state = .Disabled
|
|
|
}
|
|
@@ -632,10 +645,16 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
let data = self.listView.editingSelectionFontSize(with: area)
|
|
|
self.fontSizeVC?.stringValue = String(format: "%.0fpt", data)
|
|
|
}
|
|
|
+ self.fontAddVC?.state = .Norm
|
|
|
+ self.fontReduceVC?.state = .Norm
|
|
|
+ self.fontAddVC?.button.isEnabled = true
|
|
|
+ self.fontReduceVC?.button.isEnabled = true
|
|
|
} else {
|
|
|
self.fontSizeVC?.stringValue = "--"
|
|
|
self.fontAddVC?.state = .Disabled
|
|
|
self.fontReduceVC?.state = .Disabled
|
|
|
+ self.fontAddVC?.button.isEnabled = false
|
|
|
+ self.fontReduceVC?.button.isEnabled = false
|
|
|
}
|
|
|
|
|
|
if let data = self.handdler?.editAreasTextAlignmentIsEqual(), data {
|
|
@@ -712,17 +731,17 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
self.fontBoldVC?.state = .Act
|
|
|
}
|
|
|
|
|
|
- let idx = self.fontStyleVC?.indexOfSelectedItem ?? 0
|
|
|
- if idx == 0 {
|
|
|
- self.fontStyleVC?.selectItem(at: 1)
|
|
|
- } else if idx == 1 {
|
|
|
- self.fontStyleVC?.selectItem(at: 0)
|
|
|
- } else if idx == 2 {
|
|
|
- self.fontStyleVC?.selectItem(at: 3)
|
|
|
- } else if idx == 3 {
|
|
|
- self.fontStyleVC?.selectItem(at: 2)
|
|
|
- }
|
|
|
- self.km_comboBoxSelectionDidChange(self.fontStyleVC!)
|
|
|
+// let idx = self.fontStyleVC?.indexOfSelectedItem ?? 0
|
|
|
+// if idx == 0 {
|
|
|
+// self.fontStyleVC?.selectItem(at: 1)
|
|
|
+// } else if idx == 1 {
|
|
|
+// self.fontStyleVC?.selectItem(at: 0)
|
|
|
+// } else if idx == 2 {
|
|
|
+// self.fontStyleVC?.selectItem(at: 3)
|
|
|
+// } else if idx == 3 {
|
|
|
+// self.fontStyleVC?.selectItem(at: 2)
|
|
|
+// }
|
|
|
+// self.km_comboBoxSelectionDidChange(self.fontStyleVC!)
|
|
|
}
|
|
|
|
|
|
@objc func fontItalicAction(_ sender: AnyObject) {
|
|
@@ -736,17 +755,17 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
self.fontItalicVC?.state = .Act
|
|
|
}
|
|
|
|
|
|
- let idx = self.fontStyleVC?.indexOfSelectedItem ?? 0
|
|
|
- if idx == 0 {
|
|
|
- self.fontStyleVC?.selectItem(at: 2)
|
|
|
- } else if idx == 1 {
|
|
|
- self.fontStyleVC?.selectItem(at: 3)
|
|
|
- } else if idx == 2 {
|
|
|
- self.fontStyleVC?.selectItem(at: 0)
|
|
|
- } else if idx == 3 {
|
|
|
- self.fontStyleVC?.selectItem(at: 1)
|
|
|
- }
|
|
|
- self.km_comboBoxSelectionDidChange(self.fontStyleVC!)
|
|
|
+// let idx = self.fontStyleVC?.indexOfSelectedItem ?? 0
|
|
|
+// if idx == 0 {
|
|
|
+// self.fontStyleVC?.selectItem(at: 2)
|
|
|
+// } else if idx == 1 {
|
|
|
+// self.fontStyleVC?.selectItem(at: 3)
|
|
|
+// } else if idx == 2 {
|
|
|
+// self.fontStyleVC?.selectItem(at: 0)
|
|
|
+// } else if idx == 3 {
|
|
|
+// self.fontStyleVC?.selectItem(at: 1)
|
|
|
+// }
|
|
|
+// self.km_comboBoxSelectionDidChange(self.fontStyleVC!)
|
|
|
}
|
|
|
|
|
|
@objc func fontAddAction(_ sender: AnyObject) {
|
|
@@ -923,6 +942,10 @@ extension KMEditPDFTextPropertyViewController: KMSelectPopButtonDelegate {
|
|
|
} else if obj == fontNameVC {
|
|
|
self.updateFontNameAndStyle(name: obj.stringValue, style: fontStyle)
|
|
|
self.updatePreviewImage()
|
|
|
+ let win = KMEditPDFPopToolBarWindow.shared
|
|
|
+ if win.isVisible {
|
|
|
+ (win.contentViewController as? KMEditPDFPopToolBarController)?.toolbarView?.reloadData()
|
|
|
+ }
|
|
|
} else if obj == fontSizeVC {
|
|
|
let size = CGFloat(Float((obj.stringValue.replacingOccurrences(of: "pt", with: "")))!)
|
|
|
self.updateFontSize(size: size)
|
|
@@ -1057,6 +1080,7 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
self.fontStyleVC?.selectItem(at: 0)
|
|
|
styleString = KMEditPDFTextManager.manager.checkFontStyle(style: self.fontStyleVC!.stringValue)
|
|
|
} else {
|
|
|
+ self.fontStyleVC?.addItems(withObjectValues: fontStyleNames)
|
|
|
self.fontStyleVC?.selectItem(at: fontStyleNames.firstIndex(of: style) ?? 0)
|
|
|
}
|
|
|
|
|
@@ -1148,11 +1172,11 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
}
|
|
|
}
|
|
|
if !hasBold {
|
|
|
- self.fontBoldVC?.state = .Disabled
|
|
|
+// self.fontBoldVC?.state = .Disabled
|
|
|
return
|
|
|
}
|
|
|
let bold = fStyle.contains("Bold")
|
|
|
- self.fontBoldVC?.state = bold ? .Act : .Norm
|
|
|
+// self.fontBoldVC?.state = bold ? .Act : .Norm
|
|
|
}
|
|
|
|
|
|
private func _italicButtonStateUpdate(fontStyle fStyle: String) {
|
|
@@ -1165,12 +1189,12 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
}
|
|
|
}
|
|
|
if !hasItalic {
|
|
|
- self.fontItalicVC?.state = .Disabled
|
|
|
+// self.fontItalicVC?.state = .Disabled
|
|
|
return
|
|
|
}
|
|
|
|
|
|
let italic = fStyle.contains("Italic") || fStyle.contains("Oblique")
|
|
|
- self.fontItalicVC?.state = italic ? .Act : .Norm
|
|
|
+// self.fontItalicVC?.state = italic ? .Act : .Norm
|
|
|
}
|
|
|
|
|
|
//MARK: 刷新预览图片
|