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

# keyframetreestore.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_KEYFRAMETREESTORE_H
    00027 #define __SYNFIG_STUDIO_KEYFRAMETREESTORE_H
    00028
    00029 /* === H E A D E R S ======================================================= */
    00030
    00031 #include <gtkmm/liststore.h>
    00032 #include <synfigapp/canvasinterface.h>
    00033 #include <gdkmm/pixbuf.h>
    00034 #include <synfig/keyframe.h>
    00035 #include <map>
    00036
    00037 /* === M A C R O S ========================================================= */
    00038
    00039 /* === T Y P E D E F S ===================================================== */
    00040
    00041 /* === C L A S S E S & S T R U C T S ======================================= */
    00042
    00043 //class TreeRowReferenceHack;
    00044 //#define TreeRowReferenceHack Gtk::TreeRowReference
    00045
    00046 namespace studio {
    00047
    00048 class KeyframeTreeStore_Class;
    00049
    00050 class KeyframeTreeStore :
    00051     public Glib::Object,
    00052     public Gtk::TreeModel,
    00053     public Gtk::TreeDragSource,
    00054     public Gtk::TreeDragDest
    00055 {
    00056     /*
    00057  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
    00058     */
    00059
    00060 public:
    00061
    00062     class Model : public Gtk::TreeModel::ColumnRecord
    00063     {
    00064     public:
    00065         Gtk::TreeModelColumn<synfig::Time> time;
    00066         Gtk::TreeModelColumn<Glib::ustring> description;
    00067         Gtk::TreeModelColumn<synfig::Keyframe> keyframe;
    00068         Gtk::TreeModelColumn<synfig::Time> time_delta;
    00069
    00070         Model()
    00071         {
    00072             add(time);
    00073             add(description);
    00074             add(keyframe);
    00075             add(time_delta);
    00076         }
    00077     };
    00078
    00079     /*
    00080  -- ** -- P U B L I C  D A T A ------------------------------------------------
    00081     */
    00082
    00083 public:
    00084
    00085     const Model model;
    00086
    00087     /*
    00088  -- ** -- P R I V A T E   D A T A ---------------------------------------------
    00089     */
    00090
    00091 private:
    00092
    00093     etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
    00094
    00096     int stamp_;
    00097
    00098     static KeyframeTreeStore_Class keyframe_tree_store_class_;
    00099
    00100     //std::map<synfig::Keyframe,TreeRowReferenceHack> path_table_;
    00101
    00102     synfig::KeyframeList old_keyframe_list;
    00103
    00104     /*
    00105  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
    00106     */
    00107
    00108 private:
    00109
    00110     void add_keyframe(synfig::Keyframe);
    00111
    00112     void remove_keyframe(synfig::Keyframe);
    00113
    00114     void change_keyframe(synfig::Keyframe);
    00115
    00116     static int sorter(const Gtk::TreeModel::iterator &,const Gtk::TreeModel::iterator &);
    00117
    00118     bool iterator_sane(const GtkTreeIter* iter)const;
    00119
    00120     bool iterator_sane(const Gtk::TreeModel::iterator& iter)const;
    00121
    00122     void dump_iterator(const GtkTreeIter* iter, const Glib::ustring &name)const;
    00123
    00124     void dump_iterator(const Gtk::TreeModel::iterator& iter, const Glib::ustring &name)const;
    00125
    00127
    00130     void reset_stamp();
    00131
    00132     //void reset_path_table();
    00133
    00134     /*
    00135  -- ** -- V I R T U A L   F U N C T I O N S -----------------------------------
    00136     */
    00137
    00138 protected:
    00139
    00140     virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
    00141     virtual Gtk::TreeModelFlags  get_flags_vfunc ();
    00142     virtual int  get_n_columns_vfunc ();
    00143     virtual GType  get_column_type_vfunc (int index);
    00144     virtual bool iter_next_vfunc (const iterator& iter, iterator& iter_next) const;
    00145     virtual bool  get_iter_vfunc (const Gtk::TreeModel::Path& path, iterator& iter_next)const;
    00146     virtual bool  iter_nth_root_child_vfunc (int n, iterator& iter)const;
    00147     virtual Gtk::TreeModel::Path  get_path_vfunc (const iterator& iter)const;
    00148     virtual void  ref_node_vfunc (iterator& iter)const;
    00149     virtual void  unref_node_vfunc (iterator& iter)const;
    00150     virtual void  get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
    00151     virtual bool    iter_is_valid (const iterator& iter) const;
    00152     virtual int     iter_n_root_children_vfunc () const;
    00153
    00154     //virtual bool  iter_nth_child_vfunc (GtkTreeIter* iter, const GtkTreeIter* parent, int n);
    00155     //virtual bool  iter_children_vfunc (GtkTreeIter* iter, const GtkTreeIter* parent);
    00156     //virtual bool  iter_has_child_vfunc (const GtkTreeIter* iter);
    00157     //virtual int  iter_n_children_vfunc (const GtkTreeIter* iter);
    00158     //virtual bool  iter_parent_vfunc (GtkTreeIter* iter, const GtkTreeIter* child);
    00159
    00160     /*
    00161     virtual bool  get_sort_column_id_vfunc (int* sort_column_id, Gtk::SortType* order);
    00162     virtual void  set_sort_column_id_vfunc (int sort_column_id, Gtk::SortType order);
    00163     virtual void  set_sort_func_vfunc (int sort_column_id, GtkTreeIterCompareFunc func, void* data, GtkDestroyNotify destroy);
    00164     virtual void  set_default_sort_func_vfunc (GtkTreeIterCompareFunc func, void* data, GtkDestroyNotify destroy);
    00165     virtual bool  has_default_sort_func_vfunc ();
    00166     */
    00167
    00168     /*
    00169  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
    00170     */
    00171
    00172 private:
    00173
    00174     /*
    00175  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
    00176     */
    00177
    00178 public:
    00179
    00180     KeyframeTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
    00181     ~KeyframeTreeStore();
    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
    00186     synfig::Canvas::Handle get_canvas() { return canvas_interface()->get_canvas(); }
    00187     synfig::Canvas::Handle get_canvas()const { return canvas_interface()->get_canvas(); }
    00188
    00189     Gtk::TreeModel::Row find_row(const synfig::Keyframe &keyframe);
    00190
    00191     /*
    00192  -- ** -- S T A T I C  M E T H O D S ------------------------------------------
    00193     */
    00194
    00195 public:
    00196
    00197     static Glib::RefPtr<KeyframeTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
    00198
    00199     static int time_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs);
    00200     static int description_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs);
    00201
    00202 }; // END of class KeyframeTreeStore
    00203
    00205 class KeyframeTreeStore_Class : public Glib::Class
    00206 {
    00207 public:
    00208     struct KeyframeTreeStoreClass
    00209     {
    00210         GObjectClass parent_class;
    00211     };
    00212
    00213     friend class KeyframeTreeStore;
    00214
    00215     const Glib::Class& init();
    00216
    00217     static void class_init_function(gpointer g_blass, gpointer class_data);
    00218 }; // END of CustomTreeStore_Class
    00219
    00220 }; // END of namespace studio
    00221
    00222 /* === E N D =============================================================== */
    00223
    00224 #endif