X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Fblinepointtangentmerge.cpp;h=39d4f36374f30a1601ee10bcc2dac66beb7ed5cf;hb=756c0d29ac1742f231e6615f9a577e574e35a4af;hp=1860aaa179b991f69b9eb63a5ee864a291119c4b;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/blinepointtangentmerge.cpp b/synfig-studio/trunk/src/synfigapp/actions/blinepointtangentmerge.cpp index 1860aaa..39d4f36 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/blinepointtangentmerge.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/blinepointtangentmerge.cpp @@ -2,19 +2,21 @@ /*! \file blinepointtangentmerge.cpp ** \brief Template File ** -** $Id: blinepointtangentmerge.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 +** Copyright (c) 2007, 2008 Chris Moore ** -** 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 */ /* ========================================================================= */ @@ -37,6 +39,8 @@ #include "valuedescconnect.h" #include +#include + #endif using namespace std; @@ -47,14 +51,14 @@ using namespace Action; /* === M A C R O S ========================================================= */ -ACTION_INIT(Action::BLinePointTangentMerge); +ACTION_INIT_NO_GET_LOCAL_NAME(Action::BLinePointTangentMerge); ACTION_SET_NAME(Action::BLinePointTangentMerge,"bline_point_tangent_merge"); -ACTION_SET_LOCAL_NAME(Action::BLinePointTangentMerge,_("Merge Tangents")); +ACTION_SET_LOCAL_NAME(Action::BLinePointTangentMerge,N_("Merge Tangents")); ACTION_SET_TASK(Action::BLinePointTangentMerge,"merge"); ACTION_SET_CATEGORY(Action::BLinePointTangentMerge,Action::CATEGORY_VALUENODE); ACTION_SET_PRIORITY(Action::BLinePointTangentMerge,0); ACTION_SET_VERSION(Action::BLinePointTangentMerge,"0.0"); -ACTION_SET_CVS_ID(Action::BLinePointTangentMerge,"$Id: blinepointtangentmerge.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $"); +ACTION_SET_CVS_ID(Action::BLinePointTangentMerge,"$Id$"); /* === G L O B A L S ======================================================= */ @@ -68,11 +72,17 @@ Action::BLinePointTangentMerge::BLinePointTangentMerge() set_dirty(true); } +synfig::String +Action::BLinePointTangentMerge::get_local_name()const +{ + return strprintf(_("Merge Tangents of '%s'"), ((ValueNode::Handle)(value_node))->get_description().c_str()); +} + Action::ParamVocab Action::BLinePointTangentMerge::get_param_vocab() { ParamVocab ret(Action::CanvasSpecific::get_param_vocab()); - + ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE) .set_local_name(_("ValueNode of BLinePoint")) ); @@ -80,14 +90,14 @@ Action::BLinePointTangentMerge::get_param_vocab() ret.push_back(ParamDesc("time",Param::TYPE_TIME) .set_local_name(_("Time")) ); - + return ret; } bool -Action::BLinePointTangentMerge::is_canidate(const ParamList &x) +Action::BLinePointTangentMerge::is_candidate(const ParamList &x) { - if(canidate_check(get_param_vocab(),x)) + if(candidate_check(get_param_vocab(),x)) { ValueNode_Composite::Handle value_node; value_node=ValueNode_Composite::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()); @@ -107,13 +117,13 @@ Action::BLinePointTangentMerge::set_param(const synfig::String& name, const Acti if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE) { value_node=value_node.cast_dynamic(param.get_value_node()); - + return (bool)(value_node); } if(name=="time" && param.get_type()==Param::TYPE_TIME) { time=param.get_time(); - + return true; } @@ -128,7 +138,7 @@ Action::BLinePointTangentMerge::is_ready()const if(time==(Time::begin()-1)) synfig::error("Missing time"); - + if(!value_node || time==(Time::begin()-1)) return false; return Action::CanvasSpecific::is_ready(); @@ -140,40 +150,20 @@ Action::BLinePointTangentMerge::prepare() clear(); Action::Handle action; - - { - action=Action::create("value_desc_set"); - if(!action) - throw Error(_("Couldn't find action \"value_desc_set\"")); - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",get_canvas_interface()); - action->set_param("value_desc",ValueDesc(value_node,3)); - action->set_param("time",time); - action->set_param("new_value",synfig::ValueBase(false)); - - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); - - add_action(action); - } - { - action=Action::create("value_desc_set"); - if(!action) - throw Error(_("Couldn't find action \"value_desc_set\"")); - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",get_canvas_interface()); - action->set_param("value_desc",ValueDesc(value_node,5)); - action->set_param("time",time); - action->set_param("new_value",(*value_node->get_link("t1"))(time)); - - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); - - add_action(action); - } - + + action=Action::create("value_desc_set"); + if(!action) + throw Error(_("Couldn't find action \"value_desc_set\"")); + + action->set_param("canvas",get_canvas()); + action->set_param("canvas_interface",get_canvas_interface()); + action->set_param("value_desc",ValueDesc(value_node,3)); + action->set_param("time",time); + action->set_param("new_value",synfig::ValueBase(false)); + + assert(action->is_ready()); + if(!action->is_ready()) + throw Error(Error::TYPE_NOTREADY); + + add_action(action); }