diff --git a/macosx/English.lproj/InfoWindow.xib b/macosx/English.lproj/InfoWindow.xib index d4a13fd49..ac99185db 100644 --- a/macosx/English.lproj/InfoWindow.xib +++ b/macosx/English.lproj/InfoWindow.xib @@ -2237,7 +2237,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA 256 - {338, 168} + {338, 172} YES @@ -3859,7 +3859,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW NO - {{1, 17}, {338, 168}} + {{1, 17}, {338, 172}} @@ -3902,7 +3902,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW - {{10, 77}, {340, 186}} + {{10, 77}, {340, 190}} 562 @@ -3913,38 +3913,38 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW AAAAAAAAAABBgAAAQYAAAA - + 266 YES - - + + 2304 YES - - + + 256 {338, 48} - + YES - - + + 256 {338, 17} - - + + - - + + -2147483392 {{-22, 0}, {12, 17}} - + YES - + Address 3.350000e+02 1.000000e+01 @@ -3957,18 +3957,18 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW - + 337772096 2048 Text Cell - + 1 YES - + 3.000000e+00 @@ -3984,57 +3984,57 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW {{1, 17}, {338, 48}} - - - + + + 4 - - + + -2147483392 {{328, 17}, {11, 96}} - + 256 - + _doScroller: 8.658537e-01 - - + + -2147483392 {{1, 113}, {327, 11}} - + 257 - + _doScroller: 8.387097e-01 - - + + 2304 YES - + {{1, 0}, {338, 17}} - - - + + + 4 - + {{10, 271}, {340, 66}} - + 562 - - - - - + + + + + AAAAAAAAAABBgAAAQYAAAA @@ -5832,14 +5832,14 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW fWebSeedTable - + 1783 dataSource - + 1784 @@ -5847,7 +5847,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW delegate - + 1785 @@ -6586,7 +6586,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW - + Peers @@ -8112,53 +8112,53 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW 1766 - + YES - - - - + + + + 1767 - - + + 1768 - - + + 1769 - - + + 1770 - + YES - + - + 1772 - + YES - + - + 1781 - - + + diff --git a/macosx/InfoWindowController.h b/macosx/InfoWindowController.h index 6a6c4193d..b5c159dd3 100644 --- a/macosx/InfoWindowController.h +++ b/macosx/InfoWindowController.h @@ -64,6 +64,8 @@ IBOutlet NSTextView * fErrorMessageView; IBOutlet PiecesView * fPiecesView; IBOutlet NSSegmentedControl * fPiecesControl; + BOOL fWebSeedTableHidden; + float fPeerTableHeight, fWebSeedTableOrigin; IBOutlet FileOutlineController * fFileController; diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 80f88ac02..2dd2fc87c 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -72,6 +72,7 @@ typedef enum - (NSView *) tabViewForTag: (int) tag; - (NSArray *) peerSortDescriptors; +- (void) setWebSeederTableHidden: (BOOL) hidden animate: (BOOL) animate; - (void) addTrackers; - (void) removeTrackers; @@ -172,6 +173,13 @@ typedef enum [fTrackerAddRemoveControl setLabel: @"-" forSegment: TRACKER_REMOVE_TAG]; } + //prepare for animating peer table and web seed table + fWebSeedTableHidden = NO; + fPeerTableHeight = [[fPeerTable enclosingScrollView] frame].size.height; + fWebSeedTableOrigin = [[fWebSeedTable enclosingScrollView] frame].origin.y; + + [self setWebSeederTableHidden: YES animate: NO]; + //set blank inspector [self setInfoForTorrents: [NSArray array]]; @@ -359,6 +367,7 @@ typedef enum [fWebSeeds release]; fWebSeeds = nil; + [self setWebSeederTableHidden: YES animate: YES]; [fTrackers release]; fTrackers = nil; @@ -367,7 +376,7 @@ typedef enum [fTrackerAddRemoveControl setEnabled: NO forSegment: TRACKER_REMOVE_TAG]; } else - { + { Torrent * torrent = [fTorrents objectAtIndex: 0]; [fFileController setTorrent: torrent]; @@ -447,6 +456,7 @@ typedef enum //get webseers for table [fWebSeeds release]; fWebSeeds = [[torrent webSeeders] retain]; + [self setWebSeederTableHidden: [fWebSeeds count] == 0 animate: YES]; //get trackers for table [fTrackers release]; @@ -1429,6 +1439,44 @@ typedef enum } } +- (void) setWebSeederTableHidden: (BOOL) hidden 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) + { + float webSeedFrameMaxY = NSMaxY(webSeedFrame); + peerFrame.size.height = webSeedFrameMaxY - peerFrame.origin.y; + + webSeedFrame.origin.y = webSeedFrameMaxY; + webSeedFrame.size.height = 0; + } + else + { + peerFrame.size.height = fPeerTableHeight; + + webSeedFrame.size.height = webSeedFrame.origin.y - fWebSeedTableOrigin; + webSeedFrame.origin.y = fWebSeedTableOrigin; + } + + //actually resize tables + [NSAnimationContext beginGrouping]; + + [[[fWebSeedTable enclosingScrollView] animator] setFrame: webSeedFrame]; + [[[fPeerTable enclosingScrollView] animator] setFrame: peerFrame]; + + [NSAnimationContext endGrouping]; +} + - (NSArray *) peerSortDescriptors { NSMutableArray * descriptors = [NSMutableArray arrayWithCapacity: 2]; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 124172f5e..2c4760443 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1016,7 +1016,6 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * return peerDicts; } -#warning store? - (NSArray *) webSeeders { int webSeedCount = fInfo->webseedCount, i;