Revision: 15009
http://sourceforge.net/p/skim-app/code/15009
Author: hofman
Date: 2025-03-23 16:31:30 +0000 (Sun, 23 Mar 2025)
Log Message:
-----------
convenience property for bezelHeight of background view
Modified Paths:
--------------
trunk/SKColorSwatch.m
Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m 2025-03-23 16:21:06 UTC (rev 15008)
+++ trunk/SKColorSwatch.m 2025-03-23 16:31:30 UTC (rev 15009)
@@ -71,6 +71,7 @@
@interface SKColorSwatchBackgroundView : NSControl
@property (nonatomic) CGFloat bezelWidth;
+@property (nonatomic, readonly) CGFloat bezelHeight;
@end
typedef NS_ENUM(NSUInteger, SKColorSwatchDropLocation) {
@@ -301,13 +302,8 @@
if (controlSize != [self controlSize]) {
[super setControlSize:controlSize];
[backgroundView setControlSize:controlSize];
- CGFloat height = [[backgroundView cell] cellSize].height -
BEZEL_INSET_TOP - BEZEL_INSET_BOTTOM;
- if (controlSize == 3) {
- height -= LARGE_SIZE_HEIGHT_OFFSET;
- [backgroundView setFrame:NSInsetRect([self bounds],
-LARGE_SIZE_WIDTH_OUTSET, 0.0)];
- } else {
- [backgroundView setFrame:[self bounds]];
- }
+ [backgroundView setFrame:controlSize == 3 ? NSInsetRect([self bounds],
-LARGE_SIZE_WIDTH_OUTSET, 0.0) : [self bounds]];
+ CGFloat height = [backgroundView bezelHeight];
if (fabs(height - bezelHeight) > 0.0) {
bezelHeight = height;
[self updateSubviewLayout];
@@ -354,9 +350,7 @@
- (void)viewDidMoveToWindow {
[super viewDidMoveToWindow];
if ([self window]) {
- CGFloat height = [[backgroundView cell] cellSize].height -
BEZEL_INSET_TOP - BEZEL_INSET_BOTTOM;
- if ([backgroundView controlSize] == 3)
- height -= LARGE_SIZE_HEIGHT_OFFSET;
+ CGFloat height = [backgroundView bezelHeight];
if (fabs(height - bezelHeight) > 0.0) {
bezelHeight = height;
[self updateSubviewLayout];
@@ -874,7 +868,7 @@
@implementation SKColorSwatchBackgroundView
-@dynamic bezelWidth;
+@dynamic bezelWidth, bezelHeight;
+ (id)defaultAnimationForKey:(NSString *)key {
if ([key isEqualToString:@"width"]) {
@@ -910,6 +904,13 @@
[self setNeedsDisplay:YES];
}
+- (CGFloat)bezelHeight {
+ CGFloat height = [[self cell] cellSize].height - BEZEL_INSET_TOP -
BEZEL_INSET_BOTTOM;
+ if ([self controlSize] == 3)
+ height -= LARGE_SIZE_HEIGHT_OFFSET;
+ return height;
+}
+
- (void)mouseDown:(NSEvent *)event {
[[self superview] mouseDown:event];
}
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