From 98e42d53eff7c7130b90d657d4ef812a2ee6db79 Mon Sep 17 00:00:00 2001 From: dooglus Date: Wed, 29 Aug 2007 17:07:24 +0000 Subject: [PATCH] Feature request 1781331: Use shift key to manipulate ducks. It is now possible to split a tangent by shift-dragging its duck, but currently only for existing blines. The feature isn't yet implemented while in the bline tool itself. git-svn-id: http://svn.voria.com/code@560 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/workarea.cpp | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp b/synfig-studio/trunk/src/gtkmm/workarea.cpp index bf9cebe..f638b01 100644 --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include "event_mouse.h" #include "event_layerclick.h" @@ -1320,6 +1321,37 @@ WorkArea::on_drawing_area_event(GdkEvent *event) { //get_selected_duck()->signal_user_click(0)(); //if(clicked_duck)clicked_duck->signal_user_click(0)(); + + // if the user is holding shift while clicking on a tangent duck, consider splitting the tangent + if (event->motion.state&GDK_SHIFT_MASK && duck->get_type() == Duck::TYPE_TANGENT) + { + synfigapp::ValueDesc value_desc = duck->get_value_desc(); + + // we have the tangent, but need the vertex - that's the parent + if (value_desc.parent_is_value_node()) { + ValueNode_Composite::Handle parent_value_node = value_desc.get_parent_value_node(); + + // if the tangent isn't split, then split it + if (!((*(parent_value_node->get_link("split")))(get_time()).get(bool()))) + { + get_canvas_view()->canvas_interface()-> + change_value(synfigapp::ValueDesc(parent_value_node, + parent_value_node->get_link_index_from_name("split")), + true); + // rebuild the ducks from scratch, so the tangents ducks aren't connected + get_canvas_view()->rebuild_ducks(); + + // reprocess the mouse click + return on_drawing_area_event(event); + } + } else { + // I don't know how to access the vertex from the tangent duck when originally drawing the bline in the bline tool + + // synfig::ValueNode::Handle vn = value_desc.get_value_node(); + synfig::info("parent isn't value node? shift-drag-tangent doesn't work in bline tool yet..."); + } + } + dragging=DRAG_DUCK; drag_point=mouse_pos; //drawing_area->queue_draw(); -- 2.7.4