[ease] [editor] Added a more visible selection rectangle



commit 7c3ad3e7d0f7eaf534ce0149c485a2e264503088
Author: Nate Stedman <natesm gmail com>
Date:   Sat Jul 24 18:19:45 2010 -0400

    [editor] Added a more visible selection rectangle
    
    - The old selection rectangle was invisible on black
    - New SelectionRectangle class uses white with black
      border, and thus is visible everywhere.

 Makefile.am                       |    1 +
 src/ease-editor-embed.vala        |    7 +--
 src/ease-selection-rectangle.vala |   74 +++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+), 5 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 823b546..791988f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,6 +39,7 @@ ease_SOURCES = \
 	src/ease-pdf-exporter.vala \
 	src/ease-player.vala \
 	src/ease-scrollable-embed.vala \
+	src/ease-selection-rectangle.vala \
 	src/ease-slide-actor.vala \
 	src/ease-slide-button-panel.vala \
 	src/ease-slide-pane.vala \
diff --git a/src/ease-editor-embed.vala b/src/ease-editor-embed.vala
index 521563e..a16111f 100644
--- a/src/ease-editor-embed.vala
+++ b/src/ease-editor-embed.vala
@@ -37,7 +37,7 @@ public class Ease.EditorEmbed : ScrollableEmbed
 	/**
 	 * The rectangle displayed around selected { link Actor}s.
 	 */
-	private Clutter.Rectangle selection_rectangle;
+	private SelectionRectangle selection_rectangle;
 	
 	/**
 	 * The { link Handle}s attached to the selection rectangle.
@@ -428,10 +428,7 @@ public class Ease.EditorEmbed : ScrollableEmbed
 		selected = sender as Actor;
 		
 		// make a new selection rectangle
-		selection_rectangle = new Clutter.Rectangle();
-		selection_rectangle.border_color = {0, 0, 0, 255};
-		selection_rectangle.color = {0, 0, 0, 0};
-		selection_rectangle.border_width = 2;
+		selection_rectangle = new SelectionRectangle();
 		position_selection();
 		contents.add_actor(selection_rectangle);
 		
diff --git a/src/ease-selection-rectangle.vala b/src/ease-selection-rectangle.vala
new file mode 100644
index 0000000..b3a2ea7
--- /dev/null
+++ b/src/ease-selection-rectangle.vala
@@ -0,0 +1,74 @@
+/*  Ease, a GTK presentation application
+    Copyright (C) 2010 Nate Stedman
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * Rectangle displayed around the border of selected { link Actor}s.
+ */
+public class Ease.SelectionRectangle : Clutter.Group
+{
+	private Clutter.Rectangle top;
+	private Clutter.Rectangle bottom;
+	private Clutter.Rectangle left;
+	private Clutter.Rectangle right;
+	
+	private const Clutter.Color INNER_COLOR = { 255, 255, 255, 255 };
+	private const Clutter.Color OUTER_COLOR = { 0, 0, 0, 255 };
+	private const int HEIGHT = 6;
+	private const int BORDER = 2;
+	
+	public SelectionRectangle()
+	{
+		make(out top);
+		make(out bottom);
+		make(out left);
+		make(out right);
+		
+		top.height = HEIGHT;
+		top.anchor_y = HEIGHT / 2;
+		
+		bottom.height = HEIGHT;
+		bottom.anchor_y = HEIGHT / 2;
+		
+		left.width = HEIGHT;
+		left.anchor_x = HEIGHT / 2;
+		
+		right.width = HEIGHT;
+		right.anchor_x = HEIGHT / 2;
+		
+		notify["width"].connect((self, pspec) => {
+			top.width = width;
+			bottom.width = width;
+			right.x = width;
+		});
+		
+		notify["height"].connect((self, pspec) => {
+			left.height = height;
+			right.height = height;
+			bottom.y = height;
+		});
+	}
+	
+	private void make(out Clutter.Rectangle rect)
+	{
+		rect = new Clutter.Rectangle();
+		rect.color = INNER_COLOR;
+		rect.border_color = OUTER_COLOR;
+		rect.border_width = BORDER;
+		add_actor(rect);
+	}
+}
+



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