/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_TARGET
-
#ifdef USING_PCH
# include "pch.h"
#else
EXTRA_DIST = \
surfacenew.cpp \
pch.h \
- synfig.nsh
+ synfig.nsh \
+ synfig.h
LAYERHEADERS = \
string.h \
string_decl.h \
surfacenew.h \
- synfig.h \
types.h \
vector.h \
version.h \
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-//#include <cmath>
#include <math.h>
#include <cassert>
#include "gamma.h"
#include <synfig/string.h>
+# include "angle.h"
#ifdef USE_HALF_TYPE
#include <OpenEXR/half.h>
#endif
-#ifndef SYNFIG_NO_ANGLE
-# include "angle.h"
-#endif
-
/* === M A C R O S ========================================================= */
#define use_colorspace_gamma() App::use_colorspace_gamma
static Color YUV(const float& y, const float& u, const float& v, const value_type& a=1)
{ return Color().set_yuv(y,u,v).set_a(a); }
-#ifndef SYNFIG_NO_ANGLE
//! Returns the hue of the chromanance
/*! This is the angle of the U and V components.
** \see set_hue() */
static Color YUV(const float& y, const float& s, const Angle& theta, const value_type& a=1)
{ return Color().set_yuv(y,s,theta).set_a(a); }
-#endif
//! Clamps a color so that its values are in range. Ignores attempting to visualize negative colors.
Color clamped()const;
/* === S Y N F I G ========================================================= */
/*! \file importer.cpp
-** \brief writeme
+** \brief It is the base class for all the importers.
**
** $Id$
**
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
-#include <cstdio>
/* === S Y N F I G ========================================================= */
/*! \file importer.h
-** \brief writeme
+** \brief It is the base class for all the importers.
**
** $Id$
**
/* === H E A D E R S ======================================================= */
+#include <cstdio>
#include <map>
-//#include <cmath>
#include <ETL/handle>
#include "string.h"
-//#include "surface.h"
-//#include "general.h"
-//#include "vector.h"
#include "time.h"
#include "gamma.h"
/* === M A C R O S ========================================================= */
-//! \writeme
+//! Defines various variables and the create method, common for all importers.
+//! To be used in the private part of the importer class definition.
#define SYNFIG_IMPORTER_MODULE_EXT public: static const char name__[], version__[], ext__[],cvs_id__[]; static Importer *create(const char *filename);
-//! Sets the name of the importer
+//! Sets the name of the importer.
#define SYNFIG_IMPORTER_SET_NAME(class,x) const char class::name__[]=x
-//! \writeme
+//! Sets the primary file extension of the importer.
#define SYNFIG_IMPORTER_SET_EXT(class,x) const char class::ext__[]=x
-//! Sets the version of the importer
+//! Sets the version of the importer.
#define SYNFIG_IMPORTER_SET_VERSION(class,x) const char class::version__[]=x
-//! Sets the CVS ID of the importer
+//! Sets the CVS ID of the importer.
#define SYNFIG_IMPORTER_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
-//! \writeme
+//! Defines de implementation of the create method for the importer
+//! \param filename The file name to be imported by the importer.
#define SYNFIG_IMPORTER_INIT(class) synfig::Importer* class::create(const char *filename) { return new class(filename); }
/* === T Y P E D E F S ===================================================== */
class ProgressCallback;
/*! \class Importer
-** \brief Used for importing bitmaps of various formats, including animations
-** \todo Write more detailed description
+** \brief Used for importing bitmaps of various formats, including animations.
+*
+* It is the base class for all the importers. It defines the has a static Book
+* pointer class that is a map for the importers factory creators and the strings
+* of the extension that the importer can understand. It allows to create the a
+* pointer to a particular importer just by using the extension of the name of file
+* to import. Also it creates a virtual member get_frame that must be declared in
+* the inherited classes.
+* \see module.h
+** \
*/
class Importer : public etl::shared_object
{
public:
+ //! Type that represents a pointer to a Importer's constructor.
+ //! As a pointer to the constructor, it represents a "factory" of importers.
typedef Importer* (*Factory)(const char *filename);
typedef std::map<String,Factory> Book;
static Book* book_;
static Book& book();
+ //! Initializes the Import module by creating a book of importers names
+ //! and its creators and the list of open importers
static bool subsys_init();
+ //! Stops the Import module by deleting the book and the list of open
+ //! importers
static bool subsys_stop();
typedef etl::handle<Importer> Handle;
typedef etl::handle<const Importer> ConstHandle;
private:
+ //! Gamma of the importer.
+ //! \todo Do not hardcode the gamma to 2.2
Gamma gamma_;
protected:
virtual bool get_frame(Surface &surface,Time time, ProgressCallback *callback=NULL)=0;
virtual bool get_frame(Surface &surface,Time time,
bool &trimmed __attribute__ ((unused)),
- unsigned int &width __attribute__ ((unused)), unsigned int &height __attribute__ ((unused)),
- unsigned int &top __attribute__ ((unused)), unsigned int &left __attribute__ ((unused)),
- ProgressCallback *callback=NULL) {
+ unsigned int &width __attribute__ ((unused)),
+ unsigned int &height __attribute__ ((unused)),
+ unsigned int &top __attribute__ ((unused)),
+ unsigned int &left __attribute__ ((unused)),
+ ProgressCallback *callback=NULL)
+ {
return get_frame(surface,time,callback);
}
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === M A C R O S ========================================================= */
-//! \writeme
+//! Defines various variables and the create method, common for all importers.
+//! To be used in the private part of the importer class definition.
#define SYNFIG_LAYER_MODULE_EXT \
public: \
static const char name__[], version__[], cvs_id__[], local_name__[], category__[]; \
#define SYNFIG_LAYER_SET_CVS_ID(class,x) \
const char class::cvs_id__[]=x
-//! \writeme
+//! Defines de implementation of the create method for the importer
#define SYNFIG_LAYER_INIT(class) \
synfig::Layer* class::create() \
{ \
return new class(); \
}
-//! \writeme
+//! Imports a parameter 'x' and perform an action based usually based on
+//! some condition 'y'
#define IMPORT_PLUS(x,y) \
if (param==#x && value.same_type_as(x)) \
{ \
return true; \
}
-//! \writeme
+//! Imports a parameter 'y' if it has the same type than 'x'
#define IMPORT_AS(x,y) \
if (param==y && value.same_type_as(x)) \
{ \
return true; \
}
-//! \writeme
+//! Imports a parameter if it is of the same type as param
#define IMPORT(x) \
IMPORT_AS(x,#x)
-//! \writeme
+//! Exports a parameter 'x' if param is same type as given 'y'
#define EXPORT_AS(x,y) \
if (param==y) \
return ValueBase(x);
-//! \writeme
+//! Exports a parameter if it is the same type as value
#define EXPORT(x) \
EXPORT_AS(x,#x)
-//! \writeme
+//! Exports the name or the local name of the layer
#define EXPORT_NAME() \
if (param=="Name" || param=="name" || param=="name__") \
return name__; \
else if (param=="local_name__") \
return dgettext("synfig",local_name__);
-//! \writeme
+//! Exports the version of the layer
#define EXPORT_VERSION() \
if (param=="Version" || param=="version" || param=="version__") \
return version__;
//! Book of types of layers indexed by layer type name.
/*! While the sifz file is read, each time a new layer entry is found,
- ** the factory constructor that the "factory" pointer member of the
+ ** the factory constructor that the "factory" pointer member of the
** "BookEntry" struct points to, is called, and a new layer of that type
** is created.
** \sa Layer::Factory
static Book& book();
+ //! Inits the book of layers and inserts in it the basic layers that
+ //! doesn't depend on modules
+ /*! \todo motionblur should be in the mod_filter module
+ */
static bool subsys_init();
+ //! Stops the layer system by deleting the book of registered layers
static bool subsys_stop();
+ //! Map of Value Base parameters indexed by name
typedef std::map<String,ValueBase> ParamList;
typedef etl::handle<Layer> Handle;
typedef etl::handle<const Layer> ConstHandle;
+ //! Map of parameters that are animated Value Nodes indexed by the param name
typedef std::map<String,etl::rhandle<ValueNode> > DynamicParamList;
//! A list type which describes all the parameters that a layer has.
//! Handle to the canvas to which this layer belongs
etl::loose_handle<Canvas> canvas_;
+ //! Map of parameter with animated value nodes
DynamicParamList dynamic_param_list_;
//! A description of what this layer does
String description_;
- //! \writeme
+ //! The depth parameter of the layer in the layer stack
float z_depth_;
//! \writeme
//! Contains the name of the group that this layer belongs to
String group_;
- //! \writeme
+ //! Signal to connect to the signal_deleted canvas's member
+ //! Used to do let a layer with a canvas parent that doesn't exists
+ //! Instead of that it connects to a zero canvas
+ //! \see Layer::set_canvas()
sigc::connection parent_death_connect_;
/*
//! Gets the name of the group that this layer belongs to
String get_group()const;
- //! writeme
- //DynamicParamList &dynamic_param_list() { return dynamic_param_list_; }
-
- //! \todo writeme
+ //! Retrieves the dynamic param list member
+ //! \see DynamicParamList
const DynamicParamList &dynamic_param_list()const { return dynamic_param_list_; }
+ //! Connects the parameter to another Value Node
bool connect_dynamic_param(const String& param, etl::loose_handle<ValueNode>);
+
+ //! Disconnects the parameter from any Value Node
bool disconnect_dynamic_param(const String& param);
//! Enables the layer for rendering (Making it \em active)
/*! Returns negative on error */
int get_depth()const;
- //! \writeme
+ //! Gets the non animated z depth of the layer
float get_z_depth()const { return z_depth_; }
- //! \writeme
+ //! Gets the z depth of the layer at a time t
float get_z_depth(const synfig::Time& t)const;
- //! \writeme
+ //! Sets the z depth of the layer (non animated)
void set_z_depth(float x) { z_depth_=x; }
//! Sets the Canvas that this Layer is a part of
//! Returns a handle to the Canvas to which this Layer belongs
etl::loose_handle<Canvas> get_canvas()const;
- //! \writeme
+ //! Returns the description of the layer
const String& get_description()const { return description_; }
- //! \writeme
+ //! Sets the description of the layer
void set_description(const String& x);
//! Returns the layer's description if it's not empty, else its local name
*/
public:
+ //! Returns the rectangle that includes the layer
+ //! \see synfig::Rect
virtual Rect get_bounding_rect()const;
+ //!Returns the rectangle that includes the context of the layer
+ //!\see synfig::Rect synfig::Context
virtual Rect get_full_bounding_rect(Context context)const;
//! Returns a string containing the name of the Layer
//! Gets the version string for this layer
virtual String get_version()const;
- //! \writeme
+ //! Returns a handle to the Transform class of the layer
+ //! \see synfig::Transform
virtual etl::handle<Transform> get_transform()const;
//! Sets the virtual version to use for backwards-compatibility
//! Sets the \a time for the selected Layer and those under it
/*! \param context Context iterator referring to next Layer.
** \param time writeme
- ** \see Handle::set_time()
+ ** \see Context::set_time()
*/
virtual void set_time(Context context, Time time)const;
/*! \param context Context iterator referring to next Layer.
** \param time writeme
** \param point writeme
- ** \see Handle::set_time()
+ ** \see Context::set_time()
** \todo \a point should be of the type <tt>const Point \&</tt> */
virtual void set_time(Context context, Time time, const Point &point)const;
//! Gets the color of the Canvas at \a pos
/*! \param context Context iterator referring to next Layer.
** \param pos Point which indicates where the Color should come from
- ** \see Handle::get_color()
+ ** \see Context::get_color()
*/
virtual Color get_color(Context context, const Point &pos)const;
** \param renddesc The associated RendDesc.
** \param cb Pointer to callback object. May be NULL if there is no callback.
** \return \c true on success, \c false on failure
- ** \see Handle::accelerated_render()
+ ** \see Context::accelerated_render()
*/
virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
/*! \param context Context iterator referring to next Layer.
** \param point The point to check
** \return The handle of the layer under \a point. If there is not
- ** a layer under \a point, then returns an empty handle. */
+ ** a layer under \a point, then returns an empty handle.
+ ** \see Context::hit_check
+ */
virtual Handle hit_check(Context context, const Point &point)const;
//! Duplicates the Layer
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-//#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === S Y N F I G ========================================================= */
/*! \file synfig/module.h
-** \brief writeme
+** \brief Base class for all libraries modules
**
** $Id$
**
#define BEGIN_LAYERS {
//! DEPRECATED - use #INCLUDE_LAYER(class)
+// Really? ^^ The INCLUDE_LAYER(class) macro is defined in a cpp file and
+// is undefined a few lines later. In fact the INCLUDE_LAYER is only
+// used in the layer.cpp file and the functionality is the same. Even
+// more, I think that we should use register_in_book call because maybe
+// the Layer class would like to do something else when register the class.
+//! Register a Layer class in the book of layers
#define LAYER(class) \
synfig::Layer::register_in_book( \
synfig::Layer::BookEntry(class::create, \
class::cvs_id__, \
class::version__));
+//! Register a Layer class in the book of layers with an alias
#define LAYER_ALIAS(class,alias) \
synfig::Layer::register_in_book( \
synfig::Layer::BookEntry(class::create, \
//! Marks the start of the importers in the module's inventory
#define BEGIN_IMPORTERS {
+//! Register an Importer class in the book of importers by the default extension
#define IMPORTER(x) synfig::Importer::book()[synfig::String(x::ext__)]=x::create;
+//!Register an Importer class in the book of importers by one file extension string
#define IMPORTER_EXT(x,y) synfig::Importer::book()[synfig::String(y)]=x::create;
//! Marks the end of the importers in the module's inventory
//! Marks the start of the valuenodes in the module's inventory
#define BEGIN_VALUENODES { synfig::LinkableValueNode::Book &book(synfig::LinkableValueNode::book());
+//! Registers a valuenode that is defined in the module's inventory
#define VALUENODE(class,name,local,version) \
book[name].factory=reinterpret_cast<synfig::LinkableValueNode::Factory>(&class::create); \
book[name].check_type=&class::check_type; \
typedef etl::handle<const Module> ConstHandle;
public:
- typedef Module*(*constructor_type)(ProgressCallback *);
+ //! Type that represents a pointer to a Module's constructor by name.
+ //! As a pointer to the member, it represents a constructor of the module.
+ typedef Module* (*constructor_type)(ProgressCallback *);
typedef std::map<String, Handle > Book;
private:
static Book* book_;
public:
static Book& book();
+ //! Inits the book of importers and add the paths to search for the
+ //! ltdl library utilities.
static bool subsys_init(const String &prefix);
static bool subsys_stop();
+ //! Register not optional modules
static void register_default_modules(ProgressCallback *cb=NULL);
+ //! Register Module by handle
static void Register(Handle mod);
+ //! Register Module by name
static bool Register(const String &module_name, ProgressCallback *cb=NULL);
+ //!Register Module by instance pointer
static inline void Register(Module *mod) { Register(Handle(mod)); }
+ //! Virtual Modules properties wrappers. Must be defined in the modules classes
virtual const char * Name() { return " "; }
virtual const char * Desc() { return " "; }
virtual const char * Author() { return " "; }
#define BE_FRUGAL_WITH_GUIDS 1
#ifndef __sys_clock
-#ifndef _WIN32
-# include <time.h>
-# define __sys_clock ::clock
-#else
-# ifdef __GNUG__
-# include <time.h>
-# define __sys_clock ::clock
-# else
-typedef int clock_t;
-extern clock_t _clock();
-# define CLOCKS_PER_SEC 1000
-# define __sys_clock _clock
-# endif
-#endif
-#endif
+ #ifndef _WIN32
+ # include <time.h>
+ # define __sys_clock ::clock
+ #else
+ # ifdef __GNUG__
+ # include <time.h>
+ # define __sys_clock ::clock
+ # else
+ typedef int clock_t;
+ extern clock_t _clock();
+ # define CLOCKS_PER_SEC 1000
+ # define __sys_clock _clock
+ # endif // __GNUG__
+ #endif // _WIN_32
+#endif // __sys_clock
/* === G L O B A L S ======================================================= */
typedef map<synfig::GUID,Node*> GlobalNodeMap;
#endif
+//! A map to store all the GUIDs with a pointer to the Node.
static GlobalNodeMap* global_node_map_;
static GlobalNodeMap& global_node_map()
void
TimePoint::absorb(const TimePoint& x)
{
+ //! If the Time Point to absorb is itself then bail out
if(get_guid()==x.get_guid())
return;
+ //! Creates a new GUID with the old and the new one using XOR operator
set_guid(get_guid()^x.get_guid());
-
+ //! If the current before/after interpolation is NIL use the interpolation
+ //! provided by the TimePoint to absorb
if(get_after()==INTERPOLATION_NIL)
set_after(x.get_after());
if(get_before()==INTERPOLATION_NIL)
set_before(x.get_before());
-
+ //! If the interpolation of the Time Point to absorb is not the same
+ //! than the interpolation from the Time Point to absorb then
+ //! use UNDEFINED interpolation
if(get_after()!=x.get_after() && x.get_after()!=INTERPOLATION_NIL)
set_after(INTERPOLATION_UNDEFINED);
if(get_before()!=x.get_before() && x.get_before()!=INTERPOLATION_NIL)
TimePointSet::iterator
TimePointSet::insert(const TimePoint& x)
{
+ //! finds a iterator to a Time Point with the same time
+ //! \see inline bool operator==(const TimePoint& lhs,const TimePoint& rhs)
iterator iter(find(x));
+ //! If iter is not a the end of the set (we found one Time Point)
if(iter!=end())
{
+ //! Absorb the time point
const_cast<TimePoint&>(*iter).absorb(x);
return iter;
}
+ //! Else, insert it at the first of the set
return std::set<TimePoint>::insert(x).first;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
Node::Node():
guid_(0),
bchanged(true),
/* === 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$
**
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;
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
private:
- //! \writeme
+ //! \ The GUID of the node
GUID guid_;
//! cached time values for all the children
//! \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<Node*> parent_set;
private:
+ //! Node changed signal
sigc::signal<void> signal_changed_;
- //! GUID Changed
+ //! GUID changed signal
/*! \note The second parameter is the *OLD* guid! */
sigc::signal<void,GUID> signal_guid_changed_;
- //! Deleted
+ //! Node deleted signal
sigc::signal<void> signal_deleted_;
/*
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:
*/
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<typename T> etl::handle<T>
guid_cast(const synfig::GUID& guid)
{
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef USING_PCH
# include "pch.h"
#else
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* === H E A D E R S ======================================================= */
#include <cmath>
-
-#ifndef SYNFIG_NO_ANGLE
#include "angle.h"
-#endif
-
#include "time.h"
#include "vector.h"
/* === H E A D E R S ======================================================= */
-//#include "vector.h"
-//#include "time.h"
+#include "angle.h"
#include "segment.h"
-//#include "color.h"
#include "string.h"
#include <list>
#include <vector>
#include <ETL/trivial>
#include <ETL/handle>
#include "general.h"
-//#include "gradient.h"
#include "blinepoint.h"
#include "exception.h"
#include <OpenEXR/half.h>
#endif
-#ifndef SYNFIG_NO_ANGLE
-#include "angle.h"
-#endif
#include <ETL/ref_count>
operator half()const { return get(Real()); }
#endif
-#ifndef SYNFIG_NO_ANGLE
operator const Angle&()const { return get(Angle()); }
static Type get_type(const Angle&) { return TYPE_ANGLE; }
-#endif
template <class T>
operator std::list<T>()const
/* === H E A D E R S ======================================================= */
-#define SYNFIG_NO_ANGLE
-
-//#define HAS_HASH_MAP 1
-
#ifdef USING_PCH
# include "pch.h"
#else
ValueNode::subsys_stop()
{
delete book_;
-/* if(global_value_node_map.size() || value_node_count)
- {
- if(value_node_count)
- synfig::error("%d ValueNodes haven't been destroyed yet!",value_node_count);
-
- if(global_value_node_map.size()!=value_node_count)
- synfig::error("value node count mismatch! map.size()!=value_node_count (%d!=%d)",global_value_node_map.size(),value_node_count);
-
- GlobalValueNodeMap::iterator iter;
- for(iter=global_value_node_map.begin();iter!=global_value_node_map.end();++iter)
- {
- if(!iter->second->is_exported())
- synfig::info(_("%s: count:%d name:%s type:%s"),
- iter->first.get_string().c_str(),
- iter->second->count(),
- iter->second->get_name().c_str(),
- ValueBase::type_local_name(iter->second->get_type()).c_str()
- );
- else
- synfig::info(_("%s: id:%s count:%d name:%s type:%s"),
- iter->first.get_string().c_str(),
- iter->second->get_id().c_str(),
- iter->second->count(),
- iter->second->get_name().c_str(),
- ValueBase::type_local_name(iter->second->get_type()).c_str()
- );
- }
- }
-*/
return true;
}
#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();
/*
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:
/*! \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
*/
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>
{