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

Log Message:
-----------
Combine code.

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-11-19 15:49:24 UTC (rev 3223)
+++ trunk/SKMainWindowController.m      2007-11-19 16:40:42 UTC (rev 3224)
@@ -2893,16 +2893,14 @@
 
 #pragma mark Tiger history fixes
 
-- (void)goToDestination:(PDFDestination *)destination {
-    PDFDestination *dest = [pdfView currentDestination];
-    [pdfView goToDestination:destination];
+- (void)registerDestinationHistory:(PDFDestination *)destination {
     if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_4) {
         @try {
             NSMutableArray *destinationHistory = [pdfView 
valueForKeyPath:@"pdfPriv.destinationHistory"];
             int historyIndex = [[pdfView 
valueForKeyPath:@"pdfPriv.historyIndex"] intValue];
             if (historyIndex < (int)[destinationHistory count])
                 [destinationHistory 
removeObjectsInRange:NSMakeRange(historyIndex, [destinationHistory count] - 
historyIndex)];
-            [destinationHistory addObject:dest];
+            [destinationHistory addObject:destination];
             [pdfView setValue:[NSNumber numberWithInt:++historyIndex] 
forKeyPath:@"pdfPriv.historyIndex"];
             [[NSNotificationCenter defaultCenter] 
postNotificationName:PDFViewChangedHistoryNotification object:pdfView];
         }
@@ -2910,21 +2908,16 @@
     }
 }
 
+- (void)goToDestination:(PDFDestination *)destination {
+    PDFDestination *dest = [pdfView currentDestination];
+    [pdfView goToDestination:destination];
+    [self registerDestinationHistory:dest];
+}
+
 - (void)goToPage:(PDFPage *)page {
     PDFDestination *dest = [pdfView currentDestination];
     [pdfView goToPage:page];
-    if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_4) {
-        @try {
-            NSMutableArray *destinationHistory = [pdfView 
valueForKeyPath:@"pdfPriv.destinationHistory"];
-            int historyIndex = [[pdfView 
valueForKeyPath:@"pdfPriv.historyIndex"] intValue];
-            if (historyIndex < (int)[destinationHistory count])
-                [destinationHistory 
removeObjectsInRange:NSMakeRange(historyIndex, [destinationHistory count] - 
historyIndex)];
-            [destinationHistory addObject:dest];
-            [pdfView setValue:[NSNumber numberWithInt:++historyIndex] 
forKeyPath:@"pdfPriv.historyIndex"];
-            [[NSNotificationCenter defaultCenter] 
postNotificationName:PDFViewChangedHistoryNotification object:pdfView];
-        }
-        @catch (id exception) {}
-    }
+    [self registerDestinationHistory:dest];
 }
 
 #pragma mark Sub- and note- windows


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
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to