1 /* === S Y N F I G ========================================================= */
2 /*! \file valuenode_reference.cpp
3 ** \brief Implementation of the "Reference" valuenode conversion.
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2008 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === H E A D E R S ======================================================= */
33 #include "valuenode_reference.h"
34 #include "valuenode_const.h"
39 /* === U S I N G =========================================================== */
43 using namespace synfig;
45 /* === M A C R O S ========================================================= */
47 /* === G L O B A L S ======================================================= */
49 /* === P R O C E D U R E S ================================================= */
51 /* === M E T H O D S ======================================================= */
53 ValueNode_Reference::ValueNode_Reference(const ValueBase::Type &x):
58 ValueNode_Reference::ValueNode_Reference(const ValueNode::Handle &x):
59 LinkableValueNode(x->get_type())
61 Vocab ret(get_children_vocab());
62 set_children_vocab(ret);
67 ValueNode_Reference::create(const ValueBase &x)
69 return new ValueNode_Reference(ValueNode_Const::create(x));
73 ValueNode_Reference::create_new()const
75 return new ValueNode_Reference(get_type());
78 ValueNode_Reference::~ValueNode_Reference()
84 ValueNode_Reference::set_link_vfunc(int i,ValueNode::Handle value)
86 assert(i>=0 && i<link_count());
90 case 0: CHECK_TYPE_AND_SET_VALUE(link_, get_type());
95 ValueNode::LooseHandle
96 ValueNode_Reference::get_link_vfunc(int i __attribute__ ((unused)))const
98 assert(i>=0 && i<link_count());
104 ValueNode_Reference::operator()(Time t)const
106 if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS"))
107 printf("%s:%d operator()\n", __FILE__, __LINE__);
114 ValueNode_Reference::get_name()const
120 ValueNode_Reference::get_local_name()const
122 return _("Reference");
126 ValueNode_Reference::check_type(ValueBase::Type type)
133 LinkableValueNode::Vocab
134 ValueNode_Reference::get_children_vocab_vfunc()const
136 if(children_vocab.size())
137 return children_vocab;
139 LinkableValueNode::Vocab ret;
141 ret.push_back(ParamDesc(ValueBase(),"link")
142 .set_local_name(_("Link"))
143 .set_description(_("The referenced value"))