X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftags%2Fstable%2Fsrc%2Fsynfigapp%2Factions%2Fvaluedescset.cpp;h=a5610aa73f8d9413e352e606931772bffce3f47c;hb=47fce282611fbba1044921d22ca887f9b53ad91a;hp=09624a9e091ffca3e931c366ff9bafdd7610bc5f;hpb=9b5810cef039c7f25e924ce2cf2fc80e76e59972;p=synfig.git diff --git a/synfig-studio/tags/stable/src/synfigapp/actions/valuedescset.cpp b/synfig-studio/tags/stable/src/synfigapp/actions/valuedescset.cpp index 09624a9..a5610aa 100644 --- a/synfig-studio/tags/stable/src/synfigapp/actions/valuedescset.cpp +++ b/synfig-studio/tags/stable/src/synfigapp/actions/valuedescset.cpp @@ -6,7 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007 Chris Moore +** Copyright (c) 2007, 2008 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -42,6 +42,8 @@ #include #include +#include + #endif using namespace std; @@ -51,13 +53,10 @@ using namespace synfigapp; using namespace Action; /* === M A C R O S ========================================================= */ -#define ACTION_INIT2(class) \ - Action::Base* class::create() { return new class(); } \ - synfig::String class::get_name()const { return name__; } -ACTION_INIT2(Action::ValueDescSet); +ACTION_INIT_NO_GET_LOCAL_NAME(Action::ValueDescSet); ACTION_SET_NAME(Action::ValueDescSet,"value_desc_set"); -ACTION_SET_LOCAL_NAME(Action::ValueDescSet,"Set ValueDesc"); +ACTION_SET_LOCAL_NAME(Action::ValueDescSet,N_("Set ValueDesc")); ACTION_SET_TASK(Action::ValueDescSet,"set"); ACTION_SET_CATEGORY(Action::ValueDescSet,Action::CATEGORY_VALUEDESC); ACTION_SET_PRIORITY(Action::ValueDescSet,0); @@ -78,37 +77,10 @@ Action::ValueDescSet::ValueDescSet(): synfig::String Action::ValueDescSet::get_local_name()const { - String name("ValueDesc"); - - if(!value_desc) - { - } - else if(value_desc.parent_is_layer_param()) - { - if(value_desc.get_layer()->get_description().empty()) - name=value_desc.get_layer()->get_local_name(); - else - name=value_desc.get_layer()->get_description(); - name+="->"+value_desc.get_param_name(); - } - else if(value_desc.parent_is_value_node()) - { - synfig::LinkableValueNode::Handle value_node(synfig::LinkableValueNode::Handle::cast_reinterpret(value_desc.get_parent_value_node())); - name=value_node->link_local_name(value_desc.get_index()); - - synfig::Node* node; - for(node=value_node.get();!node->parent_set.empty() && !dynamic_cast(node);node=*node->parent_set.begin()); - Layer::Handle parent_layer(dynamic_cast(node)); - if(parent_layer) - { - if(parent_layer->get_description().empty()) - name=parent_layer->get_local_name()+"=>"+name; - else - name=parent_layer->get_description()+"=>"+name; - } - } - - return strprintf(_("Set %s"),name.c_str()); + return strprintf(_("Set %s"), + value_desc + ? value_desc.get_description().c_str() + : _("ValueDesc")); } Action::ParamVocab @@ -187,8 +159,6 @@ Action::ValueDescSet::prepare() (value_desc.get_index()==4 || value_desc.get_index()==5) && (*value_desc.get_parent_value_node())(time).get(BLinePoint()).get_split_tangent_flag()==false) { - printf("a tangent got changed - #%d\n", value_desc.get_index()-3); - { ValueNode_Composite::Handle parent_value_node; parent_value_node=parent_value_node.cast_dynamic(value_desc.get_parent_value_node()); @@ -196,12 +166,9 @@ Action::ValueDescSet::prepare() Vector t1((*parent_value_node->get_link("t1"))(time)); Vector t2((*parent_value_node->get_link("t2"))(time)); - printf("current values are: t1(%.2f, %2.f) t2(%.2f, %.2f)\n", t1[0], t1[1], t2[0], t2[1]); } if (value_desc.get_index()==4) { - printf("copying change to tangent 2\n"); - DEBUGPOINT(); ValueNode_Composite::Handle parent_value_node; parent_value_node=parent_value_node.cast_dynamic(value_desc.get_parent_value_node()); @@ -292,7 +259,7 @@ Action::ValueDescSet::prepare() break; } default: - throw Error("Bad type for composite (%s)",ValueBase::type_name(value.get_type()).c_str()); + throw Error(_("Bad type for composite (%s)"),ValueBase::type_local_name(value.get_type()).c_str()); break; } @@ -332,9 +299,14 @@ Action::ValueDescSet::prepare() { case ValueBase::TYPE_VECTOR: { + Angle old_angle = (*(ValueNode_RadialComposite::Handle::cast_dynamic( + value_desc.get_value_node())->get_link_vfunc(1)))(time).get(Angle()); Vector vect(value.get(Vector())); components[0]=vect.mag(); - components[1]=Angle(Angle::tan(vect[1],vect[0])); + Angle change = Angle(Angle::tan(vect[1],vect[0])) - old_angle; + while (change < Angle::deg(-180)) change += Angle::deg(360); + while (change > Angle::deg(180)) change -= Angle::deg(360); + components[1]=old_angle + change; n_components=2; } break; @@ -346,7 +318,7 @@ Action::ValueDescSet::prepare() n_components=4; break; default: - throw Error("Bad type for radial composite (%s)",ValueBase::type_name(value.get_type()).c_str()); + throw Error(_("Bad type for radial composite (%s)"),ValueBase::type_local_name(value.get_type()).c_str()); break; } for(int i=0;iis_ready()) throw Error(Error::TYPE_NOTREADY); - DEBUGPOINT(); add_action_front(action); } else @@ -522,7 +493,6 @@ Action::ValueDescSet::prepare() value_node=value_node.cast_dynamic(value_desc.get_value_node()); } - DEBUGPOINT(); if(!value_node) throw Error(_("Direct manipulation of this ValueNode type is not yet supported")); @@ -544,7 +514,6 @@ Action::ValueDescSet::prepare() if(!action->is_ready()) throw Error(Error::TYPE_NOTREADY); - DEBUGPOINT(); add_action(action); return;