avoid resizing the search field if unnecessary

This commit is contained in:
Mitchell Livingston 2007-05-29 04:53:05 +00:00
parent fd8cccf789
commit 2c25d1019b
1 changed files with 12 additions and 9 deletions

View File

@ -2977,22 +2977,25 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
- (void) checkSearchFilter: (NSNotification *) notification - (void) checkSearchFilter: (NSNotification *) notification
{ {
//size search filter to not overlap buttons //size search filter to not overlap buttons
float pointX = NSMaxX([fPauseFilterButton frame]) + 2.0; float pointX = NSMaxX([fPauseFilterButton frame]) + 5.0;
NSRect oldFrame = [fSearchFilterField frame], NSRect oldFrame = [fSearchFilterField frame],
frame = NSMakeRect(pointX, oldFrame.origin.y, NSMaxX(oldFrame) - pointX, oldFrame.size.height); frame = NSMakeRect(pointX, oldFrame.origin.y, NSMaxX(oldFrame) - pointX, oldFrame.size.height);
//make sure it is not too long BOOL show;
if (frame.size.width > SEARCH_FILTER_MAX_WIDTH) if (show = (frame.size.width >= SEARCH_FILTER_MIN_WIDTH))
{ {
float different = frame.size.width - SEARCH_FILTER_MAX_WIDTH; //make sure it is not too long
frame.origin.x += different; if (frame.size.width > SEARCH_FILTER_MAX_WIDTH)
frame.size.width -= different; {
float different = frame.size.width - SEARCH_FILTER_MAX_WIDTH;
frame.origin.x += different;
frame.size.width -= different;
}
[fSearchFilterField setFrame: frame];
} }
[fSearchFilterField setFrame: frame];
//hide search filter if it overlaps filter buttons //hide search filter if it overlaps filter buttons
[fSearchFilterField setHidden: frame.size.width < SEARCH_FILTER_MIN_WIDTH]; [fSearchFilterField setHidden: !show];
} }
- (void) linkHomepage: (id) sender - (void) linkHomepage: (id) sender