Revision: 6963
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6963&view=rev
Author:   hofman
Date:     2010-12-12 13:21:36 +0000 (Sun, 12 Dec 2010)

Log Message:
-----------
Add markup in note tool mode in mouseUp: instead of doSelectTextWithEvent:. Add 
a comment and fix layout.

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2010-12-12 11:25:15 UTC (rev 6962)
+++ trunk/SKPDFView.m   2010-12-12 13:21:36 UTC (rev 6963)
@@ -1089,11 +1089,12 @@
                         (toolMode == SKTextToolMode || hideNotes || 
annotationMode == SKHighlightNote || annotationMode == SKUnderlineNote || 
annotationMode == SKStrikeOutNote)) {
                         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 (nil == activeAnnotation && 
mouseDownInAnnotation) {
-                            [self doSelectTextWithEvent:theEvent];
-                            mouseDownInAnnotation = NO;         
                         } else {
-                            [super mouseDown:theEvent];
+                            if (nil == activeAnnotation && 
mouseDownInAnnotation)
+                                [self doSelectTextWithEvent:theEvent];
+                            else
+                                [super mouseDown:theEvent];
+                            mouseDownInAnnotation = NO;         
                             if (toolMode == SKNoteToolMode && hideNotes == NO 
&& (annotationMode == SKHighlightNote || annotationMode == SKUnderlineNote || 
annotationMode == SKStrikeOutNote) && [[self currentSelection] hasCharacters]) {
                                 [self addAnnotationWithType:annotationMode];
                                 [self setCurrentSelection:nil];
@@ -1127,22 +1128,23 @@
     switch (toolMode) {
         case SKTextToolMode:
         case SKNoteToolMode:
+            // is this code path still needed, now that since 10.5 mouseDown: 
already tracks the mouse?
             if (mouseDownInAnnotation) {
-                if (nil == activeAnnotation && NSIsEmptyRect(selectionRect) == 
NO) {    
-                     [self setNeedsDisplayInRect:selectionRect];        
-                     selectionRect = NSZeroRect;
-                     selectionPageIndex = NSNotFound;   
-                     [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewSelectionChangedNotification object:self];     
-                 } else if ([activeAnnotation isLink]) {        
-                     NSPoint p = [self convertPoint:[theEvent 
locationInWindow] fromView:nil];          
-                     PDFPage *page = [self pageForPoint:p nearest:NO];         
 
-                     if (page && NSPointInRect([self convertPoint:p 
toPage:page], [activeAnnotation bounds]))   
-                         [self editActiveAnnotation:nil];       
-                     else       
-                         [self setActiveAnnotation:nil];        
-                 }      
-                 mouseDownInAnnotation = NO;    
-                 dragMask = 0;          
+                if (nil == activeAnnotation && NSIsEmptyRect(selectionRect) == 
NO) {
+                    [self setNeedsDisplayInRect:selectionRect];
+                    selectionRect = NSZeroRect;
+                    selectionPageIndex = NSNotFound;
+                    [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewSelectionChangedNotification object:self];
+                 } else if ([activeAnnotation isLink]) {
+                    NSPoint p = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
+                    PDFPage *page = [self pageForPoint:p nearest:NO];
+                    if (page && NSPointInRect([self convertPoint:p 
toPage:page], [activeAnnotation bounds])) 
+                        [self editActiveAnnotation:nil];
+                    else
+                        [self setActiveAnnotation:nil];
+                 }
+                 mouseDownInAnnotation = NO;
+                 dragMask = 0;
             }
             if (toolMode == SKNoteToolMode && hideNotes == NO && 
(annotationMode == SKHighlightNote || annotationMode == SKUnderlineNote || 
annotationMode == SKStrikeOutNote) && [[self currentSelection] hasCharacters]) {
                 [self addAnnotationWithType:annotationMode];
@@ -3674,11 +3676,6 @@
             selectionRect = NSZeroRect;
         }
     }
-    
-    if (toolMode == SKNoteToolMode && hideNotes == NO && (annotationMode == 
SKHighlightNote || annotationMode == SKUnderlineNote || annotationMode == 
SKStrikeOutNote) && [[self currentSelection] hasCharacters]) {
-        [self addAnnotationWithType:annotationMode];
-        [self setCurrentSelection:nil];
-    }
 }
 
 - (void)doDragReadingBarWithEvent:(NSEvent *)theEvent {


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