Fixed zoom effect

This commit is contained in:
Gennadiy Potapov 2016-03-29 14:39:04 +03:00
parent a3dcfc4edf
commit a2fbbe7d36
4 changed files with 209 additions and 192 deletions

View file

@ -68,7 +68,7 @@
DB46BEEB143466ED0025EA0E /* DBUserDefaults.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB46BEEA143466ED0025EA0E /* DBUserDefaults.framework */; }; DB46BEEB143466ED0025EA0E /* DBUserDefaults.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB46BEEA143466ED0025EA0E /* DBUserDefaults.framework */; };
DB46BEEF14346A7C0025EA0E /* DBUserDefaultsController.h in Headers */ = {isa = PBXBuildFile; fileRef = DB46BEED14346A7C0025EA0E /* DBUserDefaultsController.h */; }; DB46BEEF14346A7C0025EA0E /* DBUserDefaultsController.h in Headers */ = {isa = PBXBuildFile; fileRef = DB46BEED14346A7C0025EA0E /* DBUserDefaultsController.h */; };
DB46BEF014346A7C0025EA0E /* DBUserDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = DB46BEEE14346A7C0025EA0E /* DBUserDefaultsController.m */; }; DB46BEF014346A7C0025EA0E /* DBUserDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = DB46BEEE14346A7C0025EA0E /* DBUserDefaultsController.m */; };
DB46BEF114346B2F0025EA0E /* DBUserDefaults.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB46BEEA143466ED0025EA0E /* DBUserDefaults.framework */; }; DB46BEF114346B2F0025EA0E /* DBUserDefaults.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB46BEEA143466ED0025EA0E /* DBUserDefaults.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
DB46BEF314346C660025EA0E /* DBSyncPromptDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DB46BEF214346C660025EA0E /* DBSyncPromptDelegate.h */; }; DB46BEF314346C660025EA0E /* DBSyncPromptDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DB46BEF214346C660025EA0E /* DBSyncPromptDelegate.h */; };
DB46BEF514346C6D0025EA0E /* DBUserDefaults.h in Headers */ = {isa = PBXBuildFile; fileRef = DB46BEF414346C6D0025EA0E /* DBUserDefaults.h */; }; DB46BEF514346C6D0025EA0E /* DBUserDefaults.h in Headers */ = {isa = PBXBuildFile; fileRef = DB46BEF414346C6D0025EA0E /* DBUserDefaults.h */; };
DBEB0C9C1442F2AE0080D24E /* NSWindow+ULIZoomEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = DBEB0C9A1442F2AE0080D24E /* NSWindow+ULIZoomEffect.h */; }; DBEB0C9C1442F2AE0080D24E /* NSWindow+ULIZoomEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = DBEB0C9A1442F2AE0080D24E /* NSWindow+ULIZoomEffect.h */; };
@ -457,6 +457,7 @@
LastUpgradeCheck = 0500; LastUpgradeCheck = 0500;
TargetAttributes = { TargetAttributes = {
8D1107260486CEB800E47090 = { 8D1107260486CEB800E47090 = {
DevelopmentTeam = S8JLSG5ES7;
SystemCapabilities = { SystemCapabilities = {
com.apple.Sandbox = { com.apple.Sandbox = {
enabled = 1; enabled = 1;
@ -576,7 +577,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = Flycut.entitlements; CODE_SIGN_ENTITLEMENTS = Flycut.entitlements;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "Mac Developer: Gennady Potapov (25MP9WMKUA)";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -590,6 +591,7 @@
INSTALL_PATH = "$(HOME)/Applications"; INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.7; MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = Flycut; PRODUCT_NAME = Flycut;
PROVISIONING_PROFILE = "3abf5364-dfb4-4792-a5a0-377a74572bcb";
WRAPPER_EXTENSION = app; WRAPPER_EXTENSION = app;
ZERO_LINK = YES; ZERO_LINK = YES;
}; };
@ -599,7 +601,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = Flycut.entitlements; CODE_SIGN_ENTITLEMENTS = Flycut.entitlements;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "Mac Developer: Gennady Potapov (25MP9WMKUA)";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(FRAMEWORK_SEARCH_PATHS)", "$(FRAMEWORK_SEARCH_PATHS)",
@ -611,6 +613,7 @@
INSTALL_PATH = "$(HOME)/Applications"; INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.7; MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = Flycut; PRODUCT_NAME = Flycut;
PROVISIONING_PROFILE = "3abf5364-dfb4-4792-a5a0-377a74572bcb";
STRIP_INSTALLED_PRODUCT = YES; STRIP_INSTALLED_PRODUCT = YES;
WRAPPER_EXTENSION = app; WRAPPER_EXTENSION = app;
}; };

View file

@ -22,22 +22,29 @@
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" buildConfiguration = "Debug"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
buildConfiguration = "Debug"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
</Testables> </Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" buildConfiguration = "Release"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
displayScaleIsEnabled = "NO" displayScaleIsEnabled = "NO"
displayScale = "1.00" displayScale = "1.00"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"> ignoresPersistentStateOnLaunch = "NO"
<BuildableProductRunnable> debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090" BlueprintIdentifier = "8D1107260486CEB800E47090"
@ -52,11 +59,13 @@
<ProfileAction <ProfileAction
displayScaleIsEnabled = "NO" displayScaleIsEnabled = "NO"
displayScale = "1.00" displayScale = "1.00"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"> debugDocumentVersioning = "YES">
<BuildableProductRunnable> <BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "8D1107260486CEB800E47090" BlueprintIdentifier = "8D1107260486CEB800E47090"

View file

@ -57,6 +57,7 @@ typedef NSInteger NSWindowAnimationBehavior;
-(void) setAnimationBehavior: (NSWindowAnimationBehavior)animBehaviour; -(void) setAnimationBehavior: (NSWindowAnimationBehavior)animBehaviour;
-(NSWindowAnimationBehavior) animationBehavior; -(NSWindowAnimationBehavior) animationBehavior;
-(CGFloat) backingScaleFactor;
@end @end
@ -173,7 +174,7 @@ typedef NSInteger NSWindowAnimationBehavior;
[self orderFront: nil]; [self orderFront: nil];
// snag the image // snag the image
CGImageRef windowImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [self windowNumber], kCGWindowImageBoundsIgnoreFraming); CGImageRef windowImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, (CGWindowID)[self windowNumber], kCGWindowImageBoundsIgnoreFraming);
if( !wasVisible ) if( !wasVisible )
[self orderOut: nil]; [self orderOut: nil];
@ -186,9 +187,13 @@ typedef NSInteger NSWindowAnimationBehavior;
return nil; return nil;
} }
CGFloat backingScaleFactor = 1.0;
if( [self respondsToSelector: @selector(backingScaleFactor)] )
backingScaleFactor = self.backingScaleFactor;
// Create a bitmap rep from the window and convert to NSImage... // Create a bitmap rep from the window and convert to NSImage...
NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage: windowImage]; NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage: windowImage];
NSImage *image = [[NSImage alloc] initWithSize: NSMakeSize(CGImageGetWidth(windowImage),CGImageGetHeight(windowImage))]; NSImage *image = [[NSImage alloc] initWithSize: NSMakeSize(CGImageGetWidth(windowImage) / backingScaleFactor, CGImageGetHeight(windowImage) / backingScaleFactor)];
[image addRepresentation: bitmapRep]; [image addRepresentation: bitmapRep];
[bitmapRep release]; [bitmapRep release];
CGImageRelease(windowImage); CGImageRelease(windowImage);
@ -275,7 +280,7 @@ typedef NSInteger NSWindowAnimationBehavior;
NSImage * snapshotImage = [self uli_imageWithSnapshotForceActive: YES]; NSImage * snapshotImage = [self uli_imageWithSnapshotForceActive: YES];
NSRect myFrame = [self frame]; NSRect myFrame = [self frame];
myFrame.size = snapshotImage.size; myFrame.size = snapshotImage.size;
NSWindow * animationWindow = [self uli_animationWindowForZoomEffectWithImage: snapshotImage]; ULIQuicklyAnimatingWindow * animationWindow = [self uli_animationWindowForZoomEffectWithImage: snapshotImage];
[animationWindow setFrame: globalStartPoint display: YES]; [animationWindow setFrame: globalStartPoint display: YES];
[animationWindow orderFront: nil]; [animationWindow orderFront: nil];
[animationWindow setFrame: myFrame display: YES animate: YES]; [animationWindow setFrame: myFrame display: YES animate: YES];
@ -306,7 +311,7 @@ typedef NSInteger NSWindowAnimationBehavior;
NSImage * snapshotImage = [self uli_imageWithSnapshotForceActive: NO]; NSImage * snapshotImage = [self uli_imageWithSnapshotForceActive: NO];
NSRect myFrame = [self frame]; NSRect myFrame = [self frame];
myFrame.size = snapshotImage.size; myFrame.size = snapshotImage.size;
NSWindow * animationWindow = [self uli_animationWindowForZoomEffectWithImage: snapshotImage]; ULIQuicklyAnimatingWindow * animationWindow = [self uli_animationWindowForZoomEffectWithImage: snapshotImage];
[animationWindow setFrame: globalStartPoint display: YES]; [animationWindow setFrame: globalStartPoint display: YES];
[animationWindow orderFront: nil]; [animationWindow orderFront: nil];
[animationWindow setFrame: myFrame display: YES animate: YES]; [animationWindow setFrame: myFrame display: YES animate: YES];
@ -337,7 +342,7 @@ typedef NSInteger NSWindowAnimationBehavior;
NSImage * snapshotImage = [self uli_imageWithSnapshotForceActive: NO]; NSImage * snapshotImage = [self uli_imageWithSnapshotForceActive: NO];
NSRect myFrame = [self frame]; NSRect myFrame = [self frame];
myFrame.size = snapshotImage.size; myFrame.size = snapshotImage.size;
NSWindow * animationWindow = [self uli_animationWindowForZoomEffectWithImage: snapshotImage]; ULIQuicklyAnimatingWindow * animationWindow = [self uli_animationWindowForZoomEffectWithImage: snapshotImage];
[animationWindow setFrame: myFrame display: YES]; [animationWindow setFrame: myFrame display: YES];
NSDisableScreenUpdates(); NSDisableScreenUpdates();