1 /* === S Y N F I G ========================================================= */
2 /*! \file groupremove.cpp
3 ** \brief Template File
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 "groupremove.h"
33 #include <synfigapp/canvasinterface.h>
35 #include <synfigapp/general.h>
41 using namespace synfig;
42 using namespace synfigapp;
43 using namespace Action;
45 /* === M A C R O S ========================================================= */
47 ACTION_INIT(Action::GroupRemove);
48 ACTION_SET_NAME(Action::GroupRemove,"GroupRemove");
49 ACTION_SET_LOCAL_NAME(Action::GroupRemove,N_("Remove Group"));
50 ACTION_SET_TASK(Action::GroupRemove,"remove");
51 ACTION_SET_CATEGORY(Action::GroupRemove,Action::CATEGORY_GROUP);
52 ACTION_SET_PRIORITY(Action::GroupRemove,0);
53 ACTION_SET_VERSION(Action::GroupRemove,"0.0");
54 ACTION_SET_CVS_ID(Action::GroupRemove,"$Id$");
56 /* === G L O B A L S ======================================================= */
58 /* === P R O C E D U R E S ================================================= */
60 /* === M E T H O D S ======================================================= */
62 Action::GroupRemove::GroupRemove()
67 Action::GroupRemove::get_param_vocab()
69 ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
71 ret.push_back(ParamDesc("group",Param::TYPE_STRING)
72 .set_local_name(_("Group"))
73 .set_desc(_("Name of the Group to remove"))
80 Action::GroupRemove::is_candidate(const ParamList &x)
82 bool ret(candidate_check(get_param_vocab(),x));
85 synfig::info("Action::GroupRemove::is_candidate(): failed candidate check");
86 ParamList::const_iterator iter;
87 for(iter=x.begin();iter!=x.end();++iter)
89 synfig::info("PARAM: %s",iter->first.c_str());
96 Action::GroupRemove::set_param(const synfig::String& name, const Action::Param ¶m)
98 if(name=="group" && param.get_type()==Param::TYPE_STRING)
100 group=param.get_string();
105 return Action::CanvasSpecific::set_param(name,param);
109 Action::GroupRemove::is_ready()const
113 return Action::CanvasSpecific::is_ready();
117 Action::GroupRemove::perform()
119 layer_list=get_canvas()->get_layers_in_group(group);
121 std::set<synfig::Layer::Handle>::iterator iter;
122 for(iter=layer_list.begin();iter!=layer_list.end();++iter)
124 (*iter)->remove_from_group(group);
129 Action::GroupRemove::undo()
131 std::set<synfig::Layer::Handle>::iterator iter;
132 for(iter=layer_list.begin();iter!=layer_list.end();++iter)
134 (*iter)->add_to_group(group);