From 338b2a6a1917aadea9f913461d9f2a026ef02e1c Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Fri, 16 Jun 2006 01:50:10 +0000 Subject: [PATCH] Make more images static. --- macosx/TorrentCell.m | 2 +- macosx/TorrentTableView.m | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index a419e97db..17388a798 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -32,7 +32,7 @@ - (void) placeBar: (NSImage *) barImage width: (float) width point: (NSPoint) point; - (void) buildSimpleBar: (float) width point: (NSPoint) point; -- (void) buildAdvancedBar: (float) width point: (NSPoint) point; +- (void) buildAdvancedBar: (float) widthFloat point: (NSPoint) point; @end diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index 41eacce76..06f342e19 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -44,8 +44,18 @@ @implementation TorrentTableView +static NSImage * fResumeOnIcon, * fResumeOffIcon, * fPauseOnIcon, * fPauseOffIcon, + * fRevealOnIcon, * fRevealOffIcon; + - (void) awakeFromNib { + fResumeOnIcon = [NSImage imageNamed: @"ResumeOn.png"]; + fResumeOffIcon = [NSImage imageNamed: @"ResumeOff.png"]; + fPauseOnIcon = [NSImage imageNamed: @"PauseOn.png"]; + fPauseOffIcon = [NSImage imageNamed: @"PauseOff.png"]; + fRevealOnIcon = [NSImage imageNamed: @"RevealOn.png"]; + fRevealOffIcon = [NSImage imageNamed: @"RevealOff.png"]; + [fContextRow setTitle: @"Context"]; [fContextNoRow setTitle: @"Context"]; } @@ -145,23 +155,15 @@ { torrent = [fTorrents objectAtIndex: i]; rect = [self pauseRectForRow: i]; - image = nil; - if( [torrent isPaused] ) - { - image = NSPointInRect( fClickPoint, rect ) ? - [NSImage imageNamed: @"ResumeOn.png"] : - [NSImage imageNamed: @"ResumeOff.png"]; - } - else if( [torrent isActive] ) - { - image = NSPointInRect( fClickPoint, rect ) ? - [NSImage imageNamed: @"PauseOn.png"] : - [NSImage imageNamed: @"PauseOff.png"]; - } - else; + if ([torrent isPaused]) + image = NSPointInRect(fClickPoint, rect) ? fResumeOnIcon : fResumeOffIcon; + else if ([torrent isActive]) + image = NSPointInRect(fClickPoint, rect) ? fPauseOnIcon : fPauseOffIcon; + else + image = nil; - if( image ) + if (image) { [image setFlipped: YES]; [image drawAtPoint: rect.origin fromRect: @@ -169,10 +171,8 @@ NSCompositeSourceOver fraction: 1.0]; } - rect = [self revealRectForRow: i]; - image = NSPointInRect( fClickPoint, rect ) ? - [NSImage imageNamed: @"RevealOn.png"] : - [NSImage imageNamed: @"RevealOff.png"]; + rect = [self revealRectForRow: i]; + image = NSPointInRect(fClickPoint, rect) ? fRevealOnIcon : fRevealOffIcon; [image setFlipped: YES]; [image drawAtPoint: rect.origin fromRect: NSMakeRect(0, 0, BUTTON_WIDTH, BUTTON_WIDTH) operation: