Revision: 16584
          http://sourceforge.net/p/skim-app/code/16584
Author:   hofman
Date:     2026-10-01 16:19:41 +0000 (Thu, 01 Oct 2026)
Log Message:
-----------
change order for note types

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

Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-10-01 16:07:25 UTC 
(rev 16583)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.m       2026-10-01 16:19:41 UTC 
(rev 16584)
@@ -323,6 +323,9 @@
 @interface PDFAnnotationMarkup (SKNExtensions)
 @end
 
+@interface PDFAnnotationInk (SKNExtensions)
+@end
+
 @interface PDFAnnotationText (SKNExtensions)
 @end
 
@@ -329,9 +332,6 @@
 @interface PDFAnnotationStamp (SKNExtensions)
 @end
 
-@interface PDFAnnotationInk (SKNExtensions)
-@end
-
 @interface PDFAnnotationTextWidget (SKNExtensions)
 @end
 
@@ -562,15 +562,6 @@
             if ([pointStrings isKindOfClass:arrayClass])
                 [self 
setQuadrilateralPoints:quadrilateralPointsFromPointStrings(pointStrings)];
             
-        } else if ([type isEqualToString:SKNTextString] || [type 
isEqualToString:SKNStampString] || [type isEqualToString:SKNNoteString]) {
-            
-            NSString *name = [dict objectForKey:SKNPDFAnnotationNameKey];
-            NSNumber *iconType = [dict 
objectForKey:SKNPDFAnnotationIconTypeKey];
-            if ([iconType respondsToSelector:@selector(integerValue)])
-                [self setIconType:[iconType integerValue]];
-            if ([name isKindOfClass:stringClass])
-                [self setStampName:name];
-            
         } else if ([type isEqualToString:SKNInkString]) {
             
             NSArray *pointLists = [dict 
objectForKey:SKNPDFAnnotationPointListsKey];
@@ -584,6 +575,15 @@
                 }
             }
             
