Revision: 3086
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3086&view=rev
Author:   hofman
Date:     2007-10-28 11:29:29 -0700 (Sun, 28 Oct 2007)

Log Message:
-----------
End editing if needed in Leopard.

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2007-10-28 18:12:12 UTC (rev 3085)
+++ trunk/SKPDFView.m   2007-10-28 18:29:29 UTC (rev 3086)
@@ -126,6 +126,8 @@
 - (NSCursor *)cursorForEvent:(NSEvent *)theEvent;
 - (void)updateCursor;
 
+- (void)endEditingIfPageOutOfScope;
+
 @end
 
 #pragma mark -
@@ -541,6 +543,16 @@
     return editAnnotation != nil || editField != nil;
 }
 
+- (void)setDisplayMode:(PDFDisplayMode)mode {
+    [super setDisplayMode:mode];
+    [self endEditingIfPageOutOfScope];
+}
+
+- (void)setDisplaysAsBook:(BOOL)asBook {
+    [super setDisplaysAsBook:asBook];
+    [self endEditingIfPageOutOfScope];
+}
+
 - (NSRect)currentSelectionRect {
     if (toolMode == SKSelectToolMode)
         return selectionRect;
@@ -2162,25 +2174,9 @@
 }
 
 - (void)handlePageChangedNotification:(NSNotification *)notification {
+    [self endEditingIfPageOutOfScope];
     if ([self toolMode] == SKSelectToolMode && NSIsEmptyRect(selectionRect) == 
NO)
         [self setNeedsDisplay:YES];
-    if (editField) {
-        PDFDisplayMode displayMode = [self displayMode];
-        PDFPage *page = [activeAnnotation page];
-        PDFPage *currentPage = [self currentPage];
-        if ([page isEqual:currentPage] == NO && displayMode != 
kPDFDisplaySinglePageContinuous && displayMode != kPDFDisplayTwoUpContinuous) {
-            int currentPageIndex = [currentPage pageIndex];
-            int facingPageIndex = -1;
-            if (displayMode == kPDFDisplayTwoUp) {
-                if ([self displaysAsBook] == (BOOL)(currentPageIndex % 2))
-                    facingPageIndex = currentPageIndex + 1;
-                else
-                    facingPageIndex = currentPageIndex - 1;
-            }
-            if (facingPageIndex == -1 || facingPageIndex == (int)[[self 
document] pageCount] || [page isEqual:[[self document] 
pageAtIndex:facingPageIndex]] == NO)
-                [self endAnnotationEdit:self];
-        }
-    }
 }
 
 - (void)handleScaleChangedNotification:(NSNotification *)notification {
@@ -3805,6 +3801,26 @@
     [[self cursorForEvent:event] set];
 }
 
+- (void)endEditingIfPageOutOfScope {
+    if (editField) {
+        PDFDisplayMode displayMode = [self displayMode];
+        PDFPage *page = [activeAnnotation page];
+        PDFPage *currentPage = [self currentPage];
+        if ([page isEqual:currentPage] == NO && displayMode != 
kPDFDisplaySinglePageContinuous && displayMode != kPDFDisplayTwoUpContinuous) {
+            int currentPageIndex = [currentPage pageIndex];
+            int facingPageIndex = -1;
+            if (displayMode == kPDFDisplayTwoUp) {
+                if ([self displaysAsBook] == (BOOL)(currentPageIndex % 2))
+                    facingPageIndex = currentPageIndex + 1;
+                else
+                    facingPageIndex = currentPageIndex - 1;
+            }
+            if (facingPageIndex == -1 || facingPageIndex == (int)[[self 
document] pageCount] || [page isEqual:[[self document] 
pageAtIndex:facingPageIndex]] == NO)
+                [self endAnnotationEdit:self];
+        }
+    }
+}
+
 @end
 
 static inline int SKIndexOfRectAtYInOrderedRects(float y,  NSArray 
*rectValues, BOOL lower) 


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
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to