Revision: 7849
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7849&view=rev
Author:   hofman
Date:     2012-12-12 13:05:21 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
convenience method to get the pages currently displayed in the PDFView's 
documentView

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2012-12-12 00:50:15 UTC (rev 7848)
+++ trunk/SKPDFView.m   2012-12-12 13:05:21 UTC (rev 7849)
@@ -136,6 +136,7 @@
 
 - (NSRange)visiblePageIndexRange;
 - (NSRect)visibleContentRect;
+- (NSRange)displayedPageIndexRange;
 
 - (void)enableNavigation;
 - (void)disableNavigation;
@@ -2216,23 +2217,7 @@
 - (NSArray *)accessibilityChildren {
     if (accessibilityChildren == nil) {
         PDFDocument *pdfDoc = [self document];
-        NSUInteger pageCount = [pdfDoc pageCount];
-        NSRange range = NSMakeRange(0, pageCount);
-        if (pageCount && ([self displayMode] == kPDFDisplaySinglePage || [self 
displayMode] == kPDFDisplayTwoUp)) {
-            range = NSMakeRange([[self currentPage] pageIndex], 1);
-            if ([self displayMode] == kPDFDisplayTwoUp) {
-                range.length = 2;
-                if ((NSUInteger)[self displaysAsBook] != (range.location % 2)) 
{
-                    if (range.location == 0)
-                        range.length = 1;
-                    else
-                        range.location -= 1;
-                }
-                if (NSMaxRange(range) == pageCount)
-                    range.length = 1;
-            }
-        }
-        
+        NSRange range = [self displayedPageIndexRange];
         NSMutableArray *children = [NSMutableArray array];
         
         //[children addObject:[SKAccessibilityPDFDisplayViewElement 
elementWithParent:[self documentView]]];
@@ -2435,6 +2420,27 @@
     return range;
 }
 
+- (NSRange)displayedPageIndexRange {
+    NSUInteger pageCount = [[self document] pageCount];
+    PDFDisplayMode displayMode = [self displayMode];
+    NSRange range = NSMakeRange(0, pageCount);
+    if (pageCount && (displayMode == kPDFDisplaySinglePage || displayMode == 
kPDFDisplayTwoUp)) {
+        range = NSMakeRange([[self currentPage] pageIndex], 1);
+        if (displayMode == kPDFDisplayTwoUp) {
+            range.length = 2;
+            if ([self displaysAsBook] != (BOOL)(range.location % 2)) {
+                if (range.location == 0)
+                    range.length = 1;
+                else
+                    range.location -= 1;
+            }
+            if (NSMaxRange(range) == pageCount)
+                range.length = 1;
+        }
+    }
+    return range;
+}
+
 #pragma mark FullScreen navigation and autohide
 
 - (void)handleWindowWillCloseNotification:(NSNotification *)notification {
@@ -4197,25 +4203,7 @@
 
 - (void)relayoutEditField {
     if ([self isEditing]) {
-        PDFDisplayMode displayMode = [self displayMode];
-        PDFPage *page = [activeAnnotation page];
-        PDFPage *currentPage = [self currentPage];
-        BOOL isVisible = YES;
-        if ([page isEqual:currentPage] == NO && displayMode != 
kPDFDisplaySinglePageContinuous && displayMode != kPDFDisplayTwoUpContinuous) {
-            if (displayMode == kPDFDisplayTwoUp) {
-                NSInteger currentPageIndex = [currentPage pageIndex];
-                NSInteger facingPageIndex = currentPageIndex;
-                if ([self displaysAsBook] == (BOOL)(currentPageIndex % 2))
-                    facingPageIndex++;
-                else
-                    facingPageIndex--;
-                if ((NSInteger)[page pageIndex] != facingPageIndex)
-                    isVisible = NO;
-            } else {
-                isVisible = NO;
-            }
-        }
-        if (isVisible) {
+        if (NSLocationInRange([activeAnnotation pageIndex], [self 
displayedPageIndexRange])) {
             [editor updateFrame];
             if ([[editor textField] superview] == nil) {
                 [[self documentView] addSubview:[editor textField]];

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


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to