From: Mitchell Livingston Date: Thu, 27 Sep 2012 00:16:21 +0000 (+0000) Subject: fix a bug with the auto-resizing localization code in InfoGeneralViewController X-Git-Tag: 2.72~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3e57ff7f89ed1d73f5609422955a4d7fc2e5291;p=transmission fix a bug with the auto-resizing localization code in InfoGeneralViewController --- diff --git a/macosx/InfoGeneralViewController.m b/macosx/InfoGeneralViewController.m index 6330c47a4..b76f02505 100644 --- a/macosx/InfoGeneralViewController.m +++ b/macosx/InfoGeneralViewController.m @@ -59,15 +59,14 @@ NSArray * labels = @[ fPiecesLabel, fHashLabel, fSecureLabel, fCreatorLabel, fDateCreatedLabel, fCommentLabel, fDataLocationLabel ]; - CGFloat oldMaxWidth = 0.0, newMaxWidth = 0.0; - NSTextField * oldLongestLabel = nil; + CGFloat oldMaxWidth = 0.0, originX, newMaxWidth = 0.0; for (NSTextField * label in labels) { - const CGFloat oldWidth = [label bounds].size.width; - if (oldWidth > oldMaxWidth) + const CGRect oldFrame = [label frame]; + if (oldFrame.size.width > oldMaxWidth) { - oldMaxWidth = oldWidth; - oldLongestLabel = label; + oldMaxWidth = oldFrame.size.width; + originX = oldFrame.origin.x; } [label sizeToFit]; @@ -79,8 +78,7 @@ for (NSTextField * label in labels) { NSRect frame = [label frame]; - frame.origin.x = [oldLongestLabel frame].origin.x; - frame.origin.x += newMaxWidth - frame.size.width; + frame.origin.x = originX + (newMaxWidth - frame.size.width); [label setFrame: frame]; }