/* === S Y N F I G ========================================================= */
/*! \file valuenode_repeat_gradient.cpp
-** \brief Template File
+** \brief Implementation of the "Repeat Gradient" valuenode conversion.
**
** $Id: valuenode_repeat_gradient.cpp 604 2007-09-05 14:29:02Z dooglus $
**
** \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
/* === M E T H O D S ======================================================= */
-synfig::ValueNode_Repeat_Gradient::ValueNode_Repeat_Gradient():LinkableValueNode(synfig::ValueBase::TYPE_GRADIENT)
+synfig::ValueNode_Repeat_Gradient::ValueNode_Repeat_Gradient(const Gradient& x):LinkableValueNode(synfig::ValueBase::TYPE_GRADIENT)
{
- set_link("gradient",ValueNode_Const::create(Gradient()));
+ set_link("gradient",ValueNode_Const::create(x));
set_link("count",count_=ValueNode_Const::create(int(3)));
set_link("width",ValueNode_Const::create(0.5));
set_link("specify_start",ValueNode_Const::create(true));
LinkableValueNode*
ValueNode_Repeat_Gradient::create_new()const
{
- return new ValueNode_Repeat_Gradient();
+ return new ValueNode_Repeat_Gradient(Gradient());
}
ValueNode_Repeat_Gradient*
if(id!=ValueBase::TYPE_GRADIENT)
{
assert(0);
- throw runtime_error("synfig::ValueNode_Repeat_Gradient:Bad type "+ValueBase::type_name(id));
+ throw runtime_error(String(_("Repeat Gradient"))+_(":Bad type ")+ValueBase::type_local_name(id));
}
- ValueNode_Repeat_Gradient* value_node=new ValueNode_Repeat_Gradient();
- value_node->set_gradient(ValueNode_Const::create(x.get(Gradient())));
+ ValueNode_Repeat_Gradient* value_node=new ValueNode_Repeat_Gradient(x.get(Gradient()));
assert(value_node->get_type()==id);
unlink_all();
}
-bool
-synfig::ValueNode_Repeat_Gradient::set_gradient(ValueNode::Handle a)
-{
- if(a->get_type()!=ValueBase::TYPE_GRADIENT)
- return false;
-
- gradient_=a;
-
- return true;
-}
-
-bool
-synfig::ValueNode_Repeat_Gradient::set_width(ValueNode::Handle x)
-{
- if(x->get_type()!=ValueBase::TYPE_REAL)
- return false;
-
- width_=x;
-
- return true;
-}
-
-bool
-synfig::ValueNode_Repeat_Gradient::set_count(ValueNode::Handle b)
-{
- if(b->get_type()!=ValueBase::TYPE_INTEGER)
- return false;
- count_=b;
- return true;
-}
-
-bool
-synfig::ValueNode_Repeat_Gradient::set_specify_start(ValueNode::Handle a)
-{
- if(a->get_type()!=ValueBase::TYPE_BOOL)
- return false;
- specify_start_=a;
- return true;
-}
-
-bool
-synfig::ValueNode_Repeat_Gradient::set_specify_end(ValueNode::Handle a)
-{
- if(a->get_type()!=ValueBase::TYPE_BOOL)
- return false;
- specify_end_=a;
- return true;
-}
-
-bool
-synfig::ValueNode_Repeat_Gradient::set_start_color(ValueNode::Handle a)
-{
- if(a->get_type()!=ValueBase::TYPE_COLOR)
- return false;
- start_color_=a;
- return true;
-}
-
-bool
-synfig::ValueNode_Repeat_Gradient::set_end_color(ValueNode::Handle a)
-{
- if(a->get_type()!=ValueBase::TYPE_COLOR)
- return false;
- end_color_=a;
- return true;
-}
-
synfig::ValueBase
synfig::ValueNode_Repeat_Gradient::operator()(Time t)const
{
}
bool
-ValueNode_Repeat_Gradient::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Repeat_Gradient::set_link_vfunc(int i,ValueNode::Handle value)
{
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_count(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
- else { return false; }
- case 2:
- if(set_width(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
- else { return false; }
- case 3:
- if(set_specify_start(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
- else { return false; }
- case 4:
- if(set_specify_end(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
- else { return false; }
- case 5:
- if(set_start_color(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
- else { return false; }
- case 6:
- if(set_end_color(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
- else { return false; }
+ case 0: CHECK_TYPE_AND_SET_VALUE(gradient_, get_type());
+ case 1: CHECK_TYPE_AND_SET_VALUE(count_, ValueBase::TYPE_INTEGER);
+ case 2: CHECK_TYPE_AND_SET_VALUE(width_, ValueBase::TYPE_REAL);
+ case 3: CHECK_TYPE_AND_SET_VALUE(specify_start_, ValueBase::TYPE_BOOL);
+ case 4: CHECK_TYPE_AND_SET_VALUE(specify_end_, ValueBase::TYPE_BOOL);
+ case 5: CHECK_TYPE_AND_SET_VALUE(start_color_, ValueBase::TYPE_COLOR);
+ case 6: CHECK_TYPE_AND_SET_VALUE(end_color_, ValueBase::TYPE_COLOR);
}
-
return false;
}
ValueNode_Repeat_Gradient::get_link_vfunc(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return gradient_;
ValueNode_Repeat_Gradient::link_local_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return _("Gradient");
ValueNode_Repeat_Gradient::link_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return "gradient";