mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
the pause/resume and reveal buttons in the main window don't dim when pushed but not hovered over
This commit is contained in:
parent
c1e98ffd64
commit
24fc88c21d
2 changed files with 43 additions and 7 deletions
|
@ -39,7 +39,9 @@
|
|||
{
|
||||
IBOutlet Controller * fController;
|
||||
NSArray * fTorrents;
|
||||
|
||||
NSPoint fClickPoint;
|
||||
BOOL fClickIn;
|
||||
|
||||
NSUserDefaults * fDefaults;
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
fActionOffIcon = [NSImage imageNamed: @"ActionOff.png"];
|
||||
|
||||
fClickPoint = NSZeroPoint;
|
||||
fClickIn = NO;
|
||||
|
||||
fKeyStrokes = [[NSMutableArray alloc] init];
|
||||
|
||||
|
@ -116,11 +117,14 @@
|
|||
|
||||
if ([self pointInActionRect: fClickPoint])
|
||||
{
|
||||
|
||||
[self setNeedsDisplayInRect: [self rectOfRow: [self rowAtPoint: fClickPoint]]]; //ensure button is pushed down
|
||||
[self displayTorrentMenuForEvent: event];
|
||||
fClickPoint = NSZeroPoint;
|
||||
}
|
||||
else if (![self pointInPauseRect: fClickPoint] && ![self pointInRevealRect: fClickPoint])
|
||||
else if ([self pointInPauseRect: fClickPoint] || [self pointInRevealRect: fClickPoint])
|
||||
fClickIn = YES;
|
||||
else
|
||||
{
|
||||
if ([event modifierFlags] & NSAlternateKeyMask)
|
||||
{
|
||||
|
@ -138,7 +142,6 @@
|
|||
[super mouseDown: event];
|
||||
}
|
||||
}
|
||||
else;
|
||||
|
||||
[self display];
|
||||
}
|
||||
|
@ -180,9 +183,39 @@
|
|||
[super mouseUp: event];
|
||||
|
||||
fClickPoint = NSZeroPoint;
|
||||
fClickIn = NO;
|
||||
[self setNeedsDisplayInRect: [self rectOfRow: oldRow]];
|
||||
}
|
||||
|
||||
- (void) mouseDragged: (NSEvent *) event
|
||||
{
|
||||
if (NSEqualPoints(fClickPoint, NSZeroPoint))
|
||||
{
|
||||
[super mouseDragged: event];
|
||||
return;
|
||||
}
|
||||
|
||||
NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
|
||||
int oldRow = [self rowAtPoint: fClickPoint];
|
||||
|
||||
BOOL inRect;
|
||||
if ([self pointInRevealRect: fClickPoint])
|
||||
inRect = oldRow == [self rowAtPoint: point] && [self pointInRevealRect: point];
|
||||
else if ([self pointInPauseRect: fClickPoint])
|
||||
inRect = oldRow == [self rowAtPoint: point] && [self pointInPauseRect: point];
|
||||
else
|
||||
{
|
||||
[super mouseDragged: event];
|
||||
return;
|
||||
}
|
||||
|
||||
if (inRect != fClickIn)
|
||||
{
|
||||
fClickIn = inRect;
|
||||
[self setNeedsDisplayInRect: [self rectOfRow: oldRow]];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSMenu *) menuForEvent: (NSEvent *) event
|
||||
{
|
||||
int row = [self rowAtPoint: [self convertPoint: [event locationInWindow] fromView: nil]];
|
||||
|
@ -371,16 +404,17 @@
|
|||
if ([torrent isActive])
|
||||
{
|
||||
if (![torrent isChecking])
|
||||
pauseImage = NSPointInRect(fClickPoint, pauseRect) ? fPauseOnIcon : fPauseOffIcon;
|
||||
pauseImage = fClickIn && NSPointInRect(fClickPoint, pauseRect) ? fPauseOnIcon : fPauseOffIcon;
|
||||
}
|
||||
else if ([torrent isPaused])
|
||||
{
|
||||
BOOL inPauseRect = fClickIn && NSPointInRect(fClickPoint, pauseRect);
|
||||
if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask && [fDefaults boolForKey: @"Queue"])
|
||||
pauseImage = NSPointInRect(fClickPoint, pauseRect) ? fResumeNoWaitOnIcon : fResumeNoWaitOffIcon;
|
||||
pauseImage = inPauseRect ? fResumeNoWaitOnIcon : fResumeNoWaitOffIcon;
|
||||
else if ([torrent waitingToStart])
|
||||
pauseImage = NSPointInRect(fClickPoint, pauseRect) ? fPauseOnIcon : fPauseOffIcon;
|
||||
pauseImage = inPauseRect ? fPauseOnIcon : fPauseOffIcon;
|
||||
else
|
||||
pauseImage = NSPointInRect(fClickPoint, pauseRect) ? fResumeOnIcon : fResumeOffIcon;
|
||||
pauseImage = inPauseRect ? fResumeOnIcon : fResumeOffIcon;
|
||||
}
|
||||
else;
|
||||
|
||||
|
@ -389,7 +423,7 @@
|
|||
|
||||
//reveal icon
|
||||
NSRect revealRect = [self revealRectForRow: row];
|
||||
NSImage * revealImage = NSPointInRect(fClickPoint, revealRect) ? fRevealOnIcon : fRevealOffIcon;
|
||||
NSImage * revealImage = fClickIn && NSPointInRect(fClickPoint, revealRect) ? fRevealOnIcon : fRevealOffIcon;
|
||||
[revealImage compositeToPoint: NSMakePoint(revealRect.origin.x, NSMaxY(revealRect)) operation: NSCompositeSourceOver];
|
||||
|
||||
//action icon
|
||||
|
|
Loading…
Reference in a new issue