Revision: 13365
          http://sourceforge.net/p/skim-app/code/13365
Author:   hofman
Date:     2023-03-15 15:50:39 +0000 (Wed, 15 Mar 2023)
Log Message:
-----------
Add gap animation for tables with reduced motion. Reorder conditionals.

Modified Paths:
--------------
    trunk/SKAnimatedBorderlessWindow.m
    trunk/SKBookmarkController.m
    trunk/SKDownloadController.m
    trunk/SKFullScreenWindow.m
    trunk/SKMainWindowController.m
    trunk/SKPreferenceController.m

Modified: trunk/SKAnimatedBorderlessWindow.m
===================================================================
--- trunk/SKAnimatedBorderlessWindow.m  2023-03-15 15:43:47 UTC (rev 13364)
+++ trunk/SKAnimatedBorderlessWindow.m  2023-03-15 15:50:39 UTC (rev 13365)
@@ -124,9 +124,7 @@
     
     [self setAlphaValue:[self defaultAlphaValue]];
     
-    if ([NSView shouldShowFadeAnimation] == NO) {
-        [self remove];
-    } else {
+    if ([NSView shouldShowFadeAnimation]) {
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
                 [context setDuration:[self fadeOutDuration]];
                 [[self animator] setAlphaValue:0.0];
@@ -134,6 +132,8 @@
             completionHandler:nil];
         // don't put this in the completionHandler, because we want to be able 
to stop this using stopAnimation
         [self performSelector:@selector(remove) withObject:nil 
afterDelay:[self fadeOutDuration]];
+    } else {
+        [self remove];
     }
 }
 
@@ -144,9 +144,7 @@
         [self setAlphaValue:0.0];
     [super orderFront:self];
     
-    if ([NSView shouldShowFadeAnimation] == NO) {
-        [self setAlphaValue:[self defaultAlphaValue]];
-    } else {
+    if ([NSView shouldShowFadeAnimation]) {
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
                 [context setDuration:[self fadeInDuration]];
                 [[self animator] setAlphaValue:[self defaultAlphaValue]];
@@ -155,6 +153,8 @@
                 if ([self hasShadow])
                     [self invalidateShadow];
             }];
+    } else {
+        [self setAlphaValue:[self defaultAlphaValue]];
     }
     [self fadeOutAfterTimeout];
 }

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2023-03-15 15:43:47 UTC (rev 13364)
+++ trunk/SKBookmarkController.m        2023-03-15 15:50:39 UTC (rev 13365)
@@ -344,7 +344,7 @@
     if (animate == NO || [self isWindowLoaded] == NO || [[self window] 
isVisible] == NO || [NSView shouldShowFadeAnimation] == NO)
         options = NSTableViewAnimationEffectNone;
     else if ([NSView shouldShowSlideAnimation] == NO)
