Revision: 15151 http://sourceforge.net/p/skim-app/code/15151 Author: hofman Date: 2025-05-04 14:29:24 +0000 (Sun, 04 May 2025) Log Message: ----------- No need for NSAttributedString to conform to SKToolTipImageContext. Don't override isOpaque for tooltip images from attributed string.
Modified Paths: -------------- trunk/SKImageToolTipContext.h trunk/SKImageToolTipContext.m Modified: trunk/SKImageToolTipContext.h =================================================================== --- trunk/SKImageToolTipContext.h 2025-05-04 14:10:32 UTC (rev 15150) +++ trunk/SKImageToolTipContext.h 2025-05-04 14:29:24 UTC (rev 15151) @@ -47,9 +47,6 @@ @end -@interface NSAttributedString (SKImageToolTipContext) <SKImageToolTipContext> -@end - @interface PDFDestination (SKImageToolTipContext) <SKImageToolTipContext> @end Modified: trunk/SKImageToolTipContext.m =================================================================== --- trunk/SKImageToolTipContext.m 2025-05-04 14:10:32 UTC (rev 15150) +++ trunk/SKImageToolTipContext.m 2025-05-04 14:29:24 UTC (rev 15151) @@ -67,9 +67,13 @@ } +@interface NSAttributedString (SKImageToolTipContext) +- (NSImage *)toolTipImage; +@end + @implementation NSAttributedString (SKImageToolTipContext) -- (NSImage *)toolTipImageWithScale:(CGFloat)scale { +- (NSImage *)toolTipImage { NSAttributedString *attrString = [self attributedStringByAddingControlTextColorAttribute]; CGFloat width = [[NSUserDefaults standardUserDefaults] doubleForKey:SKToolTipWidthKey] - 2.0 * TEXT_MARGIN_X; CGFloat height = [[NSUserDefaults standardUserDefaults] doubleForKey:SKToolTipHeightKey] - 2.0 * TEXT_MARGIN_Y; @@ -216,16 +220,16 @@ if ([self isLink]) { NSImage *image = [[self destination] toolTipImageWithScale:scale selections:nil label:nil]; - if (image == nil) { + if (image) { + [[[image representations] firstObject] setOpaque:YES]; + return image; + } else { NSURL *url = [self URL]; if (url) { NSAttributedString *attrString = toolTipAttributedString([url absoluteString]); if ([attrString length]) - image = [attrString toolTipImageWithScale:1.0]; + image = [attrString toolTipImage]; } - } - if (image) { - [[[image representations] firstObject] setOpaque:YES]; return image; } } @@ -252,7 +256,7 @@ attrString = [attrString attributedSubstringFromRange:r]; } - return [attrString length] ? [attrString toolTipImageWithScale:1.0] : nil; + return [attrString length] ? [attrString toolTipImage] : nil; } @end 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