Local adjustments - Fix apply/paste actions with LA

- Fixes LA lost when applying partial profile (fixes #6150)
- Fixes LA behavior when using apply/paste actions: spots are now totally replaced and not anymore merged (fixes #6136 and #6411)
- Fixes a crash in specific situations when saving/copying a partial number of spots
- Partial paste dialog: Fixes Locallab button remaining inconsistent if all the spots are deselected
This commit is contained in:
Pandagrapher 2022-07-18 19:03:29 +02:00 committed by GitHub
parent 19a4720ec7
commit 1e2dc30738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 9 deletions

View File

@ -3382,15 +3382,16 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
if (locallab.enabled) {
toEdit.locallab.enabled = mods.locallab.enabled;
// In that case, locallab is impacted by the combine:
// Resizing locallab spots vector according to pedited
toEdit.locallab.spots.resize(locallab.spots.size());
}
if (locallab.selspot) {
toEdit.locallab.selspot = mods.locallab.selspot;
}
// Resizing locallab spots vector according to pedited
toEdit.locallab.spots.resize(locallab.spots.size());
// Updating each locallab spot according to pedited
for (size_t i = 0; i < toEdit.locallab.spots.size() && i < mods.locallab.spots.size() && i < locallab.spots.size(); i++) {
// Control spot settings

View File

@ -1234,6 +1234,9 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param
if (!chosenSpots.at(i)) {
tmpPP.locallab.spots.erase(tmpPP.locallab.spots.begin() + i);
tmpPE.locallab.spots.erase(tmpPE.locallab.spots.begin() + i);
// Locallab Selspot param shall be kept in vector size limit
tmpPP.locallab.selspot = std::max(0, std::min(tmpPP.locallab.selspot, (int)tmpPP.locallab.spots.size() - 1));
}
}
@ -1260,16 +1263,23 @@ void PartialPasteDlg::updateSpotWidget(const rtengine::procparams::ProcParams* p
void PartialPasteDlg::partialSpotUpdated(const UpdateStatus status)
{
locallabConn.block(true);
switch (status) {
case (AllSelection):
locallab->set_active(true);
locallab->set_inconsistent(false);
break;
case (NoSelection):
locallab->set_active(false);
locallab->set_inconsistent(false);
break;
case (PartialSelection):
locallab->set_active(false);
locallab->set_inconsistent(true);
}
locallabConn.block(false);
}

View File

@ -496,6 +496,12 @@ void ProfilePanel::load_clicked (GdkEventButton* event)
custom->pedited->locallab.spots.clear();
}
// For each Locallab spot, loaded profile pp only contains activated tools params
// Missing tool params in pe shall be also set to true to avoid a "spot merge" issue
for (int i = 0; i < (int)pe.locallab.spots.size(); i++) {
pe.locallab.spots.at(i).set(true);
}
custom->set(true);
bool prevState = changeconn.block(true);