.
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 add_help_lines ();
28
29 Toolbox tools = MainWindow.get_toolbox ();
30 ZoomTool z = (ZoomTool) tools.get_tool ("zoom_tool");
31 z.store_current_view ();
32 }
33
34 public static BackgroundTab get_instance () {
35 if (is_null (singleton)) {
36 singleton = new BackgroundTab ();
37 }
38 return singleton;
39 }
40
41 public override string get_name () {
42 return "Backgrounds";
43 }
44
45 public override string get_label () {
46 return t_("Background Image");
47 }
48
49 public override void selected_canvas () {
50 GlyphCanvas canvas = MainWindow.get_glyph_canvas ();
51 GlyphCollection gc = new GlyphCollection ('\0', "");
52 gc.add_glyph (this);
53 canvas.set_current_glyph_collection (gc, false);
54 DrawingTools.background_scale.set_tool_visibility (true);
55 ZoomTool.zoom_full_background_image ();
56 }
57
58 public override void draw (WidgetAllocation allocation, Context cr) {
59 base.draw (allocation, cr);
60 Tool t = Toolbox.background_tools.select_background;
61 t.draw_action (t, cr, this);
62 }
63 }
64
65 }
66