Revision: 15398
          http://sourceforge.net/p/skim-app/code/15398
Author:   hofman
Date:     2025-06-07 20:50:06 +0000 (Sat, 07 Jun 2025)
Log Message:
-----------
set shouldDisplay when adding the note to the page

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2025-06-07 16:04:20 UTC (rev 15397)
+++ trunk/SKMainWindowController.m      2025-06-07 20:50:06 UTC (rev 15398)
@@ -985,8 +985,11 @@
     }
 
     if ([notesAndPagesToAdd count]) {
+        BOOL shouldDisplay = [pdfView hideNotes] == NO;
         for (NSArray *annotationAndPage in notesAndPagesToAdd) {
             PDFAnnotation *annotation = [annotationAndPage firstObject];
+            [annotation setShouldDisplay:shouldDisplay];
+            [annotation setShouldPrint:shouldDisplay];
             [addedNotes addObject:annotation];
             [pageIndexes addIndex:[annotation pageIndex]];
             [pdfDoc addAnnotation:annotation toPage:[annotationAndPage 
lastObject]];
@@ -1018,7 +1021,6 @@
 
 - (NSArray *)annotationsAndPagesFromDictionaries:(NSArray *)noteDicts 
forDocument:(PDFDocument *)pdfDoc autoUpdate:(BOOL)autoUpdate 
widgetDictionaries:(NSMutableArray *)widgetDicts {
     NSMutableArray *notesAndPagesToAdd = [NSMutableArray array];
-    BOOL shouldDisplay = [pdfView hideNotes] == NO;
     
     // create new annotations from the dictionary and get the page to add to
     for (NSDictionary *dict in noteDicts) {
@@ -1034,8 +1036,6 @@
                     pageIndex = 0;
                 else if (pageIndex >= [pdfDoc pageCount])
                     pageIndex = [pdfDoc pageCount] - 1;
-                [annotation setShouldDisplay:shouldDisplay];
-                [annotation setShouldPrint:shouldDisplay];
                 PDFPage *page = [pdfDoc pageAtIndex:pageIndex];
                 if (autoUpdate && [[annotation contents] length] == 0)
                     [annotation autoUpdateStringWithPage:page];
@@ -1160,9 +1160,12 @@
     if ([noteDicts count]) {
         NSArray *notesAndPagesToAdd = [self 
annotationsAndPagesFromDictionaries:noteDicts forDocument:pdfDoc autoUpdate:NO 
widgetDictionaries:nil];
         NSMutableArray *addedNotes = [NSMutableArray array];
+        BOOL shouldDisplay = [pdfView hideNotes] == NO;
         
         for (NSArray *annotationAndPage in notesAndPagesToAdd) {
             PDFAnnotation *annotation = [annotationAndPage firstObject];
+            [annotation setShouldDisplay:shouldDisplay];
+            [annotation setShouldPrint:shouldDisplay];
             [pdfDoc addAnnotation:annotation toPage:[annotationAndPage 
lastObject]];
             [addedNotes addObject:annotation];
         }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to