Revision: 14601
http://sourceforge.net/p/skim-app/code/14601
Author: hofman
Date: 2024-10-29 10:24:16 +0000 (Tue, 29 Oct 2024)
Log Message:
-----------
Funnel icon drawing functions through single function
Modified Paths:
--------------
trunk/SkimNotes/SKNPDFAnnotationNote.m
Modified: trunk/SkimNotes/SKNPDFAnnotationNote.m
===================================================================
--- trunk/SkimNotes/SKNPDFAnnotationNote.m 2024-10-28 23:20:10 UTC (rev
14600)
+++ trunk/SkimNotes/SKNPDFAnnotationNote.m 2024-10-29 10:24:16 UTC (rev
14601)
@@ -50,13 +50,7 @@
#import <CoreGraphics/CoreGraphics.h>
#if !defined(MAC_OS_X_VERSION_10_15) || MAC_OS_X_VERSION_MIN_REQUIRED <
MAC_OS_X_VERSION_10_15
-static inline void drawIconComment(CGContextRef context, NSRect bounds);
-static inline void drawIconKey(CGContextRef context, NSRect bounds);
-static inline void drawIconNote(CGContextRef context, NSRect bounds);
-static inline void drawIconHelp(CGContextRef context, NSRect bounds);
-static inline void drawIconNewParagraph(CGContextRef context, NSRect bounds);
-static inline void drawIconParagraph(CGContextRef context, NSRect bounds);
-static inline void drawIconInsert(CGContextRef context, NSRect bounds);
+static inline void drawIcon(CGContextRef context, NSRect bounds,
PDFTextAnnotationIconType iconType);
#define SKNAppKitVersionNumber10_12 1504
#define SKNAppKitVersionNumber10_14 1671
@@ -262,20 +256,7 @@
if (NSWidth(bounds) > 2.0 && NSHeight(bounds) > 2.0) {
CGContextSetFillColorWithColor(context, [[self color] CGColor]);
CGContextSetStrokeColorWithColor(context,
CGColorGetConstantColor(kCGColorBlack));
- CGContextSetLineWidth(context, 1.0);
- CGContextSetLineCap(context, kCGLineCapButt);
- CGContextSetLineJoin(context, kCGLineJoinMiter);
- CGContextClipToRect(context, NSRectToCGRect(bounds));
- switch ([self iconType]) {
- case kPDFTextAnnotationIconComment:
drawIconComment(context, bounds); break;
- case kPDFTextAnnotationIconKey: drawIconKey(context,
bounds); break;
- case kPDFTextAnnotationIconNote: drawIconNote(context,
bounds); break;
- case kPDFTextAnnotationIconHelp: drawIconHelp(context,
bounds); break;
- case kPDFTextAnnotationIconNewParagraph:
drawIconNewParagraph(context, bounds); break;
- case kPDFTextAnnotationIconParagraph:
drawIconParagraph(context, bounds); break;
- case kPDFTextAnnotationIconInsert:
drawIconInsert(context, bounds); break;
- default: drawIconNote(context,
bounds); break;
- }
+ drawIcon(context, bounds, [self iconType]);
} else {
CGContextSetFillColorWithColor(context,
CGColorGetConstantColor(kCGColorBlack));
CGContextFillRect(context, NSRectToCGRect(bounds));
@@ -454,4 +435,21 @@
CGContextDrawPath(context, kCGPathFillStroke);
}
+static inline void drawIcon(CGContextRef context, NSRect bounds,
PDFTextAnnotationIconType iconType) {
+ CGContextSetLineWidth(context, 1.0);
+ CGContextSetLineCap(context, kCGLineCapButt);
+ CGContextSetLineJoin(context, kCGLineJoinMiter);
+ CGContextClipToRect(context, NSRectToCGRect(bounds));
+ switch (iconType) {
+ case kPDFTextAnnotationIconComment: drawIconComment(context,
bounds); break;
+ case kPDFTextAnnotationIconKey: drawIconKey(context, bounds);
break;
+ case kPDFTextAnnotationIconNote: drawIconNote(context,
bounds); break;
+ case kPDFTextAnnotationIconHelp: drawIconHelp(context,
bounds); break;
+ case kPDFTextAnnotationIconNewParagraph: drawIconNewParagraph(context,
bounds); break;
+ case kPDFTextAnnotationIconParagraph: drawIconParagraph(context,
bounds); break;
+ case kPDFTextAnnotationIconInsert: drawIconInsert(context,
bounds); break;
+ default: drawIconNote(context,
bounds); break;
+ }
+}
+
#endif
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