+        } else if ([type isEqualToString:SKNTextString] || [type 
isEqualToString:SKNStampString] || [type isEqualToString:SKNNoteString]) {
+            
+            NSString *name = [dict objectForKey:SKNPDFAnnotationNameKey];
+            NSNumber *iconType = [dict 
objectForKey:SKNPDFAnnotationIconTypeKey];
+            if ([iconType respondsToSelector:@selector(integerValue)])
+                [self setIconType:[iconType integerValue]];
+            if ([name isKindOfClass:stringClass])
+                [self setStampName:name];
+            
         } else if ([type isEqualToString:SKNWidgetString]) {
             
             SKNPDFWidgetType widgetType = [[dict 
objectForKey:SKNPDFAnnotationWidgetTypeKey] integerValue];
@@ -728,8 +728,45 @@
         Class arrayClass = [NSArray class];
         Class stringClass = [NSString class];
         
-        if ([type isEqualToString:SKNFreeTextString]) {
+        if (([type isEqualToString:SKNCircleString] || [type 
isEqualToString:SKNSquareString]) || [type isEqualToString:SKNLineString]) {
             
+            PDFKitPlatformColor *color = nil;
+            if ([self respondsToSelector:@selector(interiorColor)])
+                color = [(id)self interiorColor];
+            if (color == nil && (value = [self valueForAnnotationKey:@"/IC"]))
+                color = SKNColorFromAnnotationValue(value);
+            if (color)
+                [dict setValue:color forKey:SKNPDFAnnotationInteriorColorKey];
+            
+            if ([type isEqualToString:SKNLineString]) {
+                
+                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"])) {
+                    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];
+                    }
+                }
+                
+                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"])) {
+                    if ([value isKindOfClass:arrayClass] && [value count] == 
4) {
+                        PDFRect bounds = [self bounds];
+                        PDFPoint p = SKNMakePoint([[value objectAtIndex:0] 
doubleValue] - bounds.origin.x, [[value objectAtIndex:1] doubleValue] - 
bounds.origin.y);
+                        [dict setValue:SKNStringFromPoint(p) 
forKey:SKNPDFAnnotationStartPointKey];
+                        p = SKNMakePoint([[value objectAtIndex:2] doubleValue] 
- bounds.origin.x, [[value objectAtIndex:3] doubleValue] - bounds.origin.y);
+                        [dict setValue:SKNStringFromPoint(p) 
forKey:SKNPDFAnnotationEndPointKey];
+                    }
+                }
+                
+            }
+            
+        } else if ([type isEqualToString:SKNFreeTextString]) {
+            
             if ([self respondsToSelector:@selector(alignment)]) {
                 [dict setValue:[NSNumber 
numberWithInteger:SKNAlignmentFromTextAlignment([(id)self alignment])] 
forKey:SKNPDFAnnotationAlignmentKey];
             } else if ((value = [self valueForAnnotationKey:@"/Q"])) {
@@ -784,43 +821,6 @@
             if (fontColor)
                 [dict setObject:fontColor forKey:SKNPDFAnnotationFontColorKey];
             
-        } else if (([type isEqualToString:SKNCircleString] || [type 
isEqualToString:SKNSquareString]) || [type isEqualToString:SKNLineString]) {
-            
-            PDFKitPlatformColor *color = nil;
-            if ([self respondsToSelector:@selector(interiorColor)])
-                color = [(id)self interiorColor];
-            if (color == nil && (value = [self valueForAnnotationKey:@"/IC"]))
-                color = SKNColorFromAnnotationValue(value);
-            if (color)
-                [dict setValue:color forKey:SKNPDFAnnotationInteriorColorKey];
-            
-            if ([type isEqualToString:SKNLineString]) {
-                
-                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"])) {
-                    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];
-                    }
-                }
-                
-                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"])) {
-                    if ([value isKindOfClass:arrayClass] && [value count] == 
4) {
-                        PDFRect bounds = [self bounds];
-                        PDFPoint p = SKNMakePoint([[value objectAtIndex:0] 
doubleValue] - bounds.origin.x, [[value objectAtIndex:1] doubleValue] - 
bounds.origin.y);
-                        [dict setValue:SKNStringFromPoint(p) 
forKey:SKNPDFAnnotationStartPointKey];
-                        p = SKNMakePoint([[value objectAtIndex:2] doubleValue] 
- bounds.origin.x, [[value objectAtIndex:3] doubleValue] - bounds.origin.y);
-                        [dict setValue:SKNStringFromPoint(p) 
forKey:SKNPDFAnnotationEndPointKey];
-                    }
-                }
-                
-            }
-            
         } else if ([type isEqualToString:SKNHighlightString] || [type 
isEqualToString:SKNMarkUpString] || [type isEqualToString:SKNUnderlineString] 
|| [type isEqualToString:SKNStrikeOutString] || [type 
isEqualToString:SKNSquigglyString]) {
             
             if ([self respondsToSelector:@selector(quadrilateralPoints)]) {
@@ -1500,14 +1500,23 @@
 
 #pragma mark -
 
-@implementation PDFAnnotationText (SKNExtensions)
+@implementation PDFAnnotationInk (SKNExtensions)
 
 - (id)initSkimNoteWithProperties:(NSDictionary *)dict{
     self = [super initSkimNoteWithProperties:dict];
     if (self) {
-        NSNumber *iconType = [dict objectForKey:SKNPDFAnnotationIconTypeKey];
-        if ([iconType respondsToSelector:@selector(integerValue)])
-            [self setIconType:[iconType integerValue]];
+        Class arrayClass = [NSArray class];
+        Class selfClass = [self class];
+        NSArray *pointLists = [dict 
objectForKey:SKNPDFAnnotationPointListsKey];
+        if ([pointLists isKindOfClass:arrayClass]) {
+            for (NSArray *pointStrings in pointLists) {
+                if ([pointStrings isKindOfClass:arrayClass]) {
+                    NSBezierPath *path = [[NSBezierPath alloc] init];
+                    [selfClass setPoints:pointStrings ofSkimNotePath:path];
+                    [self addBezierPath:path];
+                }
+            }
+        }
     }
     return self;
 }
@@ -1514,25 +1523,39 @@
 
 - (NSDictionary *)SkimNoteProperties{
     NSMutableDictionary *dict = [self genericSkimNoteProperties];
-    [dict setValue:[NSNumber numberWithInteger:[self iconType]] 
forKey:SKNPDFAnnotationIconTypeKey];
+    NSArray *paths = [self paths];
+    if (paths) {
+        Class selfClass = [self class];
+        NSMutableArray *pointLists = [[NSMutableArray alloc] 
initWithCapacity:[paths count]];
+        for (NSBezierPath *path in paths) {
+            NSArray *pointStrings = [selfClass pointsFromSkimNotePath:path];
+            if ([pointStrings count])
+                [pointLists addObject:pointStrings];
+        }
+        [dict setValue:pointLists forKey:SKNPDFAnnotationPointListsKey];
+    }
     return dict;
 }
 
+- (NSString *)string {
+    return [self contents];
+}
+
+- (void)setString:(NSString *)string {
+    [self setContents:string];
+}
+
 @end
 
 #pragma mark -
 
-@implementation PDFAnnotationStamp (SKNExtensions)
+@implementation PDFAnnotationText (SKNExtensions)
 
 - (id)initSkimNoteWithProperties:(NSDictionary *)dict{
     self = [super initSkimNoteWithProperties:dict];
     if (self) {
-        Class stringClass = [NSString class];
-        NSString *name = [dict objectForKey:SKNPDFAnnotationNameKey];
-        if ([name isKindOfClass:stringClass])
-            [self setName:name];
         NSNumber *iconType = [dict objectForKey:SKNPDFAnnotationIconTypeKey];
-        if ([iconType respondsToSelector:@selector(integerValue)] && [self 
respondsToSelector:@selector(setIconType:)])
+        if ([iconType respondsToSelector:@selector(integerValue)])
             [self setIconType:[iconType integerValue]];
     }
     return self;
@@ -1540,11 +1563,7 @@
 
 - (NSDictionary *)SkimNoteProperties{
     NSMutableDictionary *dict = [self genericSkimNoteProperties];
-    NSString *name = [self name];
-    [dict setValue:name forKey:SKNPDFAnnotationNameKey];
-    if (name && [[NSSet setWithObjects:@"/Comment", @"/Key", @"/Note", 
@"/Help", @"/NewParagraph", @"/Paragraph", @"/Insert", nil] 
containsObject:name] && [self respondsToSelector:@selector(iconType)])
-        [dict setValue:[NSNumber numberWithInteger:[self iconType]] 
forKey:SKNPDFAnnotationIconTypeKey];
-    [dict setValue:appearanceImageForAnnotation(self) 
forKey:SKNPDFAnnotationImageKey];
+    [dict setValue:[NSNumber numberWithInteger:[self iconType]] 
forKey:SKNPDFAnnotationIconTypeKey];
     return dict;
 }
 
@@ -1552,23 +1571,18 @@
 
 #pragma mark -
 
-@implementation PDFAnnotationInk (SKNExtensions)
+@implementation PDFAnnotationStamp (SKNExtensions)
 
 - (id)initSkimNoteWithProperties:(NSDictionary *)dict{
     self = [super initSkimNoteWithProperties:dict];
     if (self) {
-        Class arrayClass = [NSArray class];
-        Class selfClass = [self class];
-        NSArray *pointLists = [dict 
objectForKey:SKNPDFAnnotationPointListsKey];
-        if ([pointLists isKindOfClass:arrayClass]) {
-            for (NSArray *pointStrings in pointLists) {
-                if ([pointStrings isKindOfClass:arrayClass]) {
-                    NSBezierPath *path = [[NSBezierPath alloc] init];
-                    [selfClass setPoints:pointStrings ofSkimNotePath:path];
-                    [self addBezierPath:path];
-                }
-            }
-        }
+        Class stringClass = [NSString class];
+        NSString *name = [dict objectForKey:SKNPDFAnnotationNameKey];
+        if ([name isKindOfClass:stringClass])
+            [self setName:name];
+        NSNumber *iconType = [dict objectForKey:SKNPDFAnnotationIconTypeKey];
+        if ([iconType respondsToSelector:@selector(integerValue)] && [self 
respondsToSelector:@selector(setIconType:)])
+            [self setIconType:[iconType integerValue]];
     }
     return self;
 }
@@ -1575,28 +1589,14 @@
 
 - (NSDictionary *)SkimNoteProperties{
     NSMutableDictionary *dict = [self genericSkimNoteProperties];
-    NSArray *paths = [self paths];
-    if (paths) {
-        Class selfClass = [self class];
-        NSMutableArray *pointLists = [[NSMutableArray alloc] 
initWithCapacity:[paths count]];
-        for (NSBezierPath *path in paths) {
-            NSArray *pointStrings = [selfClass pointsFromSkimNotePath:path];
-            if ([pointStrings count])
-                [pointLists addObject:pointStrings];
-        }
-        [dict setValue:pointLists forKey:SKNPDFAnnotationPointListsKey];
-    }
+    NSString *name = [self name];
+    [dict setValue:name forKey:SKNPDFAnnotationNameKey];
+    if (name && [[NSSet setWithObjects:@"/Comment", @"/Key", @"/Note", 
@"/Help", @"/NewParagraph", @"/Paragraph", @"/Insert", nil] 
containsObject:name] && [self respondsToSelector:@selector(iconType)])
+        [dict setValue:[NSNumber numberWithInteger:[self iconType]] 
forKey:SKNPDFAnnotationIconTypeKey];
+    [dict setValue:appearanceImageForAnnotation(self) 
forKey:SKNPDFAnnotationImageKey];
     return dict;
 }
 
-- (NSString *)string {
-    return [self contents];
-}
-
-- (void)setString:(NSString *)string {
-    [self setContents:string];
-}
-
 @end
 
 #pragma mark -

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