Changeset 6079


Ignore:
Timestamp:
Jun 8, 2008, 2:10:10 AM (14 years ago)
Author:
livings124
Message:

more chicanery to get the web seed table resizing in edge-case situations

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.h

    r6078 r6079  
    6565    IBOutlet PiecesView * fPiecesView;
    6666    IBOutlet NSSegmentedControl * fPiecesControl;
    67     BOOL fWebSeedTableHidden;
    68     float fPeerTableHeight, fWebSeedTableHeight, fWebSeedTableOrigin;
     67    float fWebSeedTableHeight, fSpaceBetweenWebSeedAndPeer;
    6968   
    7069    IBOutlet FileOutlineController * fFileController;
  • trunk/macosx/InfoWindowController.m

    r6078 r6079  
    7373- (NSView *) tabViewForTag: (int) tag;
    7474- (NSArray *) peerSortDescriptors;
    75 - (void) setWebSeederTableHidden: (BOOL) hidden animate: (BOOL) animate;
     75- (void) setWebSeederTableHidden: (BOOL) hide animate: (BOOL) animate;
    7676
    7777- (void) addTrackers;
     
    175175   
    176176    //prepare for animating peer table and web seed table
    177     fWebSeedTableHidden = NO;
    178     fPeerTableHeight = [[fPeerTable enclosingScrollView] frame].size.height;
    179     fWebSeedTableHeight = [[fWebSeedTable enclosingScrollView] frame].size.height;
    180     fWebSeedTableOrigin = [[fWebSeedTable enclosingScrollView] frame].origin.y;
     177    NSRect webSeedTableFrame = [[fWebSeedTable enclosingScrollView] frame];
     178    fWebSeedTableHeight = webSeedTableFrame.size.height;
     179    fSpaceBetweenWebSeedAndPeer = webSeedTableFrame.origin.y - NSMaxY([[fPeerTable enclosingScrollView] frame]);
    181180   
    182181    [self setWebSeederTableHidden: YES animate: NO];
     
    14411440}
    14421441
    1443 - (void) setWebSeederTableHidden: (BOOL) hidden animate: (BOOL) animate
    1444 {
    1445     if (hidden == fWebSeedTableHidden)
    1446         return;
    1447    
    1448     fWebSeedTableHidden = hidden;
    1449    
     1442- (void) setWebSeederTableHidden: (BOOL) hide animate: (BOOL) animate
     1443{
    14501444    if (![NSApp isOnLeopardOrBetter])
    14511445        animate = NO;
     
    14541448    NSRect peerFrame = [[fPeerTable enclosingScrollView] frame];
    14551449   
    1456     if (hidden)
    1457     {
    1458         float webSeedFrameMaxY = fWebSeedTableHeight + fWebSeedTableOrigin;
     1450    if (hide)
     1451    {
     1452        float webSeedFrameMaxY = NSMaxY(webSeedFrame);
     1453        webSeedFrame.size.height = 0;
     1454        webSeedFrame.origin.y = webSeedFrameMaxY;
     1455       
    14591456        peerFrame.size.height = webSeedFrameMaxY - peerFrame.origin.y;
    1460        
    1461         webSeedFrame.origin.y = webSeedFrameMaxY;
    1462         webSeedFrame.size.height = 0;
    14631457    }
    14641458    else
    14651459    {
    1466         peerFrame.size.height = fPeerTableHeight;
    1467        
     1460        webSeedFrame.origin.y -= fWebSeedTableHeight - webSeedFrame.size.height;
    14681461        webSeedFrame.size.height = fWebSeedTableHeight;
    1469         webSeedFrame.origin.y = fWebSeedTableOrigin;
    1470     }NSLog(@"%f", webSeedFrame.size.height);
     1462       
     1463        peerFrame.size.height = (webSeedFrame.origin.y - fSpaceBetweenWebSeedAndPeer) - peerFrame.origin.y;
     1464    }
    14711465   
    14721466    //actually resize tables
    1473     [NSAnimationContext beginGrouping];
    1474    
    1475     [[[fWebSeedTable enclosingScrollView] animator] setFrame: webSeedFrame];
    1476     [[[fPeerTable enclosingScrollView] animator] setFrame: peerFrame];
    1477    
    1478     [NSAnimationContext endGrouping];
     1467    if (animate)
     1468    {
     1469        [NSAnimationContext beginGrouping];
     1470       
     1471        [[NSAnimationContext currentContext] setDuration: 0.2];
     1472       
     1473        [[[fWebSeedTable enclosingScrollView] animator] setFrame: webSeedFrame];
     1474        [[[fPeerTable enclosingScrollView] animator] setFrame: peerFrame];
     1475       
     1476        [NSAnimationContext endGrouping];
     1477    }
     1478    else
     1479    {
     1480        [[fWebSeedTable enclosingScrollView] setFrame: webSeedFrame];
     1481        [[fPeerTable enclosingScrollView] setFrame: peerFrame];
     1482    }
    14791483}
    14801484
Note: See TracChangeset for help on using the changeset viewer.