trunk: make status bar inactive when window isn't main window
This commit is contained in:
parent
91f4a5db9b
commit
525cf7904d
|
@ -45,6 +45,12 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[fAttributes release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) drawRect: (NSRect) rect
|
||||
{
|
||||
[[NSImage imageNamed: @"NSApplicationIcon"] drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
if ([NSApp isOnLeopardOrBetter])
|
||||
{
|
||||
BadgeView * view = [[BadgeView alloc] initWithFrame: [[[NSApp dockTile] contentView] frame] lib: fLib];
|
||||
BadgeView * view = [[BadgeView alloc] initWithFrame: [[[NSApp dockTile] contentView] frame] lib: lib];
|
||||
[[NSApp dockTile] setContentView: view];
|
||||
[view release];
|
||||
}
|
||||
|
@ -217,7 +217,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
//for quitting
|
||||
//for quitting -- only needed by Tiger
|
||||
- (void) clearBadge
|
||||
{
|
||||
if (![NSApp isOnLeopardOrBetter])
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
|
||||
- (BOOL) isOpaque
|
||||
{
|
||||
return [[self window] isKeyWindow];
|
||||
return [[self window] isMainWindow];
|
||||
}
|
||||
|
||||
- (void) drawRect: (NSRect) rect
|
||||
{
|
||||
if ([[self window] isKeyWindow])
|
||||
if ([[self window] isMainWindow])
|
||||
[super drawRect: rect];
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,6 @@
|
|||
NSUserDefaults * fDefaults;
|
||||
|
||||
IBOutlet NSMenu * fContextRow, * fContextNoRow;
|
||||
NSImage * fResumeOnIcon, * fResumeOffIcon, * fPauseOnIcon, * fPauseOffIcon,
|
||||
* fResumeNoWaitOnIcon, * fResumeNoWaitOffIcon, * fRevealOnIcon, * fRevealOffIcon,
|
||||
* fActionOnIcon, * fActionOffIcon;
|
||||
|
||||
NSMutableArray * fKeyStrokes;
|
||||
|
||||
|
|
|
@ -64,19 +64,6 @@
|
|||
{
|
||||
if ((self = [super initWithCoder: decoder]))
|
||||
{
|
||||
fResumeOnIcon = [NSImage imageNamed: @"ResumeOn.png"];
|
||||
fResumeOffIcon = [NSImage imageNamed: @"ResumeOff.png"];
|
||||
fPauseOnIcon = [NSImage imageNamed: @"PauseOn.png"];
|
||||
fPauseOffIcon = [NSImage imageNamed: @"PauseOff.png"];
|
||||
fResumeNoWaitOnIcon = [NSImage imageNamed: @"ResumeNoWaitOn.png"];
|
||||
fResumeNoWaitOffIcon = [NSImage imageNamed: @"ResumeNoWaitOff.png"];
|
||||
|
||||
fRevealOnIcon = [NSImage imageNamed: @"RevealOn.png"];
|
||||
fRevealOffIcon = [NSImage imageNamed: @"RevealOff.png"];
|
||||
|
||||
fActionOnIcon = [NSImage imageNamed: @"ActionOn.png"];
|
||||
fActionOffIcon = [NSImage imageNamed: @"ActionOff.png"];
|
||||
|
||||
fClickPoint = NSZeroPoint;
|
||||
fClickIn = NO;
|
||||
|
||||
|
@ -477,16 +464,17 @@
|
|||
NSImage * pauseImage = nil;
|
||||
NSRect pauseRect = [self pauseRectForRow: row];
|
||||
if ([torrent isActive])
|
||||
pauseImage = fClickIn && NSPointInRect(fClickPoint, pauseRect) ? fPauseOnIcon : fPauseOffIcon;
|
||||
pauseImage = fClickIn && NSPointInRect(fClickPoint, pauseRect) ? [NSImage imageNamed: @"PauseOn.png"]
|
||||
: [NSImage imageNamed: @"PauseOff.png"];
|
||||
else
|
||||
{
|
||||
BOOL inPauseRect = fClickIn && NSPointInRect(fClickPoint, pauseRect);
|
||||
if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask && [fDefaults boolForKey: @"Queue"])
|
||||
pauseImage = inPauseRect ? fResumeNoWaitOnIcon : fResumeNoWaitOffIcon;
|
||||
pauseImage = inPauseRect ? [NSImage imageNamed: @"ResumeNoWaitOn.png"] : [NSImage imageNamed: @"ResumeNoWaitOff.png"];
|
||||
else if ([torrent waitingToStart])
|
||||
pauseImage = inPauseRect ? fPauseOnIcon : fPauseOffIcon;
|
||||
pauseImage = inPauseRect ? [NSImage imageNamed: @"PauseOn.png"] : [NSImage imageNamed: @"PauseOff.png"];
|
||||
else
|
||||
pauseImage = inPauseRect ? fResumeOnIcon : fResumeOffIcon;
|
||||
pauseImage = inPauseRect ? [NSImage imageNamed: @"ResumeOn.png"] : [NSImage imageNamed: @"ResumeOff.png"];
|
||||
}
|
||||
|
||||
if (pauseImage)
|
||||
|
@ -494,14 +482,16 @@
|
|||
|
||||
//reveal icon
|
||||
NSRect revealRect = [self revealRectForRow: row];
|
||||
NSImage * revealImage = fClickIn && NSPointInRect(fClickPoint, revealRect) ? fRevealOnIcon : fRevealOffIcon;
|
||||
NSImage * revealImage = fClickIn && NSPointInRect(fClickPoint, revealRect) ? [NSImage imageNamed: @"RevealOn.png"]
|
||||
: [NSImage imageNamed: @"RevealOff.png"];
|
||||
[revealImage compositeToPoint: NSMakePoint(revealRect.origin.x, NSMaxY(revealRect)) operation: NSCompositeSourceOver];
|
||||
|
||||
//action icon
|
||||
if (![fDefaults boolForKey: @"SmallView"])
|
||||
{
|
||||
NSRect actionRect = [self actionRectForRow: row];
|
||||
NSImage * actionImage = NSPointInRect(fClickPoint, actionRect) ? fActionOnIcon : fActionOffIcon;
|
||||
NSImage * actionImage = NSPointInRect(fClickPoint, actionRect) ? [NSImage imageNamed: @"ActionOn.png"]
|
||||
: [NSImage imageNamed: @"ActionOff.png"];
|
||||
[actionImage compositeToPoint: NSMakePoint(actionRect.origin.x, NSMaxY(actionRect)) operation: NSCompositeSourceOver];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue