From 74d03302d1e6f05f1f90d4c2a3b38a03aa51dc86 Mon Sep 17 00:00:00 2001 From: dooglus Date: Sun, 25 Feb 2007 05:43:55 +0000 Subject: [PATCH] Fix 1455310: add 'loop' and 'unloop' to the right-click action of all bline vertices (not just the first one) both in the bline tool and the 'normal' tool. git-svn-id: http://svn.voria.com/code@254 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/state_bline.cpp | 15 +++++++++++++- .../synfigapp/actions/valuenodedynamiclistloop.cpp | 24 ++++++++++++++++++++-- .../actions/valuenodedynamiclistunloop.cpp | 24 ++++++++++++++++++++-- 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/state_bline.cpp b/synfig-studio/trunk/src/gtkmm/state_bline.cpp index 68aa318..d21ad9e 100644 --- a/synfig-studio/trunk/src/gtkmm/state_bline.cpp +++ b/synfig-studio/trunk/src/gtkmm/state_bline.cpp @@ -104,6 +104,7 @@ class studio::StateBLine_Context : public sigc::trackable void bline_delete_vertex(synfig::ValueNode_Const::Handle value_node); void bline_insert_vertex(synfig::ValueNode_Const::Handle value_node,float origin=0.5); void loop_bline(); + void unloop_bline(); void refresh_ducks(bool x=true); @@ -1055,12 +1056,24 @@ StateBLine_Context::loop_bline() } void +StateBLine_Context::unloop_bline() +{ + loop_=false; + + refresh_ducks(false); +} + +void StateBLine_Context::popup_vertex_menu(synfig::ValueNode_Const::Handle value_node) { menu.items().clear(); - if(!loop_ && value_node==bline_point_list.front()) + if(loop_) { + menu.items().push_back(Gtk::Menu_Helpers::MenuElem("Unloop BLine", + sigc::mem_fun(*this,&studio::StateBLine_Context::unloop_bline) + )); + } else { menu.items().push_back(Gtk::Menu_Helpers::MenuElem("Loop BLine", sigc::mem_fun(*this,&studio::StateBLine_Context::loop_bline) )); diff --git a/synfig-studio/trunk/src/synfigapp/actions/valuenodedynamiclistloop.cpp b/synfig-studio/trunk/src/synfigapp/actions/valuenodedynamiclistloop.cpp index 66f147c..daa8b82 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/valuenodedynamiclistloop.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/valuenodedynamiclistloop.cpp @@ -78,7 +78,12 @@ Action::ValueNodeDynamicListLoop::is_canidate(const ParamList &x) { if(canidate_check(get_param_vocab(),x)) { - ValueNode::Handle value_node(x.find("value_node")->second.get_value_node()); + ValueNode::Handle value_node; + ValueDesc value_desc(x.find("value_desc")->second.get_value_desc()); + if(value_desc.parent_is_value_node()) + value_node = value_desc.get_parent_value_node(); + else + value_node = x.find("value_node")->second.get_value_node(); if(!ValueNode_DynamicList::Handle::cast_dynamic(value_node)) return false; if(ValueNode_DynamicList::Handle::cast_dynamic(value_node)->get_loop()==true) @@ -91,7 +96,22 @@ Action::ValueNodeDynamicListLoop::is_canidate(const ParamList &x) bool Action::ValueNodeDynamicListLoop::set_param(const synfig::String& name, const Action::Param ¶m) { - if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE) + if(!value_node && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC) + { + ValueDesc value_desc(param.get_value_desc()); + + if(!value_desc.parent_is_value_node()) + return false; + + value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()); + + if (!value_node) + return false; + + return true; + } + + if(!value_node && name=="value_node" && param.get_type()==Param::TYPE_VALUENODE) { value_node=ValueNode_DynamicList::Handle::cast_dynamic(param.get_value_node()); diff --git a/synfig-studio/trunk/src/synfigapp/actions/valuenodedynamiclistunloop.cpp b/synfig-studio/trunk/src/synfigapp/actions/valuenodedynamiclistunloop.cpp index 2d04245..9b107a2 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/valuenodedynamiclistunloop.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/valuenodedynamiclistunloop.cpp @@ -78,7 +78,12 @@ Action::ValueNodeDynamicListUnLoop::is_canidate(const ParamList &x) { if(canidate_check(get_param_vocab(),x)) { - ValueNode::Handle value_node(x.find("value_node")->second.get_value_node()); + ValueNode::Handle value_node; + ValueDesc value_desc(x.find("value_desc")->second.get_value_desc()); + if(value_desc.parent_is_value_node()) + value_node = value_desc.get_parent_value_node(); + else + value_node = x.find("value_node")->second.get_value_node(); if(!ValueNode_DynamicList::Handle::cast_dynamic(value_node)) return false; if(ValueNode_DynamicList::Handle::cast_dynamic(value_node)->get_loop()==false) @@ -91,7 +96,22 @@ Action::ValueNodeDynamicListUnLoop::is_canidate(const ParamList &x) bool Action::ValueNodeDynamicListUnLoop::set_param(const synfig::String& name, const Action::Param ¶m) { - if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE) + if(!value_node && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC) + { + ValueDesc value_desc(param.get_value_desc()); + + if(!value_desc.parent_is_value_node()) + return false; + + value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()); + + if (!value_node) + return false; + + return true; + } + + if(!value_node && name=="value_node" && param.get_type()==Param::TYPE_VALUENODE) { value_node=ValueNode_DynamicList::Handle::cast_dynamic(param.get_value_node()); -- 2.7.4