X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsinfgapp%2Factions%2Fvaluedescconvert.cpp;fp=synfig-studio%2Ftrunk%2Fsrc%2Fsinfgapp%2Factions%2Fvaluedescconvert.cpp;h=0000000000000000000000000000000000000000;hb=02252941b29de64037116f4d37991a38d9ff0d94;hp=5163bb5479b0efe0480c27d838ccbe30b607e838;hpb=34f6fabfcefdc878ba3c08b82358ae4aef439e99;p=synfig.git diff --git a/synfig-studio/trunk/src/sinfgapp/actions/valuedescconvert.cpp b/synfig-studio/trunk/src/sinfgapp/actions/valuedescconvert.cpp deleted file mode 100644 index 5163bb5..0000000 --- a/synfig-studio/trunk/src/sinfgapp/actions/valuedescconvert.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/* === S I N F G =========================================================== */ -/*! \file valuedescconvert.cpp -** \brief Template File -** -** $Id: valuedescconvert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ -** -** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. -** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. -** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -/* -#include "valuenodereplace.h" -#include "layerparamconnect.h" -#include "valuenodelinkconnect.h" -*/ - -#include "valuedescconnect.h" - -#include "valuedescconvert.h" - -#include -#include - -#endif - -using namespace std; -using namespace etl; -using namespace sinfg; -using namespace sinfgapp; -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_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 $"); - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -Action::ValueDescConvert::ValueDescConvert() -{ -} - -Action::ParamVocab -Action::ValueDescConvert::get_param_vocab() -{ - ParamVocab ret(Action::CanvasSpecific::get_param_vocab()); - - ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC) - .set_local_name(_("ValueDesc")) - ); - - ret.push_back(ParamDesc("type",Param::TYPE_STRING) - .set_local_name(_("Type")) - .set_desc(_("The type of ValueNode that you want to be converted to")) - ); - - return ret; -} - -bool -Action::ValueDescConvert::is_canidate(const ParamList &x) -{ - return canidate_check(get_param_vocab(),x); -} - -bool -Action::ValueDescConvert::set_param(const sinfg::String& name, const Action::Param ¶m) -{ - if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC) - { - value_desc=param.get_value_desc(); - - return true; - } - - if(name=="type" && param.get_type()==Param::TYPE_STRING) - { - type=param.get_string(); - - return true; - } - - return Action::CanvasSpecific::set_param(name,param); -} - -bool -Action::ValueDescConvert::is_ready()const -{ - if(!value_desc || type.empty()) - return false; - return Action::CanvasSpecific::is_ready(); -} - -void -Action::ValueDescConvert::prepare() -{ - clear(); - - ValueBase value; - - if(value_desc.is_const()) - value=value_desc.get_value(); - else if(value_desc.is_value_node()) - value=(*value_desc.get_value_node())(0); - else - throw Error(_("Unable to decipher ValueDesc (Bug?)")); - - ValueNode::Handle src_value_node(LinkableValueNode::create(type,value)); - - if(!src_value_node) - throw Error(_("Unable to create new value node")); - - - ValueNode::Handle dest_value_node; - dest_value_node=value_desc.get_value_node(); - - Action::Handle action(ValueDescConnect::create()); - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",get_canvas_interface()); - action->set_param("src",src_value_node); - action->set_param("dest",value_desc); - - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); - - add_action_front(action); - -/* - return; - - - if(value_desc.parent_is_canvas()) - { - ValueNode::Handle dest_value_node; - dest_value_node=value_desc.get_value_node(); - - Action::Handle action(ValueNodeReplace::create()); - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",get_canvas_interface()); - action->set_param("src",src_value_node); - action->set_param("dest",dest_value_node); - - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); - - add_action_front(action); - return; - } - else - if(value_desc.parent_is_linkable_value_node()) - { - Action::Handle action(ValueNodeLinkConnect::create()); - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",get_canvas_interface()); - action->set_param("parent_value_node",value_desc.get_parent_value_node()); - action->set_param("value_node", src_value_node); - action->set_param("index",value_desc.get_index()); - - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); - - add_action_front(action); - return; - } - else - if(value_desc.parent_is_layer_param()) - { - 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",src_value_node); - - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); - - add_action_front(action); - return; - } - - - - throw Error(_("ValueDesc is not recognised or supported.")); -*/ -}