Revision: 16517
          http://sourceforge.net/p/skim-app/code/16517
Author:   hofman
Date:     2026-09-21 16:44:56 +0000 (Mon, 21 Sep 2026)
Log Message:
-----------
Use macro to determine whether to implement skim notes using legacy 
PDFAnnotation subclasses, defined for macOS for now

Modified Paths:
--------------
    trunk/SkimNotes/PDFAnnotation_SKNExtensions.h
    trunk/SkimNotes/PDFAnnotation_SKNExtensions.m

Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.h
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.h       2026-09-21 16:18:53 UTC 
(rev 16516)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.h       2026-09-21 16:44:56 UTC 
(rev 16517)
@@ -46,6 +46,11 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+#ifndef PDFKIT_PLATFORM_IOS
+// Undefine this if you want Skim notes to be implemented by the PDFAnnotation 
class
+#define SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
+#endif
+
 #ifndef PDFRect
 #define PDFRect NSRect
 #endif
@@ -292,9 +297,9 @@
 */
 @interface PDFAnnotation (SKNExtensions)
 
-#ifndef PDFKIT_PLATFORM_IOS
+#ifdef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
 /*!
-    @abstract   Initializes a new Skim note annotation.  This is the 
designated initializer for a Skim note on macOS.
+    @abstract   Initializes a new Skim note annotation.  This is the 
designated initializer for a Skim note on macOS when using legacy 
<code>PDFAnnotation</code> subclasses.
     @discussion This method can be implemented in subclasses to provide 
default properties for Skim notes.
     @param      bounds The bounding box of the annotation, in page space.
     @result     An initialized Skim note annotation instance, or 
<code>nil</code> if the object could not be initialized.
@@ -303,8 +308,8 @@
 #endif
 
 /*!
-    @abstract   Initializes a new Skim note annotation.  This is the 
designated initializer for a Skim noteon iOS.
-    @discussion On macOS this returns a subclasses initialized with 
<code>initSkimNoteWithBounds:</code>.
+    @abstract   Initializes a new Skim note annotation.  This is the 
designated initializer for a Skim noteon iOS, or on macOS when not using legacy 
<code>PDFAnnotation</code> classes.
+    @discussion On macOS when using legacsy <code>PDFAnnotation</code> 
classes, this returns a subclasses initialized with 
<code>initSkimNoteWithBounds:</code>.
     @param      bounds The bounding box of the annotation, in page space.
     @param      type The type of the note .
     @result     An initialized Skim note annotation instance, or 
<code>nil</code> if the object could not be initialized.
@@ -380,7 +385,7 @@
 
 #pragma mark -
 
-#ifndef PDFKIT_PLATFORM_IOS
+#ifdef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
 
 /*!
     @abstract    Provides methods to translate between dictionary 
representations of Skim notes and <code>PDFAnnotation</code> objects.
@@ -497,7 +502,7 @@
 
 #pragma mark -
 
-#ifndef PDFKIT_PLATFORM_IOS
+#ifdef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 /*!

Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-09-21 16:18:53 UTC 
(rev 16516)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-09-21 16:44:56 UTC 
(rev 16517)
@@ -304,7 +304,7 @@
 
 char SKNIsSkimNoteKey;
 
-#ifndef PDFKIT_PLATFORM_IOS
+#ifdef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
 
 static inline Class SKNAnnotationClassForType(NSString *type) {
 #pragma clang diagnostic push
@@ -344,6 +344,10 @@
     return self;
 }
 
+#elif !defined(PDFKIT_PLATFORM_IOS) && (!defined(MAC_OS_X_VERSION_10_13) || 
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_13)
+
+#error "Deployment target before macOS 10.13 not supported without legacy 
PDFAnnotation classes"
+
 #endif
 
 - (id)initSkimNoteWithBounds:(PDFRect)bounds forType:(NSString *)type {
@@ -350,7 +354,7 @@
     if ([type hasPrefix:@"/"])
         type = [type substringFromIndex:1];
     
-#ifdef PDFKIT_PLATFORM_IOS
+#ifndef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
     
     if ([type isEqualToString:SKNNoteString] || [type 
isEqualToString:SKNTextString] || [type isEqualToString:SKNStampString]) {
         if ([self isMemberOfClass:[PDFAnnotation class]]) {
@@ -413,7 +417,7 @@
     NSString *type = [dict objectForKey:SKNPDFAnnotationTypeKey];
     
         
-#ifdef PDFKIT_PLATFORM_IOS
+#ifndef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
     
     if (([type isEqualToString:SKNNoteString] || [type 
isEqualToString:SKNTextString] || [type isEqualToString:SKNStampString]) && 
[self isMemberOfClass:[PDFAnnotation class]]) {
         // replace by our subclass
@@ -481,7 +485,7 @@
             [[self border] setLineWidth:0.0];
         }
         
-#ifdef PDFKIT_PLATFORM_IOS
+#ifndef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
         
         color = [dict objectForKey:SKNPDFAnnotationInteriorColorKey];
         if ([color isKindOfClass:colorClass])
@@ -1197,7 +1201,7 @@
 
 #pragma mark -
 
-#ifndef PDFKIT_PLATFORM_IOS
+#ifdef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
 
 @implementation PDFAnnotationCircle (SKNExtensions)
 

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

Reply via email to