1 /* === S Y N F I G ========================================================= */
2 /*! \file value_desc.cpp
3 ** \brief Template File
8 ** Copyright (c) 2008 Chris Moore
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
32 #include "value_desc.h"
39 /* === U S I N G =========================================================== */
43 using namespace synfig;
44 using namespace synfigapp;
46 /* === M A C R O S ========================================================= */
48 /* === M E T H O D S ======================================================= */
51 ValueDesc::get_description(bool show_exported_name)const
55 if (show_exported_name && !is_exported())
56 show_exported_name = false;
58 if (parent_is_layer_param())
60 description = strprintf("%s (%s):%s", _("Layer Parameter"),
61 get_layer()->get_non_empty_description().c_str(),
62 get_layer()->get_param_local_name(get_param_name()).c_str());
63 if (show_exported_name)
64 description += strprintf(" (%s)", get_value_node()->get_id().c_str());
66 else if (parent_is_value_node())
68 if (parent_is_linkable_value_node())
70 synfig::LinkableValueNode::Handle value_node(synfig::LinkableValueNode::Handle::cast_reinterpret(get_parent_value_node()));
71 description = strprintf("%s %s", _("ValueNode"),
72 value_node->get_description(get_index(), show_exported_name).c_str());
74 else if (parent_is_value_node_const())
76 synfig::ValueNode_Const::Handle value_node(synfig::ValueNode_Const::Handle::cast_reinterpret(get_parent_value_node()));
77 description = strprintf("%s %s", _("Const ValueNode"),
78 value_node->get_description(show_exported_name).c_str());
80 else if (parent_is_waypoint())
81 description = _("Waypoint");
84 warning("%s:%d didn't expect to get here", __FILE__, __LINE__);
88 else if (parent_is_canvas())
89 description = strprintf("%s (%s)", _("Exported ValueNode"),
90 get_value_node()->get_id().c_str());
93 error("Unknown ValueDesc type");