Revision: 28420
http://sourceforge.net/p/bibdesk/svn/28420
Author: hofman
Date: 2023-11-04 17:52:29 +0000 (Sat, 04 Nov 2023)
Log Message:
-----------
Use @available
Modified Paths:
--------------
trunk/bibdesk/BDSKBookmarkController.m
trunk/bibdesk/BDSKCategoryGroup.m
trunk/bibdesk/BDSKCompatibility.h
trunk/bibdesk/BDSKCustomCiteDrawerController.m
trunk/bibdesk/BDSKEdgeView.m
trunk/bibdesk/BDSKEditor.m
trunk/bibdesk/BDSKErrorEditor.m
trunk/bibdesk/BDSKFileContentSearchController.m
trunk/bibdesk/BDSKGroupBubbleView.m
trunk/bibdesk/BDSKGroupOutlineView.m
trunk/bibdesk/BDSKGroupRowView.m
trunk/bibdesk/BDSKMainTableView.m
trunk/bibdesk/BDSKPreferenceController.m
trunk/bibdesk/BDSKPreviewer.m
trunk/bibdesk/BDSKReadMeController.m
trunk/bibdesk/BDSKSearchBookmarkController.m
trunk/bibdesk/BDSKTemplateDocument.m
trunk/bibdesk/BDSKTextImportController.m
trunk/bibdesk/BDSKZoomablePDFView.m
trunk/bibdesk/BDSKZoomableTextView.m
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_Toolbar.m
trunk/bibdesk/BibDocument_UI.m
trunk/bibdesk/NSColor_BDSKExtensions.m
trunk/bibdesk/NSImage_BDSKExtensions.m
Modified: trunk/bibdesk/BDSKBookmarkController.m
===================================================================
--- trunk/bibdesk/BDSKBookmarkController.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/BDSKBookmarkController.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -72,7 +72,8 @@
#define NAME_KEY @"name"
#define URL_KEY @"URL"
-#define INDENT (RUNNING_AFTER(10_15) ? 9.0 : 16.0)
+#define INDENT 9.0
+#define OLD_INDENT 16.0
static char BDSKBookmarkPropertiesObservationContext;
@@ -457,7 +458,11 @@
NSTableColumn *tableColumn = [ov outlineTableColumn];
NSTableCellView *view = [ov makeViewWithIdentifier:[tableColumn
identifier] owner:self];
__block NSInteger validCount = 0;
- NSRect frame = NSMakeRect(0.0, 0.0, [tableColumn width] - INDENT, [ov
rowHeight]);
+ NSRect frame = NSMakeRect(0.0, 0.0, [tableColumn width], [ov
rowHeight]);
+ if (@available(macOS 11.0, *))
+ frame.size.width -= INDENT;
+ else
+ frame.size.width -= OLD_INDENT;
[view setFrame:frame];
frame.origin = [draggingInfo draggingLocation];
@@ -606,7 +611,7 @@
BOOL isSep = ([item bookmarkType] == BDSKBookmarkTypeSeparator);
NSString *identifier = isSep ? @"separator" : [tableColumn identifier];
NSTableCellView *view = [ov makeViewWithIdentifier:identifier owner:self];
- if (!RUNNING_AFTER(10_15)) {
+ if (@available(macOS 11.0, *)) {} else {
BOOL isLast = [[tableColumn identifier] isEqualToString:@"url"];
if (isLast || isSep)
[[view constraintWithFirstItem:view
firstAttribute:NSLayoutAttributeTrailing] setConstant:isSep == NO ? 4.0 :
isLast ? 2.0 : 0.0];
@@ -669,7 +674,7 @@
[item setPaletteLabel:NSLocalizedString(@"New Bookmark", @"Toolbar item
label")];
[item setToolTip:NSLocalizedString(@"Add a New Bookmark", @"Tool tip
message")];
[item setView:addBookmarkButton];
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *)) {} else
[addBookmarkButton setImageScaling:NSImageScaleNone forSegment:0];
[toolbarItems setObject:item
forKey:BDSKBookmarksNewBookmarkToolbarItemIdentifier];
[item release];
@@ -679,7 +684,7 @@
[item setPaletteLabel:NSLocalizedString(@"New Folder", @"Toolbar item
label")];
[item setToolTip:NSLocalizedString(@"Add a New Folder", @"Tool tip
message")];
[item setView:addFolderButton];
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *)) {} else
[addFolderButton setImageScaling:NSImageScaleNone forSegment:0];
[toolbarItems setObject:item
forKey:BDSKBookmarksNewFolderToolbarItemIdentifier];
[item release];
@@ -689,7 +694,7 @@
[item setPaletteLabel:NSLocalizedString(@"New Separator", @"Toolbar item
label")];
[item setToolTip:NSLocalizedString(@"Add a New Separator", @"Tool tip
message")];
[item setView:addSeparatorButton];
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *)) {} else
[addSeparatorButton setImageScaling:NSImageScaleNone forSegment:0];
[toolbarItems setObject:item
forKey:BDSKBookmarksNewSeparatorToolbarItemIdentifier];
[item release];
@@ -699,7 +704,7 @@
[item setPaletteLabel:NSLocalizedString(@"Delete", @"Toolbar item label")];
[item setToolTip:NSLocalizedString(@"Delete Selected Items", @"Tool tip
message")];
[item setView:deleteButton];
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *)) {} else
[deleteButton setImageScaling:NSImageScaleNone forSegment:0];
[deleteButton setEnabled:[outlineView numberOfSelectedRows] > 0];
[toolbarItems setObject:item
forKey:BDSKBookmarksDeleteToolbarItemIdentifier];
Modified: trunk/bibdesk/BDSKCategoryGroup.m
===================================================================
--- trunk/bibdesk/BDSKCategoryGroup.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKCategoryGroup.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -149,10 +149,13 @@
NSImage *smartFolderImage = [NSImage
imageNamed:NSImageNameFolderSmart];
CIFilter *hueAdjustFilter = [CIFilter filterWithName:@"CIHueAdjust"];
CIFilter *colorControlsFilter = [CIFilter
filterWithName:@"CIColorControls"];
- [hueAdjustFilter setValue:[NSNumber
numberWithDouble:RUNNING_AFTER(10_15) ? 2.4 : 2.7] forKey:@"inputAngle"];
+ if (@available(macOS 11.0, *))
+ [hueAdjustFilter setValue:@2.4 forKey:@"inputAngle"];
+ else
+ [hueAdjustFilter setValue:@2.7 forKey:@"inputAngle"];
[colorControlsFilter setDefaults];
- [colorControlsFilter setValue:[NSNumber numberWithDouble:1.5]
forKey:@"inputSaturation"];
- [colorControlsFilter setValue:[NSNumber numberWithDouble:0.3]
forKey:@"inputBrightness"];
+ [colorControlsFilter setValue:@1.5 forKey:@"inputSaturation"];
+ [colorControlsFilter setValue:@0.3 forKey:@"inputBrightness"];
icon = [[NSImage alloc] initSmallBitmapWithDrawingHandler:^(NSRect
rect){
CGImageRef cgImage = [smartFolderImage
CGImageForProposedRect:&rect context:[NSGraphicsContext currentContext]
hints:nil];
CIImage *ciImage = [CIImage imageWithCGImage:cgImage];
Modified: trunk/bibdesk/BDSKCompatibility.h
===================================================================
--- trunk/bibdesk/BDSKCompatibility.h 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKCompatibility.h 2023-11-04 17:52:29 UTC (rev 28420)
@@ -44,30 +44,6 @@
#define MAC_OS_X_VERSION_11_0 MAC_OS_VERSION_11_0
#endif
-
-#if SDK_BEFORE(10_14)
-
-static const NSAppKitVersion NSAppKitVersionNumber10_13 = 1561;
-static const NSAppKitVersion NSAppKitVersionNumber10_14 = 1671;
-static const NSAppKitVersion NSAppKitVersionNumber10_15 = 1894;
-
-#elif SDK_BEFORE(10_15)
-
-static const NSAppKitVersion NSAppKitVersionNumber10_14 = 1671;
-static const NSAppKitVersion NSAppKitVersionNumber10_15 = 1894;
-
-#elif SDK_BEFORE(11_0)
-
-static const NSAppKitVersion NSAppKitVersionNumber10_15 = 1894;
-
-#endif
-
-
-#ifndef NS_DESIGNATED_INITIALIZER
- #define NS_DESIGNATED_INITIALIZER
-#endif
-
-
#if SDK_BEFORE(11_0)
typedef NS_ENUM(NSInteger, NSTableViewStyle) {
Modified: trunk/bibdesk/BDSKCustomCiteDrawerController.m
===================================================================
--- trunk/bibdesk/BDSKCustomCiteDrawerController.m 2023-11-04 17:07:33 UTC
(rev 28419)
+++ trunk/bibdesk/BDSKCustomCiteDrawerController.m 2023-11-04 17:52:29 UTC
(rev 28420)
@@ -78,11 +78,8 @@
[tableView setBackgroundColor:[[NSColor
controlAlternatingRowBackgroundColors] lastObject]];
- if ([tableView respondsToSelector:@selector(setStyle:)])
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 11.0, *))
[tableView setStyle:NSTableViewStylePlain];
-#pragma clang diagnostic pop
[tableView setDraggingSourceOperationMask:NSDragOperationNone
forLocal:YES];
[tableView setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO];
Modified: trunk/bibdesk/BDSKEdgeView.m
===================================================================
--- trunk/bibdesk/BDSKEdgeView.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKEdgeView.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -75,24 +75,24 @@
NSColor *color;
NSColor *topColor;
edges = BDSKNoEdgeMask; // we start with no edge, so we can use this
in IB without getting weird offsets
- if (RUNNING_BEFORE(10_14)) {
- color = [NSColor colorWithCalibratedWhite:0.75 alpha:1.0];
- topColor = [NSColor colorWithCalibratedWhite:0.55 alpha:1.0];
- backgroundColors = [[NSArray alloc] initWithObjects:[NSColor
colorWithCalibratedWhite:0.65 alpha:1.0], [NSColor colorWithCalibratedWhite:0.8
alpha:1.0], nil];
- backgroundView = nil;
- } else {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 10.14, *)) {
color = topColor = [NSColor separatorColor];
-#pragma clang diagnostic pop
backgroundColors = nil;
backgroundView = [[BDSKReflectionView alloc] initWithFrame:[self
contentRect]];
wantsSubviews = YES;
[self addSubview:backgroundView positioned:NSWindowBelow
relativeTo:nil];
wantsSubviews = NO;
+ } else {
+ color = [NSColor colorWithCalibratedWhite:0.75 alpha:1.0];
+ topColor = [NSColor colorWithCalibratedWhite:0.55 alpha:1.0];
+ backgroundColors = [[NSArray alloc] initWithObjects:[NSColor
colorWithCalibratedWhite:0.65 alpha:1.0], [NSColor colorWithCalibratedWhite:0.8
alpha:1.0], nil];
+ backgroundView = nil;
}
edgeColors = [[NSMutableArray alloc] initWithObjects:color, color,
color, topColor, nil];
- reflectViewEnabled = RUNNING_AFTER(10_13);
+ if (@available(macOS 10.14, *))
+ reflectViewEnabled = YES;
+ else
+ reflectViewEnabled = NO;
}
return self;
}
@@ -108,7 +108,10 @@
edges = [decoder decodeIntegerForKey:@"edges"];
backgroundColors = [[decoder decodeObjectForKey:@"backgroundColors"]
retain];
backgroundView = [[decoder decodeObjectForKey:@"backgroundView"]
retain];
- reflectViewEnabled = RUNNING_AFTER(10_13);
+ if (@available(macOS 10.14, *))
+ reflectViewEnabled = YES;
+ else
+ reflectViewEnabled = NO;
}
return self;
}
Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKEditor.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -195,12 +195,9 @@
if (editorFlags.isEditable)
[tableView setDoubleAction:@selector(raiseChangeFieldName:)];
- if ([tableView respondsToSelector:@selector(setStyle:)]) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 11.0, *)) {
[tableView setStyle:NSTableViewStylePlain];
[authorTableView setStyle:NSTableViewStylePlain];
-#pragma clang diagnostic pop
}
[bibTypeButton setEnabled:editorFlags.isEditable];
@@ -272,7 +269,7 @@
[rssDescriptionView setString:currentValue];
[rssDescriptionView setEditable:editorFlags.isEditable];
[rssDescriptionView setTextColor:[NSColor textColor]];
- if (RUNNING_AFTER(10_13)) {
+ if (@available(macOS 10.14, *)) {
[notesView setDrawsBackground:NO];
[abstractView setDrawsBackground:NO];
[rssDescriptionView setDrawsBackground:NO];
Modified: trunk/bibdesk/BDSKErrorEditor.m
===================================================================
--- trunk/bibdesk/BDSKErrorEditor.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKErrorEditor.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -136,7 +136,7 @@
// faster layout if it's not antialiased, and fixed pitch makes
pretty-printed files look right
[textView setFont:[NSFont userFixedPitchFontOfSize:0.0]];
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
[textView setDrawsBackground:NO];
NSScrollView *scrollView = [textView enclosingScrollView];
Modified: trunk/bibdesk/BDSKFileContentSearchController.m
===================================================================
--- trunk/bibdesk/BDSKFileContentSearchController.m 2023-11-04 17:07:33 UTC
(rev 28419)
+++ trunk/bibdesk/BDSKFileContentSearchController.m 2023-11-04 17:52:29 UTC
(rev 28420)
@@ -96,11 +96,8 @@
[tableView
setFontNamePreferenceKey:BDSKFileContentSearchTableViewFontNameKey];
[tableView
setFontSizePreferenceKey:BDSKFileContentSearchTableViewFontSizeKey];
- if ([tableView respondsToSelector:@selector(setStyle:)])
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 11.0, *))
[tableView setStyle:NSTableViewStyleFullWidth];
-#pragma clang diagnostic pop
// Do custom view setup
[controlView setEdges:BDSKMinYEdgeMask];
Modified: trunk/bibdesk/BDSKGroupBubbleView.m
===================================================================
--- trunk/bibdesk/BDSKGroupBubbleView.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKGroupBubbleView.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -64,7 +64,7 @@
- (id)initWithFrame:(NSRect)frameRect {
self = [super initWithFrame:frameRect];
if (self) {
- if (RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *))
[self commonInit];
}
return self;
@@ -73,7 +73,7 @@
- (id)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];
if (self) {
- if (RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *))
[self commonInit];
}
return self;
@@ -96,17 +96,15 @@
}
- (void)viewDidChangeEffectiveAppearance {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
- [super viewDidChangeEffectiveAppearance];
-#pragma clang diagnostic pop
- if (RUNNING_AFTER(10_15))
+ if (@available(macOS 10.14, *))
+ [super viewDidChangeEffectiveAppearance];
+ if (@available(macOS 11.0, *))
[self updateMaterial:nil];
}
- (void)setImage:(NSImage *)image {
[super setImage:image];
- if (RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *))
[bgView setMaskImage:image];
[self setHidden:image == nil];
}
@@ -117,20 +115,24 @@
@implementation BDSKGroupBubbleCell
- (BOOL)isEnabled {
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *))
+ return [super isEnabled];
+ else
return [self backgroundStyle] == NSBackgroundStyleDark;
- return [super isEnabled];
}
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle {
[super setBackgroundStyle:backgroundStyle];
- if (RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *))
[(BDSKGroupBubbleView *)[self controlView] updateMaterial:nil];
}
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- if (!RUNNING_AFTER(10_15) || [self backgroundStyle] !=
NSBackgroundStyleLight)
- [super drawInteriorWithFrame:cellFrame inView:controlView];
+ if (@available(macOS 11.0, *)) {
+ if ([self backgroundStyle] == NSBackgroundStyleLight)
+ return;
+ }
+ [super drawInteriorWithFrame:cellFrame inView:controlView];
}
@end
Modified: trunk/bibdesk/BDSKGroupOutlineView.m
===================================================================
--- trunk/bibdesk/BDSKGroupOutlineView.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/BDSKGroupOutlineView.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -138,7 +138,10 @@
if (count > 0) {
[countImage lockFocus];
NSRect rect = NSMakeRect(1.0, 0.0, size.width - 2.0, size.height);
- [[NSColor colorWithGenericGamma22White:0.0
alpha:RUNNING_AFTER(10_15) ? 1.0 : 0.9] setFill];
+ if (@available(macOS 11.0, *))
+ [[NSColor colorWithGenericGamma22White:0.0 alpha:1.0] setFill];
+ else
+ [[NSColor colorWithGenericGamma22White:0.0 alpha:0.9] setFill];
[NSBezierPath fillHorizontalOvalInRect:rect];
[[NSGraphicsContext currentContext]
setCompositingOperation:NSCompositingOperationClear];
[countString drawWithRect:rect
options:NSStringDrawingUsesLineFragmentOrigin];
@@ -157,7 +160,10 @@
[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:RUNNING_AFTER(10_15) ? 1.0 : 0.9] setFill];
+ if (@available(macOS 11.0, *))
+ [[NSColor colorWithGenericGamma22White:0.0 alpha:1.0] setFill];
+ else
+ [[NSColor colorWithGenericGamma22White:0.0 alpha:0.9] setFill];
[path fill];
[countImage unlockFocus];
[countImage setAccessibilityDescription:[NSString
stringWithFormat:NSLocalizedString(@"error", @""), count]];
Modified: trunk/bibdesk/BDSKGroupRowView.m
===================================================================
--- trunk/bibdesk/BDSKGroupRowView.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKGroupRowView.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -88,7 +88,7 @@
- (void)setHighlighted:(BOOL)flag {
if (flag != highlighted) {
highlighted = flag;
- if (RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *))
[self updateHighlightView];
else
[self setNeedsDisplay:YES];
@@ -98,7 +98,7 @@
- (void)setSelected:(BOOL)selected {
if (selected != [self isSelected]) {
[super setSelected:selected];
- if (RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *))
[self updateHighlightView];
}
}
@@ -106,13 +106,14 @@
- (void)drawBackgroundInRect:(NSRect)dirtyRect {
[super drawBackgroundInRect:dirtyRect];
- if (!RUNNING_AFTER(10_15) && [self isHighlighted] && [self isSelected] ==
NO) {
- NSRect drawRect = NSInsetRect([self bounds], 1.0, 1.0);
- BOOL isMain = [[self window] isMainWindow] || [[self window]
isKeyWindow];
- NSColor *highlightColor = [[NSColor textColor]
colorWithAlphaComponent:isMain ? 0.25 : 0.2];
- [NSBezierPath drawHighlightInRect:drawRect radius:4.0 lineWidth:1.0
color:highlightColor];
+ if (@available(macOS 11.0, *)) {} else {
+ if ([self isHighlighted] && [self isSelected] == NO) {
+ NSRect drawRect = NSInsetRect([self bounds], 1.0, 1.0);
+ BOOL isMain = [[self window] isMainWindow] || [[self window]
isKeyWindow];
+ NSColor *highlightColor = [[NSColor textColor]
colorWithAlphaComponent:isMain ? 0.25 : 0.2];
+ [NSBezierPath drawHighlightInRect:drawRect radius:4.0
lineWidth:1.0 color:highlightColor];
+ }
}
-
}
- (void)handleKeyOrMainStateChangedNotification:(NSNotification *)note {
@@ -122,7 +123,7 @@
- (void)viewWillMoveToWindow:(NSWindow *)newWindow {
[super viewWillMoveToWindow:newWindow];
- if (RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *))
return;
NSWindow *oldWindow = [self window];
if (oldWindow) {
Modified: trunk/bibdesk/BDSKMainTableView.m
===================================================================
--- trunk/bibdesk/BDSKMainTableView.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKMainTableView.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -384,7 +384,9 @@
static NSDictionary *headerImageCache = nil;
if (headerImageCache == nil) {
- CGFloat width = RUNNING_AFTER(10_15) ? 16.0 : 13.0;
+ CGFloat width = 13.0;
+ if (@available(macOS 11.0, *))
+ width = 16.0;
NSSize size = NSMakeSize(width, width);
CGFloat x = (width - 1.0) / 3.0;
Modified: trunk/bibdesk/BDSKPreferenceController.m
===================================================================
--- trunk/bibdesk/BDSKPreferenceController.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/BDSKPreferenceController.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -363,7 +363,7 @@
[pane willSelect];
[window setTitle:[self localizedString:[pane title]] ?:
[self defaultWindowTitle]];
[titleField setStringValue:[window title]];
- if (!RUNNING_AFTER(10_15)) {
+ if (@available(macOS 11.0, *)) {} else {
NSToolbarItem *titleItem = [toolbarItems
objectForKey:BDSKPreferencesToolbarTitleItemIdentifier];
[titleField sizeToFit];
[titleItem setMinSize:[titleField frame].size];
@@ -415,24 +415,23 @@
}
} else if ([itemIdentifier
isEqualToString:BDSKPreferencesToolbarSearchItemIdentifier]) {
if ((item = [[NSToolbarItem alloc]
initWithItemIdentifier:itemIdentifier])) {
- if (!RUNNING_AFTER(10_15)) {
- [item setMinSize:[searchField frame].size];
- [item setMaxSize:NSMakeSize(200.0, NSHeight([searchField
frame]))];
- } else {
+ if (@available(macOS 11.0, *)) {
[searchField
setTranslatesAutoresizingMaskIntoConstraints:NO];
[searchField addConstraints:@[[NSLayoutConstraint
constraintWithItem:searchField attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil
attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0
constant:NSWidth([searchField frame])], [NSLayoutConstraint
constraintWithItem:searchField attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationLessThanOrEqual toItem:nil
attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:200.0]]];
}
[item setView:searchField];
//[item setLabel:NSLocalizedString(@"Search", @"Toolbar item
label")];
+ } else {
+ [item setMinSize:[searchField frame].size];
+ [item setMaxSize:NSMakeSize(200.0, NSHeight([searchField
frame]))];
}
} else if ([itemIdentifier
isEqualToString:BDSKPreferencesToolbarTitleItemIdentifier]) {
if ((item = [[NSToolbarItem alloc]
initWithItemIdentifier:itemIdentifier])) {
[titleField setStringValue:[[self window] title]];
- if (!RUNNING_AFTER(10_15)) {
+ if (@available(macOS 11.0, *))
+ [titleField
setTranslatesAutoresizingMaskIntoConstraints:NO];
+ else
[titleField sizeToFit];
- } else {
- [titleField
setTranslatesAutoresizingMaskIntoConstraints:NO];
- }
[item setView:titleField];
}
}
@@ -513,7 +512,7 @@
static NSImage *templatePreferencesImage = nil;
NSRect rect = NSMakeRect(0.0, 0.0, 32.0, 32.0);
- NSRect badgeRect = NSMakeRect(8.0, RUNNING_AFTER(10_15) ? 7.0 : 8.0, 16.0,
16.0);
+ NSRect badgeRect = NSMakeRect(8.0, 8.0, 16.0, 16.0);
NSRect fileRect = NSMakeRect(16.0, 16.0, 16.0, 16.0);
NSRect textRect = NSMakeRect(0.0, 16.0, 16.0, 16.0);
NSImage *docImage = [[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kGenericDocumentIcon)];
@@ -520,6 +519,9 @@
NSImage *badgeImage = [NSImage imageNamed:@"docBadge"];
NSImage *textImage = [[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kClippingTextTypeIcon)];
+ if (@available(macOS 11.0, *))
+ badgeRect.origin.y -= 1.0;
+
filesPreferencesImage = [[NSImage alloc] initWithSize:rect.size];
[filesPreferencesImage lockFocus];
[docImage drawInRect:rect];
@@ -691,10 +693,11 @@
NSLayoutConstraint *bottomConstraint = nil;
NSMutableArray *constraints = [NSMutableArray array];
NSColor *backgroundColor = [NSColor colorWithAquaColor:[NSColor
colorWithGenericGamma22White:0.0 alpha:0.03] darkAquaColor:[NSColor
colorWithGenericGamma22White:1.0 alpha:0.03]];
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
- NSColor *dividerColor = [NSColor
respondsToSelector:@selector(separatorColor)] ? [NSColor separatorColor] :
[NSColor colorWithGenericGamma22White:0.0 alpha:0.1];
-#pragma clang diagnostic pop
+ NSColor *dividerColor;
+ if (@available(macOS 10.14, *))
+ dividerColor = [NSColor separatorColor];
+ else
+ dividerColor = [NSColor colorWithGenericGamma22White:0.0 alpha:0.1];
BOOL drawsBackground = NO;
for (NSString *category in categories) {
Modified: trunk/bibdesk/BDSKPreviewer.m
===================================================================
--- trunk/bibdesk/BDSKPreviewer.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKPreviewer.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -143,11 +143,8 @@
[pdfView setDisplaysPageBreaks:NO];
[pdfView setBackgroundColor:[NSColor whiteColor]];
- if ([pdfView respondsToSelector:@selector(pageShadowsEnabled)])
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 10.14, *))
[pdfView enablePageShadows:NO];
-#pragma clang diagnostic pop
// don't reset the scale factor until there's a document loaded, or else
we get a huge gray border
[pdfView setScaleFactor:pdfScaleFactor];
Modified: trunk/bibdesk/BDSKReadMeController.m
===================================================================
--- trunk/bibdesk/BDSKReadMeController.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/BDSKReadMeController.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -81,7 +81,7 @@
[textView setString:@""];
[textView replaceCharactersInRange:[textView selectedRange]
withRTF:[NSData
dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[self
resourceName] ofType:@"rtf"]]];
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
[textView setDrawsBackground:NO];
}
Modified: trunk/bibdesk/BDSKSearchBookmarkController.m
===================================================================
--- trunk/bibdesk/BDSKSearchBookmarkController.m 2023-11-04 17:07:33 UTC
(rev 28419)
+++ trunk/bibdesk/BDSKSearchBookmarkController.m 2023-11-04 17:52:29 UTC
(rev 28420)
@@ -70,7 +70,8 @@
#define INFO_KEY @"info"
#define SEARCHTERM_KEY @"searchTerm"
-#define INDENT (RUNNING_AFTER(10_15) ? 9.0 : 16.0)
+#define INDENT 9.0
+#define OLD_INDENT 16.0
static char BDSKSearchBookmarkPropertiesObservationContext;
@@ -433,7 +434,11 @@
NSTableColumn *tableColumn = [ov outlineTableColumn];
NSTableCellView *view = [ov makeViewWithIdentifier:[tableColumn
identifier] owner:self];
__block NSInteger validCount = 0;
- NSRect frame = NSMakeRect(0.0, 0.0, [tableColumn width] - INDENT, [ov
rowHeight]);
+ NSRect frame = NSMakeRect(0.0, 0.0, [tableColumn width], [ov
rowHeight]);
+ if (@available(macOS 11.0, *))
+ frame.size.width -= INDENT;
+ else
+ frame.size.width -= OLD_INDENT;
[view setFrame:frame];
frame.origin = [draggingInfo draggingLocation];
@@ -583,7 +588,7 @@
BOOL isSep = ([item bookmarkType] == BDSKSearchBookmarkTypeSeparator);
NSString *identifier = isSep ? @"separator" : [tableColumn identifier];
NSTableCellView *view = [ov makeViewWithIdentifier:identifier owner:self];
- if (!RUNNING_AFTER(10_15)) {
+ if (@available(macOS 11.0, *)) {} else {
BOOL isLast = [[tableColumn identifier] isEqualToString:@"server"];
if (isLast || isSep)
[[view constraintWithFirstItem:view
firstAttribute:NSLayoutAttributeTrailing] setConstant:isSep == NO ? 4.0 :
isLast ? 2.0 : 0.0];
@@ -652,7 +657,7 @@
[item setPaletteLabel:NSLocalizedString(@"New Folder", @"Toolbar item
label")];
[item setToolTip:NSLocalizedString(@"Add a New Folder", @"Tool tip
message")];
[item setView:addFolderButton];
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *)) {} else
[addFolderButton setImageScaling:NSImageScaleNone forSegment:0];
[toolbarItems setObject:item
forKey:BDSKSearchBookmarksNewFolderToolbarItemIdentifier];
[item release];
@@ -662,7 +667,7 @@
[item setPaletteLabel:NSLocalizedString(@"New Separator", @"Toolbar item
label")];
[item setToolTip:NSLocalizedString(@"Add a New Separator", @"Tool tip
message")];
[item setView:addSeparatorButton];
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *)) {} else
[addSeparatorButton setImageScaling:NSImageScaleNone forSegment:0];
[toolbarItems setObject:item
forKey:BDSKSearchBookmarksNewSeparatorToolbarItemIdentifier];
[item release];
@@ -672,7 +677,7 @@
[item setPaletteLabel:NSLocalizedString(@"Delete", @"Toolbar item label")];
[item setToolTip:NSLocalizedString(@"Delete Selected Items", @"Tool tip
message")];
[item setView:deleteButton];
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *)) {} else
[deleteButton setImageScaling:NSImageScaleNone forSegment:0];
[deleteButton setEnabled:[outlineView numberOfSelectedRows] > 0];
[toolbarItems setObject:item
forKey:BDSKSearchBookmarksDeleteToolbarItemIdentifier];
@@ -683,7 +688,7 @@
[item setPaletteLabel:NSLocalizedString(@"Edit", @"Toolbar item label")];
[item setToolTip:NSLocalizedString(@"Edit Selected Item", @"Tool tip
message")];
[item setView:editButton];
- if (!RUNNING_AFTER(10_15))
+ if (@available(macOS 11.0, *)) {} else
[editButton setImageScaling:NSImageScaleNone forSegment:0];
[editButton setEnabled:[outlineView numberOfSelectedRows] == 1 &&
[[[outlineView selectedItems] lastObject] bookmarkType] ==
BDSKSearchBookmarkTypeBookmark];
[toolbarItems setObject:item
forKey:BDSKSearchBookmarksEditToolbarItemIdentifier];
Modified: trunk/bibdesk/BDSKTemplateDocument.m
===================================================================
--- trunk/bibdesk/BDSKTemplateDocument.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/BDSKTemplateDocument.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -249,7 +249,7 @@
[view addConstraint:[NSLayoutConstraint constraintWithWidth:width
forItem:view]];
[optionsView addConstraint:[NSLayoutConstraint
constraintWithItem:optionsView attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil
attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width]];
- if (RUNNING_AFTER(10_13)) {
+ if (@available(macOS 10.14, *)) {
[prefixTemplateTextView setDrawsBackground:NO];
[separatorTemplateTextView setDrawsBackground:NO];
[suffixTemplateTextView setDrawsBackground:NO];
@@ -262,11 +262,8 @@
[tableView registerForDraggedTypes:@[BDSKPasteboardTypeTemplateRow]];
- if ([tableView respondsToSelector:@selector(setStyle:)])
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 11.0, *))
[tableView setStyle:NSTableViewStylePlain];
-#pragma clang diagnostic pop
NSTableColumn *tableColumn = [tableView
tableColumnWithIdentifier:@"pubType"];
width = NSWidth([[[tableView enclosingScrollView] contentView]
visibleRect]) - 2.0 * [tableView intercellSpacing].width - [[tableView
tableColumnWithIdentifier:@"included"] width];
@@ -334,7 +331,7 @@
if (separatorRange.length > 0)
separator = [attrString
attributedSubstringFromRange:separatorRange];
parsedTemplate = [BDSKTemplateParser
arrayByParsingTemplateAttributedString:[attrString
attributedSubstringFromRange:itemRange]];
- if (RUNNING_AFTER(10_13)) {
+ if (@available(macOS 10.14, *)) {
if (prefix)
prefix = [prefix
attributedStringByAddingTextColorAttribute];
if (suffix)
@@ -647,7 +644,7 @@
font = [[NSFontManager sharedFontManager] convertFont:font
toHaveTrait:NSBoldFontMask];
if (italic)
font = [[NSFontManager sharedFontManager] convertFont:font
toHaveTrait:NSItalicFontMask];
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
attrs = @{NSFontAttributeName:font,
NSForegroundColorAttributeName:[NSColor textColor]};
else
attrs = @{NSFontAttributeName:font};
Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/BDSKTextImportController.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -176,7 +176,7 @@
[webViewView retain];
[sourceTextView setTextColor:[NSColor textColor]];
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
[sourceTextView setDrawsBackground:NO];
[itemTableView registerForDraggedTypes:@[NSPasteboardTypeString]];
@@ -674,7 +674,7 @@
[sourceTextView setString:NSLocalizedString(@"Sorry,
BibDesk can't read this data type.", @"warning message when choosing \"new
publication from pasteboard\" for an unsupported type")];
return;
}
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
[[sourceTextView textStorage] addTextColorAttribute];
[self autoDiscoverDataFromString:[sourceTextView string]];
}
@@ -700,7 +700,7 @@
[text endEditing];
[text addLayoutManager:layoutManager]; // Hook layout manager back up
[layoutManager release];
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
[text addTextColorAttribute];
[self autoDiscoverDataFromString:[text string]];
Modified: trunk/bibdesk/BDSKZoomablePDFView.m
===================================================================
--- trunk/bibdesk/BDSKZoomablePDFView.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BDSKZoomablePDFView.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -220,10 +220,8 @@
}
- (void)viewDidChangeEffectiveAppearance {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
- [super viewDidChangeEffectiveAppearance];
-#pragma clang diagnostic pop
+ if (@available(macOS 10.14, *))
+ [super viewDidChangeEffectiveAppearance];
[self updateColorFilters];
}
Modified: trunk/bibdesk/BDSKZoomableTextView.m
===================================================================
--- trunk/bibdesk/BDSKZoomableTextView.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/BDSKZoomableTextView.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -189,7 +189,7 @@
[scrollView setAutomaticallyAdjustsContentInsets:NO];
[scrollView setContentInsets:NSEdgeInsetsMake(0.0, 0.0,
[scalePopUpButton intrinsicContentSize].height + 2.0, 0.0)];
- if (RUNNING_AFTER(10_14)) {
+ if (@available(macOS 10.15, *)) {
[scrollView setDrawsBackground:NO];
[self setDrawsBackground:NO];
}
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BibDocument.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -440,7 +440,7 @@
docState.lastWebViewFraction = [self
doubleForSetupKey:BDSKWebViewFractionKey defaultValue:0.0];
- if (RUNNING_BEFORE(10_14))
+ if (@available(macOS 10.14, *)) {} else
[mainBox setBackgroundColor:[NSColor controlBackgroundColor]];
// this might be replaced by the file content tableView
@@ -461,11 +461,8 @@
[groupOutlineView setFontNamePreferenceKey:BDSKGroupTableViewFontNameKey];
[groupOutlineView setFontSizePreferenceKey:BDSKGroupTableViewFontSizeKey];
- if ([tableView respondsToSelector:@selector(setStyle:)])
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 11.0, *))
[tableView setStyle:NSTableViewStyleFullWidth];
-#pragma clang diagnostic pop
[groupOutlineView sizeToFit];
@@ -513,7 +510,7 @@
if ([sideFileView backgroundColor])
[[sideFileView enclosingScrollView] setBackgroundColor:[sideFileView
backgroundColor]];
[bottomFileView setBackgroundColor:[[NSColor
controlAlternatingRowBackgroundColors] lastObject]];
- if (RUNNING_AFTER(10_13)) {
+ if (@available(macOS 10.14, *)) {
[[bottomFileView enclosingScrollView] setBackgroundColor:[NSColor
controlBackgroundColor]];
[[bottomFileView enclosingScrollView] setDrawsBackground:YES];
} else {
@@ -544,7 +541,10 @@
[(BDSKZoomableTextView *)bottomPreviewTextView setScaleFactor:[self
doubleForSetupKey:BDSKBottomPreviewScaleFactorKey defaultValue:1.0]];
colorLabelWell = [[BDSKColorLabelWell alloc] initWithFrame:NSMakeRect(0.0,
0.0, 198, 22.0)];
- [colorLabelWell setMargin:RUNNING_AFTER(10_15) ? 12.0 : 20.0];
+ if (@available(macOS 11.0, *))
+ [colorLabelWell setMargin:12.0];
+ else
+ [colorLabelWell setMargin:20.0];
[colorLabelWell setShowLabel:YES];
[colorLabelWell sizeToFit];
[colorLabelWell setColor:[NSColor clearColor]];
Modified: trunk/bibdesk/BibDocument_Toolbar.m
===================================================================
--- trunk/bibdesk/BibDocument_Toolbar.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BibDocument_Toolbar.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -151,7 +151,7 @@
[item setView:searchField];
[item setAction:@selector(search:)];
[item setMenuFormRepresentation:menuItem];
- if (RUNNING_AFTER(10_15)) {
+ if (@available(macOS 11.0, *)) {
[searchField setTranslatesAutoresizingMaskIntoConstraints:NO];
[searchField addConstraints:@[[NSLayoutConstraint
constraintWithItem:searchField attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil
attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:140.0],
[NSLayoutConstraint constraintWithItem:searchField
attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationLessThanOrEqual
toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0
constant:200.0]]];
} else {
Modified: trunk/bibdesk/BibDocument_UI.m
===================================================================
--- trunk/bibdesk/BibDocument_UI.m 2023-11-04 17:07:33 UTC (rev 28419)
+++ trunk/bibdesk/BibDocument_UI.m 2023-11-04 17:52:29 UTC (rev 28420)
@@ -207,8 +207,10 @@
[textStorage setAttributedString:templateString];
else
[[textStorage mutableString] setString:@""];
- if (RUNNING_AFTER(10_13) && backgroundColor == nil)
- [textStorage addTextColorAttribute];
+ if (@available(macOS 10.14, *)) {
+ if (backgroundColor == nil)
+ [textStorage addTextColorAttribute];
+ }
[textStorage endEditing];
[textView didChangeText];
@@ -470,7 +472,7 @@
while (i-- > 1) {
BDSKEdgeView *view = [oldViews objectAtIndex:i];
if (([view tag] & removeMask) == 0) continue;
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
[view reflectScrollView:nil animate:NO];
[view removeFromSuperview];
[oldViews removeObjectAtIndex:i];
@@ -537,8 +539,9 @@
if (isAdd) {
- NSScrollView *reflectedView = RUNNING_AFTER(10_13) ?
[(docState.controlViewDisplay & BDSKControlViewFileSearch) ?
[fileSearchController tableView] : tableView enclosingScrollView] : nil;
-
+ NSScrollView *reflectedView = nil;
+ if (@available(macOS 10.14, *))
+ reflectedView = [(docState.controlViewDisplay &
BDSKControlViewFileSearch) ? [fileSearchController tableView] : tableView
enclosingScrollView];
if ([oldViews count] == 0)
[controlContentView removeConstraint:[controlContentView
constraintWithFirstItem:controlContentView
firstAttribute:NSLayoutAttributeHeight]];
@@ -617,7 +620,7 @@
[[mainView animator] replaceSubview:oldView with:newView];
[mainView addConstraints:viewConstraints];
- if (RUNNING_AFTER(10_13)) {
+ if (@available(macOS 10.14, *)) {
for (BDSKEdgeView *view in oldViews)
[view reflectScrollView:newView animate:YES];
}
@@ -630,7 +633,7 @@
if (isRemove) {
[topViews addObjectsFromArray:bottomViews];
for (BDSKEdgeView *view in topViews) {
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
[view reflectScrollView:nil animate:NO];
[view removeFromSuperview];
}
@@ -649,7 +652,7 @@
[mainView replaceSubview:oldView with:newView];
[mainView addConstraints:viewConstraints];
- if (RUNNING_AFTER(10_13)) {
+ if (@available(macOS 10.14, *)) {
for (BDSKEdgeView *view in oldViews)
[view reflectScrollView:newView animate:NO];
}
@@ -658,7 +661,7 @@
if (isRemove) {
[topViews addObjectsFromArray:bottomViews];
for (BDSKEdgeView *view in topViews) {
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
[view reflectScrollView:nil animate:NO];
[view removeFromSuperview];
}
@@ -903,7 +906,9 @@
[menu addItemsFromMenu:actionMenu];
[menu removeItemAtIndex:0];
if ([tcId isRatingField] && [tableView
numberOfClickedOrSelectedRows] == 1 && [self
hasGroupTypeSelected:BDSKExternalGroupType] == NO){
- CGFloat margin = RUNNING_AFTER(10_15) ? 12.0 : 20.0;
+ CGFloat margin = 20.0;
+ if (@available(macOS 11.0, *))
+ margin = 12.0;
BDSKRatingButton *ratingButton = [[[BDSKRatingButton alloc]
init] autorelease];
[ratingButton setImagePosition:NSImageRight];
[ratingButton setAlignment:NSTextAlignmentLeft];
Modified: trunk/bibdesk/NSColor_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSColor_BDSKExtensions.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/NSColor_BDSKExtensions.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -51,9 +51,7 @@
#endif
BOOL BDSKHasDarkAppearance(id object) {
- if (RUNNING_AFTER(10_13)) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 10.14, *)) {
id appearance = nil;
if (object == nil)
appearance = [NSAppearance currentAppearance];
@@ -60,35 +58,40 @@
else if ([object respondsToSelector:@selector(effectiveAppearance)])
appearance = [(id<NSAppearanceCustomization>)object
effectiveAppearance];
return [[appearance
bestMatchFromAppearancesWithNames:@[@"NSAppearanceNameAqua",
@"NSAppearanceNameDarkAqua"]] isEqualToString:@"NSAppearanceNameDarkAqua"];
-#pragma clang diagnostic pop
}
return NO;
}
void BDSKSetHasDarkAppearance(id object) {
- if (RUNNING_AFTER(10_13) && [object
respondsToSelector:@selector(setAppearance:)])
- [(id<NSAppearanceCustomization>)object setAppearance:[NSAppearance
appearanceNamed:@"NSAppearanceNameDarkAqua"]];
+ if (@available(macOS 10.14, *)) {
+ if ([object respondsToSelector:@selector(setAppearance:)])
+ [(id<NSAppearanceCustomization>)object setAppearance:[NSAppearance
appearanceNamed:@"NSAppearanceNameDarkAqua"]];
+ }
}
void BDSKSetHasLightAppearance(id object) {
- if (RUNNING_AFTER(10_13) && [object
respondsToSelector:@selector(setAppearance:)])
- [(id<NSAppearanceCustomization>)object setAppearance:[NSAppearance
appearanceNamed:@"NSAppearanceNameAqua"]];
+ if (@available(macOS 10.14, *)) {
+ if ([object respondsToSelector:@selector(setAppearance:)])
+ [(id<NSAppearanceCustomization>)object setAppearance:[NSAppearance
appearanceNamed:@"NSAppearanceNameAqua"]];
+ }
}
void BDSKSetHasDefaultAppearance(id object) {
- if (RUNNING_AFTER(10_13) && [object
respondsToSelector:@selector(setAppearance:)])
- [(id<NSAppearanceCustomization>)object setAppearance:nil];
+ if (@available(macOS 10.14, *)) {
+ if ([object respondsToSelector:@selector(setAppearance:)])
+ [(id<NSAppearanceCustomization>)object setAppearance:nil];
+ }
}
void BDSKSetAppearance(id toObject, id fromObject) {
- if (RUNNING_AFTER(10_13) && [fromObject
respondsToSelector:@selector(appearance)] && [toObject
respondsToSelector:@selector(setAppearance:)])
- [(id<NSAppearanceCustomization>)toObject
setAppearance:[(id<NSAppearanceCustomization>)fromObject appearance]];
+ if (@available(macOS 10.14, *)) {
+ if ([fromObject respondsToSelector:@selector(appearance)] && [toObject
respondsToSelector:@selector(setAppearance:)])
+ [(id<NSAppearanceCustomization>)toObject
setAppearance:[(id<NSAppearanceCustomization>)fromObject appearance]];
+ }
}
void BDSKRunWithAppearance(id object, void (^code)(void)) {
- if (RUNNING_AFTER(10_13)) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
+ if (@available(macOS 10.14, *)) {
if ([object respondsToSelector:@selector(effectiveAppearance)]) {
NSAppearance *appearance = nil;
appearance = [[[NSAppearance currentAppearance] retain]
autorelease];
@@ -98,7 +101,6 @@
} else {
code();
}
-#pragma clang diagnostic pop
} else {
code();
}
@@ -122,13 +124,13 @@
@implementation NSColor (BDSKExtensions)
+ (NSColor *)newWithColorGenerator:(NSColor *(^)(void))aColorGenerator {
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
return [[BDSKGeneratedDynamicColor alloc]
initWithColorGenerator:aColorGenerator];
return [aColorGenerator() retain];
}
+ (NSColor *)colorWithAquaColor:(NSColor *)aAquaColor darkAquaColor:(NSColor
*)aDarkAquaColor {
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
return [[[BDSKDynamicColor alloc] initWithAquaColor:aAquaColor
darkAquaColor:aDarkAquaColor] autorelease];
return aAquaColor;
}
@@ -171,7 +173,7 @@
+ (NSColor *)searchHighlightColor {
static NSColor *color = nil;
if (color == nil) {
- if (RUNNING_AFTER(10_13))
+ if (@available(macOS 10.14, *))
color = [[BDSKGeneratedDynamicColor alloc]
initWithColorGenerator:^{
return [[NSColor systemYellowColor]
colorWithAlphaComponent:0.33333];
}];
Modified: trunk/bibdesk/NSImage_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSImage_BDSKExtensions.m 2023-11-04 17:07:33 UTC (rev
28419)
+++ trunk/bibdesk/NSImage_BDSKExtensions.m 2023-11-04 17:52:29 UTC (rev
28420)
@@ -127,7 +127,7 @@
}
- (id)initToolbarImageWithSize:(NSSize)size drawingHandler:(void
(^)(void))drawingHandler {
- if (RUNNING_AFTER(10_15)) {
+ if (@available(macOS 11.0, *)) {
CFMutableDataRef pdfData = CFDataCreateMutable(NULL, 0);
CGDataConsumerRef consumer = CGDataConsumerCreateWithCFData(pdfData);
CGRect rect = CGRectMake(0.0, 0.0, size.width, size.height);
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