[ease] Added SVGs for handles, flip colors when dragged.



commit d31f61488d8c25484195820be35ed499ed09aebe
Author: Nate Stedman <natesm gmail com>
Date:   Wed Jun 9 18:25:36 2010 -0400

    Added SVGs for handles, flip colors when dragged.

 Makefile.am               |    3 ++
 data/svg/handle-black.svg |   74 +++++++++++++++++++++++++++++++++++++++++++++
 data/svg/handle-white.svg |   74 +++++++++++++++++++++++++++++++++++++++++++++
 src/EditorEmbed.vala      |    2 +
 src/Handle.vala           |   43 ++++++++++++++++++--------
 5 files changed, 183 insertions(+), 13 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index cf8da45..d43f432 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -94,3 +94,6 @@ Applications_DATA = data/ease.desktop.in
 themedir = $(datadir)/ease/themes
 theme_DATA = themes/*.easetheme
 
+svgdir = $(datadir)/ease/svg
+svg_DATA = data/svg/*.svg
+
diff --git a/data/svg/handle-black.svg b/data/svg/handle-black.svg
new file mode 100644
index 0000000..30a4b30
--- /dev/null
+++ b/data/svg/handle-black.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="20"
+   height="20"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.47 r22583"
+   sodipodi:docname="handle-white.svg">
+  <defs
+     id="defs4">
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       id="perspective10" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="16"
+     inkscape:cx="18.859306"
+     inkscape:cy="8.397238"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1440"
+     inkscape:window-height="850"
+     inkscape:window-x="0"
+     inkscape:window-y="25"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1032.3622)">
+    <path
+       sodipodi:type="arc"
+       style="fill:#000000;stroke:#ffffff;stroke-width:0.66898363999999999"
+       id="path2816"
+       sodipodi:cx="4.2300138"
+       sodipodi:cy="2.3854649"
+       sodipodi:rx="4.2300138"
+       sodipodi:ry="2.3991122"
+       d="m 8.4600277,2.3854649 a 4.2300138,2.3991122 0 1 1 -8.4600277,0 4.2300138,2.3991122 0 1 1 8.4600277,0 z"
+       transform="matrix(2.1394194,0,0,3.7721344,0.95022624,1033.3639)" />
+  </g>
+</svg>
diff --git a/data/svg/handle-white.svg b/data/svg/handle-white.svg
new file mode 100644
index 0000000..2466b1f
--- /dev/null
+++ b/data/svg/handle-white.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="20"
+   height="20"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.47 r22583"
+   sodipodi:docname="New document 1">
+  <defs
+     id="defs4">
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       id="perspective10" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="16"
+     inkscape:cx="18.859306"
+     inkscape:cy="8.397238"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1440"
+     inkscape:window-height="850"
+     inkscape:window-x="0"
+     inkscape:window-y="25"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1032.3622)">
+    <path
+       sodipodi:type="arc"
+       style="fill:#ffffff;stroke:#000000;stroke-width:0.66898364"
+       id="path2816"
+       sodipodi:cx="4.2300138"
+       sodipodi:cy="2.3854649"
+       sodipodi:rx="4.2300138"
+       sodipodi:ry="2.3991122"
+       d="m 8.4600277,2.3854649 a 4.2300138,2.3991122 0 1 1 -8.4600277,0 4.2300138,2.3991122 0 1 1 8.4600277,0 z"
+       transform="matrix(2.1394194,0,0,3.7721344,0.95022624,1033.3639)" />
+  </g>
+</svg>
diff --git a/src/EditorEmbed.vala b/src/EditorEmbed.vala
index c2bbe75..11f64ea 100644
--- a/src/EditorEmbed.vala
+++ b/src/EditorEmbed.vala
@@ -422,6 +422,7 @@ public class Ease.EditorEmbed : ScrollableEmbed
 	 */
 	public bool handle_clicked(Clutter.Actor sender, Clutter.ButtonEvent event)
 	{
+		(sender as Handle).flip();
 		is_dragging = true;
 		is_drag_ready = false;
 		sender.motion_event.connect(handle_motion);
@@ -444,6 +445,7 @@ public class Ease.EditorEmbed : ScrollableEmbed
 	{
 		if (is_dragging)
 		{
+			(sender as Handle).flip();
 			is_dragging = false;
 			sender.motion_event.disconnect(handle_motion);
 			
diff --git a/src/Handle.vala b/src/Handle.vala
index ffb5ff0..110d461 100644
--- a/src/Handle.vala
+++ b/src/Handle.vala
@@ -18,31 +18,31 @@
 /**
  * Interface element for manipulating the size of { link Actor}s.
  */
-public class Ease.Handle : Clutter.Rectangle
+public class Ease.Handle : Clutter.Texture
 {	
 	// the position of this handle
 	private HandlePosition position;
 	
+	// if the handle has been "flipped"
+	private bool flipped = false;
+	
 	// constants
-	public const float SIZE = 50;
+	public const float SIZE = 20;
+	public const string W_PATH = "/usr/local/share/ease/svg/handle-white.svg";
+	public const string B_PATH = "/usr/local/share/ease/svg/handle-black.svg";
 	
 	public Handle(HandlePosition pos)
 	{
-		// set the rectangle's position
+		// set the handle's position
 		position = pos;
 
-		// set the rectangle's color
-		color = {0, 0, 0, 255};
-
-		// set the rectangle's border
-		border_width = 2;
-		border_color = {255, 255, 255, 255};
+		// load the handle texture
+		filename = W_PATH;
 
-		// set the rectangle's size
-		width = SIZE;
-		height = SIZE;
-		set_anchor_point(SIZE / 2, SIZE / 2);
+		// set the handle's anchor
+		set_anchor_point(width / 2, height / 2);
 		
+		// react to clicks
 		reactive = true;
 	}
 	
@@ -181,5 +181,22 @@ public class Ease.Handle : Clutter.Rectangle
 				break;
 		}
 	}
+	
+	/**
+	 * Flips the colors of the handle.
+	 */
+	public void flip()
+	{
+		if (flipped)
+		{
+			filename = W_PATH;
+		}
+		else
+		{
+			filename = B_PATH;
+		}
+		
+		flipped = !flipped;
+	}
 }
 



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