Get rid of all references to the bootstrap script since it was removed
[synfig.git] / synfig-studio / trunk / src / gtkmm / layertree.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file layertree.h
3 **      \brief Template Header
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_STUDIO_LAYERTREE_H
26 #define __SYNFIG_STUDIO_LAYERTREE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <gtkmm/treeview.h>
31 #include <gtkmm/treestore.h>
32 #include <gtkmm/tooltips.h>
33 #include <gtkmm/table.h>
34 #include <gtkmm/box.h>
35 #include <gtkmm/adjustment.h>
36 #include <gtkmm/scale.h>
37 #include <gtkmm/button.h>
38
39 #include <synfigapp/canvasinterface.h>
40 #include <synfigapp/value_desc.h>
41 #include "layertreestore.h"
42 #include "layerparamtreestore.h"
43 #include <synfig/valuenode_animated.h>
44
45 #include "widget_value.h"
46
47 /* === M A C R O S ========================================================= */
48
49 /* === T Y P E D E F S ===================================================== */
50
51 /* === C L A S S E S & S T R U C T S ======================================= */
52
53 namespace Gtk { class TreeModelSort; };
54
55 namespace studio {
56
57 class CellRenderer_TimeTrack;
58 class CellRenderer_ValueBase;
59
60 class LayerTree : public Gtk::Table
61 {
62         /*
63  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
64         */
65
66 public:
67
68         typedef studio::ColumnID ColumnID;
69 /*      enum ColumnID
70         {
71                 COLUMNID_NAME,
72                 COLUMNID_VALUE,
73                 COLUMNID_TIME_TRACK,
74
75                 COLUMNID_END                    //!< \internal
76         };
77 */
78         typedef std::list<synfig::Layer::Handle> LayerList;
79
80         /*
81  -- ** -- P U B L I C  D A T A ------------------------------------------------
82         */
83
84 public:
85
86         //LayerTreeStore::Model model;
87
88         LayerTreeStore::Model layer_model;
89         LayerParamTreeStore::Model param_model;
90
91         synfig::Layer::Handle last_top_selected_layer;
92         Gtk::TreePath last_top_selected_path;
93
94         /*
95  -- ** -- P R I V A T E   D A T A ---------------------------------------------
96         */
97
98 private:
99
100         Gtk::Tooltips tooltips_;
101         Gtk::TreePath last_tooltip_path;
102
103
104
105         Gtk::TreeView* layer_tree_view_;
106
107         Gtk::TreeView* param_tree_view_;
108
109
110
111         Gtk::HBox *hbox;
112
113         Gtk::Adjustment layer_amount_adjustment_;
114
115         Gtk::HScale *layer_amount_hscale;
116
117         synfig::Layer::Handle quick_layer;
118
119         Glib::RefPtr<LayerTreeStore> layer_tree_store_;
120
121         Glib::RefPtr<LayerParamTreeStore> param_tree_store_;
122
123         Glib::RefPtr<Gtk::TreeModelSort> sorted_layer_tree_store_;
124
125 //      CellRenderer_TimeTrack *cellrenderer_time_track;
126
127         Gtk::TreeView::Column* column_time_track;
128
129         Gtk::TreeView::Column* column_z_depth;
130
131         CellRenderer_ValueBase *cellrenderer_value;
132
133         sigc::signal<void,synfig::Layer::Handle> signal_layer_toggle_;
134
135         sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase> signal_edited_value_;
136
137         sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_layer_user_click_;
138
139         sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_param_user_click_;
140
141         sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int> signal_waypoint_clicked_;
142
143         bool disable_amount_changed_signal;
144
145         Gtk::Button *button_raise;
146         Gtk::Button *button_lower;
147         Gtk::Button *button_duplicate;
148         Gtk::Button *button_delete;
149
150         Widget_ValueBase blend_method_widget;
151
152         /*
153  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
154         */
155
156 private:
157
158         Gtk::Widget* create_layer_tree();
159         Gtk::Widget* create_param_tree();
160
161         /*
162  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
163         */
164
165 private:
166
167         void on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value);
168
169         void on_layer_renamed(const Glib::ustring&path_string,const Glib::ustring& value);
170
171         void on_layer_toggle(const Glib::ustring& path_string);
172
173         void on_waypoint_clicked(const Glib::ustring &, synfig::Waypoint, int button);
174
175         void on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node);
176
177         bool on_layer_tree_event(GdkEvent *event);
178
179         bool on_param_tree_event(GdkEvent *event);
180
181         void on_selection_changed();
182
183         void on_dirty_preview();
184
185         void on_amount_value_changed();
186
187         void on_blend_method_changed();
188
189 public:
190
191         void on_raise_pressed();
192
193         void on_lower_pressed();
194
195         void on_duplicate_pressed();
196
197         void on_delete_pressed();
198
199         /*
200  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
201         */
202
203 public:
204
205         //Gtk::TreeView* get_param_tree_view() { return param_tree_view_; }
206         //Gtk::TreeView& param_tree_view() { return *param_tree_view_; }
207         Gtk::HBox& get_hbox() { return *hbox; }
208
209         Gtk::TreeView& get_layer_tree_view() { return *layer_tree_view_; }
210         Gtk::TreeView& get_param_tree_view() { return *param_tree_view_; }
211
212         const Gtk::TreeView& get_layer_tree_view()const { return *layer_tree_view_; }
213         const Gtk::TreeView& get_param_tree_view()const { return *param_tree_view_; }
214
215         Glib::RefPtr<Gtk::TreeSelection> get_selection() { return get_layer_tree_view().get_selection(); }
216         Glib::SignalProxy1< bool,GdkEvent* >  signal_event () { return get_layer_tree_view().signal_event(); }
217
218         LayerTree();
219         ~LayerTree();
220
221         void set_model(Glib::RefPtr<LayerTreeStore> layer_tree_store_);
222
223         void set_time_adjustment(Gtk::Adjustment &adjustment);
224
225         void set_show_timetrack(bool x=true);
226
227         //! Signal called when layer is toggled.
228         sigc::signal<void,synfig::Layer::Handle>& signal_layer_toggle() { return signal_layer_toggle_; }
229
230         //! Signal called with a value has been edited.
231         sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase>& signal_edited_value() { return signal_edited_value_; }
232
233         sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_layer_user_click() { return signal_layer_user_click_; }
234
235         sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_param_user_click() { return signal_param_user_click_; }
236
237         sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
238
239         etl::handle<synfigapp::SelectionManager> get_selection_manager() { return layer_tree_store_->canvas_interface()->get_selection_manager(); }
240
241
242
243         void select_layer(synfig::Layer::Handle layer);
244         void select_layers(const LayerList& layer_list);
245         void select_all_children_layers(synfig::Layer::Handle layer);
246         void select_all_children(Gtk::TreeModel::Children::iterator iter);
247         LayerList get_selected_layers()const;
248         synfig::Layer::Handle get_selected_layer()const;
249         void clear_selected_layers();
250
251 }; // END of LayerTree
252
253 }; // END of namespace studio
254
255 /* === E N D =============================================================== */
256
257 #endif