aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-07-15 17:33:28 +0000
committerBibiko <bibiko@eva.mpg.de>2009-07-15 17:33:28 +0000
commit6380481880bf44e8f50a47e606a6c8357c71afa5 (patch)
tree67e1ffbd0913ede532c546806de7e9b481461b09
parentc213d86c13973d280e43bb4c5c380e72c50b703e (diff)
downloadsequelpro-6380481880bf44e8f50a47e606a6c8357c71afa5.tar.gz
sequelpro-6380481880bf44e8f50a47e606a6c8357c71afa5.tar.bz2
sequelpro-6380481880bf44e8f50a47e606a6c8357c71afa5.zip
• Comment current Query/Selection
- changed comment string to "-- " - fixed bug in uncomment - added gear menu item -- TODO: change menu item title according to selection/current query (coming soon)
-rw-r--r--Interfaces/English.lproj/DBView.xib197
-rw-r--r--Source/CMTextView.m5
-rw-r--r--Source/CustomQuery.h1
-rw-r--r--Source/CustomQuery.m20
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];
'>1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368