The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

PointTool.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/PointTool.vala.
Ignore case in key bindings
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 using Math; 16 using Cairo; 17 18 namespace BirdFont { 19 20 /** Move control points. */ 21 public class PointTool : Tool { 22 23 public PointTool (string name) { 24 base (name, t_ ("Move control points")); 25 26 select_action.connect ((self) => { 27 }); 28 29 deselect_action.connect ((self) => { 30 }); 31 32 press_action.connect ((self, b, x, y) => { 33 Tool p = pen (); 34 if (b == 1) { 35 p.press_action (p, 3, x, y); 36 } else if (b == 2) { 37 p.press_action (p, 2, x, y); 38 } else if (b == 3) { 39 p.press_action (p, 1, x, y); 40 } 41 }); 42 43 double_click_action.connect ((self, b, x, y) => { 44 Tool p = pen (); 45 46 if (!BirdFont.android) { 47 p.double_click_action (p, b, x, y); 48 } 49 }); 50 51 release_action.connect ((self, b, x, y) => { 52 Tool p = pen (); 53 if (b == 1) { 54 p.release_action (p, 3, x, y); 55 } else if (b == 2) { 56 p.release_action (p, 2, x, y); 57 } else if (b == 3) { 58 p.release_action (p, 1, x, y); 59 } 60 }); 61 62 move_action.connect ((self, x, y) => { 63 Tool p = pen (); 64 p.move_action (p, x, y); 65 }); 66 67 key_press_action.connect ((self, keyval) => { 68 Tool p = pen (); 69 p.key_press_action (p, keyval); 70 }); 71 72 key_release_action.connect ((self, keyval) => { 73 Tool p = pen (); 74 p.key_release_action (p, keyval); 75 }); 76 77 draw_action.connect ((tool, cairo_context, glyph) => { 78 Tool p = pen (); 79 p.draw_action (p, cairo_context, glyph); 80 }); 81 } 82 83 public static Tool pen () { 84 return MainWindow.get_toolbox ().get_tool ("pen_tool"); 85 } 86 } 87 88 } 89