|
@@ -59,8 +59,9 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
@IBOutlet weak var areasTopButton: NSButton!
|
|
@IBOutlet weak var areasTopButton: NSButton!
|
|
@IBOutlet weak var areasRightButton: NSButton!
|
|
@IBOutlet weak var areasRightButton: NSButton!
|
|
|
|
|
|
- var textPresuppositionVC: KMDesignPropertySelector?
|
|
|
|
- var textPresuppositionResetVC: KMDesignSelect?
|
|
|
|
|
|
+ var textPresuppositionVC: KMDesignSelect?
|
|
|
|
+ var textPresuppositionResetVC: KMDesignPropertySelector?
|
|
|
|
+ var textPresuppositionResetString: String = ""
|
|
|
|
|
|
var leftAlignmentVC: KMDesignPropertySelector?
|
|
var leftAlignmentVC: KMDesignPropertySelector?
|
|
var centerAlignmentVC: KMDesignPropertySelector?
|
|
var centerAlignmentVC: KMDesignPropertySelector?
|
|
@@ -103,9 +104,13 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
}
|
|
}
|
|
|
|
|
|
func setup() {
|
|
func setup() {
|
|
|
|
+
|
|
|
|
+ //
|
|
|
|
+ self.fontColorButton.border(NSColor.clear, 0, 10)
|
|
//alignment
|
|
//alignment
|
|
leftAlignmentVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
|
|
leftAlignmentVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
|
|
leftAlignmentBox.contentView = leftAlignmentVC?.view
|
|
leftAlignmentBox.contentView = leftAlignmentVC?.view
|
|
|
|
+ leftAlignmentBox.fillColor = NSColor.clear
|
|
leftAlignmentVC?.target = self
|
|
leftAlignmentVC?.target = self
|
|
leftAlignmentVC?.action = #selector(leftAlignmentAction)
|
|
leftAlignmentVC?.action = #selector(leftAlignmentAction)
|
|
leftAlignmentVC?.image = NSImage(named: "KMImageNameEditPDFAlignLeft")!
|
|
leftAlignmentVC?.image = NSImage(named: "KMImageNameEditPDFAlignLeft")!
|
|
@@ -113,6 +118,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
|
|
|
centerAlignmentVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
|
|
centerAlignmentVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
|
|
centerAlignmentBox.contentView = centerAlignmentVC?.view
|
|
centerAlignmentBox.contentView = centerAlignmentVC?.view
|
|
|
|
+ centerAlignmentBox.fillColor = NSColor.clear
|
|
centerAlignmentVC?.target = self
|
|
centerAlignmentVC?.target = self
|
|
centerAlignmentVC?.action = #selector(centerAlignmentAction)
|
|
centerAlignmentVC?.action = #selector(centerAlignmentAction)
|
|
centerAlignmentVC?.image = NSImage(named: "KMImageNameEditPDFAlignCenter")!
|
|
centerAlignmentVC?.image = NSImage(named: "KMImageNameEditPDFAlignCenter")!
|
|
@@ -120,6 +126,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
|
|
|
rightAlignmentVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
|
|
rightAlignmentVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
|
|
rightAlignmentBox.contentView = rightAlignmentVC?.view
|
|
rightAlignmentBox.contentView = rightAlignmentVC?.view
|
|
|
|
+ rightAlignmentBox.fillColor = NSColor.clear
|
|
rightAlignmentVC?.target = self
|
|
rightAlignmentVC?.target = self
|
|
rightAlignmentVC?.action = #selector(rightAlignmentAction)
|
|
rightAlignmentVC?.action = #selector(rightAlignmentAction)
|
|
rightAlignmentVC?.image = NSImage(named: "KMImageNameEditPDFAlignRight")!
|
|
rightAlignmentVC?.image = NSImage(named: "KMImageNameEditPDFAlignRight")!
|
|
@@ -143,7 +150,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
if fontNames.last == "Regular" {
|
|
if fontNames.last == "Regular" {
|
|
font = NSFont.init(name: fontNames.first!, size: currentFont.pointSize)!
|
|
font = NSFont.init(name: fontNames.first!, size: currentFont.pointSize)!
|
|
} else {
|
|
} else {
|
|
- font = NSFont.init(name: currentFont.fontName, size: currentFont.pointSize)!
|
|
|
|
|
|
+ font = NSFont.init(name: "Helvetica-Bold", size: currentFont.pointSize)!
|
|
}
|
|
}
|
|
|
|
|
|
var styleArray: [String] = []
|
|
var styleArray: [String] = []
|
|
@@ -165,6 +172,21 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
fontSizeVC?.addItems(withObjectValues: self.supportFontSize())
|
|
fontSizeVC?.addItems(withObjectValues: self.supportFontSize())
|
|
fontSizeVC?.selectItem(at: 0)
|
|
fontSizeVC?.selectItem(at: 0)
|
|
fontSizeVC?.delete = self
|
|
fontSizeVC?.delete = self
|
|
|
|
+
|
|
|
|
+ //textPresupposition
|
|
|
|
+ let textPresuppositionArray = ["Customize", "H1 Headline", "H2 Title", "H3 Subtitle", "B1 Text", "B2 Small Text", "B3 Describtion"]
|
|
|
|
+ textPresuppositionVC = KMDesignSelect.init(withType: .PopButton)
|
|
|
|
+ textPresuppositionBox.contentView = textPresuppositionVC?.view
|
|
|
|
+ textPresuppositionVC?.addItems(withObjectValues: textPresuppositionArray)
|
|
|
|
+ textPresuppositionVC?.selectItem(at: 0)
|
|
|
|
+ textPresuppositionVC?.delete = self
|
|
|
|
+
|
|
|
|
+ textPresuppositionResetVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
|
|
|
|
+ resetTextPresuppositionBox.contentView = textPresuppositionResetVC?.view
|
|
|
|
+ resetTextPresuppositionBox.fillColor = NSColor.clear
|
|
|
|
+ textPresuppositionResetVC?.target = self
|
|
|
|
+ textPresuppositionResetVC?.action = #selector(resetTextPresuppositionButtonAction)
|
|
|
|
+ textPresuppositionResetVC?.image = NSImage(named: "KMImagePropertPanelTextDefaultMore")!
|
|
}
|
|
}
|
|
|
|
|
|
func initData() {
|
|
func initData() {
|
|
@@ -175,13 +197,13 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
let fontAlign : String = UserDefaults.standard.object(forKey: CEditPDFTextDefaultFontAlign) as? String ?? "2"
|
|
let fontAlign : String = UserDefaults.standard.object(forKey: CEditPDFTextDefaultFontAlign) as? String ?? "2"
|
|
self.fontNameVC!.stringValue = fontName
|
|
self.fontNameVC!.stringValue = fontName
|
|
self.fontStyleVC!.stringValue = fontStyle
|
|
self.fontStyleVC!.stringValue = fontStyle
|
|
- self.fontSizeVC!.stringValue = fontSize
|
|
|
|
|
|
+ self.fontSizeVC!.stringValue = fontSize + "pt"
|
|
self.alignment = NSTextAlignment.init(rawValue: Int(fontAlign)!)!
|
|
self.alignment = NSTextAlignment.init(rawValue: Int(fontAlign)!)!
|
|
self.currentColor = fontColor
|
|
self.currentColor = fontColor
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
NSColorPanel.shared.color = self.currentColor
|
|
NSColorPanel.shared.color = self.currentColor
|
|
}
|
|
}
|
|
- self.fontColorButton.image = self.swatchWithColor(color: self.currentColor, size: NSSize(width: 18, height: 18))
|
|
|
|
|
|
+ self.fontColorButton.image = self.swatchWithColor(color: self.currentColor, size: NSSize(width: 20, height: 20))
|
|
}
|
|
}
|
|
|
|
|
|
func updateUI() {
|
|
func updateUI() {
|
|
@@ -606,11 +628,40 @@ extension KMEditPDFTextPropertyViewController {
|
|
}
|
|
}
|
|
self.updataPreviewImage()
|
|
self.updataPreviewImage()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @objc func resetTextPresuppositionButtonAction(sender: NSButton) {
|
|
|
|
+ var popViewDataArr: [String] = []
|
|
|
|
+ for string in ["Redefine", "Reset"] {
|
|
|
|
+ popViewDataArr.append(NSLocalizedString(string, comment: ""))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let vc: KMHomePopViewController = KMHomePopViewController().initWithPopViewDataArr(popViewDataArr)
|
|
|
|
+ let createFilePopover: NSPopover = NSPopover.init()
|
|
|
|
+ createFilePopover.contentViewController = vc
|
|
|
|
+ createFilePopover.animates = true
|
|
|
|
+ createFilePopover.behavior = .semitransient
|
|
|
|
+ createFilePopover.setValue(true, forKey: "shouldHideAnchor")
|
|
|
|
+ createFilePopover.show(relativeTo: CGRect(x: sender.bounds.origin.x, y: -10, width: sender.bounds.size.width, height: sender.bounds.size.height), of: sender, preferredEdge: .maxY)
|
|
|
|
+
|
|
|
|
+// vc.customBoxWidthLayoutConstraint.constant = self.popWidth ?? sender.frame.width
|
|
|
|
+ vc.downCallback = { [weak self](downEntered: Bool, count: String) -> Void in
|
|
|
|
+ if downEntered {
|
|
|
|
+// if self != nil {
|
|
|
|
+// if self!.mouseDownAction != nil {
|
|
|
|
+// self!.mouseDownAction!(sender, count)
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ createFilePopover.close()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
extension KMEditPDFTextPropertyViewController: KMSelectPopButtonDelegate {
|
|
extension KMEditPDFTextPropertyViewController: KMSelectPopButtonDelegate {
|
|
func km_comboBoxSelectionDidChange(_ obj: KMDesignSelect) {
|
|
func km_comboBoxSelectionDidChange(_ obj: KMDesignSelect) {
|
|
-
|
|
|
|
|
|
+ if obj == textPresuppositionVC {
|
|
|
|
+ print("textPresuppositionVC")
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|