diff options
-rw-r--r-- | Interfaces/English.lproj/QueryFavoriteManager.xib | 90 | ||||
-rw-r--r-- | Resources/CompletionTokens.plist | 8 | ||||
-rw-r--r-- | Resources/PreferenceDefaults.plist | 2 | ||||
-rw-r--r-- | Source/CMTextView.m | 45 | ||||
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 2 |
5 files changed, 106 insertions, 41 deletions
diff --git a/Interfaces/English.lproj/QueryFavoriteManager.xib b/Interfaces/English.lproj/QueryFavoriteManager.xib index d4b64179..1a3cf4d3 100644 --- a/Interfaces/English.lproj/QueryFavoriteManager.xib +++ b/Interfaces/English.lproj/QueryFavoriteManager.xib @@ -21,6 +21,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="1"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -67,7 +68,6 @@ <int key="NSvFlags">4106</int> <string key="NSFrame">{{0, 358}, {500, 5}}</string> <reference key="NSSuperview" ref="1006"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -117,7 +117,6 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{-1, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="12172024"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="63587388"> <int key="NSCellFlags">67239424</int> @@ -142,7 +141,6 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{30, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="12172024"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1023807891"> <int key="NSCellFlags">67239424</int> @@ -167,7 +165,6 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{61, -1}, {32, 24}}</string> <reference key="NSSuperview" ref="12172024"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="BWAnchoredPopUpButtonCell" key="NSCell" id="929623756"> <int key="NSCellFlags">71433792</int> @@ -320,7 +317,6 @@ </object> <string key="NSFrameSize">{209, 23}</string> <reference key="NSSuperview" ref="1030932325"/> - <reference key="NSWindow"/> <bool key="BWABBIsResizable">YES</bool> <bool key="BWABBIsAtBottom">YES</bool> <bool key="BWABBHandleIsRightAligned">NO</bool> @@ -341,14 +337,12 @@ <int key="NSvFlags">4370</int> <string key="NSFrameSize">{210, 322}</string> <reference key="NSSuperview" ref="106335880"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTableHeaderView" key="NSHeaderView" id="724842455"> <reference key="NSNextResponder" ref="642947098"/> <int key="NSvFlags">4352</int> <string key="NSFrameSize">{210, 17}</string> <reference key="NSSuperview" ref="642947098"/> - <reference key="NSWindow"/> <reference key="NSTableView" ref="522643855"/> </object> <object class="_NSCornerView" key="NSCornerView" id="299150059"> @@ -356,7 +350,6 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{198, 0}, {12, 17}}</string> <reference key="NSSuperview" ref="205303038"/> - <reference key="NSWindow"/> </object> <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -482,7 +475,7 @@ </object> <string key="NSFrame">{{0, 17}, {210, 322}}</string> <reference key="NSSuperview" ref="205303038"/> - <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="522643855"/> <reference key="NSDocView" ref="522643855"/> <reference key="NSBGColor" ref="392588142"/> <int key="NScvFlags">4</int> @@ -492,7 +485,6 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{198, 17}, {11, 322}}</string> <reference key="NSSuperview" ref="205303038"/> - <reference key="NSWindow"/> <int key="NSsFlags">256</int> <reference key="NSTarget" ref="205303038"/> <string key="NSAction">_doScroller:</string> @@ -503,7 +495,6 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {311, 15}}</string> <reference key="NSSuperview" ref="205303038"/> - <reference key="NSWindow"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="205303038"/> <string key="NSAction">_doScroller:</string> @@ -518,7 +509,7 @@ </object> <string key="NSFrameSize">{210, 17}</string> <reference key="NSSuperview" ref="205303038"/> - <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="724842455"/> <reference key="NSDocView" ref="724842455"/> <reference key="NSBGColor" ref="392588142"/> <int key="NScvFlags">4</int> @@ -527,7 +518,7 @@ </object> <string key="NSFrame">{{0, 22}, {210, 339}}</string> <reference key="NSSuperview" ref="1030932325"/> - <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="106335880"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="322405876"/> <reference key="NSHScroller" ref="336819166"/> @@ -539,7 +530,6 @@ </object> <string key="NSFrameSize">{209, 361}</string> <reference key="NSSuperview" ref="588484039"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="BWCustomView" id="954707656"> @@ -552,7 +542,6 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{17, 15}, {117, 25}}</string> <reference key="NSSuperview" ref="954707656"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="1063983207"> <int key="NSCellFlags">-2076049856</int> @@ -607,6 +596,28 @@ <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="1063983207"/> </object> + <object class="NSMenuItem" id="613928550"> + <reference key="NSMenu" ref="217968621"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="451328194"/> + <reference key="NSMixedImage" ref="770393621"/> + <string key="NSAction">_popUpItemAction:</string> + <reference key="NSTarget" ref="1063983207"/> + </object> + <object class="NSMenuItem" id="866231750"> + <reference key="NSMenu" ref="217968621"/> + <string key="NSTitle">list template</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="451328194"/> + <reference key="NSMixedImage" ref="770393621"/> + <string key="NSAction">_popUpItemAction:</string> + <reference key="NSTarget" ref="1063983207"/> + </object> <object class="NSMenuItem" id="465218922"> <reference key="NSMenu" ref="217968621"/> <bool key="NSIsDisabled">YES</bool> @@ -652,7 +663,7 @@ </object> <reference key="NSMenuFont" ref="1071840538"/> </object> - <int key="NSSelectedIndex">6</int> + <int key="NSSelectedIndex">4</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -665,7 +676,6 @@ <int key="NSvFlags">290</int> <string key="NSFrame">{{92, 54}, {178, 19}}</string> <reference key="NSSuperview" ref="954707656"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="276546601"> <int key="NSCellFlags">-1804468671</int> @@ -688,7 +698,6 @@ <int key="NSvFlags">288</int> <string key="NSFrame">{{17, 57}, {70, 14}}</string> <reference key="NSSuperview" ref="954707656"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="497354008"> <int key="NSCellFlags">68288064</int> @@ -710,7 +719,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 330}, {45, 14}}</string> <reference key="NSSuperview" ref="954707656"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="448987091"> <int key="NSCellFlags">68288064</int> @@ -727,7 +735,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{56, 328}, {214, 19}}</string> <reference key="NSSuperview" ref="954707656"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="474077606"> <int key="NSCellFlags">-1804468671</int> @@ -779,7 +786,6 @@ </object> <string key="NSFrameSize">{248, 14}</string> <reference key="NSSuperview" ref="221447089"/> - <reference key="NSWindow"/> <object class="NSTextContainer" key="NSTextContainer" id="74289808"> <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> @@ -854,7 +860,7 @@ </object> <string key="NSFrame">{{1, 1}, {248, 236}}</string> <reference key="NSSuperview" ref="407061848"/> - <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="556251150"/> <reference key="NSDocView" ref="556251150"/> <reference key="NSBGColor" ref="359131077"/> <object class="NSCursor" key="NSCursor"> @@ -868,7 +874,6 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {11, 133}}</string> <reference key="NSSuperview" ref="407061848"/> - <reference key="NSWindow"/> <int key="NSsFlags">256</int> <reference key="NSTarget" ref="407061848"/> <string key="NSAction">_doScroller:</string> @@ -879,7 +884,6 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {87, 18}}</string> <reference key="NSSuperview" ref="407061848"/> - <reference key="NSWindow"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="407061848"/> <string key="NSAction">_doScroller:</string> @@ -889,7 +893,7 @@ </object> <string key="NSFrame">{{20, 82}, {250, 238}}</string> <reference key="NSSuperview" ref="954707656"/> - <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="221447089"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="978638217"/> <reference key="NSHScroller" ref="1008017707"/> @@ -900,7 +904,6 @@ <int key="NSvFlags">289</int> <string key="NSFrame">{{205, 13}, {70, 28}}</string> <reference key="NSSuperview" ref="954707656"/> - <reference key="NSWindow"/> <int key="NSTag">1</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="908635119"> @@ -927,7 +930,6 @@ <int key="NSvFlags">289</int> <string key="NSFrame">{{137, 13}, {70, 28}}</string> <reference key="NSSuperview" ref="954707656"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="615814080"> <int key="NSCellFlags">67239424</int> @@ -947,13 +949,11 @@ </object> <string key="NSFrame">{{210, 0}, {290, 361}}</string> <reference key="NSSuperview" ref="588484039"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrameSize">{500, 361}</string> <reference key="NSSuperview" ref="1006"/> - <reference key="NSWindow"/> <bool key="NSIsVertical">YES</bool> <int key="NSDividerStyle">2</int> <string key="NSAutosaveName">SPQueryFavoriteSplitView</string> @@ -1020,7 +1020,6 @@ </object> <string key="NSFrameSize">{500, 371}</string> <reference key="NSSuperview"/> - <reference key="NSWindow"/> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSMinSize">{500, 393}</string> @@ -1910,6 +1909,8 @@ <reference ref="279891750"/> <reference ref="70354412"/> <reference ref="816443132"/> + <reference ref="613928550"/> + <reference ref="866231750"/> </object> <reference key="parent" ref="1063983207"/> </object> @@ -1948,6 +1949,16 @@ <reference key="object" ref="816443132"/> <reference key="parent" ref="217968621"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">325</int> + <reference key="object" ref="613928550"/> + <reference key="parent" ref="217968621"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">326</int> + <reference key="object" ref="866231750"/> + <reference key="parent" ref="217968621"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -2054,6 +2065,9 @@ <string>322.IBPluginDependency</string> <string>323.IBAttributePlaceholdersKey</string> <string>323.IBPluginDependency</string> + <string>325.IBPluginDependency</string> + <string>326.IBAttributePlaceholdersKey</string> + <string>326.IBPluginDependency</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -2206,7 +2220,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{371, 222}, {216, 115}}</string> + <string>{{371, 195}, {216, 142}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableDictionary"> @@ -2265,6 +2279,18 @@ YXRhYmFzZSBuYW1lCgpbb25seSBhdmFpbGFibGUgaW5zaWRlIG9mIHRhYiBzbmlwcGV0c10</string> </object> </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSMutableDictionary"> + <string key="NS.key.0">ToolTip</string> + <object class="IBToolTipAttribute" key="NS.object.0"> + <string key="name">ToolTip</string> + <reference key="object" ref="866231750"/> + <string type="base64-UTF8" key="toolTip">wqZhwqZiwqYg4oCTIHN1Y2ggYSBzbmlwcGV0IHdpbGwgYmUgc2hvd24gYXMgY29tcGxldGlvbiBsaXN0 +IHdpdGggdGhlIGl0ZW1zIOKAnGHigJ0gYW5kIOKAnGLigJ0KCltvbmx5IGF2YWlsYWJsZSBpbnNpZGUg +b2YgdGFiIHNuaXBwZXRzXQ</string> + </object> + </object> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> @@ -2283,7 +2309,7 @@ YXRhYmFzZSBuYW1lCgpbb25seSBhdmFpbGFibGUgaW5zaWRlIG9mIHRhYiBzbmlwcGV0c10</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">324</int> + <int key="maxID">326</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/Resources/CompletionTokens.plist b/Resources/CompletionTokens.plist index efbc4648..16f6a598 100644 --- a/Resources/CompletionTokens.plist +++ b/Resources/CompletionTokens.plist @@ -223,7 +223,6 @@ <string>FUNCTION</string> <string>GEOMETRY</string> <string>GEOMETRYCOLLECTION</string> - <string>GET_FORMAT</string> <string>GLOBAL</string> <string>GRANT</string> <string>GRANTS</string> @@ -833,6 +832,7 @@ <string>MAKETIME</string> <string>MAKE_SET</string> <string>MASTER_POS_WAIT</string> + <string>MATCH</string> <string>MAX</string> <string>MBRCONTAINS</string> <string>MBRDISJOINT</string> @@ -1005,7 +1005,7 @@ <key>LEAST</key> <string>${1:value1}, ${2:value2}</string> <key>MATCH</key> - <string>${1:col} AGAINST ${2:expr}</string> + <string>${1:col_list} AGAINST ${2:expr}${3: ${4:¦IN BOOLEAN MODE¦IN NATURAL LANGUAGE MODE¦IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION¦WITH QUERY EXPANSION¦}}</string> <key>DES_DECRYPT</key> <string>${1:crypt_str}${2:, ${3:key_str}}</string> <key>DECODE</key> @@ -1095,7 +1095,7 @@ <key>PERIOD_DIFF</key> <string>${1:P1}, ${2:P2}</string> <key>DES_ENCRYPT</key> - <string>${1:str},${2:key_num|key_str}</string> + <string>${1:str}${2:, ${3:¦key_num¦key_str¦}}</string> <key>STR_TO_DATE</key> <string>${1:str}, ${2:format}</string> <key>DATE_SUB</key> @@ -1113,7 +1113,7 @@ <key>AES_ENCRYPT</key> <string>${1:str}, ${2:key_str}</string> <key>GET_FORMAT</key> - <string>${1:DATE|TIME|DATETIME}, ${2:'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'}</string> + <string>${1:¦DATE¦TIME¦DATETIME¦}, ${2:¦'EUR'¦'USA'¦'JIS'¦'ISO'¦'INTERNAL'¦}</string> <key>FIELD</key> <string>${1:str}, ${2:str1}</string> <key>MAKETIME</key> diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist index 9b8bec6a..a16c0c9d 100644 --- a/Resources/PreferenceDefaults.plist +++ b/Resources/PreferenceDefaults.plist @@ -89,7 +89,7 @@ <key>CustomQueryFunctionCompletionInsertsArguments</key> <true/> <key>CustomQueryAutoComplete</key> - <false/> + <true/> <key>CustomQueryAutoCompleteDelay</key> <real>1.5</real> <key>CustomQueryAutoHelpDelay</key> diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 32434682..b21b65ee 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -715,7 +715,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [completionPopUp setCaretPos:pos]; completionIsOpen = YES; [completionPopUp orderFront:self]; - [completionPopUp insertCommonPrefix]; + if(!autoCompleteMode) + [completionPopUp insertCommonPrefix]; } @@ -1103,10 +1104,48 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) if(snippetControlArray[currentSnippetIndex][2] == 0) { NSRange r1 = NSMakeRange(snippetControlArray[currentSnippetIndex][0], snippetControlArray[currentSnippetIndex][1]); NSRange r2 = NSIntersectionRange(NSMakeRange(0,[[self string] length]), r1); - if(r1.location == r2.location && r1.length == r2.length) + if(r1.location == r2.location && r1.length == r2.length) { [self setSelectedRange:r2]; - else + NSString *snip = [[self string] substringWithRange:r2]; + if([snip length] > 2 && [snip hasPrefix:@"¦"] && [snip hasSuffix:@"¦"]) { + NSArray *list = [[snip substringWithRange:NSMakeRange(1,[snip length]-2)] componentsSeparatedByString:@"¦"]; + NSMutableArray *possibleCompletions = [[[NSMutableArray alloc] initWithCapacity:[list count]] autorelease]; + for(id w in list) + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"dummy-small", @"image", nil]]; + + SPNarrowDownCompletion* completionPopUp = [[SPNarrowDownCompletion alloc] initWithItems:possibleCompletions + alreadyTyped:@"" + staticPrefix:@"" + additionalWordCharacters:@"_." + caseSensitive:NO + charRange:r2 + parseRange:r2 + inView:self + dictMode:NO + dbMode:NO + tabTriggerMode:[self isSnippetMode] + fuzzySearch:NO + backtickMode:NO + withDbName:@"" + withTableName:@"" + selectedDb:@"" + caretMovedLeft:NO + autoComplete:NO]; + + //Get the NSPoint of the first character of the current word + NSRange glyphRange = [[self layoutManager] glyphRangeForCharacterRange:NSMakeRange(r2.location,1) actualCharacterRange:NULL]; + NSRect boundingRect = [[self layoutManager] boundingRectForGlyphRange:glyphRange inTextContainer:[self textContainer]]; + boundingRect = [self convertRect: boundingRect toView: NULL]; + NSPoint pos = [[self window] convertBaseToScreen: NSMakePoint(boundingRect.origin.x + boundingRect.size.width,boundingRect.origin.y + boundingRect.size.height)]; + // Adjust list location to be under the current word or insertion point + pos.y -= [[self font] pointSize]*1.25; + [completionPopUp setCaretPos:pos]; + completionIsOpen = YES; + [completionPopUp orderFront:self]; + } + } else { [self endSnippetSession]; + } } } else { // for safety reasons [self endSnippetSession]; diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index 10d4c1f7..9f539d67 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -574,7 +574,7 @@ break; } } - else if(key == NSCarriageReturnCharacter || key == NSTabCharacter) + else if(key == NSCarriageReturnCharacter || (key == NSTabCharacter && !triggerMode)) { [self completeAndInsertSnippet]; } |