diff options
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 197 | ||||
-rw-r--r-- | Source/CMTextView.m | 5 | ||||
-rw-r--r-- | Source/CustomQuery.h | 1 | ||||
-rw-r--r-- | Source/CustomQuery.m | 20 |
4 files changed, 199 insertions, 24 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 6ab01886..0e4922d9 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -613,7 +613,7 @@ <object class="NSTabViewItem" id="831053945"> <string key="NSIdentifier">source</string> <object class="NSView" key="NSView" id="461236772"> - <reference key="NSNextResponder" ref="714795046"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1130,6 +1130,7 @@ </object> <string key="NSFrame">{{1, 17}, {688, 289}}</string> <reference key="NSSuperview" ref="22340145"/> + <reference key="NSNextKeyView" ref="715508012"/> <reference key="NSDocView" ref="715508012"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -1162,6 +1163,7 @@ </object> <string key="NSFrame">{{1, 0}, {688, 17}}</string> <reference key="NSSuperview" ref="22340145"/> + <reference key="NSNextKeyView" ref="926883367"/> <reference key="NSDocView" ref="926883367"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -1170,6 +1172,7 @@ </object> <string key="NSFrame">{{-1, 22}, {690, 307}}</string> <reference key="NSSuperview" ref="220777809"/> + <reference key="NSNextKeyView" ref="16936123"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="943144555"/> <reference key="NSHScroller" ref="456666876"/> @@ -1712,6 +1715,7 @@ </object> <string key="NSFrame">{{1, 17}, {688, 142}}</string> <reference key="NSSuperview" ref="376224367"/> + <reference key="NSNextKeyView" ref="584834515"/> <reference key="NSDocView" ref="584834515"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -1744,6 +1748,7 @@ </object> <string key="NSFrame">{{1, 0}, {688, 17}}</string> <reference key="NSSuperview" ref="376224367"/> + <reference key="NSNextKeyView" ref="459548655"/> <reference key="NSDocView" ref="459548655"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -1752,6 +1757,7 @@ </object> <string key="NSFrame">{{-1, 22}, {690, 160}}</string> <reference key="NSSuperview" ref="1063281455"/> + <reference key="NSNextKeyView" ref="794929378"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="1019209947"/> <reference key="NSHScroller" ref="328951385"/> @@ -1864,7 +1870,6 @@ </object> </object> <string key="NSFrame">{{10, 7}, {700, 544}}</string> - <reference key="NSSuperview" ref="714795046"/> </object> <string key="NSLabel">Structure</string> <reference key="NSColor" ref="62854682"/> @@ -2488,7 +2493,7 @@ <object class="NSTabViewItem" id="105987292"> <string key="NSIdentifier">customQuery</string> <object class="NSView" key="NSView" id="746504912"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder" ref="714795046"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -2575,7 +2580,6 @@ </object> <string key="NSFrame">{{1, 1}, {688, 155}}</string> <reference key="NSSuperview" ref="71560786"/> - <reference key="NSNextKeyView" ref="1055190999"/> <reference key="NSDocView" ref="1055190999"/> <reference key="NSBGColor" ref="449903125"/> <object class="NSCursor" key="NSCursor" id="32917531"> @@ -2607,7 +2611,6 @@ </object> <string key="NSFrameSize">{690, 157}</string> <reference key="NSSuperview" ref="873437769"/> - <reference key="NSNextKeyView" ref="1072692119"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="413233170"/> <reference key="NSHScroller" ref="783638826"/> @@ -2694,7 +2697,6 @@ </object> <string key="NSFrame">{{1, 17}, {688, 228}}</string> <reference key="NSSuperview" ref="678281118"/> - <reference key="NSNextKeyView" ref="581095761"/> <reference key="NSDocView" ref="581095761"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -2727,7 +2729,6 @@ </object> <string key="NSFrame">{{1, 0}, {688, 17}}</string> <reference key="NSSuperview" ref="678281118"/> - <reference key="NSNextKeyView" ref="1038415606"/> <reference key="NSDocView" ref="1038415606"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -2736,7 +2737,6 @@ </object> <string key="NSFrameSize">{690, 246}</string> <reference key="NSSuperview" ref="345834048"/> - <reference key="NSNextKeyView" ref="90844306"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="472831765"/> <reference key="NSHScroller" ref="851610321"/> @@ -3025,6 +3025,18 @@ <int key="NSTag">7</int> <reference key="NSTarget" ref="984501775"/> </object> + <object class="NSMenuItem" id="837073672"> + <reference key="NSMenu" ref="60735230"/> + <string key="NSTitle">Comment current Query</string> + <string key="NSKeyEquiv">/</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="450876295"/> + <reference key="NSMixedImage" ref="414351669"/> + <string key="NSAction">_popUpItemAction:</string> + <int key="NSTag">11</int> + <reference key="NSTarget" ref="984501775"/> + </object> <object class="NSMenuItem" id="847470381"> <reference key="NSMenu" ref="60735230"/> <string key="NSTitle">Completion List</string> @@ -3105,7 +3117,7 @@ </object> <bool key="NSNoAutoenable">YES</bool> </object> - <int key="NSSelectedIndex">13</int> + <int key="NSSelectedIndex">10</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -3251,6 +3263,7 @@ </object> </object> <string key="NSFrame">{{10, 7}, {700, 544}}</string> + <reference key="NSSuperview" ref="714795046"/> </object> <string key="NSLabel">Custom Query</string> <reference key="NSColor" ref="62854682"/> @@ -4289,14 +4302,14 @@ <reference key="NSTabView" ref="714795046"/> </object> </object> - <reference key="NSSelectedTabViewItem" ref="831053945"/> + <reference key="NSSelectedTabViewItem" ref="105987292"/> <reference key="NSFont" ref="26"/> <int key="NSTvFlags">134217731</int> <bool key="NSAllowTruncatedLabels">YES</bool> <bool key="NSDrawsBackground">YES</bool> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="461236772"/> + <reference ref="746504912"/> </object> </object> </object> @@ -15080,6 +15093,22 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <int key="connectionID">6248</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">gearMenuItemSelected:</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="837073672"/> + </object> + <int key="connectionID">6250</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">commentCurrentQueryOrSelectionMenuItem</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="837073672"/> + </object> + <int key="connectionID">6251</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -18012,6 +18041,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference ref="216778737"/> <reference ref="659457702"/> <reference ref="414081589"/> + <reference ref="837073672"/> </object> <reference key="parent" ref="984501775"/> </object> @@ -21293,6 +21323,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference key="object" ref="396619281"/> <reference key="parent" ref="230280632"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">6249</int> + <reference key="object" ref="837073672"/> + <reference key="parent" ref="60735230"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -22582,6 +22617,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>6240.IBPluginDependency</string> <string>6241.IBPluginDependency</string> <string>6242.IBPluginDependency</string> + <string>6249.IBPluginDependency</string> <string>654.IBPluginDependency</string> <string>654.ImportedFromIB2</string> <string>655.IBPluginDependency</string> @@ -23640,8 +23676,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{500, 144}, {944, 550}}</string> - <string>{{500, 144}, {944, 550}}</string> + <string>{{105, 148}, {944, 550}}</string> + <string>{{105, 148}, {944, 550}}</string> <reference ref="9"/> <reference ref="9"/> <string>{{62, 352}, {845, 504}}</string> @@ -23807,7 +23843,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{323, 207}, {236, 271}}</string> + <string>{{314, 239}, {236, 288}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -24427,6 +24463,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</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> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> @@ -24646,7 +24683,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">6248</int> + <int key="maxID">6251</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -25900,6 +25937,136 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> + <string key="className">CustomQuery</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>addQueryFavorite:</string> + <string>chooseQueryFavorite:</string> + <string>chooseQueryHistory:</string> + <string>closeQueryFavoritesSheet:</string> + <string>closeSheet:</string> + <string>copyQueryFavorite:</string> + <string>gearMenuItemSelected:</string> + <string>helpSearchFindNextInPage:</string> + <string>helpSearchFindPreviousInPage:</string> + <string>helpSegmentDispatcher:</string> + <string>helpSelectHelpTargetMySQL:</string> + <string>helpSelectHelpTargetPage:</string> + <string>helpSelectHelpTargetWeb:</string> + <string>helpTargetDispatcher:</string> + <string>removeQueryFavorite:</string> + <string>runAllQueries:</string> + <string>runSelectedQueries:</string> + <string>showHelpForCurrentWord:</string> + <string>showHelpForSearchString:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>affectedRowsText</string> + <string>autohelpMenuItem</string> + <string>autoindentMenuItem</string> + <string>autopairMenuItem</string> + <string>autouppercaseKeywordsMenuItem</string> + <string>clearHistoryMenuItem</string> + <string>commentCurrentQueryOrSelectionMenuItem</string> + <string>completionListMenuItem</string> + <string>copyQueryFavoriteButton</string> + <string>customQueryView</string> + <string>editorFontMenuItem</string> + <string>errorText</string> + <string>helpNavigator</string> + <string>helpSearchField</string> + <string>helpSearchFieldCell</string> + <string>helpTargetSelector</string> + <string>helpWebView</string> + <string>helpWebViewWindow</string> + <string>multipleLineEditingButton</string> + <string>queryFavoritesButton</string> + <string>queryFavoritesSheet</string> + <string>queryFavoritesView</string> + <string>queryHistoryButton</string> + <string>removeQueryFavoriteButton</string> + <string>runAllButton</string> + <string>runSelectionButton</string> + <string>runSelectionMenuItem</string> + <string>shiftLeftMenuItem</string> + <string>shiftRightMenuItem</string> + <string>tableWindow</string> + <string>textView</string> + <string>valueSheet</string> + <string>valueTextField</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>id</string> + <string>CMCopyTable</string> + <string>NSMenuItem</string> + <string>id</string> + <string>NSSegmentedControl</string> + <string>NSSearchField</string> + <string>NSSearchFieldCell</string> + <string>NSSegmentedControl</string> + <string>WebView</string> + <string>NSWindow</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>id</string> + <string>CMTextView</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../../Source/CustomQuery.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">SPTableView</string> <string key="superclassName">NSTableView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 27fb0dab..3720a521 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -531,11 +531,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [self makeTextSizeSmaller]; return; } - if([charactersIgnMod isEqualToString:@"/"]) - { - [[[[self window] delegate] valueForKeyPath:@"customQueryInstance"] commentOutQuery]; - return; - } } // Only process for character autopairing if autopairing is enabled and a single character is being added. diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h index 56f56f0d..9d6ea2df 100644 --- a/Source/CustomQuery.h +++ b/Source/CustomQuery.h @@ -63,6 +63,7 @@ IBOutlet NSMenuItem *autopairMenuItem; IBOutlet NSMenuItem *autohelpMenuItem; IBOutlet NSMenuItem *autouppercaseKeywordsMenuItem; + IBOutlet NSMenuItem *commentCurrentQueryOrSelectionMenuItem; IBOutlet NSWindow *helpWebViewWindow; IBOutlet WebView *helpWebView; diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 00834f80..59be27f8 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -212,6 +212,12 @@ [textView shiftSelectionLeft]; } + // "Comment Current Query/Selection" menu item - Add or remove "-- " for each line + // in the current query or selection + if (sender == commentCurrentQueryOrSelectionMenuItem) { + [self commentOutQuery]; + } + // "Completion List" menu item - used to autocomplete. Uses a different shortcut to avoid the menu button flickering // on normal autocomplete usage. if (sender == completionListMenuItem) { @@ -927,6 +933,9 @@ [textView setSelectedRange:currentQueryRange]; } +/* + * Add or remove "-- " for each line in the current query or selection + */ - (void)commentOutQuery { @@ -945,11 +954,14 @@ workingRange = currentQueryRange; NSMutableString *n = [NSMutableString string]; - [n setString:[NSString stringWithFormat:@"# %@", [[textView string] substringWithRange:workingRange]]]; - [n replaceOccurrencesOfRegex:@"\\n(?=.)" withString:@"\n# "]; - [n replaceOccurrencesOfRegex:@"\\n# # " withString:@"\n"]; - [n replaceOccurrencesOfRegex:@"^# # " withString:@""]; + [n setString:[NSString stringWithFormat:@"-- %@", [[textView string] substringWithRange:workingRange]]]; + [n replaceOccurrencesOfRegex:@"\\n(?=.)" withString:@"\n-- "]; + // comment out if at least one line is already commented out + if(!([n isMatchedByRegex:@"(\\n-- --|^-- --)"] && [n isMatchedByRegex:@"(\\n-- |^-- )(?!-)"])) { + [n replaceOccurrencesOfRegex:@"\\n-- -- " withString:@"\n"]; + [n replaceOccurrencesOfRegex:@"^-- -- " withString:@""]; + } [textView setSelectedRange:workingRange]; [textView insertText:n]; |