Revision: 6979
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6979&view=rev
Author:   hofman
Date:     2010-12-15 13:29:47 +0000 (Wed, 15 Dec 2010)

Log Message:
-----------
make ivar to track whether we selected a region local

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

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2010-12-15 12:47:23 UTC (rev 6978)
+++ trunk/SKPDFView.h   2010-12-15 13:29:47 UTC (rev 6979)
@@ -109,7 +109,6 @@
     NSRect selectionRect;
     NSUInteger selectionPageIndex;
     CGFloat magnification;
-    BOOL didSelect;
     SKRectEdges dragMask;
     NSBezierPath *bezierPath;
     NSUInteger pathPageIndex;

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2010-12-15 12:47:23 UTC (rev 6978)
+++ trunk/SKPDFView.m   2010-12-15 13:29:47 UTC (rev 6979)
@@ -218,7 +218,6 @@
     selectionRect = NSZeroRect;
     selectionPageIndex = NSNotFound;
     magnification = 0.0;
-    didSelect = NO;
     
     gestureRotation = 0.0;
     gesturePageIndex = NSNotFound;
@@ -404,7 +403,7 @@
         NSRect rect = NSInsetRect([self convertRect:selectionRect 
toPage:pdfPage], 0.5, 0.5);
         [[NSColor blackColor] setStroke];
         [NSBezierPath strokeRect:rect];
-    } else if (toolMode == SKSelectToolMode && (didSelect || 
NSEqualRects(selectionRect, NSZeroRect) == NO)) {
+    } else if (toolMode == SKSelectToolMode && selectionPageIndex != 
NSNotFound) {
         NSRect bounds = [pdfPage boundsForBox:[self displayBox]];
         CGFloat radius = 4.0 / [self scaleFactor];
         NSBezierPath *path = [NSBezierPath bezierPathWithRect:bounds];
@@ -3362,14 +3361,12 @@
     NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
     
     PDFPage *page = [self pageForPoint:mouseLoc nearest:NO];
+    if (page == nil) // should never get here, see mouseDown:
+        return;
+    
     CGFloat margin = 4.0 / [self scaleFactor];
     
-    if (page == nil) {
-        selectionRect = NSZeroRect;
-        [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewSelectionChangedNotification object:self];
-        [self setNeedsDisplay:YES];
-        return;
-    } else if ([page pageIndex] != selectionPageIndex && selectionPageIndex != 
NSNotFound) {
+    if (selectionPageIndex != NSNotFound && [page pageIndex] != 
selectionPageIndex) {
         [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, 
-margin) ofPage:[self currentSelectionPage]];
         [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, 
-margin) ofPage:page];
     }
@@ -3377,6 +3374,7 @@
     selectionPageIndex = [page pageIndex];
     
        NSPoint initialPoint = [self convertPoint:mouseLoc toPage:page];
+    BOOL didSelect = NO;
     
     dragMask = 0;
     


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

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to