The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

BackgroundTab.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/BackgroundTab.vala.
Fix translation
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 using Math; 16 using Cairo; 17 18 namespace BirdFont { 19 20 public class BackgroundTab : Glyph { 21 22 static BackgroundTab singleton; 23 24 public BackgroundTab () { 25 base ("", '\0'); 26 singleton = this; 27 28 Toolbox tools = MainWindow.get_toolbox (); 29 ZoomTool z = (ZoomTool) tools.get_tool ("zoom_tool"); 30 z.store_current_view (); 31 32 layers.add_layer (new Layer ()); 33 } 34 35 public static BackgroundTab get_instance () { 36 if (is_null (singleton)) { 37 singleton = new BackgroundTab (); 38 } 39 return singleton; 40 } 41 42 public override string get_name () { 43 return "Backgrounds"; 44 } 45 46 public override string get_label () { 47 return t_("Background Image"); 48 } 49 50 public override void selected_canvas () { 51 base.selected_canvas (); 52 53 GlyphCanvas canvas = MainWindow.get_glyph_canvas (); 54 GlyphCollection gc = new GlyphCollection ('\0', ""); 55 56 GlyphMaster master = new GlyphMaster (); 57 master.add_glyph (this); 58 gc.add_master (master); 59 60 canvas.set_current_glyph_collection (gc, false); 61 DrawingTools.background_scale.set_tool_visibility (true); 62 ZoomTool.zoom_full_background_image (); 63 } 64 65 public override void draw (WidgetAllocation allocation, Context cr) { 66 base.draw (allocation, cr); 67 Tool t = Toolbox.background_tools.select_background; 68 t.draw_action (t, cr, this); 69 } 70 } 71 72 } 73