Revision: 4421
http://skim-app.svn.sourceforge.net/skim-app/?rev=4421&view=rev
Author: hofman
Date: 2008-08-18 10:02:12 +0000 (Mon, 18 Aug 2008)
Log Message:
-----------
Move method implementation
Modified Paths:
--------------
trunk/SKApplication.m
Modified: trunk/SKApplication.m
===================================================================
--- trunk/SKApplication.m 2008-08-16 14:13:37 UTC (rev 4420)
+++ trunk/SKApplication.m 2008-08-18 10:02:12 UTC (rev 4421)
@@ -83,54 +83,6 @@
[super terminate:sender];
}
-- (id)handleOpenScriptCommand:(NSScriptCommand *)command {
- NSDictionary *args = [command evaluatedArguments];
- id file = [command directParameter];
- id lineNumber = [args objectForKey:@"line"];
- id source = [args objectForKey:@"source"];
-
- if (lineNumber == nil || ([file isKindOfClass:[NSArray class]] && [file
count] != 1)) {
- if ([[SKApplication superclass] instancesRespondToSelector:_cmd])
- [super handleOpenScriptCommand:command];
- return nil;
- }
-
- if ([file isKindOfClass:[NSArray class]])
- file = [file lastObject];
- if ([file isKindOfClass:[NSString class]])
- file = [NSURL fileURLWithPath:file];
-
- if (source == nil)
- source = file;
- if ([source isKindOfClass:[NSString class]])
- source = [NSURL fileURLWithPath:source];
-
- if ([file isKindOfClass:[NSURL class]] && [source isKindOfClass:[NSURL
class]]) {
-
- source = [[source path] stringByReplacingPathExtension:@"tex"];
-
- if ([[NSFileManager defaultManager] fileExistsAtPath:[file path]]) {
-
- NSError *error = nil;
- SKPDFDocument *document = [[NSDocumentController
sharedDocumentController] openDocumentWithContentsOfURL:file display:YES
error:&error];
- if (document == nil)
- [self presentError:error];
-
- if ([[NSFileManager defaultManager] fileExistsAtPath:source] &&
[document respondsToSelector:@selector(synchronizer)])
- [[document synchronizer] findPageAndLocationForLine:MAX(0,
[lineNumber intValue] - 1) inFile:source];
-
- } else {
- [command setScriptErrorNumber:NSArgumentsWrongScriptError];
- [command setScriptErrorString:@"File does not exist."];
- }
- } else {
- [command setScriptErrorNumber:NSArgumentsWrongScriptError];
- [command setScriptErrorString:@"File argument is not a file."];
- }
-
- return nil;
-}
-
- (void)reorganizeWindowsItem:(NSWindow *)aWindow {
NSMenu *windowsMenu = [self windowsMenu];
NSWindowController *windowController = [aWindow windowController];
@@ -271,4 +223,52 @@
return orderedDocuments;
}
+- (id)handleOpenScriptCommand:(NSScriptCommand *)command {
+ NSDictionary *args = [command evaluatedArguments];
+ id file = [command directParameter];
+ id lineNumber = [args objectForKey:@"line"];
+ id source = [args objectForKey:@"source"];
+
+ if (lineNumber == nil || ([file isKindOfClass:[NSArray class]] && [file
count] != 1)) {
+ if ([[SKApplication superclass] instancesRespondToSelector:_cmd])
+ [super handleOpenScriptCommand:command];
+ return nil;
+ }
+
+ if ([file isKindOfClass:[NSArray class]])
+ file = [file lastObject];
+ if ([file isKindOfClass:[NSString class]])
+ file = [NSURL fileURLWithPath:file];
+
+ if (source == nil)
+ source = file;
+ if ([source isKindOfClass:[NSString class]])
+ source = [NSURL fileURLWithPath:source];
+
+ if ([file isKindOfClass:[NSURL class]] && [source isKindOfClass:[NSURL
class]]) {
+
+ source = [[source path] stringByReplacingPathExtension:@"tex"];
+
+ if ([[NSFileManager defaultManager] fileExistsAtPath:[file path]]) {
+
+ NSError *error = nil;
+ SKPDFDocument *document = [[NSDocumentController
sharedDocumentController] openDocumentWithContentsOfURL:file display:YES
error:&error];
+ if (document == nil)
+ [self presentError:error];
+
+ if ([[NSFileManager defaultManager] fileExistsAtPath:source] &&
[document respondsToSelector:@selector(synchronizer)])
+ [[document synchronizer] findPageAndLocationForLine:MAX(0,
[lineNumber intValue] - 1) inFile:source];
+
+ } else {
+ [command setScriptErrorNumber:NSArgumentsWrongScriptError];
+ [command setScriptErrorString:@"File does not exist."];
+ }
+ } else {
+ [command setScriptErrorNumber:NSArgumentsWrongScriptError];
+ [command setScriptErrorString:@"File argument is not a file."];
+ }
+
+ return nil;
+}
+
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit