Commit ac6d24d
Select paths in layer
Changed files (5)
modifiedlibbirdfont/BirdFontFile.valamodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/LayerLabel.valamodifiedlibbirdfont/Path.vala
Diff
@@ -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 {@@ -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 ();@@ -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 ()) {@@ -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; }); @@ -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; }