- Main Page
- Related Pages
- Namespaces
- Classes
- Files

# layertree.h

Go to the documentation of this file.

    00001 /* === S Y N F I G ========================================================= */
    00022 /* ========================================================================= */
    00023
    00024 /* === S T A R T =========================================================== */
    00025
    00026 #ifndef __SYNFIG_STUDIO_LAYERTREE_H
    00027 #define __SYNFIG_STUDIO_LAYERTREE_H
    00028
    00029 /* === H E A D E R S ======================================================= */
    00030
    00031 #include <gtkmm/treeview.h>
    00032 #include <gtkmm/treestore.h>
    00033 #include <gtkmm/tooltips.h>
    00034 #include <gtkmm/table.h>
    00035 #include <gtkmm/box.h>
    00036 #include <gtkmm/adjustment.h>
    00037 #include <gtkmm/scale.h>
    00038 #include <gtkmm/button.h>
    00039
    00040 #include <synfigapp/canvasinterface.h>
    00041 #include <synfigapp/value_desc.h>
    00042 #include "layertreestore.h"
    00043 #include "layerparamtreestore.h"
    00044 #include <synfig/valuenode_animated.h>
    00045
    00046 #include "widget_value.h"
    00047
    00048 /* === M A C R O S ========================================================= */
    00049
    00050 // comment this out if you don't want the params dialog to have a 'timetrack' column
    00051 // (alternatively, export SYNFIG_DISABLE_PARAMS_PANEL_TIMETRACK=1 in environment at runtime)
    00052 #define TIMETRACK_IN_PARAMS_PANEL
    00053
    00054 /* === T Y P E D E F S ===================================================== */
    00055
    00056 /* === C L A S S E S & S T R U C T S ======================================= */
    00057
    00058 namespace Gtk { class TreeModelSort; };
    00059
    00060 namespace studio {
    00061
    00062 class CellRenderer_TimeTrack;
    00063 class CellRenderer_ValueBase;
    00064
    00065 class LayerTree : public Gtk::Table
    00066 {
    00067     /*
    00068  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
    00069     */
    00070
    00071 public:
    00072
    00073     typedef studio::ColumnID ColumnID;
    00074 /*  enum ColumnID
    00075     {
    00076         COLUMNID_NAME,
    00077         COLUMNID_VALUE,
    00078         COLUMNID_TIME_TRACK,
    00079
    00080         COLUMNID_END            //!< \internal
    00081     };
    00082 */
    00083     typedef std::list<synfig::Layer::Handle> LayerList;
    00084
    00085     /*
    00086  -- ** -- P U B L I C  D A T A ------------------------------------------------
    00087     */
    00088
    00089 public:
    00090
    00091     //LayerTreeStore::Model model;
    00092
    00093     LayerTreeStore::Model layer_model;
    00094     LayerParamTreeStore::Model param_model;
    00095
    00096     synfig::Layer::Handle last_top_selected_layer;
    00097     Gtk::TreePath last_top_selected_path;
    00098
    00099     /*
    00100  -- ** -- P R I V A T E   D A T A ---------------------------------------------
    00101     */
    00102
    00103 private:
    00104
    00105     Gtk::Tooltips tooltips_;
    00106     Gtk::TreePath last_tooltip_path;
    00107
    00108     Gtk::TreeView* layer_tree_view_;
    00109
    00110     Gtk::TreeView* param_tree_view_;
    00111
    00112     Gtk::HBox *hbox;
    00113
    00114     Gtk::Adjustment layer_amount_adjustment_;
    00115
    00116     Gtk::HScale *layer_amount_hscale;
    00117
    00118     synfig::Layer::Handle quick_layer;
    00119
    00120     Glib::RefPtr<LayerTreeStore> layer_tree_store_;
    00121
    00122     Glib::RefPtr<LayerParamTreeStore> param_tree_store_;
    00123
    00124     Glib::RefPtr<Gtk::TreeModelSort> sorted_layer_tree_store_;
    00125
    00126 #ifdef TIMETRACK_IN_PARAMS_PANEL
    00127     CellRenderer_TimeTrack *cellrenderer_time_track;
    00128 #endif  // TIMETRACK_IN_PARAMS_PANEL
    00129
    00130     Gtk::TreeView::Column* column_time_track;
    00131
    00132     Gtk::TreeView::Column* column_z_depth;
    00133
    00134     CellRenderer_ValueBase *cellrenderer_value;
    00135
    00136     sigc::signal<void,synfig::Layer::Handle> signal_layer_toggle_;
    00137
    00138     sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase> signal_edited_value_;
    00139
    00140     sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_layer_user_click_;
    00141
    00142     sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_param_user_click_;
    00143
    00144     sigc::signal<void,synfigapp::ValueDesc,std::set<synfig::Waypoint,std::less<synfig::UniqueID> >,int> signal_waypoint_clicked_layertree_;
    00145
    00146     bool disable_amount_changed_signal;
    00147
    00148     Gtk::Button *button_raise;
    00149     Gtk::Button *button_lower;
    00150     Gtk::Button *button_duplicate;
    00151     Gtk::Button *button_encapsulate;
    00152     Gtk::Button *button_delete;
    00153
    00154     Widget_ValueBase blend_method_widget;
    00155
    00156     /*
    00157  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
    00158     */
    00159
    00160 private:
    00161
    00162     Gtk::Widget* create_layer_tree();
    00163     Gtk::Widget* create_param_tree();
    00164
    00165     /*
    00166  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
    00167     */
    00168
    00169 private:
    00170
    00171     void on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value);
    00172
    00173     void on_layer_renamed(const Glib::ustring&path_string,const Glib::ustring& value);
    00174
    00175     void on_layer_toggle(const Glib::ustring& path_string);
    00176
    00177     void on_waypoint_clicked_layertree(const etl::handle<synfig::Node>& node, const synfig::Time&, const synfig::Time&, int button);
    00178
    00179     void on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node);
    00180
    00181     bool on_layer_tree_event(GdkEvent *event);
    00182
    00183     bool on_param_tree_event(GdkEvent *event);
    00184
    00185     void on_selection_changed();
    00186
    00187     void on_dirty_preview();
    00188
    00189     void on_amount_value_changed();
    00190
    00191     void on_blend_method_changed();
    00192
    00193 public:
    00194
    00195     // void on_raise_pressed();
    00196
    00197     // void on_lower_pressed();
    00198
    00199     // void on_duplicate_pressed();
    00200
    00201     // void on_encapsulate_pressed();
    00202
    00203     // void on_delete_pressed();
    00204
    00205     /*
    00206  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
    00207     */
    00208
    00209 public:
    00210
    00211     //Gtk::TreeView* get_param_tree_view() { return param_tree_view_; }
    00212     //Gtk::TreeView& param_tree_view() { return *param_tree_view_; }
    00213     Gtk::HBox& get_hbox() { return *hbox; }
    00214
    00215     Gtk::TreeView& get_layer_tree_view() { return *layer_tree_view_; }
    00216     Gtk::TreeView& get_param_tree_view() { return *param_tree_view_; }
    00217
    00218     const Gtk::TreeView& get_layer_tree_view()const { return *layer_tree_view_; }
    00219     const Gtk::TreeView& get_param_tree_view()const { return *param_tree_view_; }
    00220
    00221     Glib::RefPtr<Gtk::TreeSelection> get_selection() { return get_layer_tree_view().get_selection(); }
    00222     Glib::SignalProxy1< bool,GdkEvent* >  signal_event () { return get_layer_tree_view().signal_event(); }
    00223
    00224     LayerTree();
    00225     ~LayerTree();
    00226
    00227     void set_model(Glib::RefPtr<LayerTreeStore> layer_tree_store_);
    00228
    00229     void set_time_adjustment(Gtk::Adjustment &adjustment);
    00230
    00231     void set_show_timetrack(bool x=true);
    00232
    00234     sigc::signal<void,synfig::Layer::Handle>& signal_layer_toggle() { return signal_layer_toggle_; }
    00235
    00237     sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase>& signal_edited_value() { return signal_edited_value_; }
    00238
    00239     sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_layer_user_click() { return signal_layer_user_click_; }
    00240
    00241     sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_param_user_click() { return signal_param_user_click_; }
    00242
    00243     sigc::signal<void,synfigapp::ValueDesc,std::set<synfig::Waypoint,std::less<synfig::UniqueID> >,int>& signal_waypoint_clicked_layertree() { return signal_waypoint_clicked_layertree_; }
    00244
    00245     etl::handle<synfigapp::SelectionManager> get_selection_manager() { return layer_tree_store_->canvas_interface()->get_selection_manager(); }
    00246
    00247     void select_layer(synfig::Layer::Handle layer);
    00248     void select_layers(const LayerList& layer_list);
    00249     void select_all_children_layers(synfig::Layer::Handle layer);
    00250     void select_all_children(Gtk::TreeModel::Children::iterator iter);
    00251     LayerList get_selected_layers()const;
    00252     synfig::Layer::Handle get_selected_layer()const;
    00253     void clear_selected_layers();
    00254
    00255 }; // END of LayerTree
    00256
    00257 }; // END of namespace studio
    00258
    00259 /* === E N D =============================================================== */
    00260
    00261 #endif