[ease] undo work



commit 4cb3e4fabc61928f53a793d5b2564a091aa551f7
Author: Nate Stedman <natesm gmail com>
Date:   Thu May 20 01:10:52 2010 -0400

    undo work

 src/libease/EditorEmbed.vala |    4 ++--
 src/libease/UndoActions.vala |   14 +++++++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/libease/EditorEmbed.vala b/src/libease/EditorEmbed.vala
index 2624752..ddf4360 100644
--- a/src/libease/EditorEmbed.vala
+++ b/src/libease/EditorEmbed.vala
@@ -339,7 +339,7 @@ public class Ease.EditorEmbed : ScrollableEmbed
 			is_dragging = false;
 			Clutter.ungrab_pointer();
 			sender.motion_event.disconnect(actor_motion);
-			win.add_undo_action(new MoveUndoAction(selected,
+			win.add_undo_action(new MoveUndoAction(selected.element, selected,
 			                                       orig_x, orig_y,
 			                                       orig_w, orig_h));
 		}
@@ -425,7 +425,7 @@ public class Ease.EditorEmbed : ScrollableEmbed
 			is_dragging = false;
 			sender.motion_event.disconnect(handle_motion);
 			
-			win.add_undo_action(new MoveUndoAction(selected,
+			win.add_undo_action(new MoveUndoAction(selected.element, selected,
 			                                       orig_x, orig_y,
 			                                       orig_w, orig_h));
 		}
diff --git a/src/libease/UndoActions.vala b/src/libease/UndoActions.vala
index 60a677b..cc86321 100644
--- a/src/libease/UndoActions.vala
+++ b/src/libease/UndoActions.vala
@@ -37,7 +37,8 @@ public abstract class Ease.UndoAction : Object
  */
 public class Ease.MoveUndoAction : UndoAction
 {
-	private Actor actor;
+	private Element element;
+	private weak Actor actor;
 	private float x_pos;
 	private float y_pos;
 	private float width;
@@ -46,14 +47,15 @@ public class Ease.MoveUndoAction : UndoAction
 	/**
 	 * Creates a new MoveUndoAction.
 	 *
-	 * @param actor The { link Actor} this applies to.
+	 * @param element The { link Element} this applies to.
 	 * @param x The origin X position of the { link Actor}.
 	 * @param y The origin Y position of the { link Actor}.
 	 * @param w The origin width of the { link Actor}
 	 * @param h The origin height position of the { link Actor}
 	 */
-	public MoveUndoAction(Actor a, float x, float y, float w, float h)
+	public MoveUndoAction(Element e, float x, float y, float w, float h)
 	{
+		element = e;
 		actor = a;
 		x_pos = x;
 		y_pos = y;
@@ -63,8 +65,10 @@ public class Ease.MoveUndoAction : UndoAction
 	
 	public override void apply()
 	{
-		actor.translate(x_pos - actor.x, y_pos - actor.y);
-		actor.resize(width - actor.width, height - actor.height, false);
+		element.x = x_pos;
+		element.y = y_pos;
+		element.width = width;
+		element.height = height;
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]