Revision: 2826
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2826&view=rev
Author:   hofman
Date:     2007-09-04 09:56:47 -0700 (Tue, 04 Sep 2007)

Log Message:
-----------
Add a convenience method to get the index of a page.

Don't allow empty selection in outline.

Modified Paths:
--------------
    trunk/Dutch.lproj/MainWindow.nib/info.nib
    trunk/Dutch.lproj/MainWindow.nib/keyedobjects.nib
    trunk/English.lproj/MainWindow.nib/info.nib
    trunk/English.lproj/MainWindow.nib/keyedobjects.nib
    trunk/French.lproj/MainWindow.nib/info.nib
    trunk/French.lproj/MainWindow.nib/keyedobjects.nib
    trunk/Italian.lproj/MainWindow.nib/info.nib
    trunk/Italian.lproj/MainWindow.nib/keyedobjects.nib
    trunk/PDFPage_SKExtensions.h
    trunk/PDFPage_SKExtensions.m
    trunk/PDFSelection_SKExtensions.m
    trunk/SKDocument.m
    trunk/SKMainWindowController.m
    trunk/SKPDFAnnotationNote.m
    trunk/SKPDFView.m
    trunk/SKReadingBar.m
    trunk/SKSnapshotWindowController.m

Modified: trunk/Dutch.lproj/MainWindow.nib/info.nib
===================================================================
--- trunk/Dutch.lproj/MainWindow.nib/info.nib   2007-09-04 15:32:08 UTC (rev 
2825)
+++ trunk/Dutch.lproj/MainWindow.nib/info.nib   2007-09-04 16:56:47 UTC (rev 
2826)
@@ -31,9 +31,9 @@
        </array>
        <key>IBOpenObjects</key>
        <array>
-               <integer>502</integer>
                <integer>224</integer>
                <integer>256</integer>
+               <integer>502</integer>
        </array>
        <key>IBSystem Version</key>
        <string>8R218</string>

Modified: trunk/Dutch.lproj/MainWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/English.lproj/MainWindow.nib/info.nib
===================================================================
--- trunk/English.lproj/MainWindow.nib/info.nib 2007-09-04 15:32:08 UTC (rev 
2825)
+++ trunk/English.lproj/MainWindow.nib/info.nib 2007-09-04 16:56:47 UTC (rev 
2826)
@@ -31,20 +31,20 @@
        </array>
        <key>IBOpenObjects</key>
        <array>
-               <integer>633</integer>
-               <integer>502</integer>
-               <integer>314</integer>
-               <integer>224</integer>
+               <integer>553</integer>
                <integer>5</integer>
-               <integer>553</integer>
                <integer>694</integer>
+               <integer>208</integer>
+               <integer>314</integer>
+               <integer>502</integer>
+               <integer>633</integer>
+               <integer>687</integer>
                <integer>511</integer>
-               <integer>687</integer>
-               <integer>208</integer>
+               <integer>256</integer>
+               <integer>539</integer>
                <integer>585</integer>
+               <integer>224</integer>
                <integer>168</integer>
-               <integer>539</integer>
-               <integer>256</integer>
        </array>
        <key>IBSystem Version</key>
        <string>8R218</string>

Modified: trunk/English.lproj/MainWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/French.lproj/MainWindow.nib/info.nib
===================================================================
--- trunk/French.lproj/MainWindow.nib/info.nib  2007-09-04 15:32:08 UTC (rev 
2825)
+++ trunk/French.lproj/MainWindow.nib/info.nib  2007-09-04 16:56:47 UTC (rev 
2826)
@@ -32,9 +32,9 @@
        <key>IBOpenObjects</key>
        <array>
                <integer>314</integer>
-               <integer>256</integer>
                <integer>502</integer>
                <integer>224</integer>
+               <integer>256</integer>
        </array>
        <key>IBSystem Version</key>
        <string>8R218</string>

Modified: trunk/French.lproj/MainWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/Italian.lproj/MainWindow.nib/info.nib
===================================================================
--- trunk/Italian.lproj/MainWindow.nib/info.nib 2007-09-04 15:32:08 UTC (rev 
2825)
+++ trunk/Italian.lproj/MainWindow.nib/info.nib 2007-09-04 16:56:47 UTC (rev 
2826)
@@ -31,19 +31,19 @@
        </array>
        <key>IBOpenObjects</key>
        <array>