-        options = NSTableViewAnimationEffectFade;
+        options = NSTableViewAnimationEffectGap | 
NSTableViewAnimationEffectFade;
     if (needsBeginUpdates) {
         [outlineView beginUpdates];
         needsBeginUpdates = NO;
@@ -358,7 +358,7 @@
     if (animate == NO || [self isWindowLoaded] == NO || [[self window] 
isVisible] == NO || [NSView shouldShowFadeAnimation] == NO)
         options = NSTableViewAnimationEffectNone;
     else if ([NSView shouldShowSlideAnimation] == NO)
-        options = NSTableViewAnimationEffectFade;
+        options = NSTableViewAnimationEffectGap | 
NSTableViewAnimationEffectFade;
     if (needsBeginUpdates) {
         [outlineView beginUpdates];
         needsBeginUpdates = NO;

Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m        2023-03-15 15:43:47 UTC (rev 13364)
+++ trunk/SKDownloadController.m        2023-03-15 15:50:39 UTC (rev 13365)
@@ -265,7 +265,7 @@
     if ([self isWindowLoaded] == NO || [[self window] isVisible] == NO || 
[NSView shouldShowFadeAnimation] == NO)
         options = NSTableViewAnimationEffectNone;
     else if ([NSView shouldShowSlideAnimation] == NO)
-        options = NSTableViewAnimationEffectFade;
+        options = NSTableViewAnimationEffectGap | 
NSTableViewAnimationEffectFade;
     [tableView beginUpdates];
     [tableView insertRowsAtIndexes:[NSIndexSet indexSetWithIndex:row] 
withAnimation:options];
     [self insertObject:download inDownloadsAtIndex:row];
@@ -277,7 +277,7 @@
     if ([self isWindowLoaded] == NO || [[self window] isVisible] == NO || 
[NSView shouldShowFadeAnimation] == NO)
         options = NSTableViewAnimationEffectNone;
     else if ([NSView shouldShowSlideAnimation] == NO)
-        options = NSTableViewAnimationEffectFade;
+        options = NSTableViewAnimationEffectGap | 
NSTableViewAnimationEffectFade;
     [tableView beginUpdates];
     [tableView removeRowsAtIndexes:indexes withAnimation:options];
     [[self mutableArrayValueForKey:DOWNLOADS_KEY] 
removeObjectsAtIndexes:indexes];

Modified: trunk/SKFullScreenWindow.m
===================================================================
--- trunk/SKFullScreenWindow.m  2023-03-15 15:43:47 UTC (rev 13364)
+++ trunk/SKFullScreenWindow.m  2023-03-15 15:50:39 UTC (rev 13365)
@@ -67,9 +67,7 @@
 - (BOOL)canBecomeMainWindow { return isMain; }
 
 - (void)fadeOutBlocking:(BOOL)blocking {
-    if ([NSView shouldShowFadeAnimation] == NO) {
-        [self orderOut:nil];
-    } else {
+    if ([NSView shouldShowFadeAnimation]) {
         __block BOOL wait = blocking;
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
             [context setDuration:DURATION];
@@ -81,13 +79,13 @@
         }];
         NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
         while (wait && [runLoop runMode:NSDefaultRunLoopMode 
beforeDate:[NSDate distantFuture]]);
+    } else {
+        [self orderOut:nil];
     }
 }
 
 - (void)fadeInBlocking:(BOOL)blocking {
-    if ([NSView shouldShowFadeAnimation] == NO) {
-        [self orderFront:nil];
-    } else {
+    if ([NSView shouldShowFadeAnimation]) {
         __block BOOL wait = blocking;
         [self setAlphaValue:0.0];
         [self orderFront:nil];
@@ -99,6 +97,8 @@
         }];
         NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
         while (wait && [runLoop runMode:NSDefaultRunLoopMode 
beforeDate:[NSDate distantFuture]]);
+    } else {
+        [self orderFront:nil];
     }
 }
 

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2023-03-15 15:43:47 UTC (rev 13364)
+++ trunk/SKMainWindowController.m      2023-03-15 15:50:39 UTC (rev 13365)
@@ -2362,7 +2362,7 @@
                 if ([self rightSidePaneIsOpen] == NO || [self 
rightSidePaneState] != SKSidePaneStateSnapshot || [NSView 
shouldShowFadeAnimation] == NO)
                     options = NSTableViewAnimationEffectNone;
                 else if ([NSView shouldShowSlideAnimation] == NO)
-                    options = NSTableViewAnimationEffectFade;
+                    options = NSTableViewAnimationEffectGap | 
NSTableViewAnimationEffectFade;
                 [rightSideController.snapshotTableView 
insertRowsAtIndexes:[NSIndexSet indexSetWithIndex:row] withAnimation:options];
             }
             [rightSideController.snapshotTableView endUpdates];
@@ -2383,7 +2383,7 @@
             if ([self rightSidePaneIsOpen] == NO || [self rightSidePaneState] 
!= SKSidePaneStateSnapshot || [NSView shouldShowFadeAnimation] == NO)
                 options = NSTableViewAnimationEffectNone;
             else if ([NSView shouldShowSlideAnimation] == NO)
-                options = NSTableViewAnimationEffectFade;
+                options = NSTableViewAnimationEffectGap | 
NSTableViewAnimationEffectFade;
             [rightSideController.snapshotTableView 
removeRowsAtIndexes:[NSIndexSet indexSetWithIndex:row] withAnimation:options];
         }
         [[self mutableArrayValueForKey:SNAPSHOTS_KEY] removeObject:controller];

Modified: trunk/SKPreferenceController.m
===================================================================
--- trunk/SKPreferenceController.m      2023-03-15 15:43:47 UTC (rev 13364)
+++ trunk/SKPreferenceController.m      2023-03-15 15:50:39 UTC (rev 13365)
@@ -157,11 +157,7 @@
             [NSLayoutConstraint constraintWithItem:view 
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual 
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0 
constant:0.0]];
         [[constraints lastObject] setPriority:NSLayoutPriorityDefaultLow];
         
-        if ([NSView shouldShowFadeAnimation] == NO) {
-            [contentView replaceSubview:oldView with:view];
-            [NSLayoutConstraint activateConstraints:constraints];
-            [window setFrame:frame display:YES];
-        } else {
+        if ([NSView shouldShowFadeAnimation]) {
             NSTimeInterval duration = fmax(0.25, [window 
animationResizeTime:frame]);
             [contentView displayIfNeeded];
             if ([NSView shouldShowSlideAnimation] == NO)
@@ -174,6 +170,10 @@
                         [[window animator] setFrame:frame display:YES];
                 }
                 completionHandler:^{}];
+        } else {
+            [contentView replaceSubview:oldView with:view];
+            [NSLayoutConstraint activateConstraints:constraints];
+            [window setFrame:frame display:YES];
         }
     }
 }

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