Revision: 15249
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15249&view=rev
Author:   hofman
Date:     2009-05-01 09:54:28 +0000 (Fri, 01 May 2009)

Log Message:
-----------
separate method to get the count padding for group count bubble

Modified Paths:
--------------
    trunk/bibdesk/BDSKGroupCell.m

Modified: trunk/bibdesk/BDSKGroupCell.m
===================================================================
--- trunk/bibdesk/BDSKGroupCell.m       2009-05-01 04:59:06 UTC (rev 15248)
+++ trunk/bibdesk/BDSKGroupCell.m       2009-05-01 09:54:28 UTC (rev 15249)
@@ -177,6 +177,11 @@
 #define TEXT_INSET                    (2.0)
 #define IMAGE_SIZE_OFFSET             (2.0)
 
+- (CGFloat)countPaddingForSize:(NSSize)countSize {
+    NSInteger count = [self count];
+    return (count < 10 ? 1.0 : count < 100 ? 0.9 : 0.7) * countSize.height;
+}
+
 - (NSSize)iconSizeForBounds:(NSRect)aRect {
     return NSMakeSize(NSHeight(aRect) - IMAGE_SIZE_OFFSET, NSHeight(aRect) - 
IMAGE_SIZE_OFFSET);
 }
@@ -198,7 +203,7 @@
         countSize = [self iconSizeForBounds:aRect];
     } else if ([self count] > 0) {
         countSize = [countString boundingRectWithSize:aRect.size 
options:0].size;
-        countSize.width += ([self count] < 100 ? 0.9 : 0.7) * 
countSize.height; // add oval pading around count
+        countSize.width += [self countPaddingForSize:countSize]; // add oval 
pading around count
     }
     NSRect countRect, ignored;
     if (countSize.width > 0.0) {
@@ -229,7 +234,7 @@
         countSize = NSMakeSize(16, 16);
     } else if ([self count] > 0) {
         countSize = [countString boundingRectWithSize:cellSize options:0].size;
-        countSize.width += ([self count] < 100 ? 0.9 : 0.7) * 
countSize.height; // add oval pading around count
+        countSize.width += [self countPaddingForSize:countSize]; // add oval 
pading around count
     }
     // cellSize.height approximates the icon size
     cellSize.width += BORDER_BETWEEN_EDGE_AND_IMAGE + cellSize.height + 
BORDER_BETWEEN_IMAGE_AND_TEXT;
@@ -283,7 +288,7 @@
         if ([self failedDownload]) {
             [self drawIcon:[NSImage imageNamed:@"BDSKSmallCautionIcon"] 
withFrame:countRect inView:controlView];
         } else if (count > 0) {
-            CGFloat countInset = (count < 100 ? 0.45 : 0.35) * 
NSHeight(countRect);
+            CGFloat countInset = 0.5 * [self 
countPaddingForSize:countRect.size];
             NSColor *fgColor;
             NSColor *bgColor;
             if ([controlView 
respondsToSelector:@selector(setSelectionHighlightStyle:)]) {


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

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to