X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvaluenode.cpp;h=ced38912c6855082633ee4748634fdc1d6055088;hb=031f3c52eaf4c994f7c662c7d44caee7596aafa2;hp=d264d9162dca8aefcb43f78eb2fcce70f104c92c;hpb=f1853221eb20d3c9a8bd72d4fd16f3cea436c894;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/valuenode.cpp b/synfig-core/trunk/src/synfig/valuenode.cpp index d264d91..ced3891 100644 --- a/synfig-core/trunk/src/synfig/valuenode.cpp +++ b/synfig-core/trunk/src/synfig/valuenode.cpp @@ -6,7 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007 Chris Moore +** Copyright (c) 2007, 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 @@ -38,6 +38,7 @@ #include "general.h" #include "canvas.h" #include "paramdesc.h" +#include "releases.h" #include "valuenode_const.h" #include "valuenode_linear.h" @@ -69,6 +70,7 @@ #include "valuenode_reciprocal.h" #include "valuenode_duplicate.h" #include "valuenode_integer.h" +#include "valuenode_step.h" #include "layer.h" @@ -104,45 +106,50 @@ ValueNode::subsys_init() { book_=new LinkableValueNode::Book(); -#define ADD_VALUENODE(class,name,local) \ +#define ADD_VALUENODE(class,name,local,version) \ (*book_)[name].factory=reinterpret_cast(&class::create); \ (*book_)[name].check_type=&class::check_type; \ - (*book_)[name].local_name=local + (*book_)[name].local_name=local; \ + (*book_)[name].release_version=version -#define ADD_VALUENODE2(class,name,local) \ +#define ADD_VALUENODE2(class,name,local,version) \ (*book_)[name].factory=reinterpret_cast(&class::create_from); \ (*book_)[name].check_type=&class::check_type; \ - (*book_)[name].local_name=local - - ADD_VALUENODE(ValueNode_Linear, "linear", _("Linear") ); - ADD_VALUENODE(ValueNode_Composite, "composite", _("Composite") ); - ADD_VALUENODE(ValueNode_RadialComposite,"radial_composite", _("Radial Composite") ); - ADD_VALUENODE(ValueNode_Reference, "reference", _("Reference") ); - ADD_VALUENODE(ValueNode_Repeat_Gradient,"repeat_gradient", _("Repeat Gradient") ); - ADD_VALUENODE(ValueNode_Scale, "scale", _("Scale") ); - ADD_VALUENODE(ValueNode_BLineCalcTangent,"blinecalctangent",_("BLine Tangent") ); - ADD_VALUENODE(ValueNode_BLineCalcVertex,"blinecalcvertex", _("BLine Vertex") ); - ADD_VALUENODE(ValueNode_BLineRevTangent,"blinerevtangent", _("Reverse Tangent") ); - ADD_VALUENODE(ValueNode_SegCalcTangent, "segcalctangent", _("Segment Tangent") ); - ADD_VALUENODE(ValueNode_SegCalcVertex, "segcalcvertex", _("Segment Vertex") ); - ADD_VALUENODE(ValueNode_Stripes, "stripes", _("Stripes") ); - ADD_VALUENODE(ValueNode_Range, "range", _("Range") ); - ADD_VALUENODE(ValueNode_Add, "add", _("Add") ); - ADD_VALUENODE(ValueNode_Subtract, "subtract", _("Subtract") ); - ADD_VALUENODE(ValueNode_TimedSwap, "timed_swap", _("Timed Swap") ); - ADD_VALUENODE(ValueNode_TwoTone, "twotone", _("Two-Tone") ); - ADD_VALUENODE(ValueNode_BLine, "bline", _("BLine") ); - ADD_VALUENODE2(ValueNode_DynamicList, "dynamic_list", _("Dynamic List") ); - ADD_VALUENODE(ValueNode_GradientRotate, "gradient_rotate", _("Gradient Rotate") ); - ADD_VALUENODE(ValueNode_Sine, "sine", _("Sine") ); - ADD_VALUENODE(ValueNode_Cos, "cos", _("Cos") ); - ADD_VALUENODE(ValueNode_Atan2, "atan2", _("aTan2") ); - ADD_VALUENODE(ValueNode_Exp, "exp", _("Exponential") ); - ADD_VALUENODE(ValueNode_Switch, "switch", _("Switch") ); - ADD_VALUENODE(ValueNode_TimeLoop, "timeloop", _("Time Loop") ); - ADD_VALUENODE(ValueNode_Reciprocal, "reciprocal", _("Reciprocal") ); - ADD_VALUENODE(ValueNode_Duplicate, "duplicate", _("Duplicate") ); - ADD_VALUENODE(ValueNode_Integer, "fromint", _("From Integer") ); + (*book_)[name].local_name=local; \ + (*book_)[name].release_version=version + + ADD_VALUENODE(ValueNode_Linear, "linear", _("Linear") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_Composite, "composite", _("Composite") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_RadialComposite,"radial_composite", _("Radial Composite"),RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_Reference, "reference", _("Reference") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_Scale, "scale", _("Scale") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_SegCalcTangent, "segcalctangent", _("Segment Tangent") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_SegCalcVertex, "segcalcvertex", _("Segment Vertex") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_Stripes, "stripes", _("Stripes") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_Subtract, "subtract", _("Subtract") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_TwoTone, "twotone", _("Two-Tone") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_BLine, "bline", _("BLine") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE2(ValueNode_DynamicList, "dynamic_list", _("Dynamic List") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_GradientRotate, "gradient_rotate", _("Gradient Rotate") ,RELEASE_VERSION_0_61_06); + ADD_VALUENODE(ValueNode_Sine, "sine", _("Sine") ,RELEASE_VERSION_0_61_06); + + ADD_VALUENODE(ValueNode_TimedSwap, "timed_swap", _("Timed Swap") ,RELEASE_VERSION_0_61_07); // SVN r610 + ADD_VALUENODE(ValueNode_Repeat_Gradient,"repeat_gradient", _("Repeat Gradient") ,RELEASE_VERSION_0_61_07); // SVN r666 + ADD_VALUENODE(ValueNode_Exp, "exp", _("Exponential") ,RELEASE_VERSION_0_61_07); // SVN r739 + ADD_VALUENODE(ValueNode_Add, "add", _("Add") ,RELEASE_VERSION_0_61_07); // SVN r742 + ADD_VALUENODE(ValueNode_BLineCalcTangent,"blinecalctangent",_("BLine Tangent") ,RELEASE_VERSION_0_61_07); // SVN r744 + ADD_VALUENODE(ValueNode_BLineCalcVertex,"blinecalcvertex", _("BLine Vertex") ,RELEASE_VERSION_0_61_07); // SVN r744 + ADD_VALUENODE(ValueNode_Range, "range", _("Range") ,RELEASE_VERSION_0_61_07); // SVN r776 + + ADD_VALUENODE(ValueNode_Switch, "switch", _("Switch") ,RELEASE_VERSION_0_61_08); // SVN r923 + ADD_VALUENODE(ValueNode_Cos, "cos", _("Cos") ,RELEASE_VERSION_0_61_08); // SVN r1111 + ADD_VALUENODE(ValueNode_Atan2, "atan2", _("aTan2") ,RELEASE_VERSION_0_61_08); // SVN r1132 + ADD_VALUENODE(ValueNode_BLineRevTangent,"blinerevtangent", _("Reverse Tangent") ,RELEASE_VERSION_0_61_08); // SVN r1162 + ADD_VALUENODE(ValueNode_TimeLoop, "timeloop", _("Time Loop") ,RELEASE_VERSION_0_61_08); // SVN r1226 + ADD_VALUENODE(ValueNode_Reciprocal, "reciprocal", _("Reciprocal") ,RELEASE_VERSION_0_61_08); // SVN r1238 + ADD_VALUENODE(ValueNode_Duplicate, "duplicate", _("Duplicate") ,RELEASE_VERSION_0_61_08); // SVN r1267 + ADD_VALUENODE(ValueNode_Integer, "fromint", _("From Integer") ,RELEASE_VERSION_0_61_08); // SVN r1267 + ADD_VALUENODE(ValueNode_Step, "step", _("Step") ,RELEASE_VERSION_0_61_08); // SVN r1691 #undef ADD_VALUENODE #undef ADD_VALUENODE2 @@ -314,10 +321,18 @@ ValueNode::set_id(const String &x) String ValueNode::get_description(bool show_exported_name)const { + String ret(_("ValueNode")); + if (dynamic_cast(this)) return (dynamic_cast(this))->get_description(-1, show_exported_name); - return "ValueNode"; + if (show_exported_name && !is_exported()) + show_exported_name = false; + + if (show_exported_name) + ret += strprintf(" (%s)", get_id().c_str()); + + return ret; } ValueNodeList::ValueNodeList(): @@ -333,7 +348,8 @@ ValueNodeList::count(const String &id)const if(id.empty()) return false; - for(iter=begin();iter!=end() && id!=(*iter)->get_id();++iter); + for(iter=begin();iter!=end() && id!=(*iter)->get_id();++iter) + ; if(iter==end()) return false; @@ -349,7 +365,8 @@ ValueNodeList::find(const String &id) if(id.empty()) throw Exception::IDNotFound("Empty ID"); - for(iter=begin();iter!=end() && id!=(*iter)->get_id();++iter); + for(iter=begin();iter!=end() && id!=(*iter)->get_id();++iter) + ; if(iter==end()) throw Exception::IDNotFound("ValueNode in ValueNodeList: "+id); @@ -365,7 +382,8 @@ ValueNodeList::find(const String &id)const if(id.empty()) throw Exception::IDNotFound("Empty ID"); - for(iter=begin();iter!=end() && id!=(*iter)->get_id();++iter); + for(iter=begin();iter!=end() && id!=(*iter)->get_id();++iter) + ; if(iter==end()) throw Exception::IDNotFound("ValueNode in ValueNodeList: "+id); @@ -571,12 +589,23 @@ LinkableValueNode::get_description(int index, bool show_exported_name)const { String description; - if (show_exported_name && !is_exported()) - show_exported_name = false; - - if (index != -1) + if (index == -1) + { + if (show_exported_name && is_exported()) + description += strprintf(" (%s)", get_id().c_str()); + } + else + { description = String(":") + link_local_name(index); + if (show_exported_name) + { + ValueNode::LooseHandle link(get_link(index)); + if (link->is_exported()) + description += strprintf(" (%s)", link->get_id().c_str()); + } + } + const synfig::Node* node = this; LinkableValueNode::ConstHandle parent_linkable_vn = 0; @@ -609,19 +638,12 @@ LinkableValueNode::get_description(int index, bool show_exported_name)const // loop to find the parameter in the dynamic parameter list - this gives us its name for (Layer::DynamicParamList::const_iterator iter = dynamic_param_list.begin(); iter != dynamic_param_list.end(); iter++) if (iter->second == parent_linkable_vn) - { - String param_local_name(parent_layer->get_param_local_name(iter->first)); - if (!param_local_name.empty()) - param = String(":(nu)") + param_local_name; - } + param = String(":") + parent_layer->get_param_local_name(iter->first); description = strprintf("(%s)%s>%s", parent_layer->get_non_empty_description().c_str(), param.c_str(), description.c_str()); } - if (show_exported_name) - description += strprintf(" (%s)", get_id().c_str()); - return description; }