Revision: 5511
http://skim-app.svn.sourceforge.net/skim-app/?rev=5511&view=rev
Author: hofman
Date: 2009-07-23 09:32:08 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
enable pdf-to-tex sync in snapshot and split pdf
Modified Paths:
--------------
trunk/SKSecondaryPDFView.m
trunk/SKSnapshotPDFView.m
Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m 2009-07-22 18:29:34 UTC (rev 5510)
+++ trunk/SKSecondaryPDFView.m 2009-07-23 09:32:08 UTC (rev 5511)
@@ -44,6 +44,8 @@
#import "NSResponder_SKExtensions.h"
#import "NSEvent_SKExtensions.h"
#import "SKHighlightingPopUpButton.h"
+#import "SKPDFDocument.h"
+#import "SKPDFSynchronizer.h"
@interface NSResponder (BDSKGesturesPrivate)
@@ -574,7 +576,28 @@
#pragma mark Dragging
- (void)mouseDown:(NSEvent *)theEvent{
- [[NSCursor closedHandCursor] push];
+ if ((NSCommandKeyMask | NSShiftKeyMask) == ([theEvent modifierFlags] &
(NSCommandKeyMask | NSShiftKeyMask))) {
+ SKPDFDocument *document = (SKPDFDocument *)[[[self window]
windowController] document];
+
+ if ([document respondsToSelector:@selector(synchronizer)]) {
+
+ NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
+ PDFPage *page = [self pageForPoint:mouseLoc nearest:YES];
+ NSPoint location = [self convertPoint:mouseLoc toPage:page];
+ NSUInteger pageIndex = [page pageIndex];
+ PDFSelection *sel = [page selectionForLineAtPoint:location];
+ NSRect rect = sel ? [sel boundsForPage:page] :
NSMakeRect(location.x - 20.0, location.y - 5.0, 40.0, 10.0);
+
+ [[document synchronizer] findFileAndLineForLocation:location
inRect:rect pageBounds:[page boundsForBox:kPDFDisplayBoxMediaBox]
atPageIndex:pageIndex];
+ }
+ // eat up mouseDragged/mouseUp events, so we won't get their event
handlers
+ while (YES) {
+ if ([[[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask] type] == NSLeftMouseUp)
+ break;
+ }
+ } else {
+ [[NSCursor closedHandCursor] push];
+ }
}
- (void)mouseUp:(NSEvent *)theEvent{
Modified: trunk/SKSnapshotPDFView.m
===================================================================
--- trunk/SKSnapshotPDFView.m 2009-07-22 18:29:34 UTC (rev 5510)
+++ trunk/SKSnapshotPDFView.m 2009-07-23 09:32:08 UTC (rev 5511)
@@ -41,6 +41,9 @@
#import "NSResponder_SKExtensions.h"
#import "NSEvent_SKExtensions.h"
#import "SKHighlightingPopUpButton.h"
+#import "PDFPage_SKExtensions.h"
+#import "SKPDFDocument.h"
+#import "SKPDFSynchronizer.h"
@implementation SKSnapshotPDFView
@@ -425,7 +428,28 @@
#pragma mark Dragging
- (void)mouseDown:(NSEvent *)theEvent{
- [[NSCursor closedHandCursor] push];
+ if ((NSCommandKeyMask | NSShiftKeyMask) == ([theEvent modifierFlags] &
(NSCommandKeyMask | NSShiftKeyMask))) {
+ SKPDFDocument *document = (SKPDFDocument *)[[[self window]
windowController] document];
+
+ if ([document respondsToSelector:@selector(synchronizer)]) {
+
+ NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
+ PDFPage *page = [self pageForPoint:mouseLoc nearest:YES];
+ NSPoint location = [self convertPoint:mouseLoc toPage:page];
+ NSUInteger pageIndex = [page pageIndex];
+ PDFSelection *sel = [page selectionForLineAtPoint:location];
+ NSRect rect = sel ? [sel boundsForPage:page] :
NSMakeRect(location.x - 20.0, location.y - 5.0, 40.0, 10.0);
+
+ [[document synchronizer] findFileAndLineForLocation:location
inRect:rect pageBounds:[page boundsForBox:kPDFDisplayBoxMediaBox]
atPageIndex:pageIndex];
+ }
+ // eat up mouseDragged/mouseUp events, so we won't get their event
handlers
+ while (YES) {
+ if ([[[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask] type] == NSLeftMouseUp)
+ break;
+ }
+ } else {
+ [[NSCursor closedHandCursor] push];
+ }
}
- (void)mouseUp:(NSEvent *)theEvent{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit