Revision: 7206
http://skim-app.svn.sourceforge.net/skim-app/?rev=7206&view=rev
Author: hofman
Date: 2011-04-08 11:13:55 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
define a select script command
Modified Paths:
--------------
trunk/Skim.sdef
trunk/Skim.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/SKSelectCommand.h
trunk/SKSelectCommand.m
Added: trunk/SKSelectCommand.h
===================================================================
--- trunk/SKSelectCommand.h (rev 0)
+++ trunk/SKSelectCommand.h 2011-04-08 11:13:55 UTC (rev 7206)
@@ -0,0 +1,43 @@
+//
+// SKSelectCommand.h
+// Skim
+//
+// Created by Christiaan Hofman on 4/8/11.
+/*
+ This software is Copyright (c) 2011
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface SKSelectCommand : NSScriptCommand
+@end
Added: trunk/SKSelectCommand.m
===================================================================
--- trunk/SKSelectCommand.m (rev 0)
+++ trunk/SKSelectCommand.m 2011-04-08 11:13:55 UTC (rev 7206)
@@ -0,0 +1,62 @@
+//
+// SKSelectCommand.m
+// Skim
+//
+// Created by Christiaan Hofman on 4/8/11.
+/*
+ This software is Copyright (c) 2011
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "SKSelectCommand.h"
+#import "PDFSelection_SKExtensions.h"
+#import "PDFPage_SKExtensions.h"
+#import "SKMainDocument.h"
+#import <Quartz/Quartz.h>
+
+
+@implementation SKSelectCommand
+
+- (id)performDefaultImplementation {
+ id dP = [self directParameter];
+ PDFSelection *selection = [PDFSelection selectionWithSpecifier:dP];
+ id doc = [[[selection pages] lastObject] containingDocument];
+
+ if ([doc respondsToSelector:@selector(pdfView)]) {
+ [doc showWindows];
+ [[doc pdfView] setCurrentSelection:selection];
+ [[doc pdfView] goToSelection:selection];
+ }
+
+ return nil;
+}
+
+@end
Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef 2011-04-07 11:48:38 UTC (rev 7205)
+++ trunk/Skim.sdef 2011-04-08 11:13:55 UTC (rev 7206)
@@ -308,6 +308,9 @@
<element type="word"/>
<element type="attribute run"/>
<element type="attachment"/>
+ <responds-to name="select" hidden="yes">
+ <cocoa method=""/>
+ </responds-to>
<responds-to name="join" hidden="yes">
<cocoa method=""/>
</responds-to>
@@ -350,6 +353,9 @@
<element type="word"/>
<element type="attribute run"/>
<element type="attachment"/>
+ <responds-to name="select" hidden="yes">
+ <cocoa method=""/>
+ </responds-to>
<responds-to name="join" hidden="yes">
<cocoa method=""/>
</responds-to>
@@ -392,6 +398,9 @@
<element type="word"/>
<element type="attribute run"/>
<element type="attachment"/>
+ <responds-to name="select" hidden="yes">
+ <cocoa method=""/>
+ </responds-to>
<responds-to name="join" hidden="yes">
<cocoa method=""/>
</responds-to>
@@ -434,6 +443,9 @@
<element type="word"/>
<element type="attribute run"/>
<element type="attachment"/>
+ <responds-to name="select" hidden="yes">
+ <cocoa method=""/>
+ </responds-to>
<responds-to name="join" hidden="yes">
<cocoa method=""/>
</responds-to>
@@ -476,6 +488,9 @@
<element type="word"/>
<element type="attribute run"/>
<element type="attachment"/>
+ <responds-to name="select" hidden="yes">
+ <cocoa method=""/>
+ </responds-to>
<responds-to name="join" hidden="yes">
<cocoa method=""/>
</responds-to>
@@ -529,6 +544,16 @@
description="The document(s) or window(s) to revert."/>
</command>
+ <command name="select" code="SKIMSele"
+ description="Select text in a document.">
+ <cocoa class="SKSelectCommand"/>
+ <direct-parameter
+ description="The character range(s) to select.">
+ <type type="specifier" list="yes"/>
+ <type type="specifier"/>
+ </direct-parameter>
+ </command>
+
<command name="go" code="SKIMGoTo"
description="Go to a location.">
<direct-parameter type="document"
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2011-04-07 11:48:38 UTC (rev
7205)
+++ trunk/Skim.xcodeproj/project.pbxproj 2011-04-08 11:13:55 UTC (rev
7206)
@@ -72,6 +72,7 @@
CE121AC81180644A00951425 /* SKScriptMenu.m in Sources */ = {isa
= PBXBuildFile; fileRef = CE121AC71180644A00951425 /* SKScriptMenu.m */; };
CE121B2D1180770900951425 /* ScriptMenu.tiff in Resources */ =
{isa = PBXBuildFile; fileRef = CE121B2C1180770900951425 /* ScriptMenu.tiff */;
};
CE121BFB11529D15001D92ED /* SKIBArray.m in Sources */ = {isa =
PBXBuildFile; fileRef = CE121BFA11529D15001D92ED /* SKIBArray.m */; };
+ CE12A73E134F215F003AED67 /* SKSelectCommand.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE12A73D134F215F003AED67 /* SKSelectCommand.m
*/; };
CE171E3512C3AC1600291179 /* SKFileUpdateChecker.m in Sources */
= {isa = PBXBuildFile; fileRef = CE171E3412C3AC1600291179 /*
SKFileUpdateChecker.m */; };
CE17F47E0F1A17E200E741DD /* SKPDFSynchronizerServer.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE17F47D0F1A17E200E741DD /*
SKPDFSynchronizerServer.m */; };
CE19446310627483007E8770 /* BookmarksWindow.xib in Resources */
= {isa = PBXBuildFile; fileRef = CE19445C10627483007E8770 /*
BookmarksWindow.xib */; };
@@ -584,6 +585,8 @@
CE121B2C1180770900951425 /* ScriptMenu.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; path = ScriptMenu.tiff;
sourceTree = "<group>"; };
CE121BF911529D15001D92ED /* SKIBArray.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKIBArray.h; sourceTree = "<group>"; };
CE121BFA11529D15001D92ED /* SKIBArray.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKIBArray.m; sourceTree = "<group>"; };
+ CE12A73C134F215F003AED67 /* SKSelectCommand.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKSelectCommand.h; sourceTree = "<group>"; };
+ CE12A73D134F215F003AED67 /* SKSelectCommand.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKSelectCommand.m; sourceTree = "<group>"; };
CE157ED212D4EBC000515B85 /* Japanese */ = {isa =
PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings;
name = Japanese; path = Japanese.lproj/BookmarkSheet.strings; sourceTree =
"<group>"; };
CE157ED312D4EBC000515B85 /* Japanese */ = {isa =
PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings;
name = Japanese; path = Japanese.lproj/BookmarksWindow.strings; sourceTree =
"<group>"; };
CE157ED512D4EBC000515B85 /* Japanese */ = {isa =
PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings;
name = Japanese; path = Japanese.lproj/DisplayPreferences.strings; sourceTree =
"<group>"; };
@@ -1746,6 +1749,8 @@
CE4643CE0DF6B5A400CFD8D2 /* SKJoinCommand.m */,
CE4643D30DF6B60500CFD8D2 /* SKPagesCommand.h */,
CE4643D40DF6B60500CFD8D2 /* SKPagesCommand.m */,
+ CE12A73C134F215F003AED67 /* SKSelectCommand.h
*/,
+ CE12A73D134F215F003AED67 /* SKSelectCommand.m
*/,
CE4643D60DF6B63500CFD8D2 /* SKTextCommand.h */,
CE4643D70DF6B63500CFD8D2 /* SKTextCommand.m */,
);
@@ -2532,6 +2537,7 @@
CE4E1E9A12BCFF5A005227ED /* HIDRemote.m in
Sources */,
CE171E3512C3AC1600291179 /*
SKFileUpdateChecker.m in Sources */,
CEECD61C12E9E30B00B9E35E /*
NSError_SKExtensions.m in Sources */,
+ CE12A73E134F215F003AED67 /* SKSelectCommand.m
in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit