From 34112c936cafb5bba11376f67c5d11af3601dc43 Mon Sep 17 00:00:00 2001 From: Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> Date: Wed, 9 Oct 2019 20:33:17 +1100 Subject: Make sure old calls to insert behaves the same --- src/ui/tool/control-point-selection.cpp | 12 +++++++----- src/ui/tool/control-point-selection.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index ca81a75a0..a20a54c74 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -76,7 +76,7 @@ ControlPointSelection::~ControlPointSelection() } /** Add a control point to the selection. */ -std::pair ControlPointSelection::insert(const value_type &x, bool notify) +std::pair ControlPointSelection::insert(const value_type &x, bool notify, bool to_update) { iterator found = _points.find(x); if (found != _points.end()) { @@ -88,8 +88,10 @@ std::pair ControlPointSelection::insert(c x->updateState(); - if (notify) { + if (to_update) { _update(); + } + if (notify) { signal_selection_changed.emit(std::vector(1, x), true); } @@ -148,7 +150,7 @@ void ControlPointSelection::clear() void ControlPointSelection::selectAll() { for (auto _all_point : _all_points) { - insert(_all_point, false); + insert(_all_point, false, false); } std::vector out(_all_points.begin(), _all_points.end()); if (!out.empty()) { @@ -162,7 +164,7 @@ void ControlPointSelection::selectArea(Geom::Rect const &r) std::vector out; for (auto _all_point : _all_points) { if (r.contains(*_all_point)) { - insert(_all_point, false); + insert(_all_point, false, false); out.push_back(_all_point); } } @@ -182,7 +184,7 @@ void ControlPointSelection::invertSelection() } else { out.push_back(_all_point); - insert(_all_point, false); + insert(_all_point, false, false); } } _update(); diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 7525b4849..b50f1f247 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -64,11 +64,11 @@ public: const_iterator end() const { return _points.end(); } // insert - std::pair insert(const value_type& x, bool notify = true); + std::pair insert(const value_type& x, bool notify = true, bool to_update = true); template void insert(InputIterator first, InputIterator last) { for (; first != last; ++first) { - insert(*first, false); + insert(*first, false, false); } _update(); signal_selection_changed.emit(std::vector(first, last), true); -- cgit v1.2.3