X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Fvaluedescexport.cpp;h=0ae145352deac8aaf25c97ad3ed598c708c2b2f7;hb=828216f2051e31236e9edbc79be2cf7833abbc7e;hp=e63ded906e7a3fd055e768d9642b1c3474595887;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/valuedescexport.cpp b/synfig-studio/trunk/src/synfigapp/actions/valuedescexport.cpp index e63ded9..0ae1453 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/valuedescexport.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/valuedescexport.cpp @@ -1,20 +1,21 @@ /* === S Y N F I G ========================================================= */ -/*! \file valuedescset.cpp +/*! \file valuedescexport.cpp ** \brief Template File ** -** $Id: valuedescexport.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ +** $Id$ ** ** \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 */ /* ========================================================================= */ @@ -37,6 +38,8 @@ #include #include +#include + #endif using namespace std; @@ -49,12 +52,12 @@ using namespace Action; ACTION_INIT(Action::ValueDescExport); ACTION_SET_NAME(Action::ValueDescExport,"value_desc_export"); -ACTION_SET_LOCAL_NAME(Action::ValueDescExport,"Export"); +ACTION_SET_LOCAL_NAME(Action::ValueDescExport,N_("Export")); ACTION_SET_TASK(Action::ValueDescExport,"export"); ACTION_SET_CATEGORY(Action::ValueDescExport,Action::CATEGORY_VALUEDESC); ACTION_SET_PRIORITY(Action::ValueDescExport,0); ACTION_SET_VERSION(Action::ValueDescExport,"0.0"); -ACTION_SET_CVS_ID(Action::ValueDescExport,"$Id: valuedescexport.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $"); +ACTION_SET_CVS_ID(Action::ValueDescExport,"$Id$"); /* === G L O B A L S ======================================================= */ @@ -70,7 +73,7 @@ Action::ParamVocab Action::ValueDescExport::get_param_vocab() { ParamVocab ret(Action::CanvasSpecific::get_param_vocab()); - + ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC) .set_local_name(_("ValueDesc")) ); @@ -80,21 +83,21 @@ Action::ValueDescExport::get_param_vocab() .set_desc(_("The name that you want this value to be exported as")) .set_user_supplied() ); - + return ret; } bool -Action::ValueDescExport::is_canidate(const ParamList &x) +Action::ValueDescExport::is_candidate(const ParamList &x) { - if(canidate_check(get_param_vocab(),x)) + if(candidate_check(get_param_vocab(),x)) { ValueDesc value_desc=x.find("value_desc")->second.get_value_desc(); if(!value_desc || value_desc.parent_is_canvas() || (value_desc.is_value_node() && value_desc.get_value_node()->is_exported())) return false; return true; } - return false; + return false; } bool @@ -103,14 +106,14 @@ Action::ValueDescExport::set_param(const synfig::String& param_name, const Actio if(param_name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC) { value_desc=param.get_value_desc(); - + return true; } if(param_name=="name" && param.get_type()==Param::TYPE_STRING) { name=param.get_string(); - + return true; } @@ -137,24 +140,24 @@ Action::ValueDescExport::prepare() if(!value_desc.is_const()) throw Error(_("Can only export Canvas when used as constant parameter")); Canvas::Handle canvas(value_desc.get_value().get(Canvas::Handle())); - + Action::Handle action(CanvasAdd::create()); - + action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("src",canvas); action->set_param("id",name); - - assert(action->is_ready()); + + assert(action->is_ready()); if(!action->is_ready()) throw Error(Error::TYPE_NOTREADY); - - add_action_front(action); - + + add_action_front(action); + return; } - + if(value_desc.is_value_node()) { if(value_desc.get_value_node()->is_exported()) @@ -166,32 +169,32 @@ Action::ValueDescExport::prepare() { if(!value_desc.parent_is_layer_param()) throw Error(_("Unable to export parameter. (Bug?)")); - + value_node=ValueNode_Const::create(value_desc.get_value()); - + Action::Handle action(LayerParamConnect::create()); - + action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("layer",value_desc.get_layer()); action->set_param("param",value_desc.get_param_name()); action->set_param("value_node",value_node); - - assert(action->is_ready()); + + assert(action->is_ready()); if(!action->is_ready()) throw Error(Error::TYPE_NOTREADY); - - add_action_front(action); + + add_action_front(action); } - + Action::Handle action(ValueNodeAdd::create()); - + action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("new",value_node); action->set_param("name",name); - assert(action->is_ready()); + assert(action->is_ready()); if(!action->is_ready()) throw Error(Error::TYPE_NOTREADY);