Revision: 14515
          http://sourceforge.net/p/skim-app/code/14515
Author:   hofman
Date:     2024-10-04 16:31:31 +0000 (Fri, 04 Oct 2024)
Log Message:
-----------
Pass index and forward flag instead of from and to index

Modified Paths:
--------------
    trunk/SKPresentationView.m
    trunk/SKTransitionController.h
    trunk/SKTransitionController.m

Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m  2024-10-04 14:23:21 UTC (rev 14514)
+++ trunk/SKPresentationView.m  2024-10-04 16:31:31 UTC (rev 14515)
@@ -186,11 +186,11 @@
     return s1 == nil || s2 == nil || [s1 isEqualToString:s2];
 }
 
-- (BOOL)animateTransitionFromIndex:(NSUInteger)idx toPage:(PDFPage *)toPage 
atIndex:(NSUInteger)toIdx {
+- (BOOL)animateTransitionAtIndex:(NSUInteger)idx forward:(BOOL)forward 
toPage:(PDFPage *)toPage {
     if ([transitionController pageTransitions] == nil &&
         ([[transitionController transition] style] == SKNoTransition || 
equalStrings([page label], [toPage label])))
         return NO;
-    [transitionController animateForRect:[self pageRect] from:idx to:toIdx 
change:^{
+    [transitionController animateForRect:[self pageRect] atIndex:idx 
forward:forward change:^{
         [self setPage:toPage];
         return [self pageRect];
     }];
@@ -202,7 +202,7 @@
     NSUInteger idx = [page pageIndex];
     if (idx + 1 < [pdfDoc pageCount]) {
         PDFPage *toPage = [pdfDoc pageAtIndex:idx + 1];
-        if ([self window] == nil || NO == [self animateTransitionFromIndex:idx 
toPage:toPage atIndex:idx + 1])
+        if ([self window] == nil || NO == [self animateTransitionAtIndex:idx 
forward:YES toPage:toPage])
             [self setPage:toPage];
     }
 }
@@ -212,7 +212,7 @@
     NSUInteger idx = [page pageIndex];
     if (idx > 0) {
         PDFPage *toPage = [pdfDoc pageAtIndex:idx - 1];
-        if ([self window] == nil || NO == [self animateTransitionFromIndex:idx 
toPage:toPage atIndex:idx - 1])
+        if ([self window] == nil || NO == [self animateTransitionAtIndex:idx - 
1 forward:NO toPage:toPage])
             [self setPage:toPage];
     }
 }

Modified: trunk/SKTransitionController.h
===================================================================
--- trunk/SKTransitionController.h      2024-10-04 14:23:21 UTC (rev 14514)
+++ trunk/SKTransitionController.h      2024-10-04 16:31:31 UTC (rev 14515)
@@ -58,7 +58,7 @@
 
 @property (nonatomic) BOOL shouldScale;
 
-- (void)animateForRect:(NSRect)rect from:(NSUInteger)fromIndex 
to:(NSUInteger)toIndex change:(NSRect (^)(void))change;
+- (void)animateForRect:(NSRect)rect atIndex:(NSUInteger)anIndex 
forward:(BOOL)forward change:(NSRect (^)(void))change;
 
 @end
 

Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m      2024-10-04 14:23:21 UTC (rev 14514)
+++ trunk/SKTransitionController.m      2024-10-04 16:31:31 UTC (rev 14515)
@@ -171,7 +171,7 @@
     return image;
 }
 
-- (void)animateForRect:(NSRect)rect from:(NSUInteger)fromIndex 
to:(NSUInteger)toIndex change:(NSRect (^)(void))change {
+- (void)animateForRect:(NSRect)rect atIndex:(NSUInteger)idx 
forward:(BOOL)forward change:(NSRect (^)(void))change {
     if (animating) {
         change();
         return;
@@ -178,8 +178,7 @@
     }
     
     SKTransitionInfo *currentTransition = transition;
-    NSUInteger idx = MIN(fromIndex, toIndex);
-    if (fromIndex != NSNotFound && toIndex != NSNotFound && idx < 
[pageTransitions count])
+    if (idx < [pageTransitions count])
         currentTransition = [[SKTransitionInfo alloc] 
initWithProperties:[pageTransitions objectAtIndex:idx]];
     
     if ([currentTransition style] == SKNoTransition) {
@@ -206,7 +205,7 @@
                                                                rect:cgRect
                                                              extent:extent
                                                               scale:scale
-                                                            forward:toIndex >= 
fromIndex
+                                                            forward:forward
                                                        
initialImage:initialImage
                                                          
finalImage:finalImage];
         

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to