1 /* === S Y N F I G ========================================================= */
2 /*! \file layersetdesc.cpp
3 ** \brief Template File
5 ** $Id: layersetdesc.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
31 #include "layersetdesc.h"
32 #include <synfigapp/canvasinterface.h>
38 using namespace synfig;
39 using namespace synfigapp;
40 using namespace Action;
42 /* === M A C R O S ========================================================= */
44 ACTION_INIT(Action::LayerSetDesc);
45 ACTION_SET_NAME(Action::LayerSetDesc,"layer_set_desc");
46 ACTION_SET_LOCAL_NAME(Action::LayerSetDesc,_("Set Layer Description"));
47 ACTION_SET_TASK(Action::LayerSetDesc,"set_desc");
48 ACTION_SET_CATEGORY(Action::LayerSetDesc,Action::CATEGORY_LAYER);
49 ACTION_SET_PRIORITY(Action::LayerSetDesc,0);
50 ACTION_SET_VERSION(Action::LayerSetDesc,"0.0");
51 ACTION_SET_CVS_ID(Action::LayerSetDesc,"$Id: layersetdesc.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
53 /* === G L O B A L S ======================================================= */
55 static const int nindex=-1;
57 /* === P R O C E D U R E S ================================================= */
59 /* === M E T H O D S ======================================================= */
61 Action::LayerSetDesc::LayerSetDesc()
66 Action::LayerSetDesc::get_param_vocab()
68 ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
70 ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
71 .set_local_name(_("Layer"))
72 .set_desc(_("Layer to be moved"))
75 ret.push_back(ParamDesc("new_description",Param::TYPE_STRING)
76 .set_local_name(_("New Description"))
77 .set_local_name(_("Enter a new description for this layer"))
85 Action::LayerSetDesc::is_canidate(const ParamList &x)
87 return canidate_check(get_param_vocab(),x);
91 Action::LayerSetDesc::set_param(const synfig::String& name, const Action::Param ¶m)
93 if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
95 layer=param.get_layer();
100 if(name=="new_description" && param.get_type()==Param::TYPE_STRING)
102 new_description=param.get_string();
107 return Action::CanvasSpecific::set_param(name,param);
111 Action::LayerSetDesc::is_ready()const
115 return Action::CanvasSpecific::is_ready();
119 Action::LayerSetDesc::perform()
121 old_description=layer->get_description();
122 layer->set_description(new_description);
124 if(get_canvas_interface())
126 get_canvas_interface()->signal_layer_new_description()(layer,new_description);
128 else synfig::warning("CanvasInterface not set on action");
132 Action::LayerSetDesc::undo()
134 layer->set_description(old_description);
136 if(get_canvas_interface())
138 get_canvas_interface()->signal_layer_new_description()(layer,old_description);
140 else synfig::warning("CanvasInterface not set on action");