Revision: 13359
http://sourceforge.net/p/skim-app/code/13359
Author: hofman
Date: 2023-03-14 17:50:26 +0000 (Tue, 14 Mar 2023)
Log Message:
-----------
use fade animation for table rows and side window with reduced motion
Modified Paths:
--------------
trunk/SKBookmarkController.m
trunk/SKDownloadController.m
trunk/SKMainWindowController.m
trunk/SKSideWindow.m
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2023-03-14 17:37:21 UTC (rev 13358)
+++ trunk/SKBookmarkController.m 2023-03-14 17:50:26 UTC (rev 13359)
@@ -341,8 +341,10 @@
- (void)insertBookmarks:(NSArray *)newBookmarks atIndexes:(NSIndexSet
*)indexes ofBookmark:(SKBookmark *)parent animate:(BOOL)animate {
NSTableViewAnimationOptions options = NSTableViewAnimationEffectGap |
NSTableViewAnimationSlideDown;
- if (animate == NO || [self isWindowLoaded] == NO || [[self window]
isVisible] == NO || [NSView shouldShowSlideAnimation] == NO)
+ if (animate == NO || [self isWindowLoaded] == NO || [[self window]
isVisible] == NO || [NSView shouldShowFadeAnimation] == NO)
options = NSTableViewAnimationEffectNone;
+ else if ([NSView shouldShowSlideAnimation] == NO)
+ options = NSTableViewAnimationEffectFade;
if (needsBeginUpdates) {
[outlineView beginUpdates];
needsBeginUpdates = NO;
@@ -353,8 +355,10 @@
- (void)removeBookmarksAtIndexes:(NSIndexSet *)indexes ofBookmark:(SKBookmark
*)parent animate:(BOOL)animate {
NSTableViewAnimationOptions options = NSTableViewAnimationEffectGap |
NSTableViewAnimationSlideUp;
- if (animate == NO || [self isWindowLoaded] == NO || [[self window]
isVisible] == NO || [NSView shouldShowSlideAnimation] == NO)
+ if (animate == NO || [self isWindowLoaded] == NO || [[self window]
isVisible] == NO || [NSView shouldShowFadeAnimation] == NO)
options = NSTableViewAnimationEffectNone;
+ else if ([NSView shouldShowSlideAnimation] == NO)
+ options = NSTableViewAnimationEffectFade;
if (needsBeginUpdates) {
[outlineView beginUpdates];
needsBeginUpdates = NO;
@@ -468,7 +472,7 @@
[self getInsertionFolder:&item childIndex:&idx];
[self insertBookmark:folder atIndex:idx ofBookmark:item animate:YES];
- CGFloat delay = [NSView shouldShowSlideAnimation] ? 0.25 : 0.0;
+ CGFloat delay = [NSView shouldShowFadeAnimation] ? 0.25 : 0.0;
DISPATCH_MAIN_AFTER_SEC(delay, ^{
NSInteger row = [outlineView rowForItem:folder];
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row]
byExtendingSelection:NO];
Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m 2023-03-14 17:37:21 UTC (rev 13358)
+++ trunk/SKDownloadController.m 2023-03-14 17:50:26 UTC (rev 13359)
@@ -262,8 +262,10 @@
- (void)addObjectToDownloads:(SKDownload *)download {
NSInteger row = [self countOfDownloads];
NSTableViewAnimationOptions options = NSTableViewAnimationEffectGap |
NSTableViewAnimationSlideDown;
- if ([self isWindowLoaded] == NO || [[self window] isVisible] == NO ||
[NSView shouldShowSlideAnimation] == NO)
+ if ([self isWindowLoaded] == NO || [[self window] isVisible] == NO ||
[NSView shouldShowFadeAnimation] == NO)
options = NSTableViewAnimationEffectNone;
+ else if ([NSView shouldShowSlideAnimation] == NO)
+ options = NSTableViewAnimationEffectFade;
[tableView beginUpdates];
[tableView insertRowsAtIndexes:[NSIndexSet indexSetWithIndex:row]
withAnimation:options];
[self insertObject:download inDownloadsAtIndex:row];
@@ -272,8 +274,10 @@
- (void)removeObjectsFromDownloadsAtIndexes:(NSIndexSet *)indexes {
NSTableViewAnimationOptions options = NSTableViewAnimationEffectGap |
NSTableViewAnimationSlideUp;
- if ([self isWindowLoaded] == NO || [[self window] isVisible] == NO ||
[NSView shouldShowSlideAnimation] == NO)
+ if ([self isWindowLoaded] == NO || [[self window] isVisible] == NO ||
[NSView shouldShowFadeAnimation] == NO)
options = NSTableViewAnimationEffectNone;
+ else if ([NSView shouldShowSlideAnimation] == NO)
+ options = NSTableViewAnimationEffectFade;
[tableView beginUpdates];
[tableView removeRowsAtIndexes:indexes withAnimation:options];
[[self mutableArrayValueForKey:DOWNLOADS_KEY]
removeObjectsAtIndexes:indexes];
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2023-03-14 17:37:21 UTC (rev 13358)
+++ trunk/SKMainWindowController.m 2023-03-14 17:50:26 UTC (rev 13359)
@@ -2359,8 +2359,10 @@
NSUInteger row = [[rightSideController.snapshotArrayController
arrangedObjects] indexOfObject:controller];
if (row != NSNotFound) {
NSTableViewAnimationOptions options =
NSTableViewAnimationEffectGap | NSTableViewAnimationSlideDown;
- if ([self rightSidePaneIsOpen] == NO || [self
rightSidePaneState] != SKSidePaneStateSnapshot || [NSView
shouldShowSlideAnimation] == NO)
+ if ([self rightSidePaneIsOpen] == NO || [self
rightSidePaneState] != SKSidePaneStateSnapshot || [NSView
shouldShowFadeAnimation] == NO)
options = NSTableViewAnimationEffectNone;
+ else if ([NSView shouldShowSlideAnimation] == NO)
+ options = NSTableViewAnimationEffectFade;
[rightSideController.snapshotTableView
insertRowsAtIndexes:[NSIndexSet indexSetWithIndex:row] withAnimation:options];
}
[rightSideController.snapshotTableView endUpdates];
@@ -2378,8 +2380,10 @@
NSUInteger row = [[rightSideController.snapshotArrayController
arrangedObjects] indexOfObject:controller];
if (row != NSNotFound) {
NSTableViewAnimationOptions options =
NSTableViewAnimationEffectGap | NSTableViewAnimationSlideUp;
- if ([self rightSidePaneIsOpen] == NO || [self rightSidePaneState]
!= SKSidePaneStateSnapshot || [NSView shouldShowSlideAnimation] == NO)
+ if ([self rightSidePaneIsOpen] == NO || [self rightSidePaneState]
!= SKSidePaneStateSnapshot || [NSView shouldShowFadeAnimation] == NO)
options = NSTableViewAnimationEffectNone;
+ else if ([NSView shouldShowSlideAnimation] == NO)
+ options = NSTableViewAnimationEffectFade;
[rightSideController.snapshotTableView
removeRowsAtIndexes:[NSIndexSet indexSetWithIndex:row] withAnimation:options];
}
[[self mutableArrayValueForKey:SNAPSHOTS_KEY] removeObject:controller];
Modified: trunk/SKSideWindow.m
===================================================================
--- trunk/SKSideWindow.m 2023-03-14 17:37:21 UTC (rev 13358)
+++ trunk/SKSideWindow.m 2023-03-14 17:50:26 UTC (rev 13359)
@@ -127,13 +127,13 @@
[window addChildWindow:self ordered:NSWindowAbove];
frame.size.width = NSWidth([mainContentView frame]) + CONTENT_INSET;
- if ([NSView shouldShowSlideAnimation]) {
+ if ([NSView shouldShowFadeAnimation] == NO) {
[self setFrame:frame display:YES];
if ([window isKeyWindow])
[self makeKeyAndOrderFront:nil];
else
[self orderFront:nil];
- } else {
+ } else if ([NSView shouldShowSlideAnimation] == NO) {
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
[[self animator] setFrame:frame display:YES];
}
@@ -143,6 +143,19 @@
else
[self orderFront:nil];
}];
+ } else {
+ CGFloat alpha = [self alphaValue];
+ [self setAlphaValue:0.0];
+ [self setFrame:frame display:YES];
+ [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
+ [[self animator] setAlphaValue:alpha];
+ }
+ completionHandler:^{
+ if ([window isKeyWindow])
+ [self makeKeyAndOrderFront:nil];
+ else
+ [self orderFront:nil];
+ }];
}
}
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