ValueNode_Add::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: CHECK_TYPE_AND_SET_VALUE(ref_a, get_type());
ValueNode_Add::get_link_vfunc(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return ref_a;
ValueNode_Add::link_local_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return _("LHS");
ValueNode_Add::link_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return "lhs";
}
bool
-ValueNode_Atan2::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Atan2::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(i==0)
- {
- x_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- }
- if(i==1)
+ switch(i)
{
- y_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(x_, ValueBase::TYPE_REAL);
+ case 1: CHECK_TYPE_AND_SET_VALUE(y_, ValueBase::TYPE_REAL);
}
return false;
}
String
ValueNode_BLine::link_local_name(int i)const
{
- assert(i>=0 && (unsigned)i<list.size());
+ assert(i>=0 && i<list.size());
+
return etl::strprintf(_("Vertex %03d"),i+1);
}
}
bool
-ValueNode_BLineCalcTangent::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_BLineCalcTangent::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
+
switch(i)
{
- case 0:
- bline_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 1:
- loop_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 2:
- amount_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(bline_, ValueBase::TYPE_LIST);
+ case 1: CHECK_TYPE_AND_SET_VALUE(loop_, ValueBase::TYPE_BOOL);
+ case 2: CHECK_TYPE_AND_SET_VALUE(amount_, ValueBase::TYPE_REAL);
}
return false;
}
ValueNode_BLineCalcTangent::get_link_vfunc(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return bline_;
ValueNode_BLineCalcTangent::link_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return "bline";
ValueNode_BLineCalcTangent::link_local_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return _("BLine");
}
bool
-ValueNode_BLineCalcVertex::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_BLineCalcVertex::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
+
switch(i)
{
- case 0:
- bline_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 1:
- loop_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 2:
- amount_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(bline_, ValueBase::TYPE_LIST);
+ case 1: CHECK_TYPE_AND_SET_VALUE(loop_, ValueBase::TYPE_BOOL);
+ case 2: CHECK_TYPE_AND_SET_VALUE(amount_, ValueBase::TYPE_REAL);
}
return false;
}
ValueNode_BLineCalcVertex::get_link_vfunc(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return bline_;
ValueNode_BLineCalcVertex::link_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return "bline";
ValueNode_BLineCalcVertex::link_local_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return _("BLine");
}
bool
-ValueNode_BLineRevTangent::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_BLineRevTangent::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
+
switch(i)
{
- case 0:
- reference_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 1:
- reverse_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(reference_, get_type());
+ case 1: CHECK_TYPE_AND_SET_VALUE(reverse_, ValueBase::TYPE_BOOL);
}
return false;
}
ValueNode_BLineRevTangent::get_link_vfunc(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return reference_;
ValueNode_BLineRevTangent::link_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return "reference";
ValueNode_BLineRevTangent::link_local_name(int i)const
{
assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return _("Reference");
}
bool
-ValueNode_Cos::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Cos::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(i==0)
- {
- angle_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- }
- if(i==1)
+ switch(i)
{
- amp_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(angle_, ValueBase::TYPE_ANGLE);
+ case 1: CHECK_TYPE_AND_SET_VALUE(amp_, ValueBase::TYPE_REAL);
}
return false;
}
}
bool
-ValueNode_Duplicate::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Duplicate::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
switch(i)
{
- case 0: from_ = x; break;
- case 1: to_ = x; break;
- case 2: step_ = x; break;
- default: return false;
+ case 0: CHECK_TYPE_AND_SET_VALUE(from_, ValueBase::TYPE_REAL);
+ case 1: CHECK_TYPE_AND_SET_VALUE(to_, ValueBase::TYPE_REAL);
+ case 2: CHECK_TYPE_AND_SET_VALUE(step_, ValueBase::TYPE_REAL);
}
-
- signal_child_changed()(i);
- signal_value_changed()();
- return true;
+ return false;
}
ValueNode::LooseHandle
}
bool
-ValueNode_Exp::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Exp::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(i==0)
- {
- exp_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- }
- if(i==1)
+ switch(i)
{
- scale_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(exp_, ValueBase::TYPE_REAL);
+ case 1: CHECK_TYPE_AND_SET_VALUE(scale_, ValueBase::TYPE_REAL);
}
return false;
}
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
{
}
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<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;
}
// static Handle create(ValueBase::Type id=ValueBase::TYPE_GRADIENT);
- //! Sets the left-hand-side value_node
- bool set_gradient(ValueNode::Handle a);
-
- //! Gets the left-hand-side value_node
- ValueNode::Handle get_gradient()const { return ref_gradient; }
-
- //! Sets the right-hand-side value_node
- bool set_offset(ValueNode::Handle b);
-
- //! Gets the right-hand-side value_node
- ValueNode::Handle get_offset()const { return ref_gradient; }
-
virtual ValueNode::LooseHandle get_link_vfunc(int i)const;
}
bool
-ValueNode_Integer::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Integer::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
switch(i)
{
- case 0: integer_ = x; break;
- default: return false;
+ case 0: CHECK_TYPE_AND_SET_VALUE(integer_, get_type());
}
-
- signal_child_changed()(i);
- signal_value_changed()();
- return true;
+ return false;
}
ValueNode::LooseHandle
}
bool
-ValueNode_Linear::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Linear::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(i==0)
- {
- m_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- }
- if(i==1)
+ switch(i)
{
- b_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(m_, get_type());
+ case 1: CHECK_TYPE_AND_SET_VALUE(b_, get_type());
}
return false;
}
switch(i)
{
- case 0:
- min_=value;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 1:
- max_=value;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 2:
- link_=value;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(min_, get_type());
+ case 1: CHECK_TYPE_AND_SET_VALUE(max_, get_type());
+ case 2: CHECK_TYPE_AND_SET_VALUE(link_, get_type());
}
-
return false;
}
}
bool
-ValueNode_Reciprocal::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Reciprocal::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
switch(i)
{
- case 0: link_ = x; break;
- case 1: epsilon_ = x; break;
- case 2: infinite_ = x; break;
- default: return false;
+ case 0: CHECK_TYPE_AND_SET_VALUE(link_, ValueBase::TYPE_REAL);
+ case 1: CHECK_TYPE_AND_SET_VALUE(epsilon_, ValueBase::TYPE_REAL);
+ case 2: CHECK_TYPE_AND_SET_VALUE(infinite_, ValueBase::TYPE_REAL);
}
-
- signal_child_changed()(i);
- signal_value_changed()();
- return true;
+ return false;
}
ValueNode::LooseHandle
}
bool
-ValueNode_Reference::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Reference::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(x->get_type()!=get_type() && !PlaceholderValueNode::Handle::cast_dynamic(x))
- return false;
- link_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ switch(i)
+ {
+ case 0: CHECK_TYPE_AND_SET_VALUE(link_, get_type());
+ }
+ return false;
}
ValueNode::LooseHandle
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;
}
virtual ~ValueNode_Repeat_Gradient();
- bool set_gradient(ValueNode::Handle a);
- bool set_count(ValueNode::Handle b);
- bool set_width(ValueNode::Handle x);
- bool set_specify_start(ValueNode::Handle a);
- bool set_specify_end(ValueNode::Handle a);
- bool set_start_color(ValueNode::Handle a);
- bool set_end_color(ValueNode::Handle a);
-
virtual bool set_link_vfunc(int i,ValueNode::Handle x);
virtual ValueNode::LooseHandle get_link_vfunc(int i)const;
ValueNode_Scale::ValueNode_Scale(const ValueBase &value):
LinkableValueNode(value.get_type())
{
- set_scalar(1.0);
+ set_link("scalar",ValueNode::Handle(ValueNode_Const::create(Real(1.0))));
ValueBase::Type id(value.get_type());
switch(id)
}
assert(value_node);
- assert(get_value_node()->get_type()==id);
+ assert(value_node->get_type()==id);
assert(get_type()==id);
}
unlink_all();
}
-void
-ValueNode_Scale::set_scalar(Real x)
-{
- set_link("scalar",ValueNode::Handle(ValueNode_Const::create(x)));
-}
-
-bool
-ValueNode_Scale::set_scalar(const ValueNode::Handle &x)
-{
- if(!x
- || x->get_type()!=ValueBase::TYPE_REAL
- && !PlaceholderValueNode::Handle::cast_dynamic(x)
- )
- return false;
- scalar=x;
- return true;
-}
-
-ValueNode::Handle
-ValueNode_Scale::get_scalar()const
-{
- return scalar;
-}
-
-bool
-ValueNode_Scale::set_value_node(const ValueNode::Handle &x)
-{
- assert(get_type());
-
- // if this isn't a proper value
- if(!x ||
- // or we don't have a type, and this value isn't one of the types we accept
- (get_type()==ValueBase::TYPE_NIL && !check_type(x->get_type())) ||
- // or we have a type and this value is a different type and (placeholder?)
- (get_type()!=ValueBase::TYPE_NIL && x->get_type()!=get_type() && !PlaceholderValueNode::Handle::cast_dynamic(x)))
- // then fail to set the value
- return false;
-
- value_node=x;
-
- return true;
-}
-
-ValueNode::Handle
-ValueNode_Scale::get_value_node()const
-{
- return value_node;
-}
-
-
synfig::ValueBase
synfig::ValueNode_Scale::operator()(Time t)const
{
bool
-ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(i==0 && !set_value_node(x))
- return false;
- else
- if(i==1 && !set_scalar(x))
- return false;
-
- signal_child_changed()(i);signal_value_changed()();
-
- return true;
+ switch(i)
+ {
+ case 0: CHECK_TYPE_AND_SET_VALUE(value_node, get_type());
+ case 1: CHECK_TYPE_AND_SET_VALUE(scalar, ValueBase::TYPE_REAL);
+ }
+ return false;
}
ValueNode::LooseHandle
virtual ~ValueNode_Scale();
- //! \writeme
- bool set_value_node(const ValueNode::Handle &a);
-
- //! \writeme
- ValueNode::Handle get_value_node()const;
-
- void set_scalar(Real x);
-
- bool set_scalar(const ValueNode::Handle &x);
-
- ValueNode::Handle get_scalar()const;
-
-
-
-
virtual ValueNode::LooseHandle get_link_vfunc(int i)const;
virtual int link_count()const;
}
bool
-ValueNode_SegCalcTangent::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_SegCalcTangent::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(i==0)
- {
- segment_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- }
- if(i==1)
+ switch(i)
{
- amount_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(segment_, ValueBase::TYPE_SEGMENT);
+ case 1: CHECK_TYPE_AND_SET_VALUE(amount_, ValueBase::TYPE_REAL);
}
return false;
}
}
bool
-ValueNode_SegCalcVertex::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_SegCalcVertex::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(i==0)
- {
- segment_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- }
- if(i==1)
+ switch(i)
{
- amount_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(segment_, ValueBase::TYPE_SEGMENT);
+ case 1: CHECK_TYPE_AND_SET_VALUE(amount_, ValueBase::TYPE_REAL);
}
return false;
}
}
bool
-ValueNode_Sine::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Sine::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
- if(i==0)
- {
- angle_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- }
- if(i==1)
+ switch(i)
{
- amp_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(angle_, ValueBase::TYPE_ANGLE);
+ case 1: CHECK_TYPE_AND_SET_VALUE(amp_, ValueBase::TYPE_REAL);
}
return false;
}
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
{
}
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;
}
virtual ~ValueNode_Stripes();
-// static Handle create(ValueBase::Type id=ValueBase::TYPE_GRADIENT);
-
- bool set_color1(ValueNode::Handle a);
- ValueNode::Handle get_color1()const { return color1_; }
-
- bool set_color2(ValueNode::Handle a);
- ValueNode::Handle get_color2()const { return color2_; }
-
- bool set_stripes(ValueNode::Handle b);
- ValueNode::Handle get_stripes()const { return stripes_; }
-
- bool set_width(ValueNode::Handle x);
-
-
virtual bool set_link_vfunc(int i,ValueNode::Handle x);
virtual ValueNode::LooseHandle get_link_vfunc(int i)const;
}
bool
-ValueNode_Switch::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_Switch::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
switch(i)
{
- case 0:
- if(x->get_type()!=get_type() && !PlaceholderValueNode::Handle::cast_dynamic(x))
- return false;
- link_off_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 1:
- if(x->get_type()!=get_type() && !PlaceholderValueNode::Handle::cast_dynamic(x))
- return false;
- link_on_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
- case 2:
- switch_=x;
- signal_child_changed()(i);signal_value_changed()();
- return true;
+ case 0: CHECK_TYPE_AND_SET_VALUE(link_off_, get_type());
+ case 1: CHECK_TYPE_AND_SET_VALUE(link_on_, get_type());
+ case 2: CHECK_TYPE_AND_SET_VALUE(switch_, ValueBase::TYPE_BOOL);
}
- return true;
+ return false;
}
ValueNode::LooseHandle
return new ValueNode_TimedSwap(x);
}
-
LinkableValueNode*
ValueNode_TimedSwap::create_new()const
{
return new ValueNode_TimedSwap(get_type());
}
-
synfig::ValueNode_TimedSwap::~ValueNode_TimedSwap()
{
unlink_all();
}
-
-
-bool
-ValueNode_TimedSwap::set_before(const ValueNode::Handle &x)
-{
- if(!x || x->get_type()!=get_type()
- && !PlaceholderValueNode::Handle::cast_dynamic(x))
- return false;
-
- before=x;
-
- return true;
-}
-
-ValueNode::Handle
-ValueNode_TimedSwap::get_before()const
-{
- return before;
-}
-
-
-bool
-ValueNode_TimedSwap::set_after(const ValueNode::Handle &x)
-{
- if(!x || x->get_type()!=get_type()
- && !PlaceholderValueNode::Handle::cast_dynamic(x))
- return false;
-
- after=x;
-
- return true;
-}
-
-ValueNode::Handle
-ValueNode_TimedSwap::get_after()const
-{
- return after;
-}
-
-
-bool
-ValueNode_TimedSwap::set_swap_time(const ValueNode::Handle &x)
-{
- if(!x || (!ValueBase(x->get_type()).same_type_as(ValueBase::TYPE_TIME) &&
- !PlaceholderValueNode::Handle::cast_dynamic(x)))
- return false;
-
- swap_time=x;
- return true;
-}
-
-ValueNode::Handle
-ValueNode_TimedSwap::get_swap_time()const
-{
- return swap_time;
-}
-
-bool
-ValueNode_TimedSwap::set_swap_length(const ValueNode::Handle &x)
-{
- if(!x || (!ValueBase(x->get_type()).same_type_as(ValueBase::TYPE_TIME) &&
- !PlaceholderValueNode::Handle::cast_dynamic(x)))
- return false;
-
- swap_length=x;
- return true;
-}
-
-ValueNode::Handle
-ValueNode_TimedSwap::get_swap_length()const
-{
- return swap_length;
-}
-
-
-
synfig::ValueBase
synfig::ValueNode_TimedSwap::operator()(Time t)const
{
}
}
-
/*! \todo this should interpolate from
** before to after over the period defined
** by swap_length */
return (*before)(t);
}
-
bool
-ValueNode_TimedSwap::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_TimedSwap::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
switch(i)
{
- case 0: return set_before(x);
- case 1: return set_after(x);
- case 2: return set_swap_time(x);
- case 3: return set_swap_length(x);
+ case 0: CHECK_TYPE_AND_SET_VALUE(before, get_type());
+ case 1: CHECK_TYPE_AND_SET_VALUE(after, get_type());
+ case 2: CHECK_TYPE_AND_SET_VALUE(swap_time, ValueBase::TYPE_TIME);
+ case 3: CHECK_TYPE_AND_SET_VALUE(swap_length, ValueBase::TYPE_TIME);
}
return false;
}
switch(i)
{
- case 0: return get_before();
- case 1: return get_after();
- case 2: return get_swap_time();
- case 3: return get_swap_length();
+ case 0: return before;
+ case 1: return after;
+ case 2: return swap_time;
+ case 3: return swap_length;
}
return 0;
}
virtual ~ValueNode_TimedSwap();
- bool set_before(const ValueNode::Handle &a);
- ValueNode::Handle get_before()const;
- bool set_after(const ValueNode::Handle &a);
- ValueNode::Handle get_after()const;
-
- bool set_swap_time(const ValueNode::Handle &x);
- ValueNode::Handle get_swap_time()const;
-
- bool set_swap_length(const ValueNode::Handle &x);
- ValueNode::Handle get_swap_length()const;
-
-
virtual bool set_link_vfunc(int i,ValueNode::Handle x);
virtual ValueNode::LooseHandle get_link_vfunc(int i)const;
virtual int link_count()const;
}
bool
-ValueNode_TimeLoop::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_TimeLoop::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
switch(i)
{
- case 0: link_ = x; break;
- case 1: link_time_ = x; break;
- case 2: local_time_ = x; break;
- case 3: duration_ = x; break;
- default: return false;
+ case 0: CHECK_TYPE_AND_SET_VALUE(link_, get_type());
+ case 1: CHECK_TYPE_AND_SET_VALUE(link_time_, ValueBase::TYPE_TIME);
+ case 2: CHECK_TYPE_AND_SET_VALUE(local_time_, ValueBase::TYPE_TIME);
+ case 3: CHECK_TYPE_AND_SET_VALUE(duration_, ValueBase::TYPE_TIME);
}
-
- signal_child_changed()(i);
- signal_value_changed()();
- return true;
+ return false;
}
ValueNode::LooseHandle
unlink_all();
}
-bool
-synfig::ValueNode_TwoTone::set_lhs(ValueNode::Handle a)
-{
- if(a->get_type()!=ValueBase::TYPE_COLOR)
- return false;
-
- ref_a=a;
-
- return true;
-}
-
-bool
-synfig::ValueNode_TwoTone::set_rhs(ValueNode::Handle b)
-{
- if(b->get_type()!=ValueBase::TYPE_COLOR)
- return false;
- ref_b=b;
- return true;
-}
-
synfig::ValueBase
synfig::ValueNode_TwoTone::operator()(Time t)const
{
}
bool
-ValueNode_TwoTone::set_link_vfunc(int i,ValueNode::Handle x)
+ValueNode_TwoTone::set_link_vfunc(int i,ValueNode::Handle value)
{
assert(i>=0 && i<link_count());
switch(i)
{
- case 0:
- if(set_lhs(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
- else { return false; }
- case 1:
- if(set_rhs(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
- else { return false; }
+ case 0: CHECK_TYPE_AND_SET_VALUE(ref_a, ValueBase::TYPE_COLOR);
+ case 1: CHECK_TYPE_AND_SET_VALUE(ref_b, ValueBase::TYPE_COLOR);
}
-
return false;
}
virtual ~ValueNode_TwoTone();
-// static Handle create(ValueBase::Type id=ValueBase::TYPE_GRADIENT);
-
- //! Sets the left-hand-side value_node
- bool set_lhs(ValueNode::Handle a);
-
- //! Gets the left-hand-side value_node
- ValueNode::Handle get_lhs()const { return ref_a; }
-
- //! Sets the right-hand-side value_node
- bool set_rhs(ValueNode::Handle b);
-
- //! Gets the right-hand-side value_node
- ValueNode::Handle get_rhs()const { return ref_b; }
-
-
virtual bool set_link_vfunc(int i,ValueNode::Handle x);
virtual ValueNode::LooseHandle get_link_vfunc(int i)const;