Revision: 15417
          http://sourceforge.net/p/skim-app/code/15417
Author:   hofman
Date:     2025-06-08 22:09:37 +0000 (Sun, 08 Jun 2025)
Log Message:
-----------
try to add notes only when there are notes to add

Modified Paths:
--------------
    trunk/SKMainWindowController.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2025-06-08 21:59:01 UTC (rev 15416)
+++ trunk/SKMainWindowController.m      2025-06-08 22:09:37 UTC (rev 15417)
@@ -1148,22 +1148,25 @@
     if ([noteDicts count]) {
         widgetProperties = [NSMutableArray array];
         NSArray *notesAndPagesToAdd = [self 
annotationsAndPagesFromDictionaries:noteDicts forDocument:pdfDoc autoUpdate:NO 
widgetDictionaries:widgetProperties];
-        NSMutableArray *addedNotes = [NSMutableArray array];
-        BOOL shouldDisplay = [pdfView hideNotes] == NO;
         
-        mwcFlags.addOrRemoveNotesInBulk = 1;
-        
-        for (NSArray *annotationAndPage in notesAndPagesToAdd) {
-            PDFAnnotation *annotation = [annotationAndPage firstObject];
-            [annotation setShouldDisplay:shouldDisplay];
-            [annotation setShouldPrint:shouldDisplay];
-            [pdfDoc addAnnotation:annotation toPage:[annotationAndPage 
lastObject]];
-            [addedNotes addObject:annotation];
+        if ([notesAndPagesToAdd count]) {
+            NSMutableArray *addedNotes = [NSMutableArray array];
+            BOOL shouldDisplay = [pdfView hideNotes] == NO;
+            
+            mwcFlags.addOrRemoveNotesInBulk = 1;
+            
+            for (NSArray *annotationAndPage in notesAndPagesToAdd) {
+                PDFAnnotation *annotation = [annotationAndPage firstObject];
+                [annotation setShouldDisplay:shouldDisplay];
+                [annotation setShouldPrint:shouldDisplay];
+                [pdfDoc addAnnotation:annotation toPage:[annotationAndPage 
lastObject]];
+                [addedNotes addObject:annotation];
+            }
+            
+            mwcFlags.addOrRemoveNotesInBulk = 0;
+            
+            [self insertNotes:addedNotes atIndexes:[NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(0, [addedNotes count])]];
         }
-        
-        mwcFlags.addOrRemoveNotesInBulk = 0;
-        
-        [self insertNotes:addedNotes atIndexes:[NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(0, [addedNotes count])]];
     }
     
     [pdfView setDocument:pdfDocument];

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