From: dooglus Date: Sun, 13 Jan 2008 16:33:27 +0000 (+0000) Subject: Add new file value_desc.cpp and add it to the Makefile. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=238847fac924cf756235b9c63cbf1a48341f648f;p=synfig.git Add new file value_desc.cpp and add it to the Makefile. git-svn-id: http://svn.voria.com/code@1344 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/synfigapp/Makefile.am b/synfig-studio/trunk/src/synfigapp/Makefile.am index f7e0f36..b53f409 100644 --- a/synfig-studio/trunk/src/synfigapp/Makefile.am +++ b/synfig-studio/trunk/src/synfigapp/Makefile.am @@ -87,12 +87,12 @@ ACTIONCC = \ $(OTHER_ACTION_CC) $(TIMEPOINT_ACTION_CC) $(VALUEDESC_ACTION_CC) $(VALUENODE_ACTION_CC) $(WAYPOINT_ACTION_CC) SYNFIGAPPHH = \ - editmode.h selectionmanager.h value_desc.h \ + editmode.h selectionmanager.h \ $(ACTIONHH) action.h action_param.h action_system.h blineconvert.h canvasinterface.h cvs.h \ - inputdevice.h instance.h main.h settings.h uimanager.h + inputdevice.h instance.h main.h settings.h uimanager.h value_desc.h SYNFIGAPPCC = \ $(ACTIONCC) action.cpp action_param.cpp action_system.cpp blineconvert.cpp canvasinterface.cpp cvs.cpp \ - inputdevice.cpp instance.cpp main.cpp settings.cpp uimanager.cpp + inputdevice.cpp instance.cpp main.cpp settings.cpp uimanager.cpp value_desc.cpp synfiglibdir = @synfiglibdir@ 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; +}