use the actual Torrent class to access values for the torrent cell class, rather than creating a dictionary and using that on each reload

This commit is contained in:
Mitchell Livingston 2007-08-10 03:20:01 +00:00
parent ea8a9f39fe
commit 87a2bd6479
6 changed files with 170 additions and 191 deletions

View File

@ -313,7 +313,7 @@
4DFBC2DD09C0970D00D5C571 /* Torrent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Torrent.h; path = macosx/Torrent.h; sourceTree = "<group>"; }; 4DFBC2DD09C0970D00D5C571 /* Torrent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Torrent.h; path = macosx/Torrent.h; sourceTree = "<group>"; };
4DFBC2DE09C0970D00D5C571 /* Torrent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Torrent.m; path = macosx/Torrent.m; sourceTree = "<group>"; }; 4DFBC2DE09C0970D00D5C571 /* Torrent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Torrent.m; path = macosx/Torrent.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = Info.plist; path = macosx/Info.plist; sourceTree = "<group>"; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = Info.plist; path = macosx/Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; };
A200B8390A2263BA007BBB1E /* InfoWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoWindowController.h; path = macosx/InfoWindowController.h; sourceTree = "<group>"; }; A200B8390A2263BA007BBB1E /* InfoWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoWindowController.h; path = macosx/InfoWindowController.h; sourceTree = "<group>"; };
A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InfoWindowController.m; path = macosx/InfoWindowController.m; sourceTree = "<group>"; }; A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InfoWindowController.m; path = macosx/InfoWindowController.m; sourceTree = "<group>"; };
A200B9630A227FD0007BBB1E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/InfoWindow.nib; sourceTree = "<group>"; }; A200B9630A227FD0007BBB1E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/InfoWindow.nib; sourceTree = "<group>"; };

View File

@ -2116,10 +2116,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
return [fDisplayedTorrents count]; return [fDisplayedTorrents count];
} }
- (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) tableColumn row: (int) row /*- (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) tableColumn row: (int) row
{ {
return [[fDisplayedTorrents objectAtIndex: row] infoForCurrentView]; return [[fDisplayedTorrents objectAtIndex: row] infoForCurrentView];
} }*/
- (BOOL) tableView: (NSTableView *) tableView writeRowsWithIndexes: (NSIndexSet *) indexes - (BOOL) tableView: (NSTableView *) tableView writeRowsWithIndexes: (NSIndexSet *) indexes
toPasteboard: (NSPasteboard *) pasteboard toPasteboard: (NSPasteboard *) pasteboard

View File

@ -85,7 +85,6 @@
- (void) getAmountFinished: (float *) tab size: (int) size; - (void) getAmountFinished: (float *) tab size: (int) size;
- (void) update; - (void) update;
- (NSDictionary *) infoForCurrentView;
- (void) startTransfer; - (void) startTransfer;
- (void) stopTransfer; - (void) stopTransfer;
@ -152,6 +151,7 @@
- (float) progress; - (float) progress;
- (float) progressDone; - (float) progressDone;
- (float) progressLeft;
- (int) eta; - (int) eta;
- (BOOL) isActive; - (BOOL) isActive;
@ -223,6 +223,8 @@
- (NSNumber *) progressSortKey; - (NSNumber *) progressSortKey;
- (NSNumber *) ratioSortKey; - (NSNumber *) ratioSortKey;
- (NSImage *) advancedBar;
- (int) torrentID; - (int) torrentID;
- (const tr_info_t *) torrentInfo; - (const tr_info_t *) torrentInfo;
- (const tr_stat_t *) torrentStat; - (const tr_stat_t *) torrentStat;

View File

