mirror of
https://github.com/transmission/transmission
synced 2025-01-03 05:25:52 +00:00
adjust the code for determining the layout of text in the file table
This commit is contained in:
parent
5d54074d26
commit
7f85325487
1 changed files with 9 additions and 5 deletions
|
@ -63,9 +63,12 @@
|
||||||
[NSFont messageFontOfSize: 12.0], NSFontAttributeName,
|
[NSFont messageFontOfSize: 12.0], NSFontAttributeName,
|
||||||
paragraphStyle, NSParagraphStyleAttributeName, nil];
|
paragraphStyle, NSParagraphStyleAttributeName, nil];
|
||||||
|
|
||||||
|
NSMutableParagraphStyle * statusParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||||
|
[statusParagraphStyle setLineBreakMode: NSLineBreakByTruncatingTail];
|
||||||
|
|
||||||
fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
|
fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
|
||||||
[NSFont messageFontOfSize: 9.0], NSFontAttributeName,
|
[NSFont messageFontOfSize: 9.0], NSFontAttributeName,
|
||||||
paragraphStyle, NSParagraphStyleAttributeName, nil];
|
statusParagraphStyle, NSParagraphStyleAttributeName, nil];
|
||||||
|
|
||||||
[paragraphStyle release];
|
[paragraphStyle release];
|
||||||
}
|
}
|
||||||
|
@ -160,14 +163,15 @@
|
||||||
{
|
{
|
||||||
result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_ICON_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
|
result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_ICON_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
|
||||||
result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE_FILE;
|
result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE_FILE;
|
||||||
|
result.size.width = NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_FOLDER_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
|
result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_FOLDER_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
|
||||||
result.origin.y = NSMidY(bounds) - titleSize.height * 0.5;
|
result.origin.y = NSMidY(bounds) - titleSize.height * 0.5;
|
||||||
|
result.size.width = MIN(titleSize.width, NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL);
|
||||||
}
|
}
|
||||||
result.size.height = titleSize.height;
|
result.size.height = titleSize.height;
|
||||||
result.size.width = MIN(titleSize.width, NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONAL);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -179,17 +183,17 @@
|
||||||
NSRect result;
|
NSRect result;
|
||||||
if (![(FileListNode *)[self objectValue] isFolder])
|
if (![(FileListNode *)[self objectValue] isFolder])
|
||||||
{
|
{
|
||||||
result.origin.x = NSMinX(bounds) + PADDING_HORIZONAL + IMAGE_ICON_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
|
result.origin.x = NSMinX(titleRect);
|
||||||
result.origin.y = NSMaxY(bounds) - PADDING_BELOW_STATUS_FILE - statusSize.height;
|
result.origin.y = NSMaxY(bounds) - PADDING_BELOW_STATUS_FILE - statusSize.height;
|
||||||
|
result.size.width = NSWidth(titleRect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.origin.x = NSMaxX(titleRect) + PADDING_BETWEEN_NAME_AND_FOLDER_STATUS;
|
result.origin.x = NSMaxX(titleRect) + PADDING_BETWEEN_NAME_AND_FOLDER_STATUS;
|
||||||
result.origin.y = NSMaxY(titleRect) - statusSize.height - 1.0;
|
result.origin.y = NSMaxY(titleRect) - statusSize.height - 1.0;
|
||||||
|
result.size.width = NSMaxX(bounds) - NSMaxX(titleRect) - PADDING_HORIZONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.size.height = statusSize.height;
|
result.size.height = statusSize.height;
|
||||||
result.size.width = NSMaxX(bounds) - NSMaxX(result) - PADDING_HORIZONAL;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue