The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

GlyphSelection.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) 2014 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 namespace BirdFont { 16 17 /** A tab for picking characters in the font. */ 18 public class GlyphSelection : OverView { 19 20 public signal void selected_glyph (GlyphCollection gc); 21 22 public GlyphSelection () { 23 base (null, false, false); 24 update_default_characterset (); 25 26 OverviewTools.update_overview_characterset (this); 27 FontDisplay.dirty_scrollbar = true; 28 29 open_glyph_signal.connect ((gc) => { 30 selected_glyph (gc); 31 Toolbox.redraw_tool_box (); 32 }); 33 34 Toolbox.set_toolbox_from_tab (get_name ()); 35 36 IdleSource idle = new IdleSource (); 37 38 idle.set_callback (() => { 39 update_default_characterset (); 40 return false; 41 }); 42 43 idle.attach (null); 44 } 45 46 void update_default_characterset () { 47 if (BirdFont.get_current_font ().length () > 0) { 48 display_all_available_glyphs (); 49 } else { 50 GlyphRange gr = new GlyphRange (); 51 DefaultCharacterSet.use_default_range (gr); 52 set_current_glyph_range (gr); 53 } 54 55 update_item_list (); 56 } 57 } 58 59 } 60