Changeset 10981 for branches


Ignore:
Timestamp:
Jul 8, 2010, 10:01:43 PM (12 years ago)
Author:
livings124
Message:

(2.0x) adjust the code for determining the layout of text in the file table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0x/macosx/FileNameCell.m

    r10711 r10981  
    6464                            paragraphStyle, NSParagraphStyleAttributeName, nil];
    6565       
     66        NSMutableParagraphStyle * statusParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
     67        [statusParagraphStyle setLineBreakMode: NSLineBreakByTruncatingTail];
     68       
    6669        fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
    6770                                [NSFont messageFontOfSize: 9.0], NSFontAttributeName,
    68                                 paragraphStyle, NSParagraphStyleAttributeName, nil];
     71                                statusParagraphStyle, NSParagraphStyleAttributeName, nil];
    6972       
    7073        [paragraphStyle release];
     74        [statusParagraphStyle release];
    7175    }
    7276    return self;
     
    161165        result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_ICON_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
    162166        result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE_FILE;
     167        result.size.width = NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL;
    163168    }
    164169    else
     
    166171        result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_FOLDER_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
    167172        result.origin.y = NSMidY(bounds) - titleSize.height * 0.5;
     173        result.size.width = MIN(titleSize.width, NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL);
    168174    }
    169175    result.size.height = titleSize.height;
    170     result.size.width = MIN(titleSize.width, NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL);
    171176   
    172177    return result;
     
    180185    if (![(FileListNode *)[self objectValue] isFolder])
    181186    {
    182         result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_ICON_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
     187        result.origin.x = NSMinX(titleRect);
    183188        result.origin.y = NSMaxY(bounds) - PADDING_BELOW_STATUS_FILE - statusSize.height;
     189        result.size.width = NSWidth(titleRect);
    184190    }
    185191    else
     
    187193        result.origin.x = NSMaxX(titleRect) + PADDING_BETWEEN_NAME_AND_FOLDER_STATUS;
    188194        result.origin.y = NSMaxY(titleRect) - statusSize.height - 1.0;
    189     }
    190        
     195        result.size.width = NSMaxX(bounds) - NSMaxX(titleRect) - PADDING_HORIZONAL;
     196    }
    191197    result.size.height = statusSize.height;
    192     result.size.width = NSMaxX(bounds) - NSMaxX(result) - PADDING_HORIZONAL;
    193198   
    194199    return result;
     
    207212   
    208213    const CGFloat progress = [torrent fileProgress: node];
    209     NSString * percentString = progress == 1.0 ? @"100%"
    210                                 : [NSString localizedStringWithFormat: @"%.2f%%", tr_truncd(progress * 100.0, 2)];
     214    NSString * percentString = [NSString percentString: progress longDecimals: YES];
    211215   
    212216    NSString * status = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@",
Note: See TracChangeset for help on using the changeset viewer.