|
@@ -59,6 +59,7 @@ import Cocoa
|
|
|
class KMEditPDFToolbarModel: NSObject {
|
|
|
var itemKey: KMEditPDFToolbarItemKey = .none
|
|
|
var isEnabled = true
|
|
|
+ var isSelected = false
|
|
|
|
|
|
var fontName: String?
|
|
|
var state: NSControl.StateValue = .mixed
|
|
@@ -157,6 +158,15 @@ class KMEditPDFPopToolBarController: NSViewController {
|
|
|
let key = self.itemKeys[idx]
|
|
|
self.itemClick?(key, nil)
|
|
|
|
|
|
+ let itemView = (self.toolbarView?.itemViews.safe_element(for: idx) as? KMEditPDFToolbarItemView)
|
|
|
+ let viewC = (itemView?.obj as? KMDesignButton)
|
|
|
+ let state = viewC?.state ?? .None
|
|
|
+ if state == .Act {
|
|
|
+ viewC?.state = .Norm
|
|
|
+ } else {
|
|
|
+ viewC?.state = .Act
|
|
|
+ }
|
|
|
+
|
|
|
self._trackEvent(key: key, style: self._fetchStyle())
|
|
|
}
|
|
|
}
|
|
@@ -517,9 +527,20 @@ extension KMEditPDFPopToolBarController: KMEditPDFToolbarViewDelegate {
|
|
|
colorView.popToolTip = NSLocalizedString("Bold font", comment: "")
|
|
|
// viewC.button.keyEquivalent = "b"
|
|
|
// viewC.button.keyEquivalentModifierMask = [.control]
|
|
|
+ viewC.initDefaultValue()
|
|
|
+ viewC.borderWidth = 0
|
|
|
+ viewC.borderWidth_hov = 0
|
|
|
+ viewC.borderWidth_act = 0
|
|
|
+ viewC.state = model.isSelected ? .Act : .Norm
|
|
|
} else if itemKey == .fontItalic {
|
|
|
viewC.image = NSImage(named: "KMImageNameEditPDFFontItalic")!
|
|
|
colorView.popToolTip = NSLocalizedString("Italic font", comment: "")
|
|
|
+
|
|
|
+ viewC.initDefaultValue()
|
|
|
+ viewC.borderWidth = 0
|
|
|
+ viewC.borderWidth_hov = 0
|
|
|
+ viewC.borderWidth_act = 0
|
|
|
+ viewC.state = model.isSelected ? .Act : .Norm
|
|
|
} else if itemKey == .textAlignment {
|
|
|
viewC.image = NSImage(named: "KMImageNameEditPDFAlignCenterSelect")!
|
|
|
colorView.popToolTip = NSLocalizedString("Center text", comment: "")
|