|
@@ -264,7 +264,27 @@ class KMEditPDFToolbarView: NSView {
|
|
|
|
|
|
let contentViewC = (self.contentViewController as? KMEditPDFPopToolBarController)
|
|
let contentViewC = (self.contentViewController as? KMEditPDFPopToolBarController)
|
|
|
|
|
|
- contentViewC?.itemKeys = [.color, .fontStyle, .fontAdd, .fontReduce, .fontBold, .fontItalic]
|
|
|
|
|
|
+ if self.style.contains(.text) {
|
|
|
|
+ if self.style.contains(.image) { // text + image
|
|
|
|
+ contentViewC?.itemKeys = [.alignmentLeft, .alignmentCenterX, .alignmentRight, .alignmentjustifiedX, .alignmentTop, .alignmentCenterY, .alignmentBottom, .alignmentjustifiedY]
|
|
|
|
+ } else { // text
|
|
|
|
+ if self.isMultiple {
|
|
|
|
+ contentViewC?.itemKeys = [.color, .fontStyle, .fontAdd, .fontReduce, .fontBold, .fontItalic, .textAlignment, .alignmentLeft, .alignmentTop]
|
|
|
|
+ } else {
|
|
|
|
+ contentViewC?.itemKeys = [.color, .fontStyle, .fontAdd, .fontReduce, .fontBold, .fontItalic, .textAlignment]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if self.style.contains(.image) { // image
|
|
|
|
+ if self.isMultiple {
|
|
|
|
+ contentViewC?.itemKeys = [.leftRotate, .rightRotate, .reverseX, .reverseY, .crop, .replace, .export, .alignmentLeft, .alignmentTop]
|
|
|
|
+ } else {
|
|
|
|
+ contentViewC?.itemKeys = [.leftRotate, .rightRotate, .reverseX, .reverseY, .crop, .replace, .export]
|
|
|
|
+ }
|
|
|
|
+ } else { // none
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
override var isMainWindow: Bool {
|
|
override var isMainWindow: Bool {
|
|
@@ -355,6 +375,42 @@ extension KMEditPDFPopToolBarController: KMEditPDFToolbarViewDelegate {
|
|
viewC.image = NSImage(named: "KMImageNameEditPDFFontBold")!
|
|
viewC.image = NSImage(named: "KMImageNameEditPDFFontBold")!
|
|
} else if itemKey == .fontItalic {
|
|
} else if itemKey == .fontItalic {
|
|
viewC.image = NSImage(named: "KMImageNameEditPDFFontItalic")!
|
|
viewC.image = NSImage(named: "KMImageNameEditPDFFontItalic")!
|
|
|
|
+ } else if itemKey == .textAlignment {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFAlignCenterSelect")!
|
|
|
|
+ }
|
|
|
|
+ // 图片
|
|
|
|
+ else if itemKey == .leftRotate {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFRotationLeft")!
|
|
|
|
+ } else if itemKey == .rightRotate {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFRotationRight")!
|
|
|
|
+ } else if itemKey == .reverseX {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFReverseX")!
|
|
|
|
+ } else if itemKey == .reverseY {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFReverseY")!
|
|
|
|
+ } else if itemKey == .crop {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFCrop")!
|
|
|
|
+ } else if itemKey == .replace {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFReplace")!
|
|
|
|
+ } else if itemKey == .export {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFExport")!
|
|
|
|
+ }
|
|
|
|
+ // 对齐
|
|
|
|
+ else if itemKey == .alignmentLeft {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFImage45_1")!
|
|
|
|
+ } else if itemKey == .alignmentCenterX {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFImage46_1")!
|
|
|
|
+ } else if itemKey == .alignmentRight {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFImage47_1")!
|
|
|
|
+ } else if itemKey == .alignmentjustifiedX {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFImage21_1")!
|
|
|
|
+ } else if itemKey == .alignmentTop {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFImage48_1")!
|
|
|
|
+ } else if itemKey == .alignmentCenterY {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFImage49_1")!
|
|
|
|
+ } else if itemKey == .alignmentBottom {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFImage50_1")!
|
|
|
|
+ } else if itemKey == .alignmentjustifiedY {
|
|
|
|
+ viewC.image = NSImage(named: "KMImageNameEditPDFImage20_1")!
|
|
}
|
|
}
|
|
return colorView
|
|
return colorView
|
|
}
|
|
}
|