diff options
author | rowanbeentje <rowan@beent.je> | 2012-08-01 00:17:54 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-08-01 00:17:54 +0000 |
commit | e6e2fe26d29659d805628114a0c1cd5f9d7ab5b4 (patch) | |
tree | dd125ddd17a68d07495d8935178f219a4e0e081a /Source | |
parent | ed16bf078249b4b474a231ba487702f4f7d9a13b (diff) | |
download | sequelpro-e6e2fe26d29659d805628114a0c1cd5f9d7ab5b4.tar.gz sequelpro-e6e2fe26d29659d805628114a0c1cd5f9d7ab5b4.tar.bz2 sequelpro-e6e2fe26d29659d805628114a0c1cd5f9d7ab5b4.zip |
- Remove all BWToolKit elements in the connection view, replacing with standard equivalents and SPSplitView
- Replace the "Add" action menu on the connection view with two buttons for easier use and to avoid having to set up more popup buttons
- Improve SPSplitView's handling of delegates set through code
- Update localisable strings
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPConnectionController.h | 10 | ||||
-rw-r--r-- | Source/SPConnectionController.m | 14 | ||||
-rw-r--r-- | Source/SPConnectionControllerDelegate.m | 9 | ||||
-rw-r--r-- | Source/SPConnectionControllerInitializer.m | 7 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 1 | ||||
-rw-r--r-- | Source/SPSplitView.m | 16 |
6 files changed, 38 insertions, 19 deletions
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h index be417aea..07899f5d 100644 --- a/Source/SPConnectionController.h +++ b/Source/SPConnectionController.h @@ -38,10 +38,10 @@ SPSSHTunnel, SPTreeNode, SPFavoritesOutlineView, - SPMySQLConnection + SPMySQLConnection, + SPSplitView #ifndef SP_REFACTOR /* class decl */ ,SPKeychain, - BWAnchoredButtonBar, SPFavoriteNode #endif ; @@ -112,12 +112,9 @@ NSMutableArray *nibObjectsToRelease; IBOutlet NSView *connectionView; - IBOutlet NSSplitView *connectionSplitView; + IBOutlet SPSplitView *connectionSplitView; IBOutlet NSScrollView *connectionDetailsScrollView; IBOutlet NSTextField *connectionInstructionsTextField; -#ifndef SP_REFACTOR - IBOutlet BWAnchoredButtonBar *connectionSplitViewButtonBar; -#endif IBOutlet SPFavoritesOutlineView *favoritesOutlineView; IBOutlet NSWindow *errorDetailWindow; @@ -223,6 +220,7 @@ - (IBAction)showHelp:(id)sender; - (IBAction)updateSSLInterface:(id)sender; - (IBAction)updateKeyLocationFileVisibility:(id)sender; +- (void)updateSplitViewSize; - (void)resizeTabViewToConnectionType:(NSUInteger)theType animating:(BOOL)animate; - (IBAction)sortFavorites:(id)sender; - (IBAction)reverseSortFavorites:(NSMenuItem *)sender; diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index d7aad6f7..d6078f1d 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -412,6 +412,20 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [keySelectionPanel setShowsHiddenFiles:[prefs boolForKey:SPHiddenKeyFileVisibilityKey]]; } +/** + * Update the interface in response to external split view size changes. + */ +- (void)updateSplitViewSize +{ + if ([dbDocument getConnection]) { + return; + } + + [connectionSplitView setDelegate:nil]; + [connectionSplitView setPosition:[[[databaseConnectionView subviews] objectAtIndex:0] frame].size.width ofDividerAtIndex:0]; + [connectionSplitView setDelegate:self]; +} + #pragma mark - #pragma mark Connection details interaction and display diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m index 286dcea6..d8f82a02 100644 --- a/Source/SPConnectionControllerDelegate.m +++ b/Source/SPConnectionControllerDelegate.m @@ -65,18 +65,15 @@ static NSString *SPDatabaseImage = @"database-small"; #ifndef SP_REFACTOR -- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(NSInteger)dividerIndex -{ - return [connectionSplitViewButtonBar splitView:splitView additionalEffectiveRectOfDividerAtIndex:dividerIndex]; -} - /** * When the split view is resized, trigger a resize in the hidden table * width as well, to keep the connection view and connected view in sync. */ - (void)splitViewDidResizeSubviews:(NSNotification *)notification { - [databaseConnectionView setPosition:[[[connectionSplitView subviews] objectAtIndex:0] frame].size.width ofDividerAtIndex:0]; + if (initComplete) { + [databaseConnectionView setPosition:[[[connectionSplitView subviews] objectAtIndex:0] frame].size.width ofDividerAtIndex:0]; + } } #endif diff --git a/Source/SPConnectionControllerInitializer.m b/Source/SPConnectionControllerInitializer.m index e6f1ff71..cee0770a 100644 --- a/Source/SPConnectionControllerInitializer.m +++ b/Source/SPConnectionControllerInitializer.m @@ -37,6 +37,7 @@ #import "SPFavoriteNode.h" #import "SPGroupNode.h" #import "SPDatabaseViewController.h" +#import "SPSplitView.h" static NSString *SPConnectionViewNibName = @"ConnectionView"; @@ -93,9 +94,11 @@ static NSString *SPConnectionViewNibName = @"ConnectionView"; [databaseConnectionView setHidden:YES]; [connectionView setFrame:[databaseConnectionView frame]]; [databaseConnectionSuperview addSubview:connectionView]; - [connectionSplitView setPosition:[[dbDocument valueForKey:@"dbTablesTableView"] frame].size.width ofDividerAtIndex:0]; - [connectionSplitView setDelegate:self]; + // Set up the splitview + [connectionSplitView setMinSize:80.f ofSubviewAtIndex:0]; + [connectionSplitView setMinSize:445.f ofSubviewAtIndex:1]; + // Generic folder image for use in the outline view's groups folderImage = [[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)] retain]; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index f32445a3..714a58c1 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -5585,6 +5585,7 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; - (void)splitViewDidResizeSubviews:(NSNotification *)notification { [self updateChooseDatabaseToolbarItemWidth]; + [connectionController updateSplitViewSize]; } - (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex diff --git a/Source/SPSplitView.m b/Source/SPSplitView.m index b3c067d5..d8b6f8de 100644 --- a/Source/SPSplitView.m +++ b/Source/SPSplitView.m @@ -96,11 +96,6 @@ [super awakeFromNib]; } - delegate = [super delegate]; - [super setDelegate:self]; - - [self adjustSubviews]; - [collapseToggleButton setState:(collapsibleSubviewCollapsed?NSOnState:NSOffState)]; } @@ -117,6 +112,14 @@ } #pragma mark - +#pragma mark Delegate management + +- (void)setDelegate:(NSObject *)aDelegate +{ + delegate = aDelegate; +} + +#pragma mark - #pragma mark Collapsible subview management /** @@ -686,6 +689,9 @@ viewMinimumSizes = [[NSMutableArray alloc] initWithCapacity:l]; viewMaximumSizes = [[NSMutableArray alloc] initWithCapacity:l]; [self _ensureDefaultSubviewSizesToIndex:l-1]; + + delegate = [super delegate]; + [super setDelegate:self]; } /** |