From e89a0779387aaf99c5ea94d5287b1361e3c389a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Krzysztof=20Kosi=C5=84ski?= Date: Wed, 20 Jan 2010 15:14:37 +0100 Subject: [PATCH] Fix snapping in the node tool when more than one point is dragged. --- src/ui/tool/control-point-selection.cpp | 18 ++++++++---------- src/ui/tool/selectable-control-point.cpp | 16 +--------------- src/ui/tool/selectable-control-point.h | 2 -- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index 2a3498d7f..d1ff5f9d8 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -81,26 +81,24 @@ std::pair ControlPointSelection::insert(c boost::shared_ptr clist(new connlist_type()); // hide event param and always return false - /*clist->push_back( + clist->push_back( x->signal_grabbed.connect( sigc::bind_return( - sigc::bind<0>( - sigc::mem_fun(*this, &ControlPointSelection::_selectionGrabbed), - x), + sigc::hide( + sigc::mem_fun(*this, &ControlPointSelection::_pointGrabbed)), false))); clist->push_back( x->signal_dragged.connect( - sigc::mem_fun(*this, &ControlPointSelection::_selectionDragged))); + sigc::mem_fun(*this, &ControlPointSelection::_pointDragged))); clist->push_back( x->signal_ungrabbed.connect( sigc::hide( - sigc::mem_fun(*this, &ControlPointSelection::_selectionUngrabbed)))); + sigc::mem_fun(*this, &ControlPointSelection::_pointUngrabbed)))); clist->push_back( x->signal_clicked.connect( - sigc::hide( - sigc::bind<0>( - sigc::mem_fun(*this, &ControlPointSelection::_selectionClicked), - x))));*/ + sigc::bind<0>( + sigc::mem_fun(*this, &ControlPointSelection::_pointClicked), + x))); found = _points.insert(std::make_pair(x, clist)).first; diff --git a/src/ui/tool/selectable-control-point.cpp b/src/ui/tool/selectable-control-point.cpp index df2410dc2..9039bd533 100644 --- a/src/ui/tool/selectable-control-point.cpp +++ b/src/ui/tool/selectable-control-point.cpp @@ -61,11 +61,6 @@ void SelectableControlPoint::_connectHandlers() sigc::hide( sigc::mem_fun(*this, &SelectableControlPoint::_grabbedHandler)), false)); - signal_dragged.connect( - sigc::mem_fun(*this, &SelectableControlPoint::_draggedHandler)); - signal_ungrabbed.connect( - sigc::hide( - sigc::mem_fun(*this, &SelectableControlPoint::_ungrabbedHandler))); signal_clicked.connect( sigc::mem_fun(*this, &SelectableControlPoint::_clickedHandler)); } @@ -75,20 +70,11 @@ void SelectableControlPoint::_grabbedHandler() // if a point is dragged while not selected, it should select itself if (!selected()) { _takeSelection(); - _selection._pointGrabbed(); } } -void SelectableControlPoint::_draggedHandler(Geom::Point const &old_pos, Geom::Point &new_pos, GdkEventMotion *event) -{ - _selection._pointDragged(old_pos, new_pos, event); -} -void SelectableControlPoint::_ungrabbedHandler() -{ - _selection._pointUngrabbed(); -} + bool SelectableControlPoint::_clickedHandler(GdkEventButton *event) { - if (selected() && _selection._pointClicked(this, event)) return true; if (event->button != 1) return false; if (held_shift(*event)) { if (selected()) { diff --git a/src/ui/tool/selectable-control-point.h b/src/ui/tool/selectable-control-point.h index 208593e3f..f5e9541c3 100644 --- a/src/ui/tool/selectable-control-point.h +++ b/src/ui/tool/selectable-control-point.h @@ -51,8 +51,6 @@ private: void _takeSelection(); void _grabbedHandler(); - void _draggedHandler(Geom::Point const &, Geom::Point &, GdkEventMotion *); - void _ungrabbedHandler(); bool _clickedHandler(GdkEventButton *); }; -- 2.30.2