X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Fwaypointadd.cpp;h=8912b3a594a27386fbac15fbc6cbda5c884d041d;hb=343b52e397572ae6630ad0f128de1290f89b8f81;hp=a5a1694177f9840c7af35a970f49ff02015b6e43;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/waypointadd.cpp b/synfig-studio/trunk/src/synfigapp/actions/waypointadd.cpp index a5a1694..8912b3a 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/waypointadd.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/waypointadd.cpp @@ -2,19 +2,20 @@ /*! \file waypointadd.cpp ** \brief Template File ** -** $Id: waypointadd.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 */ /* ========================================================================= */ @@ -32,6 +33,8 @@ #include #include +#include + #endif using namespace std; @@ -44,12 +47,12 @@ using namespace Action; ACTION_INIT(Action::WaypointAdd); ACTION_SET_NAME(Action::WaypointAdd,"waypoint_add"); -ACTION_SET_LOCAL_NAME(Action::WaypointAdd,"Add Waypoint"); +ACTION_SET_LOCAL_NAME(Action::WaypointAdd,N_("Add Waypoint")); ACTION_SET_TASK(Action::WaypointAdd,"add"); ACTION_SET_CATEGORY(Action::WaypointAdd,Action::CATEGORY_WAYPOINT); ACTION_SET_PRIORITY(Action::WaypointAdd,0); ACTION_SET_VERSION(Action::WaypointAdd,"0.0"); -ACTION_SET_CVS_ID(Action::WaypointAdd,"$Id: waypointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $"); +ACTION_SET_CVS_ID(Action::WaypointAdd,"$Id$"); /* === G L O B A L S ======================================================= */ @@ -68,7 +71,7 @@ Action::ParamVocab Action::WaypointAdd::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)")) ); @@ -89,9 +92,9 @@ Action::WaypointAdd::get_param_vocab() } bool -Action::WaypointAdd::is_canidate(const ParamList &x) +Action::WaypointAdd::is_candidate(const ParamList &x) { - if(canidate_check(get_param_vocab(),x)) + if(candidate_check(get_param_vocab(),x)) { if(!ValueNode_Animated::Handle::cast_dynamic(x.find("value_node")->second.get_value_node())) return false; @@ -111,13 +114,13 @@ Action::WaypointAdd::set_param(const synfig::String& name, const Action::Param & value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node()); if(time_set) calc_waypoint(); - + return static_cast(value_node); } if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set) { waypoint=param.get_waypoint(); - + return true; } if(name=="time" && param.get_type()==Param::TYPE_TIME && waypoint.get_time()==Time::begin()-1) @@ -127,7 +130,7 @@ Action::WaypointAdd::set_param(const synfig::String& name, const Action::Param & if(value_node) calc_waypoint(); - + return true; } @@ -142,15 +145,15 @@ Action::WaypointAdd::is_ready()const return Action::CanvasSpecific::is_ready(); } -// This function is called if a time is specified, but not +// This function is called if a time is specified, but not // a waypoint. In this case, we need to calculate the value // of the waypoint void Action::WaypointAdd::calc_waypoint() -{ +{ Time time=waypoint.get_time(); Waypoint original(waypoint); - waypoint=value_node->new_waypoint_at_time(time); + waypoint=value_node->new_waypoint_at_time(time); waypoint.mimic(original); waypoint.set_before(synfigapp::Main::get_interpolation()); waypoint.set_after(synfigapp::Main::get_interpolation()); @@ -158,7 +161,7 @@ Action::WaypointAdd::calc_waypoint() /* ValueNode_Animated::WaypointList &waypoint_list(value_node->waypoint_list()); ValueNode_Animated::WaypointList::iterator iter; - + if(waypoint_list.empty()) { waypoint.set_value((*value_node)(time)); @@ -166,7 +169,7 @@ Action::WaypointAdd::calc_waypoint() } ValueNode_Animated::WaypointList::iterator closest=waypoint_list.begin(); - + for(iter=waypoint_list.begin();iter!=waypoint_list.end();++iter) { const Real dist(abs(iter->get_time()-time)); @@ -182,15 +185,15 @@ Action::WaypointAdd::calc_waypoint() void Action::WaypointAdd::perform() -{ +{ try { value_node->find(waypoint.get_time()); throw Error(_("A Waypoint already exists at this point in time (%s)"),waypoint.get_time().get_string().c_str());} - catch(synfig::Exception::NotFound) { } + catch(synfig::Exception::NotFound) { } try { if(value_node->find(waypoint)!=value_node->waypoint_list().end()) throw Error(_("This waypoint is already in the ValueNode"));} - catch(synfig::Exception::NotFound) { } - + catch(synfig::Exception::NotFound) { } + value_node->add(waypoint); - + value_node->changed(); /*_if(get_canvas_interface()) { @@ -203,7 +206,7 @@ void Action::WaypointAdd::undo() { value_node->erase(waypoint); - + value_node->changed(); /*_if(get_canvas_interface()) {