Author: alanmc
Date: 2007-06-29 16:38:42 -0400 (Fri, 29 Jun 2007)
New Revision: 81077

Modified:
   trunk/lunareclipse/ChangeLog
   trunk/lunareclipse/Controller/UndoActions/UndoMoveShape.cs
   trunk/lunareclipse/Model/Draw/SelectionDraw.cs
Log:
Can now undo a group move with one "undo" click.

Modified: trunk/lunareclipse/ChangeLog
===================================================================
--- trunk/lunareclipse/ChangeLog        2007-06-29 20:35:47 UTC (rev 81076)
+++ trunk/lunareclipse/ChangeLog        2007-06-29 20:38:42 UTC (rev 81077)
@@ -1,5 +1,9 @@
 2007-06-29  Alan McGovern <[EMAIL PROTECTED]> 
 
+       Can now undo a group move with one "undo" click.
+
+2007-06-29  Alan McGovern <[EMAIL PROTECTED]> 
+
        Fixed issue selecting something which is on top of something else
 
 2007-06-29  Alan McGovern <[EMAIL PROTECTED]> 

Modified: trunk/lunareclipse/Controller/UndoActions/UndoMoveShape.cs
===================================================================
--- trunk/lunareclipse/Controller/UndoActions/UndoMoveShape.cs  2007-06-29 
20:35:47 UTC (rev 81076)
+++ trunk/lunareclipse/Controller/UndoActions/UndoMoveShape.cs  2007-06-29 
20:38:42 UTC (rev 81077)
@@ -11,33 +11,37 @@
 
 namespace LunarEclipse
 {
-    
-    
     public class UndoMoveShape : UndoActionBase
     {
         private Point offset;
-        private Shape shape;
+        private Shape[] shapes;
         
-        
-        public UndoMoveShape(Shape shape, Point offset)
+        internal UndoMoveShape(Shape[] shapes, Point offset)
         {
-            this.shape = shape;
+            this.shapes = shapes;
             this.offset = offset;
         }
         
+        
         public override void Redo ()
         {
-            Point location = new 
Point((double)shape.GetValue(Canvas.LeftProperty), 
(double)shape.GetValue(Canvas.TopProperty));
-            shape.SetValue<double>(Canvas.LeftProperty, location.X - offset.X);
-            shape.SetValue<double>(Canvas.TopProperty, location.Y - offset.Y);
+            foreach(Shape shape in shapes)
+            {
+                Point location = new 
Point((double)shape.GetValue(Canvas.LeftProperty), 
(double)shape.GetValue(Canvas.TopProperty));
+                shape.SetValue<double>(Canvas.LeftProperty, location.X - 
offset.X);
+                shape.SetValue<double>(Canvas.TopProperty, location.Y - 
offset.Y);
+            }
         }
 
-        
+
         public override void Undo ()
         {
-            Point location = new 
Point((double)shape.GetValue(Canvas.LeftProperty), 
(double)shape.GetValue(Canvas.TopProperty));
-            shape.SetValue<double>(Canvas.LeftProperty, location.X + offset.X);
-            shape.SetValue<double>(Canvas.TopProperty, location.Y + offset.Y);
+            foreach(Shape shape in shapes)
+            {
+                Point location = new 
Point((double)shape.GetValue(Canvas.LeftProperty), 
(double)shape.GetValue(Canvas.TopProperty));
+                shape.SetValue<double>(Canvas.LeftProperty, location.X + 
offset.X);
+                shape.SetValue<double>(Canvas.TopProperty, location.Y + 
offset.Y);
+            }
         }
     }
 }

Modified: trunk/lunareclipse/Model/Draw/SelectionDraw.cs
===================================================================
--- trunk/lunareclipse/Model/Draw/SelectionDraw.cs      2007-06-29 20:35:47 UTC 
(rev 81076)
+++ trunk/lunareclipse/Model/Draw/SelectionDraw.cs      2007-06-29 20:38:42 UTC 
(rev 81077)
@@ -197,8 +197,7 @@
                 Point start = mouseStart;
                 start.Offset(-mouseLocation.X, -mouseLocation.Y);
                 Console.WriteLine("Offset is: " + start.ToString());
-                foreach(Shape s in selectedObjects)
-                    controller.UndoEngine.PushUndo(new UndoMoveShape(s, 
start));
+                controller.UndoEngine.PushUndo(new 
UndoMoveShape(selectedObjects.ToArray(), start));
             }
         }
         

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

Reply via email to