Revision: 12152
http://sourceforge.net/p/skim-app/code/12152
Author: hofman
Date: 2021-03-01 15:45:25 +0000 (Mon, 01 Mar 2021)
Log Message:
-----------
Declare class of ivar in interface
Modified Paths:
--------------
trunk/SKColorSwatch.m
Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m 2021-03-01 15:31:45 UTC (rev 12151)
+++ trunk/SKColorSwatch.m 2021-03-01 15:45:25 UTC (rev 12152)
@@ -58,12 +58,12 @@
#define COLOR_KEY @"color"
-#define BEZEL_HEIGHT 22.0
-#define BEZEL_INSET_LR 1.0
-#define BEZEL_INSET_T 1.0
-#define BEZEL_INSET_B 2.0
-#define COLOR_INSET 2.0
-#define COLOR_OFFSET 3.0
+#define BEZEL_HEIGHT 22.0
+#define BEZEL_INSET_LR 1.0
+#define BEZEL_INSET_T 1.0
+#define BEZEL_INSET_B 2.0
+#define COLOR_INSET 2.0
+#define COLOR_DISTANCE 19.0
#define BACKGROUND_WIDTH_OFFSET 6.0
@@ -208,19 +208,15 @@
#pragma mark Layout
- (NSSize)contentSizeForNumberOfColors:(NSUInteger)count {
- return NSMakeSize(count * (BEZEL_HEIGHT - COLOR_OFFSET) + COLOR_OFFSET,
BEZEL_HEIGHT);
+ return NSMakeSize(BEZEL_HEIGHT + (count - 1) * COLOR_DISTANCE,
BEZEL_HEIGHT);
}
-- (CGFloat)distanceBetweenColors {
- return BEZEL_HEIGHT - COLOR_OFFSET;
-}
-
- (NSRect)frameForColorAtIndex:(NSInteger)anIndex {
NSEdgeInsets insets = [self alignmentRectInsets];
NSRect rect = NSMakeRect(insets.left, insets.bottom, BEZEL_HEIGHT,
BEZEL_HEIGHT);
rect = NSInsetRect(rect, COLOR_INSET, COLOR_INSET);
if (anIndex > 0)
- rect.origin.x += anIndex * [self distanceBetweenColors];
+ rect.origin.x += anIndex * COLOR_DISTANCE;
return rect;
}
@@ -230,13 +226,13 @@
i--;
NSRect rect = NSInsetRect([self frameForColorAtIndex:i], -1.0, -1.0);
if (collapsedIndex == anIndex)
- rect.size.width = 1.0;
+ rect.size.width -= COLOR_DISTANCE;
return rect;
}
- (NSInteger)colorIndexAtPoint:(NSPoint)point {
NSRect rect = [self frameForColorAtIndex:0];
- CGFloat distance = [self distanceBetweenColors];
+ CGFloat distance = COLOR_DISTANCE;
NSInteger i, count = [colors count];
for (i = 0; i < count; i++) {
@@ -249,7 +245,7 @@
- (NSInteger)insertionIndexAtPoint:(NSPoint)point {
NSRect rect = [self frameForColorAtIndex:0];
- CGFloat w = [self distanceBetweenColors];
+ CGFloat w = COLOR_DISTANCE;
CGFloat x = NSMidX(rect);
NSInteger i, count = [colors count];
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