Revision: 3939
http://skim-app.svn.sourceforge.net/skim-app/?rev=3939&view=rev
Author: hofman
Date: 2008-05-30 08:32:20 -0700 (Fri, 30 May 2008)
Log Message:
-----------
make selection from selection tool accessible to scripting.
Modified Paths:
--------------
trunk/SKPDFDocument.h
trunk/SKPDFDocument.m
trunk/SKPDFView.h
trunk/SKPDFView.m
trunk/Skim.sdef
Modified: trunk/SKPDFDocument.h
===================================================================
--- trunk/SKPDFDocument.h 2008-05-30 13:43:10 UTC (rev 3938)
+++ trunk/SKPDFDocument.h 2008-05-30 15:32:20 UTC (rev 3939)
@@ -135,6 +135,10 @@
- (NSString *)text;
- (id)selectionSpecifier;
- (void)setSelectionSpecifier:(id)specifier;
+- (NSData *)selectionQDRect;
+- (void)setSelectionQDRect:(NSData *)inQDBoundsAsData;
+- (id)selectionPage;
+- (void)setSelectionPage:(PDFPage *)page;
- (id)handleRevertScriptCommand:(NSScriptCommand *)command;
- (id)handleGoToScriptCommand:(NSScriptCommand *)command;
- (id)handleFindScriptCommand:(NSScriptCommand *)command;
Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m 2008-05-30 13:43:10 UTC (rev 3938)
+++ trunk/SKPDFDocument.m 2008-05-30 15:32:20 UTC (rev 3939)
@@ -1824,6 +1824,31 @@
[[self pdfView] setCurrentSelection:selection];
}
+- (NSData *)selectionQDRect {
+ Rect qdRect = RectFromNSRect([[self pdfView] currentSelectionRect]);
+ return [NSData dataWithBytes:&qdRect length:sizeof(Rect)];
+}
+
+- (void)setSelectionQDRect:(NSData *)inQDRectAsData {
+ if ([inQDRectAsData length] == sizeof(Rect)) {
+ const Rect *qdBounds = (const Rect *)[inQDRectAsData bytes];
+ NSRect newBounds = NSRectFromRect(*qdBounds);
+ [[self pdfView] setCurrentSelectionRect:newBounds];
+ if ([[self pdfView] currentSelectionPage] == nil)
+ [[self pdfView] setCurrentSelectionPage:[[self pdfView]
currentPage]];
+ }
+}
+
+- (id)selectionPage {
+ PDFPage *page = [[self pdfView] currentSelectionPage];
+ return page ? (id)page : (id)[NSNull null];
+}
+
+- (void)setSelectionPage:(PDFPage *)page {
+ if (NSIsEmptyRect([[self pdfView] currentSelectionRect]) == NO)
+ [[self pdfView] setCurrentSelectionPage:[page isKindOfClass:[PDFPage
class]] ? page : nil];
+}
+
- (NSDictionary *)pdfViewSettings {
return [[[self mainWindowController] currentPDFSettings]
AppleScriptPDFViewSettingsFromPDFViewSettings];
}
Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h 2008-05-30 13:43:10 UTC (rev 3938)
+++ trunk/SKPDFView.h 2008-05-30 15:32:20 UTC (rev 3939)
@@ -146,7 +146,9 @@
- (NSRect)currentSelectionRect;
- (void)setCurrentSelectionRect:(NSRect)rect;
+
- (PDFPage *)currentSelectionPage;
+- (void)setCurrentSelectionPage:(PDFPage *)page;
- (float)currentMagnification;
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2008-05-30 13:43:10 UTC (rev 3938)
+++ trunk/SKPDFView.m 2008-05-30 15:32:20 UTC (rev 3939)
@@ -606,6 +606,16 @@
return selectionPageIndex == NSNotFound ? nil : [[self document]
pageAtIndex:selectionPageIndex];
}
+- (void)setCurrentSelectionPage:(PDFPage *)page {
+ if (toolMode == SKSelectToolMode) {
+ if (selectionPageIndex != [page pageIndex] || (page == nil &&
selectionPageIndex != NSNotFound))
+ [self setNeedsDisplay:YES];
+ selectionPageIndex = [page pageIndex];
+ if (page == nil)
+ selectionRect = NSZeroRect;
+ }
+}
+
- (float)currentMagnification {
return magnification;
}
Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef 2008-05-30 13:43:10 UTC (rev 3938)
+++ trunk/Skim.sdef 2008-05-30 15:32:20 UTC (rev 3939)
@@ -133,6 +133,14 @@
<type type="specifier" list="yes"/>
<cocoa key="selectionSpecifier"/>
</property>
+ <property name="selection bounds" code="SelB" type="rectangle"
+ description="The bounds of the selection from the selection
tool of the document (left, top, right, bottom).">
+ <cocoa key="selectionQDRect"/>
+ </property>
+ <property name="selection page" code="SelP" type="page"
+ description="The page for the selection from the selection
tool of the document.">
+ <cocoa key="selectionPage"/>
+ </property>
<property name="view settings" type="PDF view settings" code="vSet"
description="The PDF view settings.">
<cocoa key="pdfViewSettings"/>
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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit