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
15using Cairo;
16using Math;
17
18namespace BirdFont {
19
20public class HiddenTools : ToolCollection  {
21
22	public Gee.ArrayList<Expander> expanders;
23	public Expander hidden_expander;
24
25	public static Tool bezier_line;
26	public static Tool bezier_corner;
27	public static Tool move_along_axis;
28
29	public HiddenTools () {
30		hidden_expander = new Expander ();
31		expanders = new Gee.ArrayList<Expander> ();
32
33		Tool zoom_in = new Tool ("zoom_in", t_("Zoom in"));
34		zoom_in.select_action.connect ((self) => {
35			DrawingTools.zoom_tool.store_current_view ();
36			GlyphCanvas.current_display.zoom_in ();
37		});
38		hidden_expander.add_tool (zoom_in);
39
40		Tool zoom_out = new Tool ("zoom_out", t_("Zoom out"));
41		zoom_out.select_action.connect ((self) => {
42			DrawingTools.zoom_tool.store_current_view ();
43			GlyphCanvas.current_display.zoom_out ();
44		});
45		hidden_expander.add_tool (zoom_out);
46
47		bezier_line = new Tool ("bezier_line", t_("Convert the last segment to a straight line"));
48		bezier_line.select_action.connect ((self) => {
49			DrawingTools.bezier_tool.switch_to_line_mode ();
50		});
51		bezier_line.is_tool_modifier = true;
52		hidden_expander.add_tool (bezier_line);
53		bezier_line.set_tool_visibility (false);
54
55		bezier_corner = new Tool ("bezier_corner", t_("Convert the last control point to a corner node"));
56		bezier_corner.select_action.connect ((self) => {
57			DrawingTools.bezier_tool.create_corner ();
58		});
59		bezier_corner.is_tool_modifier = true;
60		hidden_expander.add_tool (bezier_corner);
61		bezier_corner.set_tool_visibility (false);
62
63		move_along_axis = new Tool ("bezier", t_("Move handle along axis"));
64		move_along_axis.select_action.connect ((self) => {
65			Tool t = MainWindow.get_toolbox ().get_current_tool ();
66			if (t is BezierTool) {
67				DrawingTools.bezier_tool.move_handle_on_axis ();
68			} else if (t is PenTool || t is PointTool) {
69				PenTool.move_handle_on_axis ();
70			} else if (t is BackgroundTool) {
71				BackgroundTool.move_handle_on_axis ();
72			}
73		});
74		move_along_axis.is_tool_modifier = true;
75		hidden_expander.add_tool (move_along_axis);
76		move_along_axis.set_tool_visibility (false);
77
78		expanders.add (hidden_expander);
79	}
80
81	public override Gee.ArrayList<Expander> get_expanders () {
82		return expanders;
83	}
84}
85
86}
87