From d3e57ff7f89ed1d73f5609422955a4d7fc2e5291 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 27 Sep 2012 00:16:21 +0000 Subject: [PATCH] fix a bug with the auto-resizing localization code in InfoGeneralViewController --- macosx/InfoGeneralViewController.m | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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]; }