From 78f44c3bf98f8b0b6a6b74ef5aba07c345639d65 Mon Sep 17 00:00:00 2001 From: dooglus Date: Sat, 29 Nov 2008 12:40:39 +0000 Subject: [PATCH] Add ValueNode "Greyed" for making ducks uneditable. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2305 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/Makefile.am | 28 ++++---- synfig-core/trunk/src/synfig/valuenode.cpp | 3 + synfig-core/trunk/src/synfig/valuenode_greyed.cpp | 82 +++++++++++++++++++++++ synfig-core/trunk/src/synfig/valuenode_greyed.h | 60 +++++++++++++++++ synfig-studio/trunk/src/synfigapp/instance.cpp | 3 +- 5 files changed, 161 insertions(+), 15 deletions(-) create mode 100644 synfig-core/trunk/src/synfig/valuenode_greyed.cpp create mode 100644 synfig-core/trunk/src/synfig/valuenode_greyed.h diff --git a/synfig-core/trunk/src/synfig/Makefile.am b/synfig-core/trunk/src/synfig/Makefile.am index 745767e..9ec94e4 100644 --- a/synfig-core/trunk/src/synfig/Makefile.am +++ b/synfig-core/trunk/src/synfig/Makefile.am @@ -31,25 +31,25 @@ VALUENODEHEADERS = \ valuenode_blinecalctangent.h valuenode_blinecalcvertex.h valuenode_blinecalcwidth.h \ valuenode_blinereversetangent.h valuenode_composite.h valuenode_const.h valuenode_cos.h \ valuenode_dotproduct.h valuenode_duplicate.h valuenode_dynamiclist.h valuenode_exp.h \ - valuenode_gradientcolor.h valuenode_gradientrotate.h valuenode_integer.h valuenode_intstring.h \ - valuenode_join.h valuenode_linear.h valuenode_radialcomposite.h valuenode_range.h \ - valuenode_realstring.h valuenode_reciprocal.h valuenode_reference.h valuenode_repeat_gradient.h \ - valuenode_scale.h valuenode_segcalctangent.h valuenode_segcalcvertex.h valuenode_sine.h \ - valuenode_step.h valuenode_stripes.h valuenode_subtract.h valuenode_switch.h valuenode_timedswap.h \ - valuenode_timeloop.h valuenode_timestring.h valuenode_twotone.h valuenode_vectorangle.h \ - valuenode_vectorlength.h valuenode_vectorx.h valuenode_vectory.h valuenode_log.h + valuenode_gradientcolor.h valuenode_gradientrotate.h valuenode_greyed.h valuenode_integer.h \ + valuenode_intstring.h valuenode_join.h valuenode_linear.h valuenode_log.h valuenode_radialcomposite.h \ + valuenode_range.h valuenode_realstring.h valuenode_reciprocal.h valuenode_reference.h \ + valuenode_repeat_gradient.h valuenode_scale.h valuenode_segcalctangent.h valuenode_segcalcvertex.h \ + valuenode_sine.h valuenode_step.h valuenode_stripes.h valuenode_subtract.h valuenode_switch.h \ + valuenode_timedswap.h valuenode_timeloop.h valuenode_timestring.h valuenode_twotone.h \ + valuenode_vectorangle.h valuenode_vectorlength.h valuenode_vectorx.h valuenode_vectory.h VALUENODESOURCES = \ valuenode_add.cpp valuenode_anglestring.cpp valuenode_animated.cpp valuenode_atan2.cpp valuenode_bline.cpp \ valuenode_blinecalctangent.cpp valuenode_blinecalcvertex.cpp valuenode_blinecalcwidth.cpp \ valuenode_blinereversetangent.cpp valuenode_composite.cpp valuenode_const.cpp valuenode_cos.cpp \ valuenode_dotproduct.cpp valuenode_duplicate.cpp valuenode_dynamiclist.cpp valuenode_exp.cpp \ - valuenode_gradientcolor.cpp valuenode_gradientrotate.cpp valuenode_integer.cpp valuenode_intstring.cpp \ - valuenode_join.cpp valuenode_linear.cpp valuenode_radialcomposite.cpp valuenode_range.cpp \ - valuenode_realstring.cpp valuenode_reciprocal.cpp valuenode_reference.cpp valuenode_repeat_gradient.cpp \ - valuenode_scale.cpp valuenode_segcalctangent.cpp valuenode_segcalcvertex.cpp valuenode_sine.cpp \ - valuenode_step.cpp valuenode_stripes.cpp valuenode_subtract.cpp valuenode_switch.cpp valuenode_timedswap.cpp \ - valuenode_timeloop.cpp valuenode_timestring.cpp valuenode_twotone.cpp valuenode_vectorangle.cpp \ - valuenode_vectorlength.cpp valuenode_vectorx.cpp valuenode_vectory.cpp valuenode_log.cpp + valuenode_gradientcolor.cpp valuenode_gradientrotate.cpp valuenode_greyed.cpp valuenode_integer.cpp \ + valuenode_intstring.cpp valuenode_join.cpp valuenode_linear.cpp valuenode_log.cpp valuenode_radialcomposite.cpp \ + valuenode_range.cpp valuenode_realstring.cpp valuenode_reciprocal.cpp valuenode_reference.cpp \ + valuenode_repeat_gradient.cpp valuenode_scale.cpp valuenode_segcalctangent.cpp valuenode_segcalcvertex.cpp \ + valuenode_sine.cpp valuenode_step.cpp valuenode_stripes.cpp valuenode_subtract.cpp valuenode_switch.cpp \ + valuenode_timedswap.cpp valuenode_timeloop.cpp valuenode_timestring.cpp valuenode_twotone.cpp \ + valuenode_vectorangle.cpp valuenode_vectorlength.cpp valuenode_vectorx.cpp valuenode_vectory.cpp VALUEHEADERS = \ blinepoint.h gradient.h value.h diff --git a/synfig-core/trunk/src/synfig/valuenode.cpp b/synfig-core/trunk/src/synfig/valuenode.cpp index 1d4c854..5d8647a 100644 --- a/synfig-core/trunk/src/synfig/valuenode.cpp +++ b/synfig-core/trunk/src/synfig/valuenode.cpp @@ -45,6 +45,7 @@ #include "valuenode_linear.h" #include "valuenode_composite.h" #include "valuenode_reference.h" +#include "valuenode_greyed.h" #include "valuenode_scale.h" #include "valuenode_blinecalctangent.h" #include "valuenode_blinecalcvertex.h" @@ -179,6 +180,8 @@ ValueNode::subsys_init() ADD_VALUENODE(ValueNode_IntString, "intstring", _("Int String"), RELEASE_VERSION_0_61_09); // SVN r2010 ADD_VALUENODE(ValueNode_Logarithm, "logarithm", _("Logarithm"), RELEASE_VERSION_0_61_09); // SVN r2034 + ADD_VALUENODE(ValueNode_Greyed, "greyed", _("Greyed"), RELEASE_VERSION_0_61_10); // SVN r2305 + #undef ADD_VALUENODE #undef ADD_VALUENODE2 diff --git a/synfig-core/trunk/src/synfig/valuenode_greyed.cpp b/synfig-core/trunk/src/synfig/valuenode_greyed.cpp new file mode 100644 index 0000000..4e3536e --- /dev/null +++ b/synfig-core/trunk/src/synfig/valuenode_greyed.cpp @@ -0,0 +1,82 @@ +/* === S Y N F I G ========================================================= */ +/*! \file valuenode_greyed.cpp +** \brief Implementation of the "Greyed" valuenode conversion. +** +** $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 "valuenode_greyed.h" +#include "valuenode_const.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace synfig; + +/* === M A C R O S ========================================================= */ + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +ValueNode_Greyed::ValueNode_Greyed(const ValueBase::Type &x): + ValueNode_Reference(x) +{ +} + +ValueNode_Greyed::ValueNode_Greyed(const ValueNode::Handle &x): + ValueNode_Reference(x->get_type()) +{ + set_link("link",x); +} + +ValueNode_Greyed* +ValueNode_Greyed::create(const ValueBase &x) +{ + return new ValueNode_Greyed(ValueNode_Const::create(x)); +} + +LinkableValueNode* +ValueNode_Greyed::create_new()const +{ + return new ValueNode_Greyed(get_type()); +} + +String +ValueNode_Greyed::get_name()const +{ + return "greyed"; +} + +String +ValueNode_Greyed::get_local_name()const +{ + return _("Greyed"); +} diff --git a/synfig-core/trunk/src/synfig/valuenode_greyed.h b/synfig-core/trunk/src/synfig/valuenode_greyed.h new file mode 100644 index 0000000..6996336 --- /dev/null +++ b/synfig-core/trunk/src/synfig/valuenode_greyed.h @@ -0,0 +1,60 @@ +/* === S Y N F I G ========================================================= */ +/*! \file valuenode_greyed.h +** \brief Header file for implementation of the "Greyed" valuenode conversion. +** +** $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 +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SYNFIG_VALUENODE_GREYED_H +#define __SYNFIG_VALUENODE_GREYED_H + +/* === H E A D E R S ======================================================= */ + +#include "valuenode_reference.h" + +/* === M A C R O S ========================================================= */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace synfig { + +class ValueNode_Greyed : public ValueNode_Reference +{ +public: + typedef etl::handle Handle; + ValueNode_Greyed(const ValueBase::Type &x); + ValueNode_Greyed(const ValueNode::Handle &x); + + virtual String get_name()const; + virtual String get_local_name()const; + +protected: + LinkableValueNode* create_new()const; + +public: + static ValueNode_Greyed* create(const ValueBase &x); + +}; // END of class ValueNode_Greyed + +}; // END of namespace synfig + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/trunk/src/synfigapp/instance.cpp b/synfig-studio/trunk/src/synfigapp/instance.cpp index 92fd239..020d337 100644 --- a/synfig-studio/trunk/src/synfigapp/instance.cpp +++ b/synfig-studio/trunk/src/synfigapp/instance.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +70,7 @@ synfigapp::is_editable(synfig::ValueNode::Handle value_node) || ValueNode_Animated::Handle::cast_dynamic(value_node) || ValueNode_Composite::Handle::cast_dynamic(value_node) || ValueNode_RadialComposite::Handle::cast_dynamic(value_node) - || ValueNode_Reference::Handle::cast_dynamic(value_node) + ||(ValueNode_Reference::Handle::cast_dynamic(value_node) && !ValueNode_Greyed::Handle::cast_dynamic(value_node)) || ValueNode_BLineCalcVertex::Handle::cast_dynamic(value_node) || ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_node) || ValueNode_BLineCalcWidth::Handle::cast_dynamic(value_node) -- 2.7.4