Revision: 3219
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3219&view=rev
Author:   hofman
Date:     2007-11-19 03:11:42 -0800 (Mon, 19 Nov 2007)

Log Message:
-----------
Go back to previous page after moving to marked page with same menu item. 
Useful as the page history is broken on Tiger.

Modified Paths:
--------------
    trunk/French.lproj/Localizable.strings
    trunk/German.lproj/Localizable.strings
    trunk/Italian.lproj/Localizable.strings
    trunk/SKMainWindowController.h
    trunk/SKMainWindowController.m
    trunk/Spanish.lproj/Localizable.strings

Modified: trunk/French.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/German.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/Italian.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2007-11-18 19:34:15 UTC (rev 3218)
+++ trunk/SKMainWindowController.h      2007-11-19 11:11:42 UTC (rev 3219)
@@ -194,6 +194,7 @@
     NSMutableArray              *pageLabels;
     
     unsigned int                markedPageIndex;
+    unsigned int                beforeMarkedPageIndex;
     
     NSMutableArray              *lastViewedPages;
     

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-11-18 19:34:15 UTC (rev 3218)
+++ trunk/SKMainWindowController.m      2007-11-19 11:11:42 UTC (rev 3219)
@@ -241,6 +241,7 @@
         findPaneState = SKSingularFindPaneState;
         temporaryAnnotations = CFSetCreateMutable(kCFAllocatorDefault, 0, 
&kCFTypeSetCallBacks);
         markedPageIndex = NSNotFound;
+        beforeMarkedPageIndex = NSNotFound;
         isAnimating = NO;
         updatingColor = NO;
         updatingFont = NO;
@@ -1511,10 +1512,15 @@
 
 - (IBAction)goToMarkedPage:(id)sender {
     PDFDocument *pdfDoc = [pdfView document];
-    if (markedPageIndex == NSNotFound || [pdfDoc isLocked] || [pdfDoc 
pageCount] == 0)
+    unsigned int currentPageIndex = [[pdfView currentPage] pageIndex];
+    if (markedPageIndex == NSNotFound || [pdfDoc isLocked] || [pdfDoc 
pageCount] == 0) {
         NSBeep();
-    else
+    } else if (beforeMarkedPageIndex != NSNotFound) {
+        [pdfView goToPage:[pdfDoc pageAtIndex:MIN(beforeMarkedPageIndex, 
[pdfDoc pageCount] - 1)]];
+    } else if (currentPageIndex != markedPageIndex) {
+        beforeMarkedPageIndex = currentPageIndex;
         [pdfView goToPage:[pdfDoc pageAtIndex:MIN(markedPageIndex, [pdfDoc 
pageCount] - 1)]];
+    }
 }
 
 - (IBAction)markPage:(id)sender {
@@ -3063,6 +3069,9 @@
     [self updateNoteSelection];
     [self updateThumbnailSelection];
     
+    if (beforeMarkedPageIndex != NSNotFound && [[pdfView currentPage] 
pageIndex] != markedPageIndex)
+        beforeMarkedPageIndex = NSNotFound;
+    
     [self updateLeftStatus];
 }
 
@@ -5121,7 +5130,13 @@
     } else if (action == @selector(doGoForward:)) {
         return [pdfView canGoForward];
     } else if (action == @selector(goToMarkedPage:)) {
-        return markedPageIndex != NSNotFound;
+        if (beforeMarkedPageIndex != NSNotFound) {
+            [menuItem setTitle:NSLocalizedString(@"Jump Back From Marked 
Page", @"Menu item title")];
+            return YES;
+        } else {
+            [menuItem setTitle:NSLocalizedString(@"Go To Marked Page", @"Menu 
item title")];
+            return markedPageIndex != NSNotFound && markedPageIndex != 
[[pdfView currentPage] pageIndex];
+        }
     } else if (action == @selector(doZoomIn:)) {
         return [self isPresentation] == NO && [pdfView canZoomIn];
     } else if (action == @selector(doZoomOut:)) {

Modified: trunk/Spanish.lproj/Localizable.strings
===================================================================
(Binary files differ)


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to