Resize window when filtering with auto resize enabled.

This commit is contained in:
Mitchell Livingston 2006-07-23 14:42:54 +00:00
parent d61d0cd56e
commit 4a5fb32e62
2 changed files with 10 additions and 5 deletions

View File

@ -26,7 +26,7 @@
@implementation BarButton @implementation BarButton
//height of button should be made 17.0 //height of button should be 17.0
- (id) initWithCoder: (NSCoder *) coder - (id) initWithCoder: (NSCoder *) coder
{ {
if ((self = [super initWithCoder: coder])) if ((self = [super initWithCoder: coder]))

View File

@ -340,6 +340,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
fAutoImportedNames = [[NSMutableArray alloc] init]; fAutoImportedNames = [[NSMutableArray alloc] init];
[self applyFilter: nil]; [self applyFilter: nil];
#warning repetitive
[self setAutoSize: nil]; [self setAutoSize: nil];
[fWindow makeKeyAndOrderFront: nil]; [fWindow makeKeyAndOrderFront: nil];
@ -526,8 +528,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
int count = [fTorrents count]; int count = [fTorrents count];
[fTotalTorrentsField setStringValue: [NSString stringWithFormat: [fTotalTorrentsField setStringValue: [NSString stringWithFormat:
@"%d Transfer%s", count, count == 1 ? "" : "s"]]; @"%d Transfer%s", count, count == 1 ? "" : "s"]];
[self setWindowSizeToFit];
} }
//called on by applescript //called on by applescript
@ -728,10 +728,12 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[[tempTorrents objectAtIndex: i] setOrderValue: i]; [[tempTorrents objectAtIndex: i] setOrderValue: i];
} }
[self torrentNumberChanged];
[self updateUI: nil]; [self updateUI: nil];
[self setWindowSizeToFit];
[fTableView deselectAll: nil]; [fTableView deselectAll: nil];
[self torrentNumberChanged];
[self updateTorrentHistory]; [self updateTorrentHistory];
} }
@ -1127,6 +1129,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fTableView selectRowIndexes: indexSet byExtendingSelection: NO]; [fTableView selectRowIndexes: indexSet byExtendingSelection: NO];
[indexSet release]; [indexSet release];
} }
[self setWindowSizeToFit];
} }
//resets filter and sorts torrents //resets filter and sorts torrents
@ -2118,6 +2122,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
return frame; return frame;
} }
#warning remove?
- (void) setAutoSize: (NSNotification *) notification - (void) setAutoSize: (NSNotification *) notification
{ {
[self setWindowSizeToFit]; [self setWindowSizeToFit];
@ -2126,7 +2131,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
- (void) setWindowSizeToFit - (void) setWindowSizeToFit
{ {
if ([fDefaults boolForKey: @"AutoSize"]) if ([fDefaults boolForKey: @"AutoSize"])
[fWindow setFrame: [self windowFrameForAmount: [fTorrents count]] display: YES animate: YES]; [fWindow setFrame: [self windowFrameForAmount: [fFilteredTorrents count]] display: YES animate: YES];
} }
- (NSRect) windowFrameForAmount: (int) amount - (NSRect) windowFrameForAmount: (int) amount