Added copyright lines for files I've edited this year.
[synfig.git] / synfig-core / trunk / src / synfig / valuenode_gradientrotate.cpp
index fa43922..642856d 100644 (file)
@@ -6,7 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007 Chris Moore
+**     Copyright (c) 2007, 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
@@ -73,7 +73,7 @@ ValueNode_GradientRotate::create(const ValueBase& x)
        if(id!=ValueBase::TYPE_GRADIENT)
        {
                assert(0);
-               throw runtime_error("synfig::ValueNode_GradientRotate:Bad type "+ValueBase::type_name(id));
+               throw runtime_error(String(_("Gradient Rotate"))+_(":Bad type ")+ValueBase::type_local_name(id));
        }
 
        ValueNode_GradientRotate* value_node=new ValueNode_GradientRotate(x.get(Gradient()));
@@ -88,26 +88,6 @@ synfig::ValueNode_GradientRotate::~ValueNode_GradientRotate()
        unlink_all();
 }
 
-bool
-synfig::ValueNode_GradientRotate::set_gradient(ValueNode::Handle a)
-{
-       if(a->get_type()!=ValueBase::TYPE_GRADIENT&& !PlaceholderValueNode::Handle::cast_dynamic(a))
-               return false;
-
-       ref_gradient=a;
-
-       return true;
-}
-
-bool
-synfig::ValueNode_GradientRotate::set_offset(ValueNode::Handle b)
-{
-       if(b->get_type()!=ValueBase::TYPE_REAL&& !PlaceholderValueNode::Handle::cast_dynamic(b))
-               return false;
-       ref_offset=b;
-       return true;
-}
-
 synfig::ValueBase
 synfig::ValueNode_GradientRotate::operator()(Time t)const
 {
@@ -122,26 +102,23 @@ synfig::ValueNode_GradientRotate::operator()(Time t)const
 }
 
 bool
-ValueNode_GradientRotate::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_GradientRotate::set_link_vfunc(int i,ValueNode::Handle value)
 {
-       assert(i>=0 && i<3);
+       assert(i>=0 && i<link_count());
+
        switch(i)
        {
-               case 0:
-                       if(set_gradient(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
-                       else { return false; }
-               case 1:
-                       if(set_offset(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
-                       else { return false; }
+       case 0: CHECK_TYPE_AND_SET_VALUE(ref_gradient, ValueBase::TYPE_GRADIENT);
+       case 1: CHECK_TYPE_AND_SET_VALUE(ref_offset,   ValueBase::TYPE_REAL);
        }
-
        return false;
 }
 
 ValueNode::LooseHandle
 ValueNode_GradientRotate::get_link_vfunc(int i)const
 {
-       assert(i>=0 && i<3);
+       assert(i>=0 && i<link_count());
+
        switch(i)
        {
                case 0:
@@ -161,7 +138,8 @@ ValueNode_GradientRotate::link_count()const
 String
 ValueNode_GradientRotate::link_local_name(int i)const
 {
-       assert(i>=0 && i<2);
+       assert(i>=0 && i<link_count());
+
        switch(i)
        {
                case 0:
@@ -176,7 +154,8 @@ ValueNode_GradientRotate::link_local_name(int i)const
 String
 ValueNode_GradientRotate::link_name(int i)const
 {
-       assert(i>=0 && i<2);
+       assert(i>=0 && i<link_count());
+
        switch(i)
        {
                case 0: