Revision: 16572
          http://sourceforge.net/p/skim-app/code/16572
Author:   hofman
Date:     2026-09-29 14:11:29 +0000 (Tue, 29 Sep 2026)
Log Message:
-----------
initialize widget skim notes from properties when using legacy subclasses

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

Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-09-29 09:34:55 UTC 
(rev 16571)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-09-29 14:11:29 UTC 
(rev 16572)
@@ -337,6 +337,18 @@
 @interface PDFAnnotationChoiceWidget (SKNExtensions)
 @end
 
+static inline Class SKNAnnotationClassForWidgetType(SKNPDFWidgetType 
widgetType) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+    switch (widgetType) {
+        case kSKNPDFWidgetTypeText: return [PDFAnnotationTextWidget class];
+        case kSKNPDFWidgetTypeButton: return [PDFAnnotationButtonWidget class];
+        case kSKNPDFWidgetTypeChoice: return [PDFAnnotationChoiceWidget class];
+        default: return Nil;
+    }
+#pragma clang diagnostic pop
+}
+
 #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"
@@ -439,6 +451,10 @@
     if ([self isMemberOfClass:[PDFAnnotation class]]) {
         // possibly replace by a subclass
         Class annotationClass = SKNAnnotationClassForType(type);
+#ifdef SKIMNOTES_USE_LEGACY_PDFANNOTATION_SUBCLASSES
+        if (annotationClass == Nil && [type isEqualToString:SKNWidgetString])
+            annotationClass = SKNAnnotationClassForWidgetType([[dict 
objectForKey:SKNPDFAnnotationWidgetTypeKey] integerValue]);
+#endif
         if ([self isMemberOfClass:annotationClass] == NO) {
             self = [self init];
             self = [[annotationClass alloc] initSkimNoteWithProperties:dict];

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