experiment with moving the label from over the text to the left edge

This commit is contained in:
Mitchell Livingston
2007-12-18 01:44:37 +00:00
parent 02e52bb013
commit baa143b9b1
3 changed files with 29 additions and 18 deletions

View File

@@ -33,7 +33,7 @@
IBOutlet NSTableView * fTableView; IBOutlet NSTableView * fTableView;
IBOutlet NSSegmentedControl * fAddRemoveControl; IBOutlet NSSegmentedControl * fAddRemoveControl;
NSMutableDictionary * fCurrentColorDict, * fGroupGradients; NSMutableDictionary * fCurrentColorDict;
} }
+ (GroupsWindowController *) groupsController; + (GroupsWindowController *) groupsController;

View File

@@ -374,8 +374,8 @@ GroupsWindowController * fGroupsWindowInstance = nil;
- (CTGradient *) gradientForColor: (NSColor *) color - (CTGradient *) gradientForColor: (NSColor *) color
{ {
return [CTGradient gradientWithBeginningColor: [color blendedColorWithFraction: 0.7 ofColor: [NSColor whiteColor]] return [CTGradient gradientWithBeginningColor: [color blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]]
endingColor: [color blendedColorWithFraction: 0.4 ofColor: [NSColor whiteColor]]]; endingColor: [color blendedColorWithFraction: 0.7 ofColor: [NSColor whiteColor]]];
} }
- (void) changeColor: (id) sender - (void) changeColor: (id) sender

View File

@@ -51,9 +51,6 @@
#define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0 #define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0
#define PADDING_BETWEEN_BAR_AND_STATUS 2.0 #define PADDING_BETWEEN_BAR_AND_STATUS 2.0
#define GROUP_BORDER_X 4.0
#define GROUP_BORDER_Y 1.0
#define MAX_PIECES 324 #define MAX_PIECES 324
#define BLANK_PIECE -99 #define BLANK_PIECE -99
@@ -199,14 +196,26 @@
return NSCellHitContentArea; return NSCellHitContentArea;
} }
- (void) drawInteriorWithFrame: (NSRect) cellFrame inView: (NSView *) controlView - (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
{ {
[super drawInteriorWithFrame: cellFrame inView: controlView]; [super drawWithFrame: cellFrame inView: controlView];
Torrent * torrent = [self representedObject]; Torrent * torrent = [self representedObject];
BOOL minimal = [fDefaults boolForKey: @"SmallView"]; BOOL minimal = [fDefaults boolForKey: @"SmallView"];
int groupValue = [torrent groupValue];
if (groupValue != -1)
{
NSRect groupRect = cellFrame;
groupRect.size.width = 38.0;
groupRect.origin.x -= 1.0;
groupRect.size.height += 1.0;
groupRect.origin.y -= 1.0;
[[[GroupsWindowController groupsController] gradientForIndex: groupValue] fillRect: groupRect angle: 270];
}
//error image //error image
BOOL error = [torrent isError]; BOOL error = [torrent isError];
if (error && !fErrorImage) if (error && !fErrorImage)
@@ -228,12 +237,20 @@
} }
//text color //text color
NSColor * titleColor, * statusColor;
BOOL selected = [NSApp isOnLeopardOrBetter] ? [self backgroundStyle] == NSBackgroundStyleDark : [self isHighlighted] BOOL selected = [NSApp isOnLeopardOrBetter] ? [self backgroundStyle] == NSBackgroundStyleDark : [self isHighlighted]
&& [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]]; && [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]];
int groupIndex = [torrent groupValue]; if ([NSApp isOnLeopardOrBetter] ? [self backgroundStyle] == NSBackgroundStyleDark : [self isHighlighted]
&& [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]])
NSColor * titleColor = selected && groupIndex == -1 ? [NSColor whiteColor] : [NSColor controlTextColor], {
* statusColor = selected ? [NSColor whiteColor] : [NSColor darkGrayColor]; titleColor = [NSColor whiteColor];
statusColor = [NSColor whiteColor];
}
else
{
titleColor = [NSColor controlTextColor];
statusColor = [NSColor darkGrayColor];
}
//minimal status //minimal status
NSRect minimalStatusRect; NSRect minimalStatusRect;
@@ -250,11 +267,6 @@
//title //title
NSAttributedString * titleString = [self attributedTitleWithColor: titleColor]; NSAttributedString * titleString = [self attributedTitleWithColor: titleColor];
NSRect titleRect = [self rectForTitleWithString: titleString basedOnMinimalStatusRect: minimalStatusRect inBounds: cellFrame]; NSRect titleRect = [self rectForTitleWithString: titleString basedOnMinimalStatusRect: minimalStatusRect inBounds: cellFrame];
if (groupIndex != -1)
[[[GroupsWindowController groupsController] gradientForIndex: [torrent groupValue]] fillBezierPath:
[NSBezierPath bezierPathWithRoundedRect: NSInsetRect(titleRect, -GROUP_BORDER_X, -GROUP_BORDER_Y) radius: 7.0] angle: 90];
[titleString drawInRect: titleRect]; [titleString drawInRect: titleRect];
//progress //progress
@@ -560,7 +572,6 @@
result.size = [string size]; result.size = [string size];
result.size.width = MIN(result.size.width, NSMaxX(bounds) - result.origin.x - PADDING_HORIZONAL 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)); - (minimal ? PADDING_BETWEEN_TITLE_AND_MIN_STATUS + statusRect.size.width : 0));
return result; return result;