Clone in a terminal:
Commit 1f22054
Johan Mattsson - 2012-09-22T11:10:40+00:00
1f22054fb66dcd79d14d86ab87cb8e0b9080db60johan.mattsson.m@gmail.com

copy paths instead of glyphs

Changed files (2)

Diff

diff --git a/src/ClipTool.vala b/src/ClipTool.valaindex 58f086d..20491ab 100644--- a/src/ClipTool.vala+++ b/src/ClipTool.vala@@ -20,29 +20,33 @@ namespace Supplement { class ClipTool : Tool {  	static Glyph? glyph = null; -	static Path? path = null; +	static List<Path> path = new List<Path> ();  	public static void copy () { 		Font font = Supplement.get_current_font (); 		OverView overview  = MainWindow.get_overview (); 		FontDisplay fd = MainWindow.get_current_display (); 		string gc;-		+		Glyph g = MainWindow.get_current_glyph ();++		glyph = null;++		while (path.length () > 0) {+			path.remove_link (path.first ());+		}+					 		if (fd is OverView) { 			gc = overview.get_selected_char ();-			-			print (@"SELECTED: $gc \n");-			 			glyph = font.get_glyph (gc);-			path = null;-		}-+		} +		 		if (fd is Glyph) {-			glyph = null;-			path = MainWindow.get_current_glyph ().get_active_path ();-			-			if (path == null) {-				glyph = MainWindow.get_current_glyph ();+			foreach (Path p in g.active_paths) {+				path.append (p.copy ());+			}++			if (path.length () == 0) {+				glyph = g.copy (); 			} 		} @@ -55,7 +59,8 @@ class ClipTool : Tool { 		string gc; 		Glyph? destination = null; 		unichar new_char;-				+		Path inserted;+		 		if (fd is OverView) { 			gc = overview.get_selected_char (); 			destination = font.get_glyph (gc);@@ -69,25 +74,27 @@ class ClipTool : Tool { 		 		if (fd is Glyph) { 			destination = (Glyph) fd;-		}-		-		return_if_fail (destination != null); -		if (destination == glyph) {-			return;-		}+			if (destination == glyph) {+				return;+			} 			-		if (glyph != null) {-			foreach (Path p in ((!)glyph).path_list) {-				((!)destination).add_path (p.copy ());+			((!)destination).store_undo_state ();+			+			if (glyph != null) {+				foreach (Path p in ((!)glyph).path_list) {+					inserted = p.copy ();+					((!)destination).add_path (inserted);+				} 			}-		} -		if (path != null) {-			((!)destination).add_path (((!)path).copy ());+			foreach (Path p in path) {+				inserted = p.copy ();+				((!)destination).add_path (inserted);+			}+			+			((!)destination).update_view (); 		}-		-		((!)destination).update_view (); 	}  }diff --git a/src/Glyph.vala b/src/Glyph.valaindex 91abfd0..a64aee7 100644--- a/src/Glyph.vala+++ b/src/Glyph.vala@@ -38,12 +38,8 @@ class Glyph : FontDisplay { 	int zoom_list_index = 0; 	 	// Paths-	public List<Path> path_list;	// outline // FIXME: private+	public List<Path> path_list; 	public List<Path> active_paths = new List<Path> ();-	-	bool move_edit_point = false;-	double last_move_offset_x = 0;-	double last_move_offset_y = 0;  	// Control points 	public EditPoint? new_point_on_path = null;@@ -555,7 +551,6 @@ class Glyph : FontDisplay { 			t.release_action (t, (int) event.button, (int) event.x, (int) event.y); 		} 		-		move_edit_point = false; 		update_view (); 	} @@ -610,7 +605,6 @@ class Glyph : FontDisplay { 	 */ 	public EditPoint add_new_edit_point (int x, int y) { 		insert_edit_point (x, y);-		move_edit_point = true; 		 		return_if_fail (active_paths.length () > 0); 		

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112