The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

PathList.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

Revisions

View the latest version of libbirdfont/PathList.vala.
Reset zoom when new glyphs are selected in the version list
1 /* 2 Copyright (C) 2013 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 public class PathList : GLib.Object { 18 public Gee.ArrayList<Path> paths; 19 20 public PathList () { 21 paths = new Gee.ArrayList<Path> (); 22 } 23 24 public void add_unique (Path p) { 25 if (paths.index_of (p) == -1) { 26 paths.add (p); 27 } 28 } 29 30 public void add (Path p) { 31 paths.add (p); 32 } 33 34 public void append (PathList pl) { 35 foreach (Path p in pl.paths) { 36 paths.add (p); 37 } 38 } 39 40 public void clear () { 41 paths.clear (); 42 } 43 44 public Path get_first_path () { 45 if (unlikely (paths.size == 0)) { 46 warning ("No path"); 47 return new Path (); 48 } 49 50 return paths.get (0); 51 } 52 53 public Path merge_all () { 54 Path p = get_first_path (); 55 56 for (int i = 1; i < paths.size; i++) { 57 p.append_path (paths.get (i)); 58 } 59 60 return p; 61 } 62 } 63 64 } 65