|
@@ -17,7 +17,7 @@ class KMTextBoxController: NSViewController {
|
|
|
@IBOutlet var fontStyleSelect: ComponentSelect!
|
|
|
@IBOutlet var fontSizeSelect: ComponentSelect!
|
|
|
@IBOutlet var fontAlignmentGroup: ComponentCSelectorGroup!
|
|
|
-
|
|
|
+
|
|
|
//Color
|
|
|
@IBOutlet var colorBGView: NSView!
|
|
|
@IBOutlet var colorLabel: NSTextField!
|
|
@@ -491,7 +491,7 @@ class KMTextBoxController: NSViewController {
|
|
|
dashProperty.state = .normal
|
|
|
solidProperty.state = .normal
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if let value = lineWidth {
|
|
|
let percent = value/18
|
|
|
lineWidthSlider.properties.percent = percent
|
|
@@ -535,6 +535,10 @@ class KMTextBoxController: NSViewController {
|
|
|
//MARK: - ComponentCColorDelegate
|
|
|
extension KMTextBoxController: ComponentCColorDelegate {
|
|
|
func componentCColorDidChooseColor(_ view: NSView, _ color: NSColor?) {
|
|
|
+ for annotation in self.annotations {
|
|
|
+ pdfView!.commitEditAnnotationFreeText(annotation)
|
|
|
+ }
|
|
|
+
|
|
|
if view == fontColorGroup {
|
|
|
CPDFAnnotation.updateAnnotations(annotations, newFontColor: color, withPDFView: pdfView)
|
|
|
CPDFFreeTextAnnotation.update_DefaultFontColor_Info(color)
|
|
@@ -552,6 +556,9 @@ extension KMTextBoxController: ComponentCColorDelegate {
|
|
|
//MARK: - ComponentSliderDelegate
|
|
|
extension KMTextBoxController: ComponentSliderDelegate {
|
|
|
func componentSliderDidUpdate(_ view: ComponentSlider) {
|
|
|
+ for annotation in self.annotations {
|
|
|
+ pdfView!.commitEditAnnotationFreeText(annotation)
|
|
|
+ }
|
|
|
if view == opacitySlider {
|
|
|
let opacity = view.properties.percent
|
|
|
CPDFAnnotation.updateAnnotations(annotations, newOpacity: opacity, withPDFView: pdfView)
|
|
@@ -573,6 +580,10 @@ extension KMTextBoxController: ComponentSliderDelegate {
|
|
|
//MARK: - ComponentSelectDelegate
|
|
|
extension KMTextBoxController: ComponentSelectDelegate {
|
|
|
func componentSelectTextDidEndEditing(_ view: ComponentSelect, removeUnit text: String?) {
|
|
|
+ for annotation in self.annotations {
|
|
|
+ pdfView!.commitEditAnnotationFreeText(annotation)
|
|
|
+ }
|
|
|
+
|
|
|
if let result = text {
|
|
|
if view == opacitySelect {
|
|
|
let opacity = max(0, min(1, result.stringToCGFloat()/100))
|
|
@@ -583,7 +594,7 @@ extension KMTextBoxController: ComponentSelectDelegate {
|
|
|
let value = result.stringToCGFloat()
|
|
|
CPDFAnnotation.updateAnnotations(annotations, newFontSize: value, withPDFView: pdfView)
|
|
|
CPDFFreeTextAnnotation.update_DefaultFontSize_Info(value)
|
|
|
-
|
|
|
+
|
|
|
} else if view == lineWidthSelect {
|
|
|
var value = result.stringToCGFloat()
|
|
|
if value > 18 {
|
|
@@ -610,6 +621,10 @@ extension KMTextBoxController: ComponentSelectDelegate {
|
|
|
}
|
|
|
|
|
|
func componentSelectDidSelect(view: ComponentSelect?, menuItemProperty: ComponentMenuitemProperty?) {
|
|
|
+ for annotation in self.annotations {
|
|
|
+ pdfView!.commitEditAnnotationFreeText(annotation)
|
|
|
+ }
|
|
|
+
|
|
|
if var result = menuItemProperty?.text {
|
|
|
if let textUnit = view?.properties.textUnit {
|
|
|
result = result.stringByDeleteCharString(textUnit)
|
|
@@ -668,6 +683,9 @@ extension KMTextBoxController: ComponentSelectDelegate {
|
|
|
//MARK: - ComponentCSelectorGroupDelegate
|
|
|
extension KMTextBoxController: ComponentCSelectorGroupDelegate {
|
|
|
func componentCSelectorGroupDidChoose(_ view: ComponentCSelectorGroup, _ item: ComponentCSelectorItem) {
|
|
|
+ for annotation in self.annotations {
|
|
|
+ pdfView!.commitEditAnnotationFreeText(annotation)
|
|
|
+ }
|
|
|
if view == fontAlignmentGroup {
|
|
|
if item.properties == fontAlign_leftItem {
|
|
|
CPDFAnnotation.updateAnnotations(annotations, newAlignment: .left, withPDFView: pdfView)
|