Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / layer.h
index 7971fcb..f729c40 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2008 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
 /* === M A C R O S ========================================================= */
 
 //! \writeme
-#define SYNFIG_LAYER_MODULE_EXT public: static const char name__[], version__[], cvs_id__[], local_name__[], category__[]; static Layer *create();
+#define SYNFIG_LAYER_MODULE_EXT                                                                                                                        \
+       public:                                                                                                                                                         \
+       static const char name__[], version__[], cvs_id__[], local_name__[], category__[];      \
+       static Layer *create();
 
 //! Sets the name of the layer
-#define SYNFIG_LAYER_SET_NAME(class,x) const char class::name__[]=x
+#define SYNFIG_LAYER_SET_NAME(class,x)                                                                                                 \
+       const char class::name__[]=x
 
 //! Sets the local name of the layer
-#define SYNFIG_LAYER_SET_LOCAL_NAME(class,x) const char class::local_name__[]=x;
+#define SYNFIG_LAYER_SET_LOCAL_NAME(class,x)                                                                                   \
+       const char class::local_name__[]=x;
 
 //! Sets the category of the layer
-#define SYNFIG_LAYER_SET_CATEGORY(class,x) const char class::category__[]=x
+#define SYNFIG_LAYER_SET_CATEGORY(class,x)                                                                                             \
+       const char class::category__[]=x
 
 //! Sets the version string for the layer
-#define SYNFIG_LAYER_SET_VERSION(class,x) const char class::version__[]=x
+#define SYNFIG_LAYER_SET_VERSION(class,x)                                                                                              \
+       const char class::version__[]=x
 
 //! Sets the CVS ID string for the layer
-#define SYNFIG_LAYER_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
+#define SYNFIG_LAYER_SET_CVS_ID(class,x)                                                                                               \
+       const char class::cvs_id__[]=x
 
 //! \writeme
-#define SYNFIG_LAYER_INIT(class) synfig::Layer* class::create() { return new class(); }
+#define SYNFIG_LAYER_INIT(class)                                                                                                               \
+       synfig::Layer* class::create()                                                                                                          \
+       {                                                                                                                                                                       \
+               return new class();                                                                                                                             \
+       }
 
 //! \writeme
-#define IMPORT_PLUS(x,y) if(param==#x && value.same_type_as(x)) { value.put(&x);{y;}return true;}
+#define IMPORT_PLUS(x,y)                                                                                                                               \
+       if (param==#x && value.same_type_as(x))                                                                                         \
+       {                                                                                                                                                                       \
+               value.put(&x);                                                                                                                                  \
+               {                                                                                                                                                               \
+                       y;                                                                                                                                                      \
+               }                                                                                                                                                               \
+               return true;                                                                                                                                    \
+       }
 
 //! \writeme
-#define IMPORT_AS(x,y) if(param==y && value.same_type_as(x)) { value.put(&x); return true;}
+#define IMPORT_AS(x,y)                                                                                                                                 \
+       if (param==y && value.same_type_as(x))                                                                                          \
+       {                                                                                                                                                                       \
+               value.put(&x);                                                                                                                                  \
+               return true;                                                                                                                                    \
+       }
 
 //! \writeme
-#define IMPORT(x) IMPORT_AS(x,#x)
+#define IMPORT(x)                                                                                                                                              \
+       IMPORT_AS(x,#x)
 
 //! \writeme
-#define EXPORT_AS(x,y) if(param==y) { return ValueBase(x); }
+#define EXPORT_AS(x,y)                                                                                                                                 \
+       if (param==y)                                                                                                                                           \
+               return ValueBase(x);
 
 //! \writeme
-#define EXPORT(x)                                      EXPORT_AS(x,#x)
+#define EXPORT(x)                                                                                                                                              \
+       EXPORT_AS(x,#x)
 
 //! \writeme
-#define EXPORT_NAME()  if(param=="Name" || param=="name" || param=="name__") { return name__; } if(param=="local_name__") { return dgettext("synfig",local_name__); }
+#define EXPORT_NAME()                                                                                                                                  \
+       if (param=="Name" || param=="name" || param=="name__")                                                          \
+               return name__;                                                                                                                                  \
+       else if (param=="local_name__")                                                                                                         \
+               return dgettext("synfig",local_name__);
 
 //! \writeme
-#define EXPORT_VERSION()       if(param=="Version" || param=="version" || param=="version__") { return version__; }
+#define EXPORT_VERSION()                                                                                                                               \
+       if (param=="Version" || param=="version" || param=="version__")                                         \
+               return version__;
 
 //! This is used as the category for layer book entries which represent aliases of layers.
 //! It prevents these layers showing up in the menu.
@@ -138,8 +174,18 @@ public:
                String cvs_id;
                String version;
                BookEntry() { }
-               BookEntry(Factory factory, const String& name,const String& local_name,const String& category,const String& cvs_id,const String& version):
-                       factory(factory),name(name),local_name(local_name),category(category),cvs_id(cvs_id),version(version) { }
+               BookEntry(Factory                factory,
+                                 const String  &name,
+                                 const String  &local_name,
+                                 const String  &category,
+                                 const String  &cvs_id,
+                                 const String  &version):
+                       factory(factory),
+                       name(name),
+                       local_name(local_name),
+                       category(category),
+                       cvs_id(cvs_id),
+                       version(version) { }
        };
 
        typedef std::map<String,BookEntry> Book;
@@ -325,6 +371,9 @@ public:
        //! Returns the layer's description if it's not empty, else its local name
        const String get_non_empty_description()const { return get_description().empty() ? get_local_name() : get_description(); }
 
+       //! Returns the localised version of the given layer parameter
+       const String get_param_local_name(const String &param_name)const;
+
        /*
  --    ** -- V I R T U A L   F U N C T I O N S -----------------------------------
        */
@@ -425,10 +474,16 @@ public:
        //! Duplicates the Layer
        virtual Handle clone(const GUID& deriv_guid=GUID())const;
 
-#ifdef THIS_CODE_IS_NOT_USED
+       //! Returns true if the layer needs to be able to examine its context.
+       /*! context to render itself, other than for simple blending.  For
+       **  example, the blur layer will return true - it can't do its job
+       **  if it can't see its context, and the circle layer will return
+       **  false - rendering a circle doesn't depend on the underlying
+       **  context until the final blend operation. */
+       virtual bool reads_context()const;
+
        //! Duplicates the Layer without duplicating the value nodes
-       virtual Layer *simple_clone()const;
-#endif /* THIS_CODE_IS_NOT_USED */
+       virtual Handle simple_clone()const;
 
 protected: