Author: alanmc
Date: 2007-07-10 16:38:52 -0400 (Tue, 10 Jul 2007)
New Revision: 81742

Modified:
   trunk/lunareclipse/ChangeLog
   trunk/lunareclipse/Model/Draw/DrawBase.cs
   trunk/lunareclipse/Model/Draw/SelectionDraw.cs
   trunk/lunareclipse/Model/SelectedBorder.cs
Log:
* Model/Draw/DrawBase.cs: Cleaned up some code

Modified: trunk/lunareclipse/ChangeLog
===================================================================
--- trunk/lunareclipse/ChangeLog        2007-07-10 20:04:17 UTC (rev 81741)
+++ trunk/lunareclipse/ChangeLog        2007-07-10 20:38:52 UTC (rev 81742)
@@ -1,5 +1,9 @@
 2007-07-10  Alan McGovern <[EMAIL PROTECTED]> 
 
+       * Model/Draw/DrawBase.cs: Cleaned up some code
+
+2007-07-10  Alan McGovern <[EMAIL PROTECTED]> 
+
        * Model/Draw/DrawBase.cs, Model/SelectionRectangle.cs: Removed
          writelines
 

Modified: trunk/lunareclipse/Model/Draw/DrawBase.cs
===================================================================
--- trunk/lunareclipse/Model/Draw/DrawBase.cs   2007-07-10 20:04:17 UTC (rev 
81741)
+++ trunk/lunareclipse/Model/Draw/DrawBase.cs   2007-07-10 20:38:52 UTC (rev 
81742)
@@ -148,32 +148,6 @@
                 top -= SelectedBorder.BorderWidth;
                 height += SelectedBorder.BorderWidth * 2;
             }
-            
-            if(transform == null)
-                return;
-            
-            double angle;
-            double rotatedTopLeft;
-            double rotatedTopRight;
-            double rotatedBottomLeft;
-            double rotatedBottomRight;
-            
-            // Calculate the original angle between the bottom left corner and
-            // the centre of rotation
-            angle = Math.Atan2(top + height - transform.CenterY,
-                               left + width - transform.CenterX);
-            // Then add on the rotation from the transform
-            angle += transform.Angle;
-            // Then using some trigonomtry calculate the new position of the
-            // bottom left corner after the transform
-            Point bottomRight = new Point(Math.Cos(angle) * width / 2,
-                                         Math.Sin (angle) * height / 2);
-            
-            angle = Math.Atan2(top - transform.CenterY,
-                               left + width - transform.CenterX);
-            angle += transform.Angle;
-            Point topRight = new Point(Math.Cos(angle) * width / 2,
-                                       Math.Sin(angle) * height / 2);
         }
         
         protected virtual void MoveBy(Point p)

Modified: trunk/lunareclipse/Model/Draw/SelectionDraw.cs
===================================================================
--- trunk/lunareclipse/Model/Draw/SelectionDraw.cs      2007-07-10 20:04:17 UTC 
(rev 81741)
+++ trunk/lunareclipse/Model/Draw/SelectionDraw.cs      2007-07-10 20:38:52 UTC 
(rev 81742)
@@ -218,11 +218,14 @@
             switch(b.MoveType)
             {
                 case MoveType.Rotate:
-                Point center = new Point(b.Width * 0.5 + b.Left, b.Height * 
0.5 + b.Top);
-                Console.WriteLine("Center border: " + center.ToString());
+                Point center = new 
Point((double)b.GetValue(Canvas.WidthProperty) * 0.5 + 
+                                         
(double)b.GetValue(Canvas.LeftProperty),
+                                         
(double)b.GetValue(Canvas.HeightProperty) * 0.5 +
+                                         
(double)b.GetValue(Canvas.TopProperty));
+
                 center = new 
Point((double)b.Child.GetValue(Canvas.WidthProperty) * 0.5 + 
(double)b.Child.GetValue(Canvas.LeftProperty),
                                    
(double)b.Child.GetValue(Canvas.HeightProperty) * 0.5 + 
(double)b.Child.GetValue(Canvas.TopProperty));
-                Console.WriteLine("Center shape: " + center.ToString());
+               
                 double beginAngle = Math.Atan2(mouseStart.Y - (center.Y), 
mouseStart.X - (center.X));
                 double currentAngle = Math.Atan2((Position.Y - center.Y) , 
(Position.X - center.X));
                 b.RotateTransform.Angle = (currentAngle - beginAngle) * 360 / 
(2 * Math.PI);

Modified: trunk/lunareclipse/Model/SelectedBorder.cs
===================================================================
--- trunk/lunareclipse/Model/SelectedBorder.cs  2007-07-10 20:04:17 UTC (rev 
81741)
+++ trunk/lunareclipse/Model/SelectedBorder.cs  2007-07-10 20:38:52 UTC (rev 
81742)
@@ -35,14 +35,17 @@
         public SelectedBorder()
         {
             this.movetype = MoveType.Standard;
-            base.SetValue<bool>(IsHitTestVisibleProperty, false);
             base.SetValue<int>(ZIndexProperty, int.MaxValue);
         }
         
         public RotateTransform RotateTransform
         {
-            get { return (RotateTransform)this.RenderTransform; }
-            set { RenderTransform = value; }
+            get { return 
(RotateTransform)this.child.GetValue(RenderTransformProperty); }
+            set 
+            { 
+                this.child.SetValue<object>(RenderTransformProperty, value); 
+                base.SetValue<object>(RenderTransformProperty, value);
+            }
         }
         
         public Visual Child
@@ -72,7 +75,7 @@
                     t.Angle = 0;
                     t.CenterX = Width * 0.5;
                     t.CenterY = Height * 0.5;
-                    child.SetValue<object>(RenderTransformProperty, t);
+                    RotateTransform = t;
                 }
             }
         }
@@ -94,18 +97,7 @@
             get { return this.movetype; }
             internal set { this.movetype = value; }
         }
-        
-        public override object GetValue (DependencyProperty property)
-        {
-            return child == null ? null : child.GetValue(property);
-        }
-        
-        public override void SetValue<T> (DependencyProperty property, T obj)
-        {
-            child.SetValue<T>(property, obj);
-        }
 
-
         internal void ResizeBorder()
         {         
             ((VisualCollection)base.GetValue(ChildrenProperty)).Clear();
@@ -136,7 +128,6 @@
             copy.CenterX = current.CenterX + BorderWidth;
             copy.CenterY = current.CenterY + BorderWidth;
             base.SetValue<object>(RenderTransformProperty, copy);
-            Console.WriteLine(copy.Angle);
         }
         
         private void DrawHandles()
@@ -149,7 +140,6 @@
             double width = (double)base.GetValue(WidthProperty);
             double midX = width / 2.0;
             double midY = height / 2.0;
-
             
             // Top side
             circle = CreateCircle(new Point(0, 0));

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to