Revision: 14402
http://sourceforge.net/p/skim-app/code/14402
Author: hofman
Date: 2024-07-28 17:20:53 +0000 (Sun, 28 Jul 2024)
Log Message:
-----------
Draw arrow ourselves for note cursors
Modified Paths:
--------------
trunk/NSImage_SKExtensions.m
Modified: trunk/NSImage_SKExtensions.m
===================================================================
--- trunk/NSImage_SKExtensions.m 2024-07-27 18:04:35 UTC (rev 14401)
+++ trunk/NSImage_SKExtensions.m 2024-07-28 17:20:53 UTC (rev 14402)
@@ -204,7 +204,7 @@
static inline void drawPageBackgroundInRect(NSRect rect);
-static inline void drawArrowCursor();
+static inline void drawArrowCursor(NSColor *outlineColor, NSColor *fillColor);
static void evaluateLaserPointer(void *info, const CGFloat *in, CGFloat *out);
@@ -1595,9 +1595,9 @@
#define DEFINE_NOTE_CURSOR_IMAGE(name) \
+ (NSImage *)cursor ## name ## NoteImageWithOutlineColor:(NSColor
*)outlineColor fillColor:(NSColor *)fillColor { \
- return [[NSImage alloc] initPDFWithSize:NSMakeSize(24.0, 42.0)
drawingHandler:^(NSRect dstRect){ \
- drawArrowCursor(); \
- translate(2.0, 2.0); \
+ return [[NSImage alloc] initPDFWithSize:NSMakeSize(24.0, 40.0)
drawingHandler:^(NSRect dstRect){ \
+ drawArrowCursor(outlineColor, fillColor); \
+ translate(3.0, 3.0); \
draw ## name ## NoteBackground(outlineColor); \
draw ## name ## Note(fillColor); \
}]; \
@@ -1982,9 +1982,26 @@
[NSGraphicsContext restoreGraphicsState];
}
-static inline void drawArrowCursor() {
- NSImage *arrowCursor = [[NSCursor arrowCursor] image];
- [arrowCursor drawAtPoint:NSMakePoint(0.0, 42.0 - [arrowCursor
size].height) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver
fraction:1.0];
+static inline void drawArrowCursor(NSColor *outlineColor, NSColor *fillColor) {
+ NSBezierPath *path = NSBezierPath.bezierPath;
+ [path moveToPoint:NSMakePoint(3.0, 37.0 + M_SQRT2)];
+ [path lineToPoint:NSMakePoint(3.0, 35.0 - 9.0 * M_SQRT2)];
+ [path lineToPoint:NSMakePoint(9.0 * M_SQRT2 - 5.0, 27.0)];
+ [path lineToPoint:NSMakePoint(13.0 + M_SQRT2, 27.0)];
+ [path closePath];
+ [NSGraphicsContext saveGraphicsState];
+ [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:2.0
yOffset:-1.0];
+ [outlineColor setFill];
+ [path fill];
+ [NSGraphicsContext restoreGraphicsState];
+ path = NSBezierPath.bezierPath;
+ [path moveToPoint:NSMakePoint(4.0, 36.0)];
+ [path lineToPoint:NSMakePoint(4.0, 36.0 - 8.0 * M_SQRT2)];
+ [path lineToPoint:NSMakePoint(8.0 * M_SQRT2 - 4.0, 28.0)];
+ [path lineToPoint:NSMakePoint(12.0, 28.0)];
+ [path closePath];
+ [fillColor setFill];
+ [path fill];
}
static void evaluateLaserPointer(void *info, const CGFloat *in, CGFloat *out) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit