Changeset 2708


Ignore:
Timestamp:
Aug 10, 2007, 5:56:36 AM (15 years ago)
Author:
livings124
Message:

the pause/resume and reveal buttons in the main window don't dim when pushed but not hovered over

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentTableView.h

    r2665 r2708  
    4040    IBOutlet Controller * fController;
    4141    NSArray * fTorrents;
     42   
    4243    NSPoint fClickPoint;
     44    BOOL fClickIn;
    4345   
    4446    NSUserDefaults * fDefaults;
  • trunk/macosx/TorrentTableView.m

    r2701 r2708  
    7070       
    7171        fClickPoint = NSZeroPoint;
     72        fClickIn = NO;
    7273       
    7374        fKeyStrokes = [[NSMutableArray alloc] init];
     
    117118    if ([self pointInActionRect: fClickPoint])
    118119    {
     120       
    119121        [self setNeedsDisplayInRect: [self rectOfRow: [self rowAtPoint: fClickPoint]]]; //ensure button is pushed down
    120122        [self displayTorrentMenuForEvent: event];
    121123        fClickPoint = NSZeroPoint;
    122124    }
    123     else if (![self pointInPauseRect: fClickPoint] && ![self pointInRevealRect: fClickPoint])
     125    else if ([self pointInPauseRect: fClickPoint] || [self pointInRevealRect: fClickPoint])
     126        fClickIn = YES;
     127    else
    124128    {
    125129        if ([event modifierFlags] & NSAlternateKeyMask)
     
    139143        }
    140144    }
    141     else;
    142145
    143146    [self display];
     
    181184
    182185    fClickPoint = NSZeroPoint;
     186    fClickIn = NO;
    183187    [self setNeedsDisplayInRect: [self rectOfRow: oldRow]];
     188}
     189
     190- (void) mouseDragged: (NSEvent *) event
     191{
     192    if (NSEqualPoints(fClickPoint, NSZeroPoint))
     193    {
     194        [super mouseDragged: event];
     195        return;
     196    }
     197   
     198    NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
     199    int oldRow = [self rowAtPoint: fClickPoint];
     200   
     201    BOOL inRect;
     202    if ([self pointInRevealRect: fClickPoint])
     203        inRect = oldRow == [self rowAtPoint: point] && [self pointInRevealRect: point];
     204    else if ([self pointInPauseRect: fClickPoint])
     205        inRect = oldRow == [self rowAtPoint: point] && [self pointInPauseRect: point];
     206    else
     207    {
     208        [super mouseDragged: event];
     209        return;
     210    }
     211   
     212    if (inRect != fClickIn)
     213    {
     214        fClickIn = inRect;
     215        [self setNeedsDisplayInRect: [self rectOfRow: oldRow]];
     216    }
    184217}
    185218
     
    372405    {
    373406        if (![torrent isChecking])
    374             pauseImage = NSPointInRect(fClickPoint, pauseRect) ? fPauseOnIcon : fPauseOffIcon;
     407            pauseImage = fClickIn && NSPointInRect(fClickPoint, pauseRect) ? fPauseOnIcon : fPauseOffIcon;
    375408    }
    376409    else if ([torrent isPaused])
    377410    {
     411        BOOL inPauseRect = fClickIn && NSPointInRect(fClickPoint, pauseRect);
    378412        if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask && [fDefaults boolForKey: @"Queue"])
    379             pauseImage = NSPointInRect(fClickPoint, pauseRect) ? fResumeNoWaitOnIcon : fResumeNoWaitOffIcon;
     413            pauseImage = inPauseRect ? fResumeNoWaitOnIcon : fResumeNoWaitOffIcon;
    380414        else if ([torrent waitingToStart])
    381             pauseImage = NSPointInRect(fClickPoint, pauseRect) ? fPauseOnIcon : fPauseOffIcon;
     415            pauseImage = inPauseRect ? fPauseOnIcon : fPauseOffIcon;
    382416        else
    383             pauseImage = NSPointInRect(fClickPoint, pauseRect) ? fResumeOnIcon : fResumeOffIcon;
     417            pauseImage = inPauseRect ? fResumeOnIcon : fResumeOffIcon;
    384418    }
    385419    else;
     
    390424    //reveal icon
    391425    NSRect revealRect = [self revealRectForRow: row];
    392     NSImage * revealImage = NSPointInRect(fClickPoint, revealRect) ? fRevealOnIcon : fRevealOffIcon;
     426    NSImage * revealImage = fClickIn && NSPointInRect(fClickPoint, revealRect) ? fRevealOnIcon : fRevealOffIcon;
    393427    [revealImage compositeToPoint: NSMakePoint(revealRect.origin.x, NSMaxY(revealRect)) operation: NSCompositeSourceOver];
    394428   
Note: See TracChangeset for help on using the changeset viewer.