Show the file icon in the "Name" cell
Changed 0.5-cvs to 0.5-svn
This commit is contained in:
parent
0ed06f109d
commit
f6a70e2a8f
2
Jamrules
2
Jamrules
|
@ -8,7 +8,7 @@ if ! $(DEFINES)
|
||||||
VERSION_MAJOR = 0 ;
|
VERSION_MAJOR = 0 ;
|
||||||
VERSION_MINOR = 4 ;
|
VERSION_MINOR = 4 ;
|
||||||
# VERSION_STRING = $(VERSION_MAJOR).$(VERSION_MINOR) ;
|
# VERSION_STRING = $(VERSION_MAJOR).$(VERSION_MINOR) ;
|
||||||
VERSION_STRING = 0.5-cvs ;
|
VERSION_STRING = 0.5-svn ;
|
||||||
|
|
||||||
DEFINES += VERSION_MAJOR=$(VERSION_MAJOR)
|
DEFINES += VERSION_MAJOR=$(VERSION_MAJOR)
|
||||||
VERSION_MINOR=$(VERSION_MINOR)
|
VERSION_MINOR=$(VERSION_MINOR)
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
NSString * fSizeString;
|
NSString * fSizeString;
|
||||||
NSString * fTimeString;
|
NSString * fTimeString;
|
||||||
NSString * fPeersString;
|
NSString * fPeersString;
|
||||||
|
|
||||||
|
NSImage * fIcon;
|
||||||
}
|
}
|
||||||
- (void) setStat: (tr_stat_t *) stat whiteText: (BOOL) w;
|
- (void) setStat: (tr_stat_t *) stat whiteText: (BOOL) w;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -33,6 +33,12 @@
|
||||||
fNameString = [NSString stringWithUTF8String: stat->info.name];
|
fNameString = [NSString stringWithUTF8String: stat->info.name];
|
||||||
fSizeString = [NSString stringWithFormat: @" (%@)",
|
fSizeString = [NSString stringWithFormat: @" (%@)",
|
||||||
[NSString stringForFileSize: stat->info.totalSize]];
|
[NSString stringForFileSize: stat->info.totalSize]];
|
||||||
|
|
||||||
|
fIcon = [[NSWorkspace sharedWorkspace] iconForFile:
|
||||||
|
[[NSString stringWithUTF8String: stat->folder]
|
||||||
|
stringByAppendingPathComponent: fNameString]];
|
||||||
|
[fIcon setFlipped: YES];
|
||||||
|
|
||||||
fTimeString = @"";
|
fTimeString = @"";
|
||||||
fPeersString = @"";
|
fPeersString = @"";
|
||||||
|
|
||||||
|
@ -97,6 +103,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
pen = cellFrame.origin;
|
pen = cellFrame.origin;
|
||||||
|
float cellWidth = cellFrame.size.width;
|
||||||
|
|
||||||
|
pen.x += 5;
|
||||||
|
pen.y += 5;
|
||||||
|
[fIcon drawAtPoint: pen fromRect:
|
||||||
|
NSMakeRect(0,0,[fIcon size].width,[fIcon size].height)
|
||||||
|
operation: NSCompositeSourceOver fraction: 1.0];
|
||||||
|
|
||||||
attributes = [NSMutableDictionary dictionaryWithCapacity: 2];
|
attributes = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||||
[attributes setObject: fWhiteText ? [NSColor whiteColor] :
|
[attributes setObject: fWhiteText ? [NSColor whiteColor] :
|
||||||
|
@ -105,9 +118,9 @@
|
||||||
[attributes setObject: [NSFont messageFontOfSize: 12.0]
|
[attributes setObject: [NSFont messageFontOfSize: 12.0]
|
||||||
forKey: NSFontAttributeName];
|
forKey: NSFontAttributeName];
|
||||||
|
|
||||||
pen.x += 5; pen.y += 5;
|
pen.x += 37;
|
||||||
string = [[fNameString stringFittingInWidth: cellFrame.size.width -
|
string = [[fNameString stringFittingInWidth: cellWidth -
|
||||||
35 - [fSizeString sizeWithAttributes: attributes].width
|
72 - [fSizeString sizeWithAttributes: attributes].width
|
||||||
withAttributes: attributes] stringByAppendingString: fSizeString];
|
withAttributes: attributes] stringByAppendingString: fSizeString];
|
||||||
[string drawAtPoint: pen withAttributes: attributes];
|
[string drawAtPoint: pen withAttributes: attributes];
|
||||||
|
|
||||||
|
@ -119,7 +132,7 @@
|
||||||
|
|
||||||
pen.x += 0; pen.y += 15;
|
pen.x += 0; pen.y += 15;
|
||||||
string = [fPeersString stringFittingInWidth: cellFrame.size.width -
|
string = [fPeersString stringFittingInWidth: cellFrame.size.width -
|
||||||
40 withAttributes: attributes];
|
77 withAttributes: attributes];
|
||||||
[string drawAtPoint: pen withAttributes: attributes];
|
[string drawAtPoint: pen withAttributes: attributes];
|
||||||
|
|
||||||
[view unlockFocus];
|
[view unlockFocus];
|
||||||
|
|
Loading…
Reference in New Issue