first attempt at a single-row, more compact Compact (Minimal) View
This commit is contained in:
parent
b16620930a
commit
34bd2914db
|
@ -131,7 +131,7 @@ typedef enum
|
|||
#define TORRENT_TABLE_VIEW_DATA_TYPE @"TorrentTableViewDataType"
|
||||
|
||||
#define ROW_HEIGHT_REGULAR 62.0
|
||||
#define ROW_HEIGHT_SMALL 38.0
|
||||
#define ROW_HEIGHT_SMALL 22.0
|
||||
#define WINDOW_REGULAR_WIDTH 468.0
|
||||
|
||||
#define SEARCH_FILTER_MIN_WIDTH 48.0
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
@interface ProgressGradients : NSObject
|
||||
|
||||
+ (NSGradient *) progressGradientForRed: (CGFloat) redComponent green: (CGFloat) greenComponent blue: (CGFloat) blueComponent;
|
||||
|
||||
+ (NSGradient *) progressWhiteGradient;
|
||||
+ (NSGradient *) progressGrayGradient;
|
||||
+ (NSGradient *) progressLightGrayGradient;
|
||||
|
|
|
@ -24,101 +24,77 @@
|
|||
|
||||
#import "ProgressGradients.h"
|
||||
|
||||
@implementation ProgressGradients
|
||||
@implementation ProgressGradients (Private)
|
||||
|
||||
+ (NSGradient *) progressGradientForRed: (CGFloat) redComponent green: (CGFloat) greenComponent blue: (CGFloat) blueComponent
|
||||
{
|
||||
NSColor * baseColor = [NSColor colorWithCalibratedRed: redComponent green: greenComponent blue: blueComponent alpha: 1.0];
|
||||
const CGFloat alpha = [[NSUserDefaults standardUserDefaults] boolForKey: @"SmallView"] ? 0.075 : 1.0;
|
||||
|
||||
NSColor * baseColor = [NSColor colorWithCalibratedRed: redComponent green: greenComponent blue: blueComponent alpha: alpha];
|
||||
|
||||
NSColor * color2 = [NSColor colorWithCalibratedRed: redComponent * 0.95 green: greenComponent * 0.95 blue: blueComponent * 0.95
|
||||
alpha: 1.0];
|
||||
alpha: alpha];
|
||||
|
||||
NSColor * color3 = [NSColor colorWithCalibratedRed: redComponent * 0.85 green: greenComponent * 0.85 blue: blueComponent * 0.85
|
||||
alpha: 1.0];
|
||||
alpha: alpha];
|
||||
|
||||
NSGradient * progressGradient = [[NSGradient alloc] initWithColorsAndLocations: baseColor, 0.0, color2, 0.5, color3, 0.5,
|
||||
baseColor, 1.0, nil];
|
||||
return [progressGradient autorelease];
|
||||
}
|
||||
|
||||
NSGradient * fProgressWhiteGradient = nil;
|
||||
@end
|
||||
|
||||
@implementation ProgressGradients
|
||||
|
||||
+ (NSGradient *) progressWhiteGradient
|
||||
{
|
||||
if (!fProgressWhiteGradient)
|
||||
fProgressWhiteGradient = [[[self class] progressGradientForRed: 0.95 green: 0.95 blue: 0.95] retain];
|
||||
return fProgressWhiteGradient;
|
||||
return [[self class] progressGradientForRed: 0.95 green: 0.95 blue: 0.95];
|
||||
}
|
||||
|
||||
NSGradient * fProgressGrayGradient = nil;
|
||||
+ (NSGradient *) progressGrayGradient
|
||||
{
|
||||
if (!fProgressGrayGradient)
|
||||
fProgressGrayGradient = [[[self class] progressGradientForRed: 0.7 green: 0.7 blue: 0.7] retain];
|
||||
return fProgressGrayGradient;
|
||||
return [[self class] progressGradientForRed: 0.7 green: 0.7 blue: 0.7];
|
||||
}
|
||||
|
||||
NSGradient * fProgressLightGrayGradient = nil;
|
||||
+ (NSGradient *) progressLightGrayGradient
|
||||
{
|
||||
if (!fProgressLightGrayGradient)
|
||||
fProgressLightGrayGradient = [[[self class] progressGradientForRed: 0.87 green: 0.87 blue: 0.87] retain];
|
||||
return fProgressLightGrayGradient;
|
||||
return [[self class] progressGradientForRed: 0.87 green: 0.87 blue: 0.87];
|
||||
}
|
||||
|
||||
NSGradient * fProgressBlueGradient = nil;
|
||||
+ (NSGradient *) progressBlueGradient
|
||||
{
|
||||
if (!fProgressBlueGradient)
|
||||
fProgressBlueGradient = [[[self class] progressGradientForRed: 0.35 green: 0.67 blue: 0.98] retain];
|
||||
return fProgressBlueGradient;
|
||||
return [[self class] progressGradientForRed: 0.35 green: 0.67 blue: 0.98];
|
||||
}
|
||||
|
||||
NSGradient * fProgressDarkBlueGradient = nil;
|
||||
+ (NSGradient *) progressDarkBlueGradient
|
||||
{
|
||||
if (!fProgressDarkBlueGradient)
|
||||
fProgressDarkBlueGradient = [[[self class] progressGradientForRed: 0.616 green: 0.722 blue: 0.776] retain];
|
||||
return fProgressDarkBlueGradient;
|
||||
return [[self class] progressGradientForRed: 0.616 green: 0.722 blue: 0.776];
|
||||
}
|
||||
|
||||
NSGradient * fProgressGreenGradient = nil;
|
||||
+ (NSGradient *) progressGreenGradient
|
||||
{
|
||||
if (!fProgressGreenGradient)
|
||||
fProgressGreenGradient = [[[self class] progressGradientForRed: 0.44 green: 0.89 blue: 0.40] retain];
|
||||
return fProgressGreenGradient;
|
||||
return [[self class] progressGradientForRed: 0.44 green: 0.89 blue: 0.40];
|
||||
}
|
||||
|
||||
NSGradient * fProgressLightGreenGradient = nil;
|
||||
+ (NSGradient *) progressLightGreenGradient
|
||||
{
|
||||
if (!fProgressLightGreenGradient)
|
||||
fProgressLightGreenGradient = [[[self class] progressGradientForRed: 0.62 green: 0.99 blue: 0.58] retain];
|
||||
return fProgressLightGreenGradient;
|
||||
return [[self class] progressGradientForRed: 0.62 green: 0.99 blue: 0.58];
|
||||
}
|
||||
|
||||
NSGradient * fProgressDarkGreenGradient = nil;
|
||||
+ (NSGradient *) progressDarkGreenGradient
|
||||
{
|
||||
if (!fProgressDarkGreenGradient)
|
||||
fProgressDarkGreenGradient = [[[self class] progressGradientForRed: 0.627 green: 0.714 blue: 0.639] retain];
|
||||
return fProgressDarkGreenGradient;
|
||||
return [[self class] progressGradientForRed: 0.627 green: 0.714 blue: 0.639];
|
||||
}
|
||||
|
||||
NSGradient * fProgressRedGradient = nil;
|
||||
+ (NSGradient *) progressRedGradient
|
||||
{
|
||||
if (!fProgressRedGradient)
|
||||
fProgressRedGradient = [[[self class] progressGradientForRed: 0.902 green: 0.439 blue: 0.451] retain];
|
||||
return fProgressRedGradient;
|
||||
return [[self class] progressGradientForRed: 0.902 green: 0.439 blue: 0.451];
|
||||
}
|
||||
|
||||
NSGradient * fProgressYellowGradient = nil;
|
||||
+ (NSGradient *) progressYellowGradient
|
||||
{
|
||||
if (!fProgressYellowGradient)
|
||||
fProgressYellowGradient = [[[self class] progressGradientForRed: 0.933 green: 0.890 blue: 0.243] retain];
|
||||
return fProgressYellowGradient;
|
||||
return [[self class] progressGradientForRed: 0.933 green: 0.890 blue: 0.243];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
NSMutableDictionary * fTitleAttributes, * fStatusAttributes;
|
||||
|
||||
BOOL fTracking, fMouseDownControlButton, fMouseDownRevealButton, fMouseDownActionButton,
|
||||
fHoverControl, fHoverReveal, fHoverAction;
|
||||
fHover, fHoverControl, fHoverReveal, fHoverAction;
|
||||
|
||||
NSColor * fBarBorderColor, * fBluePieceColor;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
|||
|
||||
- (void) addTrackingAreasForView: (NSView *) controlView inRect: (NSRect) cellFrame withUserInfo: (NSDictionary *) userInfo
|
||||
mouseLocation: (NSPoint) mouseLocation;
|
||||
- (void) setHover: (BOOL) hover;
|
||||
- (void) setControlHover: (BOOL) hover;
|
||||
- (void) setRevealHover: (BOOL) hover;
|
||||
- (void) setActionHover: (BOOL) hover;
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
[paragraphStyle release];
|
||||
|
||||
fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];
|
||||
fBarBorderColor = [[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.2] retain];
|
||||
fBarBorderColor = [[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.2 * 0.075] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@
|
|||
const NSRect revealRect = [self revealButtonRectForBounds: cellFrame];
|
||||
const BOOL checkReveal = NSMouseInRect(point, revealRect, [controlView isFlipped]);
|
||||
|
||||
[(TorrentTableView *)controlView removeButtonTrackingAreas];
|
||||
[(TorrentTableView *)controlView removeTrackingAreas];
|
||||
|
||||
while ([event type] != NSLeftMouseUp)
|
||||
{
|
||||
|
@ -229,6 +229,21 @@
|
|||
{
|
||||
NSTrackingAreaOptions options = NSTrackingEnabledDuringMouseDrag | NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways;
|
||||
|
||||
//whole row
|
||||
NSTrackingAreaOptions rowOptions = options;
|
||||
if (NSMouseInRect(mouseLocation, cellFrame, [controlView isFlipped]))
|
||||
{
|
||||
rowOptions |= NSTrackingAssumeInside;
|
||||
[(TorrentTableView *)controlView setRowHover: [[userInfo objectForKey: @"Row"] integerValue]];
|
||||
}
|
||||
|
||||
NSMutableDictionary * rowInfo = [userInfo mutableCopy];
|
||||
[rowInfo setObject: @"Row" forKey: @"Type"];
|
||||
NSTrackingArea * area = [[NSTrackingArea alloc] initWithRect: cellFrame options: rowOptions owner: controlView userInfo: rowInfo];
|
||||
[controlView addTrackingArea: area];
|
||||
[rowInfo release];
|
||||
[area release];
|
||||
|
||||
//control button
|
||||
NSRect controlButtonRect = [self controlButtonRectForBounds: cellFrame];
|
||||
NSTrackingAreaOptions controlOptions = options;
|
||||
|
@ -240,7 +255,7 @@
|
|||
|
||||
NSMutableDictionary * controlInfo = [userInfo mutableCopy];
|
||||
[controlInfo setObject: @"Control" forKey: @"Type"];
|
||||
NSTrackingArea * area = [[NSTrackingArea alloc] initWithRect: controlButtonRect options: controlOptions owner: controlView
|
||||
area = [[NSTrackingArea alloc] initWithRect: controlButtonRect options: controlOptions owner: controlView
|
||||
userInfo: controlInfo];
|
||||
[controlView addTrackingArea: area];
|
||||
[controlInfo release];
|
||||
|
@ -279,6 +294,11 @@
|
|||
[area release];
|
||||
}
|
||||
|
||||
- (void) setHover: (BOOL) hover
|
||||
{
|
||||
fHover = hover;
|
||||
}
|
||||
|
||||
- (void) setControlHover: (BOOL) hover
|
||||
{
|
||||
fHoverControl = hover;
|
||||
|
@ -354,6 +374,9 @@
|
|||
[self drawImage: [NSImage imageNamed: [NSApp isOnSnowLeopardOrBetter] ? NSImageNameCaution : @"Error.png"] inRect: errorRect];
|
||||
}
|
||||
|
||||
//bar
|
||||
[self drawBar: [self barRectForBounds: cellFrame]];
|
||||
|
||||
//text color
|
||||
NSColor * titleColor, * statusColor;
|
||||
if ([self backgroundStyle] == NSBackgroundStyleDark)
|
||||
|
@ -369,7 +392,7 @@
|
|||
|
||||
//minimal status
|
||||
NSRect minimalStatusRect;
|
||||
if (minimal)
|
||||
if (minimal && !fHover)
|
||||
{
|
||||
NSAttributedString * minimalString = [self attributedStatusString: [self minimalStatusString]];
|
||||
minimalStatusRect = [self rectForMinimalStatusWithString: minimalString inBounds: cellFrame];
|
||||
|
@ -407,58 +430,58 @@
|
|||
[progressString drawInRect: progressRect];
|
||||
}
|
||||
|
||||
//bar
|
||||
[self drawBar: [self barRectForBounds: cellFrame]];
|
||||
|
||||
//control button
|
||||
NSString * controlImageSuffix;
|
||||
if (fMouseDownControlButton)
|
||||
controlImageSuffix = @"On.png";
|
||||
else if (!fTracking && fHoverControl)
|
||||
controlImageSuffix = @"Hover.png";
|
||||
else
|
||||
controlImageSuffix = @"Off.png";
|
||||
|
||||
NSImage * controlImage;
|
||||
if ([torrent isActive])
|
||||
controlImage = [NSImage imageNamed: [@"Pause" stringByAppendingString: controlImageSuffix]];
|
||||
else
|
||||
if (!minimal || fHover)
|
||||
{
|
||||
if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask)
|
||||
controlImage = [NSImage imageNamed: [@"ResumeNoWait" stringByAppendingString: controlImageSuffix]];
|
||||
else if ([torrent waitingToStart])
|
||||
//control button
|
||||
NSString * controlImageSuffix;
|
||||
if (fMouseDownControlButton)
|
||||
controlImageSuffix = @"On.png";
|
||||
else if (!fTracking && fHoverControl)
|
||||
controlImageSuffix = @"Hover.png";
|
||||
else
|
||||
controlImageSuffix = @"Off.png";
|
||||
|
||||
NSImage * controlImage;
|
||||
if ([torrent isActive])
|
||||
controlImage = [NSImage imageNamed: [@"Pause" stringByAppendingString: controlImageSuffix]];
|
||||
else
|
||||
controlImage = [NSImage imageNamed: [@"Resume" stringByAppendingString: controlImageSuffix]];
|
||||
}
|
||||
|
||||
[self drawImage: controlImage inRect: [self controlButtonRectForBounds: cellFrame]];
|
||||
|
||||
//reveal button
|
||||
NSString * revealImageString;
|
||||
if (fMouseDownRevealButton)
|
||||
revealImageString = @"RevealOn.png";
|
||||
else if (!fTracking && fHoverReveal)
|
||||
revealImageString = @"RevealHover.png";
|
||||
else
|
||||
revealImageString = @"RevealOff.png";
|
||||
|
||||
NSImage * revealImage = [NSImage imageNamed: revealImageString];
|
||||
[self drawImage: revealImage inRect: [self revealButtonRectForBounds: cellFrame]];
|
||||
|
||||
//action button
|
||||
NSString * actionImageString;
|
||||
if (fMouseDownActionButton)
|
||||
actionImageString = @"ActionOn.png";
|
||||
else if (!fTracking && fHoverAction)
|
||||
actionImageString = @"ActionHover.png";
|
||||
else
|
||||
actionImageString = nil;
|
||||
|
||||
if (actionImageString)
|
||||
{
|
||||
NSImage * actionImage = [NSImage imageNamed: actionImageString];
|
||||
[self drawImage: actionImage inRect: [self actionButtonRectForBounds: cellFrame]];
|
||||
{
|
||||
if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask)
|
||||
controlImage = [NSImage imageNamed: [@"ResumeNoWait" stringByAppendingString: controlImageSuffix]];
|
||||
else if ([torrent waitingToStart])
|
||||
controlImage = [NSImage imageNamed: [@"Pause" stringByAppendingString: controlImageSuffix]];
|
||||
else
|
||||
controlImage = [NSImage imageNamed: [@"Resume" stringByAppendingString: controlImageSuffix]];
|
||||
}
|
||||
|
||||
[self drawImage: controlImage inRect: [self controlButtonRectForBounds: cellFrame]];
|
||||
|
||||
//reveal button
|
||||
NSString * revealImageString;
|
||||
if (fMouseDownRevealButton)
|
||||
revealImageString = @"RevealOn.png";
|
||||
else if (!fTracking && fHoverReveal)
|
||||
revealImageString = @"RevealHover.png";
|
||||
else
|
||||
revealImageString = @"RevealOff.png";
|
||||
|
||||
NSImage * revealImage = [NSImage imageNamed: revealImageString];
|
||||
[self drawImage: revealImage inRect: [self revealButtonRectForBounds: cellFrame]];
|
||||
|
||||
//action button
|
||||
NSString * actionImageString;
|
||||
if (fMouseDownActionButton)
|
||||
actionImageString = @"ActionOn.png";
|
||||
else if (!fTracking && fHoverAction)
|
||||
actionImageString = @"ActionHover.png";
|
||||
else
|
||||
actionImageString = nil;
|
||||
|
||||
if (actionImageString)
|
||||
{
|
||||
NSImage * actionImage = [NSImage imageNamed: actionImageString];
|
||||
[self drawImage: actionImage inRect: [self actionButtonRectForBounds: cellFrame]];
|
||||
}
|
||||
}
|
||||
|
||||
//status
|
||||
|
@ -492,8 +515,11 @@
|
|||
[self drawRegularBar: barRect];
|
||||
}
|
||||
|
||||
[fBarBorderColor set];
|
||||
[NSBezierPath strokeRect: NSInsetRect(barRect, 0.5, 0.5)];
|
||||
if ([fDefaults boolForKey: @"SmallView"])
|
||||
{
|
||||
[fBarBorderColor set];
|
||||
[NSBezierPath strokeRect: NSInsetRect(barRect, 0.5, 0.5)];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) drawRegularBar: (NSRect) barRect
|
||||
|
@ -683,13 +709,17 @@
|
|||
result.size.height = BAR_HEIGHT;
|
||||
result.origin.x = NSMinX(bounds) + (minimal ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG) + PADDING_BETWEEN_IMAGE_AND_BAR;
|
||||
|
||||
result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE;
|
||||
result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE;
|
||||
if (minimal)
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN;
|
||||
#warning make const
|
||||
result.origin.y += 2.0;
|
||||
else
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_PROGRESS + HEIGHT_STATUS + PADDING_BETWEEN_PROGRESS_AND_BAR;
|
||||
result.origin.y += HEIGHT_TITLE + PADDING_BETWEEN_TITLE_AND_PROGRESS + HEIGHT_STATUS + PADDING_BETWEEN_PROGRESS_AND_BAR;
|
||||
|
||||
result.size.width = floor(NSMaxX(bounds) - result.origin.x - PADDING_HORIZONTAL - 2.0 * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH));
|
||||
result.size.width = NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONTAL;
|
||||
if (!minimal)
|
||||
result.size.width -= 2.0 * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);
|
||||
result.size.width = floor(NSWidth(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -701,11 +731,10 @@
|
|||
result.size.width = NORMAL_BUTTON_WIDTH;
|
||||
result.origin.x = NSMaxX(bounds) - 2.0 * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);
|
||||
|
||||
result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5;
|
||||
if ([fDefaults boolForKey: @"SmallView"])
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN;
|
||||
else
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_PROGRESS + HEIGHT_STATUS + PADDING_BETWEEN_PROGRESS_AND_BAR;
|
||||
result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE;
|
||||
if (![fDefaults boolForKey: @"SmallView"])
|
||||
result.origin.y += HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5
|
||||
+ PADDING_BETWEEN_TITLE_AND_PROGRESS + HEIGHT_STATUS + PADDING_BETWEEN_PROGRESS_AND_BAR;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -717,11 +746,10 @@
|
|||
result.size.width = NORMAL_BUTTON_WIDTH;
|
||||
result.origin.x = NSMaxX(bounds) - (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);
|
||||
|
||||
result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5;
|
||||
if ([fDefaults boolForKey: @"SmallView"])
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN;
|
||||
else
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_PROGRESS + HEIGHT_STATUS + PADDING_BETWEEN_PROGRESS_AND_BAR;
|
||||
result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE;
|
||||
if (![fDefaults boolForKey: @"SmallView"])
|
||||
result.origin.y += HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5
|
||||
+ PADDING_BETWEEN_TITLE_AND_PROGRESS + HEIGHT_STATUS + PADDING_BETWEEN_PROGRESS_AND_BAR;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
IBOutlet NSMenu * fContextRow, * fContextNoRow;
|
||||
|
||||
NSInteger fMouseControlRow, fMouseRevealRow, fMouseActionRow, fActionPushedRow;
|
||||
NSInteger fMouseRow, fMouseControlRow, fMouseRevealRow, fMouseActionRow, fActionPushedRow;
|
||||
NSArray * fSelectedValues;
|
||||
|
||||
IBOutlet NSMenu * fActionMenu, * fUploadMenu, * fDownloadMenu, * fRatioMenu, * fPriorityMenu;
|
||||
|
@ -59,7 +59,8 @@
|
|||
- (void) removeAllCollapsedGroups;
|
||||
- (void) saveCollapsedGroups;
|
||||
|
||||
- (void) removeButtonTrackingAreas;
|
||||
- (void) removeTrackingAreas;
|
||||
- (void) setRowHover: (NSInteger) row;
|
||||
- (void) setControlButtonHover: (NSInteger) row;
|
||||
- (void) setRevealButtonHover: (NSInteger) row;
|
||||
- (void) setActionButtonHover: (NSInteger) row;
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
else
|
||||
fCollapsedGroups = [[NSMutableIndexSet alloc] init];
|
||||
|
||||
fMouseRow = -1;
|
||||
fMouseControlRow = -1;
|
||||
fMouseRevealRow = -1;
|
||||
fMouseActionRow = -1;
|
||||
|
@ -152,6 +153,7 @@
|
|||
[cell setRepresentedObject: item];
|
||||
|
||||
const NSInteger row = [self rowForItem: item];
|
||||
[cell setHover: row == fMouseRow];
|
||||
[cell setControlHover: row == fMouseControlRow];
|
||||
[cell setRevealHover: row == fMouseRevealRow];
|
||||
[cell setActionHover: row == fMouseActionRow];
|
||||
|
@ -226,7 +228,7 @@
|
|||
- (void) updateTrackingAreas
|
||||
{
|
||||
[super updateTrackingAreas];
|
||||
[self removeButtonTrackingAreas];
|
||||
[self removeTrackingAreas];
|
||||
|
||||
NSRange rows = [self rowsInRect: [self visibleRect]];
|
||||
if (rows.length == 0)
|
||||
|
@ -244,8 +246,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) removeButtonTrackingAreas
|
||||
- (void) removeTrackingAreas
|
||||
{
|
||||
fMouseRow = -1;
|
||||
fMouseControlRow = -1;
|
||||
fMouseRevealRow = -1;
|
||||
fMouseActionRow = -1;
|
||||
|
@ -257,6 +260,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) setRowHover: (NSInteger) row
|
||||
{
|
||||
fMouseRow = row;
|
||||
if (row >= 0 && [fDefaults boolForKey: @"SmallView"])
|
||||
[self setNeedsDisplayInRect: [self rectOfRow: row]];
|
||||
}
|
||||
|
||||
- (void) setControlButtonHover: (NSInteger) row
|
||||
{
|
||||
fMouseControlRow = row;
|
||||
|
@ -291,8 +301,14 @@
|
|||
fMouseActionRow = rowVal;
|
||||
else if ([type isEqualToString: @"Control"])
|
||||
fMouseControlRow = rowVal;
|
||||
else
|
||||
else if ([type isEqualToString: @"Reveal"])
|
||||
fMouseRevealRow = rowVal;
|
||||
else
|
||||
{
|
||||
fMouseRow = rowVal;
|
||||
if (![fDefaults boolForKey: @"SmallView"])
|
||||
return;
|
||||
}
|
||||
|
||||
[self setNeedsDisplayInRect: [self rectOfRow: rowVal]];
|
||||
}
|
||||
|
@ -310,8 +326,14 @@
|
|||
fMouseActionRow = -1;
|
||||
else if ([type isEqualToString: @"Control"])
|
||||
fMouseControlRow = -1;
|
||||
else
|
||||
else if ([type isEqualToString: @"Reveal"])
|
||||
fMouseRevealRow = -1;
|
||||
else
|
||||
{
|
||||
fMouseRow = -1;
|
||||
if (![fDefaults boolForKey: @"SmallView"])
|
||||
return;
|
||||
}
|
||||
|
||||
[self setNeedsDisplayInRect: [self rectOfRow: [row integerValue]]];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue