diff --git a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib index 992f51849..4052345a6 100644 Binary files a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib and b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib differ diff --git a/macosx/FileBrowserCell.m b/macosx/FileBrowserCell.m index ef529775a..dc56db1bb 100644 --- a/macosx/FileBrowserCell.m +++ b/macosx/FileBrowserCell.m @@ -12,37 +12,68 @@ - (void) setImage: (NSImage *) image { [image setFlipped: YES]; + [image setScalesWhenResized: YES]; [super setImage: image]; } - (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView { //image - NSImage * icon = [self image]; - NSSize iconSize = [icon size]; - NSRect imageRect = NSMakeRect(cellFrame.origin.x + 2.0 * SPACE, cellFrame.origin.y, iconSize.width, iconSize.height); + float imageHeight = cellFrame.size.height - 2.0; - [icon drawInRect: imageRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; + NSImage * image = [self image]; + [image setSize: NSMakeSize(imageHeight, imageHeight)]; + NSRect imageRect = NSMakeRect(cellFrame.origin.x + 2.0 * SPACE, + cellFrame.origin.y + (cellFrame.size.height - imageHeight) / 2.0, + imageHeight, imageHeight); + + [image drawInRect: imageRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; //text - NSRect textRect = NSMakeRect(NSMaxX(imageRect) + SPACE, cellFrame.origin.y, - cellFrame.size.width - 4.0 * SPACE, cellFrame.size.height); + NSArray * strings = [[self stringValue] componentsSeparatedByString: @"\n"]; - if ([self isHighlighted] && [[self highlightColorWithFrame: cellFrame inView: controlView] - isEqual: [NSColor alternateSelectedControlColor]]) + NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; + [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail]; + + BOOL highlighted = [self isHighlighted] && [[self highlightColorWithFrame: cellFrame inView: controlView] + isEqual: [NSColor alternateSelectedControlColor]]; + NSDictionary * nameAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: + highlighted ? [NSColor whiteColor] : [NSColor controlTextColor], NSForegroundColorAttributeName, + [NSFont messageFontOfSize: 12.0], NSFontAttributeName, + paragraphStyle, NSParagraphStyleAttributeName, nil]; + + float textHeight = [(NSTableView *)controlView rowHeight]; + NSRect textRect = NSMakeRect(NSMaxX(imageRect) + SPACE, cellFrame.origin.y + 2.0, + NSMaxX(cellFrame) - NSMaxX(imageRect) - 2.0 * SPACE, textHeight); + + NSAttributedString * text = [[NSAttributedString alloc] initWithString: [strings objectAtIndex: 0] + attributes: nameAttributes]; + [text drawInRect: textRect]; + [text release]; + + //bottomText + if ([strings count] > 1) { - NSMutableAttributedString * text = [[self attributedStringValue] mutableCopy]; - NSDictionary * attributes = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSColor whiteColor], NSForegroundColorAttributeName, nil]; - [text addAttributes: attributes range: NSMakeRange(0, [text length])]; - [text drawInRect: textRect]; + NSDictionary * statusAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: + highlighted ? [NSColor whiteColor] : [NSColor darkGrayColor], NSForegroundColorAttributeName, + [NSFont messageFontOfSize: 9.0], NSFontAttributeName, + paragraphStyle, NSParagraphStyleAttributeName, nil]; - [attributes release]; - [text release]; + NSRect bottomTextRect = textRect; + bottomTextRect.origin.y += textHeight; + bottomTextRect.size.height = cellFrame.size.height - textHeight; + + NSMutableAttributedString * bottomText = [[NSMutableAttributedString alloc] initWithString: [strings objectAtIndex: 1] + attributes: statusAttributes]; + + [bottomText drawInRect: bottomTextRect]; + [bottomText release]; + + [statusAttributes release]; } - else - [[self attributedStringValue] drawInRect: textRect]; - + + [paragraphStyle release]; + [nameAttributes release]; } @end diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index fbde719ac..8dee19379 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -676,13 +676,16 @@ - (id) outlineView: (NSOutlineView *) outlineView objectValueForTableColumn: (NSTableColumn *) tableColumn byItem: (id) item { - if ([[tableColumn identifier] isEqualToString: @"Size"]) - return ![[item objectForKey: @"IsFolder"] boolValue] - ? [NSString stringForFileSize: [[item objectForKey: @"Size"] unsignedLongLongValue]] : @""; - else if ([[tableColumn identifier] isEqualToString: @"Check"]) + if ([[tableColumn identifier] isEqualToString: @"Check"]) return [item objectForKey: @"Check"]; else - return [item objectForKey: @"Name"]; + { + if ([[item objectForKey: @"IsFolder"] boolValue]) + return [item objectForKey: @"Name"]; + else + return [NSString stringWithFormat: @"%@\n%@", [item objectForKey: @"Name"], + [NSString stringForFileSize: [[item objectForKey: @"Size"] unsignedLongLongValue]]]; + } } - (void) outlineView: (NSOutlineView *) outlineView setObjectValue: (id) object @@ -752,8 +755,6 @@ { NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFileType: ![[item objectForKey: @"IsFolder"] boolValue] ? [[item objectForKey: @"Name"] pathExtension] : NSFileTypeForHFSTypeCode('fldr')]; - [icon setScalesWhenResized: YES]; - [icon setSize: NSMakeSize(16.0, 16.0)]; [cell setImage: icon]; } else if ([[tableColumn identifier] isEqualToString: @"Check"]) @@ -768,16 +769,25 @@ tableColumn: (NSTableColumn *) tableColumn item: (id) item mouseLocation: (NSPoint) mouseLocation { NSString * ident = [tableColumn identifier]; - if ([ident isEqualToString: @"Size"]) + #warning change + /*if ([ident isEqualToString: @"Size"]) return ![[item objectForKey: @"IsFolder"] boolValue] ? [[[item objectForKey: @"Size"] stringValue] stringByAppendingString: NSLocalizedString(@" bytes", "Inspector -> Files tab -> table row tooltip")] : nil; - else if ([ident isEqualToString: @"Name"]) + else*/ if ([ident isEqualToString: @"Name"]) return [[[fTorrents objectAtIndex: 0] downloadFolder] stringByAppendingPathComponent: [item objectForKey: @"Path"]]; else return nil; } +- (float) outlineView: (NSOutlineView *) outlineView heightOfRowByItem: (id) item +{ + float height = [outlineView rowHeight]; + if (![[item objectForKey: @"IsFolder"] boolValue]) + height = 34.0; + return height; +} + - (NSArray *) peerSortDescriptors { NSMutableArray * descriptors = [NSMutableArray array];