#include <map>
#include <sigc++/signal.h>
#include "guid.h"
-
-#ifndef SYNFIG_NO_ANGLE
#include <ETL/angle>
-#endif
#include "node.h"
class Layer;
/*! \class ValueNode
-** \todo writeme
+** \brief Base class for all Value Nodes
*/
class ValueNode : public synfig::Node
{
typedef etl::rhandle<ValueNode> RHandle;
-
+ //!Instantiates the book of ValaueNodes and register all the valid valuenodes on it
static bool subsys_init();
-
+ //!Deletes the book of ValueNodes
static bool subsys_stop();
/*
*/
private:
+ //! The type of the Value Node
+ //! \see ValueBase
ValueBase::Type type;
+ //! The name of the Value Node. This is the string that is used in the
+ //! sif file to define the value type: i.e. <param name="amount">
String name;
+ //! The canvas this Value Node belongs to
etl::loose_handle<Canvas> canvas_;
+ //! The root canvas this Value Node belongs to
etl::loose_handle<Canvas> root_canvas_;
/*
virtual String get_description(bool show_exported_name = true)const;
- //! \writeme
+ //! Clones a Value Node
virtual ValueNode* clone(const GUID& deriv_guid=GUID())const=0;
- //! \writeme
+ //! Returns \true if the Value Node has an ID (has been exported)
bool is_exported()const { return !get_id().empty(); }
//! Returns the type of the ValueNode
//! Returns a handle to the parent canvas, if it has one.
etl::loose_handle<Canvas> get_root_canvas()const { return root_canvas_; }
- //! \writeme
+ //! Sets the parent canvas for the Value Node
void set_parent_canvas(etl::loose_handle<Canvas> x);
- //! \writeme
+ //! Sets the root canvas parent for the Value Node
void set_root_canvas(etl::loose_handle<Canvas> x);
- //! \writeme
+ //! Returns the relative ID of a Node when accessed form the \x Canvas
String get_relative_id(etl::loose_handle<const Canvas> x)const;
+ //! Replaces the Value Node with a given one. It look up all its parents
+ //! remove it self from them and adds the given Value Node
+ //! Notice that it is called twice and the second time it uses
+ //! a replaceable handle to the Node
+ //! \see etl::rhandle
int replace(etl::handle<ValueNode> x);
protected:
}; // END of class ValueNode
/*! \class PlaceholderValueNode
-** \todo writeme
+** Seems to be a Place to hold a Value Node temporarly.
+*
+* Doesn't seem to implement any functionality. Seems to be used when the
+* value node cannot be created using the Const, Animated or Linkable
+* Value Nodes.
+*
*/
class PlaceholderValueNode : public ValueNode
{
/*! \class LinkableValueNode
-** \todo writeme
+** \brief Specialized Class of Value Nodes that has links to other
+** Value Nodes
+*
+* This Value Node is calculated based on a math calculation or a time
+* evaluation of the linked Value Nodes. It is commonly known as
+* Converted Value Nodes. The derived clases defines the behavior.
*/
class LinkableValueNode : public ValueNode
{
//! Type that represents a pointer to a ValueNode's constructor
- /*! As a pointer to the constructor, it represents a "factory" of
+ /*! As a pointer to the constructor, it represents a "factory" of
** objects of this class.
*/
typedef LinkableValueNode* (*Factory)(const ValueBase&);
+ //! This represents a pointer to a Type check member fucntion
+ /*! As a pointer to the member, it represents a fucntion that checks
+ ** the type of the provided ValueBase
+ */
typedef bool (*CheckType)(ValueBase::Type);
struct BookEntry
};
//! Book of types of linkable value nodes indexed by type name.
- /*! While the sifz file is read, each time a new LinkableValueNode entry
- ** is found, the factory constructor that the "factory" pointer member
- ** of the "BookEntry" struct points to, is called, and a new object of
+ /*! While the sifz file is read, each time a new LinkableValueNode entry
+ ** is found, the factory constructor that the "factory" pointer member
+ ** of the "BookEntry" struct points to, is called, and a new object of
** that type is created.
** \sa LinkableValueNode::Factory
*/
static Book& book();
+ //! Creates a Linkable Value Node based on the name and the returned
+ //! value type. Returns a valid Handle if both (name and type) match
static Handle create(const String &name, const ValueBase& x);
+ //! Each derived Linkable Value Node has to implement this fucntion and
+ //! should return true only if the type matches. \name is the name of
+ //! the linked value node and \x is the returned value type
static bool check_type(const String &name, ValueBase::Type x);
public:
ValueNode(type) { }
protected:
+ //! Stores the Value Node \x in the sub parameter i after check if the
+ //! type is the same.
+ //! It has to be defined by the derived class.
virtual bool set_link_vfunc(int i,ValueNode::Handle x)=0;
+ //! Frees all the subparameters of the Linkable Value Node.
+ //! Used by the derived classed destructors.
void unlink_all();
public:
+ //! Returns the number of linked Value Nodes
virtual int link_count()const=0;
+ //! Returns the local name of the 'i' linked Value Node
virtual String link_local_name(int i)const=0;
+ //! Returns the name of the 'i' linked Value Node
virtual String link_name(int i)const=0;
+ //! Returns the child index Value Node based on the name
virtual int get_link_index_from_name(const String &name)const=0;
+ //! Clones a Value Node
virtual ValueNode* clone(const GUID& deriv_guid=GUID())const;
+ //! Sets a new Value Node link by its index
bool set_link(int i,ValueNode::Handle x);
+ //! Sets a new Value Node link by its name
bool set_link(const String &name,ValueNode::Handle x) { return set_link(get_link_index_from_name(name),x); }
+ //! Returns a Loose Handle to the Value Node based on the link's index
ValueNode::LooseHandle get_link(int i)const;
+ //! Returns a Loose Handle to the Value Node based on the link's name
ValueNode::LooseHandle get_link(const String &name)const { return get_link(get_link_index_from_name(name)); }
-
- String
- get_description(int index = -1, bool show_exported_name = true)const;
+ //! Return a full description of the linked ValueNode given by the index
+ String get_description(int index = -1, bool show_exported_name = true)const;
protected:
//! Sets the type of the ValueNode
void set_type(ValueBase::Type t) { ValueNode::set_type(t); }
+ //! Virtual member to get the linked Value Node Handle
virtual ValueNode::LooseHandle get_link_vfunc(int i)const=0;
- // Wrapper for new operator, used by clone()
+ //! Wrapper for new operator, used by clone()
virtual LinkableValueNode* create_new()const=0;
+ //! Returns the cached times values for all the children (linked Value Nodes)
virtual void get_times_vfunc(Node::time_set &set) const;
}; // END of class LinkableValueNode
/*! \class ValueNodeList
** \brief A searchable value_node list container
** \warning Do not confuse with ValueNode_DynamicList!
-** \todo writeme
+*
+* Used by Canvas class to access to the exported value nodes.
*/
class ValueNodeList : public std::list<ValueNode::RHandle>
{