Use LinkableValueNode members functions when possible in the derived valuenodes.
[synfig.git] / synfig-core / src / synfig / valuenode_realstring.cpp
index a8b14da..aa4d834 100644 (file)
@@ -54,6 +54,8 @@ using namespace synfig;
 ValueNode_RealString::ValueNode_RealString(const ValueBase &value):
        LinkableValueNode(value.get_type())
 {
+       Vocab ret(get_children_vocab());
+       set_children_vocab(ret);
        switch(value.get_type())
        {
        case ValueBase::TYPE_STRING:
@@ -153,56 +155,41 @@ ValueNode_RealString::get_link_vfunc(int i)const
        return 0;
 }
 
-int
-ValueNode_RealString::link_count()const
+bool
+ValueNode_RealString::check_type(ValueBase::Type type)
 {
-       return 4;
+       return
+               type==ValueBase::TYPE_STRING;
 }
 
-String
-ValueNode_RealString::link_name(int i)const
+LinkableValueNode::Vocab
+ValueNode_RealString::get_children_vocab_vfunc()const
 {
-       assert(i>=0 && i<link_count());
+       if(children_vocab.size())
+               return children_vocab;
 
-       switch(i)
-       {
-               case 0: return "real";
-               case 1: return "width";
-               case 2: return "precision";
-               case 3: return "zero_pad";
-       }
-       return String();
-}
+       LinkableValueNode::Vocab ret;
 
-String
-ValueNode_RealString::link_local_name(int i)const
-{
-       assert(i>=0 && i<link_count());
+       ret.push_back(ParamDesc(ValueBase(),"real")
+               .set_local_name(_("Real"))
+               .set_description(_("Value to convert to string"))
+       );
 
-       switch(i)
-       {
-               case 0: return _("Real");
-               case 1: return _("Width");
-               case 2: return _("Precision");
-               case 3: return _("Zero Padded");
-       }
-       return String();
-}
+       ret.push_back(ParamDesc(ValueBase(),"width")
+               .set_local_name(_("Width"))
+               .set_description(_("Width of the string"))
+       );
 
-int
-ValueNode_RealString::get_link_index_from_name(const String &name)const
-{
-       if (name=="real") return 0;
-       if (name=="width") return 1;
-       if (name=="precision") return 2;
-       if (name=="zero_pad") return 3;
+       ret.push_back(ParamDesc(ValueBase(),"precision")
+               .set_local_name(_("Precision"))
+               .set_description(_("Number of decimal places"))
+       );
 
-       throw Exception::BadLinkName(name);
-}
+       ret.push_back(ParamDesc(ValueBase(),"zero_pad")
+               .set_local_name(_("Zero Padded"))
+               .set_description(_("When checked, the string is left filled with zeros to match the width"))
+       );
 
-bool
-ValueNode_RealString::check_type(ValueBase::Type type)
-{
-       return
-               type==ValueBase::TYPE_STRING;
+
+       return ret;
 }