+               <integer>676</integer>
                <integer>256</integer>
-               <integer>539</integer>
-               <integer>511</integer>
+               <integer>5</integer>
                <integer>208</integer>
                <integer>224</integer>
-               <integer>676</integer>
                <integer>677</integer>
-               <integer>5</integer>
+               <integer>168</integer>
                <integer>314</integer>
+               <integer>539</integer>
+               <integer>628</integer>
+               <integer>511</integer>
                <integer>502</integer>
                <integer>553</integer>
-               <integer>628</integer>
-               <integer>168</integer>
        </array>
        <key>IBSystem Version</key>
        <string>8R218</string>

Modified: trunk/Italian.lproj/MainWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/PDFPage_SKExtensions.h
===================================================================
--- trunk/PDFPage_SKExtensions.h        2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/PDFPage_SKExtensions.h        2007-09-04 16:56:47 UTC (rev 2826)
@@ -55,6 +55,8 @@
 
 - (NSArray *)lineBounds;
 
+- (unsigned int)pageIndex;
+
 - (NSScriptObjectSpecifier *)objectSpecifier;
 - (SKDocument *)containingDocument;
 - (unsigned int)index;

Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m        2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/PDFPage_SKExtensions.m        2007-09-04 16:56:47 UTC (rev 2826)
@@ -267,11 +267,15 @@
     return fullLines;
 }
 
