X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Ftimepointsmove.cpp;h=5cce2c8ba040c455cb923b688533ab540fccb3aa;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=2c95950ded3ce931c4c90f7e11079f7a09dab96b;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/timepointsmove.cpp b/synfig-studio/trunk/src/synfigapp/actions/timepointsmove.cpp index 2c95950..5cce2c8 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/timepointsmove.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/timepointsmove.cpp @@ -2,19 +2,20 @@ /*! \file timepointsmove.cpp ** \brief Move the Time Points File ** -** $Id: timepointsmove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ +** $Id$ ** ** \legal ** Copyright (c) 2004 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 */ /* ========================================================================= */ @@ -40,6 +41,8 @@ #include +#include + #endif using namespace std; @@ -51,13 +54,13 @@ using namespace Action; /* === M A C R O S ========================================================= */ ACTION_INIT(Action::TimepointsMove); -ACTION_SET_NAME(Action::TimepointsMove,"timepoint_move"); -ACTION_SET_LOCAL_NAME(Action::TimepointsMove,"Move Time Points"); +ACTION_SET_NAME(Action::TimepointsMove,"TimepointsMove"); +ACTION_SET_LOCAL_NAME(Action::TimepointsMove,N_("Move Time Points")); ACTION_SET_TASK(Action::TimepointsMove,"move"); ACTION_SET_CATEGORY(Action::TimepointsMove,Action::CATEGORY_WAYPOINT|Action::CATEGORY_ACTIVEPOINT); ACTION_SET_PRIORITY(Action::TimepointsMove,0); ACTION_SET_VERSION(Action::TimepointsMove,"0.0"); -ACTION_SET_CVS_ID(Action::TimepointsMove,"$Id: timepointsmove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $"); +ACTION_SET_CVS_ID(Action::TimepointsMove,"$Id$"); /* === G L O B A L S ======================================================= */ @@ -75,34 +78,34 @@ Action::ParamVocab Action::TimepointsMove::get_param_vocab() { ParamVocab ret(Action::CanvasSpecific::get_param_vocab()); - + ret.push_back(ParamDesc("addlayer",Param::TYPE_VALUE) .set_local_name(_("New Selected Layer")) .set_desc(_("A layer to add to our selected list")) .set_supports_multiple() .set_optional() ); - + ret.push_back(ParamDesc("addcanvas",Param::TYPE_CANVAS) .set_local_name(_("New Selected Canvas")) .set_desc(_("A canvas to add to our selected list")) .set_supports_multiple() .set_optional() ); - + ret.push_back(ParamDesc("addvaluedesc",Param::TYPE_VALUEDESC) .set_local_name(_("New Selected ValueBase")) .set_desc(_("A valuenode's description to add to our selected list")) .set_supports_multiple() .set_optional() ); - + ret.push_back(ParamDesc("addtime",Param::TYPE_TIME) .set_local_name(_("New Selected Time Point")) .set_desc(_("A time point to add to our selected list")) .set_supports_multiple() ); - + ret.push_back(ParamDesc("deltatime",Param::TYPE_TIME) .set_local_name(_("Time adjustment")) .set_desc(_("The amount of time to adjust all the selected points")) @@ -112,13 +115,13 @@ Action::TimepointsMove::get_param_vocab() } bool -Action::TimepointsMove::is_canidate(const ParamList &x) +Action::TimepointsMove::is_candidate(const ParamList &x) { - if(!canidate_check(get_param_vocab(),x)) + if(!candidate_check(get_param_vocab(),x)) return false; - - if( x.find("addlayer") == x.end() && - x.find("addcanvas") == x.end() && + + if( x.find("addlayer") == x.end() && + x.find("addcanvas") == x.end() && x.find("addvaluedesc") == x.end()) return false; return true; @@ -132,42 +135,42 @@ Action::TimepointsMove::set_param(const synfig::String& name, const Action::Para //add a layer to the list sel_layers.push_back(param.get_layer()); //synfig::info("action got layer"); - + return true; } - + if(name=="addcanvas" && param.get_type()==Param::TYPE_CANVAS) { //add a layer to the list sel_canvases.push_back(param.get_canvas()); //synfig::info("action got canvas"); - + return true; } - + if(name=="addvaluedesc" && param.get_type()==Param::TYPE_VALUEDESC) { //add a layer to the list sel_values.push_back(param.get_value_desc()); //synfig::info("action got valuedesc"); - + return true; } - + if(name=="addtime" && param.get_type()==Param::TYPE_TIME) { //add a layer to the list sel_times.insert(param.get_time()); //synfig::info("action got time"); - + return true; } - + if(name=="deltatime" && param.get_type()==Param::TYPE_TIME) { timemove = param.get_time(); //synfig::info("action got time to move"); - + return true; } @@ -186,72 +189,72 @@ void Action::TimepointsMove::prepare() { clear(); - + //synfig::info("Preparing TimepointsMove by %f secs",(float)timemove); - + if(sel_times.empty()) return; - + //all our lists should be set correctly... - + /*{ std::set::iterator i = sel_times.begin(), end = sel_times.end(); - + for(; i != end; ++i) { synfig::info("Time %f", (float)*i); - } + } }*/ //build our sub-action list - // and yes we do need to store it temporarily so we don't duplicate + // and yes we do need to store it temporarily so we don't duplicate // an operation on a specific valuenode, etc.... timepoints_ref match; - + Time fps = get_canvas()->rend_desc().get_frame_rate(); - + //std::vector //synfig::info("Layers %d", sel_layers.size()); { std::vector::iterator i = sel_layers.begin(), end = sel_layers.end(); - + for(; i != end; ++i) { //synfig::info("Recurse through a layer"); recurse_layer(*i,sel_times,match); } } - + //std::vector sel_canvases; //synfig::info("Canvases %d", sel_canvases.size()); { std::vector::iterator i = sel_canvases.begin(), end = sel_canvases.end(); - + for(; i != end; ++i) { //synfig::info("Recurse through a canvas"); recurse_canvas(*i,sel_times,match); } } - + //std::vector //synfig::info("ValueBasedescs %d", sel_values.size()); { std::vector::iterator i = sel_values.begin(), end = sel_values.end(); - + for(; i != end; ++i) { //synfig::info("Recurse through a valuedesc"); recurse_valuedesc(*i,sel_times,match); } } - + //synfig::info("built list of waypoints/activepoints to modify"); - //synfig::info("\t There are %d waypoint sets and %d activepointsets", + //synfig::info("\t There are %d waypoint sets and %d activepointsets", // match.waypointbiglist.size(), match.actpointbiglist.size()); - //process the hell out of em... + //process them... { //must build from both lists timepoints_ref::waytracker::const_iterator i = match.waypointbiglist.begin(), @@ -259,28 +262,28 @@ Action::TimepointsMove::prepare() for(; i != end; ++i) { Action::Handle action(WaypointSet::create()); - + action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("value_node",ValueNode::Handle(i->val)); - + //iterate through each waypoint for this specific valuenode std::set::const_iterator j = i->waypoints.begin(), - end = i->waypoints.end(); + end = i->waypoints.end(); for(; j != end; ++j) - { + { //synfig::info("add waypoint mod..."); //NOTE: We may want to store the old time for undoing the action... Waypoint w = *j; w.set_time((w.get_time() + timemove).round(fps)); action->set_param("waypoint",w); } - + //run the action now that we've added everything assert(action->is_ready()); if(!action->is_ready()) throw Error(Error::TYPE_NOTREADY); - + add_action_front(action); } } @@ -291,30 +294,30 @@ Action::TimepointsMove::prepare() for(; i != end; ++i) { Action::Handle action(ActivepointSet::create()); - + action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("value_desc",i->val); - + //iterate through each activepoint for this specific valuenode std::set::const_iterator j = i->activepoints.begin(), jend = i->activepoints.end(); for(; j != jend; ++j) { //synfig::info("add activepoint mod..."); - + //NOTE: We may want to store the old time for undoing the action... Activepoint a = *j; a.set_time((a.get_time() + timemove).round(fps)); action->set_param("activepoint",a); } - + assert(action->is_ready()); if(!action->is_ready()) { throw Error(Error::TYPE_NOTREADY); } - + add_action_front(action); } }