From 072a730f22e3c06fed48acf31ac5708259c93a32 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 17 Dec 2010 15:20:01 +0000 Subject: =?UTF-8?q?=E2=80=A2=C2=A0minor=20improvements,=20commenting,=20cl?= =?UTF-8?q?eaning=20for=20URL=20scheme=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPAppController.m | 30 +++--------------------------- Source/SPDatabaseDocument.m | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 28 deletions(-) (limited to 'Source') diff --git a/Source/SPAppController.m b/Source/SPAppController.m index a90876fa..046628b3 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -659,35 +659,11 @@ } } - if(!processDocument) + // if no processDoc found and no passedProcessID was passed execute + // command at front most doc + if(!processDocument && !passedProcessID) processDocument = [[[self frontDocumentWindow] delegate] selectedTableDocument]; - - BOOL userTerminated = NO; - - // while(1) { - // NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask - // untilDate:[NSDate distantPast] - // inMode:NSDefaultRunLoopMode - // dequeue:YES]; - // - // if ([event type] == NSKeyDown) { - // unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0; - // if (([event modifierFlags] & NSCommandKeyMask) && key == '.') { - // userTerminated = YES; - // break; - // } - // } - // [NSApp sendEvent:event]; - // if(![processDocument isWorking]) break; - // usleep(1000); - // } - // - // if(userTerminated) { - // NSBeep(); - // return; - // } - if(processDocument && command) { if([command isEqualToString:@"passToDoc"]) { NSMutableDictionary *cmdDict = [NSMutableDictionary dictionary]; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 0c2b7de7..8557eeba 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4556,6 +4556,9 @@ YY_BUFFER_STATE yy_scan_string (const char *); #pragma mark - #pragma mark Scheme scripting methods +/** + * Return an HTML formatted string representing the passed SQL string syntax highlighted + */ - (NSString*)doSQLSyntaxHighlightForString:(NSString*)sqlText cssLike:(BOOL)cssLike { @@ -4633,16 +4636,28 @@ YY_BUFFER_STATE yy_scan_string (const char *); } +/** + * Called by handleSchemeCommand: to break a while loop + */ - (void)setTimeout { _workingTimeout = YES; } +/** + * Process passed URL scheme command and wait (timeouted) for the document if it's busy or not yet connected + */ - (void)handleSchemeCommand:(NSDictionary*)commandDict { + if(!commandDict) return; + NSArray *params = [commandDict objectForKey:@"parameter"]; - if(![params count]) return; + if(![params count]) { + NSLog(@"No URL scheme command passed"); + NSBeep(); + return; + } NSString *command = [params objectAtIndex:0]; NSString *docProcessID = [self processID]; -- cgit v1.2.3