1 /* === S Y N F I G ========================================================= */
2 /*! \file value_desc.cpp
3 ** \brief Template File
8 ** Copyright (c) 2008 Chris Moore
9 ** Copyright (c) 2009 Nikita Kitaev
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 "value_desc.h"
40 /* === U S I N G =========================================================== */
44 using namespace synfig;
45 using namespace synfigapp;
47 /* === M A C R O S ========================================================= */
49 /* === M E T H O D S ======================================================= */
52 ValueDesc::get_description(bool show_exported_name)const
56 if (show_exported_name && !is_exported())
57 show_exported_name = false;
59 if (parent_is_layer_param())
61 description = strprintf("%s (%s):%s", _("Layer Parameter"),
62 get_layer()->get_non_empty_description().c_str(),
63 get_layer()->get_param_local_name(get_param_name()).c_str());
64 if (show_exported_name)
65 description += strprintf(" (%s)", get_value_node()->get_id().c_str());
67 else if (parent_is_value_node())
69 if (parent_is_linkable_value_node())
71 synfig::LinkableValueNode::Handle value_node(synfig::LinkableValueNode::Handle::cast_reinterpret(get_parent_value_node()));
72 description = strprintf("%s %s", _("ValueNode"),
73 value_node->get_description(get_index(), show_exported_name).c_str());
75 else if (parent_is_value_node_const())
77 synfig::ValueNode_Const::Handle value_node(synfig::ValueNode_Const::Handle::cast_reinterpret(get_parent_value_node()));
78 description = strprintf("%s %s", _("Const ValueNode"),
79 value_node->get_description(show_exported_name).c_str());
81 else if (parent_is_waypoint())
82 description = _("Waypoint");
85 warning("%s:%d didn't expect to get here", __FILE__, __LINE__);
89 else if (parent_is_canvas())
90 description = strprintf("%s (%s)", _("Exported ValueNode"),
91 get_value_node()->get_id().c_str());
94 error("Unknown ValueDesc type");