Changeset 10975


Ignore:
Timestamp:
Jul 8, 2010, 1:49:41 AM (12 years ago)
Author:
livings124
Message:

adjust the code for determining the layout of text in the file table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileNameCell.m

    r10950 r10975  
    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];
     
    161164        result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_ICON_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
    162165        result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE_FILE;
     166        result.size.width = NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL;
    163167    }
    164168    else
     
    166170        result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_FOLDER_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
    167171        result.origin.y = NSMidY(bounds) - titleSize.height * 0.5;
     172        result.size.width = MIN(titleSize.width, NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL);
    168173    }
    169174    result.size.height = titleSize.height;
    170     result.size.width = MIN(titleSize.width, NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL);
    171175   
    172176    return result;
     
    180184    if (![(FileListNode *)[self objectValue] isFolder])
    181185    {
    182         result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_ICON_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
     186        result.origin.x = NSMinX(titleRect);
    183187        result.origin.y = NSMaxY(bounds) - PADDING_BELOW_STATUS_FILE - statusSize.height;
     188        result.size.width = NSWidth(titleRect);
    184189    }
    185190    else
     
    187192        result.origin.x = NSMaxX(titleRect) + PADDING_BETWEEN_NAME_AND_FOLDER_STATUS;
    188193        result.origin.y = NSMaxY(titleRect) - statusSize.height - 1.0;
    189     }
    190        
     194        result.size.width = NSMaxX(bounds) - NSMaxX(titleRect) - PADDING_HORIZONAL;
     195    }
    191196    result.size.height = statusSize.height;
    192     result.size.width = NSMaxX(bounds) - NSMaxX(result) - PADDING_HORIZONAL;
    193197   
    194198    return result;
Note: See TracChangeset for help on using the changeset viewer.