Revision: 16543
          http://sourceforge.net/p/skim-app/code/16543
Author:   hofman
Date:     2026-09-27 13:48:29 +0000 (Sun, 27 Sep 2026)
Log Message:
-----------
combine normalizing note properties

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

Modified: trunk/SkimNotes/skimpdf.m
===================================================================
--- trunk/SkimNotes/skimpdf.m   2026-09-27 08:50:38 UTC (rev 16542)
+++ trunk/SkimNotes/skimpdf.m   2026-09-27 13:48:29 UTC (rev 16543)
@@ -378,14 +378,9 @@
                     for (PDFAnnotation *annotation in annotations) {
                         if ([convertibleTypes containsObject:[annotation 
type]]) {
                             NSDictionary *note = [annotation 
SkimNoteProperties];
-                            if ([[annotation type] 
isEqualToString:SKNTextString]) {
+                            if ([[annotation type] 
isEqualToString:SKNTextString] || [[annotation type] 
isEqualToString:SKNStampString]) {
                                 NSMutableDictionary *mutableNote = [note 
mutableCopy];
-                                NSRect bounds = NSRectFromString([note 
objectForKey:SKNPDFAnnotationBoundsKey]);
                                 NSString *contents = [note 
objectForKey:SKNPDFAnnotationContentsKey];
-                                [mutableNote setObject:SKNNoteString 
forKey:SKNPDFAnnotationTypeKey];
-                                bounds.origin.y = NSMaxY(bounds) - 
SKNPDFAnnotationNoteSize.height;
-                                bounds.size = SKNPDFAnnotationNoteSize;
-                                [mutableNote 
setObject:NSStringFromRect(bounds) forKey:SKNPDFAnnotationBoundsKey];
                                 if (contents) {
                                     NSRange r = [contents rangeOfString:@"  "];
                                     NSRange r1 = [contents 
rangeOfString:@"\n"];
@@ -397,22 +392,16 @@
                                         [mutableNote setObject:[contents 
substringToIndex:r.location] forKey:SKNPDFAnnotationContentsKey];
                                     }
                                 }
-                                note = mutableNote;
-                            } else if ([[annotation type] 
isEqualToString:SKNStampString]) {
-                                NSMutableDictionary *mutableNote = [note 
mutableCopy];
-                                NSString *contents = [note 
objectForKey:SKNPDFAnnotationContentsKey];
                                 [mutableNote setObject:SKNNoteString 
forKey:SKNPDFAnnotationTypeKey];
-                                [mutableNote setObject:[NSNumber 
numberWithBool:YES] forKey:SKNPDFAnnotationDrawsImageKey];
-                                if (contents) {
-                                    NSRange r = [contents rangeOfString:@"  "];
-                                    NSRange r1 = [contents 
rangeOfString:@"\n"];
-                                    if (r1.location < r.location)
-                                        r = r1;
-                                    if (NSMaxRange(r) < [contents length]) {
-                                        NSAttributedString *attrString = 
[[NSAttributedString alloc] initWithString:[contents 
substringFromIndex:NSMaxRange(r)]];
-                                        [mutableNote setObject:attrString 
forKey:SKNPDFAnnotationTextKey];
-                                        [mutableNote setObject:[contents 
substringToIndex:r.location] forKey:SKNPDFAnnotationContentsKey];
+                                if ([[annotation type] 
isEqualToString:SKNTextString]) {
+                                    NSRect bounds = NSRectFromString([note 
objectForKey:SKNPDFAnnotationBoundsKey]);
+                                    if (NSEqualSizes(bounds.size, 
SKNPDFAnnotationNoteSize) == NO) {
+                                        bounds.origin.y = NSMaxY(bounds) - 
SKNPDFAnnotationNoteSize.height;
+                                        bounds.size = SKNPDFAnnotationNoteSize;
+                                        [mutableNote 
setObject:NSStringFromRect(bounds) forKey:SKNPDFAnnotationBoundsKey];
                                     }
+                                } else {
+                                    [mutableNote setObject:[NSNumber 
numberWithBool:YES] forKey:SKNPDFAnnotationDrawsImageKey];
                                 }
                                 note = mutableNote;
                             }

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