+- (unsigned int)pageIndex {
+    return [[self document] indexForPage:self];
+}
+
 #pragma mark Scripting support
 
 - (NSScriptObjectSpecifier *)objectSpecifier {
     SKDocument *document = [self containingDocument];
-       unsigned index = [[self document] indexForPage:self];
+       unsigned index = [self pageIndex];
     
     if (document && index != NSNotFound) {
         NSScriptObjectSpecifier *containerRef = [document objectSpecifier];
@@ -294,7 +298,7 @@
 }
 
 - (unsigned int)index {
-    return [[self document] indexForPage:self] + 1;
+    return [self pageIndex] + 1;
 }
 
 - (int)rotationAngle {

Modified: trunk/PDFSelection_SKExtensions.m
===================================================================
--- trunk/PDFSelection_SKExtensions.m   2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/PDFSelection_SKExtensions.m   2007-09-04 16:56:47 UTC (rev 2826)
@@ -459,7 +459,7 @@
     if ([dPO isKindOfClass:[SKDocument class]]) {
         index = [[NSApp orderedDocuments] indexOfObjectIdenticalTo:dPO];
     } else if ([dPO isKindOfClass:[PDFPage class]]) {
-        index = [[page document] indexForPage:dPO];
+        index = [dPO pageIndex];
     } else if ([dPO isKindOfClass:[PDFAnnotation class]]) {
         index = [[(page ? (id)page : (id)[page containingDocument]) 
valueForKey:@"notes"] indexOfObjectIdenticalTo:dPO];
     } else {

Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m  2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/SKDocument.m  2007-09-04 16:56:47 UTC (rev 2826)
@@ -1575,7 +1575,7 @@
         point = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
     }
     if (page) {
-        unsigned int pageIndex = [[page document] indexForPage:page];
+        unsigned int pageIndex = [page pageIndex];
         PDFSelection *sel = [page selectionForLineAtPoint:point];
         NSRect rect = sel ? [sel boundsForPage:page] : NSMakeRect(point.x - 
20.0, point.y - 5.0, 40.0, 10.0);
         

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/SKMainWindowController.m      2007-09-04 16:56:47 UTC (rev 2826)
@@ -523,7 +523,7 @@
     [setup setObject:NSStringFromRect([mainWindow frame]) 
forKey:@"windowFrame"];
     [setup setObject:[NSNumber numberWithFloat:NSWidth([leftSideContentBox 
frame])] forKey:@"leftSidePaneWidth"];
     [setup setObject:[NSNumber numberWithFloat:NSWidth([rightSideContentBox 
frame])] forKey:@"rightSidePaneWidth"];
-    [setup setObject:[NSNumber numberWithUnsignedInt:[[pdfView document] 
indexForPage:[pdfView currentPage]]] forKey:@"pageIndex"];
+    [setup setObject:[NSNumber numberWithUnsignedInt:[[pdfView currentPage] 
pageIndex]] forKey:@"pageIndex"];
     if ([self isFullScreen] || [self isPresentation]) {
         [setup addEntriesFromDictionary:savedNormalSetup];
         [setup removeObjectsForKeys:[NSArray 
arrayWithObjects:@"hasHorizontalScroller", @"hasVerticalScroller", 
@"autoHidesScrollers", nil]];
@@ -730,7 +730,7 @@
 
 - (void)setDocument:(NSDocument *)document {
     if ([self document] && document == nil) {
-        unsigned int pageIndex = [[pdfView document] indexForPage:[pdfView 
currentPage]];
+        unsigned int pageIndex = [[pdfView currentPage] pageIndex];
         NSString *path = [[[self document] fileURL] path];
         if (pageIndex != NSNotFound && path)
             [[SKBookmarkController sharedBookmarkController] 
addRecentDocumentForPath:path pageIndex:pageIndex snapshots:[snapshots 
valueForKey:@"currentSetup"]];
@@ -751,7 +751,7 @@
         NSArray *snapshotDicts = nil;
         
         if ([pdfView document]) {
-            pageIndex = [[pdfView document] indexForPage:[pdfView 
currentPage]];
+            pageIndex = [[pdfView currentPage] pageIndex];
             visibleRect = [pdfView convertRect:[pdfView convertRect:[[pdfView 
documentView] visibleRect] fromView:[pdfView documentView]] toPage:[pdfView 
currentPage]];
             
             [[pdfView document] cancelFindString];
@@ -906,7 +906,7 @@
 }
 
 - (unsigned int)pageNumber {
-    return [[pdfView document] indexForPage:[pdfView currentPage]] + 1;
+    return [[pdfView currentPage] pageIndex] + 1;
 }
 
 - (void)setPageNumber:(unsigned int)pageNumber {
@@ -1399,11 +1399,11 @@
 }
 
 - (IBAction)rotateRight:(id)sender {
-    [self rotatePageAtIndex:[[pdfView document] indexForPage:[pdfView 
currentPage]] by:90];
+    [self rotatePageAtIndex:[[pdfView currentPage] pageIndex] by:90];
 }
 
 - (IBAction)rotateLeft:(id)sender {
-    [self rotatePageAtIndex:[[pdfView document] indexForPage:[pdfView 
currentPage]] by:-90];
+    [self rotatePageAtIndex:[[pdfView currentPage] pageIndex] by:-90];
 }
 
 - (IBAction)rotateAllRight:(id)sender {
@@ -1455,7 +1455,7 @@
     NSRect rect = NSIntegralRect([pdfView currentSelectionRect]);
     if (NSIsEmptyRect(rect))
         rect = [[pdfView currentPage] foregroundBox];
-    [self cropPageAtIndex:[[pdfView document] indexForPage:[pdfView 
currentPage]] toRect:rect];
+    [self cropPageAtIndex:[[pdfView currentPage] pageIndex] toRect:rect];
 }
 
 - (void)cropPagesToRects:(NSArray *)rects {
@@ -2488,7 +2488,7 @@
 
 - (void)findString:(NSString *)string options:(int)options{
     PDFSelection *sel = [pdfView currentSelection];
-    unsigned pageIndex = [[pdfView document] indexForPage:[pdfView 
currentPage]];
+    unsigned pageIndex = [[pdfView currentPage] pageIndex];
     while ([sel string] == nil && pageIndex-- > 0) {
         PDFPage *page = [[pdfView document] pageAtIndex:pageIndex];
         sel = [page selectionForRect:[page 
boundsForBox:kPDFDisplayBoxCropBox]];
@@ -2661,7 +2661,7 @@
         SKBookmarkController *bmController = [SKBookmarkController 
sharedBookmarkController];
         NSString *path = [[self document] fileName];
         NSString *label = [bookmarkField stringValue];
-        unsigned int pageIndex = [[pdfView document] indexForPage:[pdfView 
currentPage]];
+        unsigned int pageIndex = [[pdfView currentPage] pageIndex];
         [bmController addBookmarkForPath:path pageIndex:pageIndex label:label];
     }
 }
@@ -2689,7 +2689,7 @@
 }
 
 - (void)handlePageChangedNotification:(NSNotification *)notification {
-    [lastViewedPages insertObject:[NSNumber numberWithInt:[[pdfView document] 
indexForPage:[pdfView currentPage]]] atIndex:0];
+    [lastViewedPages insertObject:[NSNumber numberWithInt:[[pdfView 
currentPage] pageIndex]] atIndex:0];
     if ([lastViewedPages count] > 5)
         [lastViewedPages removeLastObject];
     [thumbnailTableView setNeedsDisplay:YES];
@@ -2777,7 +2777,7 @@
         updatingNoteSelection = NO;
     }
     if (page) {
-        [self updateThumbnailAtPageIndex:[[pdfView document] 
indexForPage:page]];
+        [self updateThumbnailAtPageIndex:[page pageIndex]];
         NSEnumerator *snapshotEnum = [snapshots objectEnumerator];
         SKSnapshotWindowController *wc;
         while (wc = [snapshotEnum nextObject]) {
@@ -2809,7 +2809,7 @@
         [noteArrayController rearrangeObjects];
     }
     if (page) {
-        [self updateThumbnailAtPageIndex:[[pdfView document] 
indexForPage:page]];
+        [self updateThumbnailAtPageIndex:[page pageIndex]];
         NSEnumerator *snapshotEnum = [snapshots objectEnumerator];
         SKSnapshotWindowController *wc;
         while (wc = [snapshotEnum nextObject]) {
@@ -2826,9 +2826,9 @@
     
     if (oldPage || newPage) {
         if (oldPage)
-            [self updateThumbnailAtPageIndex:[[pdfView document] 
indexForPage:oldPage]];
+            [self updateThumbnailAtPageIndex:[oldPage pageIndex]];
         if (newPage)
-            [self updateThumbnailAtPageIndex:[[pdfView document] 
indexForPage:newPage]];
+            [self updateThumbnailAtPageIndex:[newPage pageIndex]];
         NSEnumerator *snapshotEnum = [snapshots objectEnumerator];
         SKSnapshotWindowController *wc;
         while (wc = [snapshotEnum nextObject]) {
@@ -2852,9 +2852,9 @@
     PDFPage *oldPage = [userInfo objectForKey:@"oldPage"];
     PDFPage *newPage = [userInfo objectForKey:@"newPage"];
     if (oldPage)
-        [self updateThumbnailAtPageIndex:[[pdfView document] 
indexForPage:oldPage]];
+        [self updateThumbnailAtPageIndex:[oldPage pageIndex]];
     if (newPage && [newPage isEqual:oldPage] == NO)
-        [self updateThumbnailAtPageIndex:[[pdfView document] 
indexForPage:newPage]];
+        [self updateThumbnailAtPageIndex:[newPage pageIndex]];
 }
 
 - (void)handleAnnotationDidChangeNotification:(NSNotification *)notification {
@@ -2900,7 +2900,7 @@
     if (displayChanged)
         [pdfView layoutDocumentView];
     if (page) {
-        unsigned int index = [[pdfView document] indexForPage:page];
+        unsigned int index = [page pageIndex];
         NSEnumerator *snapshotEnum = [snapshots objectEnumerator];
         SKSnapshotWindowController *wc;
         while (wc = [snapshotEnum nextObject]) {
@@ -3730,14 +3730,16 @@
                // Get the destination of the given row....
                PDFOutline *outlineItem = (PDFOutline *)[outlineView itemAtRow: 
i];
                
-               if ([[pdfView document] indexForPage: [[outlineItem 
destination] page]] == pageIndex) {
+               if ([[[outlineItem destination] page ] pageIndex] == pageIndex) 
{
             break;
-        } else if ([[pdfView document] indexForPage: [[outlineItem 
destination] page]] > pageIndex) {
+        } else if ([[[outlineItem destination] page] pageIndex] > pageIndex) {
                        if (i > 0) --i;
             break;     
                }
        }
-    return i == numRows ? -1 : i;
+    if (i == numRows)
+        i--;
+    return i;
 }
 
 - (void)updateOutlineSelection{
@@ -3747,20 +3749,17 @@
                return;
        
        // Get index of current page.
-       unsigned int pageIndex = [[pdfView document] indexForPage: [pdfView 
currentPage]];
-       
-       // Test that the current selection is still valid.
-       PDFOutline *outlineItem = (PDFOutline *)[outlineView itemAtRow: 
[outlineView selectedRow]];
-       
-    if ([[pdfView document] indexForPage: [[outlineItem destination] page]] == 
pageIndex)
-               return;
-       
-    int row = [self outlineRowForPageIndex:pageIndex];
+       unsigned int pageIndex = [[pdfView currentPage] pageIndex];
     
-    if (row != -1) {
-        updatingOutlineSelection = YES;
-        [outlineView selectRow:row byExtendingSelection: NO];
-        updatingOutlineSelection = NO;
+       // Test that the current selection is still valid.
+       int row = [outlineView selectedRow];
+    if (row == -1 || [[[[outlineView itemAtRow:row] destination] page] 
pageIndex] != pageIndex) {
+        row = [self outlineRowForPageIndex:pageIndex];
+        if (row != -1) {
+            updatingOutlineSelection = YES;
+            [outlineView selectRow:row byExtendingSelection: NO];
+            updatingOutlineSelection = NO;
+        }
     }
 }
 
@@ -3768,7 +3767,7 @@
 
 - (void)updateThumbnailSelection {
        // Get index of current page.
-       unsigned pageIndex = [[pdfView document] indexForPage: [pdfView 
currentPage]];
+       unsigned pageIndex = [[pdfView currentPage] pageIndex];
     updatingThumbnailSelection = YES;
     [thumbnailTableView selectRowIndexes:[NSIndexSet 
indexSetWithIndex:pageIndex] byExtendingSelection:NO];
     [thumbnailTableView scrollRowToVisible:pageIndex];
@@ -3838,7 +3837,7 @@
 
     NSArray *orderedNotes = [noteArrayController arrangedObjects];
     PDFAnnotation *annotation, *selAnnotation = nil;
-    unsigned int pageIndex = [[pdfView document] indexForPage: [pdfView 
currentPage]];
+    unsigned int pageIndex = [[pdfView currentPage] pageIndex];
        int i, count = [orderedNotes count];
     unsigned int selPageIndex = [noteOutlineView selectedRow] != -1 ? [[self 
selectedNote] pageIndex] : NSNotFound;
     

Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/SKPDFAnnotationNote.m 2007-09-04 16:56:47 UTC (rev 2826)
@@ -230,7 +230,7 @@
 
 - (unsigned int)pageIndex {
     PDFPage *page = [self page];
-    return page ? [[page document] indexForPage:page] : NSNotFound;
+    return page ? [page pageIndex] : NSNotFound;
 }
 
 - (int)noteType {

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/SKPDFView.m   2007-09-04 16:56:47 UTC (rev 2826)
@@ -1388,7 +1388,7 @@
 }
 
 - (void)checkSpellingStartingAtIndex:(int)index onPage:(PDFPage *)page {
-    unsigned int i, first = [[self document] indexForPage:page];
+    unsigned int i, first = [page pageIndex];
     unsigned int count = [[self document] pageCount];
     BOOL didWrap = NO;
     i = first;
@@ -1970,10 +1970,10 @@
     if (activeAnnotation) {
         if (editAnnotation)
             [self endAnnotationEdit:self];
-        pageIndex = [pdfDoc indexForPage:[activeAnnotation page]];
+        pageIndex = [[activeAnnotation page] pageIndex];
         i = [[[activeAnnotation page] annotations] 
indexOfObject:activeAnnotation];
     } else {
-        pageIndex = [pdfDoc indexForPage:[self currentPage]];
+        pageIndex = [[self currentPage] pageIndex];
     }
     while (annotation == nil) {
         NSArray *annotations = [[pdfDoc pageAtIndex:pageIndex] annotations];
@@ -2015,10 +2015,10 @@
     if (activeAnnotation) {
         if (editAnnotation)
             [self endAnnotationEdit:self];
-        pageIndex = [pdfDoc indexForPage:[activeAnnotation page]];
+        pageIndex = [[activeAnnotation page] pageIndex];
         i = [[[activeAnnotation page] annotations] 
indexOfObject:activeAnnotation];
     } else {
-        pageIndex = [pdfDoc indexForPage:[self currentPage]];
+        pageIndex = [[self currentPage] pageIndex];
     }
     while (annotation == nil) {
         NSArray *annotations = [[pdfDoc pageAtIndex:pageIndex] annotations];
@@ -2113,7 +2113,7 @@
     
     SKMainWindowController *controller = [[self window] windowController];
     
-    [controller showSnapshotAtPageNumber:[[self document] indexForPage:page] 
forRect:rect factor:1 autoFits:autoFits display:YES];
+    [controller showSnapshotAtPageNumber:[page pageIndex] forRect:rect 
factor:1 autoFits:autoFits display:YES];
 }
 
 #pragma mark Notification handling
@@ -2307,9 +2307,9 @@
     unsigned first, last;
     
     page = [self pageForPoint:SKTopLeftPoint(visibleRect) nearest:YES];
-    first = [[self document] indexForPage:page];
+    first = [page pageIndex];
     page = [self pageForPoint:SKBottomRightPoint(visibleRect) nearest:YES];
-    last = [[self document] indexForPage:page];
+    last = [page pageIndex];
     
     return NSMakeRange(first, last - first + 1);
 }
@@ -3404,7 +3404,7 @@
     
     SKMainWindowController *controller = [[self window] windowController];
     
-    [controller showSnapshotAtPageNumber:[[self document] indexForPage:page] 
forRect:[self convertRect:rect toPage:page] factor:factor autoFits:autoFits 
display:YES];
+    [controller showSnapshotAtPageNumber:[page pageIndex] forRect:[self 
convertRect:rect toPage:page] factor:factor autoFits:autoFits display:YES];
 }
 
 - (void)magnifyWithEvent:(NSEvent *)theEvent {
@@ -3543,7 +3543,7 @@
         NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
         PDFPage *page = [self pageForPoint:mouseLoc nearest:YES];
         NSPoint location = [self convertPoint:mouseLoc toPage:page];
-        unsigned int pageIndex = [[self document] indexForPage:page];
+        unsigned int pageIndex = [page pageIndex];
         PDFSelection *sel = [page selectionForLineAtPoint:location];
         NSRect rect = sel ? [sel boundsForPage:page] : NSMakeRect(location.x - 
20.0, location.y - 5.0, 40.0, 10.0);
         

Modified: trunk/SKReadingBar.m
===================================================================
--- trunk/SKReadingBar.m        2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/SKReadingBar.m        2007-09-04 16:56:47 UTC (rev 2826)
@@ -127,7 +127,7 @@
 - (BOOL)goToNextPage {
     BOOL didMove = NO;
     PDFDocument *doc = [page document];
-    int i = [doc indexForPage:page], iMax = [doc pageCount];
+    int i = [page pageIndex], iMax = [doc pageCount];
     
     while (++i < iMax) {
         PDFPage *nextPage = [doc pageAtIndex:i];

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2007-09-04 15:32:08 UTC (rev 2825)
+++ trunk/SKSnapshotWindowController.m  2007-09-04 16:56:47 UTC (rev 2826)
@@ -48,6 +48,7 @@
 #import "SKStringConstants.h"
 #import "NSUserDefaultsController_SKExtensions.h"
 #import "NSGeometry_SKExtensions.h"
+#import "PDFPage_SKExtensions.h"
 
 static NSString *SKSnapshotWindowFrameAutosaveName = @"SKSnapshotWindow";
 static NSString *SKSnapshotViewChangedNotification = 
@"SKSnapshotViewChangedNotification";
@@ -230,10 +231,10 @@
     
     NSView *clipView = [[[pdfView documentView] enclosingScrollView] 
contentView];
     NSRect visibleRect = [clipView convertRect:[clipView visibleRect] 
toView:pdfView];
-    unsigned first, last, index = [[pdfView document] indexForPage:page];
+    unsigned first, last, index = [page pageIndex];
     
-    first = [[pdfView document] indexForPage:[pdfView 
pageForPoint:SKTopLeftPoint(visibleRect) nearest:YES]];
-    last = [[pdfView document] indexForPage:[pdfView 
pageForPoint:SKBottomRightPoint(visibleRect) nearest:YES]];
+    first = [[pdfView pageForPoint:SKTopLeftPoint(visibleRect) nearest:YES] 
pageIndex];
+    last = [[pdfView pageForPoint:SKBottomRightPoint(visibleRect) nearest:YES] 
pageIndex];
     
     return index >= first && index <= last;
 }
@@ -264,7 +265,7 @@
 }
 
 - (unsigned int)pageIndex {
-    return [[pdfView document] indexForPage:[pdfView currentPage]];
+    return [[pdfView currentPage] pageIndex];
 }
 
 - (NSDictionary *)pageAndWindow {


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to