mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Make OakPopOutAnimation window a child of the main window
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
#include <oak/misc.h>
|
||||
|
||||
PUBLIC void OakShowPopOutAnimation (NSRect aRect, NSImage* image, BOOL hidePrevious = YES);
|
||||
PUBLIC void OakShowPopOutAnimation (NSView* parentView, NSRect aRect, NSImage* image, BOOL hidePrevious = YES);
|
||||
|
||||
@@ -28,7 +28,7 @@ static double const kFadeFinishTime = 0.70;
|
||||
- (void)startAnimation:(id)sender;
|
||||
@end
|
||||
|
||||
void OakShowPopOutAnimation (NSRect popOutRect, NSImage* anImage, BOOL hidePrevious)
|
||||
void OakShowPopOutAnimation (NSView* parentView, NSRect popOutRect, NSImage* anImage, BOOL hidePrevious)
|
||||
{
|
||||
if(popOutRect.size.width == 0 || popOutRect.size.height == 0)
|
||||
return;
|
||||
@@ -57,7 +57,6 @@ void OakShowPopOutAnimation (NSRect popOutRect, NSImage* anImage, BOOL hidePrevi
|
||||
[window setBackgroundColor:[NSColor clearColor]];
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[window setIgnoresMouseEvents:YES];
|
||||
[window setLevel:NSStatusWindowLevel];
|
||||
[window setOpaque:NO];
|
||||
[[window contentView] setWantsLayer:YES];
|
||||
|
||||
@@ -72,7 +71,11 @@ void OakShowPopOutAnimation (NSRect popOutRect, NSImage* anImage, BOOL hidePrevi
|
||||
aView.contentImage = anImage;
|
||||
[[window contentView] addSubview:aView];
|
||||
|
||||
if(NSScrollView* scrollView = parentView.enclosingScrollView)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:aView selector:@selector(parentViewBoundsDidChange:) name:NSViewBoundsDidChangeNotification object:scrollView.contentView];
|
||||
|
||||
[window setFrame:[window frameRectForContentRect:windowRect] display:YES];
|
||||
[parentView.window addChildWindow:window ordered:NSWindowAbove];
|
||||
[window orderFront:nil];
|
||||
[previousViews addObject:aView];
|
||||
|
||||
@@ -161,4 +164,15 @@ void OakShowPopOutAnimation (NSRect popOutRect, NSImage* anImage, BOOL hidePrevi
|
||||
[shapeLayer removeAllAnimations]; // Releases the animation which holds a strong reference to its delegate (us)
|
||||
[[self window] close];
|
||||
}
|
||||
|
||||
- (void)parentViewBoundsDidChange:(NSNotification*)notification
|
||||
{
|
||||
[shapeLayer removeAllAnimations]; // Releases the animation which holds a strong reference to its delegate (us)
|
||||
[[self window] close];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
- (void)mouseDown:(NSEvent*)anEvent
|
||||
{
|
||||
NSRect p = [[self window] convertRectToScreen:(NSRect){ [anEvent locationInWindow], NSMakeSize(48, 48) }];
|
||||
OakShowPopOutAnimation(p, [NSImage imageNamed:NSImageNameComputer]);
|
||||
OakShowPopOutAnimation(nil, p, [NSImage imageNamed:NSImageNameComputer]);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@@ -610,7 +610,7 @@ struct refresh_helper_t
|
||||
NSRect imageRect;
|
||||
NSImage* image = [_self imageForRanges:range imageRect:&imageRect];
|
||||
imageRect = [[_self window] convertRectToScreen:[_self convertRect:imageRect toView:nil]];
|
||||
OakShowPopOutAnimation(imageRect, image);
|
||||
OakShowPopOutAnimation(_self, imageRect, image);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,7 +790,7 @@ static std::string shell_quote (std::vector<std::string> paths)
|
||||
NSRect imageRect;
|
||||
NSImage* image = [self imageForRanges:range imageRect:&imageRect];
|
||||
imageRect = [[self window] convertRectToScreen:[self convertRect:imageRect toView:nil]];
|
||||
OakShowPopOutAnimation(imageRect, image, firstRange);
|
||||
OakShowPopOutAnimation(self, imageRect, image, firstRange);
|
||||
firstRange = NO;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user