aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionController.h7
-rw-r--r--Source/SPConnectionController.m3
-rw-r--r--Source/TableDocument.h1
-rw-r--r--Source/TableDocument.m3
-rw-r--r--Source/TablesList.h9
-rw-r--r--Source/TablesList.m25
6 files changed, 44 insertions, 4 deletions
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h
index 0ab3cc2e..f9af5894 100644
--- a/Source/SPConnectionController.h
+++ b/Source/SPConnectionController.h
@@ -37,6 +37,12 @@ enum spconnection_types
SP_CONNECTION_SSHTUNNEL = 2
};
+@class BWAnchoredButtonBar;
+
+@interface NSObject (BWAnchoredButtonBar)
+- (void)setSplitViewDelegate:(id)splitViewDelegate;
+@end
+
@interface SPConnectionController : NSObject
{
TableDocument *tableDocument;
@@ -70,6 +76,7 @@ enum spconnection_types
IBOutlet NSView *connectionView;
IBOutlet NSSplitView *connectionSplitView;
+ IBOutlet BWAnchoredButtonBar *connectionSplitViewButtonBar;
IBOutlet NSTableView *favoritesTable;
IBOutlet NSWindow *errorDetailWindow;
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 272808a5..d52ca7d3 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -73,6 +73,7 @@
[connectionView setFrame:[contentView frame]];
[[documentWindow contentView] addSubview:connectionView];
[connectionSplitView setPosition:[[tableDocument valueForKey:@"dbTablesTableView"] frame].size.width ofDividerAtIndex:0];
+ [connectionSplitViewButtonBar setSplitViewDelegate:self];
// Disable the toolbar icons
NSArray *toolbarItems = [[documentWindow toolbar] items];
@@ -819,8 +820,6 @@
/**
* 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 synch.
- * TODO: this isn't functional until a BWToolkit bug is fixed - see
- * http://bitbucket.org/bwalkin/bwtoolkit/issue/50/bwsplitview-and-splitviewdidresizesubviews
*/
- (void) splitViewDidResizeSubviews:(NSNotification *)aNotification
{
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 6b3acaef..5cd9dc6c 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -68,6 +68,7 @@
IBOutlet NSTabView *tableTabView;
IBOutlet NSTableView *tableInfoTable;
+ IBOutlet NSButton *tableInfoCollapseButton;
IBOutlet NSSplitView *tableListSplitter;
IBOutlet NSSplitView *contentViewSplitter;
IBOutlet id sidebarGrabber;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index c3a5b3da..7970d0aa 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -2178,8 +2178,7 @@
- (void)splitViewDidResizeSubviews:(NSNotification *)notification
{
- if ([notification object] == contentViewSplitter)
- [self updateChooseDatabaseToolbarItemWidth];
+ [self updateChooseDatabaseToolbarItemWidth];
}
- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(int)dividerIndex
diff --git a/Source/TablesList.h b/Source/TablesList.h
index bd1e36e9..6210f9e7 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -37,6 +37,12 @@ enum sp_table_types
@class CMMCResult, MCPConnection;
+@interface NSObject (NSSplitView)
+- (NSView *)collapsibleSubview;
+- (IBAction)toggleCollapse:(id)sender;
+- (void)setCollapsibleSubviewCollapsed:(BOOL)flag;
+@end
+
@interface TablesList : NSObject
{
IBOutlet id tableDocumentInstance;
@@ -67,6 +73,8 @@ enum sp_table_types
IBOutlet id renameTableButton;
IBOutlet id truncateTableButton;
IBOutlet id truncateTableContextButton;
+ IBOutlet NSSplitView *tableListSplitView;
+ IBOutlet NSButton *tableInfoCollapseButton;
IBOutlet NSMenuItem *removeTableMenuItem;
IBOutlet NSMenuItem *duplicateTableMenuItem;
@@ -94,6 +102,7 @@ enum sp_table_types
- (IBAction)copyTable:(id)sender;
- (IBAction)renameTable:(id)sender;
- (IBAction)truncateTable:(id)sender;
+- (IBAction)togglePaneCollapse:(id)sender;
// copyTableSheet methods
- (IBAction)closeCopyTableSheet:(id)sender;
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 10be699a..a8781128 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -705,6 +705,15 @@
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"truncateTable"];
}
+/**
+ * Toggle whether the splitview is collapsed.
+ */
+- (IBAction)togglePaneCollapse:(id)sender
+{
+ [tableListSplitView toggleCollapse:sender];
+ [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:([tableInfoCollapseButton state] == NSOffState)] forKey:@"TableInformationPanelCollapsed"];
+}
+
#pragma mark Alert sheet methods
/**
@@ -1660,6 +1669,22 @@
}
/**
+ * Standard awakeFromNib method for interface loading.
+ */
+- (void)awakeFromNib
+{
+
+ // Collapse the table information pane if preference to do so is set
+ if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"TableInformationPanelCollapsed"] boolValue]
+ && [tableListSplitView collapsibleSubview]) {
+ [tableInfoCollapseButton setNextState];
+ [tableListSplitView setValue:[NSNumber numberWithFloat:[tableListSplitView collapsibleSubview].frame.size.height] forKey:@"uncollapsedSize"];
+ [[tableListSplitView collapsibleSubview] setFrameSize:NSMakeSize([tableListSplitView collapsibleSubview].frame.size.width, 0)];
+ [tableListSplitView setCollapsibleSubviewCollapsed:YES];
+ }
+}
+
+/**
* Standard dealloc method.
*/
- (void)dealloc