|
@@ -124,12 +124,12 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
|
NotificationCenter.default.removeObserver(self)
|
|
|
DistributedNotificationCenter.default.removeObserver(self)
|
|
|
|
|
|
- if ((annotationModel?.annotation) != nil) && annotationModel?.annotations.count == 1 {
|
|
|
- let keys = ["string", "rotation", "imageAlpha"]
|
|
|
- for key in keys {
|
|
|
- self.annotation.removeObserver(self, forKeyPath: key)
|
|
|
- }
|
|
|
- }
|
|
|
+// if ((annotationModel?.annotation) != nil) && annotationModel?.annotations.count == 1 {
|
|
|
+// let keys = ["string", "rotation", "imageAlpha"]
|
|
|
+// for key in keys {
|
|
|
+// self.annotation.removeObserver(self, forKeyPath: key)
|
|
|
+// }
|
|
|
+// }
|
|
|
dateComboBox.delegate = nil
|
|
|
contentTextView.delegate = nil
|
|
|
|
|
@@ -389,8 +389,8 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
|
|
|
|
var opacity = 1.0
|
|
|
if annotationModel?.annotations != nil {
|
|
|
- if annotation is KMAnnotationStamp {
|
|
|
- opacity = Double((annotation as! KMAnnotationStamp).imageAlpha)
|
|
|
+ if annotation is CPDFListStampAnnotation {
|
|
|
+ opacity = Double((annotation as! CPDFListStampAnnotation).opacity)
|
|
|
}
|
|
|
}
|
|
|
opacitySlider.floatValue = Float(opacity)
|
|
@@ -410,7 +410,9 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
|
blockSelf.leftRotateImage.image = NSImage(named: KMImageNameUXIconPropertybarRotateCounterclockwisePre)
|
|
|
|
|
|
for tAnnotation in blockSelf.annotations {
|
|
|
- blockSelf.pdfView?.rotateLeft(forStampAnnotation: (tAnnotation as! KMAnnotationStamp))
|
|
|
+ if tAnnotation is CPDFListStampAnnotation {
|
|
|
+ blockSelf.pdfView?.rotateStampAnnotation(tAnnotation as! CPDFListStampAnnotation, rotateAngle: -90)
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
blockSelf.leftRotateBox.fillColor = KMAppearance.Layout.l1Color()
|
|
@@ -432,7 +434,11 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
|
blockSelf.rightRotateImage.image = NSImage(named: KMImageNameUXIconPropertybarRotateClockwisePre)
|
|
|
|
|
|
for tAnnotation in blockSelf.annotations {
|
|
|
- blockSelf.pdfView?.rotateRight(forStampAnnotation: (tAnnotation as! KMAnnotationStamp))
|
|
|
+ if tAnnotation is CPDFListStampAnnotation {
|
|
|
+ if tAnnotation is CPDFListStampAnnotation {
|
|
|
+ blockSelf.pdfView?.rotateStampAnnotation(tAnnotation as! CPDFListStampAnnotation, rotateAngle: 90)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
blockSelf.rightRotateBox.fillColor = KMAppearance.Layout.l1Color()
|
|
@@ -444,8 +450,6 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
|
if annotationModel?.annotations != nil {
|
|
|
if annotation is CPDFStampAnnotation {
|
|
|
contentTextView.string = (annotation as! CPDFStampAnnotation).string()
|
|
|
- } else if annotation is KMAnnotationStamp {
|
|
|
- contentTextView.string = (annotation as! KMAnnotationStamp).contentStr
|
|
|
}
|
|
|
}
|
|
|
contentTextView.textColor = NSColor.labelColor
|
|
@@ -454,11 +458,11 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
|
contentTextView.delegate = self
|
|
|
contentTextView.isEditable = false
|
|
|
|
|
|
- sampleImageView.image = annotationModel?.annotationImage
|
|
|
+// sampleImageView.image = self.annotationModel?.annotationImage
|
|
|
|
|
|
if annotationModel?.annotations != nil {
|
|
|
- if annotation is KMAnnotationStamp {
|
|
|
- contentTextView.isHidden = (annotation as! KMAnnotationStamp).image == nil
|
|
|
+ if annotation is CPDFListStampAnnotation {
|
|
|
+ opacityBox.isHidden = (annotation as! CPDFListStampAnnotation).pImage == nil
|
|
|
}
|
|
|
}
|
|
|
opacityBoxTopLayoutConstraint.constant = opacityBox.isHidden ? 16 : 96
|
|
@@ -466,28 +470,6 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
|
updateViewColor()
|
|
|
}
|
|
|
|
|
|
- func annotationImage() -> NSImage? {
|
|
|
- let annotation = self.annotation
|
|
|
- let image = NSImage(size: annotation.bounds.size)
|
|
|
- if image.size.width == 0 || image.size.height == 0 {
|
|
|
- return nil
|
|
|
- }
|
|
|
-
|
|
|
- image.lockFocus()
|
|
|
- NSGraphicsContext.current?.imageInterpolation = .high
|
|
|
-
|
|
|
- if let context = NSGraphicsContext.current?.cgContext {
|
|
|
- let boxRect = annotation.page?.bounds(for: .cropBox) ?? CGRect.zero
|
|
|
- context.translateBy(x: boxRect.origin.x, y: boxRect.origin.y)
|
|
|
- context.translateBy(x: -annotation.bounds.origin.x, y: -annotation.bounds.origin.y)
|
|
|
- annotation.draw(with: .cropBox, in: context)
|
|
|
- }
|
|
|
-
|
|
|
- NSGraphicsContext.current?.imageInterpolation = .default
|
|
|
- image.unlockFocus()
|
|
|
- return image
|
|
|
- }
|
|
|
-
|
|
|
func createStandardTypeStamp() {
|
|
|
createStampTableView.delegate = self
|
|
|
createStampTableView.dataSource = self
|
|
@@ -1353,8 +1335,6 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
|
if annotation is CPDFStampAnnotation {
|
|
|
contentTextView.string = (annotation as! CPDFStampAnnotation).string()
|
|
|
(annotation as! CPDFStampAnnotation).setString(contentTextView.string)
|
|
|
- } else if annotation is KMAnnotationStamp {
|
|
|
- (annotation as! KMAnnotationStamp).contentStr = contentTextView.string
|
|
|
}
|
|
|
if obj.isEqual(self.contentTextView) {
|
|
|
UserDefaults.standard.set(self.contentTextView.string, forKey: "SKAnnotationSelfSignPlaceHolderStringKey")
|