aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2009-06-10 11:25:33 +0000
committeravenjamin <avenjamin@gmail.com>2009-06-10 11:25:33 +0000
commit65ad99e8fdbce63bcf65151d5f77403683959349 (patch)
tree969beaba0b5058f39d9668f67b3a9352806c55ad /Source
parent33f0e7a530714b3f95ef45860565934528b2f575 (diff)
downloadsequelpro-65ad99e8fdbce63bcf65151d5f77403683959349.tar.gz
sequelpro-65ad99e8fdbce63bcf65151d5f77403683959349.tar.bz2
sequelpro-65ad99e8fdbce63bcf65151d5f77403683959349.zip
- Table Info pane now has fixed height
- Table Info pane is collapsable - Export Controller code cleanup
Diffstat (limited to 'Source')
-rw-r--r--Source/SPExportController.m13
-rw-r--r--Source/SPTableInfo.m9
-rw-r--r--Source/TableDocument.h3
-rw-r--r--Source/TableDocument.m52
4 files changed, 70 insertions, 7 deletions
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index d0cc34f9..bd72c9d2 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -32,10 +32,17 @@
-(void)export
{
- if ([NSBundle loadNibNamed:@"ExportDialog" owner:self]) {
- [self loadTables];
- [NSApp beginSheet:exportWindow modalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
+ if (!exportWindow) {
+ [NSBundle loadNibNamed:@"ExportDialog" owner:self];
}
+
+ [self loadTables];
+
+ [NSApp beginSheet:exportWindow
+ modalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
+ contextInfo:nil];
}
- (IBAction)closeSheet:(id)sender
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index e9f3e3a1..9295aa38 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -159,6 +159,12 @@
return [info objectAtIndex:rowIndex];
}
+- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
+{
+ return (row == 0 ? 25 : [tableView rowHeight]);
+}
+
+
- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
{
// row 1 and 6 should be editable - ie be able to rename the table and change the auto_increment value.
@@ -176,9 +182,12 @@
if ((rowIndex > 0) && [[aTableColumn identifier] isEqualToString:@"info"]) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-property"]];
[(ImageAndTextCell*)aCell setIndentationLevel:1];
+ [(ImageAndTextCell*)aCell setDrawsBackground:NO];
} else {
[(ImageAndTextCell*)aCell setImage:nil];
[(ImageAndTextCell*)aCell setIndentationLevel:0];
+ //[(ImageAndTextCell*)aCell setDrawsBackground:YES];
+ //[(ImageAndTextCell*)aCell setBackgroundColor:[NSColor colorWithDeviceRed:0.894 green:0.917 blue:0.945 alpha:1]];
}
}
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 1a718b32..a7ba9d01 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -81,6 +81,9 @@
IBOutlet id variablesTableView;
IBOutlet NSTabView *tableTabView;
+ IBOutlet NSTableView *tableInfoTable;
+ IBOutlet NSSplitView *tableListSplitter;
+ IBOutlet NSSplitView *contentViewSplitter;
IBOutlet id sidebarGrabber;
IBOutlet NSTextView *customQueryTextView;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 9a7f863c..56ca2422 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -109,6 +109,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
// Hide the tabs in the tab view (we only show them to allow switching tabs in interface builder)
[tableTabView setTabViewType:NSNoTabsNoBorder];
+ [tableListSplitter setDividerStyle:NSSplitViewDividerStyleThin];
}
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
@@ -2341,7 +2342,8 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
*/
- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview
{
- return NO;
+
+ return subview == [[tableInfoTable superview] superview];
}
/**
@@ -2349,7 +2351,12 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
*/
- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
{
- return proposedMax - 600;
+ if (sender == contentViewSplitter) {
+ return 300;
+ } else {
+ //
+ return proposedMax;//([tableInfoTable rowHeight] * [tableInfoTable numberOfRows] + 25);
+ }
}
/**
@@ -2357,12 +2364,49 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
*/
- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
{
- return proposedMin + 140;
+ if (sender == tableListSplitter) {
+ return [sender frame].size.height - [sender dividerThickness] - 145;
+ //return [sender frame].size.height - [sender dividerThickness] - ([tableInfoTable rowHeight] * [tableInfoTable numberOfRows] + 25);
+ } else {
+ return 160;
+ }
+}
+
+-(void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize
+{
+ [sender adjustSubviews];
+
+ if (sender == tableListSplitter &&
+ ![tableListSplitter isSubviewCollapsed:[[sender subviews] objectAtIndex:1]]) {
+
+ CGFloat dividerThickness = [sender dividerThickness];
+ NSRect topRect = [[[sender subviews] objectAtIndex:0] frame];
+ NSRect bottomRect = [[[sender subviews] objectAtIndex:1] frame];
+ NSRect newFrame = [sender frame];
+
+ topRect.size.height = newFrame.size.height - 145 - dividerThickness;
+ topRect.size.width = newFrame.size.width;
+ topRect.origin = NSMakePoint(0, 0);
+
+ bottomRect.size.height = newFrame.size.height - topRect.size.height - dividerThickness;
+ bottomRect.size.width = newFrame.size.width;
+ bottomRect.origin.y = topRect.size.height + dividerThickness;
+
+ [[[sender subviews] objectAtIndex:0] setFrame:topRect];
+ [[[sender subviews] objectAtIndex:1] setFrame:bottomRect];
+ }
+}
+
+
+- (BOOL)splitView:(NSSplitView *)splitView shouldHideDividerAtIndex:(NSInteger)dividerIndex
+{
+ return NO;//splitView == tableListSplitter;
}
- (void)splitViewDidResizeSubviews:(NSNotification *)notification
{
- [self updateChooseDatabaseToolbarItemWidth];
+ if ([notification object] == contentViewSplitter)
+ [self updateChooseDatabaseToolbarItemWidth];
}
- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(int)dividerIndex