|
@@ -26,7 +26,9 @@ let SKNNoteString = "SKNNoteString"
|
|
let SKNCircleString = "SKNCircleString"
|
|
let SKNCircleString = "SKNCircleString"
|
|
let SKNSquareString = "SKNSquareString"
|
|
let SKNSquareString = "SKNSquareString"
|
|
let SKNHighlightString = "SKNHighlightString"
|
|
let SKNHighlightString = "SKNHighlightString"
|
|
|
|
+let SKNHighlightStringHighlight = "SKNHighlightStringHighlight"
|
|
let SKNUnderlineString = "SKNUnderlineString"
|
|
let SKNUnderlineString = "SKNUnderlineString"
|
|
|
|
+let SKNUnderlineStringHighlight = "SKNUnderlineStringHighlight"
|
|
let SKNStrikeOutString = "SKNStrikeOutString"
|
|
let SKNStrikeOutString = "SKNStrikeOutString"
|
|
let SKNStrikeOutStringHighlight = "SKNStrikeOutStringHighlight"
|
|
let SKNStrikeOutStringHighlight = "SKNStrikeOutStringHighlight"
|
|
let SKNLine_NoneString = "SKNLine_NoneString"
|
|
let SKNLine_NoneString = "SKNLine_NoneString"
|
|
@@ -65,8 +67,11 @@ class KMNoteTypeImageView: NSImageView {
|
|
var image: NSImage?
|
|
var image: NSImage?
|
|
|
|
|
|
var strikePath = "KMImageNameAnnotationStrikeout"
|
|
var strikePath = "KMImageNameAnnotationStrikeout"
|
|
|
|
+ var strikePathHighlight = "KMImageNameAnnotationStrikeoutHighlight"
|
|
var highlight = "KMImageNameStikeoutIcon"
|
|
var highlight = "KMImageNameStikeoutIcon"
|
|
|
|
+ var highlightHighlight = "KMImageNameStikeoutIconHighlight"
|
|
var underline = "KMImageNameAnnotationUnderline"
|
|
var underline = "KMImageNameAnnotationUnderline"
|
|
|
|
+ var underlineHighlight = "KMImageNameAnnotationUnderlineHighlight"
|
|
var inkImagePath = Bundle.main.path(forResource: "KMImageNameAnnotationFreehand", ofType: "pdf")
|
|
var inkImagePath = Bundle.main.path(forResource: "KMImageNameAnnotationFreehand", ofType: "pdf")
|
|
|
|
|
|
if #available(macOS 10.14, *) {
|
|
if #available(macOS 10.14, *) {
|
|
@@ -136,6 +141,28 @@ class KMNoteTypeImageView: NSImageView {
|
|
}
|
|
}
|
|
image?.unlockFocus()
|
|
image?.unlockFocus()
|
|
}
|
|
}
|
|
|
|
+ } else if type == SKNHighlightStringHighlight {
|
|
|
|
+ if let baseImage = NSImage(named: highlightHighlight) {
|
|
|
|
+ var size = NSMakeSize(20, 20)
|
|
|
|
+ image = NSImage(size: size)
|
|
|
|
+ image?.lockFocus()
|
|
|
|
+ if let context = NSGraphicsContext.current?.cgContext {
|
|
|
|
+ let newColor = color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)
|
|
|
|
+ let newUnderlineColor = NSColor(red: newColor!.redComponent, green: newColor!.greenComponent, blue: newColor!.blueComponent, alpha: newColor?.alphaComponent ?? 0.7)
|
|
|
|
+ newUnderlineColor.setFill()
|
|
|
|
+ context.setStrokeColor(NSColor.clear.cgColor)
|
|
|
|
+ let fw = image!.size.width
|
|
|
|
+ let fh = image!.size.height
|
|
|
|
+ context.move(to: CGPoint(x: 0, y: fh - 4))
|
|
|
|
+ context.addArc(tangent1End: CGPoint(x: 0, y: 0), tangent2End: CGPoint(x: 4, y: 0), radius: 2)
|
|
|
|
+ context.addArc(tangent1End: CGPoint(x: fw, y: 0), tangent2End: CGPoint(x: fw, y: 4), radius: 2)
|
|
|
|
+ context.addArc(tangent1End: CGPoint(x: fw, y: fh), tangent2End: CGPoint(x: fw - 4, y: fh), radius: 2)
|
|
|
|
+ context.addArc(tangent1End: CGPoint(x: 0, y: fh), tangent2End: CGPoint(x: 0, y: fh - 4), radius: 2)
|
|
|
|
+ context.drawPath(using: .fillStroke)
|
|
|
|
+ baseImage.draw(in: CGRect(x: 0, y: 0, width: image!.size.width, height: image!.size.height))
|
|
|
|
+ }
|
|
|
|
+ image?.unlockFocus()
|
|
|
|
+ }
|
|
} else if type == SKNUnderlineString {
|
|
} else if type == SKNUnderlineString {
|
|
if let baseImage = NSImage(named: underline) {
|
|
if let baseImage = NSImage(named: underline) {
|
|
var size = NSMakeSize(20, 20)
|
|
var size = NSMakeSize(20, 20)
|
|
@@ -154,6 +181,24 @@ class KMNoteTypeImageView: NSImageView {
|
|
}
|
|
}
|
|
image?.unlockFocus()
|
|
image?.unlockFocus()
|
|
}
|
|
}
|
|
|
|
+ } else if type == SKNUnderlineStringHighlight {
|
|
|
|
+ if let baseImage = NSImage(named: underlineHighlight) {
|
|
|
|
+ var size = NSMakeSize(20, 20)
|
|
|
|
+ image = NSImage(size: size)
|
|
|
|
+ image?.lockFocus()
|
|
|
|
+ if let context = NSGraphicsContext.current?.cgContext {
|
|
|
|
+ context.beginPath()
|
|
|
|
+ context.move(to: CGPoint(x: 0, y: 1))
|
|
|
|
+ context.addLine(to: CGPoint(x: image!.size.width, y: 1))
|
|
|
|
+ let newColor = color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)
|
|
|
|
+ let newUnderlineColor = NSColor(red: newColor!.redComponent, green: newColor!.greenComponent, blue: newColor!.blueComponent, alpha: 1)
|
|
|
|
+ newUnderlineColor.setStroke()
|
|
|
|
+ context.setLineWidth(2)
|
|
|
|
+ context.strokePath()
|
|
|
|
+ baseImage.draw(in: CGRect(x: 0, y: 0, width: image!.size.width, height: image!.size.height))
|
|
|
|
+ }
|
|
|
|
+ image?.unlockFocus()
|
|
|
|
+ }
|
|
} else if type == SKNStrikeOutString {
|
|
} else if type == SKNStrikeOutString {
|
|
if let strikeImage = NSImage(named: strikePath) {
|
|
if let strikeImage = NSImage(named: strikePath) {
|
|
var size = NSMakeSize(20, 20)
|
|
var size = NSMakeSize(20, 20)
|
|
@@ -173,7 +218,7 @@ class KMNoteTypeImageView: NSImageView {
|
|
image?.unlockFocus()
|
|
image?.unlockFocus()
|
|
}
|
|
}
|
|
} else if type == SKNStrikeOutStringHighlight {
|
|
} else if type == SKNStrikeOutStringHighlight {
|
|
- if let strikeImage = NSImage(named: strikePath) {
|
|
|
|
|
|
+ if let strikeImage = NSImage(named: strikePathHighlight) {
|
|
var size = NSMakeSize(20, 20)
|
|
var size = NSMakeSize(20, 20)
|
|
image = NSImage(size: size)
|
|
image = NSImage(size: size)
|
|
image?.lockFocus()
|
|
image?.lockFocus()
|