Revision: 15019
          http://sourceforge.net/p/skim-app/code/15019
Author:   hofman
Date:     2025-03-24 17:09:26 +0000 (Mon, 24 Mar 2025)
Log Message:
-----------
Use macro instead of method

Modified Paths:
--------------
    trunk/SKColorSwatch.m

Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m       2025-03-24 17:03:06 UTC (rev 15018)
+++ trunk/SKColorSwatch.m       2025-03-24 17:09:26 UTC (rev 15019)
@@ -197,9 +197,7 @@
 
 #pragma mark Layout
 
-- (CGFloat)distanceBetweenColors {
-    return bezelHeight - COLOR_INSET;
-}
+#define DISTANCE_BETWEEN_COLORS (bezelHeight - COLOR_INSET)
 
 - (NSRect)frameForColorAtIndex:(NSInteger)anIndex {
     NSEdgeInsets insets = [self alignmentRectInsets];
@@ -206,7 +204,7 @@
     NSRect rect = NSMakeRect(insets.left, insets.bottom, bezelHeight, 
bezelHeight);
     rect = NSInsetRect(rect, COLOR_INSET, COLOR_INSET);
     if (anIndex > 0)
-        rect.origin.x += anIndex * [self distanceBetweenColors];
+        rect.origin.x += anIndex * DISTANCE_BETWEEN_COLORS;
     return rect;
 }
 
@@ -216,7 +214,7 @@
         i--;
     NSRect rect = NSInsetRect([self frameForColorAtIndex:i], -2.0, -2.0);
     if (collapsedIndex == anIndex)
-        rect.size.width -= [self distanceBetweenColors];
+        rect.size.width -= DISTANCE_BETWEEN_COLORS;
     return rect;
 }
 
@@ -227,7 +225,7 @@
     for (i = 0; i < count; i++) {
         if (NSMouseInRect(point, rect, [self isFlipped]))
             return i;
-        rect.origin.x += [self distanceBetweenColors];
+        rect.origin.x += DISTANCE_BETWEEN_COLORS;
     }
     return -1;
 }
@@ -240,7 +238,7 @@
     for (i = 0; i < count; i++) {
         if (point.x < x)
             return i;
-        x += [self distanceBetweenColors];
+        x += DISTANCE_BETWEEN_COLORS;
     }
     return count;
 }
@@ -247,11 +245,11 @@
 
 - (NSSize)sizeForNumberOfColors:(NSUInteger)count {
     NSEdgeInsets insets = [self alignmentRectInsets];
-    return NSMakeSize(COLOR_INSET + count * [self distanceBetweenColors] + 
insets.left + insets.right, bezelHeight + insets.bottom + insets.top);
+    return NSMakeSize(COLOR_INSET + count * DISTANCE_BETWEEN_COLORS + 
insets.left + insets.right, bezelHeight + insets.bottom + insets.top);
 }
 
 - (NSSize)intrinsicContentSize {
-    return NSMakeSize(COLOR_INSET + [colors count] * [self 
distanceBetweenColors], bezelHeight);
+    return NSMakeSize(COLOR_INSET + [colors count] * DISTANCE_BETWEEN_COLORS, 
bezelHeight);
 }
 
 - (void)sizeToFit {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to