Revision: 2337
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2337&view=rev
Author:   hofman
Date:     2007-06-18 06:16:14 -0700 (Mon, 18 Jun 2007)

Log Message:
-----------
Add scripting command for pdfsync.

Modified Paths:
--------------
    trunk/SKDocument.h
    trunk/SKDocument.m
    trunk/Skim.sdef

Modified: trunk/SKDocument.h
===================================================================
--- trunk/SKDocument.h  2007-06-18 13:14:23 UTC (rev 2336)
+++ trunk/SKDocument.h  2007-06-18 13:16:14 UTC (rev 2337)
@@ -113,6 +113,7 @@
 - (id)handleRevertScriptCommand:(NSScriptCommand *)command;
 - (id)handleGoToScriptCommand:(NSScriptCommand *)command;
 - (id)handleFindScriptCommand:(NSScriptCommand *)command;
+- (id)handleShowTeXScriptCommand:(NSScriptCommand *)command;
 
 @end
 

Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m  2007-06-18 13:14:23 UTC (rev 2336)
+++ trunk/SKDocument.m  2007-06-18 13:16:14 UTC (rev 2337)
@@ -1082,6 +1082,32 @@
     return specifier ? specifier : [NSArray array];
 }
 
+- (id)handleShowTeXScriptCommand:(NSScriptCommand *)command {
+       NSDictionary *args = [command evaluatedArguments];
+    id page = [args objectForKey:@"Page"];
+    id pointData = [args objectForKey:@"Point"];
+    NSPoint point = NSZeroPoint;
+    
+    if ([page isKindOfClass:[PDFPage class]] == NO)
+        page = [[self pdfView] currentPage];
+    if ([pointData isKindOfClass:[NSDate class]] && [pointData length] != 
sizeof(Point)) {
+        const Point *qdPoint = (const Point *)[pointData bytes];
+        point = NSPointFromPoint(*qdPoint);
+    } else {
+        NSRect bounds = [page boundsForBox:[[self pdfView] displayBox]];
+        point = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
+    }
+    if (page) {
+        unsigned int pageIndex = [[page document] indexForPage:page];
+        PDFSelection *sel = [page selectionForLineAtPoint:point];
+        NSRect rect = sel ? [sel boundsForPage:page] : NSMakeRect(point.x - 
20.0, point.y - 5.0, 40.0, 10.0);
+        
+        [[self synchronizer] findLineForLocation:point inRect:rect 
atPageIndex:pageIndex];
+    }
+    
+    return nil;
+}
+
 @end
 
 

Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef     2007-06-18 13:14:23 UTC (rev 2336)
+++ trunk/Skim.sdef     2007-06-18 13:16:14 UTC (rev 2337)
@@ -127,6 +127,9 @@
             <responds-to name="find">
                 <cocoa method="handleFindScriptCommand:"/>
             </responds-to>
+            <responds-to name="show TeX file">
+                <cocoa method="handleShowTeXScriptCommand:"/>
+            </responds-to>
                        <responds-to name="get bounds for">
                                <cocoa method=""/>
                        </responds-to>
@@ -1036,6 +1039,20 @@
             </result>
         </command>
 
+        <command name="show TeX file" code="SKIMSTeX"
+            description="Show the LaTeX source file.">
+            <direct-parameter type="document"
+                description="The document to show the TeX source for."/>
+            <parameter name="from" code="from" type="point" optional="yes"
+                description="The point from the page to show the TeX line 
for.">
+                <cocoa key="Point"/>
+            </parameter>
+            <parameter name="at" code="at  " type="page" optional="yes"
+                description="The page to show the TeX line for.">
+                <cocoa key="Page"/>
+            </parameter>
+        </command>
+
         <command name="get bounds for" code="SKIMBnds"
             description="Get the bounds of a page, note, or selection.">
             <synonym name="bounds for"/>


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 DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to