aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-07-15 09:13:08 +0000
committerBibiko <bibiko@eva.mpg.de>2009-07-15 09:13:08 +0000
commita1f15a4aff3e32817faa5b237f4d1febd3bc4410 (patch)
tree4d6fa4a661c174ac26435656ed74ba407448acb8
parent0b9c1d19c50dd993991dda997a48699b04894090 (diff)
downloadsequelpro-a1f15a4aff3e32817faa5b237f4d1febd3bc4410.tar.gz
sequelpro-a1f15a4aff3e32817faa5b237f4d1febd3bc4410.tar.bz2
sequelpro-a1f15a4aff3e32817faa5b237f4d1febd3bc4410.zip
• narrow-down completion (F5)
- added view icon for Views - improved some tiny code snippets
-rw-r--r--Resources/Images/table-view-small-square.tiffbin0 -> 1262 bytes
-rw-r--r--Source/CMTextView.m30
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj4
3 files changed, 14 insertions, 20 deletions
diff --git a/Resources/Images/table-view-small-square.tiff b/Resources/Images/table-view-small-square.tiff
new file mode 100644
index 00000000..6627390d
--- /dev/null
+++ b/Resources/Images/table-view-small-square.tiff
Binary files differ
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index c8f62e56..dbd33342 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -133,12 +133,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if([mySQLConnection isConnected] && !isDictMode)
{
// Add table names to completions list
- for (id obj in [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"allTableAndViewNames"])
+ for (id obj in [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"allTableNames"])
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:obj, @"display", @"table-small-square", @"image", nil]];
// Add view names to completions list
- // for (id obj in [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"allViewNames"])
- // [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:obj, @"display", @"table-view-small", @"image", nil]];
+ for (id obj in [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"allViewNames"])
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:obj, @"display", @"table-view-small-square", @"image", nil]];
// Add field names to completions list for currently selected table
if ([[[self window] delegate] table] != nil)
@@ -170,26 +170,18 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if([[self string] length]<6000000)
{
NSCharacterSet *separators = [NSCharacterSet characterSetWithCharactersInString:@" \t\r\n,()[]{}\"'`-!;=+|?:~@"];
- NSArray *textViewWords = [[self string] componentsSeparatedByCharactersInSet:separators];
+
NSMutableArray *uniqueArray = [NSMutableArray array];
- NSString *s;
- enumerate(textViewWords, s)
- if(![uniqueArray containsObject:s])
- [uniqueArray addObject:s];
+ [uniqueArray addObjectsFromArray:[[NSSet setWithArray:[[self string] componentsSeparatedByCharactersInSet:separators]] allObjects]];
// Remove current word from list
[uniqueArray removeObject:currentWord];
int reverseSort = NO;
NSArray *sortedArray = [[[uniqueArray mutableCopy] autorelease] sortedArrayUsingFunction:alphabeticSort context:&reverseSort];
- // [possibleCompletions addObjectsFromArray:sortedArray];
- NSString *w;
- enumerate(sortedArray, w)
+ for(id w in sortedArray)
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"dummy-small", @"image", nil]];
-
- // Remove the current word
- // [possibleCompletions removeObject:currentWord];
}
}
@@ -212,14 +204,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Build array of dictionaries as e.g.:
// [NSDictionary dictionaryWithObjectsAndKeys:@"foo", @"display", @"`foo`", @"insert", @"func-small", @"image", nil]
- NSString* candidate;
- enumerate(possibleCompletions, candidate)
- {
- if(![compl containsObject:candidate])
- [compl addObject:candidate];
- }
+ for(id suggestion in possibleCompletions)
+ if(![compl containsObject:suggestion])
+ [compl addObject:suggestion];
[possibleCompletions release];
+
return [compl autorelease];
}
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index 23b3f04d..c39a019a 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -156,6 +156,7 @@
B5EAC0FD0EC87FF900CC579C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5EAC0FC0EC87FF900CC579C /* Security.framework */; };
B5F4F7810F7BCF990059AE84 /* toolbar-switch-to-procedures.tiff in Resources */ = {isa = PBXBuildFile; fileRef = B5F4F7800F7BCF990059AE84 /* toolbar-switch-to-procedures.tiff */; };
BC1847EA0FE6EC8400094BFB /* SPEditSheetTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC1847E90FE6EC8400094BFB /* SPEditSheetTextView.m */; };
+ BC1E55C4100DC92200AAE9F0 /* table-view-small-square.tiff in Resources */ = {isa = PBXBuildFile; fileRef = BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */; };
BC2C16D40FEBEDF10003993B /* SPDataAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2C16D30FEBEDF10003993B /* SPDataAdditions.m */; };
BC2C8E220FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html in Resources */ = {isa = PBXBuildFile; fileRef = BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */; };
BC99296E0FF3D001008B79AB /* SPFieldEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = BC99296D0FF3D001008B79AB /* SPFieldEditor.m */; };
@@ -448,6 +449,7 @@
B5F4F7800F7BCF990059AE84 /* toolbar-switch-to-procedures.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "toolbar-switch-to-procedures.tiff"; sourceTree = "<group>"; };
BC1847E80FE6EC8400094BFB /* SPEditSheetTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPEditSheetTextView.h; sourceTree = "<group>"; };
BC1847E90FE6EC8400094BFB /* SPEditSheetTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPEditSheetTextView.m; sourceTree = "<group>"; };
+ BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "table-view-small-square.tiff"; sourceTree = "<group>"; };
BC2C16D20FEBEDF10003993B /* SPDataAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDataAdditions.h; sourceTree = "<group>"; };
BC2C16D30FEBEDF10003993B /* SPDataAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDataAdditions.m; sourceTree = "<group>"; };
BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "sequel-pro-mysql-help-template.html"; sourceTree = "<group>"; };
@@ -767,6 +769,7 @@
17E6418B0EF01FF7001BC333 /* Images */ = {
isa = PBXGroup;
children = (
+ BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */,
177E792B0FCB54EC00E9E122 /* database-small.png */,
177E792C0FCB54EC00E9E122 /* dummy-small.png */,
177E792D0FCB54EC00E9E122 /* table-small-square.tiff */,
@@ -1155,6 +1158,7 @@
B5538AAF0FF251EE00219803 /* button_pane_hide_icon.tif in Resources */,
B5538AB00FF251EE00219803 /* button_pane_show_icon.tif in Resources */,
5822CAE110011C8000DCC3D6 /* ConnectionView.xib in Resources */,
+ BC1E55C4100DC92200AAE9F0 /* table-view-small-square.tiff in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};