Revision: 16508
          http://sourceforge.net/p/skim-app/code/16508
Author:   hofman
Date:     2026-09-20 14:46:39 +0000 (Sun, 20 Sep 2026)
Log Message:
-----------
use dedicated removal method rather than setting nil for annotation value

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

Modified: trunk/SKNPDFAnnotationNote_SKExtensions.m
===================================================================
--- trunk/SKNPDFAnnotationNote_SKExtensions.m   2026-09-20 14:41:44 UTC (rev 
16507)
+++ trunk/SKNPDFAnnotationNote_SKExtensions.m   2026-09-20 14:46:39 UTC (rev 
16508)
@@ -117,7 +117,10 @@
 }
 
 - (void)setName:(NSString *)name {
-    [self setValue:name forAnnotationKey:PDFAnnotationKeyIconName];
+    if (name)
+        [self setValue:name forAnnotationKey:PDFAnnotationKeyIconName];
+    else
+        [self removeValueForAnnotationKey:PDFAnnotationKeyIconName];
 }
 
 // override these Leopard methods to avoid showing the standard tool tips over 
our own

Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-09-20 14:41:44 UTC 
(rev 16507)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-09-20 14:46:39 UTC 
(rev 16508)
@@ -986,7 +986,10 @@
         if (markupTypes == nil)
             markupTypes = [[NSSet alloc] initWithObjects:SKNHighlightString, 
SKNUnderlineString, SKNStrikeOutString, SKNMarkUpString, SKNSquigglyString, 
nil];
         if ([markupTypes containsObject:[self type]]) {
-            [self setValue:string forAnnotationKey:@"/SkimContents"];
+            if (string)
+                [self setValue:string forAnnotationKey:@"/SkimContents"];
+            else
+                [self removeValueForAnnotationKey:@"/SkimContents"];
             return;
         }
     }
@@ -1007,8 +1010,10 @@
         } else {
             if ([self respondsToSelector:@selector(setWidgetStringValue:)])
                 [self setWidgetStringValue:string];
+            else if (string)
+                [self setValue:string forAnnotationKey:@"/V"];
             else
-                [self setValue:string forAnnotationKey:@"/V"];
+                [self removeValueForAnnotationKey:@"/V"];
         }
     }
 }
@@ -1426,9 +1431,12 @@
 
 - (void)setString:(NSString *)string {
 #if defined(MAC_OS_X_VERSION_10_13) && MAC_OS_X_VERSION_MAX_ALLOWED >= 
MAC_OS_X_VERSION_10_13
-    if (@available(macOS 27.0, iOS 27.0, *))
-        [self setValue:string forAnnotationKey:@"/SkimContents"];
-    else
+    if (@available(macOS 27.0, iOS 27.0, *)) {
+        if (string)
+            [self setValue:string forAnnotationKey:@"/SkimContents"];
+        else
+            [self removeValueForAnnotationKey:@"/SkimContents"];
+    } else
 #endif
         [self setContents:string];
 }

Modified: trunk/SkimNotes/SKNPDFAnnotationNote.m
===================================================================
--- trunk/SkimNotes/SKNPDFAnnotationNote.m      2026-09-20 14:41:44 UTC (rev 
16507)
+++ trunk/SkimNotes/SKNPDFAnnotationNote.m      2026-09-20 14:46:39 UTC (rev 
16508)
@@ -60,6 +60,7 @@
 - (void)drawWithBox:(PDFDisplayBox)box inContext:(CGContextRef)context;
 - (id)valueForAnnotationKey:(NSString *)key;
 - (BOOL)setValue:(id)value forAnnotationKey:(NSString *)key;
+- (void)removeValueForAnnotationKey:(NSString *)key;
 @end
 @interface PDFPage (SKNSierraDeclarations)
 - (void)transformContext:(CGContextRef)context forBox:(PDFDisplayBox)box;

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