Changeset 9701


Ignore:
Timestamp:
Dec 10, 2009, 5:16:30 AM (12 years ago)
Author:
livings124
Message:

calculate the message attributes when opening the window, to avoid constant checking for nil

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/MessageWindowController.m

    r9699 r9701  
    111111    [fClearButton setFrame: clearButtonFrame];
    112112   
     113    fAttributes = [[[[[fMessageTable tableColumnWithIdentifier: @"Message"] dataCell] attributedStringValue]
     114                    attributesAtIndex: 0 effectiveRange: NULL] retain];
     115   
    113116    //select proper level in popup button
    114117    switch ([[NSUserDefaults standardUserDefaults] integerForKey: @"MessageLevel"])
     
    251254- (CGFloat) tableView: (NSTableView *) tableView heightOfRow: (NSInteger) row
    252255{
     256    NSString * message = [[fDisplayedMessages objectAtIndex: row] objectForKey: @"Message"];
     257   
    253258    NSTableColumn * column = [tableView tableColumnWithIdentifier: @"Message"];
    254    
    255     if (!fAttributes)
    256         fAttributes = [[[[column dataCell] attributedStringValue] attributesAtIndex: 0 effectiveRange: NULL] retain];
    257    
    258     NSString * message = [[fDisplayedMessages objectAtIndex: row] objectForKey: @"Message"];
    259259    const CGFloat count = floorf([message sizeWithAttributes: fAttributes].width / [column width]);
    260260    return [tableView rowHeight] * (count + 1.0);
Note: See TracChangeset for help on using the changeset viewer.