@ -51,7 +51,6 @@ static int static_lastid = 0;
- (void) insertPath: (NSMutableArray *) components forSiblings: (NSMutableArray *) siblings - (void) insertPath: (NSMutableArray *) components forSiblings: (NSMutableArray *) siblings
withParent: (NSMutableDictionary *) parent previousPath: (NSString *) previousPath withParent: (NSMutableDictionary *) parent previousPath: (NSString *) previousPath
flatList: (NSMutableArray *) flatList fileSize: (uint64_t) size index: (int) index; flatList: (NSMutableArray *) flatList fileSize: (uint64_t) size index: (int) index;
- (NSImage *) advancedBar;
- (void) quickPause; - (void) quickPause;
- (void) endQuickPause; - (void) endQuickPause;
@ -485,40 +484,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[fRemainingTimeString setString: remainingTimeString]; [fRemainingTimeString setString: remainingTimeString];
} }
- (NSDictionary *) infoForCurrentView
{
NSMutableDictionary * info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[self name], @"Name",
[NSNumber numberWithFloat: [self progress]], @"Progress",
[NSNumber numberWithFloat: (float)fStat->left/[self size]], @"Left",
[NSNumber numberWithBool: [self isActive]], @"Active",
[NSNumber numberWithBool: [self isSeeding]], @"Seeding",
[NSNumber numberWithBool: [self isChecking]], @"Checking",
[NSNumber numberWithBool: fWaitToStart], @"Waiting",
[NSNumber numberWithBool: [self isError]], @"Error", nil];
if ([self isSeeding])
[info setObject: [NSNumber numberWithFloat: [self progressStopRatio]] forKey: @"ProgressStopRatio"];
if (![fDefaults boolForKey: @"SmallView"])
{
[info setObject: [self iconFlipped] forKey: @"Icon"];
[info setObject: [self progressString] forKey: @"ProgressString"];
[info setObject: [self statusString] forKey: @"StatusString"];
}
else
{
[info setObject: [self iconSmall] forKey: @"Icon"];
[info setObject: [self remainingTimeString] forKey: @"RemainingTimeString"];
[info setObject: [self shortStatusString] forKey: @"ShortStatusString"];
}
if ([fDefaults boolForKey: @"UseAdvancedBar"])
[info setObject: [self advancedBar] forKey: @"AdvancedBar"];
return info;
}
- (void) startTransfer - (void) startTransfer
{ {
fWaitToStart = NO; fWaitToStart = NO;
@ -1020,6 +985,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
return fStat->percentDone; return fStat->percentDone;
} }
- (float) progressLeft
{
return fStat->left/[self size];
}
- (int) eta - (int) eta
{ {
return fStat->eta; return fStat->eta;
@ -1450,6 +1420,135 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
return [NSNumber numberWithFloat: [self ratio]]; return [NSNumber numberWithFloat: [self ratio]];
} }
#warning move?
- (NSImage *) advancedBar
{
uint32_t * p;
uint8_t * bitmapData = [fBitmap bitmapData];
int bytesPerRow = [fBitmap bytesPerRow];
int pieceCount = [self pieceCount];
int8_t * piecesAvailablity = malloc(pieceCount);
[self getAvailability: piecesAvailablity size: pieceCount];
//lines 2 to 14: blue, green, or gray depending on piece availability
int i, h, index = 0;
float increment = (float)pieceCount / MAX_PIECES, indexValue = 0;
uint32_t color;
BOOL change;
for (i = 0; i < MAX_PIECES; i++)
{
change = NO;
if (piecesAvailablity[index] < 0)
{
if (fPieces[i] != -1)
{
color = kBlue;
fPieces[i] = -1;
change = YES;
}
}
else if (piecesAvailablity[index] == 0)
{
if (fPieces[i] != 0)
{
color = kGray;
fPieces[i] = 0;
change = YES;
}
}
else if (piecesAvailablity[index] <= 4)
{
if (fPieces[i] != 1)
{
color = kGreen1;
fPieces[i] = 1;
change = YES;
}
}
else if (piecesAvailablity[index] <= 8)
{
if (fPieces[i] != 2)
{
color = kGreen2;
fPieces[i] = 2;
change = YES;
}
}
else
{
if (fPieces[i] != 3)
{
color = kGreen3;
fPieces[i] = 3;
change = YES;
}
}
if (change)
{
//point to pixel (i, 2) and draw "vertically"
p = (uint32_t *)(bitmapData + 2 * bytesPerRow) + i;
for (h = 2; h < BAR_HEIGHT; h++)
{
p[0] = color;
p = (uint32_t *)((uint8_t *)p + bytesPerRow);
}
}
indexValue += increment;
index = (int)indexValue;
}
//determine percentage finished and available
int have = rintf((float)MAX_PIECES * [self progress]), avail;
if ([self progress] >= 1.0 || ![self isActive] || [self totalPeersConnected] <= 0)
avail = 0;
else
{
float * piecesFinished = malloc(pieceCount * sizeof(float));
[self getAmountFinished: piecesFinished size: pieceCount];
float available = 0;
for (i = 0; i < pieceCount; i++)
if (piecesAvailablity[i] > 0)
available += 1.0 - piecesFinished[i];
avail = rintf(MAX_PIECES * available / (float)pieceCount);
if (have + avail > MAX_PIECES) //case if both end in .5 and all pieces are available
avail--;
free(piecesFinished);
}
free(piecesAvailablity);
//first two lines: dark blue to show progression, green to show available
p = (uint32_t *)bitmapData;
for (i = 0; i < have; i++)
{
p[i] = kBlue2;
p[i + bytesPerRow / 4] = kBlue2;
}
for (; i < avail + have; i++)
{
p[i] = kGreen3;
p[i + bytesPerRow / 4] = kGreen3;
}
for (; i < MAX_PIECES; i++)
{
p[i] = kWhite;
p[i + bytesPerRow / 4] = kWhite;
}
//actually draw image
NSImage * bar = [[NSImage alloc] initWithSize: [fBitmap size]];
[bar addRepresentation: fBitmap];
[bar setScalesWhenResized: YES];
return [bar autorelease];
}
- (int) torrentID - (int) torrentID
{ {
return fID; return fID;
@ -1680,135 +1779,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
tr_torrentSetFolder(fHandle, [folder UTF8String]); tr_torrentSetFolder(fHandle, [folder UTF8String]);
} }
#warning move?
- (NSImage *) advancedBar
{
uint32_t * p;
uint8_t * bitmapData = [fBitmap bitmapData];
int bytesPerRow = [fBitmap bytesPerRow];
int pieceCount = [self pieceCount];
int8_t * piecesAvailablity = malloc(pieceCount);
[self getAvailability: piecesAvailablity size: pieceCount];
//lines 2 to 14: blue, green, or gray depending on piece availability
int i, h, index = 0;
float increment = (float)pieceCount / (float)MAX_PIECES, indexValue = 0;
uint32_t color;
BOOL change;
for (i = 0; i < MAX_PIECES; i++)
{
change = NO;
if (piecesAvailablity[index] < 0)
{
if (fPieces[i] != -1)
{
color = kBlue;
fPieces[i] = -1;
change = YES;
}
}
else if (piecesAvailablity[index] == 0)
{
if (fPieces[i] != 0)
{
color = kGray;
fPieces[i] = 0;
change = YES;
}
}
else if (piecesAvailablity[index] <= 4)
{
if (fPieces[i] != 1)
{
color = kGreen1;
fPieces[i] = 1;
change = YES;
}
}
else if (piecesAvailablity[index] <= 8)
{
if (fPieces[i] != 2)
{
color = kGreen2;
fPieces[i] = 2;
change = YES;
}
}
else
{
if (fPieces[i] != 3)
{
color = kGreen3;
fPieces[i] = 3;
change = YES;
}
}
if (change)
{
//point to pixel (i, 2) and draw "vertically"
p = (uint32_t *)(bitmapData + 2 * bytesPerRow) + i;
for (h = 2; h < BAR_HEIGHT; h++)
{
p[0] = color;
p = (uint32_t *)((uint8_t *)p + bytesPerRow);
}
}
indexValue += increment;
index = (int)indexValue;
}
//determine percentage finished and available
int have = rintf((float)MAX_PIECES * [self progress]), avail;
if ([self progress] >= 1.0 || ![self isActive] || [self totalPeersConnected] <= 0)
avail = 0;
else
{
float * piecesFinished = malloc(pieceCount * sizeof(float));
[self getAmountFinished: piecesFinished size: pieceCount];
float available = 0;
for (i = 0; i < pieceCount; i++)
if (piecesAvailablity[i] > 0)
available += 1.0 - piecesFinished[i];
avail = rintf((float)MAX_PIECES * available / (float)pieceCount);
if (have + avail > MAX_PIECES) //case if both end in .5 and all pieces are available
avail--;
free(piecesFinished);
}
free(piecesAvailablity);
//first two lines: dark blue to show progression, green to show available
p = (uint32_t *)bitmapData;
for (i = 0; i < have; i++)
{
p[i] = kBlue2;
p[i + bytesPerRow / 4] = kBlue2;
}
for (; i < avail + have; i++)
{
p[i] = kGreen3;
p[i + bytesPerRow / 4] = kGreen3;
}
for (; i < MAX_PIECES; i++)
{
p[i] = kWhite;
p[i + bytesPerRow / 4] = kWhite;
}
//actually draw image
NSImage * bar = [[NSImage alloc] initWithSize: [fBitmap size]];
[bar addRepresentation: fBitmap];
[bar setScalesWhenResized: YES];
return [bar autorelease];
}
- (void) quickPause - (void) quickPause
{ {
if (fQuickPauseDict) if (fQuickPauseDict)

View File

@ -75,7 +75,7 @@
- (void) buildSimpleBar: (float) width point: (NSPoint) point - (void) buildSimpleBar: (float) width point: (NSPoint) point
{ {
NSDictionary * info = [self objectValue]; Torrent * torrent = [self representedObject];
NSRect barBounds, completeBounds; NSRect barBounds, completeBounds;
if([[self controlView] isFlipped]) if([[self controlView] isFlipped])
@ -84,7 +84,7 @@
barBounds = NSMakeRect(point.x, point.y - BAR_HEIGHT, width, BAR_HEIGHT); barBounds = NSMakeRect(point.x, point.y - BAR_HEIGHT, width, BAR_HEIGHT);
completeBounds = barBounds; completeBounds = barBounds;
float progress = [[info objectForKey: @"Progress"] floatValue]; float progress = [torrent progress];
completeBounds.size.width = progress * width; completeBounds.size.width = progress * width;
float left = INVALID; float left = INVALID;
@ -94,7 +94,7 @@
fWhiteGradient = [[CTGradient progressWhiteGradient] retain]; fWhiteGradient = [[CTGradient progressWhiteGradient] retain];
[fWhiteGradient fillRect: barBounds angle: -90]; [fWhiteGradient fillRect: barBounds angle: -90];
left = [[info objectForKey: @"Left"] floatValue]; left = [torrent progressLeft];
if ((progress + left) < 1.0) if ((progress + left) < 1.0)
{ {
NSRect blankBounds = barBounds; NSRect blankBounds = barBounds;
@ -107,18 +107,18 @@
} }
} }
if ([[info objectForKey: @"Active"] boolValue]) if ([torrent isActive])
{ {
if ([[info objectForKey: @"Checking"] boolValue]) if ([torrent isChecking])
{ {
if (!fYellowGradient) if (!fYellowGradient)
fYellowGradient = [[CTGradient progressYellowGradient] retain]; fYellowGradient = [[CTGradient progressYellowGradient] retain];
[fYellowGradient fillRect: completeBounds angle: -90]; [fYellowGradient fillRect: completeBounds angle: -90];
} }
else if ([[info objectForKey: @"Seeding"] boolValue]) else if ([torrent isSeeding])
{ {
NSRect ratioBounds = completeBounds; NSRect ratioBounds = completeBounds;
ratioBounds.size.width *= [[info objectForKey: @"ProgressStopRatio"] floatValue]; ratioBounds.size.width *= [torrent progressStopRatio];
if (ratioBounds.size.width < completeBounds.size.width) if (ratioBounds.size.width < completeBounds.size.width)
{ {
@ -140,10 +140,10 @@
} }
else else
{ {
if ([[info objectForKey: @"Waiting"] boolValue]) if ([torrent waitingToStart])
{ {
if (left == INVALID) if (left == INVALID)
left = [[info objectForKey: @"Left"] floatValue]; left = [torrent progressLeft];
if (left <= 0.0) if (left <= 0.0)
{ {
@ -172,10 +172,10 @@
- (void) buildAdvancedBar: (float) width point: (NSPoint) point - (void) buildAdvancedBar: (float) width point: (NSPoint) point
{ {
NSDictionary * info = [self objectValue]; Torrent * torrent = [self representedObject];
//place actual advanced bar //place actual advanced bar
NSImage * image = [info objectForKey: @"AdvancedBar"]; NSImage * image = [torrent advancedBar];
[image setSize: NSMakeSize(width, BAR_HEIGHT)]; [image setSize: NSMakeSize(width, BAR_HEIGHT)];
[image compositeToPoint: point operation: NSCompositeSourceOver]; [image compositeToPoint: point operation: NSCompositeSourceOver];
@ -211,12 +211,12 @@
NSPoint pen = cellFrame.origin; NSPoint pen = cellFrame.origin;
const float LINE_PADDING = 2.0, EXTRA_NAME_SHIFT = 1.0; //standard padding is defined in TorrentCell.h const float LINE_PADDING = 2.0, EXTRA_NAME_SHIFT = 1.0; //standard padding is defined in TorrentCell.h
NSDictionary * info = [self objectValue]; Torrent * torrent = [self representedObject];
if (![fDefaults boolForKey: @"SmallView"]) //regular size if (![fDefaults boolForKey: @"SmallView"]) //regular size
{ {
//icon //icon
NSImage * icon = [info objectForKey: @"Icon"]; NSImage * icon = [torrent iconFlipped];
NSSize iconSize = [icon size]; NSSize iconSize = [icon size];
pen.x += PADDING; pen.x += PADDING;
@ -226,7 +226,7 @@
operation: NSCompositeSourceOver fraction: 1.0]; operation: NSCompositeSourceOver fraction: 1.0];
//error badge //error badge
if ([[info objectForKey: @"Error"] boolValue]) if ([torrent isError])
{ {
if (!fErrorImage) if (!fErrorImage)
{ {
@ -247,14 +247,14 @@
pen.x += iconSize.width + PADDING + EXTRA_NAME_SHIFT; pen.x += iconSize.width + PADDING + EXTRA_NAME_SHIFT;
pen.y = cellFrame.origin.y + PADDING; pen.y = cellFrame.origin.y + PADDING;
NSString * nameString = [info objectForKey: @"Name"]; NSString * nameString = [torrent name];
NSSize nameSize = [nameString sizeWithAttributes: nameAttributes]; NSSize nameSize = [nameString sizeWithAttributes: nameAttributes];
[nameString drawInRect: NSMakeRect(pen.x, pen.y, mainWidth, nameSize.height) withAttributes: nameAttributes]; [nameString drawInRect: NSMakeRect(pen.x, pen.y, mainWidth, nameSize.height) withAttributes: nameAttributes];
//progress string //progress string
pen.y += nameSize.height + LINE_PADDING - 1.0; pen.y += nameSize.height + LINE_PADDING - 1.0;
NSString * progressString = [info objectForKey: @"ProgressString"]; NSString * progressString = [torrent progressString];
NSSize progressSize = [progressString sizeWithAttributes: statusAttributes]; NSSize progressSize = [progressString sizeWithAttributes: statusAttributes];
[progressString drawInRect: NSMakeRect(pen.x, pen.y, mainWidth, progressSize.height) withAttributes: statusAttributes]; [progressString drawInRect: NSMakeRect(pen.x, pen.y, mainWidth, progressSize.height) withAttributes: statusAttributes];
@ -273,7 +273,7 @@
pen.x += EXTRA_NAME_SHIFT; pen.x += EXTRA_NAME_SHIFT;
pen.y += LINE_PADDING; pen.y += LINE_PADDING;
NSString * statusString = [info objectForKey: @"StatusString"]; NSString * statusString = [torrent statusString];
NSSize statusSize = [statusString sizeWithAttributes: statusAttributes]; NSSize statusSize = [statusString sizeWithAttributes: statusAttributes];
[statusString drawInRect: NSMakeRect(pen.x, pen.y, mainWidth, statusSize.height) withAttributes: statusAttributes]; [statusString drawInRect: NSMakeRect(pen.x, pen.y, mainWidth, statusSize.height) withAttributes: statusAttributes];
} }
@ -281,7 +281,7 @@
{ {
//icon //icon
NSImage * icon; NSImage * icon;
if ([[info objectForKey: @"Error"] boolValue]) if ([torrent isError])
{ {
if (!fErrorImage) if (!fErrorImage)
{ {
@ -291,7 +291,7 @@
icon = fErrorImage; icon = fErrorImage;
} }
else else
icon = [info objectForKey: @"Icon"]; icon = [torrent iconSmall];
NSSize iconSize = [icon size]; NSSize iconSize = [icon size];
pen.x += PADDING; pen.x += PADDING;
@ -307,12 +307,11 @@
pen.x += iconSize.width + PADDING + EXTRA_NAME_SHIFT; pen.x += iconSize.width + PADDING + EXTRA_NAME_SHIFT;
pen.y = cellFrame.origin.y + LINE_PADDING; pen.y = cellFrame.origin.y + LINE_PADDING;
NSString * nameString = [info objectForKey: @"Name"]; NSString * nameString = [torrent name];
NSSize nameSize = [nameString sizeWithAttributes: nameAttributes]; NSSize nameSize = [nameString sizeWithAttributes: nameAttributes];
NSString * statusString = ![fDefaults boolForKey: @"SmallStatusRegular"] && [[info objectForKey: @"Active"] boolValue] NSString * statusString = ![fDefaults boolForKey: @"SmallStatusRegular"] && [torrent isActive]
? [info objectForKey: @"RemainingTimeString"] ? [torrent remainingTimeString] : [torrent shortStatusString];
: [info objectForKey: @"ShortStatusString"];
NSSize statusSize = [statusString sizeWithAttributes: statusAttributes]; NSSize statusSize = [statusString sizeWithAttributes: statusAttributes];
[nameString drawInRect: NSMakeRect(pen.x, pen.y, mainWidth - statusSize.width - 2.0 * LINE_PADDING, nameSize.height) [nameString drawInRect: NSMakeRect(pen.x, pen.y, mainWidth - statusSize.width - 2.0 * LINE_PADDING, nameSize.height)

View File

@ -76,6 +76,8 @@
[NSFont messageFontOfSize: 9.0], NSFontAttributeName, nil]; [NSFont messageFontOfSize: 9.0], NSFontAttributeName, nil];
fDefaults = [NSUserDefaults standardUserDefaults]; fDefaults = [NSUserDefaults standardUserDefaults];
[self setDelegate: self];
} }
return self; return self;
@ -102,6 +104,12 @@
fTorrents = torrents; fTorrents = torrents;
} }
- (void) tableView: (NSTableView *) tableView willDisplayCell: (id) cell
forTableColumn: (NSTableColumn *) tableColumn row: (int) row
{
[cell setRepresentedObject: [fTorrents objectAtIndex: row]];
}
- (void) mouseDown: (NSEvent *) event - (void) mouseDown: (NSEvent *) event
{ {
fClickPoint = [self convertPoint: [event locationInWindow] fromView: nil]; fClickPoint = [self convertPoint: [event locationInWindow] fromView: nil];