diff --git a/macosx/Controller.m b/macosx/Controller.m index 80a6fd6df..973ea1285 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -2888,6 +2888,10 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi [segmentedControl setSegmentCount: 2]; [segmentedCell setTrackingMode: NSSegmentSwitchTrackingMomentary]; + NSSize groupSize = NSMakeSize(72.0, 25.0); + [groupItem setMinSize: groupSize]; + [groupItem setMaxSize: groupSize]; + [groupItem setLabel: NSLocalizedString(@"Apply All", "All toolbar item -> label")]; [groupItem setPaletteLabel: NSLocalizedString(@"Pause / Resume All", "All toolbar item -> palette label")]; [groupItem setTarget: self]; @@ -2908,10 +2912,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi [groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause All", "All toolbar item -> label"), NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]]; - NSSize groupSize = NSMakeSize(72.0, 25.0); - [groupItem setMinSize: groupSize]; - [groupItem setMaxSize: groupSize]; - [segmentedControl release]; return [groupItem autorelease]; } diff --git a/macosx/FileNameCell.m b/macosx/FileNameCell.m index 277009c51..b1b6ac616 100644 --- a/macosx/FileNameCell.m +++ b/macosx/FileNameCell.m @@ -47,6 +47,47 @@ @implementation FileNameCell +- (id) init +{ + if ((self = [super init])) + { + NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; + [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail]; + + fTitleAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: + [NSFont messageFontOfSize: 12.0], NSFontAttributeName, + paragraphStyle, NSParagraphStyleAttributeName, nil]; + + fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: + [NSFont messageFontOfSize: 9.0], NSFontAttributeName, + paragraphStyle, NSParagraphStyleAttributeName, nil]; + + [paragraphStyle release]; + } + return self; +} + +- (void) dealloc +{ + [fTitleAttributes release]; + [fStatusAttributes release]; + + [fFolderImage release]; + + [super dealloc]; +} + +- (id) copyWithZone: (NSZone *) zone +{ + FileNameCell * copy = [super copyWithZone: zone]; + + copy->fTitleAttributes = [fTitleAttributes retain]; + copy->fStatusAttributes = [fStatusAttributes retain]; + copy->fFolderImage = [fFolderImage retain]; + + return copy; +} + - (NSImage *) image { NSImage * image = [[self objectValue] objectForKey: @"Icon"]; @@ -159,18 +200,6 @@ - (NSAttributedString *) attributedTitleWithColor: (NSColor *) color { - if (!fTitleAttributes) - { - NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail]; - - fTitleAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: - [NSFont messageFontOfSize: 12.0], NSFontAttributeName, - paragraphStyle, NSParagraphStyleAttributeName, nil]; - - [paragraphStyle release]; - } - if (color) [fTitleAttributes setObject: color forKey: NSForegroundColorAttributeName]; @@ -180,18 +209,6 @@ - (NSAttributedString *) attributedStatusWithColor: (NSColor *) color { - if (!fStatusAttributes) - { - NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail]; - - fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: - [NSFont messageFontOfSize: 9.0], NSFontAttributeName, - paragraphStyle, NSParagraphStyleAttributeName, nil]; - - [paragraphStyle release]; - } - if (color) [fStatusAttributes setObject: color forKey: NSForegroundColorAttributeName]; diff --git a/macosx/PeerProgressIndicatorCell.h b/macosx/PeerProgressIndicatorCell.h index 30b5fbee1..e2f8ab0db 100644 --- a/macosx/PeerProgressIndicatorCell.h +++ b/macosx/PeerProgressIndicatorCell.h @@ -28,7 +28,6 @@ { BOOL fIsHidden; NSDictionary * fAttributes; - NSImage * fCheckImage; } @end diff --git a/macosx/PeerProgressIndicatorCell.m b/macosx/PeerProgressIndicatorCell.m index 7e439433f..c66b0f0e1 100644 --- a/macosx/PeerProgressIndicatorCell.m +++ b/macosx/PeerProgressIndicatorCell.m @@ -26,6 +26,20 @@ @implementation PeerProgressIndicatorCell +- (id) copyWithZone: (NSZone *) zone +{ + PeerProgressIndicatorCell * copy = [super copyWithZone: zone]; + copy->fAttributes = [fAttributes retain]; + + return copy; +} + +- (void) dealloc +{ + [fAttributes release]; + [super dealloc]; +} + - (BOOL) hidden { return fIsHidden; @@ -58,16 +72,13 @@ [super drawWithFrame: cellFrame inView: controlView]; if ([self floatValue] >= 1.0) { - if (!fCheckImage) - { - fCheckImage = [NSImage imageNamed: @"CompleteCheck.png"]; - [fCheckImage setFlipped: YES]; - } + NSImage * checkImage = [NSImage imageNamed: @"CompleteCheck.png"]; + [checkImage setFlipped: YES]; - NSSize imageSize = [fCheckImage size]; + NSSize imageSize = [checkImage size]; NSRect rect = NSMakeRect(cellFrame.origin.x + (cellFrame.size.width - imageSize.width) * 0.5, cellFrame.origin.y + (cellFrame.size.height - imageSize.height) * 0.5, imageSize.width, imageSize.height); - [fCheckImage drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; + [checkImage drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; } } }