From: Mitchell Livingston Date: Fri, 2 May 2008 13:08:23 +0000 (+0000) Subject: generate the inspector tab button images dynamically when selected/deselected instead... X-Git-Tag: 1.20~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acdd97384e6ac79f0ac96481ec51202b9c2cd70a;p=transmission generate the inspector tab button images dynamically when selected/deselected instead of storing them --- diff --git a/macosx/BadgeView.m b/macosx/BadgeView.m index 5d07301f3..6c24c9114 100644 --- a/macosx/BadgeView.m +++ b/macosx/BadgeView.m @@ -70,7 +70,6 @@ - (void) setQuitting { fQuitting = YES; - [self display]; } - (void) drawRect: (NSRect) rect diff --git a/macosx/InfoTabButtonCell.h b/macosx/InfoTabButtonCell.h index dba0b35b7..4a7d045aa 100644 --- a/macosx/InfoTabButtonCell.h +++ b/macosx/InfoTabButtonCell.h @@ -26,7 +26,7 @@ @interface InfoTabButtonCell : NSButtonCell { - NSImage * fIcon, * fRegularImage, * fSelectedImage; + NSImage * fIcon; BOOL fSelected; } diff --git a/macosx/InfoTabButtonCell.m b/macosx/InfoTabButtonCell.m index 3239ddeb5..a8e4ae323 100644 --- a/macosx/InfoTabButtonCell.m +++ b/macosx/InfoTabButtonCell.m @@ -43,8 +43,6 @@ [fIcon release]; - [fRegularImage release]; - [fSelectedImage release]; [super dealloc]; } @@ -53,17 +51,6 @@ [fIcon release]; fIcon = [image retain]; - if (fRegularImage) - { - [fRegularImage release]; - fRegularImage = nil; - } - if (fSelectedImage) - { - [fSelectedImage release]; - fSelectedImage = nil; - } - [self setSelectedTab: fSelected]; } @@ -72,49 +59,29 @@ fSelected = selected; NSImage * tabImage; - BOOL createImage = NO; if (fSelected) - { - if (!fSelectedImage) - { - fSelectedImage = [NSColor currentControlTint] == NSGraphiteControlTint - ? [[NSImage imageNamed: @"InfoTabBackGraphite.png"] copy] : [[NSImage imageNamed: @"InfoTabBackBlue.png"] copy]; - createImage = YES; - } - tabImage = fSelectedImage; - } + tabImage = [NSColor currentControlTint] == NSGraphiteControlTint + ? [[NSImage imageNamed: @"InfoTabBackGraphite.png"] copy] : [[NSImage imageNamed: @"InfoTabBackBlue.png"] copy]; else - { - if (!fRegularImage) - { - fRegularImage = [[NSImage imageNamed: @"InfoTabBack.png"] copy]; - createImage = YES; - } - tabImage = fRegularImage; - } + tabImage = [[NSImage imageNamed: @"InfoTabBack.png"] copy]; - if (createImage) + if (fIcon) { - if (fIcon) - { - NSSize iconSize = [fIcon size], tabSize = [tabImage size]; - NSPoint point = NSMakePoint(floorf((tabSize.width - iconSize.width) * 0.5), - floorf((tabSize.height - iconSize.height) * 0.5)); - - [tabImage lockFocus]; - [fIcon compositeToPoint: point operation: NSCompositeSourceOver]; - [tabImage unlockFocus]; - } + NSSize iconSize = [fIcon size], tabSize = [tabImage size]; + NSPoint point = NSMakePoint(floorf((tabSize.width - iconSize.width) * 0.5), + floorf((tabSize.height - iconSize.height) * 0.5)); + + [tabImage lockFocus]; + [fIcon compositeToPoint: point operation: NSCompositeSourceOver]; + [tabImage unlockFocus]; } [self setImage: tabImage]; + [tabImage release]; } - (void) updateControlTint: (NSNotification *) notification { - [fSelectedImage release]; - fSelectedImage = nil; - if (fSelected) [self setSelectedTab: YES]; }