Revision: 5416
http://skim-app.svn.sourceforge.net/skim-app/?rev=5416&view=rev
Author: hofman
Date: 2009-06-11 14:26:02 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
start periodic event for dragging the reading bar or an annotation to support
continuous auto-scroll
Modified Paths:
--------------
trunk/SKPDFView.m
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2009-06-11 12:51:58 UTC (rev 5415)
+++ trunk/SKPDFView.m 2009-06-11 14:26:02 UTC (rev 5416)
@@ -3147,13 +3147,19 @@
if ([activeAnnotation isMovable]) {
// we move or resize the annotation in an event loop, which
ensures it's enclosed in a single undo group
BOOL draggedAnnotation = NO;
+ NSEvent *lastMouseEvent = theEvent;
+ [NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1];
while (YES) {
- theEvent = [[self window] nextEventMatchingMask:
NSLeftMouseUpMask | NSLeftMouseDraggedMask];
+ NSEvent *theEvent = [[self window] nextEventMatchingMask:
NSLeftMouseUpMask | NSLeftMouseDraggedMask | NSPeriodicMask];
if ([theEvent type] == NSLeftMouseUp)
break;
- [self doDragAnnotationWithEvent:theEvent];
- draggedAnnotation = YES;
+ if ([theEvent type] == NSLeftMouseDragged) {
+ lastMouseEvent = theEvent;
+ draggedAnnotation = YES;
+ }
+ [self doDragAnnotationWithEvent:lastMouseEvent];
}
+ [NSEvent stopPeriodicEvents];
if (toolMode == SKNoteToolMode && NSEqualSizes(wasBounds.size,
NSZeroSize) && [[activeAnnotation type] isEqualToString:SKNFreeTextString])
[self editActiveAnnotation:self];
if (draggedAnnotation &&
@@ -3642,6 +3648,7 @@
NSArray *lineRects = [page lineRects];
NSMutableDictionary *userInfo = [NSMutableDictionary
dictionaryWithObjectsAndKeys:page, SKPDFViewOldPageKey, nil];
+ NSEvent *lastMouseEvent = theEvent;
NSPoint lastMouseLoc = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
NSPoint point = [self convertPoint:lastMouseLoc toPage:page];
NSInteger lineOffset = SKIndexOfRectAtYInOrderedRects(point.y, lineRects,
YES) - [readingBar currentLine];
@@ -3651,16 +3658,21 @@
[[NSCursor closedHandCursor] push];
+ [NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1];
+
while (YES) {
- theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
- if ([theEvent type] == NSLeftMouseUp)
+ theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask | NSPeriodicMask];
+
+ if ([theEvent type] == NSLeftMouseUp)
break;
+ if ([theEvent type] == NSLeftMouseDragged)
+ lastMouseEvent = theEvent;
// dragging
- NSPoint mouseLocInWindow = [theEvent locationInWindow];
+ NSPoint mouseLocInWindow = [lastMouseEvent locationInWindow];
NSPoint mouseLoc = [self convertPoint:mouseLocInWindow fromView:nil];
- if ([[self documentView] autoscroll:theEvent] == NO &&
+ if ([[self documentView] autoscroll:lastMouseEvent] == NO &&
([self displayMode] == kPDFDisplaySinglePage || [self displayMode]
== kPDFDisplayTwoUp) &&
[[NSDate date] timeIntervalSinceDate:lastPageChangeDate] > 0.7) {
if (mouseLoc.y < NSMinY([self bounds])) {
@@ -3709,9 +3721,11 @@
}
}
+ [NSEvent stopPeriodicEvents];
+
[NSCursor pop];
// ??? PDFView's delayed layout seems to reset the cursor to an arrow
- [[self getCursorForEvent:theEvent] performSelector:@selector(set)
withObject:nil afterDelay:0];
+ [[self getCursorForEvent:lastMouseEvent] performSelector:@selector(set)
withObject:nil afterDelay:0];
}
- (void)doResizeReadingBarWithEvent:(NSEvent *)theEvent {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit