Revision: 3020
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3020&view=rev
Author:   hofman
Date:     2007-10-06 10:53:28 -0700 (Sat, 06 Oct 2007)

Log Message:
-----------
Switch page in non-continuous mode when dragging the reading bar outside the 
document view.

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2007-10-06 17:15:52 UTC (rev 3019)
+++ trunk/SKPDFView.m   2007-10-06 17:53:28 UTC (rev 3020)
@@ -3267,6 +3267,7 @@
     NSPoint lastMouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
     NSPoint point = [self convertPoint:lastMouseLoc toPage:page];
     int lineOffset = SKIndexOfRectAtYInOrderedRects(point.y, lineBounds, YES) 
- [readingBar currentLine];
+    NSDate *lastPageChangeDate = [NSDate distantPast];
     
     lastMouseLoc = [self convertPoint:lastMouseLoc toView:[self documentView]];
     
@@ -3279,8 +3280,28 @@
             break;
         
         // dragging
-        [[self documentView] autoscroll:theEvent];
-        NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
+        NSPoint mouseLocInWindow = [theEvent locationInWindow];
+        NSPoint mouseLoc = [self convertPoint:mouseLocInWindow fromView:nil];
+        if ([[self documentView] autoscroll:theEvent] == NO &&
+            ([self displayMode] == kPDFDisplaySinglePage || [self displayMode] 
== kPDFDisplayTwoUp) &&
+            [[NSDate date] timeIntervalSinceDate:lastPageChangeDate] > 0.7) {
+            if (mouseLoc.y < NSMinY([self bounds])) {
+                if ([self canGoToNextPage]) {
+                    [self goToNextPage:self];
+                    lastMouseLoc.y = NSMaxY([[self documentView] bounds]);
+                    lastPageChangeDate = [NSDate date];
+                }
+            } else if (mouseLoc.y > NSMaxY([self bounds])) {
+                if ([self canGoToPreviousPage]) {
+                    [self goToPreviousPage:self];
+                    lastMouseLoc.y = NSMinY([[self documentView] bounds]);
+                    lastPageChangeDate = [NSDate date];
+                }
+            }
+        }
+        
+        mouseLoc = [self convertPoint:mouseLocInWindow fromView:nil];
+        
         PDFPage *currentPage = [self pageForPoint:mouseLoc nearest:YES];
         NSPoint mouseLocInPage = [self convertPoint:mouseLoc 
toPage:currentPage];
         NSPoint mouseLocInDocument = [self convertPoint:mouseLoc toView:[self 
documentView]];


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to