Revision: 14487
          http://sourceforge.net/p/skim-app/code/14487
Author:   hofman
Date:     2024-09-26 21:11:06 +0000 (Thu, 26 Sep 2024)
Log Message:
-----------
animate preview window conditionally

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

Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m        2024-09-26 15:52:05 UTC 
(rev 14486)
+++ trunk/SKPresentationOptionsSheetController.m        2024-09-26 21:11:06 UTC 
(rev 14487)
@@ -334,28 +334,38 @@
     [previewWindow setFrame:rect display:NO];
     [previewWindow center];
     rect = [previewWindow frame];
-    NSRect sourceRect, targetRect;
-    if (separate) {
-        sourceRect = [tableView convertRectToScreen:[tableView 
frameOfCellAtColumn:0 row:idx]];
-        sourceRect = NSOffsetRect(NSInsetRect(sourceRect, -6.0, -6.0 - 0.5 * 
titleHeight), 0.0, 0.5 * titleHeight);
-        targetRect = [tableView convertRectToScreen:[tableView 
frameOfCellAtColumn:1 row:idx]];
-        targetRect = NSOffsetRect(NSInsetRect(targetRect, -6.0, -6.0 - 0.5 * 
titleHeight), 0.0, 0.5 * titleHeight);
-    } else {
-        targetRect = sourceRect = [[stylePopUpButton superview] 
convertRectToScreen:[[stylePopUpButton superview] bounds]];
+    NSRect sourceRect = rect, targetRect = rect;
+    if ([NSView shouldShowSlideAnimation]) {
+        if (separate) {
+            sourceRect = [tableView convertRectToScreen:[tableView 
frameOfCellAtColumn:0 row:idx]];
+            sourceRect = NSOffsetRect(NSInsetRect(sourceRect, -6.0, -6.0 - 0.5 
* titleHeight), 0.0, 0.5 * titleHeight);
+            targetRect = [tableView convertRectToScreen:[tableView 
frameOfCellAtColumn:1 row:idx]];
+            targetRect = NSOffsetRect(NSInsetRect(targetRect, -6.0, -6.0 - 0.5 
* titleHeight), 0.0, 0.5 * titleHeight);
+        } else {
+            targetRect = sourceRect = [[stylePopUpButton superview] 
convertRectToScreen:[[stylePopUpButton superview] bounds]];
+        }
     }
+    BOOL shouldAnimate = [NSView shouldShowFadeAnimation];
     [previewWindow setFrame:sourceRect display:NO];
-    [previewWindow setAlphaValue:0.0];
+    if (shouldAnimate)
+        [previewWindow setAlphaValue:0.0];
     [previewWindow makeKeyAndOrderFront:nil];
     [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
+        if (shouldAnimate == NO)
+            [context setDuration:0.0];
+        else
+            [[previewWindow animator] setAlphaValue:1.0];
         [[previewWindow animator] setFrame:rect display:YES animate:YES];
-        [[previewWindow animator] setAlphaValue:1.0];
     } completionHandler:^{
         DISPATCH_MAIN_AFTER_SEC(1.0, ^{
             [previewView goToNextPage:nil];
             DISPATCH_MAIN_AFTER_SEC(1.0 + [info duration], ^{
                 [NSAnimationContext runAnimationGroup:^(NSAnimationContext 
*context){
+                    if (shouldAnimate == NO)
+                        [context setDuration:0.0];
+                    else
+                        [[previewWindow animator] setAlphaValue:0.0];
                     [[previewWindow animator] setFrame:targetRect display:YES];
-                    [[previewWindow animator] setAlphaValue:0.0];
                 } completionHandler:^{
                     [previewWindow orderOut:nil];
                     [previewWindow setAlphaValue:1.0];

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