1 /* === S Y N F I G ========================================================= */
3 ** \brief Template Header
5 ** $Id: layertree.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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.
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.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_STUDIO_LAYERTREE_H
26 #define __SYNFIG_STUDIO_LAYERTREE_H
28 /* === H E A D E R S ======================================================= */
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>
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>
45 #include "widget_value.h"
47 /* === M A C R O S ========================================================= */
49 /* === T Y P E D E F S ===================================================== */
51 /* === C L A S S E S & S T R U C T S ======================================= */
53 namespace Gtk { class TreeModelSort; };
57 class CellRenderer_TimeTrack;
58 class CellRenderer_ValueBase;
60 class LayerTree : public Gtk::Table
63 -- ** -- P U B L I C T Y P E S ---------------------------------------------
68 typedef studio::ColumnID ColumnID;
75 COLUMNID_END //!< \internal
78 typedef std::list<synfig::Layer::Handle> LayerList;
81 -- ** -- P U B L I C D A T A ------------------------------------------------
86 //LayerTreeStore::Model model;
88 LayerTreeStore::Model layer_model;
89 LayerParamTreeStore::Model param_model;
91 synfig::Layer::Handle last_top_selected_layer;
92 Gtk::TreePath last_top_selected_path;
95 -- ** -- P R I V A T E D A T A ---------------------------------------------
100 Gtk::Tooltips tooltips_;
101 Gtk::TreePath last_tooltip_path;
105 Gtk::TreeView* layer_tree_view_;
107 Gtk::TreeView* param_tree_view_;
113 Gtk::Adjustment layer_amount_adjustment_;
115 Gtk::HScale *layer_amount_hscale;
117 synfig::Layer::Handle quick_layer;
119 Glib::RefPtr<LayerTreeStore> layer_tree_store_;
121 Glib::RefPtr<LayerParamTreeStore> param_tree_store_;
123 Glib::RefPtr<Gtk::TreeModelSort> sorted_layer_tree_store_;
125 // CellRenderer_TimeTrack *cellrenderer_time_track;
127 Gtk::TreeView::Column* column_time_track;
129 Gtk::TreeView::Column* column_z_depth;
131 CellRenderer_ValueBase *cellrenderer_value;
133 sigc::signal<void,synfig::Layer::Handle> signal_layer_toggle_;
135 sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase> signal_edited_value_;
137 sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_layer_user_click_;
139 sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_param_user_click_;
141 sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int> signal_waypoint_clicked_;
143 bool disable_amount_changed_signal;
145 Gtk::Button *button_raise;
146 Gtk::Button *button_lower;
147 Gtk::Button *button_duplicate;
148 Gtk::Button *button_delete;
150 Widget_ValueBase blend_method_widget;
153 -- ** -- P R I V A T E M E T H O D S ---------------------------------------
158 Gtk::Widget* create_layer_tree();
159 Gtk::Widget* create_param_tree();
162 -- ** -- S I G N A L T E R M I N A L S -------------------------------------
167 void on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value);
169 void on_layer_toggle(const Glib::ustring& path_string);
171 void on_waypoint_clicked(const Glib::ustring &, synfig::Waypoint, int button);
173 void on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node);
175 bool on_layer_tree_event(GdkEvent *event);
177 bool on_param_tree_event(GdkEvent *event);
179 void on_selection_changed();
181 void on_dirty_preview();
183 void on_amount_value_changed();
185 void on_blend_method_changed();
189 void on_raise_pressed();
191 void on_lower_pressed();
193 void on_duplicate_pressed();
195 void on_delete_pressed();
198 -- ** -- P U B L I C M E T H O D S -----------------------------------------
203 //Gtk::TreeView* get_param_tree_view() { return param_tree_view_; }
204 Gtk::TreeView& param_tree_view() { return *param_tree_view_; }
205 Gtk::HBox& get_hbox() { return *hbox; }
207 Gtk::TreeView& get_layer_tree_view() { return *layer_tree_view_; }
208 Gtk::TreeView& get_param_tree_view() { return *param_tree_view_; }
210 const Gtk::TreeView& get_layer_tree_view()const { return *layer_tree_view_; }
211 const Gtk::TreeView& get_param_tree_view()const { return *param_tree_view_; }
213 Glib::RefPtr<Gtk::TreeSelection> get_selection() { return get_layer_tree_view().get_selection(); }
214 Glib::SignalProxy1< bool,GdkEvent* > signal_event () { return get_layer_tree_view().signal_event(); }
219 void set_model(Glib::RefPtr<LayerTreeStore> layer_tree_store_);
221 void set_time_adjustment(Gtk::Adjustment &adjustment);
223 void set_show_timetrack(bool x=true);
225 //! Signal called when layer is toggled.
226 sigc::signal<void,synfig::Layer::Handle>& signal_layer_toggle() { return signal_layer_toggle_; }
228 //! Signal called with a value has been edited.
229 sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase>& signal_edited_value() { return signal_edited_value_; }
231 sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_layer_user_click() { return signal_layer_user_click_; }
233 sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_param_user_click() { return signal_param_user_click_; }
235 sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
237 etl::handle<synfigapp::SelectionManager> get_selection_manager() { return layer_tree_store_->canvas_interface()->get_selection_manager(); }
241 void select_layer(synfig::Layer::Handle layer);
242 void select_layers(const LayerList& layer_list);
243 void select_all_children_layers(synfig::Layer::Handle layer);
244 void select_all_children(Gtk::TreeModel::Children::iterator iter);
245 LayerList get_selected_layers()const;
246 synfig::Layer::Handle get_selected_layer()const;
247 void clear_selected_layers();
249 }; // END of LayerTree
251 }; // END of namespace studio
253 /* === E N D =============================================================== */