From 43bff5b4a07ce923786270d108d147a9cee25b38 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 30 May 2007 06:25:32 +0000 Subject: [PATCH] some cleanup from the last commit --- macosx/FilterBarButton.m | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/macosx/FilterBarButton.m b/macosx/FilterBarButton.m index bff5820d9..233202d40 100644 --- a/macosx/FilterBarButton.m +++ b/macosx/FilterBarButton.m @@ -40,7 +40,9 @@ fTrackingTag = 0; [self createButtons]; + fCount = -1; [self setCount: 0]; + [self setAlternateImage: fButtonPressed]; [self setImage: fButtonNormal]; @@ -73,8 +75,12 @@ - (void) setCount: (int) count { - [self setToolTip: count == 1 ? NSLocalizedString(@"1 Transfer", "Filter Bar Button -> tool tip") - : [NSString stringWithFormat: NSLocalizedString(@"%d Transfers", "Filter Bar Button -> tool tip"), count]]; + if (count == fCount) + return; + fCount = count; + + [self setToolTip: fCount == 1 ? NSLocalizedString(@"1 Transfer", "Filter Bar Button -> tool tip") + : [NSString stringWithFormat: NSLocalizedString(@"%d Transfers", "Filter Bar Button -> tool tip"), fCount]]; } - (void) mouseEntered: (NSEvent *) event @@ -172,10 +178,6 @@ [shadowDim release]; [shadowHighlighted release]; - //create button text - NSString * text = [self title], - * number = fCount > 0 ? [NSString stringWithFormat: @" (%d)", fCount] : nil; - //get images NSImage * leftOver = [NSImage imageNamed: @"FilterButtonOverLeft.png"], * rightOver = [NSImage imageNamed: @"FilterButtonOverRight.png"], @@ -190,6 +192,7 @@ * mainSelected = [NSImage imageNamed: @"FilterButtonSelectedMain.png"]; //get button sizes and placement + NSString * text = [self title]; NSSize textSize = [text sizeWithAttributes: normalAttributes]; textSize.width = ceilf(textSize.width);