|
@@ -36,6 +36,8 @@ class KMEditPDFToolbarItemView: NSView {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ var obj: AnyObject?
|
|
|
|
+
|
|
convenience init() {
|
|
convenience init() {
|
|
self.init(frame: .zero)
|
|
self.init(frame: .zero)
|
|
self.addSubview(self.contentBox_)
|
|
self.addSubview(self.contentBox_)
|
|
@@ -88,6 +90,7 @@ class KMEditPDFColorView: NSView {
|
|
view.wantsLayer = true
|
|
view.wantsLayer = true
|
|
view.layer?.cornerRadius = 10
|
|
view.layer?.cornerRadius = 10
|
|
view.layer?.masksToBounds = true
|
|
view.layer?.masksToBounds = true
|
|
|
|
+ view.image = NSImage(named: NSImage.colorPanelName)
|
|
return view
|
|
return view
|
|
}()
|
|
}()
|
|
|
|
|
|
@@ -182,11 +185,12 @@ class KMEditPDFToolbarView: NSView {
|
|
let leftMargin = self.inset.left
|
|
let leftMargin = self.inset.left
|
|
let topMargin = self.inset.top
|
|
let topMargin = self.inset.top
|
|
var x = leftMargin
|
|
var x = leftMargin
|
|
|
|
+ let vSpace: CGFloat = 2
|
|
for (i, sv) in self.subviews.enumerated() {
|
|
for (i, sv) in self.subviews.enumerated() {
|
|
if let size = self.delegate?.toolbarView?(self, sizeForItemAt: i) {
|
|
if let size = self.delegate?.toolbarView?(self, sizeForItemAt: i) {
|
|
let y = topMargin
|
|
let y = topMargin
|
|
var frame = NSRect(x: x, y: y, width: size.width, height: size.height)
|
|
var frame = NSRect(x: x, y: y, width: size.width, height: size.height)
|
|
- x += size.width
|
|
|
|
|
|
+ x += (size.width + vSpace)
|
|
sv.frame = frame
|
|
sv.frame = frame
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -277,6 +281,10 @@ class KMEditPDFPopToolBarController: NSViewController {
|
|
|
|
|
|
toolbarView.reloadData()
|
|
toolbarView.reloadData()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @objc func _nextButtonAction(_ sender: AnyObject) {
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
extension KMEditPDFPopToolBarController: KMEditPDFToolbarViewDelegate {
|
|
extension KMEditPDFPopToolBarController: KMEditPDFToolbarViewDelegate {
|
|
@@ -292,14 +300,34 @@ extension KMEditPDFPopToolBarController: KMEditPDFToolbarViewDelegate {
|
|
colorView.view = view
|
|
colorView.view = view
|
|
return colorView
|
|
return colorView
|
|
} else if itemKey == .fontStyle {
|
|
} else if itemKey == .fontStyle {
|
|
- let colorView = KMEditPDFToolbarItemView()
|
|
|
|
- colorView.wantsLayer = true
|
|
|
|
- colorView.layer?.backgroundColor = NSColor.blue.cgColor
|
|
|
|
- return colorView
|
|
|
|
|
|
+ let fontStyleView = KMEditPDFToolbarItemView()
|
|
|
|
+
|
|
|
|
+ let viewC = KMDesignSelect.init(withType: .PopButton)
|
|
|
|
+ fontStyleView.view = viewC.view
|
|
|
|
+ fontStyleView.obj = viewC
|
|
|
|
+
|
|
|
|
+ viewC.removeAllItems()
|
|
|
|
+ viewC.addItems(withObjectValues: ["1pt", "2pt", "4pt", "6pt", "8pt"])
|
|
|
|
+ viewC.selectItem(at: 0)
|
|
|
|
+ viewC.delete = self
|
|
|
|
+ return fontStyleView
|
|
}
|
|
}
|
|
let colorView = KMEditPDFToolbarItemView()
|
|
let colorView = KMEditPDFToolbarItemView()
|
|
- colorView.wantsLayer = true
|
|
|
|
- colorView.layer?.backgroundColor = NSColor.green.cgColor
|
|
|
|
|
|
+ let viewC = KMDesignButton(withType: .Image)
|
|
|
|
+ colorView.view = viewC.view
|
|
|
|
+ colorView.obj = viewC
|
|
|
|
+ viewC.pagination()
|
|
|
|
+ viewC.target = self
|
|
|
|
+ viewC.action = #selector(_nextButtonAction)
|
|
|
|
+ if itemKey == .fontAdd {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFFontAdd")!
|
|
|
|
+ } else if itemKey == .fontReduce {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFFontReduce")!
|
|
|
|
+ } else if itemKey == .fontBold {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFFontBold")!
|
|
|
|
+ } else if itemKey == .fontItalic {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFFontItalic")!
|
|
|
|
+ }
|
|
return colorView
|
|
return colorView
|
|
}
|
|
}
|
|
|
|
|
|
@@ -313,3 +341,38 @@ extension KMEditPDFPopToolBarController: KMEditPDFToolbarViewDelegate {
|
|
return NSMakeSize(32, 32)
|
|
return NSMakeSize(32, 32)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+extension KMEditPDFPopToolBarController: KMSelectPopButtonDelegate {
|
|
|
|
+ func km_comboBoxSelectionDidChange(_ obj: KMDesignSelect) {
|
|
|
|
+// if (self.lineWidthVC == obj) {
|
|
|
|
+// let index = self.lineWidthVC.indexOfSelectedItem
|
|
|
|
+// if index < 0 {
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// let width = self.lineWidthVC.stringValue.replacingOccurrences(of: "pt", with: "")
|
|
|
|
+// if annotationModel.stampAnnotationType() == .signDot {
|
|
|
|
+// annotationModel.setNoteWidth(CGFloat(width.stringToCGFloat())*5)
|
|
|
|
+// annotationModel.setNoteHeight(CGFloat(width.stringToCGFloat())*5)
|
|
|
|
+// } else {
|
|
|
|
+// annotationModel.setLineWidth(width.stringToCGFloat())
|
|
|
|
+// }
|
|
|
|
+// } else if (self.opacityVC == obj) {
|
|
|
|
+// let index = self.opacityVC.indexOfSelectedItem
|
|
|
|
+// if index < 0 {
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// let opacity = self.opacityVC.stringValue.replacingOccurrences(of: "%", with: "")
|
|
|
|
+// self.opacitySlider.floatValue = Float(opacity.stringToCGFloat()/100)
|
|
|
|
+// annotationModel.setOpacity(opacity.stringToCGFloat()/100)
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// refreshUI()
|
|
|
|
+// updateAnnotation()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func km_controlTextDidEndEditing(_ obj: KMDesignSelect) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|