X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Fvalue_desc.cpp;fp=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Fvalue_desc.cpp;h=96f04f6e850168872ded147b4928213b23fb4e8d;hb=238847fac924cf756235b9c63cbf1a48341f648f;hp=0000000000000000000000000000000000000000;hpb=b0f748aba0e380b4b9bb0ebcc4066cc3499aecd7;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/value_desc.cpp b/synfig-studio/trunk/src/synfigapp/value_desc.cpp new file mode 100644 index 0000000..96f04f6 --- /dev/null +++ b/synfig-studio/trunk/src/synfigapp/value_desc.cpp @@ -0,0 +1,82 @@ +/* === S Y N F I G ========================================================= */ +/*! \file value_desc.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 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 +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "value_desc.h" +#include + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +using namespace synfigapp; + +/* === M A C R O S ========================================================= */ + +/* === M E T H O D S ======================================================= */ + +String +ValueDesc::get_description()const +{ + String description(_("ValueDesc")); + + if (parent_is_layer_param()) + { + description = strprintf("'%s' -> %s", // layer -> parameter + get_layer()->get_non_empty_description().c_str(), + get_param_name().c_str()); + if (is_exported()) + description += strprintf(" (%s)", get_value_node()->get_id().c_str()); + } + else if (parent_is_value_node()) + { + synfig::LinkableValueNode::Handle value_node(synfig::LinkableValueNode::Handle::cast_reinterpret(get_parent_value_node())); + synfig::Node* node; + for(node=value_node.get();!node->parent_set.empty() && !dynamic_cast(node);node=*node->parent_set.begin()); + Layer::Handle parent_layer(dynamic_cast(node)); + if(parent_layer) + description = strprintf("'%s' => %s", // layer -> sub-parameter + parent_layer->get_non_empty_description().c_str(), + value_node->link_local_name(get_index()).c_str()); + else + description = value_node->link_local_name(get_index()); // sub-parameter + if (is_exported()) + description += strprintf(" (%s)", get_value_node()->get_id().c_str()); + } + else if (is_exported()) + description = strprintf(_("ValueNode (%s)"), get_value_node()->get_id().c_str()); + + return description; +}