1 /* === S Y N F I G ========================================================= */
2 /*! \file valuenodeconstset.cpp
3 ** \brief Template File
5 ** $Id: valuenodeconstset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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 "valuenodeconstset.h"
33 #include <synfigapp/canvasinterface.h>
39 using namespace synfig;
40 using namespace synfigapp;
41 using namespace Action;
43 /* === M A C R O S ========================================================= */
45 ACTION_INIT(Action::ValueNodeConstSet);
46 ACTION_SET_NAME(Action::ValueNodeConstSet,"value_node_const_set");
47 ACTION_SET_LOCAL_NAME(Action::ValueNodeConstSet,_("Set ValueNode_Const"));
48 ACTION_SET_TASK(Action::ValueNodeConstSet,"set");
49 ACTION_SET_CATEGORY(Action::ValueNodeConstSet,Action::CATEGORY_VALUENODE);
50 ACTION_SET_PRIORITY(Action::ValueNodeConstSet,0);
51 ACTION_SET_VERSION(Action::ValueNodeConstSet,"0.0");
52 ACTION_SET_CVS_ID(Action::ValueNodeConstSet,"$Id: valuenodeconstset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
54 /* === G L O B A L S ======================================================= */
56 /* === P R O C E D U R E S ================================================= */
58 /* === M E T H O D S ======================================================= */
60 Action::ValueNodeConstSet::ValueNodeConstSet()
66 Action::ValueNodeConstSet::get_param_vocab()
68 ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
70 ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
71 .set_local_name(_("ValueNode_Const"))
74 ret.push_back(ParamDesc("new_value",Param::TYPE_VALUE)
75 .set_local_name(_("ValueBase"))
82 Action::ValueNodeConstSet::is_candidate(const ParamList &x)
84 if(candidate_check(get_param_vocab(),x))
86 if(ValueNode_Const::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()))
93 Action::ValueNodeConstSet::set_param(const synfig::String& name, const Action::Param ¶m)
95 if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
97 value_node=ValueNode_Const::Handle::cast_dynamic(param.get_value_node());
99 return (bool)value_node;
102 if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
104 new_value=param.get_value();
109 return Action::CanvasSpecific::set_param(name,param);
113 Action::ValueNodeConstSet::is_ready()const
115 if(!value_node || !new_value.is_valid())
117 return Action::CanvasSpecific::is_ready();
121 Action::ValueNodeConstSet::perform()
125 old_value=value_node->get_value();
127 value_node->set_value(new_value);
129 // Signal that a layer has been inserted
130 /*if(get_canvas_interface())
132 get_canvas_interface()->signal_value_node_changed()(value_node);
137 Action::ValueNodeConstSet::undo()
141 value_node->set_value(old_value);
143 // Signal that a layer has been inserted
144 /*if(get_canvas_interface())
146 get_canvas_interface()->signal_value_node_changed()(value_node);