1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 03:12:44 +00:00

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

This commit is contained in:
Mitchell Livingston 2012-09-27 00:16:21 +00:00
parent 7a3f6e6010
commit d3e57ff7f8

View file

@ -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];
}