Changeset 6084


Ignore:
Timestamp:
Jun 8, 2008, 5:36:49 AM (13 years ago)
Author:
livings124
Message:

another attempt to improve the animation reliability of the sliding web seeds table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r6081 r6084  
    636636}
    637637
     638- (void) animationDidEnd: (NSAnimation *) animation
     639{
     640    if (animation == fWebSeedTableAnimation)
     641    {
     642        [fWebSeedTableAnimation release];
     643        fWebSeedTableAnimation = nil;
     644    }
     645}
     646
    638647- (NSSize) windowWillResize: (NSWindow *) window toSize: (NSSize) proposedFrameSize
    639648{
    640     [fWebSeedTableAnimation stopAnimation];
     649    //this is an edge-case - just stop the animation (stopAnimation jumps to end frame)
     650    if (fWebSeedTableAnimation)
     651    {
     652        [fWebSeedTableAnimation stopAnimation];
     653        [fWebSeedTableAnimation release];
     654        fWebSeedTableAnimation = nil;
     655    }
     656   
    641657    return proposedFrameSize;
    642 }
    643 
    644 - (void) windowDidResize: (NSNotification *) notification
    645 {
    646     //this is an edge-case - if it's reached, just safely resize the tables without animation
    647     if (fWebSeedTableAnimation)
    648         [self setWebSeederTableHidden: !fWebSeeds || [fWebSeeds count] == 0 animate: NO];
    649658}
    650659
     
    672681                break;
    673682            case TAB_PEERS_TAG:
     683                //if in the middle of animating, just stop and resize immediately
     684                if (fWebSeedTableAnimation)
     685                    [self setWebSeederTableHidden: !fWebSeeds || [fWebSeeds count] == 0 animate: NO];
     686               
    674687                [fPeers release];
    675688                fPeers = nil;
     
    14551468- (void) setWebSeederTableHidden: (BOOL) hide animate: (BOOL) animate
    14561469{
    1457     if (![[self window] isVisible])
     1470    if (fCurrentTabTag != TAB_PEERS_TAG || ![[self window] isVisible])
    14581471        animate = NO;
    14591472   
     
    14901503    {
    14911504        NSDictionary * webSeedDict = [NSDictionary dictionaryWithObjectsAndKeys:
    1492                         [fWebSeedTable enclosingScrollView], NSViewAnimationTargetKey,
    1493                         [NSValue valueWithRect: [[fWebSeedTable enclosingScrollView] frame]], NSViewAnimationStartFrameKey,
    1494                         [NSValue valueWithRect: webSeedFrame], NSViewAnimationEndFrameKey, nil],
     1505                                    [fWebSeedTable enclosingScrollView], NSViewAnimationTargetKey,
     1506                                    [NSValue valueWithRect: [[fWebSeedTable enclosingScrollView] frame]], NSViewAnimationStartFrameKey,
     1507                                    [NSValue valueWithRect: webSeedFrame], NSViewAnimationEndFrameKey, nil],
    14951508                    * peerDict = [NSDictionary dictionaryWithObjectsAndKeys:
    1496                         [fPeerTable enclosingScrollView], NSViewAnimationTargetKey,
    1497                         [NSValue valueWithRect: [[fPeerTable enclosingScrollView] frame]], NSViewAnimationStartFrameKey,
    1498                         [NSValue valueWithRect: peerFrame], NSViewAnimationEndFrameKey, nil];
     1509                                    [fPeerTable enclosingScrollView], NSViewAnimationTargetKey,
     1510                                    [NSValue valueWithRect: [[fPeerTable enclosingScrollView] frame]], NSViewAnimationStartFrameKey,
     1511                                    [NSValue valueWithRect: peerFrame], NSViewAnimationEndFrameKey, nil];
    14991512       
    15001513        fWebSeedTableAnimation = [[NSViewAnimation alloc] initWithViewAnimations:
    15011514                                        [NSArray arrayWithObjects: webSeedDict, peerDict, nil]];
    1502         [fWebSeedTableAnimation setDuration: 0.2];
    1503         [fWebSeedTableAnimation setAnimationBlockingMode: NSAnimationNonblockingThreaded];
     1515        [fWebSeedTableAnimation setDuration: 0.1];
     1516        [fWebSeedTableAnimation setAnimationBlockingMode: NSAnimationNonblocking];
    15041517        [fWebSeedTableAnimation setDelegate: self];
    15051518       
     
    15101523        [[fWebSeedTable enclosingScrollView] setFrame: webSeedFrame];
    15111524        [[fPeerTable enclosingScrollView] setFrame: peerFrame];
    1512     }
    1513 }
    1514 
    1515 - (void) animationDidEnd: (NSAnimation *) animation
    1516 {
    1517     if (animation == fWebSeedTableAnimation)
    1518     {
    1519         [fWebSeedTableAnimation release];
    1520         fWebSeedTableAnimation = nil;
    15211525    }
    15221526}
Note: See TracChangeset for help on using the changeset viewer.