Revision: 14274
          http://sourceforge.net/p/skim-app/code/14274
Author:   hofman
Date:     2024-05-29 16:28:37 +0000 (Wed, 29 May 2024)
Log Message:
-----------
pass highlights instead of readingBar in thumbnail method

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

Modified: trunk/PDFPage_SKExtensions.h
===================================================================
--- trunk/PDFPage_SKExtensions.h        2024-05-29 16:12:56 UTC (rev 14273)
+++ trunk/PDFPage_SKExtensions.h        2024-05-29 16:28:37 UTC (rev 14274)
@@ -50,7 +50,7 @@
 extern NSString *SKPDFPageActionResize;
 extern NSString *SKPDFPageActionRotate;
 
-@class SKMainDocument, SKReadingBar, SKLine;
+@class SKMainDocument, SKLine;
 
 @interface PDFPage (SKExtensions) <NSFilePromiseProviderDelegate>
 
@@ -61,7 +61,7 @@
 @property (nonatomic, readonly) NSRect boundingBox;
 
 - (NSImage *)thumbnailWithSize:(CGFloat)size forBox:(PDFDisplayBox)box;
-- (NSImage *)thumbnailWithSize:(CGFloat)size forBox:(PDFDisplayBox)box 
readingBar:(nullable SKReadingBar *)readingBar;
+- (NSImage *)thumbnailWithSize:(CGFloat)size forBox:(PDFDisplayBox)box 
highlights:(nullable NSArray *)highlights;
 - (NSImage *)thumbnailWithSize:(CGFloat)size forBox:(PDFDisplayBox)box 
shadowBlurRadius:(CGFloat)shadowBlurRadius highlights:(nullable NSArray 
*)highlights;
 
 - (NSAttributedString *)thumbnailAttachmentWithSize:(CGFloat)size;

Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m        2024-05-29 16:12:56 UTC (rev 14273)
+++ trunk/PDFPage_SKExtensions.m        2024-05-29 16:28:37 UTC (rev 14274)
@@ -38,7 +38,6 @@
 
 #import "PDFPage_SKExtensions.h"
 #import <SkimNotes/SkimNotes.h>
-#import "SKReadingBar.h"
 #import "PDFSelection_SKExtensions.h"
 #import "SKRuntime.h"
 #import "NSBitmapImageRep_SKExtensions.h"
@@ -150,12 +149,11 @@
 }
 
 - (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box {
-    return  [self thumbnailWithSize:aSize forBox:box readingBar:nil];
+    return  [self thumbnailWithSize:aSize forBox:box highlights:nil];
 }
 
-- (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box 
readingBar:(SKReadingBar *)readingBar {
+- (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box 
highlights:(NSArray *)highlights {
     CGFloat shadowBlurRadius = round(aSize / 32.0);
-    NSArray *highlights = readingBar ? @[readingBar] : nil;
     return  [self thumbnailWithSize:aSize forBox:box 
shadowBlurRadius:shadowBlurRadius highlights:highlights];
 }
 

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2024-05-29 16:12:56 UTC (rev 14273)
+++ trunk/SKMainWindowController.m      2024-05-29 16:28:37 UTC (rev 14274)
@@ -2824,11 +2824,11 @@
         return NO;
     
     PDFPage *page = [self pageForThumbnail:thumbnail];
-    SKReadingBar *readingBar = [[[pdfView readingBar] page] isEqual:page] ? 
[pdfView readingBar] : nil;
+    NSArray *highlights = page && [[[pdfView readingBar] page] isEqual:page] ? 
@[[pdfView readingBar]] : nil;
     PDFDisplayBox box = [pdfView displayBox];
     
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 
0), ^{
-        NSImage *image = [page thumbnailWithSize:thumbnailCacheSize forBox:box 
readingBar:readingBar];
+        NSImage *image = [page thumbnailWithSize:thumbnailCacheSize forBox:box 
highlights:highlights];
         [image setAccessibilityDescription:[NSString 
stringWithFormat:NSLocalizedString(@"Page %@", @""), [page displayLabel]]];
         
         dispatch_async(dispatch_get_main_queue(), ^{
@@ -2889,7 +2889,7 @@
         if ([[pdfView document] isLocked])
             [stamps addObject:[[SKPageImage alloc] initWithImage:[[NSWorkspace 
sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kLockedBadgeIcon)] 
rect:rect fraction:0.5]];
         
-        NSImage *pageImage = [emptyPage thumbnailWithSize:thumbnailCacheSize 
forBox:box shadowBlurRadius:round(thumbnailCacheSize / 32.0) highlights:stamps];
+        NSImage *pageImage = [emptyPage thumbnailWithSize:thumbnailCacheSize 
forBox:box highlights:stamps];
         
         [pageLabels enumerateObjectsUsingBlock:^(NSString *label, NSUInteger 
i, BOOL *stop) {
             SKThumbnail *thumbnail = [[SKThumbnail alloc] 
initWithImage:pageImage label:label pageIndex:i];

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