From a896123760846a4e38c5061f335056ca8658d013 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 9 Mar 2010 09:39:34 +0000 Subject: =?UTF-8?q?=E2=80=A2=20improved=20tooltip=20behaviour=20of=20SPNar?= =?UTF-8?q?rowDownCompletion's=20tableView=20=E2=80=A2=20added=20"Filter?= =?UTF-8?q?=20Tables=E2=80=A6"=20^=E2=8C=A5=E2=8C=98F"=20to=20main=20menu?= =?UTF-8?q?=20>=20Table=20which=20sets=20the=20focus=20to=20TablesList's?= =?UTF-8?q?=20search=20field=20if=20visible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Interfaces/English.lproj/MainMenu.xib | 263 +++++++++++++++++++++++++++++++++- Source/SPNarrowDownCompletion.m | 58 ++++++++ Source/TableDocument.h | 1 + Source/TableDocument.m | 13 ++ Source/TablesList.h | 1 + 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 @@ + + + Filter Tables… + f + 1835008 + 2147483647 + + + YES @@ -2889,6 +2898,14 @@ 1044 + + + focusOnTableListFilter: + + + + 1046 + @@ -3991,6 +4008,7 @@ + @@ -4272,6 +4290,11 @@ + + 1045 + + + @@ -4296,6 +4319,7 @@ 1038.ImportedFromIB2 1041.IBPluginDependency 1042.IBPluginDependency + 1045.IBPluginDependency 106.IBEditorWindowLastContentRect 106.IBPluginDependency 106.ImportedFromIB2 @@ -4660,6 +4684,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{733, 644}, {190, 123}} com.apple.InterfaceBuilder.CocoaPlugin @@ -4891,7 +4916,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{645, 335}, {265, 213}} + {{645, 315}, {279, 233}} com.apple.InterfaceBuilder.CocoaPlugin {{829, 663}, {268, 173}} com.apple.InterfaceBuilder.CocoaPlugin @@ -5070,7 +5095,7 @@ - 1044 + 1046 @@ -5909,6 +5934,240 @@ + + TableDocument + NSDocument + + YES + + YES + addConnectionToFavorites: + addDatabase: + analyzeTable: + backForwardInHistory: + cancelTask: + checkTable: + checksumTable: + chooseDatabase: + chooseEncoding: + closeErrorConnectionSheet: + closePanelSheet: + closePasswordSheet: + closeSheet: + copyChecksumFromSheet: + copyCreateTableSyntax: + copyCreateTableSyntaxFromSheet: + export: + exportMultipleTables: + exportTable: + flushPrivileges: + flushTable: + focusOnTableContentFilter: + focusOnTableListFilter: + import: + openCurrentConnectionInNewWindow: + optimizeTable: + removeDatabase: + repairTable: + saveConnectionSheet: + saveCreateSyntax: + setDatabases: + showConsole: + showCreateTableSyntax: + showMySQLHelp: + showServerProcesses: + showServerVariables: + showUserManager: + validateSaveConnectionAccessory: + viewContent: + viewQuery: + viewRelations: + viewStatus: + viewStructure: + viewTriggers: + + + YES + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + + + + YES + + YES + addDatabaseButton + chooseDatabaseButton + connectionErrorDialog + contentViewSplitter + createTableSyntaxTextField + createTableSyntaxTextView + createTableSyntaxWindow + customQueryInstance + customQueryTextView + databaseDataInstance + databaseEncodingButton + databaseNameField + databaseSheet + dbTablesTableView + encodingPopUp + exportControllerInstance + extendedTableInfoInstance + favoritesButton + historyControl + inputTextWindow + inputTextWindowHeader + inputTextWindowMessage + inputTextWindowSecureTextField + listFilterField + queryProgressBar + saveConnectionAccessory + saveConnectionAutoConnect + saveConnectionEncrypt + saveConnectionEncryptString + saveConnectionIncludeData + saveConnectionIncludeQuery + saveConnectionSavePassword + saveConnectionSavePasswordAlert + sidebarGrabber + spHistoryControllerInstance + statusTableAccessoryView + statusTableCopyChecksum + statusTableView + statusValues + tableContentInstance + tableDataInstance + tableDumpInstance + tableInfoCollapseButton + tableInfoTable + tableListSplitter + tableRelationsInstance + tableSourceInstance + tableTabView + tableTriggersInstance + tableWindow + tablesListInstance + taskCancelButton + taskCancellationCallbackObject + taskDescriptionText + taskProgressIndicator + taskProgressLayer + titleAccessoryView + titleImageView + titleStringView + userManagerInstance + + + YES + id + id + NSWindow + NSSplitView + NSTextField + NSTextView + NSWindow + id + NSTextView + id + id + id + id + NSTableView + NSPopUpButton + id + id + id + id + id + id + id + id + NSSearchField + id + id + id + id + NSSecureTextField + id + id + id + id + id + id + id + id + id + id + id + id + id + NSButton + NSTableView + NSSplitView + id + id + NSTabView + id + id + id + NSButton + id + id + id + NSBox + id + id + id + SPUserManager + + + + IBDocumentRelativeSource + ../../Source/TableDocument.h + + YES 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 @@ -1583,6 +1583,14 @@ [listFilterField setStringValue:@""]; } +/** + * Set focus to table list filter search field + */ +- (void) makeTableListFilterHaveFocus +{ + [tableWindow makeFirstResponder:listFilterField]; +} + /** * Update the filter search. */ -- cgit v1.2.3