** $Id: layerlower.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
**
** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
+** 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.
**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
+** 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
*/
/* ========================================================================= */
Action::LayerLower::get_param_vocab()
{
ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
+
ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
.set_local_name(_("Layer"))
.set_desc(_("Layer to be lowered"))
.set_supports_multiple()
);
-
+
return ret;
}
bool
-Action::LayerLower::is_canidate(const ParamList &x)
+Action::LayerLower::is_candidate(const ParamList &x)
{
- if(!canidate_check(get_param_vocab(),x))
+ if(!candidate_check(get_param_vocab(),x))
return false;
-
+
Layer::Handle layer(x.find("layer")->second.get_layer());
//synfig::info("layer->get_depth()= %d ; layer->get_canvas()->size()=%d ;",layer->get_depth(),layer->get_canvas()->size());
if(layer->get_depth()+1>=layer->get_canvas()->size())
if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
{
layers.push_back(param.get_layer());
-
+
return true;
}
std::list<synfig::Layer::Handle>::const_iterator iter;
clear();
-
+
for(iter=layers.begin();iter!=layers.end();++iter)
{
Layer::Handle layer(*iter);
-
+
Canvas::Handle subcanvas(layer->get_canvas());
-
+
// Find the iterator for the layer
Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
-
+
// If we couldn't find the layer in the canvas, then bail
if(*iter!=layer)
throw Error(_("This layer doesn't exist anymore."));
-
+
// If the subcanvas isn't the same as the canvas,
// then it had better be an inline canvas. If not,
// bail
//if(get_canvas()!=subcanvas && !subcanvas->is_inline())
// throw Error(_("This layer doesn't belong to this canvas anymore"));
-
+
int new_index=iter-subcanvas->begin();
-
+
new_index++;
-
+
// If this lowers the layer past the bottom then don't bother
if(new_index==subcanvas->size())
continue;
-
+
Action::Handle layer_move(LayerMove::create());
-
+
layer_move->set_param("canvas",get_canvas());
layer_move->set_param("canvas_interface",get_canvas_interface());
layer_move->set_param("layer",layer);
layer_move->set_param("new_index",new_index);
-
+
add_action_front(layer_move);
}
}