aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Resources/Images/database-small.pngbin0 -> 718 bytes
-rw-r--r--Resources/Images/dummy-small.pngbin0 -> 136 bytes
-rw-r--r--Resources/Images/table-small-square.tiffbin0 -> 4546 bytes
-rw-r--r--Source/CMTextView.h1
-rw-r--r--Source/CMTextView.m65
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj12
6 files changed, 63 insertions, 15 deletions
diff --git a/Resources/Images/database-small.png b/Resources/Images/database-small.png
new file mode 100644
index 00000000..ca40549e
--- /dev/null
+++ b/Resources/Images/database-small.png
Binary files differ
diff --git a/Resources/Images/dummy-small.png b/Resources/Images/dummy-small.png
new file mode 100644
index 00000000..eaebd4a5
--- /dev/null
+++ b/Resources/Images/dummy-small.png
Binary files differ
diff --git a/Resources/Images/table-small-square.tiff b/Resources/Images/table-small-square.tiff
new file mode 100644
index 00000000..762977ae
--- /dev/null
+++ b/Resources/Images/table-small-square.tiff
Binary files differ
diff --git a/Source/CMTextView.h b/Source/CMTextView.h
index 0ada18ed..152ddbc9 100644
--- a/Source/CMTextView.h
+++ b/Source/CMTextView.h
@@ -62,6 +62,7 @@
- (BOOL) shiftSelectionLeft;
- (NSArray *) completionsForPartialWordRange:(NSRange)charRange indexOfSelectedItem:(int *)index;
- (NSArray *) keywords;
+- (NSArray *) functions;
- (void) setAutoindent:(BOOL)enableAutoindent;
- (BOOL) autoindent;
- (void) setAutoindentIgnoresEnter:(BOOL)enableAutoindentIgnoresEnter;
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index c147678a..9b5fb9aa 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -138,13 +138,17 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[queryResult dataSeek:0];
for (i = 0 ; i < [queryResult numOfRows] ; i++)
{
- [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:0]];
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[queryResult fetchRowAsArray] objectAtIndex:0], @"display", @"table-small-square", @"image", nil]];
+ //[possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:0]];
}
// Add field names to completions list for currently selected table
if ([[[self window] delegate] table] != nil) {
id columnNames = [[[[self window] delegate] valueForKeyPath:@"tableDataInstance"] valueForKey:@"columnNames"];
- [possibleCompletions addObjectsFromArray:columnNames];
+ // [possibleCompletions addObjectsFromArray:columnNames];
+ NSString *s;
+ enumerate(columnNames, s)
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:s, @"display", @"dummy-small", @"image", nil]];
}
// Add all database names to completions list
@@ -153,7 +157,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[queryResult dataSeek:0];
for (i = 0 ; i < [queryResult numOfRows] ; i++)
{
- [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:0]];
+ // [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:0]];
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[queryResult fetchRowAsArray] objectAtIndex:0], @"display", @"database-small", @"image", nil]];
}
// Add proc/func only for MySQL version 5 or higher
@@ -164,7 +169,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[queryResult dataSeek:0];
for (i = 0 ; i < [queryResult numOfRows] ; i++)
{
- [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:1]];
+ // [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:1]];
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[queryResult fetchRowAsArray] objectAtIndex:1], @"display", @"proc-small", @"image", nil]];
}
// Add all function to completions list for currently selected table
@@ -173,7 +179,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[queryResult dataSeek:0];
for (i = 0 ; i < [queryResult numOfRows] ; i++)
{
- [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:1]];
+ // [possibleCompletions addObject:[[queryResult fetchRowAsArray] objectAtIndex:1]];
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[queryResult fetchRowAsArray] objectAtIndex:1], @"display", @"func-small", @"image", nil]];
}
}
@@ -192,19 +199,39 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
enumerate(textViewWords, s)
if(![uniqueArray containsObject:s])
[uniqueArray addObject:s];
-
+
+ // Remove current word from list
+ [uniqueArray removeObject:currentWord];
+
int reverseSort = NO;
NSArray *sortedArray = [[[uniqueArray mutableCopy] autorelease] sortedArrayUsingFunction:alphabeticSort context:&reverseSort];
- [possibleCompletions addObjectsFromArray:sortedArray];
+ // [possibleCompletions addObjectsFromArray:sortedArray];
+ NSString *w;
+ enumerate(sortedArray, w)
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"dummy-small", @"image", nil]];
+
+
+ // Remove the current word
+ // [possibleCompletions removeObject:currentWord];
}
}
// Add predefined keywords
- if(!isDictMode)
- [possibleCompletions addObjectsFromArray:[self keywords]];
-
- // Remove the current word
- [possibleCompletions removeObject:currentWord];
+ if(!isDictMode) {
+ // [possibleCompletions addObjectsFromArray:[self keywords]];
+ NSString *s;
+ enumerate([self keywords], s)
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:s, @"display", @"dummy-small", @"image", nil]];
+ }
+
+
+ // Add predefined functions
+ if(!isDictMode) {
+ // [possibleCompletions addObjectsFromArray:[self functions]];
+ NSString *s;
+ enumerate([self functions], s)
+ [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:s, @"display", @"func-small", @"image", nil]];
+ }
// Build array of dictionaries as e.g.:
// [NSDictionary dictionaryWithObjectsAndKeys:@"foo", @"display", @"`foo`", @"insert", @"func-small", @"image", nil]
@@ -212,7 +239,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
enumerate(possibleCompletions, candidate)
{
if(![compl containsObject:candidate])
- [compl addObject:[NSDictionary dictionaryWithObjectsAndKeys:candidate, @"display", nil]];
+ [compl addObject:candidate];
}
[possibleCompletions release];
@@ -1646,8 +1673,16 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
@"YEAR_MONTH",
@"ZEROFILL",
- //functions
-
+ nil];
+}
+
+/*
+ * List of fucntions for autocompletion. If you add a keyword here,
+ * it should also be added to the flex file SPEditorTokens.l
+ */
+-(NSArray *)functions
+{
+ return [NSArray arrayWithObjects:
@"ABS",
@"ACOS",
@"ADDDATE",
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index b3fdbe31..d90f4a2c 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -131,7 +131,10 @@
B5E92F400F75B32100012500 /* toolbar-export-xml.tiff in Resources */ = {isa = PBXBuildFile; fileRef = B5E92F3A0F75B32100012500 /* toolbar-export-xml.tiff */; };
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 */; };
+ BC26D7A90FCB28F900A4F918 /* dummy-small.png in Resources */ = {isa = PBXBuildFile; fileRef = BC26D7A80FCB28F900A4F918 /* dummy-small.png */; };
BC2C8E220FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html in Resources */ = {isa = PBXBuildFile; fileRef = BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */; };
+ BC6B05A80FCB26A500AC02A6 /* database-small.png in Resources */ = {isa = PBXBuildFile; fileRef = BC6B05A70FCB26A500AC02A6 /* database-small.png */; };
+ BCA509480FCB25F200D3879C /* table-small-square.tiff in Resources */ = {isa = PBXBuildFile; fileRef = BCA509450FCB25F200D3879C /* table-small-square.tiff */; };
BCB151910FC9542B00977C87 /* SPNarrowDownCompletion.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB151900FC9542B00977C87 /* SPNarrowDownCompletion.m */; };
BCD0AD490FBBFC340066EA5C /* SPSQLTokenizer.l in Sources */ = {isa = PBXBuildFile; fileRef = BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */; };
/* End PBXBuildFile section */
@@ -359,7 +362,10 @@
B5E92F3A0F75B32100012500 /* toolbar-export-xml.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "toolbar-export-xml.tiff"; sourceTree = "<group>"; };
B5EAC0FC0EC87FF900CC579C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
B5F4F7800F7BCF990059AE84 /* toolbar-switch-to-procedures.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "toolbar-switch-to-procedures.tiff"; sourceTree = "<group>"; };
+ BC26D7A80FCB28F900A4F918 /* dummy-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "dummy-small.png"; 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>"; };
+ BC6B05A70FCB26A500AC02A6 /* database-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "database-small.png"; sourceTree = "<group>"; };
+ BCA509450FCB25F200D3879C /* table-small-square.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "table-small-square.tiff"; sourceTree = "<group>"; };
BCB1518F0FC9542B00977C87 /* SPNarrowDownCompletion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPNarrowDownCompletion.h; sourceTree = "<group>"; };
BCB151900FC9542B00977C87 /* SPNarrowDownCompletion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPNarrowDownCompletion.m; sourceTree = "<group>"; };
BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; path = SPSQLTokenizer.l; sourceTree = "<group>"; };
@@ -645,6 +651,9 @@
17E6418B0EF01FF7001BC333 /* Images */ = {
isa = PBXGroup;
children = (
+ BC26D7A80FCB28F900A4F918 /* dummy-small.png */,
+ BC6B05A70FCB26A500AC02A6 /* database-small.png */,
+ BCA509450FCB25F200D3879C /* table-small-square.tiff */,
384582C60FB9603600DDACB6 /* proc-small.png */,
384582C30FB95FF800DDACB6 /* func-small.png */,
17E6418C0EF02036001BC333 /* appicon.icns */,
@@ -952,6 +961,9 @@
B5D93ABB0FC5121300710017 /* toolbar-preferences-network.tiff in Resources */,
B5D93ABC0FC5121300710017 /* toolbar-preferences-queryeditor.tiff in Resources */,
B5D93ABD0FC5121300710017 /* toolbar-preferences-shortcuts.png in Resources */,
+ BCA509480FCB25F200D3879C /* table-small-square.tiff in Resources */,
+ BC6B05A80FCB26A500AC02A6 /* database-small.png in Resources */,
+ BC26D7A90FCB28F900A4F918 /* dummy-small.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};