Clone in a terminal:
Commit acff38d
Johan Mattsson - 2015-03-16T11:35:57+00:00
acff38d3a0620684a1e1ff4c31245518cf6868eejohan.mattsson.m@gmail.com

Zoom bar in spacing tab

Changed files (2)

Diff

diff --git a/libbirdfont/SpacingTools.vala b/libbirdfont/SpacingTools.valanew file mode 100644index 0000000..0da04a1--- /dev/null+++ b/libbirdfont/SpacingTools.vala@@ -0,0 +1,55 @@+/*+    Copyright (C) 2015 Johan Mattsson++    This library is free software; you can redistribute it and/or modify +    it under the terms of the GNU Lesser General Public License as +    published by the Free Software Foundation; either version 3 of the +    License, or (at your option) any later version.++    This library 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 +    Lesser General Public License for more details.+*/++using Cairo;+using Math;++namespace BirdFont {++public class SpacingTools : ToolCollection  {+	public static Gee.ArrayList<Expander> expanders;++	public static ZoomBar zoom_bar;+	+	public SpacingTools () {+		expanders = new Gee.ArrayList<Expander> ();++		Expander font_name = new Expander ();+		font_name.add_tool (new FontName ());+		font_name.draw_separator = false;++		Expander zoom_expander = new Expander (t_("Font Size"));++		zoom_bar = new ZoomBar ();+		zoom_bar.new_zoom.connect ((z) => {+			KerningTools.font_size = 3 * z;+			+			if (KerningTools.font_size < 0.1) {+				KerningTools.font_size = 0.1;+			}+			+			GlyphCanvas.redraw ();+		});+		zoom_expander.add_tool (zoom_bar);+		+		expanders.add (font_name);+		expanders.add (zoom_expander);+	}+	+	public override Gee.ArrayList<Expander> get_expanders () {+		return expanders;+	}+}++}diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex eb79d5c..db073e3 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -1,5 +1,5 @@ /*-    Copyright (C) 2012 2014 Johan Mattsson+    Copyright (C) 2012 2014 2015 Johan Mattsson      This library is free software; you can redistribute it and/or modify      it under the terms of the GNU Lesser General Public License as @@ -26,6 +26,7 @@ public class Toolbox : GLib.Object  { 	public static OverviewTools overview_tools; 	public static BackgroundTools background_tools; 	public static HiddenTools hidden_tools;+	public static SpacingTools spacing_tools; 	 	Tool current_tool; 	@@ -61,6 +62,7 @@ public class Toolbox : GLib.Object  { 		overview_tools = new OverviewTools (); 		background_tools = new BackgroundTools (); 		hidden_tools = new HiddenTools ();+		spacing_tools = new SpacingTools (); 		 		tool_sets.append (drawing_tools); 		tool_sets.append (kerning_tools);@@ -80,7 +82,9 @@ public class Toolbox : GLib.Object  { 	}  	public static void set_toolbox_from_tab (string tab_name, Tab? t = null) {		-		if (tab_name == "Kerning") {+		if (tab_name == "Spacing") {+			current_set = (ToolCollection) spacing_tools;+		} else if (tab_name == "Kerning") { 			current_set = (ToolCollection) kerning_tools; 		} else if (tab_name == "Preview") { 			current_set = (ToolCollection) preview_tools;

Contact

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