]> granicus.if.org Git - transmission/commitdiff
fix a bug with the auto-resizing localization code in InfoGeneralViewController
authorMitchell Livingston <livings124@transmissionbt.com>
Thu, 27 Sep 2012 00:16:21 +0000 (00:16 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Thu, 27 Sep 2012 00:16:21 +0000 (00:16 +0000)
macosx/InfoGeneralViewController.m

index 6330c47a42feaa30b0d9fdd22a93d739b375c4b1..b76f02505e83d05ab74923b8f4ad7dfb8c42f3f5 100644 (file)
     
     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];
     }