From: <ho...@us...> - 2009-11-07 22:23:16
|
Revision: 16001 http://bibdesk.svn.sourceforge.net/bibdesk/?rev=16001&view=rev Author: hofman Date: 2009-11-07 22:23:10 +0000 (Sat, 07 Nov 2009) Log Message: ----------- animate status bar toggle Modified Paths: -------------- trunk/bibdesk/BibDocument_Actions.m Modified: trunk/bibdesk/BibDocument_Actions.m =================================================================== --- trunk/bibdesk/BibDocument_Actions.m 2009-11-07 19:20:26 UTC (rev 16000) +++ trunk/bibdesk/BibDocument_Actions.m 2009-11-07 22:23:10 UTC (rev 16001) @@ -1304,15 +1304,40 @@ } } +- (void)endStatusBarAnimation:(NSNumber *)visible { + if ([visible boolValue] == NO) { + [documentWindow setContentBorderThickness:0.0 forEdge:NSMinYEdge]; + [statusView setHidden:YES]; + } + docState.isAnimating = NO; +} + - (IBAction)toggleStatusBar:(id)sender{ + if (docState.isAnimating) + return; + BOOL visible = [statusView isHidden]; - NSRect ignored, frame = [groupSplitView frame]; - CGFloat height = NSHeight([statusView frame]); - NSDivideRect(frame, &ignored, &frame, visible ? height : -height, NSMinYEdge); - [groupSplitView setFrame:frame]; - [documentWindow setContentBorderThickness:visible ? height : 0.0 forEdge:NSMinYEdge]; - [statusView setHidden:visible == NO]; + NSRect ignored, frame = [groupSplitView frame], statusFrame = [statusView frame]; + CGFloat dy = visible ? NSHeight(statusFrame) : -NSHeight(statusFrame); + + NSDivideRect(frame, &ignored, &frame, dy, NSMinYEdge); + statusFrame.origin.y += dy; + if (visible) + [documentWindow setContentBorderThickness:dy forEdge:NSMinYEdge]; + [statusView setHidden:NO]; [[NSUserDefaults standardUserDefaults] setBool:visible forKey:BDSKShowStatusBarKey]; + + if (sender == nil) { + [groupSplitView setFrame:frame]; + [statusView setFrame:statusFrame]; + } else { + docState.isAnimating = YES; + [NSAnimationContext beginGrouping]; + [[groupSplitView animator] setFrame:frame]; + [[statusView animator] setFrame:statusFrame]; + [NSAnimationContext endGrouping]; + [self performSelector:@selector(endStatusBarAnimation:) withObject:[NSNumber numberWithBool:visible] afterDelay:[[NSAnimationContext currentContext] duration]]; + } } - (IBAction)changeMainTableFont:(id)sender{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |