Revision: 5763
http://skim-app.svn.sourceforge.net/skim-app/?rev=5763&view=rev
Author: hofman
Date: 2009-09-19 17:41:58 +0000 (Sat, 19 Sep 2009)
Log Message:
-----------
fade out pdfview from fullscreen window instead of animating the whole window
in two stages
Modified Paths:
--------------
trunk/SKFullScreenWindow.h
trunk/SKFullScreenWindow.m
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
Modified: trunk/SKFullScreenWindow.h
===================================================================
--- trunk/SKFullScreenWindow.h 2009-09-19 12:41:34 UTC (rev 5762)
+++ trunk/SKFullScreenWindow.h 2009-09-19 17:41:58 UTC (rev 5763)
@@ -49,7 +49,6 @@
- (NSView *)mainView;
- (void)setMainView:(NSView *)view;
-- (void)fadeOutBlocking:(BOOL)block;
- (void)fadeOut;
@end
Modified: trunk/SKFullScreenWindow.m
===================================================================
--- trunk/SKFullScreenWindow.m 2009-09-19 12:41:34 UTC (rev 5762)
+++ trunk/SKFullScreenWindow.m 2009-09-19 17:41:58 UTC (rev 5763)
@@ -52,7 +52,10 @@
[self setAcceptsMouseMovedEvents:YES];
[self setBackgroundColor:[NSColor blackColor]];
[self
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
- [self setAnimations:[NSDictionary
dictionaryWithObjectsAndKeys:[CABasicAnimation animation], @"alphaValue", nil]];
+ CAAnimation *animation = [CABasicAnimation animation];
+ [animation setDuration:0.5];
+ [animation setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
+ [self setAnimations:[NSDictionary
dictionaryWithObjectsAndKeys:animation, @"alphaValue", nil]];
}
return self;
}
@@ -112,23 +115,11 @@
[self setAlphaValue:1.0];
}
-- (void)fadeOutBlocking:(BOOL)block {
- [NSAnimationContext beginGrouping];
- [[NSAnimationContext currentContext] setDuration:0.7];
- animating = block;
- CAAnimation *animation = [self animationForKey:@"alphaValue"];
- [animation setTimingFunction:[CAMediaTimingFunction functionWithName:block
? kCAMediaTimingFunctionEaseIn : kCAMediaTimingFunctionEaseInEaseOut]];
- [animation setDelegate:self];
+- (void)fadeOut {
[[self animator] setAlphaValue:0.0];
- [NSAnimationContext endGrouping];
- while (animating)
- [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantPast]];
+ [self performSelector:@selector(orderOut:) withObject:nil afterDelay:0.7];
}
-- (void)fadeOut {
- return [self fadeOutBlocking:NO];
-}
-
- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag {
animating = NO;
[self orderOut:nil];
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2009-09-19 12:41:34 UTC (rev 5762)
+++ trunk/SKMainWindowController.h 2009-09-19 17:41:58 UTC (rev 5763)
@@ -236,6 +236,7 @@
unsigned int updatingOutlineSelection:1;
unsigned int updatingThumbnailSelection:1;
unsigned int isAnimating:1;
+ unsigned int isFadingOut:1;
unsigned int findPanelFind:1;
unsigned int caseInsensitiveSearch:1;
unsigned int wholeWordSearch:1;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2009-09-19 12:41:34 UTC (rev 5762)
+++ trunk/SKMainWindowController.m 2009-09-19 17:41:58 UTC (rev 5763)
@@ -1562,6 +1562,10 @@
[pdfView setInteractionMode:SKPresentationMode screen:screen];
}
+- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag {
+ mwcFlags.isFadingOut = 0;
+}
+
- (IBAction)exitFullScreen:(id)sender {
if ([self isFullScreen] == NO && [self isPresentation] == NO)
return;
@@ -1572,13 +1576,25 @@
if ([[fullScreenWindow firstResponder] isDescendantOf:pdfView])
[fullScreenWindow makeFirstResponder:nil];
- SKFullScreenWindow *bgWindow = [[SKFullScreenWindow alloc]
initWithScreen:[fullScreenWindow screen]];
- [bgWindow setBackgroundColor:[fullScreenWindow backgroundColor]];
- [bgWindow setLevel:[fullScreenWindow level]];
- [bgWindow orderWindow:NSWindowBelow relativeTo:[fullScreenWindow
windowNumber]];
- [fullScreenWindow setDelegate:nil];
- [fullScreenWindow fadeOutBlocking:YES];
+ NSView *view = [self isFullScreen] ? (NSView *)pdfSplitView : (NSView
*)pdfView;
+ NSView *contentView = [view superview];
+ NSDate *limitDate = [NSDate dateWithTimeIntervalSinceNow:3.5];
+ CAAnimation *animation = [CATransition animation];
+ [animation setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseIn]];
+ [animation setDuration:0.5];
+ [animation setDelegate:self];
+ [contentView setAnimations:[NSDictionary dictionaryWithObject:animation
forKey:@"subviews"]];
+ [contentView setWantsLayer:YES];
+ [contentView displayIfNeeded];
+ mwcFlags.isFadingOut = 1;
+ [[view animator] removeFromSuperview];
+ while (mwcFlags.isFadingOut && [limitDate compare:[NSDate date]] !=
NSOrderedAscending)
+ [[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantPast]];
+ mwcFlags.isFadingOut = 0;
+ [contentView setWantsLayer:NO];
+ [contentView setAnimations:nil];
+
[pdfView setInteractionMode:SKNormalMode screen:[[self window] screen]];
// this should be done before exitPresentationMode to get a smooth
transition
if ([self isFullScreen]) {
@@ -1599,10 +1615,6 @@
else
[self applyPDFSettings:savedNormalSetup];
- [fullScreenWindow orderWindow:NSWindowBelow relativeTo:[bgWindow
windowNumber]];
- [fullScreenWindow displayIfNeeded];
- [bgWindow orderOut:nil];
- [bgWindow release];
[fullScreenWindow setLevel:NSPopUpMenuWindowLevel];
SetSystemUIMode(kUIModeNormal, 0);
@@ -1619,7 +1631,7 @@
[self setWindow:mainWindow];
[mainWindow orderWindow:NSWindowBelow relativeTo:[fullScreenWindow
windowNumber]];
[mainWindow display];
- [fullScreenWindow fadeOutBlocking:NO];
+ [fullScreenWindow fadeOut];
[mainWindow makeFirstResponder:pdfView];
[mainWindow recalculateKeyViewLoop];
[mainWindow setDelegate:self];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit