Revision: 6987
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6987&view=rev
Author:   hofman
Date:     2010-12-17 22:40:34 +0000 (Fri, 17 Dec 2010)

Log Message:
-----------
move freehand drawing call to mouseDown:

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2010-12-17 22:03:06 UTC (rev 6986)
+++ trunk/SKPDFView.m   2010-12-17 22:40:34 UTC (rev 6987)
@@ -1083,9 +1083,13 @@
                 case SKTextToolMode:
                 case SKNoteToolMode:
                     if ([self doSelectAnnotationWithEvent:theEvent 
hitAnnotation:&hitAnnotation] == NO) {
-                        if (area == kPDFPageArea && [theEvent 
standardModifierFlags] == 0 && [[page selectionForRect:NSMakeRect(p.x - 40.0, 
p.y - 50.0, 80.0, 100.0)] hasCharacters] == NO) {
+                        if (toolMode == SKNoteToolMode && annotationMode == 
SKInkNote && hideNotes == NO && page) {
+                            [self doDrawFreehandNoteWithEvent:theEvent];
+                        } else if (toolMode == SKNoteToolMode && hideNotes == 
NO && ANNOTATION_MODE_IS_MARKUP == NO) {
+                            [self doNothingWithEvent:theEvent];
+                        } else if (area == kPDFPageArea && [theEvent 
standardModifierFlags] == 0 && [[page selectionForRect:NSMakeRect(p.x - 40.0, 
p.y - 50.0, 80.0, 100.0)] hasCharacters] == NO) {
                             [self doDragWithEvent:theEvent];
-                        } else if (toolMode == SKTextToolMode || hideNotes || 
ANNOTATION_MODE_IS_MARKUP) {
+                        } else {
                             // before 10.6 PDFView did not select behind an 
annotation
                             if (hitAnnotation && floor(NSAppKitVersionNumber) 
<= NSAppKitVersionNumber10_5)
                                 [self doSelectTextWithEvent:theEvent];
@@ -1095,8 +1099,6 @@
                                 [self addAnnotationWithType:annotationMode];
                                 [self setCurrentSelection:nil];
                             }
-                        } else {
-                            [self doNothingWithEvent:theEvent];
                         }
                     }
                     break;
@@ -3232,40 +3234,24 @@
         }
     }
     
-    if (newActiveAnnotation) {
+    if (newActiveAnnotation || isInk == NO || hideNotes || page == nil) {
+        [self setActiveAnnotation:newActiveAnnotation];
         
-        if (activeAnnotation != newActiveAnnotation)
-            [self setActiveAnnotation:newActiveAnnotation];
-        
-        if ([activeAnnotation isLink]) {
+        if ([newActiveAnnotation isLink]) {
             [self doSelectLinkAnnotationWithEvent:theEvent];
-        } else if ([theEvent clickCount] == 2 && [activeAnnotation 
isSkimNote]) {
+        } else if ([theEvent clickCount] == 2 && [newActiveAnnotation 
isEditable]) {
             [self doNothingWithEvent:theEvent];
             [self editActiveAnnotation:self];
-        } else if ([activeAnnotation isMovable]) {
+        } else if ([newActiveAnnotation isMovable]) {
             [self doDragAnnotationWithEvent:theEvent atPoint:pagePoint 
pageRotation:[page rotation]];
-        } else {
+        } else if (newActiveAnnotation) {
             [self doNothingWithEvent:theEvent];
         }
         
-        if (hitAnnotation) *hitAnnotation = mouseDownInAnnotation;
-        return YES;
-        
-    } else if (isInk && hideNotes == NO && page != nil) {
-        
-        [self doDrawFreehandNoteWithEvent:theEvent];
-        
-        if (hitAnnotation) *hitAnnotation = mouseDownInAnnotation;
-        return YES;
-        
-    } else {
-        // no new active annotation
-        [self setActiveAnnotation:nil];
-        
-        if (hitAnnotation) *hitAnnotation = mouseDownInAnnotation;
-        return NO;
-        
     }
+    
+    if (hitAnnotation) *hitAnnotation = mouseDownInAnnotation;
+    return newActiveAnnotation != nil;
 }
 
 - (void)doDrawFreehandNoteWithEvent:(NSEvent *)theEvent {


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