1 /* === S Y N F I G ========================================================= */ 2 /*! \file trees/childrentreestore.h 3 ** \brief Template Header 4 ** 5 ** $Id$ 6 ** 7 ** \legal 8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley 9 ** Copyright (c) 2007 Chris Moore 10 ** 11 ** This package is free software; you can redistribute it and/or 12 ** modify it under the terms of the GNU General Public License as 13 ** published by the Free Software Foundation; either version 2 of 14 ** the License, or (at your option) any later version. 15 ** 16 ** This package is distributed in the hope that it will be useful, 17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 ** General Public License for more details. 20 ** \endlegal 21 */ 22 /* ========================================================================= */ 23 24 /* === S T A R T =========================================================== */ 25 26 #ifndef __SYNFIG_STUDIO_CHILDRENTREESTORE_H 27 #define __SYNFIG_STUDIO_CHILDRENTREESTORE_H 28 29 /* === H E A D E R S ======================================================= */ 30 31 #include <gtkmm/treestore.h> 32 #include <synfigapp/canvasinterface.h> 33 #include "trees/canvastreestore.h" 34 #include <synfig/value.h> 35 #include <synfig/valuenode.h> 36 #include <set> 37 38 /* === M A C R O S ========================================================= */ 39 40 /* === T Y P E D E F S ===================================================== */ 41 42 /* === C L A S S E S & S T R U C T S ======================================= */ 43 44 namespace studio { 45 46 class ChildrenTreeStore : public CanvasTreeStore 47 { 48 /* 49 -- ** -- P U B L I C T Y P E S --------------------------------------------- 50 */ 51 52 public: 53 54 /* 55 -- ** -- P U B L I C D A T A ------------------------------------------------ 56 */ 57 58 public: 59 60 //! TreeModel for the layers 61 const Model model; 62 63 /* 64 -- ** -- P R I V A T E D A T A --------------------------------------------- 65 */ 66 67 private: 68 69 Gtk::TreeModel::Row value_node_row; 70 Gtk::TreeModel::Row canvas_row; 71 72 std::set<synfig::ValueNode::Handle> changed_set_; 73 74 std::set<synfig::ValueNode::Handle> replaced_set_; 75 76 /* 77 -- ** -- P R I V A T E M E T H O D S --------------------------------------- 78 */ 79 80 private: 81 82 sigc::connection changed_connection; execute_changed_queued()83 bool execute_changed_queued()const { return !changed_set_.empty() || !replaced_set_.empty(); } 84 bool execute_changed_value_nodes(); clear_changed_queue()85 void clear_changed_queue() { changed_set_.clear(); replaced_set_.clear(); } 86 87 /* 88 -- ** -- S I G N A L T E R M I N A L S ------------------------------------- 89 */ 90 91 private: 92 93 void on_value_node_added(synfig::ValueNode::Handle value_node); 94 void on_value_node_deleted(synfig::ValueNode::Handle value_node); 95 void on_value_node_changed(synfig::ValueNode::Handle value_node); 96 void on_value_node_renamed(synfig::ValueNode::Handle value_node); 97 void on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node); 98 void on_canvas_added(synfig::Canvas::Handle canvas); 99 void on_canvas_removed(synfig::Canvas::Handle canvas); 100 101 void set_value_impl(const Gtk::TreeModel::iterator& iter, int column, const Glib::ValueBase& value); 102 103 /* 104 -- ** -- P U B L I C M E T H O D S ----------------------------------------- 105 */ 106 107 public: 108 109 ChildrenTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_); 110 ~ChildrenTreeStore(); 111 112 void rebuild(); 113 114 void refresh(); 115 116 void rebuild_value_nodes(); 117 118 void refresh_value_nodes(); 119 120 void rebuild_canvases(); 121 122 void refresh_canvases(); 123 124 void refresh_row(Gtk::TreeModel::Row &row, bool do_children=false); 125 get_canvas_row()126 Gtk::TreeModel::Row get_canvas_row()const { return canvas_row; } 127 get_value_node_row()128 Gtk::TreeModel::Row get_value_node_row()const { return value_node_row; } 129 130 /* 131 -- ** -- S T A T I C P U B L I C M E T H O D S --------------------------- 132 */ 133 134 public: 135 136 static Glib::RefPtr<ChildrenTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_); 137 }; // END of class ChildrenTreeStore 138 139 }; // END of namespace studio 140 141 /* === E N D =============================================================== */ 142 143 #endif 144