1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-03 18:25:35 +00:00

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

This commit is contained in:
Mitchell Livingston 2008-06-08 02:10:10 +00:00
parent e0e086b8cb
commit 0f9093cb7d
2 changed files with 31 additions and 28 deletions

View file

@ -64,8 +64,7 @@
IBOutlet NSTextView * fErrorMessageView;
IBOutlet PiecesView * fPiecesView;
IBOutlet NSSegmentedControl * fPiecesControl;
BOOL fWebSeedTableHidden;
float fPeerTableHeight, fWebSeedTableHeight, fWebSeedTableOrigin;
float fWebSeedTableHeight, fSpaceBetweenWebSeedAndPeer;
IBOutlet FileOutlineController * fFileController;

View file

@ -72,7 +72,7 @@ typedef enum
- (NSView *) tabViewForTag: (int) tag;
- (NSArray *) peerSortDescriptors;
- (void) setWebSeederTableHidden: (BOOL) hidden animate: (BOOL) animate;
- (void) setWebSeederTableHidden: (BOOL) hide animate: (BOOL) animate;
- (void) addTrackers;
- (void) removeTrackers;
@ -174,10 +174,9 @@ typedef enum
}
//prepare for animating peer table and web seed table
fWebSeedTableHidden = NO;
fPeerTableHeight = [[fPeerTable enclosingScrollView] frame].size.height;
fWebSeedTableHeight = [[fWebSeedTable enclosingScrollView] frame].size.height;
fWebSeedTableOrigin = [[fWebSeedTable enclosingScrollView] frame].origin.y;
NSRect webSeedTableFrame = [[fWebSeedTable enclosingScrollView] frame];
fWebSeedTableHeight = webSeedTableFrame.size.height;
fSpaceBetweenWebSeedAndPeer = webSeedTableFrame.origin.y - NSMaxY([[fPeerTable enclosingScrollView] frame]);
[self setWebSeederTableHidden: YES animate: NO];
@ -1440,42 +1439,47 @@ typedef enum
}
}
- (void) setWebSeederTableHidden: (BOOL) hidden animate: (BOOL) animate
- (void) setWebSeederTableHidden: (BOOL) hide animate: (BOOL) animate
{
if (hidden == fWebSeedTableHidden)
return;
fWebSeedTableHidden = hidden;
if (![NSApp isOnLeopardOrBetter])
animate = NO;
NSRect webSeedFrame = [[fWebSeedTable enclosingScrollView] frame];
NSRect peerFrame = [[fPeerTable enclosingScrollView] frame];
if (hidden)
if (hide)
{
float webSeedFrameMaxY = fWebSeedTableHeight + fWebSeedTableOrigin;
peerFrame.size.height = webSeedFrameMaxY - peerFrame.origin.y;
webSeedFrame.origin.y = webSeedFrameMaxY;
float webSeedFrameMaxY = NSMaxY(webSeedFrame);
webSeedFrame.size.height = 0;
webSeedFrame.origin.y = webSeedFrameMaxY;
peerFrame.size.height = webSeedFrameMaxY - peerFrame.origin.y;
}
else
{
peerFrame.size.height = fPeerTableHeight;
webSeedFrame.origin.y -= fWebSeedTableHeight - webSeedFrame.size.height;
webSeedFrame.size.height = fWebSeedTableHeight;
webSeedFrame.origin.y = fWebSeedTableOrigin;
}NSLog(@"%f", webSeedFrame.size.height);
peerFrame.size.height = (webSeedFrame.origin.y - fSpaceBetweenWebSeedAndPeer) - peerFrame.origin.y;
}
//actually resize tables
[NSAnimationContext beginGrouping];
[[[fWebSeedTable enclosingScrollView] animator] setFrame: webSeedFrame];
[[[fPeerTable enclosingScrollView] animator] setFrame: peerFrame];
[NSAnimationContext endGrouping];
if (animate)
{
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration: 0.2];
[[[fWebSeedTable enclosingScrollView] animator] setFrame: webSeedFrame];
[[[fPeerTable enclosingScrollView] animator] setFrame: peerFrame];
[NSAnimationContext endGrouping];
}
else
{
[[fWebSeedTable enclosingScrollView] setFrame: webSeedFrame];
[[fPeerTable enclosingScrollView] setFrame: peerFrame];
}
}
- (NSArray *) peerSortDescriptors