From 58c5902626b1ba0feb295fab124de3160c73fbea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Krzysztof=20Kosi=C5=84ski?= Date: Wed, 20 Jan 2010 21:33:32 +0100 Subject: [PATCH] Insert nodes on Ctrl+Alt+click on a path. --- src/ui/tool/curve-drag-point.cpp | 16 ++++++++++++++-- src/ui/tool/curve-drag-point.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp index 0d1183ebf..57ae776e3 100644 --- a/src/ui/tool/curve-drag-point.cpp +++ b/src/ui/tool/curve-drag-point.cpp @@ -116,6 +116,12 @@ bool CurveDragPoint::_clickedHandler(GdkEventButton *event) NodeList::iterator second = first.next(); if (!second) return false; + // insert nodes on Ctrl+Alt+click + if (held_control(*event) && held_alt(*event)) { + _insertNode(false); + return true; + } + if (held_shift(*event)) { // if both nodes of the segment are selected, deselect; // otherwise add to selection @@ -138,18 +144,24 @@ bool CurveDragPoint::_clickedHandler(GdkEventButton *event) bool CurveDragPoint::_doubleclickedHandler(GdkEventButton *event) { if (event->button != 1 || !first || !first.next()) return false; + _insertNode(true); + return true; +} +void CurveDragPoint::_insertNode(bool take_selection) +{ // The purpose of this call is to make way for the just created node. // Otherwise clicks on the new node would only work after the user moves the mouse a bit. // PathManipulator will restore visibility when necessary. setVisible(false); NodeList::iterator inserted = _pm.subdivideSegment(first, _t); - _pm._selection.clear(); + if (take_selection) { + _pm._selection.clear(); + } _pm._selection.insert(inserted.ptr()); signal_update.emit(); _pm._commit(_("Add node")); - return true; } Glib::ustring CurveDragPoint::_getTip(unsigned state) diff --git a/src/ui/tool/curve-drag-point.h b/src/ui/tool/curve-drag-point.h index c9f32f709..51382615e 100644 --- a/src/ui/tool/curve-drag-point.h +++ b/src/ui/tool/curve-drag-point.h @@ -36,6 +36,7 @@ private: bool _clickedHandler(GdkEventButton *); bool _doubleclickedHandler(GdkEventButton *); void _ungrabbedHandler(); + void _insertNode(bool take_selection); double _t; PathManipulator &_pm; NodeList::iterator first; -- 2.30.2