Revision: 3173
http://skim-app.svn.sourceforge.net/skim-app/?rev=3173&view=rev
Author: hofman
Date: 2007-11-07 04:18:52 -0800 (Wed, 07 Nov 2007)
Log Message:
-----------
Also fade in/out button for left pane state for search.
Modified Paths:
--------------
trunk/SKMainWindowController.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2007-11-07 11:13:41 UTC (rev 3172)
+++ trunk/SKMainWindowController.m 2007-11-07 12:18:52 UTC (rev 3173)
@@ -2480,62 +2480,56 @@
- (void)replaceSideView:(NSView *)oldView withView:(NSView *)newView
animate:(BOOL)animate {
if ([newView window] == nil) {
- BOOL wasFirstResponder;
+ NSMutableArray *viewAnimations = animate ? [NSMutableArray
arrayWithCapacity:4] : nil;
+ NSResponder *oldFirstResponder = [[oldView window] firstResponder];
+ BOOL wasFind = [oldView isEqual:findView] || [oldView
isEqual:groupedFindView];
+ BOOL isFind = [newView isEqual:findView] || [newView
isEqual:groupedFindView];
+ NSSegmentedControl *oldButton = wasFind ? findButton : leftSideButton;
+ NSSegmentedControl *newButton = isFind ? findButton : leftSideButton;
+ NSView *containerView = [newButton superview];
if ([oldView isEqual:tocView] || [oldView isEqual:findView] ||
[oldView isEqual:groupedFindView])
[[SKPDFHoverWindow sharedHoverWindow] orderOut:self];
- if ((oldView == findView || oldView == groupedFindView) && (newView !=
findView && newView != groupedFindView)) {
- NSView *view = [leftSideButton superview];
- wasFirstResponder = [[[findButton window] firstResponder]
isEqual:findButton];
- [leftSideButton setFrame:[findButton frame]];
- [findButton retain];
- [[findButton superview] replaceSubview:findButton
with:leftSideButton];
- [view addSubview:findButton];
- [findButton release];
- if (wasFirstResponder)
- [[leftSideButton window] makeFirstResponder:leftSideButton];
+ if (wasFind != isFind) {
+ [newButton setFrame:[oldButton frame]];
+ [newButton setHidden:animate];
+ [[oldButton superview] addSubview:newButton];
+ if (animate) {
+ [viewAnimations addObject:[NSDictionary
dictionaryWithObjectsAndKeys:oldButton, NSViewAnimationTargetKey,
NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil]];
+ [viewAnimations addObject:[NSDictionary
dictionaryWithObjectsAndKeys:newButton, NSViewAnimationTargetKey,
NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil]];
+ }
}
- wasFirstResponder = [[[oldView window] firstResponder]
isDescendantOf:oldView];
-
[newView setFrame:[oldView frame]];
[newView setHidden:animate];
[[oldView superview] addSubview:newView];
if (animate) {
- isAnimating = YES;
- NSViewAnimation *animation;
- NSDictionary *fadeOutDict = [[NSDictionary alloc]
initWithObjectsAndKeys:oldView, NSViewAnimationTargetKey,
NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil];
- NSDictionary *fadeInDict = [[NSDictionary alloc]
initWithObjectsAndKeys:newView, NSViewAnimationTargetKey,
NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil];
+ [viewAnimations addObject:[NSDictionary
dictionaryWithObjectsAndKeys:oldView, NSViewAnimationTargetKey,
NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil]];
+ [viewAnimations addObject:[NSDictionary
dictionaryWithObjectsAndKeys:newView, NSViewAnimationTargetKey,
NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil]];
- animation = [[[NSViewAnimation alloc]
initWithViewAnimations:[NSArray arrayWithObjects:fadeOutDict, fadeInDict, nil]]
autorelease];
- [fadeOutDict release];
- [fadeInDict release];
+ NSViewAnimation *animation = [[[NSViewAnimation alloc]
initWithViewAnimations:viewAnimations] autorelease];
[animation setAnimationBlockingMode:NSAnimationBlocking];
[animation setDuration:0.75];
[animation setAnimationCurve:NSAnimationEaseIn];
+ isAnimating = YES;
[animation startAnimation];
isAnimating = NO;
}
- if (wasFirstResponder)
+ if ([oldFirstResponder isDescendantOf:oldView])
[[newView window] makeFirstResponder:[newView nextKeyView]];
[oldView removeFromSuperview];
[oldView setHidden:NO];
[[newView window] recalculateKeyViewLoop];
- if ((oldView != findView && oldView != groupedFindView) && (newView ==
findView || newView == groupedFindView)) {
- NSView *view = [findButton superview];
- wasFirstResponder = [[[leftSideButton window] firstResponder]
isEqual:leftSideButton];
- [findButton setFrame:[leftSideButton frame]];
- [leftSideButton retain];
- [[leftSideButton superview] replaceSubview:leftSideButton
with:findButton];
- [view addSubview:leftSideButton];
- [leftSideButton release];
- if (wasFirstResponder)
- [[findButton window] makeFirstResponder:findButton];
+ if (wasFind != isFind) {
+ [containerView addSubview:oldButton];
+ [oldButton setHidden:NO];
+ if ([oldFirstResponder isEqual:oldButton])
+ [[newButton window] makeFirstResponder:newButton];
}
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit