Changeset 13540


Ignore:
Timestamp:
Sep 27, 2012, 12:16:21 AM (10 years ago)
Author:
livings124
Message:

fix a bug with the auto-resizing localization code in InfoGeneralViewController?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoGeneralViewController.m

    r13539 r13540  
    6060    NSArray * labels = @[ fPiecesLabel, fHashLabel, fSecureLabel, fCreatorLabel, fDateCreatedLabel, fCommentLabel, fDataLocationLabel ];
    6161   
    62     CGFloat oldMaxWidth = 0.0, newMaxWidth = 0.0;
    63     NSTextField * oldLongestLabel = nil;
     62    CGFloat oldMaxWidth = 0.0, originX, newMaxWidth = 0.0;
    6463    for (NSTextField * label in labels)
    6564    {
    66         const CGFloat oldWidth = [label bounds].size.width;
    67         if (oldWidth > oldMaxWidth)
     65        const CGRect oldFrame = [label frame];
     66        if (oldFrame.size.width > oldMaxWidth)
    6867        {
    69             oldMaxWidth = oldWidth;
    70             oldLongestLabel = label;
     68            oldMaxWidth = oldFrame.size.width;
     69            originX = oldFrame.origin.x;
    7170        }
    7271       
     
    8079    {
    8180        NSRect frame = [label frame];
    82         frame.origin.x = [oldLongestLabel frame].origin.x;
    83         frame.origin.x += newMaxWidth - frame.size.width;
     81        frame.origin.x = originX + (newMaxWidth - frame.size.width);
    8482        [label setFrame: frame];
    8583    }
Note: See TracChangeset for help on using the changeset viewer.