Revision: 6968
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6968&view=rev
Author:   hofman
Date:     2010-12-13 12:55:41 +0000 (Mon, 13 Dec 2010)

Log Message:
-----------
make mouseDownLoc a local variable instead of an ivar

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

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2010-12-13 11:19:30 UTC (rev 6967)
+++ trunk/SKPDFView.h   2010-12-13 12:55:41 UTC (rev 6968)
@@ -106,7 +106,6 @@
        PDFAnnotation *activeAnnotation;
        PDFAnnotation *highlightAnnotation;
     NSTextField *editField;
-       NSPoint mouseDownLoc;
     NSRect selectionRect;
     NSUInteger selectionPageIndex;
     CGFloat magnification;

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2010-12-13 11:19:30 UTC (rev 6967)
+++ trunk/SKPDFView.m   2010-12-13 12:55:41 UTC (rev 6968)
@@ -215,7 +215,6 @@
     readingBar = nil;
     
     activeAnnotation = nil;
-    mouseDownLoc = NSZeroPoint;
     selectionRect = NSZeroRect;
     selectionPageIndex = NSNotFound;
     magnification = 0.0;
@@ -1041,7 +1040,6 @@
     // 10.6 does not automatically make us firstResponder, that's annoying
     [[self window] makeFirstResponder:self];
     
-    mouseDownLoc = [theEvent locationInWindow];
        NSUInteger modifiers = [theEvent modifierFlags] & 
NSDeviceIndependentModifierFlagsMask;
     
     if ([[self document] isLocked]) {
@@ -1067,7 +1065,7 @@
             [self doSelectSnapshotWithEvent:theEvent];
     } else {
         PDFAreaOfInterest area = [self areaOfInterestForMouse:theEvent];
-        NSPoint p = mouseDownLoc;
+        NSPoint p = [theEvent locationInWindow];
         p = [self convertPoint:p fromView:nil];
         PDFPage *page = [self pageForPoint:p nearest:YES];
         p = [self convertPoint:p toPage:page];
@@ -2857,20 +2855,18 @@
     }
 }
 
-- (void)doResizeAnnotationWithEvent:(NSEvent *)theEvent 
originalBounds:(NSRect)originalBounds 
originalStartPoint:(NSPoint)originalStartPoint 
originalEndPoint:(NSPoint)originalEndPoint {
+- (void)doResizeAnnotationWithEvent:(NSEvent *)theEvent 
fromPoint:(NSPoint)originalPagePoint originalBounds:(NSRect)originalBounds 
originalStartPoint:(NSPoint)originalStartPoint 
originalEndPoint:(NSPoint)originalEndPoint {
     PDFPage *page = [activeAnnotation page];
     NSRect newBounds = originalBounds;
     NSRect pageBounds = [page  boundsForBox:[self displayBox]];
-    NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
-    NSPoint startPoint = [self convertPoint:[self convertPoint:mouseDownLoc 
fromView:nil] toPage:page];
-    NSPoint endPt = [self convertPoint:mouseLoc toPage:page];
-    NSPoint relPoint = SKSubstractPoints(endPt, startPoint);
+    NSPoint currentPagePoint = [self convertPoint:[self convertPoint:[theEvent 
locationInWindow] fromView:nil] toPage:page];
+    NSPoint relPoint = SKSubstractPoints(currentPagePoint, originalPagePoint);
     
     if ([[activeAnnotation type] isEqualToString:SKNLineString]) {
         
         PDFAnnotationLine *annotation = (PDFAnnotationLine *)activeAnnotation;
         NSPoint endPoint = originalEndPoint;
-        startPoint = originalStartPoint;
+        NSPoint startPoint = originalStartPoint;
         NSPoint *draggedPoint = (dragMask & SKMinXEdgeMask) ? &startPoint : 
&endPoint;
         
         *draggedPoint = SKConstrainPointInRect(SKAddPoints(*draggedPoint, 
relPoint), pageBounds);
@@ -3085,7 +3081,7 @@
         if (dragMask == 0)
             [self doMoveAnnotationWithEvent:lastMouseEvent offset:offset];
         else
-            [self doResizeAnnotationWithEvent:lastMouseEvent 
originalBounds:originalBounds originalStartPoint:originalStartPoint 
originalEndPoint:originalEndPoint];
+            [self doResizeAnnotationWithEvent:lastMouseEvent 
fromPoint:pagePoint originalBounds:originalBounds 
originalStartPoint:originalStartPoint originalEndPoint:originalEndPoint];
     }
     [NSEvent stopPeriodicEvents];
     if (toolMode == SKNoteToolMode && NSEqualSizes(originalBounds.size, 
NSZeroSize) && [[activeAnnotation type] isEqualToString:SKNFreeTextString])
@@ -3135,9 +3131,7 @@
     PDFPage *page;
     
     // Mouse in display view coordinates.
-    mouseDownLoc = [theEvent locationInWindow];
-    
-    NSPoint mouseDownOnPage = [self convertPoint:mouseDownLoc fromView:nil];
+    NSPoint mouseDownOnPage = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
     BOOL mouseDownInAnnotation = NO;
     
     // Page we're on.
@@ -3566,6 +3560,7 @@
 
 - (void)doSelectTextWithEvent:(NSEvent *)theEvent {
     // reimplement text selection behavior so we can select text inside markup 
annotation bounds rectangles (and have a highlight and strikeout on the same 
line, for instance), but don't select inside an existing markup annotation
+    NSPoint mouseDownLoc = [theEvent locationInWindow];
     PDFSelection *wasSelection = nil;
     NSUInteger modifiers = [theEvent modifierFlags] & 
NSDeviceIndependentModifierFlagsMask;
     BOOL rectSelection = (modifiers & NSAlternateKeyMask) != 0;


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

------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages, 
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev 
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to