|
@@ -41,9 +41,7 @@ typealias KMAnnotationSelfSignViewControllerCallBack = (CAnnotationType) -> Void
|
|
|
@IBOutlet var lineWidthView: NSView!
|
|
|
@IBOutlet var lineWidthViewTopConstraint: NSLayoutConstraint!
|
|
|
|
|
|
- @IBOutlet var widthView: NSView!
|
|
|
-
|
|
|
- var annotation: KMSelfSignAnnotation?
|
|
|
+ private var _annotation: KMSelfSignAnnotation?
|
|
|
|
|
|
// MARK: Life Cycle
|
|
|
|
|
@@ -55,6 +53,8 @@ typealias KMAnnotationSelfSignViewControllerCallBack = (CAnnotationType) -> Void
|
|
|
override func loadView() {
|
|
|
super.loadView()
|
|
|
|
|
|
+ selfSignType = annotationModel!.annotationType as CAnnotationType
|
|
|
+
|
|
|
colorLabel.stringValue = NSLocalizedString("Color", comment: "")
|
|
|
colorLabel.textColor = KMAppearance.Layout.h0Color()
|
|
|
opacityLabel.stringValue = NSLocalizedString("Opacity", comment: "")
|
|
@@ -70,23 +70,22 @@ typealias KMAnnotationSelfSignViewControllerCallBack = (CAnnotationType) -> Void
|
|
|
imageBox.fillColor = KMAppearance.Layout.l1Color()
|
|
|
|
|
|
var color: NSColor?
|
|
|
- if let annotation = annotation {
|
|
|
- selfSignType = annotation.annotationType
|
|
|
+ if annotationModel?.annotation != nil {
|
|
|
+ selfSignType = annotation!.annotationType
|
|
|
typeSelected(selfSignType)
|
|
|
|
|
|
- color = annotation.lineColor
|
|
|
- lineWidthSlider.floatValue = Float(annotation.lineWidth())
|
|
|
+ color = annotation!.lineColor
|
|
|
+ lineWidthSlider.floatValue = Float(annotation!.lineWidth())
|
|
|
lineWidthComboBox.stringValue = String(format: "%.1f pt", lineWidthSlider.floatValue)
|
|
|
} else {
|
|
|
bottomView.isHidden = true
|
|
|
- color = KMSelfSignAnnotation.fetchStoredColor(selfSignType)
|
|
|
- lineWidthSlider.floatValue = Float(KMSelfSignAnnotation.fetchStoredLineWidth(selfSignType))
|
|
|
+ color = annotationModel?.color()
|
|
|
+ lineWidthSlider.floatValue = Float((annotationModel?.lineWidth())!)
|
|
|
lineWidthComboBox.stringValue = String(format: "%.1f pt", lineWidthSlider.floatValue)
|
|
|
}
|
|
|
|
|
|
colorPickView.color = color
|
|
|
- var opacity: CGFloat = 1.0
|
|
|
- color?.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green: nil, blue: nil, alpha: &opacity)
|
|
|
+ var opacity: CGFloat = (annotationModel?.opacity())!
|
|
|
opacityComboBox.stringValue = "\(Int(opacity * 100))%"
|
|
|
opacitySlider.floatValue = Float(opacity)
|
|
|
imageView.image = annotationModel?.annotationImage
|
|
@@ -136,6 +135,12 @@ typealias KMAnnotationSelfSignViewControllerCallBack = (CAnnotationType) -> Void
|
|
|
|
|
|
// MARK: Set & Get
|
|
|
|
|
|
+ var annotation: CSelfSignAnnotation? {
|
|
|
+ get {
|
|
|
+ return ((annotationModel?.annotation)! as! CSelfSignAnnotation)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var annotations: [CSelfSignAnnotation] {
|
|
|
get {
|
|
|
return annotationModel?.annotations as! [CSelfSignAnnotation]
|
|
@@ -277,16 +282,24 @@ typealias KMAnnotationSelfSignViewControllerCallBack = (CAnnotationType) -> Void
|
|
|
@IBAction func buttonClicked_TypeAwitch(_ sender: NSButton) {
|
|
|
let tag = sender.tag
|
|
|
|
|
|
- for tAnnotation in annotations {
|
|
|
+ if annotationModel?.annotation != nil {
|
|
|
if tag == 1 {
|
|
|
- tAnnotation.annotationType = .signature
|
|
|
+ selfSignType = .signTure
|
|
|
} else if tag == 2 {
|
|
|
- tAnnotation.annotationType = .signFalse
|
|
|
- } else {
|
|
|
- tAnnotation.annotationType = CAnnotationType(rawValue: tag) ?? .unkown
|
|
|
+ selfSignType = .signFalse
|
|
|
+ } else if tag == 3 {
|
|
|
+ selfSignType = .signCircle
|
|
|
+ } else if tag == 4 {
|
|
|
+ selfSignType = .signLine
|
|
|
+ } else if tag == 5 {
|
|
|
+ selfSignType = .signDot
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ let lineWidth = annotationModel?.lineWidth()
|
|
|
+ let textColor = annotationModel?.color()
|
|
|
+ let opcity = annotationModel?.opacity()
|
|
|
+
|
|
|
var originalFrame = annotation!.bounds
|
|
|
if annotation!.annotationType == .signFalse ||
|
|
|
annotation!.annotationType == .signTure ||
|
|
@@ -299,11 +312,14 @@ typealias KMAnnotationSelfSignViewControllerCallBack = (CAnnotationType) -> Void
|
|
|
annotation!.annotationType = .signCircle
|
|
|
}
|
|
|
|
|
|
- pdfview?.needsDisplay = true
|
|
|
- selfSignType = annotation!.annotationType
|
|
|
- imageView.image = annotationModel?.annotationImage
|
|
|
+ annotationModel?.setStampAnnotationType(selfSignType)
|
|
|
typeSelected(selfSignType)
|
|
|
+
|
|
|
+ annotationModel?.setLineWidth(CGFloat(lineWidth!))
|
|
|
+ annotationModel?.setOpacity(opcity!)
|
|
|
+ annotationModel?.setColor(textColor)
|
|
|
|
|
|
+ updateAnnotation()
|
|
|
if let callBack = callBack {
|
|
|
callBack(selfSignType)
|
|
|
}
|