aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-07-26 12:40:34 +0000
committerrowanbeentje <rowan@beent.je>2009-07-26 12:40:34 +0000
commit84fdbe2ab1489786031973997f8413cd2f137375 (patch)
tree6c2582eb2eb4dea292c53f621867498f0a8fbba6
parentb9519867ed83d228e16937ae77c1adbba1676c79 (diff)
downloadsequelpro-84fdbe2ab1489786031973997f8413cd2f137375.tar.gz
sequelpro-84fdbe2ab1489786031973997f8413cd2f137375.tar.bz2
sequelpro-84fdbe2ab1489786031973997f8413cd2f137375.zip
- Tweak table information panel to show scrollbars if it's resized to a position that would hide content
- Store collapse state of table information panel in preferences - Apply a double fix for BWSplitView/NSSplitView+BWAnchoredButtonBar not informing delegates of resizes - correctly inform original BWSplitView delegates of resizes, and allow BWAnchoredButtonBar registered delegates to recieve the original split view resize notifications. This fixes database menu resizing in synch with splitview resizing for improved/consistent look and feel.
-rw-r--r--Frameworks/BWToolkitFramework.framework/BWAnchoredButtonBar.m7
-rw-r--r--Frameworks/BWToolkitFramework.framework/BWSplitView.m6
-rw-r--r--Interfaces/English.lproj/ConnectionView.xib34
-rw-r--r--Interfaces/English.lproj/DBView.xib96
-rw-r--r--Resources/PreferenceDefaults.plist2
-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
11 files changed, 164 insertions, 29 deletions
diff --git a/Frameworks/BWToolkitFramework.framework/BWAnchoredButtonBar.m b/Frameworks/BWToolkitFramework.framework/BWAnchoredButtonBar.m
index 48f20cdb..0c49c84a 100644
--- a/Frameworks/BWToolkitFramework.framework/BWAnchoredButtonBar.m
+++ b/Frameworks/BWToolkitFramework.framework/BWAnchoredButtonBar.m
@@ -262,6 +262,13 @@ static float scaleFactor = 0.0f;
#pragma mark NSSplitView Delegate Methods
+// Forward resize events to the delegate if set and supported
+- (void) splitViewDidResizeSubviews:(NSNotification *)aNotification
+{
+ if ([splitViewDelegate respondsToSelector:@selector(splitViewDidResizeSubviews:)])
+ [splitViewDelegate splitViewDidResizeSubviews:aNotification];
+}
+
// Add the resize handle rect to the split view hot zone
- (NSRect)splitView:(NSSplitView *)aSplitView additionalEffectiveRectOfDividerAtIndex:(NSInteger)dividerIndex
{
diff --git a/Frameworks/BWToolkitFramework.framework/BWSplitView.m b/Frameworks/BWToolkitFramework.framework/BWSplitView.m
index 08164931..a3c20dbf 100644
--- a/Frameworks/BWToolkitFramework.framework/BWSplitView.m
+++ b/Frameworks/BWToolkitFramework.framework/BWSplitView.m
@@ -683,6 +683,12 @@ static float scaleFactor = 1.0f;
}
[self setNeedsDisplay:YES];
+
+ // Tell the original delegate to update if appropriate
+ if (![secondaryDelegate isKindOfClass:NSClassFromString(@"BWAnchoredButtonBar")] &&
+ [secondaryDelegate respondsToSelector:@selector(splitViewDidResizeSubviews:)]) {
+ [secondaryDelegate splitViewDidResizeSubviews:aNotification];
+ }
}
#pragma mark - Resize Subviews Delegate Method and Helper Methods
diff --git a/Interfaces/English.lproj/ConnectionView.xib b/Interfaces/English.lproj/ConnectionView.xib
index cdb71f80..2587aec9 100644
--- a/Interfaces/English.lproj/ConnectionView.xib
+++ b/Interfaces/English.lproj/ConnectionView.xib
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="5168"/>
+ <integer value="5343"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2467,6 +2467,14 @@
</object>
<int key="connectionID">5446</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">connectionSplitViewButtonBar</string>
+ <reference key="source" ref="545410097"/>
+ <reference key="destination" ref="805249222"/>
+ </object>
+ <int key="connectionID">5448</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -4008,7 +4016,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5447</int>
+ <int key="maxID">5448</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -4025,14 +4033,32 @@
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Frameworks/MCPKit/MCPFoundationKit/MCPNull.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
<string key="minorKey">Source/CMImageView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">toggleCollapse:</string>
+ <string key="NS.object.0">id</string>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/CMMCPConnection.h</string>
+ <string key="minorKey">Source/TablesList.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
@@ -4112,6 +4138,7 @@
<string>connectButton</string>
<string>connectionResizeContainer</string>
<string>connectionSplitView</string>
+ <string>connectionSplitViewButtonBar</string>
<string>connectionView</string>
<string>errorDetailText</string>
<string>errorDetailWindow</string>
@@ -4135,6 +4162,7 @@
<string>NSView</string>
<string>NSSplitView</string>
<string>NSView</string>
+ <string>NSView</string>
<string>NSTextView</string>
<string>NSWindow</string>
<string>NSTableView</string>
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 54f9e234..ac6e568b 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -8,6 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="6142"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -46,7 +47,7 @@
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{780, 480}</string>
<object class="NSView" key="NSWindowView" id="579726586">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -345,7 +346,7 @@
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="192579410"/>
<reference key="NSNextKeyView" ref="685057119"/>
- <int key="NSsFlags">512</int>
+ <int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="245346414"/>
<reference key="NSHScroller" ref="353686052"/>
<reference key="NSContentView" ref="685057119"/>
@@ -2524,6 +2525,29 @@
<object class="NSTextView" id="1055190999">
<reference key="NSNextResponder" ref="1072692119"/>
<int key="NSvFlags">6418</int>
+ <object class="NSMutableSet" key="NSDragTypes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="set.sortedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>Apple HTML pasteboard type</string>
+ <string>Apple PDF pasteboard type</string>
+ <string>Apple PICT pasteboard type</string>
+ <string>Apple PNG pasteboard type</string>
+ <string>Apple URL pasteboard type</string>
+ <string>CorePasteboardFlavorType 0x6D6F6F76</string>
+ <string>CorePasteboardFlavorType 0x75726C20</string>
+ <string>NSColor pasteboard type</string>
+ <string>NSFilenamesPboardType</string>
+ <string>NSStringPboardType</string>
+ <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
+ <string>NeXT RTFD pasteboard type</string>
+ <string>NeXT Rich Text Format v1.0 pasteboard type</string>
+ <string>NeXT TIFF v4.0 pasteboard type</string>
+ <string>NeXT font pasteboard type</string>
+ <string>NeXT ruler pasteboard type</string>
+ <string>WebURLsWithTitlesPboardType</string>
+ </object>
+ </object>
<string key="NSFrameSize">{688, 14}</string>
<reference key="NSSuperview" ref="1072692119"/>
<object class="NSTextContainer" key="NSTextContainer" id="326170846">
@@ -2899,7 +2923,7 @@
<reference key="NSControlView" ref="363916571"/>
<int key="NSButtonFlags">-2042609409</int>
<int key="NSButtonFlags2">35</int>
- <object class="NSCustomResource" key="NSNormalImage">
+ <object class="NSCustomResource" key="NSNormalImage" id="193133054">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_action</string>
</object>
@@ -2914,10 +2938,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">button_action</string>
- </object>
+ <reference key="NSImage" ref="193133054"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="984501775"/>
</object>
@@ -4351,6 +4372,7 @@
</object>
</object>
<string key="NSFrameSize">{944, 550}</string>
+ <reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{780, 502}</string>
@@ -13976,14 +13998,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">toggleCollapse:</string>
- <reference key="source" ref="298095498"/>
- <reference key="destination" ref="57416393"/>
- </object>
- <int key="connectionID">6161</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
<string key="label">updateTables:</string>
<reference key="source" ref="438574515"/>
<reference key="destination" ref="595750628"/>
@@ -14346,6 +14360,30 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">6256</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">tableListSplitView</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="298095498"/>
+ </object>
+ <int key="connectionID">6257</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">togglePaneCollapse:</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="57416393"/>
+ </object>
+ <int key="connectionID">6258</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">tableInfoCollapseButton</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="57416393"/>
+ </object>
+ <int key="connectionID">6259</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -22560,8 +22598,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{239, 307}, {944, 550}}</string>
- <string>{{239, 307}, {944, 550}}</string>
+ <string>{{177, 306}, {944, 550}}</string>
+ <string>{{177, 306}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -23526,7 +23564,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6256</int>
+ <int key="maxID">6259</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -23782,6 +23820,17 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">toggleCollapse:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="197237725">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/TablesList.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSTextView</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -24637,6 +24686,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>copyTable:</string>
<string>removeTable:</string>
<string>renameTable:</string>
+ <string>togglePaneCollapse:</string>
<string>truncateTable:</string>
<string>updateTables:</string>
</object>
@@ -24650,6 +24700,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -24680,6 +24731,8 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>tableDocumentInstance</string>
<string>tableDumpInstance</string>
<string>tableEncodingButton</string>
+ <string>tableInfoCollapseButton</string>
+ <string>tableListSplitView</string>
<string>tableNameField</string>
<string>tableRenameField</string>
<string>tableRenameSheet</string>
@@ -24718,6 +24771,8 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>NSButton</string>
+ <string>NSSplitView</string>
<string>id</string>
<string>id</string>
<string>id</string>
@@ -24731,10 +24786,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
</object>
</object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/TablesList.h</string>
- </object>
+ <reference key="sourceIdentifier" ref="197237725"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">TablesList</string>
diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist
index 55ef1071..644a6db1 100644
--- a/Resources/PreferenceDefaults.plist
+++ b/Resources/PreferenceDefaults.plist
@@ -76,6 +76,8 @@
<true/>
<key>LastFavoriteIndex</key>
<integer>0</integer>
+ <key>TableInformationPanelCollapsed</key>
+ <false/>
<key>ConsoleEnableLogging</key>
<true/>
<key>ConsoleShowTimestamps</key>
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