The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

SpacingClassTools.vala in /libbirdfont

This file is a part of the Birdfont project.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
Circle boundaries heads/master
1 /* 2 Copyright (C) 2016 Johan Mattsson 3 4 This library is free software; you can redistribute it and/or modify 5 it under the terms of the GNU Lesser General Public License as 6 published by the Free Software Foundation; either version 3 of the 7 License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 */ 14 15 using Cairo; 16 using Math; 17 18 namespace BirdFont { 19 20 public class SpacingClassTools : ToolCollection { 21 public static Gee.ArrayList<Expander> expanders; 22 23 public SpacingClassTools () { 24 expanders = new Gee.ArrayList<Expander> (); 25 26 Expander font_name = new Expander (); 27 font_name.add_tool (new FontName ()); 28 29 Expander spacing_class_tools = new Expander (); 30 Tool insert = new Tool ("insert_glyph_from_overview_in_spacing_class", t_("Insert glyph from overview")); 31 32 insert.set_icon ("insert_glyph_from_overview"); 33 34 insert.select_action.connect ((self) => { 35 GlyphSelection glyph_selection = new GlyphSelection (); 36 37 glyph_selection.selected_glyph.connect ((glyph_collection) => { 38 SpacingClassTab.set_class (glyph_collection.get_name ()); 39 MainWindow.get_tab_bar ().select_tab_name ("SpacingClasses"); 40 }); 41 42 GlyphCanvas.set_display (glyph_selection); 43 self.set_selected (false); 44 45 TabContent.hide_text_input (); 46 }); 47 spacing_class_tools.add_tool (insert); 48 49 expanders.add (font_name); 50 51 expanders.add (spacing_class_tools); 52 } 53 54 public override Gee.ArrayList<Expander> get_expanders () { 55 return expanders; 56 } 57 58 public override Gee.ArrayList<string> get_displays () { 59 Gee.ArrayList<string> d = new Gee.ArrayList<string> (); 60 d.add ("SpacingClasses"); 61 return d; 62 } 63 64 } 65 66 } 67