|
@@ -229,11 +229,18 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
}
|
|
|
|
|
|
@objc func backgroundMenuAction(sender: KMToolbarClickButton) {
|
|
|
- self.delegate?.toolbarViewController?(self, clickChaildToolType: .background, toolbar: sender.clickObject as! KMToolbarItemView)
|
|
|
+ self._currentItemView = sender.clickObject as? KMToolbarItemView
|
|
|
+ if let subMenu = (sender.clickObject as? KMToolbarItemView)?.menuFormRepresentation?.submenu {
|
|
|
+ subMenu.popUp(positioning: nil, at: sender.frame.origin, in: sender.superview)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @objc private func _backgroundAction(sender: NSMenuItem) {
|
|
|
+ if let data = self._currentItemView {
|
|
|
+ self.delegate?.toolbarViewController?(self, menuItemDidClick: data, index: sender.tag, info: nil)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@objc func watermarkMenuAction(sender: KMToolbarClickButton) {
|
|
|
-// self.delegate?.toolbarViewController?(self, clickChaildToolType: .watermark, toolbar: sender.clickObject as! KMToolbarItemView)
|
|
|
self._currentItemView = sender.clickObject as? KMToolbarItemView
|
|
|
if let subMenu = (sender.clickObject as? KMToolbarItemView)?.menuFormRepresentation?.submenu {
|
|
|
subMenu.popUp(positioning: nil, at: sender.frame.origin, in: sender.superview)
|
|
@@ -1417,10 +1424,17 @@ extension KMToolbarViewController {
|
|
|
item?.btnTag = KMToolbarType.background.rawValue
|
|
|
item?.toolTip = NSLocalizedString("Insert PDF page background by color or image", comment: "")
|
|
|
item?.titleName = NSLocalizedString("Backgroud", comment: "")
|
|
|
- item?.boxImagePosition = .imageLeft
|
|
|
+ item?.boxImagePosition = .imageExpandLeft
|
|
|
item?.btnAction = #selector(backgroundMenuAction)
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: "Backgroud", action: #selector(backgroundMenuAction), target: self)
|
|
|
+ let subMenu = NSMenu()
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Add Background", comment: ""), action: #selector(_backgroundAction), target: self, tag: 1)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Remove Background", comment: ""), action: #selector(_backgroundAction), target: self, tag: 2)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Batch Add Background", comment: ""), action: #selector(_backgroundAction), target: self, tag: 3)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Batch Remove Background", comment: ""), action: #selector(_backgroundAction), target: self, tag: 4)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Manage Templates", comment: ""), action: #selector(_backgroundAction), target: self, tag: 5)
|
|
|
+ menuItem.submenu = subMenu
|
|
|
item?.menuFormRepresentation = menuItem
|
|
|
} else if identifier == KMToolbarToolWatermarkItemIdentifier {
|
|
|
item?.image = NSImage(named: "KMImageNameMainToolsWatermark")
|