diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-09 09:39:34 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-09 09:39:34 +0000 |
commit | a896123760846a4e38c5061f335056ca8658d013 (patch) | |
tree | 57dcbde9cb2c8ebf76601fd8e7124d2ab21390f6 | |
parent | aa0a178df3316777c001c59e03c534cfa537b365 (diff) | |
download | sequelpro-a896123760846a4e38c5061f335056ca8658d013.tar.gz sequelpro-a896123760846a4e38c5061f335056ca8658d013.tar.bz2 sequelpro-a896123760846a4e38c5061f335056ca8658d013.zip |
• improved tooltip behaviour of SPNarrowDownCompletion's tableView
• added "Filter Tables…" ^⌥⌘F" to main menu > Table which sets the focus to TablesList's search field if visible
-rw-r--r-- | Interfaces/English.lproj/MainMenu.xib | 263 | ||||
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 58 | ||||
-rw-r--r-- | Source/TableDocument.h | 1 | ||||
-rw-r--r-- | Source/TableDocument.m | 13 | ||||
-rw-r--r-- | Source/TablesList.h | 1 | ||||
-rw-r--r-- | Source/TablesList.m | 8 |
6 files changed, 342 insertions, 2 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib index 3e7949fe..058f73d9 100644 --- a/Interfaces/English.lproj/MainMenu.xib +++ b/Interfaces/English.lproj/MainMenu.xib @@ -1626,6 +1626,15 @@ <reference key="NSOnImage" ref="625762401"/> <reference key="NSMixedImage" ref="315854375"/> </object> + <object class="NSMenuItem" id="328775074"> + <reference key="NSMenu" ref="1056168652"/> + <string key="NSTitle">Filter Tables…</string> + <string key="NSKeyEquiv">f</string> + <int key="NSKeyEquivModMask">1835008</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="625762401"/> + <reference key="NSMixedImage" ref="315854375"/> + </object> <object class="NSMenuItem" id="126273117"> <reference key="NSMenu" ref="1056168652"/> <bool key="NSIsDisabled">YES</bool> @@ -2889,6 +2898,14 @@ </object> <int key="connectionID">1044</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">focusOnTableListFilter:</string> + <reference key="source" ref="63651044"/> + <reference key="destination" ref="328775074"/> + </object> + <int key="connectionID">1046</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -3991,6 +4008,7 @@ <reference ref="759561673"/> <reference ref="126273117"/> <reference ref="309258449"/> + <reference ref="328775074"/> </object> <reference key="parent" ref="228261277"/> </object> @@ -4272,6 +4290,11 @@ <reference key="object" ref="126273117"/> <reference key="parent" ref="1056168652"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">1045</int> + <reference key="object" ref="328775074"/> + <reference key="parent" ref="1056168652"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -4296,6 +4319,7 @@ <string>1038.ImportedFromIB2</string> <string>1041.IBPluginDependency</string> <string>1042.IBPluginDependency</string> + <string>1045.IBPluginDependency</string> <string>106.IBEditorWindowLastContentRect</string> <string>106.IBPluginDependency</string> <string>106.ImportedFromIB2</string> @@ -4660,6 +4684,7 @@ <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{733, 644}, {190, 123}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> @@ -4891,7 +4916,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{645, 335}, {265, 213}}</string> + <string>{{645, 315}, {279, 233}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{829, 663}, {268, 173}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -5070,7 +5095,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">1044</int> + <int key="maxID">1046</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -5909,6 +5934,240 @@ </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>showServerProcesses:</string> + <string>showServerVariables:</string> + <string>showUserManager:</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> + </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/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index ea6752f6..2651024a 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -298,6 +298,64 @@ return [filtered count]; } +- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(id)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex mouseLocation:(NSPoint)mouseLocation +{ + if([[aTableColumn identifier] isEqualToString:@"image"]) { + if(!dictMode) { + NSString *imageName = [[filtered objectAtIndex:rowIndex] objectForKey:@"image"]; + if([imageName hasPrefix:@"dummy"]) + return @""; + if([imageName hasPrefix:@"table-view"]) + return @"view"; + if([imageName hasPrefix:@"table"]) + return @"table"; + if([imageName hasPrefix:@"database"]) + return @"database"; + if([imageName hasPrefix:@"func"]) + return @"function"; + if([imageName hasPrefix:@"proc"]) + return @"procedure"; + if([imageName hasPrefix:@"field"]) + return @"field"; + } + return @""; + } else if([[aTableColumn identifier] isEqualToString:@"name"]) { + return [[filtered objectAtIndex:rowIndex] objectForKey:@"display"]; + } else if ([[aTableColumn identifier] isEqualToString:@"list"] || [[aTableColumn identifier] isEqualToString:@"type"]) { + if(dictMode) { + return @""; + } else { + if([[filtered objectAtIndex:rowIndex] objectForKey:@"list"]) { + NSMutableString *tt = [NSMutableString string]; + [tt appendString:([[filtered objectAtIndex:rowIndex] objectForKey:@"type"]) ? [[filtered objectAtIndex:rowIndex] objectForKey:@"type"] : @""]; + [tt appendString:@"\n"]; + [tt appendString:NSLocalizedString(@"Type Declaration:", @"type declaration header")]; + [tt appendString:@"\n"]; + [tt appendString:[[filtered objectAtIndex:rowIndex] objectForKey:@"list"]]; + return tt; + } else { + return ([[filtered objectAtIndex:rowIndex] objectForKey:@"type"]) ? [[filtered objectAtIndex:rowIndex] objectForKey:@"type"] : @""; + } + return @""; + } + + } else if ([[aTableColumn identifier] isEqualToString:@"path"]) { + if(dictMode) { + return @""; + } else { + if([[filtered objectAtIndex:rowIndex] objectForKey:@"path"]) { + NSMutableString *tt = [NSMutableString string]; + [tt setString:NSLocalizedString(@"Schema path:", @"schema path header for completion tooltip")]; + for(id p in [[[[[filtered objectAtIndex:rowIndex] objectForKey:@"path"] componentsSeparatedByString:@"⇠"] reverseObjectEnumerator] allObjects]) + [tt appendFormat:@"\n• %@",p]; + return tt; + } + return @""; + } + } + return @""; +} + - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { NSImage* image = nil; diff --git a/Source/TableDocument.h b/Source/TableDocument.h index bb91fa5a..4be47ae1 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -227,6 +227,7 @@ - (IBAction)saveCreateSyntax:(id)sender; - (IBAction)copyCreateTableSyntaxFromSheet:(id)sender; - (IBAction)focusOnTableContentFilter:(id)sender; +- (IBAction)focusOnTableListFilter:(id)sender; // Other methods - (void) setQueryMode:(NSInteger)theQueryMode; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index e72f0b86..8e7ba817 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2340,6 +2340,14 @@ [tableContentInstance performSelector:@selector(makeContentFilterHaveFocus) withObject:nil afterDelay:0.1]; } +/** + * Makes the tables list filter field the first responder. + */ +- (IBAction)focusOnTableListFilter:(id)sender +{ + [tablesListInstance performSelector:@selector(makeTableListFilterHaveFocus) withObject:nil afterDelay:0.1]; +} + #pragma mark - #pragma mark Other Methods @@ -3187,6 +3195,11 @@ return ([self table] != nil && [[self table] isNotEqualTo:@""]); } + // Focus on table list filter + if ([menuItem action] == @selector(focusOnTableListFilter:)) { + return ([[tablesListInstance valueForKeyPath:@"tables"] count] > 20); + } + return [super validateMenuItem:menuItem]; } diff --git a/Source/TablesList.h b/Source/TablesList.h index aa87dbe0..acdd28c7 100644 --- a/Source/TablesList.h +++ b/Source/TablesList.h @@ -124,6 +124,7 @@ enum sp_table_types - (void)updateSelectionTask; - (void)setSelection:(NSDictionary *)selectionDetails; - (void)selectTableAtIndex:(NSNumber *)row; +- (void)makeTableListFilterHaveFocus; // Getters - (NSArray *)selectedTableNames; diff --git a/Source/TablesList.m b/Source/TablesList.m index 8e4ae268..a344ced5 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -1584,6 +1584,14 @@ } /** + * Set focus to table list filter search field + */ +- (void) makeTableListFilterHaveFocus +{ + [tableWindow makeFirstResponder:listFilterField]; +} + +/** * Update the filter search. */ - (IBAction) updateFilter:(id)sender |