X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Flayerlower.cpp;h=68cad973cc5708f06e2895f9771de4054f516f01;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=6fc401c871205b178df0ad08f172638d9c5e3364;hpb=dee84efa006428fdfbf0e84b66ee94eb23113ad9;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/layerlower.cpp b/synfig-studio/trunk/src/synfigapp/actions/layerlower.cpp index 6fc401c..68cad97 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/layerlower.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/layerlower.cpp @@ -2,10 +2,11 @@ /*! \file layerlower.cpp ** \brief Template File ** -** $Id: layerlower.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ +** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2008 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -33,6 +34,8 @@ #include "layermove.h" #include +#include + #endif using namespace std; @@ -43,14 +46,14 @@ using namespace Action; /* === M A C R O S ========================================================= */ -ACTION_INIT(Action::LayerLower); -ACTION_SET_NAME(Action::LayerLower,"layer_lower"); -ACTION_SET_LOCAL_NAME(Action::LayerLower,"Lower Layer"); +ACTION_INIT_NO_GET_LOCAL_NAME(Action::LayerLower); +ACTION_SET_NAME(Action::LayerLower,"LayerLower"); +ACTION_SET_LOCAL_NAME(Action::LayerLower,N_("Lower Layer")); ACTION_SET_TASK(Action::LayerLower,"lower"); ACTION_SET_CATEGORY(Action::LayerLower,Action::CATEGORY_LAYER); ACTION_SET_PRIORITY(Action::LayerLower,10); ACTION_SET_VERSION(Action::LayerLower,"0.0"); -ACTION_SET_CVS_ID(Action::LayerLower,"$Id: layerlower.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $"); +ACTION_SET_CVS_ID(Action::LayerLower,"$Id$"); /* === G L O B A L S ======================================================= */ @@ -62,17 +65,23 @@ Action::LayerLower::LayerLower() { } +synfig::String +Action::LayerLower::get_local_name()const +{ + return get_layer_descriptions(layers, _("Lower Layer"), _("Lower Layers")); +} + Action::ParamVocab 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; } @@ -81,7 +90,7 @@ Action::LayerLower::is_candidate(const ParamList &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()) @@ -95,7 +104,7 @@ Action::LayerLower::set_param(const synfig::String& name, const Action::Param &p if(name=="layer" && param.get_type()==Param::TYPE_LAYER) { layers.push_back(param.get_layer()); - + return true; } @@ -116,41 +125,41 @@ Action::LayerLower::prepare() std::list::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); } }