From f47f65ca4590c24b2e16ceb8147f8ba5b7d7186c Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 14 Jan 2011 13:47:00 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20sequelpro=20URL=20scheme=20commands?= =?UTF-8?q?=20passToDoc/SetText/,=20passToDoc/InsertText/=20an?= =?UTF-8?q?d=20passToDoc/SetSelectedTextRange/=20which=20work=20on?= =?UTF-8?q?=20the=20first=20responder=20of=20the=20called=20SPDatabaseDocu?= =?UTF-8?q?ment=20regardless=20of=20the=20NSApp=20first=20responder=20for?= =?UTF-8?q?=20long=20running=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPDatabaseDocument.m | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) 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)]]; -- cgit v1.2.3