1 /* === S Y N F I G ========================================================= */
2 /*! \file action_param.cpp
3 ** \brief Template File
5 ** $Id: action_param.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 "action_param.h"
34 #include "canvasinterface.h"
40 using namespace synfig;
41 using namespace synfigapp;
42 using namespace Action;
44 /* === P R O C E D U R E S ================================================= */
47 Action::canidate_check(const ParamVocab& param_vocab, const ParamList& param_list)
49 ParamVocab::const_iterator iter;
51 for(iter=param_vocab.begin();iter!=param_vocab.end();++iter)
53 int n(param_list.count(iter->get_name()));
55 // if(n && !iter->get_mutual_exclusion().empty() && param_list.count(iter->get_mutual_exclusion()))
58 if(!n && !iter->get_mutual_exclusion().empty() && param_list.count(iter->get_mutual_exclusion()))
61 if(iter->get_user_supplied() || iter->get_optional())
66 if(n==1 && iter->get_requires_multiple())
68 if(n>1 && !iter->get_supports_multiple())
71 if(iter->get_type()!=param_list.find(iter->get_name())->second.get_type())
77 /* === S T A T I C S ======================================================= */
85 synfig::error("%d action params not yet deleted!",counter);
89 int _ParamCounter::counter(0);
91 /* === M E T H O D S ======================================================= */
93 Param::Param(const Param &rhs):
96 _ParamCounter::counter++;
99 case TYPE_ACTIVEPOINT:
100 data.activepoint.construct();
101 data.activepoint.get()=rhs.data.activepoint.get();
104 data.waypoint.construct();
105 data.waypoint.get()=rhs.data.waypoint.get();
107 case TYPE_WAYPOINTMODEL:
108 data.waypoint_model.construct();
109 data.waypoint_model.get()=rhs.data.waypoint_model.get();
112 data.keyframe.construct();
113 data.keyframe.get()=rhs.data.keyframe.get();
116 data.canvas.construct();
117 data.canvas.get()=rhs.data.canvas.get();
119 case TYPE_CANVASINTERFACE:
120 data.canvas_interface.construct();
121 data.canvas_interface.get()=rhs.data.canvas_interface.get();
124 data.layer.construct();
125 data.layer.get()=rhs.data.layer.get();
128 data.value_node.construct();
129 data.value_node.get()=rhs.data.value_node.get();
132 data.value_desc.construct();
133 data.value_desc.get()=rhs.data.value_desc.get();
136 data.value.construct();
137 data.value.get()=rhs.data.value.get();
140 data.string.construct();
141 data.string.get()=rhs.data.string.get();
144 data.rend_desc.construct();
145 data.rend_desc.get()=rhs.data.rend_desc.get();
148 data.time.construct();
149 data.time.get()=rhs.data.time.get();
153 data.integer=rhs.data.integer;
156 data.edit_mode=rhs.data.edit_mode;
159 data.real=rhs.data.real;
174 Param::Param(const etl::handle<synfigapp::CanvasInterface>& x):
176 type_(TYPE_CANVASINTERFACE)
178 _ParamCounter::counter++;
179 data.canvas_interface.construct();
180 data.canvas_interface.get()=x;
184 Param::Param(synfigapp::CanvasInterface* x):
186 type_(TYPE_CANVASINTERFACE)
188 _ParamCounter::counter++;
189 data.canvas_interface.construct();
190 data.canvas_interface=x;
194 Param::Param(const etl::loose_handle<synfigapp::CanvasInterface>& x):
196 type_(TYPE_CANVASINTERFACE)
198 _ParamCounter::counter++;
199 data.canvas_interface.construct();
200 data.canvas_interface.get()=x;
203 Param::Param(const synfig::Canvas::Handle& x):
206 _ParamCounter::counter++;
207 data.canvas.construct();
211 Param::Param(const synfig::Canvas::LooseHandle& x):
214 _ParamCounter::counter++;
215 data.canvas.construct();
219 Param::Param(const synfig::Layer::Handle& x):
223 _ParamCounter::counter++;
224 data.layer.construct();
228 Param::Param(const synfig::Layer::LooseHandle& x):
232 _ParamCounter::counter++;
233 data.layer.construct();
237 Param::Param(const synfig::ValueNode::Handle& x):
239 type_(TYPE_VALUENODE)
241 _ParamCounter::counter++;
242 data.value_node.construct();
243 data.value_node.get()=x;
246 Param::Param(const synfig::ValueNode::LooseHandle& x):
248 type_(TYPE_VALUENODE)
250 _ParamCounter::counter++;
251 data.value_node.construct();
252 data.value_node.get()=x;
255 Param::Param(const synfig::ValueBase& x):
259 _ParamCounter::counter++;
260 data.value.construct();
264 Param::Param(const synfig::RendDesc& x):
267 _ParamCounter::counter++;
268 data.rend_desc.construct();
269 data.rend_desc.get()=x;
272 Param::Param(const synfig::Time& x):
275 _ParamCounter::counter++;
276 data.time.construct();
280 Param::Param(const synfig::Activepoint& x):
282 type_(TYPE_ACTIVEPOINT)
284 _ParamCounter::counter++;
285 data.activepoint.construct();
286 data.activepoint.get()=x;
289 Param::Param(const synfig::Waypoint& x):
292 _ParamCounter::counter++;
293 data.waypoint.construct();
294 data.waypoint.get()=x;
297 Param::Param(const synfig::Waypoint::Model& x):
298 type_(TYPE_WAYPOINTMODEL)
300 _ParamCounter::counter++;
301 data.waypoint_model.construct();
302 data.waypoint_model.get()=x;
305 Param::Param(const synfig::String& x):
308 _ParamCounter::counter++;
309 data.string.construct();
313 Param::Param(const char * x):
316 _ParamCounter::counter++;
317 data.string.construct();
321 Param::Param(const synfig::Keyframe& x):
325 _ParamCounter::counter++;
326 data.keyframe.construct();
327 data.keyframe.get()=x;
330 Param::Param(const synfigapp::ValueDesc& x):
332 type_(TYPE_VALUEDESC)
334 _ParamCounter::counter++;
335 data.value_desc.construct();
336 data.value_desc.get()=x;
339 Param::Param(const int& x):
342 _ParamCounter::counter++;
346 Param::Param(const EditMode& x):
349 _ParamCounter::counter++;
353 Param::Param(const synfig::Real& x):
357 _ParamCounter::counter++;
361 Param::Param(const bool& x):
365 _ParamCounter::counter++;
372 _ParamCounter::counter--;
376 Param::operator=(const Param& rhs)
383 case TYPE_ACTIVEPOINT:
384 data.activepoint.construct();
385 data.activepoint.get()=rhs.data.activepoint.get();
388 data.waypoint.construct();
389 data.waypoint.get()=rhs.data.waypoint.get();
391 case TYPE_WAYPOINTMODEL:
392 data.waypoint_model.construct();
393 data.waypoint_model.get()=rhs.data.waypoint_model.get();
396 data.keyframe.construct();
397 data.keyframe.get()=rhs.data.keyframe.get();
400 data.canvas.construct();
401 data.canvas.get()=rhs.data.canvas.get();
403 case TYPE_CANVASINTERFACE:
404 data.canvas_interface.construct();
405 data.canvas_interface.get()=rhs.data.canvas_interface.get();
408 data.time.construct();
409 data.time.get()=rhs.data.time.get();
412 data.layer.construct();
413 data.layer.get()=rhs.data.layer.get();
416 data.value_node.construct();
417 data.value_node.get()=rhs.data.value_node.get();
420 data.value_desc.construct();
421 data.value_desc.get()=rhs.data.value_desc.get();
424 data.value.construct();
425 data.value.get()=rhs.data.value.get();
428 data.rend_desc.construct();
429 data.rend_desc.get()=rhs.data.rend_desc.get();
432 data.string.construct();
433 data.string.get()=rhs.data.string.get();
437 data.integer=rhs.data.integer;
440 data.integer=rhs.data.integer;
443 data.real=rhs.data.real;
464 case TYPE_ACTIVEPOINT:
465 data.activepoint.destruct();
468 data.waypoint.destruct();
470 case TYPE_WAYPOINTMODEL:
471 data.waypoint_model.destruct();
474 data.keyframe.destruct();
477 data.canvas.destruct();
479 case TYPE_CANVASINTERFACE:
480 data.canvas_interface.destruct();
483 data.layer.destruct();
486 data.time.destruct();
489 data.value_node.destruct();
492 data.value_desc.destruct();
495 data.value.destruct();
498 data.rend_desc.destruct();
501 data.string.destruct();