aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-19 22:41:33 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-19 22:41:33 +0000
commitca77ea4aa4972ddda817485b2f301f6b39ed14e3 (patch)
treecd20c5028cf55d4820f404f0e43637cbe15cf5da
parent8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9 (diff)
downloadsequelpro-ca77ea4aa4972ddda817485b2f301f6b39ed14e3.tar.gz
sequelpro-ca77ea4aa4972ddda817485b2f301f6b39ed14e3.tar.bz2
sequelpro-ca77ea4aa4972ddda817485b2f301f6b39ed14e3.zip
• some improvements for navigator
-rw-r--r--Interfaces/English.lproj/Navigator.xib15
-rw-r--r--Source/CMTextView.m2
-rw-r--r--Source/SPNavigatorController.m104
3 files changed, 76 insertions, 45 deletions
diff --git a/Interfaces/English.lproj/Navigator.xib b/Interfaces/English.lproj/Navigator.xib
index 2a488516..a6d6590f 100644
--- a/Interfaces/English.lproj/Navigator.xib
+++ b/Interfaces/English.lproj/Navigator.xib
@@ -21,7 +21,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="4"/>
+ <integer value="15"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -181,6 +181,7 @@
<string key="NSFrameSize">{383, 14}</string>
<reference key="NSSuperview" ref="415327048"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <bool key="NSViewCanDrawConcurrently">YES</bool>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="945013976">
<reference key="NSNextResponder" ref="752652559"/>
@@ -201,7 +202,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTableColumn" id="729371637">
<string key="NSIdentifier">field</string>
- <double key="NSWidth">175</double>
+ <double key="NSWidth">182</double>
<double key="NSMinWidth">16</double>
<double key="NSMaxWidth">1000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -243,7 +244,7 @@
</object>
<object class="NSTableColumn" id="583473822">
<string key="NSIdentifier">type</string>
- <double key="NSWidth">202</double>
+ <double key="NSWidth">195</double>
<double key="NSMinWidth">40</double>
<double key="NSMaxWidth">1000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -324,13 +325,14 @@
<object class="NSScroller" id="239465385">
<reference key="NSNextResponder" ref="667909124"/>
<int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{1, 119}, {223, 11}}</string>
+ <string key="NSFrame">{{1, 19}, {383, 11}}</string>
<reference key="NSSuperview" ref="667909124"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="667909124"/>
<string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.97208124399185181</double>
+ <double key="NSCurValue">1</double>
+ <double key="NSPercent">0.98966407775878906</double>
</object>
<object class="NSClipView" id="752652559">
<reference key="NSNextResponder" ref="667909124"/>
@@ -353,6 +355,7 @@
<reference key="NSSuperview" ref="978368259"/>
<reference key="NSNextKeyView" ref="415327048"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <bool key="NSViewCanDrawConcurrently">YES</bool>
<int key="NSsFlags">626</int>
<reference key="NSVScroller" ref="619640533"/>
<reference key="NSHScroller" ref="239465385"/>
@@ -388,6 +391,7 @@
<string key="NSFrameSize">{394, 214}</string>
<reference key="NSSuperview" ref="817352949"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <bool key="NSViewCanDrawConcurrently">YES</bool>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="144900244">
<reference key="NSNextResponder" ref="584171442"/>
@@ -540,6 +544,7 @@
<reference key="NSSuperview" ref="556163261"/>
<reference key="NSNextKeyView" ref="817352949"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <bool key="NSViewCanDrawConcurrently">YES</bool>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="103116274"/>
<reference key="NSHScroller" ref="1026336837"/>
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 27de550f..6d6befc8 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -307,7 +307,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
connectionID = [[[self window] delegate] connectionID];
else
connectionID = @"_";
-NSLog(@"cid %@", connectionID);
+
NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[[mySQLConnection getDbStructure] objectForKey:connectionID]];
if(dbs != nil && [dbs count]) {
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m
index 1445f433..1dc53bcd 100644
--- a/Source/SPNavigatorController.m
+++ b/Source/SPNavigatorController.m
@@ -104,8 +104,13 @@ static SPNavigatorController *sharedNavigatorController = nil;
- (IBAction)updateEntries:(id)sender;
{
-
- if(schemaData) [schemaData release]; schemaData = nil;
+ id selectedItem1 = nil;
+ id selectedItem2 = nil;
+ if(schemaData) {
+ selectedItem1 = [outlineSchema1 itemAtRow:[outlineSchema1 selectedRow]];
+ selectedItem2 = [outlineSchema2 itemAtRow:[outlineSchema2 selectedRow]];
+ [schemaData release]; schemaData = nil;
+ }
schemaData = [[NSMutableDictionary alloc] init];
if ([[[NSDocumentController sharedDocumentController] documents] count]) {
for(id doc in [[NSDocumentController sharedDocumentController] documents]) {
@@ -117,11 +122,9 @@ static SPNavigatorController *sharedNavigatorController = nil;
if(!connectionName || [connectionName isEqualToString:@"_"]) continue;
if(![schemaData objectForKey:connectionName]) {
-
- id data = [[doc valueForKeyPath:@"mySQLConnection"] getDbStructure];
-
- if(data && [data objectForKey:connectionName]) {
- [schemaData setObject:[data objectForKey:connectionName] forKey:connectionName];
+
+ if([[doc valueForKeyPath:@"mySQLConnection"] getDbStructure] && [[[doc valueForKeyPath:@"mySQLConnection"] getDbStructure] objectForKey:connectionName]) {
+ [schemaData setObject:[[[doc valueForKeyPath:@"mySQLConnection"] getDbStructure] objectForKey:connectionName] forKey:connectionName];
} else {
if([[doc valueForKeyPath:@"mySQLConnection"] serverMajorVersion] > 4) {
@@ -136,6 +139,26 @@ static SPNavigatorController *sharedNavigatorController = nil;
[outlineSchema1 reloadData];
[outlineSchema2 reloadData];
+ if(selectedItem1) {
+ NSInteger itemIndex = [outlineSchema1 rowForItem:selectedItem1];
+ if (itemIndex < 0) {
+ // You need to decide what happens if the item doesn't exist
+ NSLog(@"1");
+ return;
+ }
+
+ [outlineSchema1 selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
+ }
+ if(selectedItem2) {
+ NSInteger itemIndex = [outlineSchema2 rowForItem:selectedItem2];
+ if (itemIndex < 0) {
+ // You need to decide what happens if the item doesn't exist
+ NSLog(@"2");
+ return;
+ }
+
+ [outlineSchema2 selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
+ }
}
}
@@ -155,10 +178,13 @@ static SPNavigatorController *sharedNavigatorController = nil;
NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
NSArray *sortedItems = [[item allKeys] sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]];
[desc release];
- if(index < [sortedItems count])
+ // if(index < [sortedItems count])
return [item objectForKey:[sortedItems objectAtIndex:index]];
}
-
+ else if ([item isKindOfClass:[NSArray class]])
+ {
+ return [item objectAtIndex:index];
+ }
return nil;
}
@@ -181,7 +207,7 @@ static SPNavigatorController *sharedNavigatorController = nil;
if(item == nil)
return [schemaData count];
- if([item isKindOfClass:[NSDictionary class]])
+ if([item isKindOfClass:[NSDictionary class]] || [item isKindOfClass:[NSArray class]])
return [item count];
return 0;
@@ -201,41 +227,41 @@ static SPNavigatorController *sharedNavigatorController = nil;
}
if ([parentObject isKindOfClass:[NSDictionary class]]) {
- if([outlineView parentForItem:item]) {
- if([item isKindOfClass:[NSDictionary class]]) {
- if([item objectForKey:@" struct_type "]) {
- NSInteger type = [[item objectForKey:@" struct_type "] intValue];
- switch(type) {
- case 0:
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"table-small-square"]];
- break;
- case 1:
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"table-view-small-square"]];
- break;
- case 2:
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"proc-small"]];
- break;
- case 3:
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"func-small"]];
- break;
- }
- } else {
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"database-small"]];
+ if([item isKindOfClass:[NSDictionary class]]) {
+ if([item objectForKey:@" struct_type "]) {
+
+ NSInteger type = [[item objectForKey:@" struct_type "] intValue];
+ switch(type) {
+ case 0:
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"table-small-square"]];
+ break;
+ case 1:
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"table-view-small-square"]];
+ break;
+ case 2:
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"proc-small"]];
+ break;
+ case 3:
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"func-small"]];
+ break;
}
} else {
- // It's a field and use the key " struct_type " to increase the distance between node and first child
- if(![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "]) {
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"field-small-square"]];
- } else {
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"dummy-small"]];
- }
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"database-small"]];
}
- }
- if([[parentObject allKeysForObject:item] count] && ![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "]) {
return [[[[parentObject allKeysForObject:item] objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter] lastObject];
+
+ } else {
+ // It's a field and use the key " struct_type " to increase the distance between node and first child
+ if(![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "]) {
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"field-small-square"]];
+ return [[[[parentObject allKeysForObject:item] objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter] lastObject];
+ } else {
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"dummy-small"]];
+ return nil;
+ }
}
}
- return nil;
+ return [item description];
}
else if ([[tableColumn identifier] isEqualToString:@"type"]) {