From 5cf6107f7fb51538c33d2839a2485493a7446c43 Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Fri, 14 Nov 2003 00:11:01 +0000 Subject: [PATCH] The dissolve, cut and slides all work properly now, I hope :D --- ITCutWindowEffect.m | 27 ++++++++++++++++++- ITDissolveWindowEffect.m | 26 +++++++++++++++++- ITPivotWindowEffect.m | 44 ++++++++++++++++++++++++++----- ITSlideHorizontallyWindowEffect.m | 19 ++++++++++--- ITSlideVerticallyWindowEffect.m | 17 ++++++++++-- 5 files changed, 119 insertions(+), 14 deletions(-) diff --git a/ITCutWindowEffect.m b/ITCutWindowEffect.m index 79381cb..8ab95cd 100755 --- a/ITCutWindowEffect.m +++ b/ITCutWindowEffect.m @@ -1,6 +1,6 @@ #import "ITCutWindowEffect.h" #import "ITTransientStatusWindow.h" - +#import "ITCoreGraphicsHacks.h" @implementation ITCutWindowEffect @@ -12,6 +12,31 @@ - (void)performAppear { + CGAffineTransform transform; + NSPoint appearPoint; + + //Set the location on the screen + if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) { + appearPoint.x = -( 32.0 + [[_window screen] visibleFrame].origin.x ); + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionRight ) { + appearPoint.x = -(([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) - 32.0 - [_window frame].size.width); + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionCenter ) { + appearPoint.x = ( [_window frame].size.width - [[_window screen] visibleFrame].size.width ) / 2; + } + + if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) { + appearPoint.y = ( 64.0 + [[_window screen] visibleFrame].origin.y - [_window frame].size.height ); + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) { + appearPoint.y = -( [[_window screen] frame].size.height - ( [_window frame].size.height + 32.0 + [[_window screen] visibleFrame].origin.y) ); + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionMiddle ) { + appearPoint.y = ( [_window frame].size.height - [[_window screen] visibleFrame].size.height) / 2; + } + + transform = CGAffineTransformMakeTranslation(appearPoint.x, appearPoint.y); + CGSSetWindowTransform([NSApp contextID], + (CGSWindowID)[_window windowNumber], + transform); + [_window orderFront:self]; [self setWindowVisibility:ITWindowVisibleState]; } diff --git a/ITDissolveWindowEffect.m b/ITDissolveWindowEffect.m index 147840d..b058548 100755 --- a/ITDissolveWindowEffect.m +++ b/ITDissolveWindowEffect.m @@ -1,6 +1,6 @@ #import "ITDissolveWindowEffect.h" #import "ITTransientStatusWindow.h" - +#import "ITCoreGraphicsHacks.h" @interface ITDissolveWindowEffect (Private) - (void)performAppearFromProgress:(float)progress effectTime:(float)time; @@ -22,8 +22,32 @@ - (void)performAppear { + CGAffineTransform transform; + NSPoint appearPoint; __idle = NO; + //Set the location on the screen + if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) { + appearPoint.x = -( 32.0 + [[_window screen] visibleFrame].origin.x ); + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionRight ) { + appearPoint.x = -(([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) - 32.0 - [_window frame].size.width); + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionCenter ) { + appearPoint.x = ( [_window frame].size.width - [[_window screen] visibleFrame].size.width ) / 2; + } + + if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) { + appearPoint.y = ( 64.0 + [[_window screen] visibleFrame].origin.y - [_window frame].size.height ); + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) { + appearPoint.y = -( [[_window screen] frame].size.height - ( [_window frame].size.height + 32.0 + [[_window screen] visibleFrame].origin.y) ); + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionMiddle ) { + appearPoint.y = ( [_window frame].size.height - [[_window screen] visibleFrame].size.height) / 2; + } + + transform = CGAffineTransformMakeTranslation(appearPoint.x, appearPoint.y); + CGSSetWindowTransform([NSApp contextID], + (CGSWindowID)[_window windowNumber], + transform); + [self setWindowVisibility:ITWindowAppearingState]; [self performAppearFromProgress:0.0 effectTime:_effectTime]; } diff --git a/ITPivotWindowEffect.m b/ITPivotWindowEffect.m index 81a4b5c..fdacd63 100755 --- a/ITPivotWindowEffect.m +++ b/ITPivotWindowEffect.m @@ -164,20 +164,50 @@ - (void)setPivot:(float)angle { - float degAngle = (angle * (pi / 180)); - - CGAffineTransform transform = CGAffineTransformMakeRotation(degAngle); + float degAngle; + NSPoint appearPoint; + CGAffineTransform transform; + + if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) { + if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) { + degAngle = (angle * (pi / 180)); + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) { + degAngle = (-angle * (pi / 180)); + } + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionRight ) { + if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) { + degAngle = (angle * (pi / 180)); + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) { + degAngle = (-angle * (pi / 180)); + } + } + + transform = CGAffineTransformMakeRotation(degAngle); // Set pivot rotation point transform.tx = -( 32.0 + [[_window screen] visibleFrame].origin.x ); transform.ty = ( [_window frame].size.height + 32.0 + [[_window screen] visibleFrame].origin.y ); - + + if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) { + appearPoint.x = -( 32.0 + [[_window screen] visibleFrame].origin.x ); + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionRight ) { + appearPoint.x = -(([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) - 32.0 - [_window frame].size.width); + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionCenter ) { + appearPoint.x = ( [_window frame].size.width - [[_window screen] visibleFrame].size.width ) / 2; + } + + if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) { + appearPoint.y = ( [_window frame].size.height - [[_window screen] visibleFrame].size.height) / 2; + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) { + appearPoint.y = -( [[_window screen] frame].size.height - ([_window frame].origin.y) + 32.0 + [[_window screen] visibleFrame].origin.y) ; + }/* else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionMiddle ) { + appearPoint.y = ( [_window frame].size.height - [[_window screen] visibleFrame].size.height) / 2; + }*/ CGSSetWindowTransform([NSApp contextID], (CGSWindowID)[_window windowNumber], CGAffineTransformTranslate( transform, - -( [_window frame].origin.x - (32.0 + [[_window screen] visibleFrame].origin.x) ), - -( [[_window screen] frame].size.height - ([_window frame].origin.y) + 32.0 + [[_window screen] visibleFrame].origin.y) ) ); + appearPoint.x, + appearPoint.y ) ); } - @end diff --git a/ITSlideHorizontallyWindowEffect.m b/ITSlideHorizontallyWindowEffect.m index 4de74ec..2382cc4 100755 --- a/ITSlideHorizontallyWindowEffect.m +++ b/ITSlideHorizontallyWindowEffect.m @@ -157,14 +157,27 @@ - (void)setSlide:(float)distance { CGAffineTransform transform; - if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) { + float yPoint; + + if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) { + yPoint = ( 64.0 + [[_window screen] visibleFrame].origin.y - [_window frame].size.height ); + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) { + yPoint = -( [[_window screen] frame].size.height - ( [_window frame].size.height + 32.0 + [[_window screen] visibleFrame].origin.y) ); + } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionMiddle ) { + yPoint = ( [_window frame].size.height - [[_window screen] visibleFrame].size.height) / 2; + } + + /*if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) { transform = CGAffineTransformMakeTranslation((distance - (32.0 + [[_window screen] visibleFrame].origin.x)), ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) ? -( [[_window screen] frame].size.height - ( [_window frame].size.height + 32.0 + [[_window screen] visibleFrame].origin.y) ) : ( 64.0 + [[_window screen] visibleFrame].origin.y - [_window frame].size.height ) ); } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionRight ) { transform = CGAffineTransformMakeTranslation(-((([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) + distance) - 32.0 - [_window frame].size.width), ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) ? -( [[_window screen] frame].size.height - ( [_window frame].size.height + 32.0 + [[_window screen] visibleFrame].origin.y) ) : ( 64.0 + [[_window screen] visibleFrame].origin.y - [_window frame].size.height ) ); - } - + }*/ + + transform = CGAffineTransformMakeTranslation( ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) ? (distance - (32.0 + [[_window screen] visibleFrame].origin.x)) : -((([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) + distance) - 32.0 - [_window frame].size.width), + yPoint); + CGSSetWindowTransform([NSApp contextID], (CGSWindowID)[_window windowNumber], transform); diff --git a/ITSlideVerticallyWindowEffect.m b/ITSlideVerticallyWindowEffect.m index 140ffbd..023e276 100755 --- a/ITSlideVerticallyWindowEffect.m +++ b/ITSlideVerticallyWindowEffect.m @@ -157,13 +157,26 @@ - (void)setSlide:(float)distance { CGAffineTransform transform; - if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) { + float xPoint; + + if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) { + xPoint = -( 32.0 + [[_window screen] visibleFrame].origin.x ); + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionRight ) { + xPoint = -(([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) - 32.0 - [_window frame].size.width); + } else if ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionCenter ) { + xPoint = ( [_window frame].size.width - [[_window screen] visibleFrame].size.width ) / 2; + } + + /*if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionBottom ) { transform = CGAffineTransformMakeTranslation( ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) ? -( 32.0 + [[_window screen] visibleFrame].origin.x ) : -(([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) - 32.0 - [_window frame].size.width), -( [[_window screen] frame].size.height - ( distance + 32.0 + [[_window screen] visibleFrame].origin.y ) ) ); } else if ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) { transform = CGAffineTransformMakeTranslation( ( [(ITTransientStatusWindow *)_window horizontalPosition] == ITWindowPositionLeft ) ? -( 32.0 + [[_window screen] visibleFrame].origin.x ) : -(([[_window screen] visibleFrame].size.width + [[_window screen] visibleFrame].origin.x) - 32.0 - [_window frame].size.width), [[_window screen] visibleFrame].origin.y - distance + 64.0 ); - } + }*/ + + transform = CGAffineTransformMakeTranslation(xPoint, + ( [(ITTransientStatusWindow *)_window verticalPosition] == ITWindowPositionTop ) ? ( [[_window screen] visibleFrame].origin.y - distance + 64.0 ) : -( [[_window screen] frame].size.height - ( distance + 32.0 + [[_window screen] visibleFrame].origin.y ) ) ); CGSSetWindowTransform([NSApp contextID], (CGSWindowID)[_window windowNumber], -- 2.20.1