[ease] [editor] Added a rectangle around actors.



commit 378d5848cc4a285428dabf72d1e39cfb716d7a97
Author: Nate Stedman <natesm gmail com>
Date:   Fri Jul 2 03:11:08 2010 -0400

    [editor] Added a rectangle around actors.

 src/ease-actor.vala |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/src/ease-actor.vala b/src/ease-actor.vala
index e8c9705..671e143 100644
--- a/src/ease-actor.vala
+++ b/src/ease-actor.vala
@@ -42,6 +42,26 @@ public abstract class Ease.Actor : Clutter.Group
 	 * If the Actor is a slide background.
 	 */
 	public bool is_background;
+	
+	/**
+	 * The rectangle surrounding the actor in the editor.
+	 */
+	private Clutter.Rectangle editor_rect;
+	
+	/**
+	 * The color of the surrounding rectangle in the editor.
+	 */
+	private const Clutter.Color RECT_COLOR = {0, 0, 0, 0};
+	
+	/**
+	 * The border color of the surrounding rectangle in the editor.
+	 */
+	private const Clutter.Color RECT_BORDER = {100, 100, 100, 255};
+	
+	/**
+	 * The widget of the surrounding rectangle in the editor.
+	 */
+	private const uint RECT_WIDTH = 1;
 
 	/**
 	 * Instantiate a new Actor
@@ -57,6 +77,17 @@ public abstract class Ease.Actor : Clutter.Group
 		element = e;
 		context = c;
 		is_background = false;
+		
+		// in the editor, draw a gray rectangle around the actor
+		if (c == ActorContext.EDITOR)
+		{
+			editor_rect = new Clutter.Rectangle.with_color(RECT_COLOR);
+			editor_rect.border_color = RECT_BORDER;
+			editor_rect.border_width = RECT_WIDTH;
+			editor_rect.width = e.width;
+			editor_rect.height = e.height;
+			add_actor(editor_rect);
+		}
 	}
 	
 	/**
@@ -72,6 +103,12 @@ public abstract class Ease.Actor : Clutter.Group
 		height = element.height;
 		contents.width = width;
 		contents.height = height;
+		
+		if (editor_rect != null)
+		{
+			editor_rect.width = width;
+			editor_rect.height = height;
+		}
 	}
 	
 	/**
@@ -126,7 +163,13 @@ public abstract class Ease.Actor : Clutter.Group
 		}
 		
 		element.width = width;
-		element.height = height;	
+		element.height = height;
+		
+		if (editor_rect != null)
+		{
+			editor_rect.width = width;
+			editor_rect.height = height;
+		}	
 	}
 	
 	/**



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