aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-01-14 13:47:00 +0000
committerBibiko <bibiko@eva.mpg.de>2011-01-14 13:47:00 +0000
commitf47f65ca4590c24b2e16ceb8147f8ba5b7d7186c (patch)
tree9a06a2c2251cce97918907eec4f20815f969a1ba /Source/SPDatabaseDocument.m
parenteb443a99b9a7b32ccce4b5ab1e70fa5aad6b1f61 (diff)
downloadsequelpro-f47f65ca4590c24b2e16ceb8147f8ba5b7d7186c.tar.gz
sequelpro-f47f65ca4590c24b2e16ceb8147f8ba5b7d7186c.tar.bz2
sequelpro-f47f65ca4590c24b2e16ceb8147f8ba5b7d7186c.zip
• added sequelpro URL scheme commands passToDoc/SetText/<text>, passToDoc/InsertText/<text> and passToDoc/SetSelectedTextRange/<range> which work on the first responder of the called SPDatabaseDocument regardless of the NSApp first responder for long running scripts
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 3ae454c3..7eaa24d5 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -4650,6 +4650,46 @@
return;
}
+ if([command isEqualToString:@"SetSelectedTextRange"]) {
+ if([params count] > 1) {
+ id firstResponder = [parentWindow firstResponder];
+ if([firstResponder isKindOfClass:[NSTextView class]]) {
+ NSRange theRange = NSIntersectionRange(NSRangeFromString([params objectAtIndex:1]), NSMakeRange(0, [[firstResponder string] length]));
+ if(theRange.location != NSNotFound) {
+ [firstResponder setSelectedRange:theRange];
+ }
+ return;
+ }
+ NSBeep();
+ }
+ return;
+ }
+
+ if([command isEqualToString:@"InsertText"]) {
+ if([params count] > 1) {
+ id firstResponder = [parentWindow firstResponder];
+ if([firstResponder isKindOfClass:[NSTextView class]]) {
+ [firstResponder insertText:[params objectAtIndex:1]];
+ return;
+ }
+ NSBeep();
+ }
+ return;
+ }
+
+ if([command isEqualToString:@"SetText"]) {
+ if([params count] > 1) {
+ id firstResponder = [parentWindow firstResponder];
+ if([firstResponder isKindOfClass:[NSTextView class]]) {
+ [firstResponder setSelectedRange:NSMakeRange(0, [[firstResponder string] length])];
+ [firstResponder insertText:[params objectAtIndex:1]];
+ return;
+ }
+ NSBeep();
+ }
+ return;
+ }
+
if([command isEqualToString:@"SelectTableRows"]) {
if([params count] > 1 && [[[NSApp mainWindow] firstResponder] respondsToSelector:@selector(selectTableRows:)]) {
[[[NSApp mainWindow] firstResponder] selectTableRows:[params subarrayWithRange:NSMakeRange(1, [params count]-1)]];