|
@@ -53,14 +53,65 @@ import Cocoa
|
|
|
if self.style.contains(.text) {
|
|
|
if self.style.contains(.image) { // text + image
|
|
|
contentViewC?.itemKeys = [.alignmentLeft, .alignmentCenterX, .alignmentRight, .alignmentjustifiedX, .alignmentTop, .alignmentCenterY, .alignmentBottom, .alignmentjustifiedY]
|
|
|
+ var datas: [KMEditPDFToolbarModel] = []
|
|
|
+ for key in contentViewC?.itemKeys ?? [] {
|
|
|
+ let model = KMEditPDFToolbarModel()
|
|
|
+ model.itemKey = key
|
|
|
+ datas.append(model)
|
|
|
+ }
|
|
|
+ contentViewC?.datas = datas
|
|
|
width = 320
|
|
|
} else { // text
|
|
|
if self.isMultiple {
|
|
|
width = 478
|
|
|
contentViewC?.itemKeys = [.color, .fontStyle, .fontAdd, .fontReduce, .fontBold, .fontItalic, .textAlignment, .separator, .alignmentLeft, .alignmentTop]
|
|
|
+ var datas: [KMEditPDFToolbarModel] = []
|
|
|
+ for key in contentViewC?.itemKeys ?? [] {
|
|
|
+ let model = KMEditPDFToolbarModel()
|
|
|
+ model.itemKey = key
|
|
|
+ if key == .color {
|
|
|
+ model.isEnabled = self.model.editAreasFontColorIsEqual()
|
|
|
+ } else if key == .fontStyle {
|
|
|
+ model.isEnabled = self.model.editAreasFontNameIsEqual()
|
|
|
+ } else if key == .fontAdd {
|
|
|
+ model.isEnabled = self.model.editAreasFontSizeIsEqual()
|
|
|
+ } else if key == .fontReduce {
|
|
|
+ model.isEnabled = self.model.editAreasFontSizeIsEqual()
|
|
|
+ } else if key == .fontBold {
|
|
|
+ model.isEnabled = self.model.editAreasFontBoldIsEqual()
|
|
|
+ } else if key == .fontItalic {
|
|
|
+ model.isEnabled = self.model.editAreasFontItalicIsEqual()
|
|
|
+ } else if key == .textAlignment {
|
|
|
+ model.isEnabled = self.model.editAreasTextAlignmentIsEqual()
|
|
|
+ }
|
|
|
+ datas.append(model)
|
|
|
+ }
|
|
|
+ contentViewC?.datas = datas
|
|
|
} else {
|
|
|
width = 392
|
|
|
contentViewC?.itemKeys = [.color, .fontStyle, .fontAdd, .fontReduce, .fontBold, .fontItalic, .textAlignment]
|
|
|
+ var datas: [KMEditPDFToolbarModel] = []
|
|
|
+ for key in contentViewC?.itemKeys ?? [] {
|
|
|
+ let model = KMEditPDFToolbarModel()
|
|
|
+ model.itemKey = key
|
|
|
+ if key == .color {
|
|
|
+ model.isEnabled = self.model.editAreasFontColorIsEqual()
|
|
|
+ } else if key == .fontStyle {
|
|
|
+ model.isEnabled = self.model.editAreasFontNameIsEqual()
|
|
|
+ } else if key == .fontAdd {
|
|
|
+ model.isEnabled = self.model.editAreasFontSizeIsEqual()
|
|
|
+ } else if key == .fontReduce {
|
|
|
+ model.isEnabled = self.model.editAreasFontSizeIsEqual()
|
|
|
+ } else if key == .fontBold {
|
|
|
+ model.isEnabled = self.model.editAreasFontBoldIsEqual()
|
|
|
+ } else if key == .fontItalic {
|
|
|
+ model.isEnabled = self.model.editAreasFontItalicIsEqual()
|
|
|
+ } else if key == .textAlignment {
|
|
|
+ model.isEnabled = self.model.editAreasTextAlignmentIsEqual()
|
|
|
+ }
|
|
|
+ datas.append(model)
|
|
|
+ }
|
|
|
+ contentViewC?.datas = datas
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -68,9 +119,29 @@ import Cocoa
|
|
|
if self.isMultiple {
|
|
|
width = 396
|
|
|
contentViewC?.itemKeys = [.leftRotate, .rightRotate, .separator, .reverseX, .reverseY, .separator, .crop, .replace, .export, .separator, .alignmentLeft, .alignmentTop]
|
|
|
+ var datas: [KMEditPDFToolbarModel] = []
|
|
|
+ for key in contentViewC?.itemKeys ?? [] {
|
|
|
+ let model = KMEditPDFToolbarModel()
|
|
|
+ model.itemKey = key
|
|
|
+ if key == .crop {
|
|
|
+ model.isEnabled = !self.isMultiple
|
|
|
+ }
|
|
|
+ datas.append(model)
|
|
|
+ }
|
|
|
+ contentViewC?.datas = datas
|
|
|
} else {
|
|
|
width = 304
|
|
|
contentViewC?.itemKeys = [.leftRotate, .rightRotate, .separator, .reverseX, .reverseY, .separator, .crop, .replace, .export]
|
|
|
+ var datas: [KMEditPDFToolbarModel] = []
|
|
|
+ for key in contentViewC?.itemKeys ?? [] {
|
|
|
+ let model = KMEditPDFToolbarModel()
|
|
|
+ model.itemKey = key
|
|
|
+ if key == .crop {
|
|
|
+ model.isEnabled = !self.isMultiple
|
|
|
+ }
|
|
|
+ datas.append(model)
|
|
|
+ }
|
|
|
+ contentViewC?.datas = datas
|
|
|
}
|
|
|
} else { // none
|
|
|
|