mirror of
https://github.com/transmission/transmission
synced 2025-02-26 07:52:38 +00:00
fix a bug with the auto-resizing localization code in InfoGeneralViewController
This commit is contained in:
parent
7a3f6e6010
commit
d3e57ff7f8
1 changed files with 6 additions and 8 deletions
|
@ -59,15 +59,14 @@
|
||||||
|
|
||||||
NSArray * labels = @[ fPiecesLabel, fHashLabel, fSecureLabel, fCreatorLabel, fDateCreatedLabel, fCommentLabel, fDataLocationLabel ];
|
NSArray * labels = @[ fPiecesLabel, fHashLabel, fSecureLabel, fCreatorLabel, fDateCreatedLabel, fCommentLabel, fDataLocationLabel ];
|
||||||
|
|
||||||
CGFloat oldMaxWidth = 0.0, newMaxWidth = 0.0;
|
CGFloat oldMaxWidth = 0.0, originX, newMaxWidth = 0.0;
|
||||||
NSTextField * oldLongestLabel = nil;
|
|
||||||
for (NSTextField * label in labels)
|
for (NSTextField * label in labels)
|
||||||
{
|
{
|
||||||
const CGFloat oldWidth = [label bounds].size.width;
|
const CGRect oldFrame = [label frame];
|
||||||
if (oldWidth > oldMaxWidth)
|
if (oldFrame.size.width > oldMaxWidth)
|
||||||
{
|
{
|
||||||
oldMaxWidth = oldWidth;
|
oldMaxWidth = oldFrame.size.width;
|
||||||
oldLongestLabel = label;
|
originX = oldFrame.origin.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
[label sizeToFit];
|
[label sizeToFit];
|
||||||
|
@ -79,8 +78,7 @@
|
||||||
for (NSTextField * label in labels)
|
for (NSTextField * label in labels)
|
||||||
{
|
{
|
||||||
NSRect frame = [label frame];
|
NSRect frame = [label frame];
|
||||||
frame.origin.x = [oldLongestLabel frame].origin.x;
|
frame.origin.x = originX + (newMaxWidth - frame.size.width);
|
||||||
frame.origin.x += newMaxWidth - frame.size.width;
|
|
||||||
[label setFrame: frame];
|
[label setFrame: frame];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue