From 74dc396081a0a721105f3e95bd9b6f1f036d575a Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 18 Apr 2009 20:05:38 +0000 Subject: Make SPPreferenceController the delegate of the favorites manager splitview and implement maximum and minimum split view sizes. --- Source/SPPreferenceController.m | 60 ++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'Source') diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 8ea4e7f0..0d44a373 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -217,7 +217,6 @@ [prefs setObject:[NSNumber numberWithInt:currentVersionNumber] forKey:@"LastUsedVersion"]; } - #pragma mark - #pragma mark IBAction methods @@ -319,7 +318,6 @@ } - // ------------------------------------------------------------------------------- // updateDefaultFavorite: // ------------------------------------------------------------------------------- @@ -335,7 +333,6 @@ } } - #pragma mark - #pragma mark Toolbar item IBAction methods @@ -505,7 +502,6 @@ return YES; } - #pragma mark - #pragma mark TableView delegate methods @@ -599,16 +595,24 @@ return [NSArray arrayWithObjects:PREFERENCE_TOOLBAR_GENERAL, PREFERENCE_TOOLBAR_TABLES, PREFERENCE_TOOLBAR_FAVORITES, PREFERENCE_TOOLBAR_NOTIFICATIONS, PREFERENCE_TOOLBAR_AUTOUPDATE, PREFERENCE_TOOLBAR_NETWORK, nil]; } +#pragma mark - +#pragma mark SplitView delegate methods + // ------------------------------------------------------------------------------- -// dealloc +// splitView:constrainMaxCoordinate:ofSubviewAt: // ------------------------------------------------------------------------------- -- (void)dealloc +- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset { - [keychain release], keychain = nil; - - [super dealloc]; + return (proposedMax - 220); } +// ------------------------------------------------------------------------------- +// splitView:constrainMinCoordinate:ofSubviewAt: +// ------------------------------------------------------------------------------- +- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset +{ + return (proposedMin + 100); +} #pragma mark - #pragma mark TextField delegate methods @@ -667,7 +671,6 @@ return YES; } - #pragma mark - #pragma mark Window delegate methods @@ -677,17 +680,14 @@ // ------------------------------------------------------------------------------- - (void)windowWillClose:(NSNotification *)notification { - // Mark the currently selected field in the window as having finished editing, to trigger saves. if ([preferencesWindow firstResponder]) [preferencesWindow endEditingFor:[preferencesWindow firstResponder]]; } - #pragma mark - #pragma mark Other - // ------------------------------------------------------------------------------- // updateDefaultFavoritePopup: // @@ -728,9 +728,17 @@ [favoritesController setSelectedObjects:favorites]; } -@end - +// ------------------------------------------------------------------------------- +// dealloc +// ------------------------------------------------------------------------------- +- (void)dealloc +{ + [keychain release], keychain = nil; + + [super dealloc]; +} +@end #pragma mark - @@ -811,18 +819,20 @@ - (void)_resizeWindowForContentView:(NSView *)view { // remove all current views - NSEnumerator *en = [[[preferencesWindow contentView] subviews] objectEnumerator]; - NSView *subview; - while (subview = [en nextObject]) { - [subview removeFromSuperview]; - } + NSEnumerator *en = [[[preferencesWindow contentView] subviews] objectEnumerator]; + NSView *subview; + + while (subview = [en nextObject]) + { + [subview removeFromSuperview]; + } - // resize window - [preferencesWindow resizeForContentView:view titleBarVisible:YES]; + // resize window + [preferencesWindow resizeForContentView:view titleBarVisible:YES]; - // add view - [[preferencesWindow contentView] addSubview:view]; - [view setFrameOrigin:NSMakePoint(0, 0)]; + // add view + [[preferencesWindow contentView] addSubview:view]; + [view setFrameOrigin:NSMakePoint(0, 0)]; } @end -- cgit v1.2.3