Revision: 27815
http://sourceforge.net/p/bibdesk/svn/27815
Author: hofman
Date: 2022-08-20 09:36:08 +0000 (Sat, 20 Aug 2022)
Log Message:
-----------
use visual effect view with mask image for count bubbles on 11.0+, using
sidebar style and vibrancy
Modified Paths:
--------------
trunk/bibdesk/BDSKGroupBubbleView.h
trunk/bibdesk/BDSKGroupBubbleView.m
trunk/bibdesk/BDSKGroupOutlineView.m
Modified: trunk/bibdesk/BDSKGroupBubbleView.h
===================================================================
--- trunk/bibdesk/BDSKGroupBubbleView.h 2022-08-19 14:20:01 UTC (rev 27814)
+++ trunk/bibdesk/BDSKGroupBubbleView.h 2022-08-20 09:36:08 UTC (rev 27815)
@@ -39,7 +39,9 @@
#import <Cocoa/Cocoa.h>
-@interface BDSKGroupBubbleView : NSImageView
+@interface BDSKGroupBubbleView : NSImageView {
+ NSVisualEffectView *bgView;
+}
@end
@interface BDSKGroupBubbleCell : NSImageCell
Modified: trunk/bibdesk/BDSKGroupBubbleView.m
===================================================================
--- trunk/bibdesk/BDSKGroupBubbleView.m 2022-08-19 14:20:01 UTC (rev 27814)
+++ trunk/bibdesk/BDSKGroupBubbleView.m 2022-08-20 09:36:08 UTC (rev 27815)
@@ -44,11 +44,44 @@
+ (Class)cellClass { return [BDSKGroupBubbleCell class]; }
+- (id)initWithFrame:(NSRect)frameRect {
+ self = [super initWithFrame:frameRect];
+ if (self && RUNNING_AFTER(10_15)) {
+ bgView = [[NSVisualEffectView alloc] initWithFrame:[self bounds]];
+ [bgView setMaterial:7];
+ [bgView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ [bgView setHidden:YES];
+ [self addSubview:bgView];
+ }
+ return self;
+}
+
+- (id)initWithCoder:(NSCoder *)coder {
+ self = [super initWithCoder:coder];
+ if (self && RUNNING_AFTER(10_15)) {
+ bgView = [[NSVisualEffectView alloc] initWithFrame:[self bounds]];
+ [bgView setMaterial:7];
+ [bgView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ [bgView setHidden:YES];
+ [self addSubview:bgView];
+ }
+ return self;
+}
+
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
+ BDSKDESTROY(bgView);
[super dealloc];
}
+- (void)setImage:(NSImage *)image {
+ [super setImage:image];
+ if (RUNNING_AFTER(10_15)) {
+ [bgView setMaskImage:image];
+ [bgView setHidden:image == nil];
+ }
+}
+
- (void)handleKeyOrMainStateChangedNotification:(NSNotification *)note {
if ([self image])
[self setNeedsDisplay:YES];
@@ -81,13 +114,14 @@
@implementation BDSKGroupBubbleCell
- (BOOL)isEnabled {
- if (RUNNING_AFTER(10_9))
+ if (RUNNING_AFTER(10_9) && !RUNNING_AFTER(10_15))
return [self backgroundStyle] == NSBackgroundStyleDark;
return [super isEnabled];
}
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- if (RUNNING_AFTER(10_9) || [self backgroundStyle] == NSBackgroundStyleDark
|| [self backgroundStyle] == NSBackgroundStyleLowered) {
+ if (RUNNING_AFTER(10_15)) {
+ } else if (RUNNING_AFTER(10_9) || [self backgroundStyle] ==
NSBackgroundStyleDark || [self backgroundStyle] == NSBackgroundStyleLowered) {
[super drawInteriorWithFrame:cellFrame inView:controlView];
} else {
NSImage *savedImage = [[self image] retain];
Modified: trunk/bibdesk/BDSKGroupOutlineView.m
===================================================================
--- trunk/bibdesk/BDSKGroupOutlineView.m 2022-08-19 14:20:01 UTC (rev
27814)
+++ trunk/bibdesk/BDSKGroupOutlineView.m 2022-08-20 09:36:08 UTC (rev
27815)
@@ -138,7 +138,7 @@
if (count > 0) {
[countImage lockFocus];
NSRect rect = NSMakeRect(1.0, 0.0, size.width - 2.0, size.height);
- [[NSColor colorWithGenericGamma22White:0.0 alpha:0.85] setFill];
+ [[NSColor colorWithGenericGamma22White:0.0
alpha:RUNNING_AFTER(10_15) ? 1.0 : 0.9] setFill];
[NSBezierPath fillHorizontalOvalInRect:rect];
[[NSGraphicsContext currentContext]
setCompositingOperation:NSCompositeClear];
[countString drawWithRect:rect
options:NSStringDrawingUsesLineFragmentOrigin];
@@ -157,7 +157,7 @@
[path appendBezierPathWithRoundedRect:NSMakeRect(x - 0.8 * u, 7.0
* u, 1.6 * u, 4.0 * u) xRadius:0.8 * u yRadius:0.8 * u];
[path appendBezierPathWithOvalInRect:NSMakeRect(x - 0.8 * u, 4.8 *
u, 1.6 * u, 1.6 * u)];
[path setWindingRule:NSEvenOddWindingRule];
- [[NSColor colorWithGenericGamma22White:0.0 alpha:0.85] setFill];
+ [[NSColor colorWithGenericGamma22White:0.0
alpha:RUNNING_AFTER(10_15) ? 1.0 : 0.9] setFill];
[path fill];
[countImage unlockFocus];
[countImage setAccessibilityDescription:[NSString
stringWithFormat:NSLocalizedString(@"error", @""), count]];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit