diff options
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 202 | ||||
-rw-r--r-- | Interfaces/English.lproj/QueryFavoriteManager.xib | 68 | ||||
-rw-r--r-- | Source/CMTextView.h | 2 | ||||
-rw-r--r-- | Source/CMTextView.m | 219 | ||||
-rw-r--r-- | Source/CustomQuery.h | 1 | ||||
-rw-r--r-- | Source/CustomQuery.m | 15 | ||||
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 9 |
7 files changed, 438 insertions, 78 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index b425a7c5..5d3083e8 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -23,8 +23,6 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="6885"/> - <integer value="5281"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -102,6 +100,7 @@ <int key="NSvFlags">290</int> <string key="NSFrame">{{5, 2}, {204, 19}}</string> <reference key="NSSuperview" ref="801427893"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSSearchFieldCell" key="NSCell" id="134854992"> <int key="NSCellFlags">343014976</int> @@ -194,6 +193,7 @@ <int key="NSvFlags">4362</int> <string key="NSFrameSize">{218, 38}</string> <reference key="NSSuperview" ref="494991824"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -283,6 +283,7 @@ </object> <string key="NSFrame">{{1, 1}, {218, 38}}</string> <reference key="NSSuperview" ref="607475905"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="970881282"/> <reference key="NSDocView" ref="970881282"/> <object class="NSColor" key="NSBGColor" id="1024678221"> @@ -298,6 +299,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {15, 8}}</string> <reference key="NSSuperview" ref="607475905"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="607475905"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.42105263471603394</double> @@ -307,6 +309,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {223, 15}}</string> <reference key="NSSuperview" ref="607475905"/> + <reference key="NSWindow"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="607475905"/> <string key="NSAction">_doScroller:</string> @@ -315,6 +318,7 @@ </object> <string key="NSFrame">{{-1, -13}, {220.212, 40}}</string> <reference key="NSSuperview" ref="801427893"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="494991824"/> <int key="NSsFlags">2</int> <reference key="NSVScroller" ref="196112633"/> @@ -325,6 +329,7 @@ </object> <string key="NSFrameSize">{214, 26}</string> <reference key="NSSuperview" ref="213762440"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="BWCustomView" id="1017775084"> @@ -347,6 +352,7 @@ <int key="NSvFlags">4352</int> <string key="NSFrameSize">{214, 354}</string> <reference key="NSSuperview" ref="73685676"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -413,6 +419,7 @@ </object> <string key="NSFrameSize">{214, 354}</string> <reference key="NSSuperview" ref="233472824"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="251040077"/> <reference key="NSDocView" ref="251040077"/> <reference key="NSBGColor" ref="1024678221"/> @@ -423,6 +430,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{197, 0}, {15, 292}}</string> <reference key="NSSuperview" ref="233472824"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="233472824"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">0.096045196056365967</double> @@ -433,6 +441,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {141, 11}}</string> <reference key="NSSuperview" ref="233472824"/> + <reference key="NSWindow"/> <int key="NSsFlags">257</int> <reference key="NSTarget" ref="233472824"/> <string key="NSAction">_doScroller:</string> @@ -441,6 +450,7 @@ </object> <string key="NSFrameSize">{214, 354}</string> <reference key="NSSuperview" ref="1017775084"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="73685676"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="693168867"/> @@ -451,11 +461,13 @@ </object> <string key="NSFrame">{{0, 27}, {214, 354}}</string> <reference key="NSSuperview" ref="213762440"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrameSize">{214, 381}</string> <reference key="NSSuperview" ref="131633443"/> + <reference key="NSWindow"/> <int key="NSDividerStyle">2</int> <object class="NSColor" key="BWSVColor"> <int key="NSColorSpace">6</int> @@ -489,6 +501,7 @@ </object> <string key="NSFrameSize">{214, 381}</string> <reference key="NSSuperview" ref="298095498"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="BWCustomView" id="192579410"> @@ -511,6 +524,7 @@ <int key="NSvFlags">4352</int> <string key="NSFrameSize">{214, 145}</string> <reference key="NSSuperview" ref="685057119"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -577,6 +591,7 @@ </object> <string key="NSFrameSize">{214, 145}</string> <reference key="NSSuperview" ref="298226231"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="347093764"/> <reference key="NSDocView" ref="347093764"/> <reference key="NSBGColor" ref="1024678221"/> @@ -587,6 +602,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {15, 20}}</string> <reference key="NSSuperview" ref="298226231"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="298226231"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">0.48965516686439514</double> @@ -597,6 +613,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {141, 11}}</string> <reference key="NSSuperview" ref="298226231"/> + <reference key="NSWindow"/> <int key="NSsFlags">257</int> <reference key="NSTarget" ref="298226231"/> <string key="NSAction">_doScroller:</string> @@ -605,6 +622,7 @@ </object> <string key="NSFrameSize">{214, 145}</string> <reference key="NSSuperview" ref="192579410"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="685057119"/> <int key="NSsFlags">512</int> <reference key="NSVScroller" ref="245346414"/> @@ -615,11 +633,13 @@ </object> <string key="NSFrame">{{0, 382}, {214, 145}}</string> <reference key="NSSuperview" ref="298095498"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrame">{{0, 23}, {214, 527}}</string> <reference key="NSSuperview" ref="372294785"/> + <reference key="NSWindow"/> <int key="NSDividerStyle">2</int> <reference key="BWSVColor" ref="304829493"/> <bool key="BWSVColorIsEnabled">NO</bool> @@ -670,6 +690,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{-1, -1}, {32, 24}}</string> <reference key="NSSuperview" ref="28219887"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="BWAnchoredButtonCell" key="NSCell" id="283448047"> <int key="NSCellFlags">67239424</int> @@ -694,6 +715,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{30, -1}, {32, 24}}</string> <reference key="NSSuperview" ref="28219887"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="BWAnchoredPopUpButtonCell" key="NSCell" id="321871356"> <int key="NSCellFlags">71433792</int> @@ -799,6 +821,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{61, -1}, {32, 24}}</string> <reference key="NSSuperview" ref="28219887"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="BWAnchoredButtonCell" key="NSCell" id="227511715"> <int key="NSCellFlags">67239424</int> @@ -823,6 +846,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{92, -1}, {32, 24}}</string> <reference key="NSSuperview" ref="28219887"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="BWAnchoredButtonCell" key="NSCell" id="708016222"> <int key="NSCellFlags">-2080244224</int> @@ -849,6 +873,7 @@ </object> <string key="NSFrameSize">{214, 23}</string> <reference key="NSSuperview" ref="372294785"/> + <reference key="NSWindow"/> <bool key="BWABBIsResizable">YES</bool> <bool key="BWABBIsAtBottom">YES</bool> <bool key="BWABBHandleIsRightAligned">NO</bool> @@ -857,6 +882,7 @@ </object> <string key="NSFrameSize">{214, 550}</string> <reference key="NSSuperview" ref="937377983"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="604818293"> @@ -869,6 +895,7 @@ <int key="NSvFlags">274</int> <string key="NSFrame">{{-7, -10}, {741, 564}}</string> <reference key="NSSuperview" ref="604818293"/> + <reference key="NSWindow"/> <object class="NSMutableArray" key="NSTabViewItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTabViewItem" id="831053945"> @@ -2944,6 +2971,7 @@ </object> <string key="NSFrameSize">{694, 14}</string> <reference key="NSSuperview" ref="1072692119"/> + <reference key="NSWindow"/> <object class="NSTextContainer" key="NSTextContainer" id="326170846"> <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> @@ -3003,6 +3031,7 @@ </object> <string key="NSFrame">{{1, 1}, {694, 155}}</string> <reference key="NSSuperview" ref="71560786"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="1055190999"/> <reference key="NSDocView" ref="1055190999"/> <reference key="NSBGColor" ref="449903125"/> @@ -3017,6 +3046,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{598, 1}, {15, 68}}</string> <reference key="NSSuperview" ref="71560786"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="71560786"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">1</double> @@ -3026,6 +3056,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {601, 11}}</string> <reference key="NSSuperview" ref="71560786"/> + <reference key="NSWindow"/> <int key="NSsFlags">257</int> <reference key="NSTarget" ref="71560786"/> <string key="NSAction">_doScroller:</string> @@ -3035,6 +3066,7 @@ </object> <string key="NSFrameSize">{696, 157}</string> <reference key="NSSuperview" ref="873437769"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="1072692119"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="413233170"/> @@ -3044,6 +3076,7 @@ </object> <string key="NSFrameSize">{696, 156}</string> <reference key="NSSuperview" ref="894339536"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="345834048"> @@ -3066,12 +3099,14 @@ <int key="NSvFlags">4352</int> <string key="NSFrameSize">{694, 228}</string> <reference key="NSSuperview" ref="90844306"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTableHeaderView" key="NSHeaderView" id="1038415606"> <reference key="NSNextResponder" ref="533922066"/> <int key="NSvFlags">256</int> <string key="NSFrameSize">{694, 17}</string> <reference key="NSSuperview" ref="533922066"/> + <reference key="NSWindow"/> <reference key="NSTableView" ref="581095761"/> </object> <object class="_NSCornerView" key="NSCornerView" id="151074124"> @@ -3079,6 +3114,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-26, 0}, {16, 17}}</string> <reference key="NSSuperview" ref="678281118"/> + <reference key="NSWindow"/> </object> <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -3125,6 +3161,7 @@ </object> <string key="NSFrame">{{1, 17}, {694, 228}}</string> <reference key="NSSuperview" ref="678281118"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="581095761"/> <reference key="NSDocView" ref="581095761"/> <reference key="NSBGColor" ref="1024678221"/> @@ -3135,6 +3172,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{611, 17}, {15, 30}}</string> <reference key="NSSuperview" ref="678281118"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="678281118"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">0.65789473056793213</double> @@ -3145,6 +3183,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{1, 47}, {610, 15}}</string> <reference key="NSSuperview" ref="678281118"/> + <reference key="NSWindow"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="678281118"/> <string key="NSAction">_doScroller:</string> @@ -3159,6 +3198,7 @@ </object> <string key="NSFrame">{{1, 0}, {694, 17}}</string> <reference key="NSSuperview" ref="678281118"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="1038415606"/> <reference key="NSDocView" ref="1038415606"/> <reference key="NSBGColor" ref="1024678221"/> @@ -3168,6 +3208,7 @@ </object> <string key="NSFrameSize">{696, 246}</string> <reference key="NSSuperview" ref="345834048"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="90844306"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="472831765"/> @@ -3182,6 +3223,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{156, 246}, {98, 22}}</string> <reference key="NSSuperview" ref="345834048"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="830957297"> <int key="NSCellFlags">-2076049856</int> @@ -3295,6 +3337,7 @@ <int key="NSvFlags">264</int> <string key="NSFrame">{{38, 246}, {108, 22}}</string> <reference key="NSSuperview" ref="345834048"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="416049103"> <int key="NSCellFlags">-2076049856</int> @@ -3409,6 +3452,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{-10, 245}, {48, 25}}</string> <reference key="NSSuperview" ref="345834048"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="984501775"> <int key="NSCellFlags">-2076049856</int> @@ -3607,6 +3651,51 @@ <int key="NSTag">8</int> <reference key="NSTarget" ref="984501775"/> </object> + <object class="NSMenuItem" id="751809280"> + <reference key="NSMenu" ref="60735230"/> + <string key="NSTitle">Show Completion List</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="450876295"/> + <reference key="NSMixedImage" ref="414351669"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="444632858"> + <string key="NSTitle">Show Completion List</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="177004131"> + <reference key="NSMenu" ref="444632858"/> + <string key="NSTitle">all databases names</string> + <string key="NSKeyEquiv">1</string> + <int key="NSKeyEquivModMask">262144</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="450876295"/> + <reference key="NSMixedImage" ref="414351669"/> + <int key="NSTag">8000</int> + </object> + <object class="NSMenuItem" id="256934198"> + <reference key="NSMenu" ref="444632858"/> + <string key="NSTitle">all table and view names</string> + <string key="NSKeyEquiv">2</string> + <int key="NSKeyEquivModMask">262144</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="450876295"/> + <reference key="NSMixedImage" ref="414351669"/> + <int key="NSTag">8001</int> + </object> + <object class="NSMenuItem" id="928430119"> + <reference key="NSMenu" ref="444632858"/> + <string key="NSTitle">all field names from current table</string> + <string key="NSKeyEquiv">3</string> + <int key="NSKeyEquivModMask">262144</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="450876295"/> + <reference key="NSMixedImage" ref="414351669"/> + <int key="NSTag">8002</int> + </object> + </object> + </object> + </object> <object class="NSMenuItem" id="309123434"> <reference key="NSMenu" ref="60735230"/> <bool key="NSIsDisabled">YES</bool> @@ -3686,7 +3775,7 @@ </object> <bool key="NSNoAutoenable">YES</bool> </object> - <int key="NSSelectedIndex">19</int> + <int key="NSSelectedIndex">15</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -3698,6 +3787,7 @@ <int key="NSvFlags">265</int> <string key="NSFrame">{{597, 248}, {90, 17}}</string> <reference key="NSSuperview" ref="345834048"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="177866566"> <int key="NSCellFlags">-2080244224</int> @@ -3719,6 +3809,7 @@ <int key="NSvFlags">265</int> <string key="NSFrame">{{479, 248}, {110, 17}}</string> <reference key="NSSuperview" ref="345834048"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="588489390"> <int key="NSCellFlags">604110336</int> @@ -3751,6 +3842,7 @@ </object> <string key="NSFrame">{{32, 246}, {664, 23}}</string> <reference key="NSSuperview" ref="345834048"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSImageCell" key="NSCell" id="76236597"> <int key="NSCellFlags">130560</int> @@ -3766,6 +3858,7 @@ </object> <string key="NSFrame">{{0, 165}, {696, 269}}</string> <reference key="NSSuperview" ref="894339536"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="875002707"> @@ -3778,6 +3871,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{242, 64}, {437, 17}}</string> <reference key="NSSuperview" ref="875002707"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="401235649"> <int key="NSCellFlags">67239424</int> @@ -3794,6 +3888,7 @@ <int key="NSvFlags">264</int> <string key="NSFrame">{{17, 67}, {143, 14}}</string> <reference key="NSSuperview" ref="875002707"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="194978207"> <int key="NSCellFlags">67239424</int> @@ -3810,6 +3905,7 @@ <int key="NSvFlags">274</int> <string key="NSFrame">{{17, 20}, {662, 43}}</string> <reference key="NSSuperview" ref="875002707"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="948571736"> <int key="NSCellFlags">69336577</int> @@ -3824,15 +3920,18 @@ </object> <string key="NSFrame">{{0, 443}, {696, 87}}</string> <reference key="NSSuperview" ref="894339536"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrame">{{6, 10}, {696, 530}}</string> <reference key="NSSuperview" ref="746504912"/> + <reference key="NSWindow"/> </object> </object> <string key="NSFrame">{{10, 7}, {706, 544}}</string> <reference key="NSSuperview" ref="714795046"/> + <reference key="NSWindow"/> </object> <string key="NSLabel">Custom Query</string> <reference key="NSColor" ref="62854682"/> @@ -5491,11 +5590,13 @@ </object> <string key="NSFrame">{{215, 0}, {729, 550}}</string> <reference key="NSSuperview" ref="937377983"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrameSize">{944, 550}</string> <reference key="NSSuperview" ref="579726586"/> + <reference key="NSWindow"/> <bool key="NSIsVertical">YES</bool> <int key="NSDividerStyle">2</int> <string key="NSAutosaveName">DBViewSplitter</string> @@ -5503,6 +5604,7 @@ </object> <string key="NSFrameSize">{944, 550}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{780, 502}</string> @@ -11450,7 +11552,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="260025442"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -11614,7 +11716,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSFrame">{{1, 17}, {358, 139}}</string> <reference key="NSSuperview" ref="880498064"/> - <reference key="NSNextKeyView" ref="999861934"/> <reference key="NSDocView" ref="999861934"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -11648,7 +11749,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSFrame">{{1, 0}, {358, 17}}</string> <reference key="NSSuperview" ref="880498064"/> - <reference key="NSNextKeyView" ref="956714173"/> <reference key="NSDocView" ref="956714173"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -11657,7 +11757,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSFrameSize">{360, 157}</string> <reference key="NSSuperview" ref="260025442"/> - <reference key="NSNextKeyView" ref="361281463"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="710144066"/> <reference key="NSHScroller" ref="786626704"/> @@ -11668,7 +11767,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> </object> <string key="NSFrameSize">{360, 157}</string> - <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="532635418"> @@ -11745,12 +11843,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSClassName">NSView</string> </object> <object class="NSUserDefaultsController" id="461189245"> - <object class="NSMutableArray" key="NSDeclaredKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>CustomQueryAutoComplete</string> - <string>CustomQueryAuto</string> - <string>CustomQueryAutoUppercaseKeywords</string> - </object> <bool key="NSSharedInstance">YES</bool> </object> <object class="NSCustomObject" id="601471102"> @@ -16222,6 +16314,30 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <int key="connectionID">6912</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showCompletionList:</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="177004131"/> + </object> + <int key="connectionID">6918</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showCompletionList:</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="256934198"/> + </object> + <int key="connectionID">6919</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showCompletionList:</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="928430119"/> + </object> + <int key="connectionID">6920</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -18468,6 +18584,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference ref="635467451"/> <reference ref="128208712"/> <reference ref="919863898"/> + <reference ref="751809280"/> </object> <reference key="parent" ref="984501775"/> </object> @@ -22815,6 +22932,41 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference key="object" ref="919863898"/> <reference key="parent" ref="60735230"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">6913</int> + <reference key="object" ref="751809280"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="444632858"/> + </object> + <reference key="parent" ref="60735230"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6914</int> + <reference key="object" ref="444632858"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="177004131"/> + <reference ref="256934198"/> + <reference ref="928430119"/> + </object> + <reference key="parent" ref="751809280"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6915</int> + <reference key="object" ref="177004131"/> + <reference key="parent" ref="444632858"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6916</int> + <reference key="object" ref="256934198"/> + <reference key="parent" ref="444632858"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6917</int> + <reference key="object" ref="928430119"/> + <reference key="parent" ref="444632858"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -24195,6 +24347,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>6901.IBPluginDependency</string> <string>6902.IBPluginDependency</string> <string>6908.IBPluginDependency</string> + <string>6913.IBPluginDependency</string> + <string>6914.IBEditorWindowLastContentRect</string> + <string>6914.IBPluginDependency</string> + <string>6915.IBPluginDependency</string> + <string>6916.IBPluginDependency</string> + <string>6917.IBPluginDependency</string> <string>711.IBPluginDependency</string> <string>711.ImportedFromIB2</string> <string>713.IBPluginDependency</string> @@ -25004,11 +25162,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{-1, 152}, {944, 550}}</string> + <string>{{110, 223}, {944, 550}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="YES"/> <boolean value="NO"/> - <string>{{-1, 152}, {944, 550}}</string> + <string>{{110, 223}, {944, 550}}</string> <integer value="1"/> <integer value="1"/> <string>{{62, 352}, {845, 504}}</string> @@ -25174,7 +25332,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{202, 69}, {256, 462}}</string> + <string>{{254, 52}, {256, 479}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -26192,6 +26350,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{510, 121}, {302, 63}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> @@ -26334,7 +26498,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">6912</int> + <int key="maxID">6920</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -27968,6 +28132,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>runSelectedQueries:</string> <string>saveQueryHistory:</string> <string>showAutoHelpForCurrentWord:</string> + <string>showCompletionList:</string> <string>showHelpForCurrentWord:</string> <string>showHelpForSearchString:</string> </object> @@ -27994,6 +28159,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>id</string> <string>id</string> <string>id</string> + <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> diff --git a/Interfaces/English.lproj/QueryFavoriteManager.xib b/Interfaces/English.lproj/QueryFavoriteManager.xib index bc83f0d5..8789a97b 100644 --- a/Interfaces/English.lproj/QueryFavoriteManager.xib +++ b/Interfaces/English.lproj/QueryFavoriteManager.xib @@ -21,7 +21,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="1"/> + <integer value="280"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -692,6 +692,26 @@ <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="1063983207"/> </object> + <object class="NSMenuItem" id="645636716"> + <reference key="NSMenu" ref="217968621"/> + <string key="NSTitle">field names of current table</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="226365011"> + <reference key="NSMenu" ref="217968621"/> + <string key="NSTitle">field names of current table (fuzzy search)</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="385598013"> <reference key="NSMenu" ref="217968621"/> <string key="NSTitle">table name list</string> @@ -735,7 +755,7 @@ </object> <reference key="NSMenuFont" ref="1071840538"/> </object> - <int key="NSSelectedIndex">15</int> + <int key="NSSelectedIndex">12</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -1990,6 +2010,8 @@ <reference ref="825914912"/> <reference ref="385598013"/> <reference ref="844132671"/> + <reference ref="645636716"/> + <reference ref="226365011"/> </object> <reference key="parent" ref="1063983207"/> </object> @@ -2073,6 +2095,16 @@ <reference key="object" ref="844132671"/> <reference key="parent" ref="217968621"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">334</int> + <reference key="object" ref="645636716"/> + <reference key="parent" ref="217968621"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">335</int> + <reference key="object" ref="226365011"/> + <reference key="parent" ref="217968621"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -2195,6 +2227,10 @@ <string>332.IBPluginDependency</string> <string>333.IBAttributePlaceholdersKey</string> <string>333.IBPluginDependency</string> + <string>334.IBAttributePlaceholdersKey</string> + <string>334.IBPluginDependency</string> + <string>335.IBAttributePlaceholdersKey</string> + <string>335.IBPluginDependency</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -2347,7 +2383,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{371, 83}, {260, 254}}</string> + <string>{{371, 49}, {286, 288}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableDictionary"> @@ -2487,6 +2523,30 @@ YXZhaWxhYmxlIGluc2lkZSBvZiB0YWIgc25pcHBldHNdA</string> </object> </object> <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="645636716"/> + <string type="base64-UTF8" key="toolTip">wqYkU1BfQVNMSVNUX0FMTF9GSUVMRFNfRlJPTV9TRUxFQ1RFRF9UQUJMRcKmIOKAkyBzdWNoIGEgc25p +cHBldCB3aWxsIGJlIHNob3duIGFzIGNvbXBsZXRpb24gbGlzdCB3aXRoIGFsbCBmaWVsZCBuYW1lcyBm +cm9tIHRoZSBjdXJyZW50IHNlbGVjdGVkIHRhYmxlCgpbb25seSBhdmFpbGFibGUgaW5zaWRlIG9mIHRh +YiBzbmlwcGV0c10</string> + </object> + </object> + <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="226365011"/> + <string type="base64-UTF8" key="toolTip">wqbCpiRTUF9BU0xJU1RfQUxMX0ZJRUxEU19GUk9NX1NFTEVDVEVEX1RBQkxFwqbCpiDigJMgc3VjaCBh +IHNuaXBwZXQgd2lsbCBiZSBzaG93biBhcyBjb21wbGV0aW9uIGxpc3Qgd2l0aCBhbGwgZmllbGQgbmFt +ZXMgZnJvbSB0aGUgY3VycmVudCBzZWxlY3RlZCB0YWJsZQoKW29ubHkgYXZhaWxhYmxlIGluc2lkZSBv +ZiB0YWIgc25pcHBldHNdA</string> + </object> + </object> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> @@ -2505,7 +2565,7 @@ YXZhaWxhYmxlIGluc2lkZSBvZiB0YWIgc25pcHBldHNdA</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">333</int> + <int key="maxID">335</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/Source/CMTextView.h b/Source/CMTextView.h index 71799f26..1dd0a59e 100644 --- a/Source/CMTextView.h +++ b/Source/CMTextView.h @@ -137,6 +137,8 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS - (BOOL)checkForCaretInsideSnippet; - (void)insertAsSnippet:(NSString*)theSnippet atRange:(NSRange)targetRange; +- (void)showCompletionListFor:(NSString*)kind atRange:(NSRange)aRange fuzzySearch:(BOOL)fuzzySearchMode; + - (NSUInteger)characterIndexOfPoint:(NSPoint)aPoint; - (void)insertFileContentOfFile:(NSString *)aPath; diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 7a0cfae4..7fb6ceee 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -1081,6 +1081,159 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) } /* + * Shows pre-defined completion list + */ +- (void)showCompletionListFor:(NSString*)kind atRange:(NSRange)aRange fuzzySearch:(BOOL)fuzzySearchMode +{ + + // Cancel auto-completion timer + if([prefs boolForKey:SPCustomQueryAutoComplete]) + [NSObject cancelPreviousPerformRequestsWithTarget:self + selector:@selector(doAutoCompletion) + object:nil]; + + NSMutableArray *possibleCompletions = [[[NSMutableArray alloc] initWithCapacity:0] autorelease]; + NSArray *arr = nil; + if([kind isEqualToString:@"$SP_ASLIST_ALL_TABLES"]) { + NSString *currentDb = nil; + + if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"selectedDatabase"] != nil) + currentDb = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"selectedDatabase"]; + + NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[mySQLConnection getDbStructure]]; + + if(currentDb != nil && dbs != nil && [dbs count] && [dbs objectForKey:currentDb]) { + NSArray *allTables = [[dbs objectForKey:currentDb] allKeys]; + NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; + NSArray *sortedTables = [allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + for(id table in sortedTables) { + NSDictionary * theTable = [[dbs objectForKey:currentDb] objectForKey:table]; + NSInteger structtype = [[theTable objectForKey:@" struct_type "] intValue]; + switch(structtype) { + case 0: + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:table, @"display", @"table-small-square", @"image", currentDb, @"path", [NSString stringWithFormat:@"%@.%@",currentDb,table], @"isRef", nil]]; + break; + case 1: + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:table, @"display", @"table-view-small-square", @"image", currentDb, @"path", [NSString stringWithFormat:@"%@.%@",currentDb,table], @"isRef", nil]]; + break; + } + } + } else { + arr = [NSArray arrayWithArray:[[[self delegate] valueForKeyPath:@"tablesListInstance"] allTableAndViewNames]]; + if(arr == nil) { + arr = [NSArray array]; + } + for(id w in arr) + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"table-small-square", @"image", @"", @"isRef", nil]]; + } + } + else if([kind isEqualToString:@"$SP_ASLIST_ALL_DATABASES"]) { + arr = [NSArray arrayWithArray:[[[self delegate] valueForKeyPath:@"tablesListInstance"] allDatabaseNames]]; + if(arr == nil) { + arr = [NSArray array]; + } + for(id w in arr) + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"database-small", @"image", @"", @"isRef", nil]]; + arr = [NSArray arrayWithArray:[[[self delegate] valueForKeyPath:@"tablesListInstance"] allSystemDatabaseNames]]; + if(arr == nil) { + arr = [NSArray array]; + } + for(id w in arr) + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"database-small", @"image", @"", @"isRef", nil]]; + } + else if([kind isEqualToString:@"$SP_ASLIST_ALL_FIELDS_FROM_SELECTED_TABLE"]) { + + NSString *currentDb = nil; + NSString *currentTable = nil; + + if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"selectedDatabase"] != nil) + currentDb = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"selectedDatabase"]; + if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"tableName"] != nil) + currentTable = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"tableName"]; + + NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[mySQLConnection getDbStructure]]; + if(currentDb != nil && currentTable != nil && dbs != nil && [dbs count] && [dbs objectForKey:currentDb] && [[dbs objectForKey:currentDb] objectForKey:currentTable]) { + NSDictionary * theTable = [[dbs objectForKey:currentDb] objectForKey:currentTable]; + NSArray *allFields = [theTable allKeys]; + NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; + NSArray *sortedFields = [allFields sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + for(id field in sortedFields) { + if(![field hasPrefix:@" "]) { + NSString *typ = [theTable objectForKey:field]; + // Check if type definition contains a , if so replace the bracket content by … and add + // the bracket content as "list" key to prevend the token field to split them by , + if(typ && [typ rangeOfString:@","].length) { + NSString *t = [typ stringByReplacingOccurrencesOfRegex:@"\\(.*?\\)" withString:@"(…)"]; + NSString *lst = [typ stringByMatching:@"\\(([^\\)]*?)\\)" capture:1L]; + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys: + field, @"display", + @"field-small-square", @"image", + [NSString stringWithFormat:@"%@⇠%@",currentTable,currentDb], @"path", + t, @"type", + lst, @"list", + [NSString stringWithFormat:@"%@.%@.%@",currentDb,currentTable,field], @"isRef", + nil]]; + } else { + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys: + field, @"display", + @"field-small-square", @"image", + [NSString stringWithFormat:@"%@⇠%@",currentTable,currentDb], @"path", + typ, @"type", + [NSString stringWithFormat:@"%@.%@.%@",currentDb,currentTable,field], @"isRef", + nil]]; + } + } + } + [desc release]; + } else { + arr = [NSArray arrayWithArray:[[[[self window] delegate] valueForKeyPath:@"tableDataInstance"] valueForKey:@"columnNames"]]; + if(arr == nil) { + arr = [NSArray array]; + } + for(id w in arr) + [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"field-small-square", @"image", @"", @"isRef", nil]]; + } + } + else { + NSLog(@"“%@” is not a valid completion list", kind); + NSBeep(); + return; + } + + SPNarrowDownCompletion* completionPopUp = [[SPNarrowDownCompletion alloc] initWithItems:possibleCompletions + alreadyTyped:@"" + staticPrefix:@"" + additionalWordCharacters:@"_." + caseSensitive:NO + charRange:aRange + parseRange:aRange + inView:self + dictMode:NO + dbMode:YES + tabTriggerMode:[self isSnippetMode] + fuzzySearch:fuzzySearchMode + backtickMode:NO + withDbName:@"" + withTableName:@"" + selectedDb:@"" + caretMovedLeft:NO + autoComplete:NO + oneColumn:NO]; + + //Get the NSPoint of the first character of the current word + NSRange glyphRange = [[self layoutManager] glyphRangeForCharacterRange:NSMakeRange(aRange.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]; + +} + +/* * Selects the current snippet defined by “currentSnippetIndex” */ - (void)selectCurrentSnippet @@ -1116,50 +1269,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) SPNarrowDownCompletion* completionPopUp; NSString *newSnip = [snip substringWithRange:NSMakeRange(1*offset,[snip length]-(2*offset))]; if([newSnip hasPrefix:@"$SP_ASLIST_"]) { - NSMutableArray *possibleCompletions = [[[NSMutableArray alloc] initWithCapacity:5] autorelease]; - NSArray *arr = nil; - if([newSnip isEqualToString:@"$SP_ASLIST_ALL_TABLES"]) { - arr = [NSArray arrayWithArray:[[[self delegate] valueForKeyPath:@"tablesListInstance"] allTableAndViewNames]]; - if(arr == nil) { - arr = [NSArray array]; - } - for(id w in arr) - [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"table-small-square", @"image", @"", @"isRef", nil]]; - } - else if([newSnip isEqualToString:@"$SP_ASLIST_ALL_DATABASES"]) { - arr = [NSArray arrayWithArray:[[[self delegate] valueForKeyPath:@"tablesListInstance"] allDatabaseNames]]; - if(arr == nil) { - arr = [NSArray array]; - } - for(id w in arr) - [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"database-small", @"image", @"", @"isRef", nil]]; - arr = [NSArray arrayWithArray:[[[self delegate] valueForKeyPath:@"tablesListInstance"] allSystemDatabaseNames]]; - if(arr == nil) { - arr = [NSArray array]; - } - for(id w in arr) - [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"database-small", @"image", @"", @"isRef", nil]]; - } - - completionPopUp = [[SPNarrowDownCompletion alloc] initWithItems:possibleCompletions - alreadyTyped:@"" - staticPrefix:@"" - additionalWordCharacters:@"_." - caseSensitive:NO - charRange:insertRange - parseRange:insertRange - inView:self - dictMode:NO - dbMode:YES - tabTriggerMode:[self isSnippetMode] - fuzzySearch:fuzzySearchMode - backtickMode:NO - withDbName:@"" - withTableName:@"" - selectedDb:@"" - caretMovedLeft:NO - autoComplete:NO - oneColumn:NO]; + [self showCompletionListFor:newSnip atRange:NSMakeRange(r2.location, 0) fuzzySearch:fuzzySearchMode]; + return; } else { NSArray *list = [[snip substringWithRange:NSMakeRange(1*offset,[snip length]-(2*offset))] componentsSeparatedByString:@"¦"]; NSMutableArray *possibleCompletions = [[[NSMutableArray alloc] initWithCapacity:[list count]] autorelease]; @@ -1185,17 +1296,17 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) caretMovedLeft:NO autoComplete:NO oneColumn:YES]; + //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]; } - //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]; diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h index 526010ad..ed4a1166 100644 --- a/Source/CustomQuery.h +++ b/Source/CustomQuery.h @@ -180,6 +180,7 @@ - (IBAction)saveQueryHistory:(id)sender; - (IBAction)copyQueryHistory:(id)sender; - (IBAction)clearQueryHistory:(id)sender; +- (IBAction)showCompletionList:(id)sender; // Query actions - (void)performQueries:(NSArray *)queries withCallback:(SEL)customQueryCallbackMethod; diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 2e26f08e..0d4207a0 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -2454,6 +2454,21 @@ [self helpTargetValidation]; } +- (IBAction)showCompletionList:(id)sender +{ + NSRange insertRange = NSMakeRange([textView selectedRange].location, 0); + switch([sender tag]) { + case 8000: + [textView showCompletionListFor:@"$SP_ASLIST_ALL_DATABASES" atRange:insertRange fuzzySearch:NO]; + break; + case 8001: + [textView showCompletionListFor:@"$SP_ASLIST_ALL_TABLES" atRange:insertRange fuzzySearch:NO]; + break; + case 8002: + [textView showCompletionListFor:@"$SP_ASLIST_ALL_FIELDS_FROM_SELECTED_TABLE" atRange:insertRange fuzzySearch:NO]; + break; + } +} /* * Show the data for "HELP 'currentWord' invoked by autohelp" */ diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index d7ac8048..a17c3aac 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -535,7 +535,7 @@ closeMe = YES; return; } else { - [newFiltered addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"No completions found", @"no completions found message"), @"display", @"", @"noCompletion", nil]]; + [newFiltered addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"No item found", @"no item found message"), @"display", @"", @"noCompletion", nil]]; } } } @@ -751,7 +751,12 @@ - (void)insert_text:(NSString* )aString { - [theView setSelectedRange:theCharRange]; + NSRange r = [theView selectedRange]; + if(r.length) + [theView setSelectedRange:r]; + else + [theView setSelectedRange:theCharRange]; + [theView insertText:aString]; // If completion string contains backticks move caret out of the backticks |