Changeset 9832


Ignore:
Timestamp:
Dec 28, 2009, 8:05:33 PM (12 years ago)
Author:
livings124
Message:

might as well dump a bunch of small changes/optimizations I have sitting locally

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/ExpandedPathToIconTransformer.m

    r9009 r9832  
    4545    NSImage * icon;
    4646    //show a folder icon if the folder doesn't exist
    47     if (![[NSFileManager defaultManager] fileExistsAtPath: path] && [[path pathExtension] isEqualToString: @""])
     47    if ([[path pathExtension] isEqualToString: @""] && ![[NSFileManager defaultManager] fileExistsAtPath: path])
    4848        icon = [[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode('fldr')];
    4949    else
    50         icon = [[NSWorkspace sharedWorkspace] iconForFile: [value stringByExpandingTildeInPath]];
     50        icon = [[NSWorkspace sharedWorkspace] iconForFile: path];
    5151   
    5252    [icon setSize: NSMakeSize(16.0, 16.0)];
  • trunk/macosx/InfoTextField.m

    r9801 r9832  
    3434}
    3535
    36 - (void)setObjectValue: (id < NSCopying >) object
     36- (void) setObjectValue: (id <NSCopying>) object
    3737{
    3838    [super setObjectValue: object];
  • trunk/macosx/PortChecker.m

    r9493 r9832  
    2626
    2727#define CHECKER_URL(port) [NSString stringWithFormat: @"http://portcheck.transmissionbt.com/%d", port]
    28 #define CHECK_FIRE  3.0
     28#define CHECK_FIRE 3.0
    2929
    3030@interface PortChecker (Private)
  • trunk/macosx/TorrentTableView.m

    r9812 r9832  
    914914        NSMenuItem * item = [[NSMenuItem alloc] initWithTitle: name action: @selector(checkFile:) keyEquivalent: @""];
    915915       
    916         NSImage * icon;
    917         if (![node isFolder])
    918             icon = [node icon];
    919         else
     916        if ([node isFolder])
    920917        {
    921918            NSMenu * itemMenu = [[NSMenu alloc] initWithTitle: name];
     
    924921            [itemMenu setDelegate: self];
    925922            [itemMenu release];
    926            
    927             icon = [[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode('fldr')];
    928923        }
    929924       
    930925        [item setRepresentedObject: node];
    931926       
     927        NSImage * icon = [node icon];
    932928        [icon setSize: NSMakeSize(16.0, 16.0)];
    933929        [item setImage: icon];
  • trunk/macosx/TrackerCell.m

    r9746 r9832  
    241241- (NSRect) imageRectForBounds: (NSRect) bounds
    242242{
    243     NSRect result = bounds;
    244     result.origin.x += PADDING_HORIZONAL;
    245     result.origin.y += PADDING_ABOVE_ICON;
    246     result.size = NSMakeSize(ICON_SIZE, ICON_SIZE);
    247    
    248     return result;
     243    return NSMakeRect(NSMinX(bounds) + PADDING_HORIZONAL, NSMinY(bounds) + PADDING_ABOVE_ICON, ICON_SIZE, ICON_SIZE);
    249244}
    250245
    251246- (NSRect) rectForNameWithString: (NSAttributedString *) string inBounds: (NSRect) bounds
    252247{
    253     const NSSize nameSize = [string size];
    254    
    255     NSRect result = bounds;
    256     result.origin.x += PADDING_HORIZONAL + ICON_SIZE + PADDING_BETWEEN_ICON_AND_NAME;
    257     result.origin.y += PADDING_ABOVE_NAME;
     248    NSRect result;
     249    result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + ICON_SIZE + PADDING_BETWEEN_ICON_AND_NAME;
     250    result.origin.y = NSMinY(bounds) + PADDING_ABOVE_NAME;
    258251       
    259     result.size = nameSize;
    260     result.size.width = MIN(result.size.width, NSMaxX(bounds) - NSMinX(result));
     252    result.size.height = [string size].height;
     253    result.size.width = NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL;
    261254   
    262255    return result;
     
    274267    NSRect result = rightRect;
    275268    result.size.width = [string size].width;
    276     result.origin.x -= result.size.width;
     269    result.origin.x -= NSWidth(result);
    277270   
    278271    return result;
     
    282275            inBounds: (NSRect) bounds
    283276{
    284     const NSSize statusSize = [string size];
    285    
    286     NSRect result = bounds;
    287     result.origin.x += PADDING_STATUS_HORIZONAL;
     277    NSRect result;
     278    result.origin.x = NSMinX(bounds) + PADDING_STATUS_HORIZONAL;
    288279    result.origin.y = NSMaxY(aboveRect) + PADDING_BETWEEN_LINES;
    289280   
    290     result.size = statusSize;
    291     result.size.width = MIN(result.size.width, (NSMinX(rightRect) - PADDING_BETWEEN_LINES_ON_SAME_LINE) - NSMinX(result));
     281    result.size.height = [string size].height;
     282    result.size.width = NSMinX(rightRect) - PADDING_BETWEEN_LINES_ON_SAME_LINE - NSMinX(result);
    292283   
    293284    return result;
Note: See TracChangeset for help on using the changeset viewer.