Revision: 15129
http://sourceforge.net/p/skim-app/code/15129
Author: hofman
Date: 2025-04-13 16:08:00 +0000 (Sun, 13 Apr 2025)
Log Message:
-----------
Use local variables, simplify check for disabled drawing
Modified Paths:
--------------
trunk/SKColorSwatch.m
Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m 2025-04-13 15:14:38 UTC (rev 15128)
+++ trunk/SKColorSwatch.m 2025-04-13 16:08:00 UTC (rev 15129)
@@ -965,10 +965,13 @@
if (NSWidth(rect) < 5.0)
return;
rect = NSInsetRect(rect, COLOR_INSET, COLOR_INSET);
- CGFloat r = cornerRadius([(SKColorSwatch *)[self superview] controlSize]);
+ SKColorSwatch *colorSwatch = (SKColorSwatch *)[self superview];
+ CGFloat r = cornerRadius([colorSwatch controlSize]);
BOOL disabled = NO;
- if (@available(macOS 10.14, *))
- disabled = [[self window] isMainWindow] == NO && [[self window]
isKeyWindow] == NO && ([self isDescendantOf:[[self window] contentView]] == NO
|| [[self window] isKindOfClass:NSClassFromString(@"NSToolbarSnapshotWindow")]);
+ if (@available(macOS 10.14, *)) {
+ NSWindow *window = [self window];
+ disabled = [window isMainWindow] == NO && [window isKeyWindow] == NO
&& [[colorSwatch superview] isDescendantOf:[window contentView]] == NO;
+ }
CGFloat stroke = [[NSWorkspace sharedWorkspace]
accessibilityDisplayShouldIncreaseContrast] ? 0.55 : 0.25;
NSBezierPath *path = [NSBezierPath
bezierPathWithRoundedRect:NSInsetRect(rect, 0.5, 0.5) xRadius:r - 0.5 yRadius:r
- 0.5];
@@ -1022,8 +1025,8 @@
[path lineToPoint:NSMakePoint(NSMaxX(rect) + 0.5, NSMaxY(rect) +
1.0)];
}
[path setLineWidth:3.0];
- if ((dropLocation == SKColorSwatchDropBefore && NSMinX([[self
superview] bounds]) + COLOR_INSET >= NSMinX([self frame])) ||
- (dropLocation == SKColorSwatchDropAfter && NSMaxX([[self
superview] bounds]) - COLOR_INSET <= NSMaxX([self frame])))
+ if ((dropLocation == SKColorSwatchDropBefore && NSMinX([colorSwatch
bounds]) + COLOR_INSET >= NSMinX([self frame])) ||
+ (dropLocation == SKColorSwatchDropAfter && NSMaxX([colorSwatch
bounds]) - COLOR_INSET <= NSMaxX([self frame])))
[[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect,
-COLOR_INSET, -COLOR_INSET) xRadius:r + COLOR_INSET yRadius:r + COLOR_INSET]
addClip];
[path stroke];
}
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