Fixed multi-monitorness except with Pivot, which is only half fixed.
authorKent Sutherland <ksuther@ithinksw.com>
Mon, 20 Dec 2004 00:53:52 +0000 (00:53 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Mon, 20 Dec 2004 00:53:52 +0000 (00:53 +0000)
ITPivotWindowEffect.m
ITSlideHorizontallyWindowEffect.m
ITSlideVerticallyWindowEffect.m
ITSpinAndZoomWindowEffect.m
ITSpinWindowEffect.m
ITZoomWindowEffect.m

index 400d931..3b0c5a4 100755 (executable)
 {
     int hPos = [_window horizontalPosition];
     int vPos = [_window verticalPosition];
+       NSRect winFrame = [_window frame];
 
     if ( (hPos == ITWindowPositionCenter) || (vPos == ITWindowPositionMiddle) ) {
     
         CGAffineTransform transform;
         NSPoint translation;
         
-        translation.x = ( -([_window frame].origin.x) ) ;
-        translation.y = -( [[_window screen] frame].size.height - [_window frame].origin.y - [_window frame].size.height );
+        translation.x = -winFrame.origin.x;
+        translation.y = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height;
 
         transform = CGAffineTransformMakeTranslation( translation.x, translation.y );
         
     } else {
         
         float  degAngle;
-        NSRect windowFrame = [_window frame];
         NSRect screenFrame = [[_window screen] frame];
         float  translateX = 0;
         float  translateY = 0;
         
         degAngle  = (angle * (pi / 180));
         transform = CGAffineTransformMakeRotation(degAngle);
-        
         if ( vPos == ITWindowPositionBottom ) {
-            transform.ty = ( windowFrame.size.height + windowFrame.origin.y);
+            transform.ty = ( winFrame.size.height + winFrame.origin.y) + (screenFrame.size.height - [[NSScreen mainScreen] frame].size.height);
             translateY   = -(screenFrame.size.height);
         } else if ( vPos == ITWindowPositionTop ) {
-            transform.ty = -( screenFrame.size.height - windowFrame.origin.y - windowFrame.size.height );
+                       transform.ty = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height;
             translateY   = 0;
         }
         
         if ( hPos == ITWindowPositionLeft ) {
-            transform.tx = -( windowFrame.origin.x );
+            transform.tx = -( winFrame.origin.x );
             translateX   = 0;
         } else if ( hPos == ITWindowPositionRight ) {
-            transform.tx = ( screenFrame.size.width - windowFrame.origin.x );
+            //transform.tx = ( screenFrame.size.width - winFrame.origin.x );
+                       transform.tx = ( screenFrame.size.width - winFrame.origin.x );
             translateX   = -(screenFrame.size.width);
         }
-        
         CGSSetWindowTransform([NSApp contextID],
                               (CGSWindowID)[_window windowNumber],
                               CGAffineTransformTranslate( transform,
index 1a26d1f..60122fd 100755 (executable)
 {
     CGAffineTransform transform;
     NSPoint translation;
-    
+    NSRect winFrame = [_window frame];
+       
     if ( [_window horizontalPosition] == ITWindowPositionLeft ) {
-        translation.x = ( -([_window frame].origin.x) + distance ) ;
+        translation.x = ( -(winFrame.origin.x) + distance ) ;
     } else if ( [_window horizontalPosition] == ITWindowPositionRight ) {
-        translation.x = ( -([_window frame].origin.x) - distance ) ;
+        translation.x = ( -(winFrame.origin.x) - distance ) ;
     } else {
-        translation.x = ( -([_window frame].origin.x) ) ;
+        translation.x = ( -(winFrame.origin.x) ) ;
     }
     
-    translation.y = -( [[_window screen] frame].size.height - [_window frame].origin.y - [_window frame].size.height );
+       translation.y = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height;
     
     transform = CGAffineTransformMakeTranslation( translation.x, translation.y );
     
index 7237620..1f60933 100755 (executable)
 {
     CGAffineTransform transform;
     NSPoint translation;
+       NSRect winFrame = [_window frame];
     
     translation.x = -( [_window frame].origin.x );
     
     if ( [_window verticalPosition] == ITWindowPositionTop ) {
-        translation.y = ( (([_window frame].size.height * 2) - ([[_window screen] frame].size.height - [_window frame].origin.y)) - distance);
+               translation.y = (winFrame.size.height * 2) - ([[NSScreen mainScreen] frame].size.height - winFrame.origin.y) - distance;
     } else if ( [_window verticalPosition] == ITWindowPositionBottom ) {
-        translation.y = -( [[_window screen] frame].size.height - [_window frame].origin.y - distance );
+        translation.y = winFrame.origin.y + distance - [[NSScreen mainScreen] frame].size.height;
     } else {
-        translation.y = -( [[_window screen] frame].size.height - [_window frame].origin.y - [_window frame].size.height );
+        translation.y = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height;
     }
     
     transform = CGAffineTransformMakeTranslation( translation.x, translation.y );
index cbbf44c..44b3ad3 100755 (executable)
 
 - (void)setScale:(float)scale angle:(float)angle
 {
-    //int hPos = [_window horizontalPosition];
     float radAngle = (angle * 4 * pi);
     CGAffineTransform transform;
     NSPoint translation;
-    NSRect screenFrame = [[_window screen] frame];
-    
-    translation.x = /*screenFrame.origin.x + */([_window frame].size.width / 2.0);
-    translation.y = /*screenFrame.origin.y + */([_window frame].size.height / 2.0);
+       NSRect winFrame = [_window frame];
+       
+    translation.x = (winFrame.size.width / 2.0);
+    translation.y = (winFrame.size.height / 2.0);
     transform = CGAffineTransformMakeTranslation(translation.x, translation.y);
     transform = CGAffineTransformScale(transform, 1.0 / scale, 1.0 / scale);
     transform = CGAffineTransformRotate(transform, radAngle);
     transform = CGAffineTransformTranslate(transform, -translation.x, -translation.y);
-    
-    /*if (hPos == ITWindowPositionLeft) {
-        translation.x = -[_window frame].origin.x;
-    } else if (hPos == ITWindowPositionRight) {
-        translation.x = -[_window frame].origin.x;
-    } else {
-        translation.x = -[_window frame].origin.x;
-    }*/
-    translation.x = -[_window frame].origin.x;
-    translation.y = -( screenFrame.size.height - [_window frame].origin.y - [_window frame].size.height );
+       
+    translation.x = -winFrame.origin.x;
+    translation.y = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height;
     
     transform = CGAffineTransformTranslate(transform, translation.x, translation.y);
     CGSSetWindowTransform([NSApp contextID],
index ef8aaf6..0de4f56 100755 (executable)
 
 - (void)setSpin:(float)progress
 {
-    //int hPos = [_window horizontalPosition];
     float radAngle = (progress * 4 * pi);
     CGAffineTransform transform;
     NSPoint translation;
-    NSRect screenFrame = [[_window screen] frame];
+    NSRect winFrame = [_window frame];
     
-    translation.x = /*screenFrame.origin.x + */([_window frame].size.width / 2.0);
-    translation.y = /*screenFrame.origin.y + */([_window frame].size.height / 2.0);
+    translation.x = (winFrame.size.width / 2.0);
+    translation.y = (winFrame.size.height / 2.0);
     transform = CGAffineTransformMakeTranslation(translation.x, translation.y);
     transform = CGAffineTransformRotate(transform, radAngle);
     transform = CGAffineTransformTranslate(transform, -translation.x, -translation.y);
     
-    /*if (hPos == ITWindowPositionLeft) {
-        translation.x = -[_window frame].origin.x;
-    } else if (hPos == ITWindowPositionRight) {
-        translation.x = -[_window frame].origin.x;
-    } else {
-        translation.x = -[_window frame].origin.x;
-    }*/
-    translation.x = -[_window frame].origin.x;
-    translation.y = -( screenFrame.size.height - [_window frame].origin.y - [_window frame].size.height );
+    translation.x = -winFrame.origin.x;
+    translation.y = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height;
     
     transform = CGAffineTransformTranslate(transform, translation.x, translation.y);
     CGSSetWindowTransform([NSApp contextID],
index b4a0778..bde7a2d 100755 (executable)
 
 - (void)setZoom:(float)Zoom
 {
-    //int hPos = [_window horizontalPosition];
     CGAffineTransform transform;
     NSPoint translation;
-    NSRect screenFrame = [[_window screen] frame];
+    NSRect winFrame = [_window frame];
     
-    translation.x = /*screenFrame.origin.x + */([_window frame].size.width / 2.0);
-    translation.y = /*screenFrame.origin.y + */([_window frame].size.height / 2.0);
+    translation.x = (winFrame.size.width / 2.0);
+    translation.y = (winFrame.size.height / 2.0);
     transform = CGAffineTransformMakeTranslation(translation.x, translation.y);
     transform = CGAffineTransformScale(transform, 1.0 / Zoom, 1.0 / Zoom);
     transform = CGAffineTransformTranslate(transform, -translation.x, -translation.y);
     
-    /*if (hPos == ITWindowPositionLeft) {
-        translation.x = -[_window frame].origin.x;
-    } else if (hPos == ITWindowPositionRight) {
-        translation.x = -[_window frame].origin.x;
-    } else {
-        translation.x = -[_window frame].origin.x;
-    }*/
-       translation.x = -[_window frame].origin.x;
-    translation.y = -( screenFrame.size.height - [_window frame].origin.y - [_window frame].size.height );
+       translation.x = -winFrame.origin.x;
+    translation.y = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height;
     
     transform = CGAffineTransformTranslate(transform, translation.x, translation.y);