Revision: 15528
          http://sourceforge.net/p/skim-app/code/15528
Author:   hofman
Date:     2025-06-23 15:25:56 +0000 (Mon, 23 Jun 2025)
Log Message:
-----------
get recent document bookmark first

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2025-06-23 14:54:30 UTC (rev 15527)
+++ trunk/SKMainWindowController.m      2025-06-23 15:25:56 UTC (rev 15528)
@@ -468,19 +468,16 @@
         [window zoom:self];
     }
     
+    // Go to page?
+    SKDestination dest = [self destinationFromSetup:savedNormalSetup];
+    BOOL rememberPage = dest.pageIndex == NSNotFound && [sud 
boolForKey:SKRememberLastPageViewedKey];
+    BOOL rememberSnapshots = [sud boolForKey:SKRememberSnapshotsKey];
     SKBookmark *recentDoc = nil;
-    BOOL lookedForRecentDoc = [doc fileURL] != nil;
+    if ((rememberPage || rememberSnapshots) && [doc fileURL])
+        recentDoc = [[SKBookmarkController sharedBookmarkController] 
recentDocumentAtURL:[doc fileURL]];
     
-    // Go to page?
-    SKDestination dest = [self destinationFromSetup:savedNormalSetup];
-    if (dest.pageIndex == NSNotFound && [sud 
boolForKey:SKRememberLastPageViewedKey]) {
-        if (lookedForRecentDoc == NO) {
-            recentDoc = [[SKBookmarkController sharedBookmarkController] 
recentDocumentAtURL:[doc fileURL]];
-            lookedForRecentDoc = YES;
-        }
-        if (recentDoc)
-            dest.pageIndex = [recentDoc pageIndex];
-    }
+    if (rememberPage && recentDoc)
+        dest.pageIndex = [recentDoc pageIndex];
     if (dest.pageIndex != NSNotFound && [[pdfView document] pageCount] > 
dest.pageIndex) {
         if ([[pdfView document] isLocked]) {
             [self setDestination:dest inSetup:savedNormalSetup];
@@ -507,14 +504,8 @@
     
     // Open snapshots?
     NSArray *snapshotSetups = [savedNormalSetup objectForKey:SNAPSHOTS_KEY];
-    if ([sud boolForKey:SKRememberSnapshotsKey]) {
-        if (lookedForRecentDoc == NO) {
-            recentDoc = [[SKBookmarkController sharedBookmarkController] 
recentDocumentAtURL:[doc fileURL]];
-            lookedForRecentDoc = YES;
-        }
-        if (recentDoc)
-            snapshotSetups = mergedSnapshotSetups(snapshotSetups, [recentDoc 
snapshots]);
-    }
+    if (rememberSnapshots && recentDoc)
+        snapshotSetups = mergedSnapshotSetups(snapshotSetups, [recentDoc 
snapshots]);
     if ([snapshotSetups count]) {
         if ([[pdfView document] isLocked])
             [savedNormalSetup setObject:snapshotSetups forKey:SNAPSHOTS_KEY];

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to