X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Fvaluedescconvert.cpp;h=2230cf93a5a5e0cf8321db9e01f5e110d610ff20;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=6f8977b4bf9b06e73e6d59f84b5be362cf922962;hpb=c34eaa5441242b3e9a7b7645e9ee4983d14eae85;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp b/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp index 6f8977b..2230cf9 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp @@ -2,10 +2,11 @@ /*! \file valuedescconvert.cpp ** \brief Template File ** -** $Id: valuedescconvert.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) 2007, 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 @@ -42,6 +43,8 @@ #include #include +#include + #endif using namespace std; @@ -52,14 +55,14 @@ using namespace Action; /* === M A C R O S ========================================================= */ -ACTION_INIT(Action::ValueDescConvert); -ACTION_SET_NAME(Action::ValueDescConvert,"value_desc_convert"); -ACTION_SET_LOCAL_NAME(Action::ValueDescConvert,"Convert"); +ACTION_INIT_NO_GET_LOCAL_NAME(Action::ValueDescConvert); +ACTION_SET_NAME(Action::ValueDescConvert,"ValueDescConvert"); +ACTION_SET_LOCAL_NAME(Action::ValueDescConvert,N_("Convert")); ACTION_SET_TASK(Action::ValueDescConvert,"convert"); ACTION_SET_CATEGORY(Action::ValueDescConvert,Action::CATEGORY_VALUEDESC); ACTION_SET_PRIORITY(Action::ValueDescConvert,0); ACTION_SET_VERSION(Action::ValueDescConvert,"0.0"); -ACTION_SET_CVS_ID(Action::ValueDescConvert,"$Id: valuedescconvert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $"); +ACTION_SET_CVS_ID(Action::ValueDescConvert,"$Id$"); /* === G L O B A L S ======================================================= */ @@ -69,6 +72,16 @@ ACTION_SET_CVS_ID(Action::ValueDescConvert,"$Id: valuedescconvert.cpp,v 1.1.1.1 Action::ValueDescConvert::ValueDescConvert() { + time=(Time::begin()-1); +} + +synfig::String +Action::ValueDescConvert::get_local_name()const +{ + // TRANSLATORS: This is used in the 'history' dialog when a ValueNode is converted. The first %s is what is converted, the 2nd is the local name of the ValueNode's type. + return strprintf(_("Convert '%s' to ValueNode type '%s'"), + value_desc.get_description().c_str(), + LinkableValueNode::book()[type].local_name.c_str()); } Action::ParamVocab @@ -85,6 +98,10 @@ Action::ValueDescConvert::get_param_vocab() .set_desc(_("The type of ValueNode that you want to be converted to")) ); + ret.push_back(ParamDesc("time",Param::TYPE_TIME) + .set_local_name(_("Time")) + ); + return ret; } @@ -111,6 +128,13 @@ Action::ValueDescConvert::set_param(const synfig::String& name, const Action::Pa return true; } + if(name=="time" && param.get_type()==Param::TYPE_TIME) + { + time=param.get_time(); + + return true; + } + return Action::CanvasSpecific::set_param(name,param); } @@ -119,6 +143,11 @@ Action::ValueDescConvert::is_ready()const { if(!value_desc || type.empty()) return false; + if(time==(Time::begin()-1)) + { + synfig::error("Missing time"); + return false; + } return Action::CanvasSpecific::is_ready(); } @@ -132,7 +161,7 @@ Action::ValueDescConvert::prepare() if(value_desc.is_const()) value=value_desc.get_value(); else if(value_desc.is_value_node()) - value=(*value_desc.get_value_node())(0); + value=(*value_desc.get_value_node())(time); else throw Error(_("Unable to decipher ValueDesc (Bug?)")); @@ -220,6 +249,6 @@ Action::ValueDescConvert::prepare() - throw Error(_("ValueDesc is not recognised or supported.")); + throw Error(_("ValueDesc is not recognized or supported.")); */ }