X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Flayerduplicate.cpp;h=530dc8463cd3bb2f8e43395818e12dafff30993c;hb=4105b5d61d5145f737d1603263c0a0292df22407;hp=74a829d7a65eb02b55a49b85dd586f242bd118a0;hpb=c34eaa5441242b3e9a7b7645e9ee4983d14eae85;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/layerduplicate.cpp b/synfig-studio/trunk/src/synfigapp/actions/layerduplicate.cpp index 74a829d..530dc84 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/layerduplicate.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/layerduplicate.cpp @@ -2,10 +2,11 @@ /*! \file layerduplicate.cpp ** \brief Template File ** -** $Id: layerduplicate.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 "layeradd.h" #include +#include + #endif using namespace std; @@ -43,14 +46,14 @@ using namespace Action; /* === M A C R O S ========================================================= */ -ACTION_INIT(Action::LayerDuplicate); +ACTION_INIT_NO_GET_LOCAL_NAME(Action::LayerDuplicate); ACTION_SET_NAME(Action::LayerDuplicate,"layer_duplicate"); -ACTION_SET_LOCAL_NAME(Action::LayerDuplicate,"Duplicate Layer"); +ACTION_SET_LOCAL_NAME(Action::LayerDuplicate,N_("Duplicate Layer")); ACTION_SET_TASK(Action::LayerDuplicate,"duplicate"); ACTION_SET_CATEGORY(Action::LayerDuplicate,Action::CATEGORY_LAYER); ACTION_SET_PRIORITY(Action::LayerDuplicate,0); ACTION_SET_VERSION(Action::LayerDuplicate,"0.0"); -ACTION_SET_CVS_ID(Action::LayerDuplicate,"$Id: layerduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $"); +ACTION_SET_CVS_ID(Action::LayerDuplicate,"$Id$"); /* === G L O B A L S ======================================================= */ @@ -62,6 +65,12 @@ Action::LayerDuplicate::LayerDuplicate() { } +synfig::String +Action::LayerDuplicate::get_local_name()const +{ + return get_layer_descriptions(layers, _("Duplicate Layer"), _("Duplicate Layers")); +} + Action::ParamVocab Action::LayerDuplicate::get_param_vocab() { @@ -151,5 +160,29 @@ Action::LayerDuplicate::prepare() add_action_front(action); } + + // automatically export the Index parameter of Duplicate layers when duplicating + if (new_layer->get_name() == "duplicate") + for (int i = 1; ; i++) + { + String name = strprintf(_("Index %d"), i); + try + { + subcanvas->find_value_node(name); + } + catch (Exception::IDNotFound x) + { + Action::Handle action(Action::create("value_node_add")); + + action->set_param("canvas",subcanvas); + action->set_param("canvas_interface",get_canvas_interface()); + action->set_param("new",new_layer->dynamic_param_list().find("index")->second); + action->set_param("name",name); + + add_action_front(action); + + break; + } + } } }