Clone in a terminal:
Commit ac6d24d
Johan Mattsson - 2015-06-04T07:37:03+00:00
ac6d24d1d4540e6e9c9830302c2119ccd86f439ajohan.mattsson.m@gmail.com

Select paths in layer

Changed files (5)

Diff

diff --git a/libbirdfont/BirdFontFile.vala b/libbirdfont/BirdFontFile.valaindex 9ae830b..5e78ca6 100644--- a/libbirdfont/BirdFontFile.vala+++ b/libbirdfont/BirdFontFile.vala@@ -247,7 +247,7 @@ class BirdFontFile : GLib.Object { 		os.put_string ("""<?xml version="1.0" encoding="utf-8" standalone="yes"?>"""); 		os.put_string ("\n"); 		os.put_string ("<font>\n");-		os.put_string (@"\t<format>$FORMAT_MAJOR.$FORMAT_MINOR</format>\n");+		os.put_string (@"<format>$FORMAT_MAJOR.$FORMAT_MINOR</format>\n"); 	} 	 	public void write_closing_root_tag (DataOutputStream os) throws GLib.Error {diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex f2841b5..b769e82 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -1580,7 +1580,8 @@ public class DrawingTools : ToolCollection  { 		layer_tools.tool.clear (); 		foreach (Layer layer in g.layers.subgroups) {  			LayerLabel label = new LayerLabel ("Layer", layer);-			layer_tools.add_tool (label);+			layer_tools.add_tool (label, 0);+			label.select_layer (); 		} 		 		MainWindow.get_toolbox ().update_expanders ();diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 6e26cd4..8ba7385 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -192,7 +192,7 @@ public class Glyph : FontDisplay { 		return empty; 	} -	public void clear_active_paths () {+	public void clear_active_paths () {	 		active_paths.clear (); 	} 	@@ -1076,7 +1076,7 @@ public class Glyph : FontDisplay { 		Path? p = null; 		bool found = false; 		-		foreach (Path pt in get_visible_paths ()) {+		foreach (Path pt in get_current_layer ()) { 			if (pt.is_over (x, y)) { 				p = pt; 				found = true;@@ -1596,8 +1596,7 @@ public class Glyph : FontDisplay { 		if (!is_open ()) { 			// This was good for testing but it is way too slow: 			// Svg.draw_svg_path (cr, get_svg_data (), Glyph.xc () + left, Glyph.yc () - baseline);-		-				+			 			cr.save (); 			cr.new_path (); 			foreach (Path p in get_visible_paths ()) {diff --git a/libbirdfont/LayerLabel.vala b/libbirdfont/LayerLabel.valaindex 98741d2..6fa9946 100644--- a/libbirdfont/LayerLabel.vala+++ b/libbirdfont/LayerLabel.vala@@ -47,10 +47,10 @@ public class LayerLabel : Tool { 				} if (tx < 25 * Toolbox.get_scale ()) { 					layer.visible = !layer.visible; 					GlyphCanvas.redraw ();+					BirdFont.get_current_font ().touch ();+					MainWindow.get_current_glyph ().clear_active_paths (); 				} else {-					MainWindow.get_current_glyph ().current_layer = layer;-					DrawingTools.deselect_layers ();-					selected_layer = true;+					select_layer (); 				} 			} else { 				selected_layer = false;@@ -58,6 +58,14 @@ public class LayerLabel : Tool { 		}); 	} 	+	public void select_layer () {+		MainWindow.get_current_glyph ().current_layer = layer;+		DrawingTools.deselect_layers ();+		selected_layer = true;+		MainWindow.get_current_glyph ().clear_active_paths ();+		GlyphCanvas.redraw ();+	}+	 	public void remove_layer () { 		// remove layer after the click loop 		IdleSource idle = new IdleSource ();@@ -66,6 +74,9 @@ public class LayerLabel : Tool { 			Glyph g = MainWindow.get_current_glyph (); 			g.layers.remove_layer (layer); 			DrawingTools.update_layers ();+			BirdFont.get_current_font ().touch ();+			MainWindow.get_current_glyph ().clear_active_paths ();+			GlyphCanvas.redraw (); 			return false; 		}); 		diff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 75e484a..fe235e0 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -80,8 +80,6 @@ public class Path { 	 	public string point_data = ""; -	static int n_paths = 0;-	 	public Path () {	 		string width; 		@@ -95,15 +93,8 @@ public class Path { 		if (stroke_width < 1) { 			stroke_width = 1; 		}-	-		n_paths++; 	} -	~Path () {-		point_data = "";-		n_paths--;-	}-	 	public bool is_filled () { 		return fill; 	}

Contact

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