Revision: 5745
http://skim-app.svn.sourceforge.net/skim-app/?rev=5745&view=rev
Author: hofman
Date: 2009-09-12 13:01:20 +0000 (Sat, 12 Sep 2009)
Log Message:
-----------
Use animation delegate method to remove fullscreen window after the animation
finished. Also ensures that the main thread blocks long enough for the
animation to finish.
Modified Paths:
--------------
trunk/SKFullScreenWindow.h
trunk/SKFullScreenWindow.m
Modified: trunk/SKFullScreenWindow.h
===================================================================
--- trunk/SKFullScreenWindow.h 2009-09-11 18:06:58 UTC (rev 5744)
+++ trunk/SKFullScreenWindow.h 2009-09-12 13:01:20 UTC (rev 5745)
@@ -40,7 +40,9 @@
#import "SKMainWindow.h"
-...@interface SKFullScreenWindow : SKMainWindow
+...@interface SKFullScreenWindow : SKMainWindow {
+ BOOL animating;
+}
- (id)initWithScreen:(NSScreen *)screen;
Modified: trunk/SKFullScreenWindow.m
===================================================================
--- trunk/SKFullScreenWindow.m 2009-09-11 18:06:58 UTC (rev 5744)
+++ trunk/SKFullScreenWindow.m 2009-09-12 13:01:20 UTC (rev 5745)
@@ -52,6 +52,7 @@
[self setAcceptsMouseMovedEvents:YES];
[self setBackgroundColor:[NSColor blackColor]];
[self
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
+ [self setAnimations:[NSDictionary
dictionaryWithObjectsAndKeys:[CABasicAnimation animation], @"alphaValue", nil]];
}
return self;
}
@@ -114,18 +115,22 @@
- (void)fadeOutBlocking:(BOOL)block {
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.7];
+ animating = block;
+ [[self animationForKey:@"alphaValue"] setDelegate:self];
[[self animator] setAlphaValue:0.0];
[NSAnimationContext endGrouping];
- if (block) {
- [[NSRunLoop currentRunLoop] runUntilDate:[NSDate
dateWithTimeIntervalSinceNow:0.7]];
- [self orderOut:nil];
- } else {
- [self performSelector:@selector(orderOut:) withObject:nil
afterDelay:0.7];
- }
+ while (animating)
+ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantPast]];
}
- (void)fadeOut {
return [self fadeOutBlocking:NO];
}
+- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag {
+ animating = NO;
+ [self orderOut:nil];
+ [theAnimation setDelegate:nil];
+}
+
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit