Revision: 3988
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3988&view=rev
Author:   hofman
Date:     2008-06-08 03:09:45 -0700 (Sun, 08 Jun 2008)

Log Message:
-----------
Always check if we found a page for a new note, apparently sometimes a note 
could still be added without a page.

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2008-06-08 09:47:05 UTC (rev 3987)
+++ trunk/SKPDFView.m   2008-06-08 10:09:45 UTC (rev 3988)
@@ -1799,8 +1799,8 @@
 }
 
 - (void)addAnnotationWithType:(SKNoteType)annotationType 
defaultPoint:(NSPoint)point {
-       PDFPage *page;
-       NSRect bounds;
+       PDFPage *page = nil;
+       NSRect bounds = NSZeroRect;
     PDFSelection *selection = [self currentSelection];
     NSString *text = nil;
        
@@ -1816,10 +1816,7 @@
             bounds = NSInsetRect(bounds, -5.0, -5.0);
         else if (annotationType == SKAnchoredNote)
             bounds.size = SKPDFAnnotationNoteSize;
-       } else if (annotationType == SKHighlightNote || annotationType == 
SKUnderlineNote || annotationType == SKStrikeOutNote) {
-        NSBeep();
-        return;
-    } else {
+       } else if (annotationType != SKHighlightNote && annotationType != 
SKUnderlineNote && annotationType != SKStrikeOutNote) {
         
                // First try the current mouse position
         NSPoint center = [self convertPoint:point fromView:nil];
@@ -1845,7 +1842,9 @@
         // Make sure it fits in the page
         bounds = SKConstrainRect(bounds, [page boundsForBox:[self 
displayBox]]);
        }
-    [self addAnnotationWithType:annotationType contents:text page:page 
bounds:bounds];
+    if (page != nil)
+        [self addAnnotationWithType:annotationType contents:text page:page 
bounds:bounds];
+    else NSBeep();
 }
 
 - (void)addAnnotationWithType:(SKNoteType)annotationType contents:(NSString 
*)text page:(PDFPage *)page bounds:(NSRect)bounds {
@@ -2884,7 +2883,7 @@
 }
 
 - (BOOL)doSelectAnnotationWithEvent:(NSEvent *)theEvent {
-    PDFAnnotation *newActiveAnnotation = NULL;
+    PDFAnnotation *newActiveAnnotation = nil;
     NSArray *annotations;
     int i;
     NSPoint pagePoint;
@@ -2934,7 +2933,7 @@
         }
     }
     
-    if (hideNotes == NO) {
+    if (hideNotes == NO && page != nil) {
         if (([theEvent modifierFlags] & NSAlternateKeyMask) && 
[newActiveAnnotation isMovable]) {
             // select a new copy of the annotation
             PDFAnnotation *newAnnotation = [[PDFAnnotation alloc] 
initNoteWithProperties:[newActiveAnnotation properties]];


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to