Revision: 3776
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3776&view=rev
Author:   hofman
Date:     2008-04-20 10:08:49 -0700 (Sun, 20 Apr 2008)

Log Message:
-----------
Fix order of selecting previous active annotation.

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2008-04-20 17:08:36 UTC (rev 3775)
+++ trunk/SKPDFView.m   2008-04-20 17:08:49 UTC (rev 3776)
@@ -2027,20 +2027,23 @@
 - (void)selectPreviousActiveAnnotation:(id)sender {
     PDFDocument *pdfDoc = [self document];
     int numberOfPages = [pdfDoc pageCount];
-    int i = numberOfPages;
+    int i = -1;
     int pageIndex, startPageIndex = -1;
     PDFAnnotation *annotation = nil;
+    NSArray *annotations = nil;
     
     if (activeAnnotation) {
         if ([self isEditing])
             [self endAnnotationEdit:self];
         pageIndex = [[activeAnnotation page] pageIndex];
-        i = [[[activeAnnotation page] annotations] 
indexOfObject:activeAnnotation];
+        annotations = [[activeAnnotation page] annotations];
+        i = [annotations indexOfObject:activeAnnotation];
     } else {
         pageIndex = [[self currentPage] pageIndex];
+        annotations = [[self currentPage] annotations];
+        i = [annotations count];
     }
     while (annotation == nil) {
-        NSArray *annotations = [[pdfDoc pageAtIndex:pageIndex] annotations];
         while (--i >= 0 && annotation == nil) {
             annotation = [annotations objectAtIndex:i];
             if (([self hideNotes] || [annotation isNoteAnnotation] == NO) && 
[[annotation type] isEqualToString:SKLinkString] == NO)
@@ -2050,9 +2053,10 @@
             startPageIndex = pageIndex;
         else if (pageIndex == startPageIndex)
             break;
-        if (++pageIndex == numberOfPages)
+        if (--pageIndex == -1)
             pageIndex = numberOfPages - 1;
-        i = [[[pdfDoc pageAtIndex:pageIndex] annotations] count];
+        annotations = [[pdfDoc pageAtIndex:pageIndex] annotations];
+        i = [annotations count];
     }
     if (annotation) {
         [self scrollAnnotationToVisible:annotation];


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

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to