The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

GuideTab.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) 2015 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 using Cairo; 15 using Math; 16 17 namespace BirdFont { 18 19 public class GuideTab : Table { 20 21 Gee.ArrayList<Row> rows = new Gee.ArrayList<Row> (); 22 23 public GuideTab () { 24 } 25 26 public override Gee.ArrayList<Row> get_rows () { 27 return rows; 28 } 29 30 public override void selected_row (Row row, int column, bool delete_button) { 31 Font font = BirdFont.get_current_font (); 32 int index = row.get_index (); 33 34 if (delete_button) { 35 return_if_fail (0 <= index < font.custom_guides.size); 36 BirdFont.get_current_font ().custom_guides.remove_at (index); 37 update_rows (); 38 } 39 } 40 41 public override void update_rows () { 42 int i = 0; 43 44 rows.clear (); 45 46 rows.add (new Row.headline (t_("Guides"))); 47 48 foreach (Line guide in BirdFont.get_current_font ().custom_guides) { 49 rows.add (new Row.columns_1 (guide.label, i)); 50 i++; 51 } 52 53 GlyphCanvas.redraw (); 54 } 55 56 public override string get_label () { 57 return t_("Guides"); 58 } 59 60 public override string get_name () { 61 return "Guides"; 62 } 63 } 64 65 } 66