Revision: 7418
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7418&view=rev
Author:   hofman
Date:     2011-08-05 11:26:47 +0000 (Fri, 05 Aug 2011)

Log Message:
-----------
command-lick in secondary pdfview to go to scroll main pdfview

Modified Paths:
--------------
    trunk/SKSecondaryPDFView.m

Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m  2011-08-04 23:12:31 UTC (rev 7417)
+++ trunk/SKSecondaryPDFView.m  2011-08-05 11:26:47 UTC (rev 7418)
@@ -542,9 +542,32 @@
 
 - (void)mouseDown:(NSEvent *)theEvent{
     [[self window] makeFirstResponder:self];
-       if ((NSCommandKeyMask | NSShiftKeyMask) == ([theEvent modifierFlags] & 
(NSCommandKeyMask | NSShiftKeyMask))) {
+       
+    NSUInteger modifiers = [theEvent standardModifierFlags];
+       
+       if (modifiers == NSCommandKeyMask) {
+        
+        [[NSCursor arrowCursor] push];
+        
         // eat up mouseDragged/mouseUp events, so we won't get their event 
handlers
+        NSEvent *lastEvent = theEvent;
         while (YES) {
+            lastEvent = [[self window] nextEventMatchingMask: 
NSLeftMouseUpMask | NSLeftMouseDraggedMask];
+            if ([lastEvent type] == NSLeftMouseUp)
+                break;
+        }
+        
+        [NSCursor pop];
+        [self performSelector:@selector(mouseMoved:) withObject:lastEvent 
afterDelay:0];
+        
+        NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
+        PDFPage *page = [self pageForPoint:mouseLoc nearest:YES];
+        NSPoint location = [self convertPoint:mouseLoc toPage:page];
+        [synchronizedPDFView goToDestination:[[[PDFDestination alloc] 
initWithPage:page atPoint:location] autorelease]];
+        
+    } else if (modifiers == (NSCommandKeyMask | NSShiftKeyMask)) {
+        // eat up mouseDragged/mouseUp events, so we won't get their event 
handlers
+        while (YES) {
             if ([[[self window] nextEventMatchingMask: NSLeftMouseUpMask | 
NSLeftMouseDraggedMask] type] == NSLeftMouseUp)
                 break;
         }
@@ -569,7 +592,7 @@
 
 - (void)mouseUp:(NSEvent *)theEvent{
     [NSCursor pop];
-    [self mouseMoved:theEvent];
+    [self performSelector:@selector(mouseMoved:) withObject:theEvent 
afterDelay:0];
 }
 
 - (void)mouseMoved:(NSEvent *)theEvent {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to