Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / valuenode_stripes.cpp
index de0171e..ce4b694 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
@@ -74,7 +75,7 @@ ValueNode_Stripes::create(const ValueBase& x)
        if(id!=ValueBase::TYPE_GRADIENT)
        {
                assert(0);
-               throw runtime_error("synfig::ValueNode_Stripes:Bad type "+ValueBase::type_name(id));
+               throw runtime_error(String(_("Stripes"))+_(":Bad type ")+ValueBase::type_local_name(id));
        }
 
        ValueNode_Stripes* value_node=new ValueNode_Stripes();
@@ -89,51 +90,12 @@ synfig::ValueNode_Stripes::~ValueNode_Stripes()
        unlink_all();
 }
 
-bool
-synfig::ValueNode_Stripes::set_color1(ValueNode::Handle a)
-{
-       if(a->get_type()!=ValueBase::TYPE_COLOR)
-               return false;
-
-       color1_=a;
-
-       return true;
-}
-
-bool
-synfig::ValueNode_Stripes::set_color2(ValueNode::Handle a)
-{
-       if(a->get_type()!=ValueBase::TYPE_COLOR)
-               return false;
-
-       color2_=a;
-
-       return true;
-}
-
-bool
-synfig::ValueNode_Stripes::set_width(ValueNode::Handle x)
-{
-       if(x->get_type()!=ValueBase::TYPE_REAL)
-               return false;
-
-       width_=x;
-
-       return true;
-}
-
-bool
-synfig::ValueNode_Stripes::set_stripes(ValueNode::Handle b)
-{
-       if(b->get_type()!=ValueBase::TYPE_INTEGER)
-               return false;
-       stripes_=b;
-       return true;
-}
-
 synfig::ValueBase
 synfig::ValueNode_Stripes::operator()(Time t)const
 {
+       if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS"))
+               printf("%s:%d operator()\n", __FILE__, __LINE__);
+
        const int total((*stripes_)(t).get(int()));
        int i;
        Gradient ret;
@@ -161,25 +123,17 @@ synfig::ValueNode_Stripes::operator()(Time t)const
 }
 
 bool
-ValueNode_Stripes::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Stripes::set_link_vfunc(int i,ValueNode::Handle value)
 {
        assert(i>=0 && i<link_count());
+
        switch(i)
        {
-               case 0:
-                       if(set_color1(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
-                       else { return false; }
-               case 1:
-                       if(set_color2(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
-                       else { return false; }
-               case 2:
-                       if(set_stripes(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
-                       else { return false; }
-               case 3:
-                       if(set_width(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
-                       else { return false; }
+       case 0: CHECK_TYPE_AND_SET_VALUE(color1_,  ValueBase::TYPE_COLOR);
+       case 1: CHECK_TYPE_AND_SET_VALUE(color2_,  ValueBase::TYPE_COLOR);
+       case 2: CHECK_TYPE_AND_SET_VALUE(stripes_, ValueBase::TYPE_INTEGER);
+       case 3: CHECK_TYPE_AND_SET_VALUE(width_,   ValueBase::TYPE_REAL);
        }
-
        return false;
 }
 
@@ -187,6 +141,7 @@ ValueNode::LooseHandle
 ValueNode_Stripes::get_link_vfunc(int i)const
 {
        assert(i>=0 && i<link_count());
+
        switch(i)
        {
                case 0:
@@ -211,6 +166,7 @@ String
 ValueNode_Stripes::link_local_name(int i)const
 {
        assert(i>=0 && i<link_count());
+
        switch(i)
        {
                case 0:
@@ -230,6 +186,7 @@ String
 ValueNode_Stripes::link_name(int i)const
 {
        assert(i>=0 && i<link_count());
+
        switch(i)
        {
                case 0: