X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Fsynfig%2Fnode.h;h=fd91cf20b4a72029f1ed55ee6c38d0e2cfb9552f;hb=b56b3e2d45cf281bb0c537f40ab43c908048df01;hp=ca5af34afc82ef80e84b5a2bf56ca975d97d5074;hpb=adfc80c126f482d7ea2bac38001a2c4a7c7df88c;p=synfig.git diff --git a/synfig-core/src/synfig/node.h b/synfig-core/src/synfig/node.h index ca5af34..fd91cf2 100644 --- a/synfig-core/src/synfig/node.h +++ b/synfig-core/src/synfig/node.h @@ -1,6 +1,9 @@ /* === S Y N F I G ========================================================= */ /*! \file node.h -** \brief Template Header +** \brief Base class for Layers and Value Nodes. +** It defines the base members for the parent - child relationship, +** the times where the node is modified and the handling of +** the GUID on deletion and changing. ** ** $Id$ ** @@ -49,6 +52,11 @@ namespace synfig { +//!\brief TimePoint class: holds the time and the before and after interpolation mode +/** + * It includes a GUID, to make it unique + * \see guid.h interpolation.h +**/ class TimePoint { GUID guid; @@ -78,6 +86,9 @@ public: void set_before(Interpolation x) { before=x; } void set_after(Interpolation x) { after=x; } + //! Modify the TimePoint based on the values of \x "merging" + //! the interpolations. Used to insert a Time Point in a Time Points Set + //! \see TimePointSet::iterator TimePointSet::insert(const TimePoint& x) void absorb(const TimePoint& x); }; // END of class TimePoint @@ -129,7 +140,7 @@ public: private: - //! \writeme + //! \ The GUID of the node GUID guid_; //! cached time values for all the children @@ -138,17 +149,20 @@ private: //! \writeme mutable bool bchanged; - //! \writeme + //! The last time the node was modified since the program started + //! \see __sys_clock mutable int time_last_changed_; //! \writeme + //! \see mutex.h mutable RWLock rw_lock_; - //! \writeme + //! Variable used to remember that a signal_deleted has been thrown bool deleting_; public: + //! A set of pointers to parent nodes //! \todo This should really be private std::set parent_set; @@ -158,13 +172,14 @@ public: private: + //! Node changed signal sigc::signal signal_changed_; - //! GUID Changed + //! GUID changed signal /*! \note The second parameter is the *OLD* guid! */ sigc::signal signal_guid_changed_; - //! Deleted + //! Node deleted signal sigc::signal signal_deleted_; /* @@ -204,22 +219,28 @@ public: void changed(); - //! Gets the GUID for this value node + //! Gets the GUID for this Node const GUID& get_guid()const; - //! Sets the GUID for this value node + //! Sets the GUID for this Node void set_guid(const GUID& x); + //! Gets the time when the Node was changed int get_time_last_changed()const; + //! Adds the parameter \x as the child of the current Node void add_child(Node*x); + //! Removes the parameter \x as a child of the current Node void remove_child(Node*x); + //!Returns how many parenst has the current Node int parent_count()const; + //! Returns the cached times values for all the children const time_set &get_times() const; + //! Writeme! RWLock& get_rw_lock()const { return rw_lock_; } protected: @@ -231,17 +252,26 @@ protected: */ protected: + //! Used when the node has changed. Makes changed the parent too. + //! To be overloaded by the derivative classes. Emits a signal where the + //! the GUI can be connected to. virtual void on_changed(); + //! Used when the node's GUID has changed. + //! To be overloaded by the derivative classes. Emits a signal where the + //! the GUI can be connected to. virtual void on_guid_changed(GUID guid); - /*! Function to be overloaded that fills - */ + //! Function to be overloaded that fills the Time Point Set with + //! all the children Time Points. virtual void get_times_vfunc(time_set &set) const = 0; -}; +}; // End of Node class +//! Finds a node by its GUID. +//! \see global_node_map() synfig::Node* find_node(const synfig::GUID& guid); +//! Returns a Handle to the Node by its GUID template etl::handle guid_cast(const synfig::GUID& guid) {