Revision: 15393
          http://sourceforge.net/p/skim-app/code/15393
Author:   hofman
Date:     2025-06-06 21:44:13 +0000 (Fri, 06 Jun 2025)
Log Message:
-----------
check page indexes directly

Modified Paths:
--------------
    trunk/PDFView_SKExtensions.h
    trunk/PDFView_SKExtensions.m
    trunk/SKMainWindowController.m
    trunk/SKSnapshotWindowController.h
    trunk/SKSnapshotWindowController.m

Modified: trunk/PDFView_SKExtensions.h
===================================================================
--- trunk/PDFView_SKExtensions.h        2025-06-06 21:37:03 UTC (rev 15392)
+++ trunk/PDFView_SKExtensions.h        2025-06-06 21:44:13 UTC (rev 15393)
@@ -55,6 +55,7 @@
 @property (nonatomic, readonly) NSRect visibleContentRect;
 
 - (BOOL)isPageAtIndexDisplayed:(NSUInteger)pageIndex;
+- (BOOL)isPageAtIndexesDisplayed:(NSIndexSet *)pageIndexes;
 
 - (void)updatedAnnotation:(PDFAnnotation *)annotation;
 - (void)addedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page;

Modified: trunk/PDFView_SKExtensions.m
===================================================================
--- trunk/PDFView_SKExtensions.m        2025-06-06 21:37:03 UTC (rev 15392)
+++ trunk/PDFView_SKExtensions.m        2025-06-06 21:44:13 UTC (rev 15393)
@@ -255,6 +255,10 @@
     return NSLocationInRange(pageIndex, [self displayedPageIndexRange]);
 }
 
+- (BOOL)isPageAtIndexesDisplayed:(NSIndexSet *)pageIndexes {
+    return [pageIndexes intersectsIndexesInRange:[self 
displayedPageIndexRange]];
+}
+
 - (NSArray *)displayedPages {
     NSMutableArray *displayedPages = [NSMutableArray array];
     PDFDocument *pdfDoc = [self document];

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2025-06-06 21:37:03 UTC (rev 15392)
+++ trunk/SKMainWindowController.m      2025-06-06 21:44:13 UTC (rev 15393)
@@ -1054,13 +1054,8 @@
     [rightSideController.noteOutlineView reloadData];
     [self updateThumbnailsAtPageIndexes:pageIndexes];
     for (SKSnapshotWindowController *wc in snapshots) {
-        [pageIndexes enumerateIndexesUsingBlock:^(NSUInteger i, BOOL *stop){
-            PDFPage *page = [pdfDoc pageAtIndex:i];
-            if ([wc isPageVisible:page]) {
-                [self snapshotNeedsUpdate:wc lowPriority:NO];
-                *stop = YES;
-            }
-        }];
+        if ([wc isPageInIndexesVisible:pageIndexes])
+            [self snapshotNeedsUpdate:wc lowPriority:NO];
     }
     [pdfView resetPDFToolTipRects];
 }

Modified: trunk/SKSnapshotWindowController.h
===================================================================
--- trunk/SKSnapshotWindowController.h  2025-06-06 21:37:03 UTC (rev 15392)
+++ trunk/SKSnapshotWindowController.h  2025-06-06 21:44:13 UTC (rev 15393)
@@ -84,6 +84,7 @@
 - (void)setPdfDocument:(PDFDocument *)pdfDocument 
previewPageNumber:(NSInteger)pageNum displayOnScreen:(nullable NSScreen 
*)screen;
 
 - (BOOL)isPageVisible:(PDFPage *)page;
+- (BOOL)isPageInIndexesVisible:(NSIndexSet *)pageIndexes;
 
 - (void)updatePageLabel;
 

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2025-06-06 21:37:03 UTC (rev 15392)
+++ trunk/SKSnapshotWindowController.m  2025-06-06 21:44:13 UTC (rev 15393)
@@ -367,6 +367,10 @@
     return [[page document] isEqual:[pdfView document]] && [pdfView 
isPageAtIndexDisplayed:[page pageIndex]];
 }
 
+- (BOOL)isPageInIndexesVisible:(NSIndexSet *)pageIndexes {
+    return [pdfView isPageAtIndexesDisplayed:pageIndexes];
+}
+
 #pragma mark Acessors
 
 - (NSRect)bounds {

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