From: Carlos Lopez Date: Wed, 30 Jun 2010 16:46:13 +0000 (+0200) Subject: Merge branch 'master' into genete_core_review X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bee0f6d2546e9afe9cbd0d9da701896947d99b5d;hp=ac5caa76ff6cc25a7923c86350851a84bb40a93a;p=synfig.git Merge branch 'master' into genete_core_review --- diff --git a/synfig-core/src/modules/lyr_std/stretch.cpp b/synfig-core/src/modules/lyr_std/stretch.cpp index de0de94..0f1c37d 100644 --- a/synfig-core/src/modules/lyr_std/stretch.cpp +++ b/synfig-core/src/modules/lyr_std/stretch.cpp @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_bmp/main.cpp b/synfig-core/src/modules/mod_bmp/main.cpp index 88fbbbd..dbf86b1 100644 --- a/synfig-core/src/modules/mod_bmp/main.cpp +++ b/synfig-core/src/modules/mod_bmp/main.cpp @@ -22,8 +22,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_bmp/mptr_bmp.cpp b/synfig-core/src/modules/mod_bmp/mptr_bmp.cpp index 9151cfe..d8c07b7 100644 --- a/synfig-core/src/modules/mod_bmp/mptr_bmp.cpp +++ b/synfig-core/src/modules/mod_bmp/mptr_bmp.cpp @@ -24,8 +24,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_bmp/trgt_bmp.cpp b/synfig-core/src/modules/mod_bmp/trgt_bmp.cpp index fe2d433..5a126ff 100644 --- a/synfig-core/src/modules/mod_bmp/trgt_bmp.cpp +++ b/synfig-core/src/modules/mod_bmp/trgt_bmp.cpp @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_dv/trgt_dv.cpp b/synfig-core/src/modules/mod_dv/trgt_dv.cpp index 6174af0..896ae6c 100644 --- a/synfig-core/src/modules/mod_dv/trgt_dv.cpp +++ b/synfig-core/src/modules/mod_dv/trgt_dv.cpp @@ -25,8 +25,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp b/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp index d1b9219..528166d 100644 --- a/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp +++ b/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp @@ -26,8 +26,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_gif/trgt_gif.cpp b/synfig-core/src/modules/mod_gif/trgt_gif.cpp index a520ff3..5c8b49a 100644 --- a/synfig-core/src/modules/mod_gif/trgt_gif.cpp +++ b/synfig-core/src/modules/mod_gif/trgt_gif.cpp @@ -25,8 +25,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_imagemagick/trgt_imagemagick.cpp b/synfig-core/src/modules/mod_imagemagick/trgt_imagemagick.cpp index dc024ae..c23ef14 100644 --- a/synfig-core/src/modules/mod_imagemagick/trgt_imagemagick.cpp +++ b/synfig-core/src/modules/mod_imagemagick/trgt_imagemagick.cpp @@ -25,8 +25,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_jpeg/trgt_jpeg.cpp b/synfig-core/src/modules/mod_jpeg/trgt_jpeg.cpp index b0def32..890b533 100644 --- a/synfig-core/src/modules/mod_jpeg/trgt_jpeg.cpp +++ b/synfig-core/src/modules/mod_jpeg/trgt_jpeg.cpp @@ -25,8 +25,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_libavcodec/main.cpp b/synfig-core/src/modules/mod_libavcodec/main.cpp index 70fa9c5..30aa3c5 100644 --- a/synfig-core/src/modules/mod_libavcodec/main.cpp +++ b/synfig-core/src/modules/mod_libavcodec/main.cpp @@ -22,8 +22,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_libavcodec/mptr.cpp b/synfig-core/src/modules/mod_libavcodec/mptr.cpp index 667968b..4c9bfb8 100644 --- a/synfig-core/src/modules/mod_libavcodec/mptr.cpp +++ b/synfig-core/src/modules/mod_libavcodec/mptr.cpp @@ -22,8 +22,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_libavcodec/trgt_av.cpp b/synfig-core/src/modules/mod_libavcodec/trgt_av.cpp index f329081..5f481f6 100644 --- a/synfig-core/src/modules/mod_libavcodec/trgt_av.cpp +++ b/synfig-core/src/modules/mod_libavcodec/trgt_av.cpp @@ -24,8 +24,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_magickpp/trgt_magickpp.cpp b/synfig-core/src/modules/mod_magickpp/trgt_magickpp.cpp index 875f2b5..0570685 100644 --- a/synfig-core/src/modules/mod_magickpp/trgt_magickpp.cpp +++ b/synfig-core/src/modules/mod_magickpp/trgt_magickpp.cpp @@ -24,8 +24,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_mng/trgt_mng.cpp b/synfig-core/src/modules/mod_mng/trgt_mng.cpp index 3540490..23d6e81 100644 --- a/synfig-core/src/modules/mod_mng/trgt_mng.cpp +++ b/synfig-core/src/modules/mod_mng/trgt_mng.cpp @@ -27,8 +27,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_openexr/trgt_openexr.cpp b/synfig-core/src/modules/mod_openexr/trgt_openexr.cpp index 2ad34f5..fd29524 100644 --- a/synfig-core/src/modules/mod_openexr/trgt_openexr.cpp +++ b/synfig-core/src/modules/mod_openexr/trgt_openexr.cpp @@ -25,8 +25,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_png/trgt_png.cpp b/synfig-core/src/modules/mod_png/trgt_png.cpp index a0a58b1..c4d4df4 100644 --- a/synfig-core/src/modules/mod_png/trgt_png.cpp +++ b/synfig-core/src/modules/mod_png/trgt_png.cpp @@ -25,8 +25,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_ppm/trgt_mpg.cpp b/synfig-core/src/modules/mod_ppm/trgt_mpg.cpp index c90ebfd..ecdecba 100644 --- a/synfig-core/src/modules/mod_ppm/trgt_mpg.cpp +++ b/synfig-core/src/modules/mod_ppm/trgt_mpg.cpp @@ -24,8 +24,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_ppm/trgt_ppm.cpp b/synfig-core/src/modules/mod_ppm/trgt_ppm.cpp index 0859d84..0012c54 100644 --- a/synfig-core/src/modules/mod_ppm/trgt_ppm.cpp +++ b/synfig-core/src/modules/mod_ppm/trgt_ppm.cpp @@ -25,8 +25,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_svg/main.cpp b/synfig-core/src/modules/mod_svg/main.cpp index 1f5be67..1906b70 100644 --- a/synfig-core/src/modules/mod_svg/main.cpp +++ b/synfig-core/src/modules/mod_svg/main.cpp @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/modules/mod_yuv420p/trgt_yuv.cpp b/synfig-core/src/modules/mod_yuv420p/trgt_yuv.cpp index a6d3455..df1e8e2 100644 --- a/synfig-core/src/modules/mod_yuv420p/trgt_yuv.cpp +++ b/synfig-core/src/modules/mod_yuv420p/trgt_yuv.cpp @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_TARGET - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/Makefile.am b/synfig-core/src/synfig/Makefile.am index ac0ddca..055b720 100644 --- a/synfig-core/src/synfig/Makefile.am +++ b/synfig-core/src/synfig/Makefile.am @@ -11,7 +11,8 @@ INCLUDES = \ EXTRA_DIST = \ surfacenew.cpp \ pch.h \ - synfig.nsh + synfig.nsh \ + synfig.h LAYERHEADERS = \ @@ -194,7 +195,6 @@ SYNFIGHEADERS = \ string.h \ string_decl.h \ surfacenew.h \ - synfig.h \ types.h \ vector.h \ version.h \ diff --git a/synfig-core/src/synfig/canvas.cpp b/synfig-core/src/synfig/canvas.cpp index 2bbb743..eeecdb0 100644 --- a/synfig-core/src/synfig/canvas.cpp +++ b/synfig-core/src/synfig/canvas.cpp @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/color.h b/synfig-core/src/synfig/color.h index d54b0e9..ee5f501 100644 --- a/synfig-core/src/synfig/color.h +++ b/synfig-core/src/synfig/color.h @@ -29,20 +29,16 @@ /* === H E A D E R S ======================================================= */ -//#include #include #include #include "gamma.h" #include +# include "angle.h" #ifdef USE_HALF_TYPE #include #endif -#ifndef SYNFIG_NO_ANGLE -# include "angle.h" -#endif - /* === M A C R O S ========================================================= */ #define use_colorspace_gamma() App::use_colorspace_gamma @@ -386,7 +382,6 @@ public: 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() */ @@ -443,7 +438,6 @@ public: 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; diff --git a/synfig-core/src/synfig/importer.cpp b/synfig-core/src/synfig/importer.cpp index e271110..1784d3a 100644 --- a/synfig-core/src/synfig/importer.cpp +++ b/synfig-core/src/synfig/importer.cpp @@ -1,6 +1,6 @@ /* === S Y N F I G ========================================================= */ /*! \file importer.cpp -** \brief writeme +** \brief It is the base class for all the importers. ** ** $Id$ ** @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/importer.h b/synfig-core/src/synfig/importer.h index 4391c4e..ce89da5 100644 --- a/synfig-core/src/synfig/importer.h +++ b/synfig-core/src/synfig/importer.h @@ -1,7 +1,6 @@ -#include /* === S Y N F I G ========================================================= */ /*! \file importer.h -** \brief writeme +** \brief It is the base class for all the importers. ** ** $Id$ ** @@ -28,34 +27,33 @@ /* === H E A D E R S ======================================================= */ +#include #include -//#include #include #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 ===================================================== */ @@ -68,19 +66,33 @@ class Surface; 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 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 Handle; @@ -88,6 +100,8 @@ public: typedef etl::handle ConstHandle; private: + //! Gamma of the importer. + //! \todo Do not hardcode the gamma to 2.2 Gamma gamma_; protected: @@ -111,9 +125,12 @@ public: 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); } diff --git a/synfig-core/src/synfig/layer.cpp b/synfig-core/src/synfig/layer.cpp index 8fcbfbf..9d1adf3 100644 --- a/synfig-core/src/synfig/layer.cpp +++ b/synfig-core/src/synfig/layer.cpp @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/layer.h b/synfig-core/src/synfig/layer.h index 1e321b0..80e50f1 100644 --- a/synfig-core/src/synfig/layer.h +++ b/synfig-core/src/synfig/layer.h @@ -41,7 +41,8 @@ /* === 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__[]; \ @@ -67,14 +68,15 @@ #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)) \ { \ @@ -85,7 +87,7 @@ 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)) \ { \ @@ -93,27 +95,27 @@ 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__; @@ -192,7 +194,7 @@ public: //! 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 @@ -203,10 +205,16 @@ public: 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 ParamList; typedef etl::handle Handle; @@ -215,6 +223,7 @@ public: typedef etl::handle ConstHandle; + //! Map of parameters that are animated Value Nodes indexed by the param name typedef std::map > DynamicParamList; //! A list type which describes all the parameters that a layer has. @@ -235,12 +244,13 @@ private: //! Handle to the canvas to which this layer belongs etl::loose_handle 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 @@ -249,7 +259,10 @@ private: //! 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_; /* @@ -327,13 +340,14 @@ public: //! 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); + + //! Disconnects the parameter from any Value Node bool disconnect_dynamic_param(const String& param); //! Enables the layer for rendering (Making it \em active) @@ -356,13 +370,13 @@ public: /*! 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 @@ -371,10 +385,10 @@ public: //! Returns a handle to the Canvas to which this Layer belongs etl::loose_handle 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 @@ -388,8 +402,12 @@ public: */ 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 @@ -404,7 +422,8 @@ public: //! 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 get_transform()const; //! Sets the virtual version to use for backwards-compatibility @@ -443,7 +462,7 @@ public: //! 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; @@ -451,14 +470,14 @@ public: /*! \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 const Point \& */ 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; @@ -469,7 +488,7 @@ public: ** \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; @@ -477,7 +496,9 @@ public: /*! \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 diff --git a/synfig-core/src/synfig/layer_bitmap.cpp b/synfig-core/src/synfig/layer_bitmap.cpp index cda5d09..8443429 100644 --- a/synfig-core/src/synfig/layer_bitmap.cpp +++ b/synfig-core/src/synfig/layer_bitmap.cpp @@ -22,8 +22,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/main.cpp b/synfig-core/src/synfig/main.cpp index 9e0a56a..31c9afe 100644 --- a/synfig-core/src/synfig/main.cpp +++ b/synfig-core/src/synfig/main.cpp @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -//#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/module.cpp b/synfig-core/src/synfig/module.cpp index 5d64003..13523b0 100644 --- a/synfig-core/src/synfig/module.cpp +++ b/synfig-core/src/synfig/module.cpp @@ -22,8 +22,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/module.h b/synfig-core/src/synfig/module.h index 29455e3..19f0c3c 100644 --- a/synfig-core/src/synfig/module.h +++ b/synfig-core/src/synfig/module.h @@ -1,6 +1,6 @@ /* === S Y N F I G ========================================================= */ /*! \file synfig/module.h -** \brief writeme +** \brief Base class for all libraries modules ** ** $Id$ ** @@ -91,6 +91,12 @@ #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, \ @@ -100,6 +106,7 @@ 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, \ @@ -132,8 +139,10 @@ //! 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 @@ -142,6 +151,7 @@ //! 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(&class::create); \ book[name].check_type=&class::check_type; \ @@ -176,21 +186,30 @@ public: typedef etl::handle 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 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 " "; } diff --git a/synfig-core/src/synfig/node.cpp b/synfig-core/src/synfig/node.cpp index 6524109..182483c 100644 --- a/synfig-core/src/synfig/node.cpp +++ b/synfig-core/src/synfig/node.cpp @@ -62,21 +62,21 @@ using namespace synfig; #define BE_FRUGAL_WITH_GUIDS 1 #ifndef __sys_clock -#ifndef _WIN32 -# include -# define __sys_clock ::clock -#else -# ifdef __GNUG__ -# include -# 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 + # define __sys_clock ::clock + #else + # ifdef __GNUG__ + # include + # 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 ======================================================= */ @@ -86,6 +86,7 @@ typedef HASH_MAP_CLASS GlobalNodeMap; typedef map 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() @@ -127,15 +128,20 @@ TimePoint::c_str()const 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) @@ -145,29 +151,21 @@ TimePoint::absorb(const TimePoint& x) 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(*iter).absorb(x); return iter; } + //! Else, insert it at the first of the set return std::set::insert(x).first; } - - - - - - - - - - - - - Node::Node(): guid_(0), bchanged(true), 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) { diff --git a/synfig-core/src/synfig/render.cpp b/synfig-core/src/synfig/render.cpp index af58a0e..fffdd6f 100644 --- a/synfig-core/src/synfig/render.cpp +++ b/synfig-core/src/synfig/render.cpp @@ -22,8 +22,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/surface.cpp b/synfig-core/src/synfig/surface.cpp index 91e1663..471b85a 100644 --- a/synfig-core/src/synfig/surface.cpp +++ b/synfig-core/src/synfig/surface.cpp @@ -24,8 +24,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef USING_PCH # include "pch.h" #else diff --git a/synfig-core/src/synfig/target.cpp b/synfig-core/src/synfig/target.cpp index b6aa1c4..a74d374 100644 --- a/synfig-core/src/synfig/target.cpp +++ b/synfig-core/src/synfig/target.cpp @@ -23,8 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - #ifdef HAVE_CONFIG_H # include #endif diff --git a/synfig-core/src/synfig/types.h b/synfig-core/src/synfig/types.h index 6c3b7ea..866e388 100644 --- a/synfig-core/src/synfig/types.h +++ b/synfig-core/src/synfig/types.h @@ -28,11 +28,7 @@ /* === H E A D E R S ======================================================= */ #include - -#ifndef SYNFIG_NO_ANGLE #include "angle.h" -#endif - #include "time.h" #include "vector.h" diff --git a/synfig-core/src/synfig/value.h b/synfig-core/src/synfig/value.h index 7079dba..eff65bb 100644 --- a/synfig-core/src/synfig/value.h +++ b/synfig-core/src/synfig/value.h @@ -28,17 +28,14 @@ /* === 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 #include #include #include #include "general.h" -//#include "gradient.h" #include "blinepoint.h" #include "exception.h" @@ -46,9 +43,6 @@ #include #endif -#ifndef SYNFIG_NO_ANGLE -#include "angle.h" -#endif #include @@ -349,10 +343,8 @@ public: 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 operator std::list()const diff --git a/synfig-core/src/synfig/valuenode.cpp b/synfig-core/src/synfig/valuenode.cpp index cae9692..8f3cc9a 100644 --- a/synfig-core/src/synfig/valuenode.cpp +++ b/synfig-core/src/synfig/valuenode.cpp @@ -24,10 +24,6 @@ /* === H E A D E R S ======================================================= */ -#define SYNFIG_NO_ANGLE - -//#define HAS_HASH_MAP 1 - #ifdef USING_PCH # include "pch.h" #else @@ -202,35 +198,6 @@ bool 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; } diff --git a/synfig-core/src/synfig/valuenode.h b/synfig-core/src/synfig/valuenode.h index a7a8f30..c681b5d 100644 --- a/synfig-core/src/synfig/valuenode.h +++ b/synfig-core/src/synfig/valuenode.h @@ -38,10 +38,7 @@ #include #include #include "guid.h" - -#ifndef SYNFIG_NO_ANGLE #include -#endif #include "node.h" @@ -82,7 +79,7 @@ class LinkableValueNode; class Layer; /*! \class ValueNode -** \todo writeme +** \brief Base class for all Value Nodes */ class ValueNode : public synfig::Node { @@ -103,9 +100,9 @@ public: typedef etl::rhandle 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(); /* @@ -206,10 +203,10 @@ public: 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 @@ -221,15 +218,20 @@ public: //! Returns a handle to the parent canvas, if it has one. etl::loose_handle get_root_canvas()const { return root_canvas_; } - //! \writeme + //! Sets the parent canvas for the Value Node void set_parent_canvas(etl::loose_handle x); - //! \writeme + //! Sets the root canvas parent for the Value Node void set_root_canvas(etl::loose_handle x); - //! \writeme + //! Returns the relative ID of a Node when accessed form the \x Canvas String get_relative_id(etl::loose_handle 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 x); protected: @@ -272,7 +274,12 @@ 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 { @@ -289,11 +296,15 @@ public: //! 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 @@ -305,9 +316,9 @@ public: }; //! 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 */ @@ -330,41 +341,52 @@ protected: 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 {