fix sizing of group labels with long file names

This commit is contained in:
Mitchell Livingston 2007-12-17 22:30:28 +00:00
parent ba145ebced
commit 02e52bb013
2 changed files with 14 additions and 11 deletions

View File

@ -2048,14 +2048,16 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
- (void) menuNeedsUpdate: (NSMenu *) menu
{
#warning if not group menu, return
int i, keep = (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu ) ? 2 : 0;
for (i = [menu numberOfItems]-1 - keep; i >= 0; i--)
[menu removeItemAtIndex: i];
NSMenu * groupMenu = [[GroupsWindowController groupsController] groupMenuWithTarget: self action: @selector(setGroup:)];
[menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [groupMenu numberOfItems])]
atBottom: NO];
if (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu)
{
int i, keep = (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu) ? 2 : 0;
for (i = [menu numberOfItems]-1 - keep; i >= 0; i--)
[menu removeItemAtIndex: i];
NSMenu * groupMenu = [[GroupsWindowController groupsController] groupMenuWithTarget: self action: @selector(setGroup:)];
[menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange:
NSMakeRange(0, [groupMenu numberOfItems])] atBottom: NO];
}
}
- (void) setGroup: (id) sender

View File

@ -51,8 +51,8 @@
#define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0
#define PADDING_BETWEEN_BAR_AND_STATUS 2.0
#define GROUP_BORDER_X -4.0
#define GROUP_BORDER_Y -1.0
#define GROUP_BORDER_X 4.0
#define GROUP_BORDER_Y 1.0
#define MAX_PIECES 324
#define BLANK_PIECE -99
@ -253,7 +253,7 @@
if (groupIndex != -1)
[[[GroupsWindowController groupsController] gradientForIndex: [torrent groupValue]] fillBezierPath:
[NSBezierPath bezierPathWithRoundedRect: NSInsetRect(titleRect, GROUP_BORDER_X, GROUP_BORDER_Y) radius: 7.0] angle: 90];
[NSBezierPath bezierPathWithRoundedRect: NSInsetRect(titleRect, -GROUP_BORDER_X, -GROUP_BORDER_Y) radius: 7.0] angle: 90];
[titleString drawInRect: titleRect];
@ -560,6 +560,7 @@
result.size = [string size];
result.size.width = MIN(result.size.width, NSMaxX(bounds) - result.origin.x - PADDING_HORIZONAL
- ([[self representedObject] groupValue] != -1 ? GROUP_BORDER_X : 0)
- (minimal ? PADDING_BETWEEN_TITLE_AND_MIN_STATUS + statusRect.size.width : 0));
return result;