mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
simplify fade in code a little
This commit is contained in:
parent
822602d602
commit
6e2ee55701
2 changed files with 21 additions and 31 deletions
|
@ -138,8 +138,6 @@
|
|||
[subLine drawInRect: lineRect withAttributes: fSubLineAttributes];
|
||||
|
||||
[fBadge unlockFocus];
|
||||
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
-(void) drawRect: (NSRect) rect
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
@interface DragOverlayWindow (Private)
|
||||
|
||||
- (void) beginFadeIn;
|
||||
- (void) fadeIn;
|
||||
- (void) fadeOut;
|
||||
|
||||
|
@ -68,18 +69,6 @@
|
|||
|
||||
- (void) setFiles: (NSArray *) files
|
||||
{
|
||||
[self setAlphaValue: 0.0];
|
||||
if (fFadeInTimer)
|
||||
{
|
||||
[fFadeInTimer invalidate];
|
||||
fFadeInTimer = nil;
|
||||
}
|
||||
if (fFadeOutTimer)
|
||||
{
|
||||
[fFadeOutTimer invalidate];
|
||||
fFadeOutTimer = nil;
|
||||
}
|
||||
|
||||
uint64_t size = 0;
|
||||
int count = 0;
|
||||
|
||||
|
@ -123,30 +112,15 @@
|
|||
|
||||
[[self contentView] setOverlay: icon mainLine: name subLine: sizeString];
|
||||
|
||||
fFadeInTimer = [NSTimer scheduledTimerWithTimeInterval: 0.0075 target: self
|
||||
selector: @selector(fadeIn) userInfo: nil repeats: YES];
|
||||
[self beginFadeIn];
|
||||
}
|
||||
|
||||
#warning combine
|
||||
- (void) setURL: (NSString *) url
|
||||
{
|
||||
[self setAlphaValue: 0.0];
|
||||
if (fFadeInTimer)
|
||||
{
|
||||
[fFadeInTimer invalidate];
|
||||
fFadeInTimer = nil;
|
||||
}
|
||||
if (fFadeOutTimer)
|
||||
{
|
||||
[fFadeOutTimer invalidate];
|
||||
fFadeOutTimer = nil;
|
||||
}
|
||||
|
||||
[[self contentView] setOverlay: [NSImage imageNamed: @"Globe.tiff"]
|
||||
mainLine: NSLocalizedString(@"Web Address", "Drag overlay -> url") subLine: url];
|
||||
|
||||
fFadeInTimer = [NSTimer scheduledTimerWithTimeInterval: 0.0075 target: self
|
||||
selector: @selector(fadeIn) userInfo: nil repeats: YES];
|
||||
[self beginFadeIn];
|
||||
}
|
||||
|
||||
- (void) closeFadeOut
|
||||
|
@ -170,6 +144,24 @@
|
|||
|
||||
@implementation DragOverlayWindow (Private)
|
||||
|
||||
- (void) beginFadeIn
|
||||
{
|
||||
[self setAlphaValue: 0.0];
|
||||
if (fFadeInTimer)
|
||||
{
|
||||
[fFadeInTimer invalidate];
|
||||
fFadeInTimer = nil;
|
||||
}
|
||||
if (fFadeOutTimer)
|
||||
{
|
||||
[fFadeOutTimer invalidate];
|
||||
fFadeOutTimer = nil;
|
||||
}
|
||||
|
||||
fFadeInTimer = [NSTimer scheduledTimerWithTimeInterval: 0.0075 target: self
|
||||
selector: @selector(fadeIn) userInfo: nil repeats: YES];
|
||||
}
|
||||
|
||||
- (void) fadeIn
|
||||
{
|
||||
[self setAlphaValue: [self alphaValue] + 0.1];
|
||||
|
|
Loading…
Reference in a new issue