Revision: 5385
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5385&view=rev
Author:   hofman
Date:     2009-05-19 15:15:06 +0000 (Tue, 19 May 2009)

Log Message:
-----------
use animator for fading windows if available

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

Modified: trunk/SKAnimatedBorderlessWindow.m
===================================================================
--- trunk/SKAnimatedBorderlessWindow.m  2009-05-19 07:58:44 UTC (rev 5384)
+++ trunk/SKAnimatedBorderlessWindow.m  2009-05-19 15:15:06 UTC (rev 5385)
@@ -90,6 +90,7 @@
 
 - (void)cancelDelayedAnimations {
     [[self class] cancelPreviousPerformRequestsWithTarget:self 
selector:@selector(fadeOut) object:nil];
+    [[self class] cancelPreviousPerformRequestsWithTarget:self 
selector:@selector(orderOut:) object:nil];
 }
 
 - (void)fadeOutAfterTimeout {
@@ -125,32 +126,48 @@
     [self setAlphaValue:[self defaultAlphaValue]];
     [self willClose];
     
-    NSDictionary *fadeOutDict = [[NSDictionary alloc] 
initWithObjectsAndKeys:self, NSViewAnimationTargetKey, 
NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil];
-    
-    animation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray 
arrayWithObjects:fadeOutDict, nil]];
-    [fadeOutDict release];
-    
-    [animation setAnimationBlockingMode:NSAnimationNonblocking];
-    [animation setDuration:[self fadeOutDuration]];
-    [animation setDelegate:self];
-    [animation startAnimation];
+    if ([self respondsToSelector:@selector(animator)]) {
+        [NSAnimationContext beginGrouping];
+        [[NSAnimationContext currentContext] setDuration:[self 
fadeOutDuration]];
+        [[self animator] setAlphaValue:0.0];
+        [NSAnimationContext endGrouping];
+        [self performSelector:@selector(orderOut:) withObject:nil 
afterDelay:[self fadeOutDuration]];
+    } else {
+        NSDictionary *fadeOutDict = [[NSDictionary alloc] 
initWithObjectsAndKeys:self, NSViewAnimationTargetKey, 
NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil];
+        
+        animation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray 
arrayWithObjects:fadeOutDict, nil]];
+        [fadeOutDict release];
+        
+        [animation setAnimationBlockingMode:NSAnimationNonblocking];
+        [animation setDuration:[self fadeOutDuration]];
+        [animation setDelegate:self];
+        [animation startAnimation];
+    }
 }
 
 - (void)fadeIn {
     [self stopAnimation];
     
-    NSDictionary *fadeInDict = [[NSDictionary alloc] 
initWithObjectsAndKeys:self, NSViewAnimationTargetKey, 
NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil];
-    
-    animation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray 
arrayWithObjects:fadeInDict, nil]];
-    [fadeInDict release];
-    
-    [self setAlphaValue:0.0];
+    if ([self isVisible] == NO)
+        [self setAlphaValue:0.0];
     [super orderFront:self];
     
-    [animation setAnimationBlockingMode:NSAnimationNonblocking];
-    [animation setDuration:[self fadeInDuration]];
-    [animation setDelegate:self];
-    [animation startAnimation];
+    if ([self respondsToSelector:@selector(animator)]) {
+        [NSAnimationContext beginGrouping];
+        [[NSAnimationContext currentContext] setDuration:[self 
fadeInDuration]];
+        [[self animator] setAlphaValue:[self defaultAlphaValue]];
+        [NSAnimationContext endGrouping];
+    }else {
+        NSDictionary *fadeInDict = [[NSDictionary alloc] 
initWithObjectsAndKeys:self, NSViewAnimationTargetKey, 
NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil];
+        
+        animation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray 
arrayWithObjects:fadeInDict, nil]];
+        [fadeInDict release];
+        
+        [animation setAnimationBlockingMode:NSAnimationNonblocking];
+        [animation setDuration:[self fadeInDuration]];
+        [animation setDelegate:self];
+        [animation startAnimation];
+    }
     [self fadeOutAfterTimeout];
 }
 


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

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to