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

# layertreestore.h

Go to the documentation of this file.

    00001 /* === S Y N F I G ========================================================= */
    00021 /* ========================================================================= */
    00022
    00023 /* === S T A R T =========================================================== */
    00024
    00025 #ifndef __SYNFIG_STUDIO_LAYERTREESTORE_H
    00026 #define __SYNFIG_STUDIO_LAYERTREESTORE_H
    00027
    00028 /* === H E A D E R S ======================================================= */
    00029
    00030 #include <gtkmm/treestore.h>
    00031 #include <synfigapp/canvasinterface.h>
    00032 #include <synfig/value.h>
    00033 #include <synfig/valuenode.h>
    00034 #include <gtkmm/treeview.h>
    00035
    00036 /* === M A C R O S ========================================================= */
    00037
    00038 /* === T Y P E D E F S ===================================================== */
    00039
    00040 /* === C L A S S E S & S T R U C T S ======================================= */
    00041
    00042 namespace studio {
    00043
    00044 class LayerTreeStore : virtual public Gtk::TreeStore
    00045 {
    00046     /*
    00047  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
    00048     */
    00049
    00050 public:
    00051
    00052     class Model : public Gtk::TreeModel::ColumnRecord
    00053     {
    00054     public:
    00055         Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
    00056         Gtk::TreeModelColumn<Glib::ustring> label;
    00057         Gtk::TreeModelColumn<Glib::ustring> name;
    00058         Gtk::TreeModelColumn<Glib::ustring> id;
    00059
    00060         Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
    00061
    00062         Gtk::TreeModelColumn<Glib::ustring> tooltip;
    00063
    00064
    00065         Gtk::TreeModelColumn<bool>                      active;
    00066         Gtk::TreeModelColumn<synfig::Layer::Handle>     layer;
    00067         Gtk::TreeModelColumn<synfig::Canvas::Handle>            contained_canvas;
    00068
    00069         Gtk::TreeModelColumn<bool>                      children_lock;
    00070
    00071         Gtk::TreeModelColumn<float> z_depth;
    00072         Gtk::TreeModelColumn<int> index;
    00073
    00074         Model()
    00075         {
    00076             add(icon);
    00077             add(label);
    00078             add(name);
    00079             add(id);
    00080             add(canvas);
    00081             add(tooltip);
    00082             add(active);
    00083             add(layer);
    00084             add(contained_canvas);
    00085             add(z_depth);
    00086             add(index);
    00087             add(children_lock);
    00088         }
    00089     };
    00090
    00091     /*
    00092  -- ** -- P U B L I C  D A T A ------------------------------------------------
    00093     */
    00094
    00095 public:
    00096
    00098     const Model model;
    00099
    00100     /*
    00101  -- ** -- P R I V A T E   D A T A ---------------------------------------------
    00102     */
    00103
    00104 private:
    00105
    00106     bool queued;
    00107
    00108     sigc::connection queue_connection;
    00109
    00110     std::map<synfig::Layer::Handle, sigc::connection> subcanvas_changed_connections;
    00111
    00112     etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
    00113
    00114     Glib::RefPtr<Gdk::Pixbuf> layer_icon;
    00115
    00116     /*
    00117  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
    00118     */
    00119
    00120 private:
    00121
    00122     /*
    00123  -- ** -- P R O T E C T E D   M E T H O D S -----------------------------------
    00124     */
    00125
    00126 private:
    00127     virtual void  set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
    00128     virtual void  get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
    00129
    00130     virtual bool  row_draggable_vfunc (const TreeModel::Path& path)const;
    00131     virtual bool  drag_data_get_vfunc (const TreeModel::Path& path, Gtk::SelectionData& selection_data)const;
    00132     virtual bool  drag_data_delete_vfunc (const TreeModel::Path& path);
    00133     virtual bool  drag_data_received_vfunc (const TreeModel::Path& dest, const Gtk::SelectionData& selection_data);
    00134     virtual bool  row_drop_possible_vfunc (const TreeModel::Path& dest, const Gtk::SelectionData& selection_data)const;
    00135
    00136     /*
    00137  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
    00138     */
    00139
    00140 private:
    00141
    00142     bool on_layer_tree_event(GdkEvent *event);
    00143
    00144     void on_layer_new_description(synfig::Layer::Handle handle,synfig::String desc);
    00145
    00146     void on_layer_added(synfig::Layer::Handle handle);
    00147
    00148     void on_layer_removed(synfig::Layer::Handle handle);
    00149
    00150     void on_layer_inserted(synfig::Layer::Handle handle,int depth);
    00151
    00152     void on_layer_moved(synfig::Layer::Handle handle,int depth, synfig::Canvas::Handle canvas);
    00153
    00154     void on_layer_status_changed(synfig::Layer::Handle handle,bool);
    00155
    00156     void on_layer_lowered(synfig::Layer::Handle handle);
    00157
    00158     void on_layer_raised(synfig::Layer::Handle handle);
    00159
    00160     void on_layer_param_changed(synfig::Layer::Handle handle,synfig::String param_name);
    00161
    00162     //void on_value_node_added(synfig::ValueNode::Handle value_node);
    00163
    00164     //void on_value_node_deleted(synfig::ValueNode::Handle value_node);
    00165
    00166     //void on_value_node_changed(synfig::ValueNode::Handle value_node);
    00167
    00168     //void on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node);
    00169
    00170     bool find_layer_row_(const synfig::Layer::Handle &handle, synfig::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
    00171
    00172     bool find_canvas_row_(synfig::Canvas::Handle canvas, synfig::Canvas::Handle parent, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter);
    00173
    00174     /*
    00175  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
    00176     */
    00177
    00178 public:
    00179
    00180     LayerTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
    00181     ~LayerTreeStore();
    00182
    00183     etl::loose_handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
    00184     etl::loose_handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
    00185     etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
    00186
    00187     bool find_canvas_row(synfig::Canvas::Handle canvas, Gtk::TreeModel::Children::iterator &iter);
    00188
    00189     bool find_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
    00190
    00191     bool find_prev_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
    00192
    00193     void queue_rebuild();
    00194
    00195     void rebuild();
    00196
    00197     void refresh();
    00198
    00199     void refresh_row(Gtk::TreeModel::Row &row);
    00200
    00201     void set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle);
    00202
    00203     static int z_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs);
    00204     static int index_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs);
    00205
    00206     //void set_row_param(Gtk::TreeRow &row,synfig::Layer::Handle &handle,const std::string& name, const std::string& local_name, const synfig::ValueBase &value, etl::handle<synfig::ValueNode> value_node,synfig::ParamDesc *param_desc);
    00207
    00208     //virtual void set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc);
    00209     static bool search_func(const Glib::RefPtr<TreeModel>&,int,const Glib::ustring&,const TreeModel::iterator&);
    00210
    00211     /*
    00212  -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
    00213     */
    00214
    00215 public:
    00216
    00217     static Glib::RefPtr<LayerTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
    00218
    00219
    00220 }; // END of class LayerTreeStore
    00221
    00222 }; // END of namespace studio
    00223
    00224 /* === E N D =============================================================== */
    00225
    00226 #endif