Revision: 16299
          http://sourceforge.net/p/skim-app/code/16299
Author:   hofman
Date:     2026-05-23 21:10:50 +0000 (Sat, 23 May 2026)
Log Message:
-----------
mainBundle is the bundle of the app extension

Modified Paths:
--------------
    trunk/SkimQuickLookPreview/SKPreviewProvider.m
    trunk/SkimQuickLookPreview/SKQLConverter.h
    trunk/SkimQuickLookPreview/SKQLConverter.m
    trunk/SkimQuickLookThumbnails/SKQLConverter.h
    trunk/SkimQuickLookThumbnails/SKQLConverter.m
    trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m

Modified: trunk/SkimQuickLookPreview/SKPreviewProvider.m
===================================================================
--- trunk/SkimQuickLookPreview/SKPreviewProvider.m      2026-05-23 17:24:09 UTC 
(rev 16298)
+++ trunk/SkimQuickLookPreview/SKPreviewProvider.m      2026-05-23 21:10:50 UTC 
(rev 16299)
@@ -86,7 +86,7 @@
                 if ((data = [htmlString 
dataUsingEncoding:NSUTF8StringEncoding])) {
                     NSSet *types = [NSSet setWithArray:[notes 
valueForKey:@"type"]];
                     NSMutableDictionary *attachments = [NSMutableDictionary 
dictionary];
-                    NSBundle *bundle = [NSBundle 
bundleForClass:[SKPreviewProvider class]];
+                    NSBundle *bundle = [NSBundle mainBundle];
                     for (NSString *type in types) {
                         NSURL *imageURL = [bundle URLForImageResource:type];
                         if (imageURL) {

Modified: trunk/SkimQuickLookPreview/SKQLConverter.h
===================================================================
--- trunk/SkimQuickLookPreview/SKQLConverter.h  2026-05-23 17:24:09 UTC (rev 
16298)
+++ trunk/SkimQuickLookPreview/SKQLConverter.h  2026-05-23 21:10:50 UTC (rev 
16299)
@@ -42,6 +42,6 @@
 
 @interface SKQLConverter : NSObject
 + (NSArray *)notesWithData:(NSData *)data;
-+ (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes 
bundle:(NSBundle *)bundle;
++ (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes;
 + (NSString *)htmlStringWithNotes:(NSArray *)notes;
 @end

Modified: trunk/SkimQuickLookPreview/SKQLConverter.m
===================================================================
--- trunk/SkimQuickLookPreview/SKQLConverter.m  2026-05-23 17:24:09 UTC (rev 
16298)
+++ trunk/SkimQuickLookPreview/SKQLConverter.m  2026-05-23 21:10:50 UTC (rev 
16299)
@@ -62,13 +62,13 @@
     return pdfFile ? [url URLByAppendingPathComponent:pdfFile] : nil;
 }
 
-static NSAttributedString *imageAttachmentForType(NSString *type, NSBundle 
*bundle)
+static NSAttributedString *imageAttachmentForType(NSString *type)
 {
     static NSMutableDictionary *imageWrappers = nil;
     NSFileWrapper *wrapper = [imageWrappers objectForKey:type];
     
     if (wrapper == nil) {
-        NSURL *imgURL = [bundle URLForImageResource:type];
+        NSURL *imgURL = [[NSBundle mainBundle] URLForImageResource:type];
         if (imageWrappers == nil)
             imageWrappers = [[NSMutableDictionary alloc] init];
         wrapper = [[NSFileWrapper alloc] initWithURL:imgURL options:0 
error:NULL];
@@ -180,7 +180,7 @@
     return [notes isKindOfClass:[NSArray class]] ? notes : nil;
 }
 
-+ (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes 
bundle:(NSBundle *)bundle;
++ (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes;
 {
     NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] 
init];
     NSFont *font = [NSFont userFontOfSize:_fontSize];
@@ -211,7 +211,7 @@
             if ([color isKindOfClass:[NSArray class]])
                 color = colorFromArray((NSArray *)color);
             
-            [attrString appendAttributedString:imageAttachmentForType(type, 
bundle)];
+            [attrString appendAttributedString:imageAttachmentForType(type)];
             [attrString addAttribute:NSBackgroundColorAttributeName 
value:color range:NSMakeRange([attrString length] - 1, 1)];
             [attrString appendAttributedString:[[NSAttributedString alloc] 
initWithString:[NSString stringWithFormat:@"%@ (page %ld)\n", type, 
(long)(pageIndex+1)] attributes:attrs]];
             start = [attrString length];

Modified: trunk/SkimQuickLookThumbnails/SKQLConverter.h
===================================================================
--- trunk/SkimQuickLookThumbnails/SKQLConverter.h       2026-05-23 17:24:09 UTC 
(rev 16298)
+++ trunk/SkimQuickLookThumbnails/SKQLConverter.h       2026-05-23 21:10:50 UTC 
(rev 16299)
@@ -42,6 +42,6 @@
 
 @interface SKQLConverter : NSObject
 + (NSArray *)notesWithData:(NSData *)data;
-+ (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes 
bundle:(NSBundle *)bundle;
++ (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes;
 + (NSString *)htmlStringWithNotes:(NSArray *)notes;
 @end

Modified: trunk/SkimQuickLookThumbnails/SKQLConverter.m
===================================================================
--- trunk/SkimQuickLookThumbnails/SKQLConverter.m       2026-05-23 17:24:09 UTC 
(rev 16298)
+++ trunk/SkimQuickLookThumbnails/SKQLConverter.m       2026-05-23 21:10:50 UTC 
(rev 16299)
@@ -62,13 +62,13 @@
     return pdfFile ? [url URLByAppendingPathComponent:pdfFile] : nil;
 }
 
-static NSAttributedString *imageAttachmentForType(NSString *type, NSBundle 
*bundle)
+static NSAttributedString *imageAttachmentForType(NSString *type)
 {
     static NSMutableDictionary *imageWrappers = nil;
     NSFileWrapper *wrapper = [imageWrappers objectForKey:type];
     
     if (wrapper == nil) {
-        NSURL *imgURL = [bundle URLForImageResource:type];
+        NSURL *imgURL = [[NSBundle mainBundle] URLForImageResource:type];
         if (imageWrappers == nil)
             imageWrappers = [[NSMutableDictionary alloc] init];
         wrapper = [[NSFileWrapper alloc] initWithURL:imgURL options:0 
error:NULL];
@@ -180,7 +180,7 @@
     return [notes isKindOfClass:[NSArray class]] ? notes : nil;
 }
 
-+ (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes 
bundle:(NSBundle *)bundle;
++ (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes;
 {
     NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] 
init];
     NSFont *font = [NSFont userFontOfSize:_fontSize];
@@ -211,7 +211,7 @@
             if ([color isKindOfClass:[NSArray class]])
                 color = colorFromArray((NSArray *)color);
             
-            [attrString appendAttributedString:imageAttachmentForType(type, 
bundle)];
+            [attrString appendAttributedString:imageAttachmentForType(type)];
             [attrString addAttribute:NSBackgroundColorAttributeName 
value:color range:NSMakeRange([attrString length] - 1, 1)];
             [attrString appendAttributedString:[[NSAttributedString alloc] 
initWithString:[NSString stringWithFormat:@"%@ (page %ld)\n", type, 
(long)(pageIndex+1)] attributes:attrs]];
             start = [attrString length];

Modified: trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m
===================================================================
--- trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m 2026-05-23 17:24:09 UTC 
(rev 16298)
+++ trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m 2026-05-23 21:10:50 UTC 
(rev 16299)
@@ -51,7 +51,7 @@
 static const NSRect _iconRect = (NSRect) { { 50, 140 }, { 512, 512 } };
 
 // wash the app icon over a white page background
-static void drawBackgroundAndApplicationIconInCurrentContext(NSBundle *bundle)
+static void drawBackgroundAndApplicationIconInCurrentContext()
 {
     [[NSColor whiteColor] setFill];
     NSRect pageRect = { NSZeroPoint, _paperSize };
@@ -58,7 +58,7 @@
     NSRectFillUsingOperation(pageRect, NSCompositingOperationSourceOver);
     BOOL isHR = 
CGContextGetUserSpaceToDeviceSpaceTransform([[NSGraphicsContext currentContext] 
CGContext]).a > 1.0;
     
-    NSURL *iconURL = [bundle URLForImageResource:isHR ? @"Skim_2x" : @"Skim"];
+    NSURL *iconURL = [[NSBundle mainBundle] URLForImageResource:isHR ? 
@"Skim_2x" : @"Skim"];
     NSImage *appIcon = [[NSImage alloc] initWithContentsOfURL:iconURL];
     
     [appIcon drawInRect:_iconRect fromRect:NSZeroRect 
operation:NSCompositingOperationSourceOver fraction:0.3];
@@ -170,9 +170,8 @@
             NSData *data = [[NSData alloc] initWithContentsOfURL:fileURL 
options:NSDataReadingUncached error:NULL];
             
             if (data) {
-                NSBundle *bundle = [NSBundle 
bundleForClass:[SKThumbnailProvider class]];
                 NSArray *notes = [SKQLConverter notesWithData:data];
-                NSAttributedString *attrString = [SKQLConverter 
attributedStringWithNotes:notes bundle:bundle];
+                NSAttributedString *attrString = [SKQLConverter 
attributedStringWithNotes:notes];
                 
                 if (attrString) {
                     NSGraphicsContext *nsContext = [NSGraphicsContext 
graphicsContextWithCGContext:context flipped:YES];
@@ -179,7 +178,7 @@
                     [NSGraphicsContext saveGraphicsState];
                     [NSGraphicsContext setCurrentContext:nsContext];
                     
-                    drawBackgroundAndApplicationIconInCurrentContext(bundle);
+                    drawBackgroundAndApplicationIconInCurrentContext();
                     drawAttributedStringInCurrentContext(attrString);
                     
                     [NSGraphicsContext restoreGraphicsState];

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