Revision: 16533
          http://sourceforge.net/p/skim-app/code/16533
Author:   hofman
Date:     2026-09-23 15:53:03 +0000 (Wed, 23 Sep 2026)
Log Message:
-----------
use string constants for annotation keys

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

Modified: trunk/PDFAnnotationLine_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationLine_SKExtensions.m      2026-09-23 15:26:50 UTC (rev 
16532)
+++ trunk/PDFAnnotationLine_SKExtensions.m      2026-09-23 15:53:03 UTC (rev 
16533)
@@ -61,7 +61,7 @@
 static void (*original_setBounds)(id, SEL, NSRect) = NULL;
 
 static void replacement_setBounds(id self, SEL _cmd , NSRect newBounds) {
-    NSArray *points = [self valueForAnnotationKey:@"/L"];
+    NSArray *points = [self valueForAnnotationKey:PDFAnnotationKeyLinePoints];
     if ([points isKindOfClass:[NSArray class]] && [points count] == 4) {
         NSPoint d = SKSubstractPoints(newBounds.origin, [self bounds].origin);
         if (NSEqualPoints(d, NSZeroPoint))
@@ -73,7 +73,7 @@
     }
     original_setBounds(self, _cmd, newBounds);
     if (points)
-        [self setValue:points forAnnotationKey:@"/L"];
+        [self setValue:points forAnnotationKey:PDFAnnotationKeyLinePoints];
 }
 
 + (void)load {

Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-09-23 15:26:50 UTC 
(rev 16532)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-09-23 15:53:03 UTC 
(rev 16533)
@@ -705,7 +705,7 @@
             
             if ([self respondsToSelector:@selector(iconType)])
                 [dict setValue:[NSNumber numberWithInteger:[(id)self 
iconType]] forKey:SKNPDFAnnotationIconTypeKey];
-            else if ((value = [self valueForAnnotationKey:@"/Name"]))
+            else if ((value = [self 
valueForAnnotationKey:PDFAnnotationKeyIconName]))
                 [dict setValue:[NSNumber 
numberWithInteger:SKNIconTypeFromAnnotationValue(value)] 
forKey:SKNPDFAnnotationIconTypeKey];
             
         } else if ([type isEqualToString:SKNStampString]) {
@@ -713,7 +713,7 @@
             if ([self respondsToSelector:@selector(stampName)])
                 value = [self stampName];
             else
-                value = [self valueForAnnotationKey:@"/Name"];
+                value = [self valueForAnnotationKey:PDFAnnotationKeyIconName];
             if (value) {
                 [dict setValue:value forKey:SKNPDFAnnotationNameKey];
                 if ([[NSSet setWithObjects:@"/Comment", @"/Key", @"/Note", 
@"/Help", @"/NewParagraph", @"/Paragraph", @"/Insert", nil] 
containsObject:value]) {
@@ -730,7 +730,7 @@
             PDFKitPlatformColor *color = nil;
             if ([self respondsToSelector:@selector(interiorColor)])
                 color = [(id)self interiorColor];
-            if (color == nil && (value = [self valueForAnnotationKey:@"/IC"]))
+            if (color == nil && (value = [self 
valueForAnnotationKey:PDFAnnotationKeyInteriorColor]))
                 color = SKNColorFromAnnotationValue(value);
             if (color)
                 [dict setValue:color forKey:SKNPDFAnnotationInteriorColorKey];
@@ -740,7 +740,7 @@
                 if ([self respondsToSelector:@selector(startLineStyle)] && 
[self respondsToSelector:@selector(endLineStyle)]) {
                     [dict setValue:[NSNumber numberWithInteger:[(id)self 
startLineStyle]] forKey:SKNPDFAnnotationStartLineStyleKey];
                     [dict setValue:[NSNumber numberWithInteger:[(id)self 
endLineStyle]] forKey:SKNPDFAnnotationStartLineStyleKey];
-                } else if ((value = [self valueForAnnotationKey:@"/LE"])) {
+                } else if ((value = [self 
valueForAnnotationKey:PDFAnnotationKeyLineEndingStyles])) {
                     if ([value isKindOfClass:arrayClass] && [value count] == 
2) {
                         [dict setValue:[NSNumber 
numberWithInteger:SKNPDFLineStyleFromAnnotationValue([value objectAtIndex:0])] 
forKey:SKNPDFAnnotationStartLineStyleKey];
                         [dict setValue:[NSNumber 
numberWithInteger:SKNPDFLineStyleFromAnnotationValue([value objectAtIndex:1])] 
forKey:SKNPDFAnnotationEndLineStyleKey];
@@ -750,7 +750,7 @@
                 if ([self respondsToSelector:@selector(startPoint)] && [self 
respondsToSelector:@selector(endPoint)]) {
                     [dict setValue:SKNStringFromPoint([(id)self startPoint]) 
forKey:SKNPDFAnnotationStartPointKey];
                     [dict setValue:SKNStringFromPoint([(id)self endPoint]) 
forKey:SKNPDFAnnotationEndPointKey];
-                } else if ((value = [self valueForAnnotationKey:@"/L"])) {
+                } else if ((value = [self 
valueForAnnotationKey:PDFAnnotationKeyLinePoints])) {
                     if ([value isKindOfClass:arrayClass] && [value count] == 
4) {
                         PDFPoint p = SKNMakePoint([[value objectAtIndex:0] 
doubleValue] - bounds.origin.x, [[value objectAtIndex:1] doubleValue] - 
bounds.origin.y);
                         [dict setValue:SKNStringFromPoint(p) 
forKey:SKNPDFAnnotationStartPointKey];
@@ -771,7 +771,7 @@
                         [quadPointStrings 
addObject:SKNStringFromPoint(SKNPointFromValue(pointValue))];
                     [dict setValue:quadPointStrings 
forKey:SKNPDFAnnotationQuadrilateralPointsKey];
                 }
-            } else if ((value = [self valueForAnnotationKey:@"/QuadPoints"])) {
+            } else if ((value = [self 
valueForAnnotationKey:PDFAnnotationKeyQuadPoints])) {
                 if ([value isKindOfClass:arrayClass] && [value count] % 4 == 
0) {
                     Class numberClass = [NSNumber class];
                     Class valueClass = [NSValue class];
@@ -809,7 +809,7 @@
                     [dict setValue:pointLists 
forKey:SKNPDFAnnotationPointListsKey];
                 }
                 
-           } else if ((value = [self valueForAnnotationKey:@"/InkList"])) {
+           } else if ((value = [self 
valueForAnnotationKey:PDFAnnotationKeyInklist])) {
                
                 if ([value isKindOfClass:arrayClass]) {
                     Class pathClass = [PDFKitPlatformBezierPath class];
@@ -846,7 +846,7 @@
             
             if ([self respondsToSelector:@selector(alignment)]) {
                 [dict setValue:[NSNumber 
numberWithInteger:SKNTextAlignmentFromAlignment([(id)self alignment])] 
forKey:SKNPDFAnnotationAlignmentKey];
-            } else if ((value = [self valueForAnnotationKey:@"/Q"])) {
+            } else if ((value = [self 
valueForAnnotationKey:PDFAnnotationKeyQuadding])) {
                 [dict setValue:[NSNumber 
numberWithInteger:SKNTextAlignmentFromAlignment([value integerValue])] 
forKey:SKNPDFAnnotationAlignmentKey];
             }
             
@@ -854,7 +854,7 @@
             if ([self respondsToSelector:@selector(font)]) {
                 font = [(id)self font];
             }
-            if (font == nil && (value = [self valueForAnnotationKey:@"/DA"])) {
+            if (font == nil && (value = [self 
valueForAnnotationKey:PDFAnnotationKeyDefaultAppearance])) {
                 NSScanner *scanner = [[NSScanner alloc] initWithString:value];
                 NSString *fontName;
                 double fontSize;
@@ -879,7 +879,7 @@
             if ([self respondsToSelector:@selector(fontColor)]) {
                 fontColor = [(id)self fontColor];
             }
-            if (fontColor == nil && (value = [self 
valueForAnnotationKey:@"/DA"])) {
+            if (fontColor == nil && (value = [self 
valueForAnnotationKey:PDFAnnotationKeyDefaultAppearance])) {
                 NSUInteger end = [value rangeOfString:@"rg"].location;
                 if (end != NSNotFound) {
                     NSCharacterSet *numberChars = [NSCharacterSet 
characterSetWithCharactersInString:@"0123456789. "];

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