diff options
-rw-r--r-- | Interfaces/English.lproj/MainMenu.xib | 273 | ||||
-rw-r--r-- | Interfaces/English.lproj/Navigator.xib | 81 | ||||
-rw-r--r-- | Resources/Images/network-small.tif | bin | 0 -> 19988 bytes | |||
-rw-r--r-- | Source/SPNavigatorController.m | 84 | ||||
-rw-r--r-- | Source/TableDocument.h | 4 | ||||
-rw-r--r-- | Source/TableDocument.m | 21 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 4 |
7 files changed, 397 insertions, 70 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib index f89d333d..a08f7f23 100644 --- a/Interfaces/English.lproj/MainMenu.xib +++ b/Interfaces/English.lproj/MainMenu.xib @@ -12,7 +12,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="106"/> + <integer value="498"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1189,6 +1189,15 @@ <reference key="NSOnImage" ref="625762401"/> <reference key="NSMixedImage" ref="315854375"/> </object> + <object class="NSMenuItem" id="986291195"> + <reference key="NSMenu" ref="466354362"/> + <bool key="NSIsHidden">YES</bool> + <string key="NSTitle">Show Navigator</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="625762401"/> + <reference key="NSMixedImage" ref="315854375"/> + </object> <object class="NSMenuItem" id="761247690"> <reference key="NSMenu" ref="466354362"/> <bool key="NSIsDisabled">YES</bool> @@ -2932,6 +2941,14 @@ </object> <int key="connectionID">1049</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">toggleNavigator:</string> + <reference key="source" ref="63651044"/> + <reference key="destination" ref="986291195"/> + </object> + <int key="connectionID">1051</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -3373,6 +3390,7 @@ <reference ref="937303212"/> <reference ref="165449785"/> <reference ref="756783652"/> + <reference ref="986291195"/> </object> <reference key="parent" ref="401969940"/> </object> @@ -4333,6 +4351,11 @@ <reference key="object" ref="329669681"/> <reference key="parent" ref="1021151289"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">1050</int> + <reference key="object" ref="986291195"/> + <reference key="parent" ref="466354362"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -4360,6 +4383,7 @@ <string>1045.IBPluginDependency</string> <string>1047.IBPluginDependency</string> <string>1048.IBPluginDependency</string> + <string>1050.IBPluginDependency</string> <string>106.IBEditorWindowLastContentRect</string> <string>106.IBPluginDependency</string> <string>106.ImportedFromIB2</string> @@ -4727,7 +4751,8 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{611, 199}, {204, 153}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{824, 199}, {204, 153}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{561, 605}, {181, 43}}</string> @@ -4810,7 +4835,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{449, 1007}, {197, 53}}</string> - <string>{{161, 352}, {511, 20}}</string> + <string>{{447, 658}, {511, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{506, 836}, {511, 20}}</string> @@ -4863,7 +4888,7 @@ <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{514, 275}, {237, 273}}</string> + <string>{{639, 365}, {237, 293}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{698, 703}, {184, 133}}</string> @@ -5137,7 +5162,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">1049</int> + <int key="maxID">1051</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -5980,6 +6005,244 @@ </object> <reference key="sourceIdentifier" ref="939419192"/> </object> + <object class="IBPartialClassDescription"> + <string key="className">TableDocument</string> + <string key="superclassName">NSDocument</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>addConnectionToFavorites:</string> + <string>addDatabase:</string> + <string>analyzeTable:</string> + <string>backForwardInHistory:</string> + <string>cancelTask:</string> + <string>checkTable:</string> + <string>checksumTable:</string> + <string>chooseDatabase:</string> + <string>chooseEncoding:</string> + <string>closeErrorConnectionSheet:</string> + <string>closePanelSheet:</string> + <string>closePasswordSheet:</string> + <string>closeSheet:</string> + <string>copyChecksumFromSheet:</string> + <string>copyCreateTableSyntax:</string> + <string>copyCreateTableSyntaxFromSheet:</string> + <string>export:</string> + <string>exportMultipleTables:</string> + <string>exportTable:</string> + <string>flushPrivileges:</string> + <string>flushTable:</string> + <string>focusOnTableContentFilter:</string> + <string>focusOnTableListFilter:</string> + <string>import:</string> + <string>openCurrentConnectionInNewWindow:</string> + <string>optimizeTable:</string> + <string>removeDatabase:</string> + <string>repairTable:</string> + <string>saveConnectionSheet:</string> + <string>saveCreateSyntax:</string> + <string>setDatabases:</string> + <string>showConsole:</string> + <string>showCreateTableSyntax:</string> + <string>showMySQLHelp:</string> + <string>showNavigator:</string> + <string>showServerProcesses:</string> + <string>showServerVariables:</string> + <string>showUserManager:</string> + <string>toggleNavigator:</string> + <string>validateSaveConnectionAccessory:</string> + <string>viewContent:</string> + <string>viewQuery:</string> + <string>viewRelations:</string> + <string>viewStatus:</string> + <string>viewStructure:</string> + <string>viewTriggers:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>addDatabaseButton</string> + <string>chooseDatabaseButton</string> + <string>connectionErrorDialog</string> + <string>contentViewSplitter</string> + <string>createTableSyntaxTextField</string> + <string>createTableSyntaxTextView</string> + <string>createTableSyntaxWindow</string> + <string>customQueryInstance</string> + <string>customQueryTextView</string> + <string>databaseDataInstance</string> + <string>databaseEncodingButton</string> + <string>databaseNameField</string> + <string>databaseSheet</string> + <string>dbTablesTableView</string> + <string>encodingPopUp</string> + <string>exportControllerInstance</string> + <string>extendedTableInfoInstance</string> + <string>favoritesButton</string> + <string>historyControl</string> + <string>inputTextWindow</string> + <string>inputTextWindowHeader</string> + <string>inputTextWindowMessage</string> + <string>inputTextWindowSecureTextField</string> + <string>listFilterField</string> + <string>queryProgressBar</string> + <string>saveConnectionAccessory</string> + <string>saveConnectionAutoConnect</string> + <string>saveConnectionEncrypt</string> + <string>saveConnectionEncryptString</string> + <string>saveConnectionIncludeData</string> + <string>saveConnectionIncludeQuery</string> + <string>saveConnectionSavePassword</string> + <string>saveConnectionSavePasswordAlert</string> + <string>sidebarGrabber</string> + <string>spHistoryControllerInstance</string> + <string>statusTableAccessoryView</string> + <string>statusTableCopyChecksum</string> + <string>statusTableView</string> + <string>statusValues</string> + <string>tableContentInstance</string> + <string>tableDataInstance</string> + <string>tableDumpInstance</string> + <string>tableInfoCollapseButton</string> + <string>tableInfoTable</string> + <string>tableListSplitter</string> + <string>tableRelationsInstance</string> + <string>tableSourceInstance</string> + <string>tableTabView</string> + <string>tableTriggersInstance</string> + <string>tableWindow</string> + <string>tablesListInstance</string> + <string>taskCancelButton</string> + <string>taskCancellationCallbackObject</string> + <string>taskDescriptionText</string> + <string>taskProgressIndicator</string> + <string>taskProgressLayer</string> + <string>titleAccessoryView</string> + <string>titleImageView</string> + <string>titleStringView</string> + <string>userManagerInstance</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>NSWindow</string> + <string>NSSplitView</string> + <string>NSTextField</string> + <string>NSTextView</string> + <string>NSWindow</string> + <string>id</string> + <string>NSTextView</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSTableView</string> + <string>NSPopUpButton</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSSearchField</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSSecureTextField</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSButton</string> + <string>NSTableView</string> + <string>NSSplitView</string> + <string>id</string> + <string>id</string> + <string>NSTabView</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSButton</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSBox</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>SPUserManager</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../../Source/TableDocument.h</string> + </object> + </object> </object> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> <bool key="EncodedWithXMLCoder">YES</bool> diff --git a/Interfaces/English.lproj/Navigator.xib b/Interfaces/English.lproj/Navigator.xib index 74a90bc7..7e7be9f8 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="3"/> + <integer value="4"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -66,7 +66,7 @@ <object class="NSSearchField" id="701533802"> <reference key="NSNextResponder" ref="881437593"/> <int key="NSvFlags">270</int> - <string key="NSFrame">{{20, 334}, {165, 19}}</string> + <string key="NSFrame">{{20, 337}, {165, 19}}</string> <reference key="NSSuperview" ref="881437593"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> @@ -201,7 +201,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTableColumn" id="729371637"> <string key="NSIdentifier">field</string> - <double key="NSWidth">178</double> + <double key="NSWidth">177</double> <double key="NSMinWidth">16</double> <double key="NSMaxWidth">1000</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> @@ -243,7 +243,7 @@ </object> <object class="NSTableColumn" id="583473822"> <string key="NSIdentifier">type</string> - <double key="NSWidth">198</double> + <double key="NSWidth">199</double> <double key="NSMinWidth">40</double> <double key="NSMaxWidth">1000</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> @@ -385,7 +385,7 @@ <object class="NSOutlineView" id="771350217"> <reference key="NSNextResponder" ref="817352949"/> <int key="NSvFlags">4352</int> - <string key="NSFrameSize">{393, 255}</string> + <string key="NSFrameSize">{393, 301}</string> <reference key="NSSuperview" ref="817352949"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> @@ -488,7 +488,7 @@ <float key="NSOutlineViewIndentationPerLevelKey">12</float> </object> </object> - <string key="NSFrame">{{1, 17}, {393, 255}}</string> + <string key="NSFrame">{{1, 17}, {393, 301}}</string> <reference key="NSSuperview" ref="1023753551"/> <reference key="NSNextKeyView" ref="771350217"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> @@ -536,7 +536,7 @@ </object> <reference ref="637334507"/> </object> - <string key="NSFrameSize">{395, 273}</string> + <string key="NSFrameSize">{395, 319}</string> <reference key="NSSuperview" ref="556163261"/> <reference key="NSNextKeyView" ref="817352949"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> @@ -549,13 +549,13 @@ <bytes key="NSScrollAmts">QSAAAEEgAABBYAAAQWAAAA</bytes> </object> </object> - <string key="NSFrame">{{0, 1}, {395, 273}}</string> + <string key="NSFrame">{{0, 1}, {395, 319}}</string> <reference key="NSSuperview" ref="800413276"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <string key="NSClassName">NSView</string> </object> </object> - <string key="NSFrameSize">{395, 274}</string> + <string key="NSFrameSize">{395, 320}</string> <reference key="NSSuperview" ref="464250149"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <int key="NSDividerStyle">2</int> @@ -605,7 +605,7 @@ <bool key="BWSVDividerCanCollapse">NO</bool> </object> </object> - <string key="NSFrameSize">{395, 274}</string> + <string key="NSFrameSize">{395, 320}</string> <reference key="NSSuperview" ref="112878735"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <string key="NSClassName">NSView</string> @@ -613,13 +613,13 @@ <object class="BWCustomView" id="65471749"> <reference key="NSNextResponder" ref="112878735"/> <int key="NSvFlags">274</int> - <string key="NSFrame">{{0, 275}, {395, 54}}</string> + <string key="NSFrame">{{0, 321}, {395, 13}}</string> <reference key="NSSuperview" ref="112878735"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <string key="NSClassName">NSView</string> </object> </object> - <string key="NSFrameSize">{395, 329}</string> + <string key="NSFrameSize">{395, 334}</string> <reference key="NSSuperview" ref="881437593"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <int key="NSDividerStyle">2</int> @@ -665,6 +665,34 @@ <int key="BWSVCollapsiblePopupSelection">0</int> <bool key="BWSVDividerCanCollapse">NO</bool> </object> + <object class="NSButton" id="576014685"> + <reference key="NSNextResponder" ref="881437593"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{355, 337}, {20, 20}}</string> + <reference key="NSSuperview" ref="881437593"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="1031400862"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents"/> + <object class="NSFont" key="NSSupport"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">13</double> + <int key="NSfFlags">1044</int> + </object> + <reference key="NSControlView" ref="576014685"/> + <int key="NSButtonFlags">-2041822977</int> + <int key="NSButtonFlags2">162</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSRefreshFreestandingTemplate</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + </object> </object> <string key="NSFrameSize">{395, 359}</string> <reference key="NSSuperview"/> @@ -796,6 +824,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="701533802"/> <reference ref="112878735"/> + <reference ref="576014685"/> </object> <reference key="parent" ref="856804369"/> </object> @@ -1002,6 +1031,20 @@ <reference key="object" ref="713670797"/> <reference key="parent" ref="998799870"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">66</int> + <reference key="object" ref="576014685"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1031400862"/> + </object> + <reference key="parent" ref="881437593"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">67</int> + <reference key="object" ref="1031400862"/> + <reference key="parent" ref="576014685"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -1025,6 +1068,7 @@ <string>26.IBPluginDependency</string> <string>27.IBPluginDependency</string> <string>28.IBPluginDependency</string> + <string>29.CustomClassName</string> <string>29.IBPluginDependency</string> <string>3.IBEditorWindowLastContentRect</string> <string>3.IBPluginDependency</string> @@ -1043,9 +1087,12 @@ <string>44.IBPluginDependency</string> <string>45.IBPluginDependency</string> <string>46.IBPluginDependency</string> + <string>47.CustomClassName</string> <string>47.IBPluginDependency</string> <string>48.CustomClassName</string> <string>48.IBPluginDependency</string> + <string>66.IBPluginDependency</string> + <string>67.IBPluginDependency</string> <string>8.IBPluginDependency</string> <string>9.IBPluginDependency</string> </object> @@ -1068,10 +1115,11 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>ImageAndTextCell</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{66, 295}, {395, 359}}</string> + <string>{{245, 305}, {395, 359}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{66, 295}, {395, 359}}</string> + <string>{{245, 305}, {395, 359}}</string> <boolean value="NO"/> <boolean value="YES"/> <string>{150, 200}</string> @@ -1086,11 +1134,14 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>ImageAndTextCell</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>ImageAndTextCell</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> @@ -1109,7 +1160,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">63</int> + <int key="maxID">67</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> diff --git a/Resources/Images/network-small.tif b/Resources/Images/network-small.tif Binary files differnew file mode 100644 index 00000000..7e813111 --- /dev/null +++ b/Resources/Images/network-small.tif diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 107019af..c31c73c0 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -87,15 +87,7 @@ static SPNavigatorController *sharedNavigatorController = nil; { prefs = [NSUserDefaults standardUserDefaults]; - if ([[[NSDocumentController sharedDocumentController] documents] count]) { - for(id doc in [[NSDocumentController sharedDocumentController] documents]) { - NSString *connectionName = [NSString stringWithFormat:@"%@@%@", [doc user], [doc host]]; - if(![schemaData objectForKey:connectionName]) { - NSDictionary *dbStructure = [[doc valueForKeyPath:@"mySQLConnection"] getDbStructure]; - if (dbStructure) [schemaData setObject:dbStructure forKey:connectionName]; - } - } - } + [self updateEntries]; [self setWindowFrameAutosaveName:@"SPNavigator"]; @@ -113,13 +105,16 @@ static SPNavigatorController *sharedNavigatorController = nil; [schemaData removeAllObjects]; if ([[[NSDocumentController sharedDocumentController] documents] count]) { for(id doc in [[NSDocumentController sharedDocumentController] documents]) { - NSString *connectionName = [NSString stringWithFormat:@"%@@%@", [doc user], [doc host]]; - if(![schemaData objectForKey:connectionName]) + NSString *connectionName; + if([(NSString*)[doc port] length]) + connectionName = [NSString stringWithFormat:@"%@:%@", [doc host], [doc port]]; + else + connectionName = [doc host]; + if(![schemaData objectForKey:connectionName]) { [schemaData setObject:[[doc valueForKeyPath:@"mySQLConnection"] getDbStructure] forKey:connectionName]; + } } } - // [outlineSchema1 reloadItem:nil reloadChildren:YES]; - // [outlineSchema2 reloadItem:nil reloadChildren:YES]; } - (IBAction)outlineViewAction:(id)sender @@ -133,14 +128,15 @@ static SPNavigatorController *sharedNavigatorController = nil; - (id)outlineView:(id)outlineView child:(NSInteger)index ofItem:(id)item { - if (item == nil) - item = schemaData; - - if ([item isKindOfClass:[NSArray class]]) - return [item objectAtIndex:index]; - - else if ([item isKindOfClass:[NSDictionary class]]) - return [item objectForKey:[[item allKeys] objectAtIndex:index]]; + if (item == nil) item = schemaData; + + if ([item isKindOfClass:[NSDictionary class]] && [item allKeys] && [[item allKeys] count]) { + NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; + NSArray *sortedTables = [[item allKeys] sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + [desc release]; + if(index < [sortedTables count]) + return [item objectForKey:[sortedTables objectAtIndex:index]]; + } return nil; } @@ -159,18 +155,23 @@ static SPNavigatorController *sharedNavigatorController = nil; if(item == nil) return [schemaData count]; - if([item isKindOfClass:[NSDictionary class]]) - return [item count]; - else if([item isKindOfClass:[NSArray class]]) - return 0; - + if([item isKindOfClass:[NSDictionary class]]) { + // if([item objectForKey:@" struct_type "]) + // return [item count] - 1; + // else + return [item count]; + } + + return 0; } - (id)outlineView:(id)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { + + id parentObject = [outlineView parentForItem:item] ? [outlineView parentForItem:item] : schemaData; + if ([[tableColumn identifier] isEqualToString:@"field"]) { - id parentObject = [outlineView parentForItem:item] ? [outlineView parentForItem:item] : schemaData; if ([parentObject isKindOfClass:[NSDictionary class]]) { if([outlineView parentForItem:item]) { if([item isKindOfClass:[NSDictionary class]]) { @@ -194,29 +195,21 @@ static SPNavigatorController *sharedNavigatorController = nil; [[tableColumn dataCell] setImage:[NSImage imageNamed:@"database-small"]]; } } else { - // [[tableColumn dataCell] setImage:[NSImage imageNamed:@"field-small-square"]]; - [[tableColumn dataCell] setImage:[NSImage imageNamed:@"dummy-small"]]; + 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:@"network-small"]]; } // if(![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "]) - return [[parentObject allKeysForObject:item] objectAtIndex:0]; + return [[parentObject allKeysForObject:item] objectAtIndex:0]; return nil; } return nil; } else if ([[tableColumn identifier] isEqualToString:@"type"]) { - if ([item isKindOfClass:[NSString class]]) - { - return nil; - } - else if ([item isKindOfClass:[NSDictionary class]]) - { - return nil; - } - else if ([item isKindOfClass:[NSArray class]]) + if ([item isKindOfClass:[NSArray class]] && ![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "]) { NSTokenFieldCell *b = [[[NSTokenFieldCell alloc] initTextCell:[item componentsJoinedByString:@", "]] autorelease]; [b setEditable:NO]; @@ -226,6 +219,7 @@ static SPNavigatorController *sharedNavigatorController = nil; [b setWraps:NO]; return b; } + return nil; } return nil; @@ -233,17 +227,15 @@ static SPNavigatorController *sharedNavigatorController = nil; - (BOOL)outlineView:outlineView isGroupItem:(id)item { - if([item isKindOfClass:[NSDictionary class]]) - return YES; + // if([item isKindOfClass:[NSDictionary class]]) + // return YES; - return NO; + return YES; } - (CGFloat)outlineView:(NSOutlineView *)outlineView heightOfRowByItem:(id)item { - if([item isKindOfClass:[NSDictionary class]]) - return 18.0; - return 20.0; + return 18.0; } - (BOOL)outlineView:(NSOutlineView *)outlineView shouldExpandItem:(id)item diff --git a/Source/TableDocument.h b/Source/TableDocument.h index c671d308..f125277d 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -249,13 +249,15 @@ - (IBAction)copyChecksumFromSheet:(id)sender; - (void)showConsole:(id)sender; -- (void)showNavigator:(id)sender; +- (IBAction)showNavigator:(id)sender; +- (IBAction)toggleNavigator:(id)sender; // Accessor methods - (NSString *)host; - (NSString *)name; - (NSString *)database; - (NSString *)table; +- (NSString *)port; - (NSString *)mySQLVersion; - (NSString *)user; - (NSString *)displaySPName; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 3a7fd59b..62823c36 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1131,7 +1131,7 @@ } else { [[[SPQueryController sharedQueryController] window] makeKeyAndOrderFront:self]; } - // [self showNavigator:self]; + } /** @@ -1156,7 +1156,7 @@ /** * Shows or hides the navigator */ -- (void)toggleNavigator:(id)sender +- (IBAction)toggleNavigator:(id)sender { BOOL isNavigatorVisible = [[[SPNavigatorController sharedNavigatorController] window] isVisible]; @@ -1170,7 +1170,7 @@ [[[SPNavigatorController sharedNavigatorController] window] setIsVisible:(!isNavigatorVisible)]; } -- (void)showNavigator:(id)sender +- (IBAction)showNavigator:(id)sender { BOOL isNavigatorVisible = [[[SPNavigatorController sharedNavigatorController] window] isVisible]; @@ -2426,6 +2426,16 @@ return theUser; } +/** + * Returns the current host's port + */ +- (NSString *)port +{ + NSString *thePort = [connectionController port]; + if (!thePort) return @""; + return thePort; +} + - (NSString *)keyChainID { return keyChainID; @@ -3076,6 +3086,11 @@ return ([[SPQueryController sharedQueryController] consoleMessageCount] > 0); } + // Show/hide console + if ([menuItem action] == @selector(toggleNavigator:)) { + [menuItem setTitle:([[[SPNavigatorController sharedNavigatorController] window] isVisible]) ? NSLocalizedString(@"Hide Navigator", @"hide navigator") : NSLocalizedString(@"Show Navigator", @"show navigator")]; + } + // Focus on table content filter if ([menuItem action] == @selector(focusOnTableContentFilter:)) { return ([self table] != nil && [[self table] isNotEqualTo:@""]); diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index f4a171fa..def54998 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -253,6 +253,7 @@ BCCBD7FC104408B000D4C50A /* SaveSPFAccessory.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCCBD7FA104408B000D4C50A /* SaveSPFAccessory.xib */; }; BCD0AD490FBBFC340066EA5C /* SPSQLTokenizer.l in Sources */ = {isa = PBXBuildFile; fileRef = BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */; }; BCE0025D11173D2A009DA533 /* SPFieldMapperController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCE0025C11173D2A009DA533 /* SPFieldMapperController.m */; }; + BCEF78C6115215CA0023F8C2 /* network-small.tif in Resources */ = {isa = PBXBuildFile; fileRef = BCEF78C5115215CA0023F8C2 /* network-small.tif */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -671,6 +672,7 @@ BCD0AD4A0FBBFC480066EA5C /* SPSQLTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPSQLTokenizer.h; sourceTree = "<group>"; }; BCE0025B11173D2A009DA533 /* SPFieldMapperController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPFieldMapperController.h; sourceTree = "<group>"; }; BCE0025C11173D2A009DA533 /* SPFieldMapperController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFieldMapperController.m; sourceTree = "<group>"; }; + BCEF78C5115215CA0023F8C2 /* network-small.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "network-small.tif"; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1208,6 +1210,7 @@ 17E6418B0EF01FF7001BC333 /* Images */ = { isa = PBXGroup; children = ( + BCEF78C5115215CA0023F8C2 /* network-small.tif */, 17BFC80D10D3FF5200A3B112 /* Icons */, BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */, 177E792B0FCB54EC00E9E122 /* database-small.png */, @@ -1692,6 +1695,7 @@ 17DD52C3115074B3007D8950 /* InfoPlist.strings in Resources */, 17DD52C6115074CB007D8950 /* Localizable.strings in Resources */, BC93FBBD11514ADE005F1D9F /* Navigator.xib in Resources */, + BCEF78C6115215CA0023F8C2 /* network-small.tif in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; |