The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Zoom bar in spacing tab

These changes was commited to the Birdfont repository Mon, 16 Mar 2015 11:35:57 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 16 Mar 2015 11:35:57 +0000 (12:35 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 16 Mar 2015 11:35:57 +0000 (12:35 +0100)
commit acff38d3a0620684a1e1ff4c31245518cf6868ee
tree 7deb645796821bcba397b635f692bc0b54a8d7af
parent 174563b4ad93b7f31a921280536e2dfdaf56b286
Zoom bar in spacing tab

libbirdfont/SpacingTools.vala [new ]
libbirdfont/Toolbox.vala
--- /dev/null +++ b/libbirdfont/SpacingTools.vala @@ -1,1 +1,56 @@ + /* + 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; + } + } + + }
--- 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 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 @@ 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 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;