X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftags%2Fstable%2Fsrc%2Fsynfigapp%2Factions%2Fwaypointsimpleadd.cpp;fp=synfig-studio%2Ftags%2Fstable%2Fsrc%2Fsynfigapp%2Factions%2Fwaypointsimpleadd.cpp;h=0000000000000000000000000000000000000000;hb=91c14fb028f8cbf78be64623aded885725606f78;hp=86906be35c7f743503da29e82f50e2343d39ae23;hpb=f6184c2a9c2245aae802c31c8f3300e1b744359c;p=synfig.git diff --git a/synfig-studio/tags/stable/src/synfigapp/actions/waypointsimpleadd.cpp b/synfig-studio/tags/stable/src/synfigapp/actions/waypointsimpleadd.cpp deleted file mode 100644 index 86906be..0000000 --- a/synfig-studio/tags/stable/src/synfigapp/actions/waypointsimpleadd.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file waypointsimpleadd.cpp -** \brief Simple add waypoint File -** -** $Id$ -** -** \legal -** Copyright (c) 2004 Adrian Bentley -** -** 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. -** -** 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 -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "waypointsimpleadd.h" -#include - -#endif - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace synfigapp; -using namespace Action; - -/* === M A C R O S ========================================================= */ - -ACTION_INIT(Action::WaypointSimpleAdd); -ACTION_SET_NAME(Action::WaypointSimpleAdd,"waypoint_simpleadd"); -ACTION_SET_LOCAL_NAME(Action::WaypointSimpleAdd,"Simply Add Waypoint"); -ACTION_SET_TASK(Action::WaypointSimpleAdd,"add"); -ACTION_SET_CATEGORY(Action::WaypointSimpleAdd,Action::CATEGORY_WAYPOINT); -ACTION_SET_PRIORITY(Action::WaypointSimpleAdd,0); -ACTION_SET_VERSION(Action::WaypointSimpleAdd,"0.0"); -ACTION_SET_CVS_ID(Action::WaypointSimpleAdd,"$Id$"); - -/* === 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::WaypointSimpleAdd::WaypointSimpleAdd() -{ - set_dirty(true); - waypoint.set_time(Time::begin()-1); -} - -Action::ParamVocab -Action::WaypointSimpleAdd::get_param_vocab() -{ - ParamVocab ret(Action::CanvasSpecific::get_param_vocab()); - - ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE) - .set_local_name(_("Destination ValueNode (Animated)")) - ); - - ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT) - .set_local_name(_("Waypoint")) - .set_desc(_("Waypoint to be added")) - ); - - return ret; -} - -bool -Action::WaypointSimpleAdd::is_candidate(const ParamList &x) -{ - return candidate_check(get_param_vocab(),x); -} - -bool -Action::WaypointSimpleAdd::set_param(const synfig::String& name, const Action::Param ¶m) -{ - if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE) - { - value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node()); - - return static_cast(value_node); - } - if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT) - { - waypoint = param.get_waypoint(); - - return true; - } - - return Action::CanvasSpecific::set_param(name,param); -} - -bool -Action::WaypointSimpleAdd::is_ready()const -{ - if(!value_node && waypoint.get_time() != (Time::begin()-1)) - return false; - return Action::CanvasSpecific::is_ready(); -} - -void -Action::WaypointSimpleAdd::perform() -{ - //remove any pretenders that lie at our destination - ValueNode_Animated::findresult iter = value_node->find_time(waypoint.get_time()); - - time_overwrite = false; - if(iter.second) - { - overwritten_wp = *iter.first; - time_overwrite = true; - } - - //add the value node in since it's safe - value_node->add(waypoint); - - // Signal that a valuenode has been changed - value_node->changed(); -} - -void -Action::WaypointSimpleAdd::undo() -{ - //remove our old version... - ValueNode_Animated::findresult iter = value_node->find_uid(waypoint); - - if(!iter.second) - { - throw Error(_("The waypoint to remove no longer exists")); - } - - //remove the offending value - value_node->erase(*iter.first); //could also just use waypoint - - if(time_overwrite) - { - value_node->add(overwritten_wp); - } - - // Signal that a valuenode has been changed - value_node->changed(); -}