Changeset 9739


Ignore:
Timestamp:
Dec 13, 2009, 5:11:59 PM (12 years ago)
Author:
livings124
Message:

right-align the progress string in the peer inspector tab

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/PeerProgressIndicatorCell.m

    r7659 r9739  
    5151    {
    5252        if (!fAttributes)
    53             fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSFont systemFontOfSize: 11.0f], NSFontAttributeName, nil];
    54         [[NSString localizedStringWithFormat: @"%.1f%%", [self floatValue] * 100.0f] drawInRect: cellFrame withAttributes: fAttributes];
     53        {
     54            NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
     55            [paragraphStyle setAlignment: NSRightTextAlignment];
     56           
     57            fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSFont systemFontOfSize: 11.0], NSFontAttributeName,
     58                                                                            paragraphStyle, NSParagraphStyleAttributeName, nil];
     59            [paragraphStyle release];
     60        }
     61       
     62        [[NSString localizedStringWithFormat: @"%.1f%%", [self floatValue] * 100.0] drawInRect: cellFrame withAttributes: fAttributes];
    5563    }
    5664    else
     
    7078           
    7179            NSSize imageSize = [checkImage size];
    72             NSRect rect = NSMakeRect(cellFrame.origin.x + (cellFrame.size.width - imageSize.width) * 0.5f,
    73                         cellFrame.origin.y + (cellFrame.size.height - imageSize.height) * 0.5f, imageSize.width, imageSize.height);
    74             [checkImage drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f];
     80            NSRect rect = NSMakeRect(cellFrame.origin.x + (cellFrame.size.width - imageSize.width) * 0.5,
     81                        cellFrame.origin.y + (cellFrame.size.height - imageSize.height) * 0.5, imageSize.width, imageSize.height);
     82            [checkImage drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
    7583        }
    7684    }
Note: See TracChangeset for help on using the changeset viewer.