Add my copyright to files I've modified.
[synfig.git] / synfig-core / trunk / src / synfig / valuenode.cpp
index 4426181..4461740 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 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
 #include "valuenode_composite.h"
 #include "valuenode_reference.h"
 #include "valuenode_scale.h"
+#include "valuenode_blinecalctangent.h"
+#include "valuenode_blinecalcvertex.h"
 #include "valuenode_segcalctangent.h"
 #include "valuenode_segcalcvertex.h"
+#include "valuenode_repeat_gradient.h"
 #include "valuenode_stripes.h"
+#include "valuenode_range.h"
+#include "valuenode_add.h"
 #include "valuenode_subtract.h"
 #include "valuenode_timedswap.h"
 #include "valuenode_twotone.h"
@@ -53,6 +59,7 @@
 #include "valuenode_radialcomposite.h"
 #include "valuenode_gradientrotate.h"
 #include "valuenode_sine.h"
+#include "valuenode_exp.h"
 
 #include "layer.h"
 
@@ -88,24 +95,37 @@ ValueNode::subsys_init()
 {
        book_=new LinkableValueNode::Book();
 
-#define ADD_VALUENODE(c,n,l)  (*book_)[n].factory=reinterpret_cast<LinkableValueNode::Factory>(&c::create);      (*book_)[n].check_type=&c::check_type;(*book_)[n].local_name=l
-#define ADD_VALUENODE2(c,n,l) (*book_)[n].factory=reinterpret_cast<LinkableValueNode::Factory>(&c::create_from); (*book_)[n].check_type=&c::check_type;(*book_)[n].local_name=l
-
-       ADD_VALUENODE(ValueNode_Linear,                 "linear",                       _("Linear")                             );x
-       ADD_VALUENODE(ValueNode_Composite,              "composite",            _("Composite")                  );x
-       ADD_VALUENODE(ValueNode_RadialComposite,"radial_composite",     _("Radial Composite")   );x
-       ADD_VALUENODE(ValueNode_Reference,              "reference",            _("Reference")                  );x
-       ADD_VALUENODE(ValueNode_Scale,                  "scale",                        _("Scale")                              );x
-       ADD_VALUENODE(ValueNode_SegCalcTangent, "segcalctangent",       _("Seg Calc Tangent")   );x
-       ADD_VALUENODE(ValueNode_SegCalcVertex,  "segcalcvertex",        _("Seg Calc Vertex")    );x
-       ADD_VALUENODE(ValueNode_Stripes,                "stripes",                      _("Stripes")                    );x
-       ADD_VALUENODE(ValueNode_Subtract,               "subtract",                     _("Subtract")                   );x
-       //ADD_VALUENODE(ValueNode_TimedSwap,    "timed_swap",           _("Timed Swap")                 );x
-       ADD_VALUENODE(ValueNode_TwoTone,                "twotone",                      _("Two-Tone")                   );x
-       ADD_VALUENODE(ValueNode_BLine,                  "bline",                        _("BLine")                              );x
-       ADD_VALUENODE2(ValueNode_DynamicList,   "dynamic_list",         _("Dynamic List")               );x
-       ADD_VALUENODE(ValueNode_GradientRotate, "gradient_rotate",      _("Gradient Rotate")    );x
-       ADD_VALUENODE(ValueNode_Sine,                   "sine",                         _("Sine")                               );x
+#define ADD_VALUENODE(class,name,local)                                                                                                                        \
+       (*book_)[name].factory=reinterpret_cast<LinkableValueNode::Factory>(&class::create);            \
+       (*book_)[name].check_type=&class::check_type;                                                                                           \
+       (*book_)[name].local_name=local
+
+#define ADD_VALUENODE2(class,name,local)                                                                                                               \
+       (*book_)[name].factory=reinterpret_cast<LinkableValueNode::Factory>(&class::create_from);       \
+       (*book_)[name].check_type=&class::check_type;                                                                                           \
+       (*book_)[name].local_name=local
+
+       ADD_VALUENODE(ValueNode_Linear,                 "linear",                       _("Linear")                             );
+       ADD_VALUENODE(ValueNode_Composite,              "composite",            _("Composite")                  );
+       ADD_VALUENODE(ValueNode_RadialComposite,"radial_composite",     _("Radial Composite")   );
+       ADD_VALUENODE(ValueNode_Reference,              "reference",            _("Reference")                  );
+       ADD_VALUENODE(ValueNode_Repeat_Gradient,"repeat_gradient",      _("Repeat Gradient")    );
+       ADD_VALUENODE(ValueNode_Scale,                  "scale",                        _("Scale")                              );
+       ADD_VALUENODE(ValueNode_BLineCalcTangent,"blinecalctangent",_("BLine Tangent")          );
+       ADD_VALUENODE(ValueNode_BLineCalcVertex,"blinecalcvertex",      _("BLine Vertex")               );
+       ADD_VALUENODE(ValueNode_SegCalcTangent, "segcalctangent",       _("Segment Tangent")    );
+       ADD_VALUENODE(ValueNode_SegCalcVertex,  "segcalcvertex",        _("Segment Vertex")             );
+       ADD_VALUENODE(ValueNode_Stripes,                "stripes",                      _("Stripes")                    );
+       ADD_VALUENODE(ValueNode_Range,                  "range",                        _("Range")                              );
+       ADD_VALUENODE(ValueNode_Add,                    "add",                          _("Add")                                );
+       ADD_VALUENODE(ValueNode_Subtract,               "subtract",                     _("Subtract")                   );
+       ADD_VALUENODE(ValueNode_TimedSwap,              "timed_swap",           _("Timed Swap")                 );
+       ADD_VALUENODE(ValueNode_TwoTone,                "twotone",                      _("Two-Tone")                   );
+       ADD_VALUENODE(ValueNode_BLine,                  "bline",                        _("BLine")                              );
+       ADD_VALUENODE2(ValueNode_DynamicList,   "dynamic_list",         _("Dynamic List")               );
+       ADD_VALUENODE(ValueNode_GradientRotate, "gradient_rotate",      _("Gradient Rotate")    );
+       ADD_VALUENODE(ValueNode_Sine,                   "sine",                         _("Sine")                               );
+       ADD_VALUENODE(ValueNode_Exp,                    "exp",                          _("Exponential")                );
 
 #undef ADD_VALUENODE
 #undef ADD_VALUENODE2
@@ -226,9 +246,12 @@ ValueNode::~ValueNode()
 void
 ValueNode::on_changed()
 {
-       if(get_parent_canvas())
-               get_parent_canvas()->signal_value_node_changed()(this);
-       else if(get_root_canvas() && get_parent_canvas())
+       etl::loose_handle<Canvas> parent_canvas = get_parent_canvas();
+       if(parent_canvas)
+               do                                              // signal to all the ancestor canvases
+                       parent_canvas->signal_value_node_changed()(this);
+               while (parent_canvas = parent_canvas->parent());
+       else if(get_root_canvas())
                get_root_canvas()->signal_value_node_changed()(this);
 
        Node::on_changed();
@@ -423,7 +446,7 @@ PlaceholderValueNode::create(ValueBase::Type type)
 }
 
 ValueBase
-PlaceholderValueNode::operator()(Time t)const
+PlaceholderValueNode::operator()(Time /*t*/)const
 {
        assert(0);
        return ValueBase();