From 9b845a628e3ac04cab68539a13c9ce081be868e5 Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Sun, 6 Jan 2019 10:56:33 +0100 Subject: [PATCH] Prevent "shadow" control spot from appearing This situation was happening when switching between pictures or using history with specific control spot id configuration (for instance, when ID1 was not used by a control spot) --- rtgui/locallab.cc | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 6a6cba1e1..b45e37155 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -888,7 +888,14 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) set_inconsistent(multiImage && !pedited->locallab.enabled); } - // Add non existent spots and update existent ones + // Delete all existent spots + std::vector* const list = expsettings->getSpotIdList(); + + for (size_t i = 0; i < list->size(); i++) { + expsettings->deleteControlSpot(list->at(i)); + } + + // Add existent spots based on pp ControlSpotPanel::SpotRow* const r = new ControlSpotPanel::SpotRow(); for (int i = 0; i < pp->locallab.nbspot && i < (int)pp->locallab.spots.size(); i++) { @@ -941,28 +948,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) r->thresh = pp->locallab.spots.at(i).thresh; r->iter = pp->locallab.spots.at(i).iter; - if (!expsettings->updateControlSpot(r)) { - expsettings->addControlSpot(r); - } - } - - // Delete not anymore existent spots - std::vector* const list = expsettings->getSpotIdList(); - bool ispresent; - - for (int i = 0; i < (int)list->size() - 1; i++) { - ispresent = false; - - for (int j = 0; j < pp->locallab.nbspot && j < (int)pp->locallab.spots.size(); j++) { - if (list->at(i) == pp->locallab.spots.at(j).id) { - ispresent = true; - break; - } - } - - if (!ispresent) { - expsettings->deleteControlSpot(list->at(i)); - } + expsettings->addControlSpot(r); } // Select active spot