Revision: 7547 http://skim-app.svn.sourceforge.net/skim-app/?rev=7547&view=rev Author: hofman Date: 2011-11-24 10:50:09 +0000 (Thu, 24 Nov 2011) Log Message: ----------- avoid using convenience method for invocation
Modified Paths: -------------- trunk/NSInvocation_SKExtensions.h trunk/NSInvocation_SKExtensions.m trunk/SKConversionProgressController.m Modified: trunk/NSInvocation_SKExtensions.h =================================================================== --- trunk/NSInvocation_SKExtensions.h 2011-11-23 15:36:49 UTC (rev 7546) +++ trunk/NSInvocation_SKExtensions.h 2011-11-24 10:50:09 UTC (rev 7547) @@ -41,5 +41,4 @@ @interface NSInvocation (SKExtensions) + (id)invocationWithTarget:(id)target selector:(SEL)selector; -+ (id)invocationWithTarget:(id)target selector:(SEL)selector argument:(void *)argument; @end Modified: trunk/NSInvocation_SKExtensions.m =================================================================== --- trunk/NSInvocation_SKExtensions.m 2011-11-23 15:36:49 UTC (rev 7546) +++ trunk/NSInvocation_SKExtensions.m 2011-11-24 10:50:09 UTC (rev 7547) @@ -49,10 +49,4 @@ return invocation; } -+ (id)invocationWithTarget:(id)target selector:(SEL)selector argument:(void *)argument { - NSInvocation *invocation = [self invocationWithTarget:target selector:selector]; - [invocation setArgument:argument atIndex:2]; - return invocation; -} - @end Modified: trunk/SKConversionProgressController.m =================================================================== --- trunk/SKConversionProgressController.m 2011-11-23 15:36:49 UTC (rev 7546) +++ trunk/SKConversionProgressController.m 2011-11-24 10:50:09 UTC (rev 7547) @@ -69,7 +69,7 @@ + (NSString *)xdvToolPath; - (NSData *)newPDFDataWithPostScriptData:(NSData *)psData error:(NSError **)outError; - (NSData *)newPDFDataWithDVIFile:(NSString *)dviFile toolPath:(NSString *)toolPath fileType:(NSString *)aFileType error:(NSError **)outError; -- (void)conversionCompleted:(BOOL)didComplete; +- (void)conversionCompleted; - (void)conversionStarted; - (void)converterWasStopped; - (void)setButtonTitle:(NSString *)title action:(SEL)action; @@ -87,11 +87,8 @@ static void PSConverterEndDocumentCallback(void *info, bool success) { id delegate = (id)info; - if ([delegate respondsToSelector:@selector(conversionCompleted:)]) { - BOOL val = (success == true); - NSInvocation *invocation = [NSInvocation invocationWithTarget:delegate selector:@selector(conversionCompleted:) argument:&val]; - [invocation performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:NO]; - } + if ([delegate respondsToSelector:@selector(conversionCompleted)]) + [delegate performSelectorOnMainThread:@selector(conversionCompleted) withObject:nil waitUntilDone:NO]; } CGPSConverterCallbacks SKPSConverterCallbacks = { @@ -192,7 +189,8 @@ - (void)stopModalOnMainThread:(BOOL)success { NSInteger val = (success ? SKConversionSucceeded : SKConversionFailed); - NSInvocation *invocation = [NSInvocation invocationWithTarget:NSApp selector:@selector(stopModalWithCode:) argument:&val]; + NSInvocation *invocation = [NSInvocation invocationWithTarget:NSApp selector:@selector(stopModalWithCode:)]; + [invocation setArgument:&val atIndex:2]; [invocation performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:NO]; } @@ -202,15 +200,13 @@ [self setButtonTitle:NSLocalizedString(@"Close", @"Button title") action:@selector(close:)]; } -- (void)conversionCompleted:(BOOL)didComplete; -{ +- (void)conversionCompleted { [textField setStringValue:NSLocalizedString(@"File successfully converted!", @"PS conversion progress message")]; [progressBar stopAnimation:nil]; [self setButtonTitle:NSLocalizedString(@"Close", @"Button title") action:@selector(close:)]; } -- (void)conversionStarted; -{ +- (void)conversionStarted { [progressBar startAnimation:nil]; [textField setStringValue:[[[self window] title] stringByAppendingEllipsis]]; } @@ -335,14 +331,12 @@ NSArray *arguments = [commandName isEqualToString:@"dvipdf"] ? [NSArray arrayWithObjects:dviFile, outFile, nil] : [NSArray arrayWithObjects:@"-o", outFile, dviFile, nil]; BOOL success = NO; - NSInvocation *invocation; NSFileManager *fm = [[[NSFileManager alloc] init] autorelease]; if ([self shouldKeepRunning] && [fm fileExistsAtPath:dviFile]) { NSTask *task = [NSTask launchedTaskWithLaunchPath:commandPath arguments:arguments currentDirectoryPath:[dviFile stringByDeletingLastPathComponent]]; if (task) { - invocation = [NSInvocation invocationWithTarget:self selector:@selector(conversionStarted)]; - [invocation performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(conversionStarted) withObject:nil waitUntilDone:NO]; while ([task isRunning] && [self shouldKeepRunning]) [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; @@ -374,8 +368,7 @@ if (success) [pdfData setData:outData]; - invocation = [NSInvocation invocationWithTarget:self selector:@selector(conversionCompleted:) argument:&success]; - [invocation performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(conversionCompleted) withObject:nil waitUntilDone:NO]; [self stopModalOnMainThread:success]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit