Changeset 1400


Ignore:
Timestamp:
Jan 18, 2007, 10:53:27 PM (15 years ago)
Author:
livings124
Message:

pass object instead of creating string

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileBrowserCell.m

    r1399 r1400  
    11#import "FileBrowserCell.h"
     2#import "StringAdditions.h"
    23
    34#define SPACE 2.0
     
    3132   
    3233    //text
    33     NSArray * strings = [[self stringValue] componentsSeparatedByString: @"\n"];
     34    NSMutableDictionary * item = [self objectValue];
    3435   
    3536    NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
     
    4748                                    NSMaxX(cellFrame) - NSMaxX(imageRect) - 2.0 * SPACE, textHeight);
    4849   
    49     NSAttributedString * text = [[NSAttributedString alloc] initWithString: [strings objectAtIndex: 0]
     50    NSAttributedString * text = [[NSAttributedString alloc] initWithString: [item objectForKey: @"Name"]
    5051                                                                attributes: nameAttributes];
    5152    [text drawInRect: textRect];
     
    5354   
    5455    //bottomText
    55     if ([strings count] > 1)
     56    if (![[item objectForKey: @"IsFolder"] boolValue])
    5657    {
    5758        NSDictionary * statusAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
     
    6465        bottomTextRect.size.height = cellFrame.size.height - textHeight;
    6566       
    66         NSMutableAttributedString * bottomText = [[NSMutableAttributedString alloc] initWithString: [strings objectAtIndex: 1]
    67                                                                                         attributes: statusAttributes];
     67        NSMutableAttributedString * bottomText = [[NSMutableAttributedString alloc] initWithString:
     68                                [NSString stringForFileSize: [[item objectForKey: @"Size"] unsignedLongLongValue]]
     69                                attributes: statusAttributes];
    6870       
    6971        [bottomText drawInRect: bottomTextRect];
  • trunk/macosx/InfoWindowController.m

    r1399 r1400  
    682682        return [item objectForKey: @"Check"];
    683683    else
    684     {
    685         if ([[item objectForKey: @"IsFolder"] boolValue])
    686             return [item objectForKey: @"Name"];
    687         else
    688             return [NSString stringWithFormat: @"%@\n%@", [item objectForKey: @"Name"],
    689                         [NSString stringForFileSize: [[item objectForKey: @"Size"] unsignedLongLongValue]]];
    690     }
     684        return item;
    691685}
    692686
Note: See TracChangeset for help on using the changeset viewer.