From 76706ac2766d926d0df56d35c7ed400525f1917d Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Sat, 22 May 2021 17:35:22 -0700 Subject: [PATCH] Leave spot removal widgets in good state on commit Set the correct geometry states if edit mode is toggled off while a spot is being dragged. --- rtgui/spot.cc | 20 ++++++++++++++++++++ rtgui/spot.h | 1 + 2 files changed, 21 insertions(+) diff --git a/rtgui/spot.cc b/rtgui/spot.cc index 322ffe106..7facb8f93 100644 --- a/rtgui/spot.cc +++ b/rtgui/spot.cc @@ -185,6 +185,25 @@ void Spot::resetPressed() } } +/** + * Release anything that's currently being dragged. + */ +void Spot::releaseEdit() +{ + Geometry *loGeom = getVisibleGeometryFromMO (lastObject); + + if (!loGeom) { + EditSubscriber::action = EditSubscriber::Action::NONE; + return; + } + + loGeom->state = Geometry::ACTIVE; + sourceIcon.state = Geometry::ACTIVE; + EditSubscriber::action = EditSubscriber::Action::NONE; + draggedSide = DraggedSide::NONE; + updateGeometry(); +} + void Spot::setBatchMode (bool batchMode) { ToolPanel::setBatchMode (batchMode); @@ -237,6 +256,7 @@ void Spot::editToggled () listener->refreshPreview(EvSpotEnabledOPA); // reprocess the preview w/o creating History entry subscribe(); } else { + releaseEdit(); unsubscribe(); listener->unsetTweakOperator(this); listener->refreshPreview(EvSpotEnabled); // reprocess the preview w/o creating History entry diff --git a/rtgui/spot.h b/rtgui/spot.h index db1fdac05..85cefa4c2 100644 --- a/rtgui/spot.h +++ b/rtgui/spot.h @@ -82,6 +82,7 @@ private: void addNewEntry (); void deleteSelectedEntry (); void resetPressed (); + void releaseEdit(); protected: Gtk::Box* labelBox;