Set the initial default blend method to "By Layer Default"
[synfig.git] / synfig-studio / src / synfigapp / value_desc.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file value_desc.cpp
3 **      \brief Template File
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2008 Chris Moore
9 **      Copyright (c) 2009 Nikita Kitaev
10 **
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.
15 **
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.
20 **      \endlegal
21 */
22 /* ========================================================================= */
23
24 /* === H E A D E R S ======================================================= */
25
26 #ifdef USING_PCH
27 #       include "pch.h"
28 #else
29 #ifdef HAVE_CONFIG_H
30 #       include <config.h>
31 #endif
32
33 #include "value_desc.h"
34 #include <string>
35
36 #include "general.h"
37
38 #endif
39
40 /* === U S I N G =========================================================== */
41
42 using namespace std;
43 using namespace etl;
44 using namespace synfig;
45 using namespace synfigapp;
46
47 /* === M A C R O S ========================================================= */
48
49 /* === M E T H O D S ======================================================= */
50
51 String
52 ValueDesc::get_description(bool show_exported_name)const
53 {
54         String description;
55
56         if (show_exported_name && !is_exported())
57                 show_exported_name = false;
58
59         if (parent_is_layer_param())
60         {
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());
66         }
67         else if (parent_is_value_node())
68         {
69                 if (parent_is_linkable_value_node())
70                 {
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());
74                 }
75                 else if (parent_is_value_node_const())
76                 {
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());
80                 }
81                 else if (parent_is_waypoint())
82                         description = _("Waypoint");
83                 else
84                 {
85                         warning("%s:%d didn't expect to get here", __FILE__, __LINE__);
86                         assert(0);
87                 }
88         }
89         else if (parent_is_canvas())
90                 description = strprintf("%s (%s)", _("Exported ValueNode"),
91                                                                 get_value_node()->get_id().c_str());
92         else
93         {
94                 error("Unknown ValueDesc type");
95                 assert(0);
96         }
97
98         return description;
99 }