keep one image for the table view instead of one for regular and one for minimal

This commit is contained in:
Mitchell Livingston
2007-08-16 03:58:50 +00:00
parent 91304ec1e6
commit 75ec8bac79
5 changed files with 8 additions and 19 deletions

View File

@@ -311,7 +311,10 @@
[self setNeedsDisplay];
}
free(showAvailablity ? pieces : piecesPercent);
if (showAvailablity)
free(pieces);
else
free(piecesPercent);
}
- (BOOL) acceptsFirstMouse: (NSEvent *) event

View File

@@ -56,7 +56,7 @@ typedef enum
NSUserDefaults * fDefaults;
NSImage * fIcon, * fIconFlipped, * fIconSmall;
NSImage * fIcon, * fIconFlipped;
NSMutableString * fNameString, * fProgressString, * fStatusString, * fShortStatusString, * fRemainingTimeString;
tr_file_stat_t * fileStat;
@@ -130,7 +130,6 @@ typedef enum
- (NSImage *) icon;
- (NSImage *) iconFlipped;
- (NSImage *) iconSmall;
- (NSString *) name;
- (uint64_t) size;

View File

@@ -157,7 +157,6 @@ static int static_lastid = 0;
[fIcon release];
[fIconFlipped release];
[fIconSmall release];
[fProgressString release];
[fStatusString release];
@@ -832,18 +831,6 @@ static int static_lastid = 0;
return fIconFlipped;
}
- (NSImage *) iconSmall
{
if (!fIconSmall)
{
fIconSmall = [fIcon copy];
[fIconSmall setFlipped: YES];
[fIconSmall setScalesWhenResized: YES];
[fIconSmall setSize: NSMakeSize(16.0, 16.0)];
}
return fIconSmall;
}
- (NSString *) name
{
return [NSString stringWithUTF8String: fInfo->name];

View File

@@ -209,7 +209,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
}
//icon
NSImage * icon = minimal ? (error ? fErrorImage : [torrent iconSmall]) : [torrent iconFlipped];
NSImage * icon = minimal && error ? fErrorImage : [torrent iconFlipped];
NSRect iconRect = [self iconRectForBounds: cellFrame];
[icon drawInRect: iconRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];

View File

@@ -451,7 +451,7 @@
if (row < 0)
return NSZeroRect;
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
NSRect cellRect = [self frameOfCellAtColumn: 0 row: row];
float buttonToTop = [fDefaults boolForKey: @"SmallView"] ? BUTTON_TO_TOP_SMALL : BUTTON_TO_TOP_REGULAR;
@@ -464,7 +464,7 @@
if (row < 0)
return NSZeroRect;
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
NSRect cellRect = [self frameOfCellAtColumn: 0 row: row];
float buttonToTop = [fDefaults boolForKey: @"SmallView"] ? BUTTON_TO_TOP_SMALL : BUTTON_TO_TOP_REGULAR;