From 39c53119ebbbe9aa2c22064e440013646e11778e Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Wed, 26 Dec 2018 10:31:57 +0100 Subject: [PATCH] Improve batch mode with Locallab Batch mode is now correctly managed by Locallab. It works only if the pictures have the same control spot number with coherent id Other improvements: - If there is no control spot, all Locallab tools are now disabled --- rtengine/procparams.cc | 419 +++++------ rtengine/procparams.h | 48 -- rtgui/batchtoolpanelcoord.cc | 26 +- rtgui/controlspotpanel.cc | 173 +++-- rtgui/controlspotpanel.h | 38 +- rtgui/editorpanel.cc | 1 + rtgui/filebrowser.cc | 1 + rtgui/history.cc | 9 + rtgui/locallab.cc | 1225 +++++++++++++++++++++---------- rtgui/locallab.h | 16 +- rtgui/paramsedited.cc | 1336 +++++++++++++++++++--------------- rtgui/paramsedited.h | 218 +++--- rtgui/partialpastedlg.cc | 5 + rtgui/profilepanel.cc | 42 +- rtgui/thumbnail.cc | 6 + rtgui/toolpanelcoord.cc | 21 + 16 files changed, 2190 insertions(+), 1394 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index e72f58dd9..ba3b5b068 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3405,117 +3405,119 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.selspot, "Locallab", "Selspot", locallab.selspot, keyFile); for (int i = 0; i < locallab.nbspot && i < (int)locallab.spots.size(); i++) { - LocallabParams::LocallabSpot spot = locallab.spots.at(i); - // Control spot settings - saveToKeyfile(!pedited || pedited->locallab.id, "Locallab", "Id_" + std::to_string(i), spot.id, keyFile); - saveToKeyfile(!pedited || pedited->locallab.name, "Locallab", "Name_" + std::to_string(i), spot.name, keyFile); - saveToKeyfile(!pedited || pedited->locallab.isvisible, "Locallab", "Isvisible_" + std::to_string(i), spot.isvisible, keyFile); - saveToKeyfile(!pedited || pedited->locallab.shape, "Locallab", "Shape_" + std::to_string(i), spot.shape, keyFile); - saveToKeyfile(!pedited || pedited->locallab.spotMethod, "Locallab", "SpotMethod_" + std::to_string(i), spot.spotMethod, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensiexclu, "Locallab", "SensiExclu_" + std::to_string(i), spot.sensiexclu, keyFile); - saveToKeyfile(!pedited || pedited->locallab.struc, "Locallab", "Struc_" + std::to_string(i), spot.struc, keyFile); - saveToKeyfile(!pedited || pedited->locallab.shapeMethod, "Locallab", "ShapeMethod_" + std::to_string(i), spot.shapeMethod, keyFile); - saveToKeyfile(!pedited || pedited->locallab.locX, "Locallab", "LocX_" + std::to_string(i), spot.locX, keyFile); - saveToKeyfile(!pedited || pedited->locallab.locXL, "Locallab", "LocXL_" + std::to_string(i), spot.locXL, keyFile); - saveToKeyfile(!pedited || pedited->locallab.locY, "Locallab", "LocY_" + std::to_string(i), spot.locY, keyFile); - saveToKeyfile(!pedited || pedited->locallab.locYT, "Locallab", "LocYT_" + std::to_string(i), spot.locYT, keyFile); - saveToKeyfile(!pedited || pedited->locallab.centerX, "Locallab", "CenterX_" + std::to_string(i), spot.centerX, keyFile); - saveToKeyfile(!pedited || pedited->locallab.centerY, "Locallab", "CenterY_" + std::to_string(i), spot.centerY, keyFile); - saveToKeyfile(!pedited || pedited->locallab.circrad, "Locallab", "Circrad_" + std::to_string(i), spot.circrad, keyFile); - saveToKeyfile(!pedited || pedited->locallab.qualityMethod, "Locallab", "QualityMethod_" + std::to_string(i), spot.qualityMethod, keyFile); - saveToKeyfile(!pedited || pedited->locallab.transit, "Locallab", "Transit_" + std::to_string(i), spot.transit, keyFile); - saveToKeyfile(!pedited || pedited->locallab.thresh, "Locallab", "Thresh_" + std::to_string(i), spot.thresh, keyFile); - saveToKeyfile(!pedited || pedited->locallab.iter, "Locallab", "Iter_" + std::to_string(i), spot.iter, keyFile); - // Color & Light - saveToKeyfile(!pedited || pedited->locallab.expcolor, "Locallab", "Expcolor_" + std::to_string(i), spot.expcolor, keyFile); - saveToKeyfile(!pedited || pedited->locallab.curvactiv, "Locallab", "Curvactiv_" + std::to_string(i), spot.curvactiv, keyFile); - saveToKeyfile(!pedited || pedited->locallab.lightness, "Locallab", "Lightness_" + std::to_string(i), spot.lightness, keyFile); - saveToKeyfile(!pedited || pedited->locallab.contrast, "Locallab", "Contrast_" + std::to_string(i), spot.contrast, keyFile); - saveToKeyfile(!pedited || pedited->locallab.chroma, "Locallab", "Chroma_" + std::to_string(i), spot.chroma, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensi, "Locallab", "Sensi_" + std::to_string(i), spot.sensi, keyFile); - saveToKeyfile(!pedited || pedited->locallab.qualitycurveMethod, "Locallab", "QualityCurveMethod_" + std::to_string(i), spot.qualitycurveMethod, keyFile); - saveToKeyfile(!pedited || pedited->locallab.llcurve, "Locallab", "LLCurve_" + std::to_string(i), spot.llcurve, keyFile); - saveToKeyfile(!pedited || pedited->locallab.cccurve, "Locallab", "CCCurve_" + std::to_string(i), spot.cccurve, keyFile); - saveToKeyfile(!pedited || pedited->locallab.LHcurve, "Locallab", "LHCurve_" + std::to_string(i), spot.LHcurve, keyFile); - saveToKeyfile(!pedited || pedited->locallab.HHcurve, "Locallab", "HHCurve_" + std::to_string(i), spot.HHcurve, keyFile); - saveToKeyfile(!pedited || pedited->locallab.invers, "Locallab", "Invers_" + std::to_string(i), spot.invers, keyFile); - // Exposure - saveToKeyfile(!pedited || pedited->locallab.expexpose, "Locallab", "Expexpose_" + std::to_string(i), spot.expexpose, keyFile); - saveToKeyfile(!pedited || pedited->locallab.expcomp, "Locallab", "Expcomp_" + std::to_string(i), spot.expcomp, keyFile); - saveToKeyfile(!pedited || pedited->locallab.hlcompr, "Locallab", "Hlcompr_" + std::to_string(i), spot.hlcompr, keyFile); - saveToKeyfile(!pedited || pedited->locallab.hlcomprthresh, "Locallab", "Hlcomprthresh_" + std::to_string(i), spot.hlcomprthresh, keyFile); - saveToKeyfile(!pedited || pedited->locallab.black, "Locallab", "Black_" + std::to_string(i), spot.black, keyFile); - saveToKeyfile(!pedited || pedited->locallab.shcompr, "Locallab", "Shcompr_" + std::to_string(i), spot.shcompr, keyFile); - saveToKeyfile(!pedited || pedited->locallab.warm, "Locallab", "Warm_" + std::to_string(i), spot.warm, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensiex, "Locallab", "Sensiex_" + std::to_string(i), spot.sensiex, keyFile); - saveToKeyfile(!pedited || pedited->locallab.excurve, "Locallab", "ExCurve_" + std::to_string(i), spot.excurve, keyFile); - // Vibrance - saveToKeyfile(!pedited || pedited->locallab.expvibrance, "Locallab", "Expvibrance_" + std::to_string(i), spot.expvibrance, keyFile); - saveToKeyfile(!pedited || pedited->locallab.saturated, "Locallab", "Saturated_" + std::to_string(i), spot.saturated, keyFile); - saveToKeyfile(!pedited || pedited->locallab.pastels, "Locallab", "Pastels_" + std::to_string(i), spot.pastels, keyFile); - saveToKeyfile(!pedited || pedited->locallab.psthreshold, "Locallab", "PSThreshold_" + std::to_string(i), spot.psthreshold.toVector(), keyFile); - saveToKeyfile(!pedited || pedited->locallab.protectskins, "Locallab", "ProtectSkins_" + std::to_string(i), spot.protectskins, keyFile); - saveToKeyfile(!pedited || pedited->locallab.avoidcolorshift, "Locallab", "AvoidColorShift_" + std::to_string(i), spot.avoidcolorshift, keyFile); - saveToKeyfile(!pedited || pedited->locallab.pastsattog, "Locallab", "PastSatTog_" + std::to_string(i), spot.pastsattog, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensiv, "Locallab", "Sensiv_" + std::to_string(i), spot.sensiv, keyFile); - saveToKeyfile(!pedited || pedited->locallab.skintonescurve, "Locallab", "SkinTonesCurve_" + std::to_string(i), spot.skintonescurve, keyFile); - // Blur & Noise - saveToKeyfile(!pedited || pedited->locallab.expblur, "Locallab", "Expblur_" + std::to_string(i), spot.expblur, keyFile); - saveToKeyfile(!pedited || pedited->locallab.radius, "Locallab", "Radius_" + std::to_string(i), spot.radius, keyFile); - saveToKeyfile(!pedited || pedited->locallab.strength, "Locallab", "Strength_" + std::to_string(i), spot.strength, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensibn, "Locallab", "Sensibn_" + std::to_string(i), spot.sensibn, keyFile); - saveToKeyfile(!pedited || pedited->locallab.blurMethod, "Locallab", "BlurMethod_" + std::to_string(i), spot.blurMethod, keyFile); - saveToKeyfile(!pedited || pedited->locallab.activlum, "Locallab", "activlum_" + std::to_string(i), spot.activlum, keyFile); - // Tone Mapping - saveToKeyfile(!pedited || pedited->locallab.exptonemap, "Locallab", "Exptonemap_" + std::to_string(i), spot.exptonemap, keyFile); - saveToKeyfile(!pedited || pedited->locallab.stren, "Locallab", "Stren_" + std::to_string(i), spot.stren, keyFile); - saveToKeyfile(!pedited || pedited->locallab.gamma, "Locallab", "Gamma_" + std::to_string(i), spot.gamma, keyFile); - saveToKeyfile(!pedited || pedited->locallab.estop, "Locallab", "Estop_" + std::to_string(i), spot.estop, keyFile); - saveToKeyfile(!pedited || pedited->locallab.scaltm, "Locallab", "Scaltm_" + std::to_string(i), spot.scaltm, keyFile); - saveToKeyfile(!pedited || pedited->locallab.rewei, "Locallab", "Rewei_" + std::to_string(i), spot.rewei, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensitm, "Locallab", "Sensitm_" + std::to_string(i), spot.sensitm, keyFile); - // Retinex - saveToKeyfile(!pedited || pedited->locallab.expreti, "Locallab", "Expreti_" + std::to_string(i), spot.expreti, keyFile); - saveToKeyfile(!pedited || pedited->locallab.retinexMethod, "Locallab", "retinexMethod_" + std::to_string(i), spot.retinexMethod, keyFile); - saveToKeyfile(!pedited || pedited->locallab.str, "Locallab", "Str_" + std::to_string(i), spot.str, keyFile); - saveToKeyfile(!pedited || pedited->locallab.chrrt, "Locallab", "Chrrt_" + std::to_string(i), spot.chrrt, keyFile); - saveToKeyfile(!pedited || pedited->locallab.neigh, "Locallab", "Neigh_" + std::to_string(i), spot.neigh, keyFile); - saveToKeyfile(!pedited || pedited->locallab.vart, "Locallab", "Vart_" + std::to_string(i), spot.vart, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensih, "Locallab", "Sensih_" + std::to_string(i), spot.sensih, keyFile); - saveToKeyfile(!pedited || pedited->locallab.localTgaincurve, "Locallab", "TgainCurve_" + std::to_string(i), spot.localTgaincurve, keyFile); - saveToKeyfile(!pedited || pedited->locallab.inversret, "Locallab", "Inversret_" + std::to_string(i), spot.inversret, keyFile); - // Sharpening - saveToKeyfile(!pedited || pedited->locallab.expsharp, "Locallab", "Expsharp_" + std::to_string(i), spot.expsharp, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sharradius, "Locallab", "Sharradius_" + std::to_string(i), spot.sharradius, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sharamount, "Locallab", "Sharamount_" + std::to_string(i), spot.sharamount, keyFile); - saveToKeyfile(!pedited || pedited->locallab.shardamping, "Locallab", "Shardamping_" + std::to_string(i), spot.shardamping, keyFile); - saveToKeyfile(!pedited || pedited->locallab.shariter, "Locallab", "Shariter_" + std::to_string(i), spot.shariter, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensisha, "Locallab", "Sensisha_" + std::to_string(i), spot.sensisha, keyFile); - saveToKeyfile(!pedited || pedited->locallab.inverssha, "Locallab", "Inverssha_" + std::to_string(i), spot.inverssha, keyFile); - // Contrast by detail levels - saveToKeyfile(!pedited || pedited->locallab.expcbdl, "Locallab", "Expcbdl_" + std::to_string(i), spot.expcbdl, keyFile); + if (!pedited || i < (int)pedited->locallab.spots.size()) { + const LocallabParams::LocallabSpot& spot = locallab.spots.at(i); + // Control spot settings + saveToKeyfile(!pedited || pedited->locallab.id, "Locallab", "Id_" + std::to_string(i), spot.id, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).name, "Locallab", "Name_" + std::to_string(i), spot.name, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).isvisible, "Locallab", "Isvisible_" + std::to_string(i), spot.isvisible, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).shape, "Locallab", "Shape_" + std::to_string(i), spot.shape, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).spotMethod, "Locallab", "SpotMethod_" + std::to_string(i), spot.spotMethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensiexclu, "Locallab", "SensiExclu_" + std::to_string(i), spot.sensiexclu, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).struc, "Locallab", "Struc_" + std::to_string(i), spot.struc, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).shapeMethod, "Locallab", "ShapeMethod_" + std::to_string(i), spot.shapeMethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).locX, "Locallab", "LocX_" + std::to_string(i), spot.locX, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).locXL, "Locallab", "LocXL_" + std::to_string(i), spot.locXL, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).locY, "Locallab", "LocY_" + std::to_string(i), spot.locY, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).locYT, "Locallab", "LocYT_" + std::to_string(i), spot.locYT, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).centerX, "Locallab", "CenterX_" + std::to_string(i), spot.centerX, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).centerY, "Locallab", "CenterY_" + std::to_string(i), spot.centerY, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).circrad, "Locallab", "Circrad_" + std::to_string(i), spot.circrad, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).qualityMethod, "Locallab", "QualityMethod_" + std::to_string(i), spot.qualityMethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).transit, "Locallab", "Transit_" + std::to_string(i), spot.transit, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).thresh, "Locallab", "Thresh_" + std::to_string(i), spot.thresh, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).iter, "Locallab", "Iter_" + std::to_string(i), spot.iter, keyFile); + // Color & Light + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expcolor, "Locallab", "Expcolor_" + std::to_string(i), spot.expcolor, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).curvactiv, "Locallab", "Curvactiv_" + std::to_string(i), spot.curvactiv, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).lightness, "Locallab", "Lightness_" + std::to_string(i), spot.lightness, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).contrast, "Locallab", "Contrast_" + std::to_string(i), spot.contrast, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).chroma, "Locallab", "Chroma_" + std::to_string(i), spot.chroma, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensi, "Locallab", "Sensi_" + std::to_string(i), spot.sensi, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).qualitycurveMethod, "Locallab", "QualityCurveMethod_" + std::to_string(i), spot.qualitycurveMethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).llcurve, "Locallab", "LLCurve_" + std::to_string(i), spot.llcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).cccurve, "Locallab", "CCCurve_" + std::to_string(i), spot.cccurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LHcurve, "Locallab", "LHCurve_" + std::to_string(i), spot.LHcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHcurve, "Locallab", "HHCurve_" + std::to_string(i), spot.HHcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).invers, "Locallab", "Invers_" + std::to_string(i), spot.invers, keyFile); + // Exposure + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expexpose, "Locallab", "Expexpose_" + std::to_string(i), spot.expexpose, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expcomp, "Locallab", "Expcomp_" + std::to_string(i), spot.expcomp, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).hlcompr, "Locallab", "Hlcompr_" + std::to_string(i), spot.hlcompr, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).hlcomprthresh, "Locallab", "Hlcomprthresh_" + std::to_string(i), spot.hlcomprthresh, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).black, "Locallab", "Black_" + std::to_string(i), spot.black, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).shcompr, "Locallab", "Shcompr_" + std::to_string(i), spot.shcompr, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).warm, "Locallab", "Warm_" + std::to_string(i), spot.warm, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensiex, "Locallab", "Sensiex_" + std::to_string(i), spot.sensiex, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).excurve, "Locallab", "ExCurve_" + std::to_string(i), spot.excurve, keyFile); + // Vibrance + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expvibrance, "Locallab", "Expvibrance_" + std::to_string(i), spot.expvibrance, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).saturated, "Locallab", "Saturated_" + std::to_string(i), spot.saturated, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).pastels, "Locallab", "Pastels_" + std::to_string(i), spot.pastels, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).psthreshold, "Locallab", "PSThreshold_" + std::to_string(i), spot.psthreshold.toVector(), keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).protectskins, "Locallab", "ProtectSkins_" + std::to_string(i), spot.protectskins, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).avoidcolorshift, "Locallab", "AvoidColorShift_" + std::to_string(i), spot.avoidcolorshift, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).pastsattog, "Locallab", "PastSatTog_" + std::to_string(i), spot.pastsattog, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensiv, "Locallab", "Sensiv_" + std::to_string(i), spot.sensiv, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).skintonescurve, "Locallab", "SkinTonesCurve_" + std::to_string(i), spot.skintonescurve, keyFile); + // Blur & Noise + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expblur, "Locallab", "Expblur_" + std::to_string(i), spot.expblur, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radius, "Locallab", "Radius_" + std::to_string(i), spot.radius, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).strength, "Locallab", "Strength_" + std::to_string(i), spot.strength, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensibn, "Locallab", "Sensibn_" + std::to_string(i), spot.sensibn, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurMethod, "Locallab", "BlurMethod_" + std::to_string(i), spot.blurMethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).activlum, "Locallab", "activlum_" + std::to_string(i), spot.activlum, keyFile); + // Tone Mapping + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).exptonemap, "Locallab", "Exptonemap_" + std::to_string(i), spot.exptonemap, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).stren, "Locallab", "Stren_" + std::to_string(i), spot.stren, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).gamma, "Locallab", "Gamma_" + std::to_string(i), spot.gamma, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).estop, "Locallab", "Estop_" + std::to_string(i), spot.estop, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).scaltm, "Locallab", "Scaltm_" + std::to_string(i), spot.scaltm, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).rewei, "Locallab", "Rewei_" + std::to_string(i), spot.rewei, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensitm, "Locallab", "Sensitm_" + std::to_string(i), spot.sensitm, keyFile); + // Retinex + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expreti, "Locallab", "Expreti_" + std::to_string(i), spot.expreti, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).retinexMethod, "Locallab", "retinexMethod_" + std::to_string(i), spot.retinexMethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).str, "Locallab", "Str_" + std::to_string(i), spot.str, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).chrrt, "Locallab", "Chrrt_" + std::to_string(i), spot.chrrt, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).neigh, "Locallab", "Neigh_" + std::to_string(i), spot.neigh, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).vart, "Locallab", "Vart_" + std::to_string(i), spot.vart, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensih, "Locallab", "Sensih_" + std::to_string(i), spot.sensih, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).localTgaincurve, "Locallab", "TgainCurve_" + std::to_string(i), spot.localTgaincurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).inversret, "Locallab", "Inversret_" + std::to_string(i), spot.inversret, keyFile); + // Sharpening + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expsharp, "Locallab", "Expsharp_" + std::to_string(i), spot.expsharp, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sharradius, "Locallab", "Sharradius_" + std::to_string(i), spot.sharradius, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sharamount, "Locallab", "Sharamount_" + std::to_string(i), spot.sharamount, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).shardamping, "Locallab", "Shardamping_" + std::to_string(i), spot.shardamping, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).shariter, "Locallab", "Shariter_" + std::to_string(i), spot.shariter, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensisha, "Locallab", "Sensisha_" + std::to_string(i), spot.sensisha, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).inverssha, "Locallab", "Inverssha_" + std::to_string(i), spot.inverssha, keyFile); + // Contrast by detail levels + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expcbdl, "Locallab", "Expcbdl_" + std::to_string(i), spot.expcbdl, keyFile); - for (int j = 0; j < 5; j++) { - saveToKeyfile(!pedited || pedited->locallab.mult[j], "Locallab", "Mult" + std::to_string(j) + "_" + std::to_string(i), spot.mult[j], keyFile); + for (int j = 0; j < 5; j++) { + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).mult[j], "Locallab", "Mult" + std::to_string(j) + "_" + std::to_string(i), spot.mult[j], keyFile); + } + + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).chromacbdl, "Locallab", "Chromacbdl_" + std::to_string(i), spot.chromacbdl, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).threshold, "Locallab", "Threshold_" + std::to_string(i), spot.threshold, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensicb, "Locallab", "Sensicb_" + std::to_string(i), spot.sensicb, keyFile); + // Denoise + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expdenoi, "Locallab", "Expdenoi_" + std::to_string(i), spot.expdenoi, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).noiselumf, "Locallab", "noiselumf_" + std::to_string(i), spot.noiselumf, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).noiselumc, "Locallab", "noiselumc_" + std::to_string(i), spot.noiselumc, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).noiselumdetail, "Locallab", "noiselumdetail_" + std::to_string(i), spot.noiselumdetail, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).noiselequal, "Locallab", "noiselequal_" + std::to_string(i), spot.noiselequal, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).noisechrof, "Locallab", "noisechrof_" + std::to_string(i), spot.noisechrof, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).noisechroc, "Locallab", "noisechroc_" + std::to_string(i), spot.noisechroc, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).noisechrodetail, "Locallab", "noisechrodetail_" + std::to_string(i), spot.noisechrodetail, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).adjblur, "Locallab", "Adjblur_" + std::to_string(i), spot.adjblur, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).bilateral, "Locallab", "Bilateral_" + std::to_string(i), spot.bilateral, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensiden, "Locallab", "Sensiden_" + std::to_string(i), spot.sensiden, keyFile); + // Others + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).avoid, "Locallab", "Avoid_" + std::to_string(i), spot.avoid, keyFile); } - - saveToKeyfile(!pedited || pedited->locallab.chromacbdl, "Locallab", "Chromacbdl_" + std::to_string(i), spot.chromacbdl, keyFile); - saveToKeyfile(!pedited || pedited->locallab.threshold, "Locallab", "Threshold_" + std::to_string(i), spot.threshold, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensicb, "Locallab", "Sensicb_" + std::to_string(i), spot.sensicb, keyFile); - // Denoise - saveToKeyfile(!pedited || pedited->locallab.expdenoi, "Locallab", "Expdenoi_" + std::to_string(i), spot.expdenoi, keyFile); - saveToKeyfile(!pedited || pedited->locallab.noiselumf, "Locallab", "noiselumf_" + std::to_string(i), spot.noiselumf, keyFile); - saveToKeyfile(!pedited || pedited->locallab.noiselumc, "Locallab", "noiselumc_" + std::to_string(i), spot.noiselumc, keyFile); - saveToKeyfile(!pedited || pedited->locallab.noiselumdetail, "Locallab", "noiselumdetail_" + std::to_string(i), spot.noiselumdetail, keyFile); - saveToKeyfile(!pedited || pedited->locallab.noiselequal, "Locallab", "noiselequal_" + std::to_string(i), spot.noiselequal, keyFile); - saveToKeyfile(!pedited || pedited->locallab.noisechrof, "Locallab", "noisechrof_" + std::to_string(i), spot.noisechrof, keyFile); - saveToKeyfile(!pedited || pedited->locallab.noisechroc, "Locallab", "noisechroc_" + std::to_string(i), spot.noisechroc, keyFile); - saveToKeyfile(!pedited || pedited->locallab.noisechrodetail, "Locallab", "noisechrodetail_" + std::to_string(i), spot.noisechrodetail, keyFile); - saveToKeyfile(!pedited || pedited->locallab.adjblur, "Locallab", "Adjblur_" + std::to_string(i), spot.adjblur, keyFile); - saveToKeyfile(!pedited || pedited->locallab.bilateral, "Locallab", "Bilateral_" + std::to_string(i), spot.bilateral, keyFile); - saveToKeyfile(!pedited || pedited->locallab.sensiden, "Locallab", "Sensiden_" + std::to_string(i), spot.sensiden, keyFile); - // Others - saveToKeyfile(!pedited || pedited->locallab.avoid, "Locallab", "Avoid_" + std::to_string(i), spot.avoid, keyFile); } // Post-crop vignette @@ -4561,56 +4563,63 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) locallab.spots.resize(locallab.nbspot); } + // Initialize LocallabSpotEdited to false according to nbspot + if (pedited) { + pedited->locallab.spots.clear(); + pedited->locallab.spots.resize(locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(false)); + } + for (int i = 0; i < locallab.nbspot; i++) { LocallabParams::LocallabSpot spot; + LocallabParamsEdited::LocallabSpotEdited spotEdited(false); // Control spot settings assignFromKeyfile(keyFile, "Locallab", "Id_" + std::to_string(i), pedited, spot.id, pedited->locallab.id); - assignFromKeyfile(keyFile, "Locallab", "Name_" + std::to_string(i), pedited, spot.name, pedited->locallab.name); - assignFromKeyfile(keyFile, "Locallab", "Isvisible_" + std::to_string(i), pedited, spot.isvisible, pedited->locallab.isvisible); - assignFromKeyfile(keyFile, "Locallab", "Shape_" + std::to_string(i), pedited, spot.shape, pedited->locallab.shape); - assignFromKeyfile(keyFile, "Locallab", "SpotMethod_" + std::to_string(i), pedited, spot.spotMethod, pedited->locallab.spotMethod); - assignFromKeyfile(keyFile, "Locallab", "ShapeMethod_" + std::to_string(i), pedited, spot.shapeMethod, pedited->locallab.shapeMethod); - assignFromKeyfile(keyFile, "Locallab", "SensiExclu_" + std::to_string(i), pedited, spot.sensiexclu, pedited->locallab.sensiexclu); - assignFromKeyfile(keyFile, "Locallab", "Struc_" + std::to_string(i), pedited, spot.struc, pedited->locallab.struc); - assignFromKeyfile(keyFile, "Locallab", "LocX_" + std::to_string(i), pedited, spot.locX, pedited->locallab.locX); - assignFromKeyfile(keyFile, "Locallab", "LocXL_" + std::to_string(i), pedited, spot.locXL, pedited->locallab.locXL); - assignFromKeyfile(keyFile, "Locallab", "LocY_" + std::to_string(i), pedited, spot.locY, pedited->locallab.locY); - assignFromKeyfile(keyFile, "Locallab", "LocYT_" + std::to_string(i), pedited, spot.locYT, pedited->locallab.locYT); - assignFromKeyfile(keyFile, "Locallab", "CenterX_" + std::to_string(i), pedited, spot.centerX, pedited->locallab.centerX); - assignFromKeyfile(keyFile, "Locallab", "CenterY_" + std::to_string(i), pedited, spot.centerY, pedited->locallab.centerY); - assignFromKeyfile(keyFile, "Locallab", "Circrad_" + std::to_string(i), pedited, spot.circrad, pedited->locallab.circrad); - assignFromKeyfile(keyFile, "Locallab", "QualityMethod_" + std::to_string(i), pedited, spot.qualityMethod, pedited->locallab.qualityMethod); - assignFromKeyfile(keyFile, "Locallab", "Transit_" + std::to_string(i), pedited, spot.transit, pedited->locallab.transit); - assignFromKeyfile(keyFile, "Locallab", "Thresh_" + std::to_string(i), pedited, spot.thresh, pedited->locallab.thresh); - assignFromKeyfile(keyFile, "Locallab", "Iter_" + std::to_string(i), pedited, spot.iter, pedited->locallab.iter); + assignFromKeyfile(keyFile, "Locallab", "Name_" + std::to_string(i), pedited, spot.name, spotEdited.name); + assignFromKeyfile(keyFile, "Locallab", "Isvisible_" + std::to_string(i), pedited, spot.isvisible, spotEdited.isvisible); + assignFromKeyfile(keyFile, "Locallab", "Shape_" + std::to_string(i), pedited, spot.shape, spotEdited.shape); + assignFromKeyfile(keyFile, "Locallab", "SpotMethod_" + std::to_string(i), pedited, spot.spotMethod, spotEdited.spotMethod); + assignFromKeyfile(keyFile, "Locallab", "ShapeMethod_" + std::to_string(i), pedited, spot.shapeMethod, spotEdited.shapeMethod); + assignFromKeyfile(keyFile, "Locallab", "SensiExclu_" + std::to_string(i), pedited, spot.sensiexclu, spotEdited.sensiexclu); + assignFromKeyfile(keyFile, "Locallab", "Struc_" + std::to_string(i), pedited, spot.struc, spotEdited.struc); + assignFromKeyfile(keyFile, "Locallab", "LocX_" + std::to_string(i), pedited, spot.locX, spotEdited.locX); + assignFromKeyfile(keyFile, "Locallab", "LocXL_" + std::to_string(i), pedited, spot.locXL, spotEdited.locXL); + assignFromKeyfile(keyFile, "Locallab", "LocY_" + std::to_string(i), pedited, spot.locY, spotEdited.locY); + assignFromKeyfile(keyFile, "Locallab", "LocYT_" + std::to_string(i), pedited, spot.locYT, spotEdited.locYT); + assignFromKeyfile(keyFile, "Locallab", "CenterX_" + std::to_string(i), pedited, spot.centerX, spotEdited.centerX); + assignFromKeyfile(keyFile, "Locallab", "CenterY_" + std::to_string(i), pedited, spot.centerY, spotEdited.centerY); + assignFromKeyfile(keyFile, "Locallab", "Circrad_" + std::to_string(i), pedited, spot.circrad, spotEdited.circrad); + assignFromKeyfile(keyFile, "Locallab", "QualityMethod_" + std::to_string(i), pedited, spot.qualityMethod, spotEdited.qualityMethod); + assignFromKeyfile(keyFile, "Locallab", "Transit_" + std::to_string(i), pedited, spot.transit, spotEdited.transit); + assignFromKeyfile(keyFile, "Locallab", "Thresh_" + std::to_string(i), pedited, spot.thresh, spotEdited.thresh); + assignFromKeyfile(keyFile, "Locallab", "Iter_" + std::to_string(i), pedited, spot.iter, spotEdited.iter); // Color & Light - assignFromKeyfile(keyFile, "Locallab", "Expcolor_" + std::to_string(i), pedited, spot.expcolor, pedited->locallab.expcolor); - assignFromKeyfile(keyFile, "Locallab", "Curvactiv_" + std::to_string(i), pedited, spot.curvactiv, pedited->locallab.curvactiv); - assignFromKeyfile(keyFile, "Locallab", "Lightness_" + std::to_string(i), pedited, spot.lightness, pedited->locallab.lightness); - assignFromKeyfile(keyFile, "Locallab", "Contrast_" + std::to_string(i), pedited, spot.contrast, pedited->locallab.contrast); - assignFromKeyfile(keyFile, "Locallab", "Chroma_" + std::to_string(i), pedited, spot.chroma, pedited->locallab.chroma); - assignFromKeyfile(keyFile, "Locallab", "Sensi_" + std::to_string(i), pedited, spot.sensi, pedited->locallab.sensi); - assignFromKeyfile(keyFile, "Locallab", "QualityCurveMethod_" + std::to_string(i), pedited, spot.qualitycurveMethod, pedited->locallab.qualitycurveMethod); - assignFromKeyfile(keyFile, "Locallab", "LLCurve_" + std::to_string(i), pedited, spot.llcurve, pedited->locallab.llcurve); - assignFromKeyfile(keyFile, "Locallab", "CCCurve_" + std::to_string(i), pedited, spot.cccurve, pedited->locallab.cccurve); - assignFromKeyfile(keyFile, "Locallab", "LHCurve_" + std::to_string(i), pedited, spot.LHcurve, pedited->locallab.LHcurve); - assignFromKeyfile(keyFile, "Locallab", "HHCurve_" + std::to_string(i), pedited, spot.HHcurve, pedited->locallab.HHcurve); - assignFromKeyfile(keyFile, "Locallab", "Invers_" + std::to_string(i), pedited, spot.invers, pedited->locallab.invers); + assignFromKeyfile(keyFile, "Locallab", "Expcolor_" + std::to_string(i), pedited, spot.expcolor, spotEdited.expcolor); + assignFromKeyfile(keyFile, "Locallab", "Curvactiv_" + std::to_string(i), pedited, spot.curvactiv, spotEdited.curvactiv); + assignFromKeyfile(keyFile, "Locallab", "Lightness_" + std::to_string(i), pedited, spot.lightness, spotEdited.lightness); + assignFromKeyfile(keyFile, "Locallab", "Contrast_" + std::to_string(i), pedited, spot.contrast, spotEdited.contrast); + assignFromKeyfile(keyFile, "Locallab", "Chroma_" + std::to_string(i), pedited, spot.chroma, spotEdited.chroma); + assignFromKeyfile(keyFile, "Locallab", "Sensi_" + std::to_string(i), pedited, spot.sensi, spotEdited.sensi); + assignFromKeyfile(keyFile, "Locallab", "QualityCurveMethod_" + std::to_string(i), pedited, spot.qualitycurveMethod, spotEdited.qualitycurveMethod); + assignFromKeyfile(keyFile, "Locallab", "LLCurve_" + std::to_string(i), pedited, spot.llcurve, spotEdited.llcurve); + assignFromKeyfile(keyFile, "Locallab", "CCCurve_" + std::to_string(i), pedited, spot.cccurve, spotEdited.cccurve); + assignFromKeyfile(keyFile, "Locallab", "LHCurve_" + std::to_string(i), pedited, spot.LHcurve, spotEdited.LHcurve); + assignFromKeyfile(keyFile, "Locallab", "HHCurve_" + std::to_string(i), pedited, spot.HHcurve, spotEdited.HHcurve); + assignFromKeyfile(keyFile, "Locallab", "Invers_" + std::to_string(i), pedited, spot.invers, spotEdited.invers); // Exposure - assignFromKeyfile(keyFile, "Locallab", "Expexpose_" + std::to_string(i), pedited, spot.expexpose, pedited->locallab.expexpose); - assignFromKeyfile(keyFile, "Locallab", "Expcomp_" + std::to_string(i), pedited, spot.expcomp, pedited->locallab.expcomp); - assignFromKeyfile(keyFile, "Locallab", "Hlcompr_" + std::to_string(i), pedited, spot.hlcompr, pedited->locallab.hlcompr); - assignFromKeyfile(keyFile, "Locallab", "Hlcomprthresh_" + std::to_string(i), pedited, spot.hlcomprthresh, pedited->locallab.hlcomprthresh); - assignFromKeyfile(keyFile, "Locallab", "Black_" + std::to_string(i), pedited, spot.black, pedited->locallab.black); - assignFromKeyfile(keyFile, "Locallab", "Shcompr_" + std::to_string(i), pedited, spot.shcompr, pedited->locallab.shcompr); - assignFromKeyfile(keyFile, "Locallab", "Warm_" + std::to_string(i), pedited, spot.warm, pedited->locallab.warm); - assignFromKeyfile(keyFile, "Locallab", "Sensiex_" + std::to_string(i), pedited, spot.sensiex, pedited->locallab.sensiex); - assignFromKeyfile(keyFile, "Locallab", "ExCurve_" + std::to_string(i), pedited, spot.excurve, pedited->locallab.excurve); + assignFromKeyfile(keyFile, "Locallab", "Expexpose_" + std::to_string(i), pedited, spot.expexpose, spotEdited.expexpose); + assignFromKeyfile(keyFile, "Locallab", "Expcomp_" + std::to_string(i), pedited, spot.expcomp, spotEdited.expcomp); + assignFromKeyfile(keyFile, "Locallab", "Hlcompr_" + std::to_string(i), pedited, spot.hlcompr, spotEdited.hlcompr); + assignFromKeyfile(keyFile, "Locallab", "Hlcomprthresh_" + std::to_string(i), pedited, spot.hlcomprthresh, spotEdited.hlcomprthresh); + assignFromKeyfile(keyFile, "Locallab", "Black_" + std::to_string(i), pedited, spot.black, spotEdited.black); + assignFromKeyfile(keyFile, "Locallab", "Shcompr_" + std::to_string(i), pedited, spot.shcompr, spotEdited.shcompr); + assignFromKeyfile(keyFile, "Locallab", "Warm_" + std::to_string(i), pedited, spot.warm, spotEdited.warm); + assignFromKeyfile(keyFile, "Locallab", "Sensiex_" + std::to_string(i), pedited, spot.sensiex, spotEdited.sensiex); + assignFromKeyfile(keyFile, "Locallab", "ExCurve_" + std::to_string(i), pedited, spot.excurve, spotEdited.excurve); // Vibrance - assignFromKeyfile(keyFile, "Locallab", "Expvibrance_" + std::to_string(i), pedited, spot.expvibrance, pedited->locallab.expvibrance); - assignFromKeyfile(keyFile, "Locallab", "Saturated_" + std::to_string(i), pedited, spot.saturated, pedited->locallab.saturated); - assignFromKeyfile(keyFile, "Locallab", "Pastels_" + std::to_string(i), pedited, spot.pastels, pedited->locallab.pastels); + assignFromKeyfile(keyFile, "Locallab", "Expvibrance_" + std::to_string(i), pedited, spot.expvibrance, spotEdited.expvibrance); + assignFromKeyfile(keyFile, "Locallab", "Saturated_" + std::to_string(i), pedited, spot.saturated, spotEdited.saturated); + assignFromKeyfile(keyFile, "Locallab", "Pastels_" + std::to_string(i), pedited, spot.pastels, spotEdited.pastels); if (keyFile.has_key("Locallab", "PSThreshold_" + std::to_string(i))) { const std::vector thresh = keyFile.get_integer_list("Locallab", "PSThreshold_" + std::to_string(i)); @@ -4620,74 +4629,78 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) } if (pedited) { - pedited->locallab.psthreshold = true; + spotEdited.psthreshold = true; } } - assignFromKeyfile(keyFile, "Locallab", "ProtectSkins_" + std::to_string(i), pedited, spot.protectskins, pedited->locallab.protectskins); - assignFromKeyfile(keyFile, "Locallab", "AvoidColorShift_" + std::to_string(i), pedited, spot.avoidcolorshift, pedited->locallab.avoidcolorshift); - assignFromKeyfile(keyFile, "Locallab", "PastSatTog_" + std::to_string(i), pedited, spot.pastsattog, pedited->locallab.pastsattog); - assignFromKeyfile(keyFile, "Locallab", "Sensiv_" + std::to_string(i), pedited, spot.sensiv, pedited->locallab.sensiv); - assignFromKeyfile(keyFile, "Locallab", "SkinTonesCurve_" + std::to_string(i), pedited, spot.skintonescurve, pedited->locallab.skintonescurve); + assignFromKeyfile(keyFile, "Locallab", "ProtectSkins_" + std::to_string(i), pedited, spot.protectskins, spotEdited.protectskins); + assignFromKeyfile(keyFile, "Locallab", "AvoidColorShift_" + std::to_string(i), pedited, spot.avoidcolorshift, spotEdited.avoidcolorshift); + assignFromKeyfile(keyFile, "Locallab", "PastSatTog_" + std::to_string(i), pedited, spot.pastsattog, spotEdited.pastsattog); + assignFromKeyfile(keyFile, "Locallab", "Sensiv_" + std::to_string(i), pedited, spot.sensiv, spotEdited.sensiv); + assignFromKeyfile(keyFile, "Locallab", "SkinTonesCurve_" + std::to_string(i), pedited, spot.skintonescurve, spotEdited.skintonescurve); // Blur & Noise - assignFromKeyfile(keyFile, "Locallab", "Expblur_" + std::to_string(i), pedited, spot.expblur, pedited->locallab.expblur); - assignFromKeyfile(keyFile, "Locallab", "Radius_" + std::to_string(i), pedited, spot.radius, pedited->locallab.radius); - assignFromKeyfile(keyFile, "Locallab", "Strength_" + std::to_string(i), pedited, spot.strength, pedited->locallab.strength); - assignFromKeyfile(keyFile, "Locallab", "Sensibn_" + std::to_string(i), pedited, spot.sensibn, pedited->locallab.sensibn); - assignFromKeyfile(keyFile, "Locallab", "BlurMethod_" + std::to_string(i), pedited, spot.blurMethod, pedited->locallab.blurMethod); - assignFromKeyfile(keyFile, "Locallab", "activlum_" + std::to_string(i), pedited, spot.activlum, pedited->locallab.activlum); + assignFromKeyfile(keyFile, "Locallab", "Expblur_" + std::to_string(i), pedited, spot.expblur, spotEdited.expblur); + assignFromKeyfile(keyFile, "Locallab", "Radius_" + std::to_string(i), pedited, spot.radius, spotEdited.radius); + assignFromKeyfile(keyFile, "Locallab", "Strength_" + std::to_string(i), pedited, spot.strength, spotEdited.strength); + assignFromKeyfile(keyFile, "Locallab", "Sensibn_" + std::to_string(i), pedited, spot.sensibn, spotEdited.sensibn); + assignFromKeyfile(keyFile, "Locallab", "BlurMethod_" + std::to_string(i), pedited, spot.blurMethod, spotEdited.blurMethod); + assignFromKeyfile(keyFile, "Locallab", "activlum_" + std::to_string(i), pedited, spot.activlum, spotEdited.activlum); // Tone Mapping - assignFromKeyfile(keyFile, "Locallab", "Exptonemap_" + std::to_string(i), pedited, spot.exptonemap, pedited->locallab.exptonemap); - assignFromKeyfile(keyFile, "Locallab", "Stren_" + std::to_string(i), pedited, spot.stren, pedited->locallab.stren); - assignFromKeyfile(keyFile, "Locallab", "Gamma_" + std::to_string(i), pedited, spot.gamma, pedited->locallab.gamma); - assignFromKeyfile(keyFile, "Locallab", "Estop_" + std::to_string(i), pedited, spot.estop, pedited->locallab.estop); - assignFromKeyfile(keyFile, "Locallab", "Scaltm_" + std::to_string(i), pedited, spot.scaltm, pedited->locallab.scaltm); - assignFromKeyfile(keyFile, "Locallab", "Rewei_" + std::to_string(i), pedited, spot.rewei, pedited->locallab.rewei); - assignFromKeyfile(keyFile, "Locallab", "Sensitm_" + std::to_string(i), pedited, spot.sensitm, pedited->locallab.sensitm); + assignFromKeyfile(keyFile, "Locallab", "Exptonemap_" + std::to_string(i), pedited, spot.exptonemap, spotEdited.exptonemap); + assignFromKeyfile(keyFile, "Locallab", "Stren_" + std::to_string(i), pedited, spot.stren, spotEdited.stren); + assignFromKeyfile(keyFile, "Locallab", "Gamma_" + std::to_string(i), pedited, spot.gamma, spotEdited.gamma); + assignFromKeyfile(keyFile, "Locallab", "Estop_" + std::to_string(i), pedited, spot.estop, spotEdited.estop); + assignFromKeyfile(keyFile, "Locallab", "Scaltm_" + std::to_string(i), pedited, spot.scaltm, spotEdited.scaltm); + assignFromKeyfile(keyFile, "Locallab", "Rewei_" + std::to_string(i), pedited, spot.rewei, spotEdited.rewei); + assignFromKeyfile(keyFile, "Locallab", "Sensitm_" + std::to_string(i), pedited, spot.sensitm, spotEdited.sensitm); // Retinex - assignFromKeyfile(keyFile, "Locallab", "Expreti_" + std::to_string(i), pedited, spot.expreti, pedited->locallab.expreti); - assignFromKeyfile(keyFile, "Locallab", "retinexMethod_" + std::to_string(i), pedited, spot.retinexMethod, pedited->locallab.retinexMethod); - assignFromKeyfile(keyFile, "Locallab", "Str_" + std::to_string(i), pedited, spot.str, pedited->locallab.str); - assignFromKeyfile(keyFile, "Locallab", "Chrrt_" + std::to_string(i), pedited, spot.chrrt, pedited->locallab.chrrt); - assignFromKeyfile(keyFile, "Locallab", "Neigh_" + std::to_string(i), pedited, spot.neigh, pedited->locallab.neigh); - assignFromKeyfile(keyFile, "Locallab", "Vart_" + std::to_string(i), pedited, spot.vart, pedited->locallab.vart); - assignFromKeyfile(keyFile, "Locallab", "Sensih_" + std::to_string(i), pedited, spot.sensih, pedited->locallab.sensih); - assignFromKeyfile(keyFile, "Locallab", "TgainCurve_" + std::to_string(i), pedited, spot.localTgaincurve, pedited->locallab.localTgaincurve); - assignFromKeyfile(keyFile, "Locallab", "Inversret_" + std::to_string(i), pedited, spot.inversret, pedited->locallab.inversret); + assignFromKeyfile(keyFile, "Locallab", "Expreti_" + std::to_string(i), pedited, spot.expreti, spotEdited.expreti); + assignFromKeyfile(keyFile, "Locallab", "retinexMethod_" + std::to_string(i), pedited, spot.retinexMethod, spotEdited.retinexMethod); + assignFromKeyfile(keyFile, "Locallab", "Str_" + std::to_string(i), pedited, spot.str, spotEdited.str); + assignFromKeyfile(keyFile, "Locallab", "Chrrt_" + std::to_string(i), pedited, spot.chrrt, spotEdited.chrrt); + assignFromKeyfile(keyFile, "Locallab", "Neigh_" + std::to_string(i), pedited, spot.neigh, spotEdited.neigh); + assignFromKeyfile(keyFile, "Locallab", "Vart_" + std::to_string(i), pedited, spot.vart, spotEdited.vart); + assignFromKeyfile(keyFile, "Locallab", "Sensih_" + std::to_string(i), pedited, spot.sensih, spotEdited.sensih); + assignFromKeyfile(keyFile, "Locallab", "TgainCurve_" + std::to_string(i), pedited, spot.localTgaincurve, spotEdited.localTgaincurve); + assignFromKeyfile(keyFile, "Locallab", "Inversret_" + std::to_string(i), pedited, spot.inversret, spotEdited.inversret); // Sharpening - assignFromKeyfile(keyFile, "Locallab", "Expsharp_" + std::to_string(i), pedited, spot.expsharp, pedited->locallab.expsharp); - assignFromKeyfile(keyFile, "Locallab", "Sharradius_" + std::to_string(i), pedited, spot.sharradius, pedited->locallab.sharradius); - assignFromKeyfile(keyFile, "Locallab", "Sharamount_" + std::to_string(i), pedited, spot.sharamount, pedited->locallab.sharamount); - assignFromKeyfile(keyFile, "Locallab", "Shardamping_" + std::to_string(i), pedited, spot.shardamping, pedited->locallab.shardamping); - assignFromKeyfile(keyFile, "Locallab", "Shariter_" + std::to_string(i), pedited, spot.shariter, pedited->locallab.shariter); - assignFromKeyfile(keyFile, "Locallab", "Sensisha_" + std::to_string(i), pedited, spot.sensisha, pedited->locallab.sensisha); - assignFromKeyfile(keyFile, "Locallab", "Inverssha_" + std::to_string(i), pedited, spot.inverssha, pedited->locallab.inverssha); + assignFromKeyfile(keyFile, "Locallab", "Expsharp_" + std::to_string(i), pedited, spot.expsharp, spotEdited.expsharp); + assignFromKeyfile(keyFile, "Locallab", "Sharradius_" + std::to_string(i), pedited, spot.sharradius, spotEdited.sharradius); + assignFromKeyfile(keyFile, "Locallab", "Sharamount_" + std::to_string(i), pedited, spot.sharamount, spotEdited.sharamount); + assignFromKeyfile(keyFile, "Locallab", "Shardamping_" + std::to_string(i), pedited, spot.shardamping, spotEdited.shardamping); + assignFromKeyfile(keyFile, "Locallab", "Shariter_" + std::to_string(i), pedited, spot.shariter, spotEdited.shariter); + assignFromKeyfile(keyFile, "Locallab", "Sensisha_" + std::to_string(i), pedited, spot.sensisha, spotEdited.sensisha); + assignFromKeyfile(keyFile, "Locallab", "Inverssha_" + std::to_string(i), pedited, spot.inverssha, spotEdited.inverssha); // Contrast by detail levels - assignFromKeyfile(keyFile, "Locallab", "Expcbdl_" + std::to_string(i), pedited, spot.expcbdl, pedited->locallab.expcbdl); + assignFromKeyfile(keyFile, "Locallab", "Expcbdl_" + std::to_string(i), pedited, spot.expcbdl, spotEdited.expcbdl); for (int j = 0; j < 5; j ++) { - assignFromKeyfile(keyFile, "Locallab", "Mult" + std::to_string(j) + "_" + std::to_string(i), pedited, spot.mult[j], pedited->locallab.mult[j]); + assignFromKeyfile(keyFile, "Locallab", "Mult" + std::to_string(j) + "_" + std::to_string(i), pedited, spot.mult[j], spotEdited.mult[j]); } - assignFromKeyfile(keyFile, "Locallab", "Chromacbdl_" + std::to_string(i), pedited, spot.chromacbdl, pedited->locallab.chromacbdl); - assignFromKeyfile(keyFile, "Locallab", "Threshold_" + std::to_string(i), pedited, spot.threshold, pedited->locallab.threshold); - assignFromKeyfile(keyFile, "Locallab", "Sensicb_" + std::to_string(i), pedited, spot.sensicb, pedited->locallab.sensicb); + assignFromKeyfile(keyFile, "Locallab", "Chromacbdl_" + std::to_string(i), pedited, spot.chromacbdl, spotEdited.chromacbdl); + assignFromKeyfile(keyFile, "Locallab", "Threshold_" + std::to_string(i), pedited, spot.threshold, spotEdited.threshold); + assignFromKeyfile(keyFile, "Locallab", "Sensicb_" + std::to_string(i), pedited, spot.sensicb, spotEdited.sensicb); // Denoise - assignFromKeyfile(keyFile, "Locallab", "Expdenoi_" + std::to_string(i), pedited, spot.expdenoi, pedited->locallab.expdenoi); - assignFromKeyfile(keyFile, "Locallab", "noiselumf_" + std::to_string(i), pedited, spot.noiselumf, pedited->locallab.noiselumf); - assignFromKeyfile(keyFile, "Locallab", "noiselumc_" + std::to_string(i), pedited, spot.noiselumc, pedited->locallab.noiselumc); - assignFromKeyfile(keyFile, "Locallab", "noiselumdetail_" + std::to_string(i), pedited, spot.noiselumdetail, pedited->locallab.noiselumdetail); - assignFromKeyfile(keyFile, "Locallab", "noiselequal_" + std::to_string(i), pedited, spot.noiselequal, pedited->locallab.noiselequal); - assignFromKeyfile(keyFile, "Locallab", "noisechrof_" + std::to_string(i), pedited, spot.noisechrof, pedited->locallab.noisechrof); - assignFromKeyfile(keyFile, "Locallab", "noisechroc_" + std::to_string(i), pedited, spot.noisechroc, pedited->locallab.noisechroc); - assignFromKeyfile(keyFile, "Locallab", "noisechrodetail_" + std::to_string(i), pedited, spot.noisechrodetail, pedited->locallab.noisechrodetail); - assignFromKeyfile(keyFile, "Locallab", "Adjblur_" + std::to_string(i), pedited, spot.adjblur, pedited->locallab.adjblur); - assignFromKeyfile(keyFile, "Locallab", "Bilateral_" + std::to_string(i), pedited, spot.bilateral, pedited->locallab.bilateral); - assignFromKeyfile(keyFile, "Locallab", "Sensiden_" + std::to_string(i), pedited, spot.sensiden, pedited->locallab.sensiden); + assignFromKeyfile(keyFile, "Locallab", "Expdenoi_" + std::to_string(i), pedited, spot.expdenoi, spotEdited.expdenoi); + assignFromKeyfile(keyFile, "Locallab", "noiselumf_" + std::to_string(i), pedited, spot.noiselumf, spotEdited.noiselumf); + assignFromKeyfile(keyFile, "Locallab", "noiselumc_" + std::to_string(i), pedited, spot.noiselumc, spotEdited.noiselumc); + assignFromKeyfile(keyFile, "Locallab", "noiselumdetail_" + std::to_string(i), pedited, spot.noiselumdetail, spotEdited.noiselumdetail); + assignFromKeyfile(keyFile, "Locallab", "noiselequal_" + std::to_string(i), pedited, spot.noiselequal, spotEdited.noiselequal); + assignFromKeyfile(keyFile, "Locallab", "noisechrof_" + std::to_string(i), pedited, spot.noisechrof, spotEdited.noisechrof); + assignFromKeyfile(keyFile, "Locallab", "noisechroc_" + std::to_string(i), pedited, spot.noisechroc, spotEdited.noisechroc); + assignFromKeyfile(keyFile, "Locallab", "noisechrodetail_" + std::to_string(i), pedited, spot.noisechrodetail, spotEdited.noisechrodetail); + assignFromKeyfile(keyFile, "Locallab", "Adjblur_" + std::to_string(i), pedited, spot.adjblur, spotEdited.adjblur); + assignFromKeyfile(keyFile, "Locallab", "Bilateral_" + std::to_string(i), pedited, spot.bilateral, spotEdited.bilateral); + assignFromKeyfile(keyFile, "Locallab", "Sensiden_" + std::to_string(i), pedited, spot.sensiden, spotEdited.sensiden); // Others - assignFromKeyfile(keyFile, "Locallab", "Avoid_" + std::to_string(i), pedited, spot.avoid, pedited->locallab.avoid); + assignFromKeyfile(keyFile, "Locallab", "Avoid_" + std::to_string(i), pedited, spot.avoid, spotEdited.avoid); locallab.spots.at(i) = spot; + + if (pedited) { + pedited->locallab.spots.at(i) = spotEdited; + } } } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 916668f38..48cb48490 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1030,54 +1030,6 @@ struct LocallabParams { bool operator ==(const LocallabParams& other) const; bool operator !=(const LocallabParams& other) const; - - template - bool compareSpotsByElem(const std::vector& other, T LocallabSpot::*elem) const - { - if (spots.size() != other.size()) { - return false; - } - - for (int i = 0; i < (int)spots.size(); i++) { - if (spots.at(i).*elem != other.at(i).*elem) { - return false; - } - } - - return true; - } - - template - bool compareSpotsByElemArray(const std::vector& other, T LocallabSpot::*elem, int index) const - { - if (spots.size() != other.size()) { - return false; - } - - for (int i = 0; i < (int)spots.size(); i++) { - if ((spots.at(i).*elem)[index] != (other.at(i).*elem)[index]) { - return false; - } - } - - return true; - } - - template - void setSpotsByElem(const std::vector& other, T LocallabSpot::*elem) - { - for (int i = 0; i < (int)spots.size() && i < (int)other.size(); i++) { - spots.at(i).*elem = other.at(i).*elem; - } - } - - template - void setSpotsByElemArray(const std::vector& other, T LocallabSpot::*elem, int index) - { - for (int i = 0; i < (int)spots.size() && i < (int)other.size(); i++) { - (spots.at(i).*elem)[index] = (other.at(i).*elem)[index]; - } - } }; /** diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 6d5c17753..1adbaa2de 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -57,7 +57,13 @@ void BatchToolPanelCoordinator::selectionChanged (const std::vector& void BatchToolPanelCoordinator::closeSession (bool save) { - pparamsEdited.set (false); + // Should remain commented for Locallab to work + // pparamsEdited.set (false); + printf("closeSession\n"); + printf("closeSession pedited %d\n", (int)pparamsEdited.locallab.spots.size()); + printf("closeSession pparams %d\n", (int)pparams.locallab.spots.size()); + printf("closeSession nbspot %d\n", (int)pparams.locallab.nbspot); + printf("closeSession pedited nbspot %d\n", pparamsEdited.locallab.nbspot); for (size_t i = 0; i < selected.size(); i++) { selected[i]->removeThumbnailListener (this); @@ -70,12 +76,18 @@ void BatchToolPanelCoordinator::closeSession (bool save) toolPanels[i]->write (&pparams, &pparamsEdited); } + printf("closeSession 2 pedited %d\n", (int)pparamsEdited.locallab.spots.size()); + printf("closeSession 2 pparams %d\n", (int)pparams.locallab.spots.size()); + printf("closeSession 2 nbspot %d\n", (int)pparams.locallab.nbspot); + printf("closeSession 2 pedited nbspot %d\n", pparamsEdited.locallab.nbspot); + // combine with initial parameters and set ProcParams newParams; for (size_t i = 0; i < selected.size(); i++) { newParams = initialPP[i]; pparamsEdited.combine (newParams, pparams, selected.size() == 1); + printf("newParams%d->nbspot %d, size %d\n", (int)i, newParams.locallab.nbspot, (int)newParams.locallab.spots.size()); // trim new adjuster's values to the adjuster's limits for (unsigned int j = 0; j < toolPanels.size(); j++) { @@ -383,6 +395,9 @@ void BatchToolPanelCoordinator::initSession () paramcListeners[i]->procParamsChanged (&pparams, rtengine::EvPhotoLoaded, M ("BATCH_PROCESSING"), &pparamsEdited); } } + + // ParamsEdited are set to false for initialization and is updated each time panel is changed (mandatory for Locallab) + pparamsEdited.set(false); } void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::ustring& descr) @@ -392,9 +407,12 @@ void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const G return; } + printf("panelChanged batch mode\n"); + somethingChanged = true; - pparamsEdited.set (false); + // Should remain commented for Locallab to work + // pparamsEdited.set (false); // read new values from the gui for (size_t i = 0; i < toolPanels.size(); i++) { @@ -554,6 +572,10 @@ void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const G for (size_t i = 0; i < paramcListeners.size(); i++) { paramcListeners[i]->procParamsChanged (&pparams, event, descr, &pparamsEdited); } + + printf("panel changed pedited %d\n", (int)pparamsEdited.locallab.spots.size()); + printf("panel changed pparams %d\n", (int)pparams.locallab.spots.size()); + printf("panel changed nbspot %d\n", (int)pparams.locallab.nbspot); } void BatchToolPanelCoordinator::getAutoWB (double& temp, double& green, double equal, double tempBias) diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 7e1c9662b..dd8982fe6 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -57,6 +57,9 @@ ControlSpotPanel::ControlSpotPanel(): lastObject_(-1), lastCoord_(new Coord()), + nbSpotChanged_(false), + selSpotChanged_(false), + nameChanged_(false), eventType(0) { @@ -221,15 +224,6 @@ ControlSpotPanel::ControlSpotPanel(): artifFrame->add(*artifBox); pack_start(*artifFrame); - // Set param widgets sensitive if there is at least one control spot - auto s = treeview_.get_selection(); - - if (!s->count_selected_rows()) { - setParamEditable(false); - } else { - setParamEditable(true); - } - show_all(); } @@ -279,6 +273,8 @@ void ControlSpotPanel::on_button_add() } // Raise event + nbSpotChanged_ = true; + selSpotChanged_ = true; eventType = 1; // 1 = Spot creation event const int newId = getNewId(); listener->panelChanged(EvLocallabSpotCreated, "ID#" + std::to_string(newId)); @@ -293,6 +289,8 @@ void ControlSpotPanel::on_button_delete() } // Raise event + nbSpotChanged_ = true; + selSpotChanged_ = true; eventType = 2; // 2 = Spot deletion event const int delId = getSelectedSpot(); listener->panelChanged(EvLocallabSpotDeleted, "ID#" + std::to_string(delId)); @@ -324,6 +322,7 @@ void ControlSpotPanel::on_button_rename() // Update actual name and raise event if (status == 1) { + nameChanged_ = true; const auto newname = d.get_new_name(); row[spots_.name] = newname; treeview_.columns_autosize(); @@ -372,6 +371,7 @@ void ControlSpotPanel::controlspotChanged() } // Raise event + selSpotChanged_ = true; eventType = 3; // 3 = Spot selection event const int selId = getSelectedSpot(); listener->panelChanged(EvLocallabSpotSelected, "ID#" + std::to_string(selId)); @@ -693,7 +693,8 @@ void ControlSpotPanel::disableParamlistener(bool cond) void ControlSpotPanel::setParamEditable(bool cond) { - printf("setParamEditable: %d\n", cond); + // printf("setParamEditable: %d\n", cond); + shape_->set_sensitive(cond); spotMethod_->set_sensitive(cond); sensiexclu_->set_sensitive(cond); @@ -1449,7 +1450,6 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot) row[spots_.transit] = newSpot->transit; row[spots_.thresh] = newSpot->thresh; row[spots_.iter] = newSpot->iter; - setParamEditable(true); updateParamVisibility(); disableParamlistener(false); @@ -1520,13 +1520,6 @@ void ControlSpotPanel::deleteControlSpot(int id) } } - // Set param widgets unsensitive if there is no more control spot - auto s = treeview_.get_selection(); - - if (!s->count_selected_rows()) { - setParamEditable(false); - } - disableParamlistener(false); } @@ -1536,10 +1529,27 @@ ControlSpotPanel::SpotEdited* ControlSpotPanel::getEditedStates() SpotEdited* se = new SpotEdited(); - se->treeview = treeview_.is_sensitive(); - se->addbutton = button_add_.is_sensitive(); - se->deletebutton = button_delete_.is_sensitive(); - se->name = button_rename_.is_sensitive(); + if (nbSpotChanged_) { + se->nbspot = true; + // nbSpotChanged_ = false; + } else { + se->nbspot = false; + } + + if (selSpotChanged_) { + se->selspot = true; + // selSpotChanged_ = false; + } else { + se->selspot = false; + } + + if (nameChanged_) { + se->name = true; + // nameChanged_ = false; + } else { + se->name = false; + } + se->isvisible = false; // TODO isvisible se->shape = shape_->get_active_row_number() != 2; se->spotMethod = spotMethod_->get_active_row_number() != 2; @@ -1565,14 +1575,26 @@ void ControlSpotPanel::setEditedStates(SpotEdited* se) { printf("setEditedStates\n"); + // Reset treeview edited states + nbSpotChanged_ = false; + selSpotChanged_ = false; + nameChanged_ = false; + // Disable params listeners disableParamlistener(true); // Set widgets edited states - treeview_.set_sensitive(se->treeview); - button_add_.set_sensitive(se->addbutton); - button_delete_.set_sensitive(se->deletebutton); - button_rename_.set_sensitive(se->name); + if (!se->nbspot || !se->selspot) { + treeview_.set_sensitive(false); + button_add_.set_sensitive(false); + button_delete_.set_sensitive(false); + button_rename_.set_sensitive(false); + } else { + treeview_.set_sensitive(true); + button_add_.set_sensitive(true); + button_delete_.set_sensitive(true); + button_rename_.set_sensitive(se->name); + } // TODO Add isvisible if (!se->shape) { @@ -1610,30 +1632,45 @@ void ControlSpotPanel::setEditedStates(SpotEdited* se) disableParamlistener(false); } -void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdited * pedited) +void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdited * pedited, int id) { - // Set default values for adjusters - if (defParams->locallab.selspot < (int)defParams->locallab.spots.size()) { - updateDefaultsValues(defParams, defParams->locallab.spots.at(defParams->locallab.selspot).id); - } else { - updateDefaultsValues(defParams); + // Find vector index of given spot id (index = -1 if not found) + int index = -1; + + for (int i = 0; i < (int)defParams->locallab.spots.size(); i++) { + printf("Test\n"); + + if (defParams->locallab.spots.at(i).id == id) { + index = i; + + break; + } } + printf("index: %d\n", index); + + // Set default values for adjusters + const LocallabParams::LocallabSpot* defSpot = new LocallabParams::LocallabSpot(); + + if (index != -1 && index < (int)defParams->locallab.spots.size()) { + defSpot = &defParams->locallab.spots.at(index); + } + + sensiexclu_->setDefault((double)defSpot->sensiexclu); + struc_->setDefault((double)defSpot->struc); + locX_->setDefault((double)defSpot->locX); + locXL_->setDefault((double)defSpot->locXL); + locY_->setDefault((double)defSpot->locY); + locYT_->setDefault((double)defSpot->locYT); + centerX_->setDefault((double)defSpot->centerX); + centerY_->setDefault((double)defSpot->centerY); + circrad_->setDefault((double)defSpot->circrad); + transit_->setDefault((double)defSpot->transit); + thresh_->setDefault((double)defSpot->thresh); + iter_->setDefault((double)defSpot->iter); + // Set default edited states for adjusters - if (pedited) { - sensiexclu_->setDefaultEditedState(pedited->locallab.sensiexclu ? Edited : UnEdited); - struc_->setDefaultEditedState(pedited->locallab.struc ? Edited : UnEdited); - locX_->setDefaultEditedState(pedited->locallab.locX ? Edited : UnEdited); - locXL_->setDefaultEditedState(pedited->locallab.locXL ? Edited : UnEdited); - locY_->setDefaultEditedState(pedited->locallab.locY ? Edited : UnEdited); - locYT_->setDefaultEditedState(pedited->locallab.locYT ? Edited : UnEdited); - centerX_->setDefaultEditedState(pedited->locallab.centerX ? Edited : UnEdited); - centerY_->setDefaultEditedState(pedited->locallab.centerY ? Edited : UnEdited); - circrad_->setDefaultEditedState(pedited->locallab.circrad ? Edited : UnEdited); - transit_->setDefaultEditedState(pedited->locallab.transit ? Edited : UnEdited); - thresh_->setDefaultEditedState(pedited->locallab.thresh ? Edited : UnEdited); - iter_->setDefaultEditedState(pedited->locallab.iter ? Edited : UnEdited); - } else { + if (!pedited) { sensiexclu_->setDefaultEditedState(Irrelevant); struc_->setDefaultEditedState(Irrelevant); locX_->setDefaultEditedState(Irrelevant); @@ -1646,9 +1683,29 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi transit_->setDefaultEditedState(Irrelevant); thresh_->setDefaultEditedState(Irrelevant); iter_->setDefaultEditedState(Irrelevant); + } else { + const LocallabParamsEdited::LocallabSpotEdited* defSpotState = new LocallabParamsEdited::LocallabSpotEdited(true); + + if (index != 1 && index < (int)pedited->locallab.spots.size()) { + defSpotState = &pedited->locallab.spots.at(index); + } + + sensiexclu_->setDefaultEditedState(defSpotState->sensiexclu ? Edited : UnEdited); + struc_->setDefaultEditedState(defSpotState->struc ? Edited : UnEdited); + locX_->setDefaultEditedState(defSpotState->locX ? Edited : UnEdited); + locXL_->setDefaultEditedState(defSpotState->locXL ? Edited : UnEdited); + locY_->setDefaultEditedState(defSpotState->locY ? Edited : UnEdited); + locYT_->setDefaultEditedState(defSpotState->locYT ? Edited : UnEdited); + centerX_->setDefaultEditedState(defSpotState->centerX ? Edited : UnEdited); + centerY_->setDefaultEditedState(defSpotState->centerY ? Edited : UnEdited); + circrad_->setDefaultEditedState(defSpotState->circrad ? Edited : UnEdited); + transit_->setDefaultEditedState(defSpotState->transit ? Edited : UnEdited); + thresh_->setDefaultEditedState(defSpotState->thresh ? Edited : UnEdited); + iter_->setDefaultEditedState(defSpotState->iter ? Edited : UnEdited); } } +/* void ControlSpotPanel::updateDefaultsValues(const rtengine::procparams::ProcParams* defParams, int id) { const LocallabParams::LocallabSpot* defSpot = new LocallabParams::LocallabSpot(); @@ -1676,6 +1733,30 @@ void ControlSpotPanel::updateDefaultsValues(const rtengine::procparams::ProcPara iter_->setDefault((double)defSpot->iter); } +void ControlSpotPanel::updateDefaultsStates(const ParamsEdited* pedited, int id = 0) +{ +} +*/ + +void ControlSpotPanel::setBatchMode(bool batchMode) +{ + ToolPanel::setBatchMode(batchMode); + + // Set batch mode for adjusters + sensiexclu_->showEditedCB(); + struc_->showEditedCB(); + locX_->showEditedCB(); + locXL_->showEditedCB(); + locY_->showEditedCB(); + locYT_->showEditedCB(); + centerX_->showEditedCB(); + centerY_->showEditedCB(); + circrad_->showEditedCB(); + transit_->showEditedCB(); + thresh_->showEditedCB(); + iter_->showEditedCB(); +} + //----------------------------------------------------------------------------- // ControlSpots //----------------------------------------------------------------------------- diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index eba5f40d6..b6ed14873 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -65,9 +65,8 @@ public: * A SpotEdited structure allows exchanges of spot panel widgets edited states from and to ControlSpotClass */ struct SpotEdited { - bool addbutton; - bool deletebutton; - bool treeview; + bool nbspot; + bool selspot; bool name; bool isvisible; bool shape; @@ -161,7 +160,7 @@ public: */ void deleteControlSpot(int id); - // Panel widgets edited states management functions + // Panel widgets management functions /** * Getter of panel widgets edited states * @@ -179,16 +178,37 @@ public: * * @param defParams ProcParams containing default values to set to the adjusters * @param pedited ParamsEdited containing default state values to set to the adjusters + * @param id Spot id to consider to update adjusters default values and default state values */ - void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr); - + void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr, int id = 0); /** * Variant of setDefaults function which only update adjuster default values * * @param defParams ProcParams containing default values to set to the adjusters * @param id Spot id to consider to update adjusters default values */ - void updateDefaultsValues(const rtengine::procparams::ProcParams* defParams, int id = 0); + // void updateDefaultsValues(const rtengine::procparams::ProcParams* defParams, int id = 0); + /** + * Variant of setDefaults function which only update adjuster default states + * + * @param pedited ParamsEdited containing default states to set to the adjusters + * @param id Spot id to consider to update adjusters default states + */ + // void updateDefaultsStates(const ParamsEdited* pedited, int id = 0); + /** + * Enable or disable the interactions with panel widgets + * + * @param cond Condition to enable interactions + */ + void setParamEditable(bool cond); + + // Batch mode management + /** + * Implementation of setBatchMode function of toolpanel.h + * + * @param batchMode Condition to enable batch mode + */ + void setBatchMode(bool batchMode); private: // Cell renderer @@ -213,7 +233,6 @@ private: void updateParamVisibility(); void adjusterChanged(Adjuster* a, double newval); void disableParamlistener(bool cond); - void setParamEditable(bool cond); void addControlSpotCurve(Gtk::TreeModel::Row row); void updateControlSpotCurve(Gtk::TreeModel::Row row); @@ -304,6 +323,9 @@ private: // Internal variables int lastObject_; rtengine::Coord* lastCoord_; + bool nbSpotChanged_; + bool selSpotChanged_; + bool nameChanged_; int eventType; // 0 = No event, 1 = Spot creation event, 2 = Spot deletion event, 3 = Spot selection event }; diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 392d12a2c..65b1f0602 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1768,6 +1768,7 @@ void EditorPanel::procParamsChanged (Thumbnail* thm, int whoChangedIt) PartialProfile pp (true); pp.set (true); * (pp.pparams) = openThm->getProcParams(); + pp.pedited->locallab.spots.resize(pp.pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); tpc->profileChange (&pp, rtengine::EvProfileChangeNotification, M ("PROGRESSDLG_PROFILECHANGEDINBROWSER")); pp.deleteInstance(); } diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index edd37f7dd..143646c51 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -1411,6 +1411,7 @@ void FileBrowser::applyPartialMenuItemActivated (ProfileStoreLabel *label) rtengine::procparams::PartialProfile dstProfile(true); *dstProfile.pparams = (static_cast(selected[i]))->thumbnail->getProcParams (); dstProfile.set(true); + dstProfile.pedited->locallab.spots.resize(dstProfile.pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); partialPasteDlg.applyPaste (dstProfile.pparams, dstProfile.pedited, srcProfiles->pparams, srcProfiles->pedited); (static_cast(selected[i]))->thumbnail->setProcParams (*dstProfile.pparams, dstProfile.pedited, FILEBROWSER); dstProfile.deleteInstance(); diff --git a/rtgui/history.cc b/rtgui/history.cc index ad88317e2..cea2f7452 100644 --- a/rtgui/history.cc +++ b/rtgui/history.cc @@ -182,8 +182,16 @@ void History::historySelectionChanged () if (row && tpc) { ProcParams pparams = row[historyColumns.params]; ParamsEdited pe (true); + pe.locallab.spots.resize(pparams.locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); PartialProfile pp (&pparams, &pe); ParamsEdited paramsEdited = row[historyColumns.paramsEdited]; + + printf("historySelectionChanged\n"); + printf("nbspot: %d %d\n", pp.pparams->locallab.nbspot, (int)pp.pparams->locallab.spots.size()); + for (size_t i = 0; i < pp.pparams->locallab.spots.size(); i++) { + printf("id_%d = %d\n", (int)i, pp.pparams->locallab.spots.at(i).id); + } + tpc->profileChange (&pp, EvHistoryBrowsed, row[historyColumns.text], ¶msEdited); } @@ -215,6 +223,7 @@ void History::bookmarkSelectionChanged () if (row && tpc) { ProcParams pparams = row[bookmarkColumns.params]; ParamsEdited pe (true); + pe.locallab.spots.resize(pparams.locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); PartialProfile pp (&pparams, &pe); ParamsEdited paramsEdited = row[bookmarkColumns.paramsEdited]; tpc->profileChange (&pp, EvBookmarkSelected, row[bookmarkColumns.text], ¶msEdited); diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 3d2b7e961..8067c2636 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -155,7 +155,12 @@ Locallab::Locallab(): labqualcurv(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_QUALCURV_METHOD") + ":"))), lumacontrastMinusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_MINUS")))), lumaneutralButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMANEUTRAL")))), - lumacontrastPlusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_PLUS")))) + lumacontrastPlusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_PLUS")))), + + // Others + defparams(nullptr), + defpedited(nullptr), + pe(nullptr) { ToolVBox* const panel = Gtk::manage(new ToolVBox()); @@ -608,6 +613,9 @@ Locallab::Locallab(): panel->pack_start(*avoid); pack_start(*panel); + + setParamEditable(false); + show_all(); } @@ -758,149 +766,151 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) if (pedited) { set_inconsistent(multiImage && !pedited->locallab.enabled); - // Control spot settings - ControlSpotPanel::SpotEdited* const se = new ControlSpotPanel::SpotEdited(); + if (pp->locallab.selspot < pp->locallab.nbspot && pp->locallab.selspot < (int)pedited->locallab.spots.size()) { + const LocallabParamsEdited::LocallabSpotEdited* spotState = &pedited->locallab.spots.at(pp->locallab.selspot); - if (pedited->locallab.nbspot) { - se->addbutton = true; - se->deletebutton = true; - } else { - se->addbutton = false; - se->deletebutton = false; + // Control spot settings + ControlSpotPanel::SpotEdited* const se = new ControlSpotPanel::SpotEdited(); + + if (pedited->locallab.nbspot && pedited->locallab.id) { + se->nbspot = true; + } else { + se->nbspot = false; + } + + se->selspot = pedited->locallab.selspot; + se->name = spotState->name; + se->isvisible = spotState->isvisible; + se->shape = spotState->shape; + se->spotMethod = spotState->spotMethod; + se->sensiexclu = spotState->sensiexclu; + se->struc = spotState->struc; + se->shapeMethod = spotState->shapeMethod; + se->locX = spotState->locX; + se->locXL = spotState->locXL; + se->locY = spotState->locY; + se->locYT = spotState->locYT; + se->centerX = spotState->centerX; + se->centerY = spotState->centerY; + se->circrad = spotState->circrad; + se->qualityMethod = spotState->qualityMethod; + se->transit = spotState->transit; + se->thresh = spotState->thresh; + se->iter = spotState->iter; + expsettings->setEditedStates(se); + + // Color & Light + expcolor->set_inconsistent(!spotState->expcolor); + curvactiv->set_inconsistent(multiImage && !spotState->curvactiv); + lightness->setEditedState(spotState->lightness ? Edited : UnEdited); + contrast->setEditedState(spotState->contrast ? Edited : UnEdited); + chroma->setEditedState(spotState->chroma ? Edited : UnEdited); + sensi->setEditedState(spotState->sensi ? Edited : UnEdited); + + if (!spotState->qualitycurveMethod) { + qualitycurveMethod->set_active_text(M("GENERAL_UNCHANGED")); + } + + llshape->setUnChanged(!spotState->llcurve); + ccshape->setUnChanged(!spotState->cccurve); + LHshape->setUnChanged(!spotState->LHcurve); + HHshape->setUnChanged(!spotState->HHcurve); + invers->set_inconsistent(multiImage && !spotState->invers); + + // Exposure + expexpose->set_inconsistent(!spotState->expexpose); + expcomp->setEditedState(spotState->expcomp ? Edited : UnEdited); + hlcompr->setEditedState(spotState->hlcompr ? Edited : UnEdited); + hlcomprthresh->setEditedState(spotState->hlcomprthresh ? Edited : UnEdited); + black->setEditedState(spotState->black ? Edited : UnEdited); + warm->setEditedState(spotState->warm ? Edited : UnEdited); + shcompr->setEditedState(spotState->shcompr ? Edited : UnEdited); + sensiex->setEditedState(spotState->sensiex ? Edited : UnEdited); + shapeexpos->setUnChanged(!spotState->excurve); + + // Vibrance + expvibrance->set_inconsistent(!spotState->expvibrance); + saturated->setEditedState(spotState->saturated ? Edited : UnEdited); + pastels->setEditedState(spotState->pastels ? Edited : UnEdited); + psThreshold->setEditedState(spotState->psthreshold ? Edited : UnEdited); + protectSkins->set_inconsistent(multiImage && !spotState->protectskins); + avoidColorShift->set_inconsistent(multiImage && !spotState->avoidcolorshift); + pastSatTog->set_inconsistent(multiImage && !spotState->pastsattog); + sensiv->setEditedState(spotState->sensiv ? Edited : UnEdited); + skinTonesCurve->setUnChanged(!spotState->skintonescurve); + + // Blur & Noise + expblur->set_inconsistent(!spotState->expblur); + radius->setEditedState(spotState->radius ? Edited : UnEdited); + strength->setEditedState(spotState->strength ? Edited : UnEdited); + sensibn->setEditedState(spotState->sensibn ? Edited : UnEdited); + + if (!spotState->blurMethod) { + blurMethod->set_active_text(M("GENERAL_UNCHANGED")); + } + + activlum->set_inconsistent(multiImage && !spotState->activlum); + + // Tone Mapping + exptonemap->set_inconsistent(!spotState->exptonemap); + stren->setEditedState(spotState->stren ? Edited : UnEdited); + gamma->setEditedState(spotState->gamma ? Edited : UnEdited); + estop->setEditedState(spotState->estop ? Edited : UnEdited); + scaltm->setEditedState(spotState->scaltm ? Edited : UnEdited); + rewei->setEditedState(spotState->rewei ? Edited : UnEdited); + sensitm->setEditedState(spotState->sensitm ? Edited : UnEdited); + + // Retinex + expreti->set_inconsistent(!spotState->expreti); + + if (!spotState->retinexMethod) { + retinexMethod->set_active_text(M("GENERAL_UNCHANGED")); + } + + str->setEditedState(spotState->str ? Edited : UnEdited); + chrrt->setEditedState(spotState->chrrt ? Edited : UnEdited); + neigh->setEditedState(spotState->neigh ? Edited : UnEdited); + vart->setEditedState(spotState->vart ? Edited : UnEdited); + sensih->setEditedState(spotState->sensih ? Edited : UnEdited); + cTgainshape->setUnChanged(!spotState->localTgaincurve); + inversret->set_inconsistent(multiImage && !spotState->inversret); + + // Sharpening + expsharp->set_inconsistent(!spotState->expsharp); + sharradius->setEditedState(spotState->sharradius ? Edited : UnEdited); + sharamount->setEditedState(spotState->sharamount ? Edited : UnEdited); + shardamping->setEditedState(spotState->shardamping ? Edited : UnEdited); + shariter->setEditedState(spotState->shariter ? Edited : UnEdited); + sensisha->setEditedState(spotState->sensisha ? Edited : UnEdited); + inverssha->set_inconsistent(multiImage && !spotState->inverssha); + + // Contrast by detail levels + expcbdl->set_inconsistent(!spotState->expcbdl); + + for (int i = 0; i < 5; i++) { + multiplier[i]->setEditedState(spotState->mult[i] ? Edited : UnEdited); + } + + chromacbdl->setEditedState(spotState->chromacbdl ? Edited : UnEdited); + threshold->setEditedState(spotState->threshold ? Edited : UnEdited); + sensicb->setEditedState(spotState->sensicb ? Edited : UnEdited); + + // Denoise + expdenoi->set_inconsistent(!spotState->expdenoi); + noiselumf->setEditedState(spotState->noiselumf ? Edited : UnEdited); + noiselumc->setEditedState(spotState->noiselumc ? Edited : UnEdited); + noiselumdetail->setEditedState(spotState->noiselumdetail ? Edited : UnEdited); + noiselequal->setEditedState(spotState->noiselequal ? Edited : UnEdited); + noisechrof->setEditedState(spotState->noisechrof ? Edited : UnEdited); + noisechroc->setEditedState(spotState->noisechroc ? Edited : UnEdited); + noisechrodetail->setEditedState(spotState->noisechrodetail ? Edited : UnEdited); + adjblur->setEditedState(spotState->adjblur ? Edited : UnEdited); + bilateral->setEditedState(spotState->bilateral ? Edited : UnEdited); + sensiden->setEditedState(spotState->sensiden ? Edited : UnEdited); + + // Others + avoid->set_inconsistent(multiImage && !spotState->avoid); } - - se->treeview = pedited->locallab.nbspot || pedited->locallab.selspot; - se->name = pedited->locallab.name; - se->isvisible = pedited->locallab.isvisible; - se->shape = pedited->locallab.shape; - se->spotMethod = pedited->locallab.spotMethod; - se->sensiexclu = pedited->locallab.sensiexclu; - se->struc = pedited->locallab.struc; - se->shapeMethod = pedited->locallab.shapeMethod; - se->locX = pedited->locallab.locX; - se->locXL = pedited->locallab.locXL; - se->locY = pedited->locallab.locY; - se->locYT = pedited->locallab.locYT; - se->centerX = pedited->locallab.centerX; - se->centerY = pedited->locallab.centerY; - se->circrad = pedited->locallab.circrad; - se->qualityMethod = pedited->locallab.qualityMethod; - se->transit = pedited->locallab.transit; - se->thresh = pedited->locallab.thresh; - se->iter = pedited->locallab.iter; - expsettings->setEditedStates(se); - - // Color & Light - expcolor->set_inconsistent(!pedited->locallab.expcolor); - curvactiv->set_inconsistent(multiImage && !pedited->locallab.curvactiv); - lightness->setEditedState(pedited->locallab.lightness ? Edited : UnEdited); - contrast->setEditedState(pedited->locallab.contrast ? Edited : UnEdited); - chroma->setEditedState(pedited->locallab.chroma ? Edited : UnEdited); - sensi->setEditedState(pedited->locallab.sensi ? Edited : UnEdited); - - if (!pedited->locallab.qualitycurveMethod) { - qualitycurveMethod->set_active_text(M("GENERAL_UNCHANGED")); - } - - llshape->setUnChanged(!pedited->locallab.llcurve); - ccshape->setUnChanged(!pedited->locallab.cccurve); - LHshape->setUnChanged(!pedited->locallab.LHcurve); - HHshape->setUnChanged(!pedited->locallab.HHcurve); - invers->set_inconsistent(multiImage && !pedited->locallab.invers); - - // Exposure - expexpose->set_inconsistent(!pedited->locallab.expexpose); - expcomp->setEditedState(pedited->locallab.expcomp ? Edited : UnEdited); - hlcompr->setEditedState(pedited->locallab.hlcompr ? Edited : UnEdited); - hlcomprthresh->setEditedState(pedited->locallab.hlcomprthresh ? Edited : UnEdited); - black->setEditedState(pedited->locallab.black ? Edited : UnEdited); - warm->setEditedState(pedited->locallab.warm ? Edited : UnEdited); - shcompr->setEditedState(pedited->locallab.shcompr ? Edited : UnEdited); - sensiex->setEditedState(pedited->locallab.sensiex ? Edited : UnEdited); - shapeexpos->setUnChanged(!pedited->locallab.excurve); - - // Vibrance - expvibrance->set_inconsistent(!pedited->locallab.expvibrance); - saturated->setEditedState(pedited->locallab.saturated ? Edited : UnEdited); - pastels->setEditedState(pedited->locallab.pastels ? Edited : UnEdited); - psThreshold->setEditedState(pedited->locallab.psthreshold ? Edited : UnEdited); - protectSkins->set_inconsistent(!pedited->locallab.protectskins); - avoidColorShift->set_inconsistent(!pedited->locallab.avoidcolorshift); - pastSatTog->set_inconsistent(!pedited->locallab.pastsattog); - sensiv->setEditedState(pedited->locallab.sensiv ? Edited : UnEdited); - skinTonesCurve->setUnChanged(!pedited->locallab.skintonescurve); - - // Blur & Noise - expblur->set_inconsistent(!pedited->locallab.expblur); - radius->setEditedState(pedited->locallab.radius ? Edited : UnEdited); - strength->setEditedState(pedited->locallab.strength ? Edited : UnEdited); - sensibn->setEditedState(pedited->locallab.sensibn ? Edited : UnEdited); - - if (!pedited->locallab.blurMethod) { - blurMethod->set_active_text(M("GENERAL_UNCHANGED")); - } - - activlum->set_inconsistent(multiImage && !pedited->locallab.activlum); - - // Tone Mapping - exptonemap->set_inconsistent(!pedited->locallab.exptonemap); - stren->setEditedState(pedited->locallab.stren ? Edited : UnEdited); - gamma->setEditedState(pedited->locallab.gamma ? Edited : UnEdited); - estop->setEditedState(pedited->locallab.estop ? Edited : UnEdited); - scaltm->setEditedState(pedited->locallab.scaltm ? Edited : UnEdited); - rewei->setEditedState(pedited->locallab.rewei ? Edited : UnEdited); - sensitm->setEditedState(pedited->locallab.sensitm ? Edited : UnEdited); - - // Retinex - expreti->set_inconsistent(!pedited->locallab.expreti); - - if (!pedited->locallab.retinexMethod) { - retinexMethod->set_active_text(M("GENERAL_UNCHANGED")); - } - - str->setEditedState(pedited->locallab.str ? Edited : UnEdited); - chrrt->setEditedState(pedited->locallab.chrrt ? Edited : UnEdited); - neigh->setEditedState(pedited->locallab.neigh ? Edited : UnEdited); - vart->setEditedState(pedited->locallab.vart ? Edited : UnEdited); - sensih->setEditedState(pedited->locallab.sensih ? Edited : UnEdited); - cTgainshape->setUnChanged(!pedited->locallab.localTgaincurve); - inversret->set_inconsistent(multiImage && !pedited->locallab.inversret); - - // Sharpening - expsharp->set_inconsistent(!pedited->locallab.expsharp); - sharradius->setEditedState(pedited->locallab.sharradius ? Edited : UnEdited); - sharamount->setEditedState(pedited->locallab.sharamount ? Edited : UnEdited); - shardamping->setEditedState(pedited->locallab.shardamping ? Edited : UnEdited); - shariter->setEditedState(pedited->locallab.shariter ? Edited : UnEdited); - sensisha->setEditedState(pedited->locallab.sensisha ? Edited : UnEdited); - inverssha->set_inconsistent(multiImage && !pedited->locallab.inverssha); - - // Contrast by detail levels - expcbdl->set_inconsistent(!pedited->locallab.expcbdl); - - for (int i = 0; i < 5; i++) { - multiplier[i]->setEditedState(pedited->locallab.mult[i] ? Edited : UnEdited); - } - - chromacbdl->setEditedState(pedited->locallab.chromacbdl ? Edited : UnEdited); - threshold->setEditedState(pedited->locallab.threshold ? Edited : UnEdited); - sensicb->setEditedState(pedited->locallab.sensicb ? Edited : UnEdited); - - // Denoise - expdenoi->set_inconsistent(!pedited->locallab.expdenoi); - noiselumf->setEditedState(pedited->locallab.noiselumf ? Edited : UnEdited); - noiselumc->setEditedState(pedited->locallab.noiselumc ? Edited : UnEdited); - noiselumdetail->setEditedState(pedited->locallab.noiselumdetail ? Edited : UnEdited); - noiselequal->setEditedState(pedited->locallab.noiselequal ? Edited : UnEdited); - noisechrof->setEditedState(pedited->locallab.noisechrof ? Edited : UnEdited); - noisechroc->setEditedState(pedited->locallab.noisechroc ? Edited : UnEdited); - noisechrodetail->setEditedState(pedited->locallab.noisechrodetail ? Edited : UnEdited); - adjblur->setEditedState(pedited->locallab.adjblur ? Edited : UnEdited); - bilateral->setEditedState(pedited->locallab.bilateral ? Edited : UnEdited); - sensiden->setEditedState(pedited->locallab.sensiden ? Edited : UnEdited); - - // Others - avoid->set_inconsistent(multiImage && !pedited->locallab.avoid); } setEnabled(pp->locallab.enabled); @@ -988,18 +998,27 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) } // Update Locallab tools GUI - updateLocallabGUI(pp, pp->locallab.selspot); + updateLocallabGUI(pp, nullptr, pp->locallab.selspot); + + if (pp->locallab.nbspot > 0) { + setParamEditable(true); + + // Locallab params are not editable if nbspot, selspot or id are not coherent (batch mode) + if (pedited) { + if (!pedited->locallab.nbspot || !pedited->locallab.selspot || !pedited->locallab.id) { + setParamEditable(false); + } + } + } else { + setParamEditable(false); + } // Enable all listeners enableListener(); // Update default values according to selected spot - if (pp->locallab.nbspot > 0) { - expsettings->updateDefaultsValues(defparams, pp->locallab.spots.at(pp->locallab.selspot).id); - updateDefaultsValues(defparams, pp->locallab.spots.at(pp->locallab.selspot).id); - } else { - expsettings->updateDefaultsValues(defparams); - updateDefaultsValues(defparams); + if (pp->locallab.nbspot > 0 && pp->locallab.selspot < (int)pp->locallab.spots.size()) { + setDefaults(defparams, defpedited, pp->locallab.spots.at(pp->locallab.selspot).id); } } @@ -1080,12 +1099,29 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) // Update Locallab tools GUI with new created spot disableListener(); - updateLocallabGUI(pp, pp->locallab.selspot); + + if (pe) { + pe->locallab.spots.push_back(new LocallabParamsEdited::LocallabSpotEdited(true)); + } + + updateLocallabGUI(pp, pe, pp->locallab.selspot); + enableListener(); + if (pp->locallab.nbspot == 1) { + setParamEditable(true); + } + // Update default values according to selected spot - expsettings->updateDefaultsValues(defparams, spotId); - updateDefaultsValues(defparams, spotId); + setDefaults(defparams, defpedited, spotId); + + // ParamsEdited update + if (pedited) { + pedited->locallab.nbspot = true; + pedited->locallab.selspot = true; + pedited->locallab.id = true; + pedited->locallab.spots.push_back(new LocallabParamsEdited::LocallabSpotEdited(true)); + } break; @@ -1108,18 +1144,39 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) // Update Locallab tools GUI with new created spot disableListener(); - updateLocallabGUI(pp, pp->locallab.selspot); + + if (pe) { + if (i < (int)pe->locallab.spots.size()) { + pe->locallab.spots.erase(pe->locallab.spots.begin() + i); + } + } + + updateLocallabGUI(pp, pe, pp->locallab.selspot); + enableListener(); + if (pp->locallab.nbspot == 0) { + setParamEditable(false); + } + // Update default values according to selected spot if (pp->locallab.nbspot > 0) { - expsettings->updateDefaultsValues(defparams, pp->locallab.spots.at(pp->locallab.selspot).id); - updateDefaultsValues(defparams, pp->locallab.spots.at(pp->locallab.selspot).id); - } else { - expsettings->updateDefaultsValues(defparams); - updateDefaultsValues(defparams); + setDefaults(defparams, defpedited, pp->locallab.spots.at(pp->locallab.selspot).id); } + // ParamsEdited update + if (pedited) { + pedited->locallab.nbspot = true; + pedited->locallab.selspot = true; + pedited->locallab.id = true; + + if (i < (int)pedited->locallab.spots.size()) { + pedited->locallab.spots.erase(pedited->locallab.spots.begin() + i); + } + } + + printf("size after deletion %d\n", (int)pp->locallab.spots.size()); + break; } } @@ -1139,12 +1196,16 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) // Update control spots and Locallab tools GUI with selected spot expsettings->setSelectedSpot(spotId); disableListener(); - updateLocallabGUI(pp, pp->locallab.selspot); + updateLocallabGUI(pp, pe, pp->locallab.selspot); enableListener(); // Update default values according to selected spot - expsettings->updateDefaultsValues(defparams, spotId); - updateDefaultsValues(defparams, spotId); + setDefaults(defparams, defpedited, spotId); + + // ParamsEdited update + if (pedited) { + pedited->locallab.selspot = true; + } break; @@ -1317,6 +1378,243 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) // Others pp->locallab.spots.at(pp->locallab.selspot).avoid = avoid->get_active(); } + + ControlSpotPanel::SpotEdited* const se = expsettings->getEditedStates(); + + if (pe) { + if (pp->locallab.selspot < (int)pe->locallab.spots.size()) { + pe->locallab.spots.at(pp->locallab.selspot).name = pe->locallab.spots.at(pp->locallab.selspot).name || se->name; + pe->locallab.spots.at(pp->locallab.selspot).isvisible = pe->locallab.spots.at(pp->locallab.selspot).isvisible || se->isvisible; + pe->locallab.spots.at(pp->locallab.selspot).shape = pe->locallab.spots.at(pp->locallab.selspot).shape || se->shape; + pe->locallab.spots.at(pp->locallab.selspot).spotMethod = pe->locallab.spots.at(pp->locallab.selspot).spotMethod || se->spotMethod; + pe->locallab.spots.at(pp->locallab.selspot).sensiexclu = pe->locallab.spots.at(pp->locallab.selspot).sensiexclu || se->sensiexclu; + pe->locallab.spots.at(pp->locallab.selspot).struc = pe->locallab.spots.at(pp->locallab.selspot).struc || se->struc; + pe->locallab.spots.at(pp->locallab.selspot).shapeMethod = pe->locallab.spots.at(pp->locallab.selspot).shapeMethod || se->shapeMethod; + pe->locallab.spots.at(pp->locallab.selspot).locX = pe->locallab.spots.at(pp->locallab.selspot).locX || se->locX; + pe->locallab.spots.at(pp->locallab.selspot).locXL = pe->locallab.spots.at(pp->locallab.selspot).locXL || se->locXL; + pe->locallab.spots.at(pp->locallab.selspot).locY = pe->locallab.spots.at(pp->locallab.selspot).locY || se->locY; + pe->locallab.spots.at(pp->locallab.selspot).locYT = pe->locallab.spots.at(pp->locallab.selspot).locYT || se->locYT; + pe->locallab.spots.at(pp->locallab.selspot).centerX = pe->locallab.spots.at(pp->locallab.selspot).centerX || se->centerX; + pe->locallab.spots.at(pp->locallab.selspot).centerY = pe->locallab.spots.at(pp->locallab.selspot).centerY || se->centerY; + pe->locallab.spots.at(pp->locallab.selspot).circrad = pe->locallab.spots.at(pp->locallab.selspot).circrad || se->circrad; + pe->locallab.spots.at(pp->locallab.selspot).qualityMethod = pe->locallab.spots.at(pp->locallab.selspot).qualityMethod || se->qualityMethod; + pe->locallab.spots.at(pp->locallab.selspot).transit = pe->locallab.spots.at(pp->locallab.selspot).transit || se->transit; + pe->locallab.spots.at(pp->locallab.selspot).thresh = pe->locallab.spots.at(pp->locallab.selspot).thresh || se->thresh; + pe->locallab.spots.at(pp->locallab.selspot).iter = pe->locallab.spots.at(pp->locallab.selspot).iter || se->iter; + // Color & Light + pe->locallab.spots.at(pp->locallab.selspot).expcolor = pe->locallab.spots.at(pp->locallab.selspot).expcolor || !expcolor->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).curvactiv = pe->locallab.spots.at(pp->locallab.selspot).curvactiv || !curvactiv->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).lightness = pe->locallab.spots.at(pp->locallab.selspot).lightness || lightness->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).contrast = pe->locallab.spots.at(pp->locallab.selspot).contrast || contrast->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).chroma = pe->locallab.spots.at(pp->locallab.selspot).chroma || chroma->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sensi = pe->locallab.spots.at(pp->locallab.selspot).sensi || sensi->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod = pe->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod || qualitycurveMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pe->locallab.spots.at(pp->locallab.selspot).llcurve = pe->locallab.spots.at(pp->locallab.selspot).llcurve || !llshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).cccurve = pe->locallab.spots.at(pp->locallab.selspot).cccurve || !ccshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).LHcurve = pe->locallab.spots.at(pp->locallab.selspot).LHcurve || !LHshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).HHcurve = pe->locallab.spots.at(pp->locallab.selspot).HHcurve || !HHshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).invers = pe->locallab.spots.at(pp->locallab.selspot).invers || !invers->get_inconsistent(); + // Exposure + pe->locallab.spots.at(pp->locallab.selspot).expexpose = pe->locallab.spots.at(pp->locallab.selspot).expexpose || !expexpose->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).expcomp = pe->locallab.spots.at(pp->locallab.selspot).expcomp || expcomp->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).hlcompr = pe->locallab.spots.at(pp->locallab.selspot).hlcompr || hlcompr->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).hlcomprthresh = pe->locallab.spots.at(pp->locallab.selspot).hlcomprthresh || hlcomprthresh->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).black = pe->locallab.spots.at(pp->locallab.selspot).black || black->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).shcompr = pe->locallab.spots.at(pp->locallab.selspot).shcompr || shcompr->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).warm = pe->locallab.spots.at(pp->locallab.selspot).warm || warm->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sensiex = pe->locallab.spots.at(pp->locallab.selspot).sensiex || sensiex->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).excurve = pe->locallab.spots.at(pp->locallab.selspot).excurve || !shapeexpos->isUnChanged(); + // Vibrance + pe->locallab.spots.at(pp->locallab.selspot).expvibrance = pe->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).saturated = pe->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).pastels = pe->locallab.spots.at(pp->locallab.selspot).pastels || pastels->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).psthreshold = pe->locallab.spots.at(pp->locallab.selspot).psthreshold || psThreshold->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).protectskins = pe->locallab.spots.at(pp->locallab.selspot).protectskins || !protectSkins->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).avoidcolorshift = pe->locallab.spots.at(pp->locallab.selspot).avoidcolorshift || !avoidColorShift->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).pastsattog = pe->locallab.spots.at(pp->locallab.selspot).pastsattog || !pastSatTog->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).sensiv = pe->locallab.spots.at(pp->locallab.selspot).sensiv || sensiv->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).skintonescurve = pe->locallab.spots.at(pp->locallab.selspot).skintonescurve || !skinTonesCurve->isUnChanged(); + // Blur & Noise + pe->locallab.spots.at(pp->locallab.selspot).expblur = pe->locallab.spots.at(pp->locallab.selspot).expblur || !expblur->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).radius = pe->locallab.spots.at(pp->locallab.selspot).radius || radius->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).strength = pe->locallab.spots.at(pp->locallab.selspot).strength || strength->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sensibn = pe->locallab.spots.at(pp->locallab.selspot).sensibn || sensibn->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).blurMethod = pe->locallab.spots.at(pp->locallab.selspot).blurMethod || blurMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pe->locallab.spots.at(pp->locallab.selspot).activlum = pe->locallab.spots.at(pp->locallab.selspot).activlum || !activlum->get_inconsistent(); + // Tone Mapping + pe->locallab.spots.at(pp->locallab.selspot).exptonemap = pe->locallab.spots.at(pp->locallab.selspot).activlum || !exptonemap->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).stren = pe->locallab.spots.at(pp->locallab.selspot).stren || stren->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).gamma = pe->locallab.spots.at(pp->locallab.selspot).gamma || gamma->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).estop = pe->locallab.spots.at(pp->locallab.selspot).estop || estop->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).scaltm = pe->locallab.spots.at(pp->locallab.selspot).scaltm || scaltm->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).rewei = pe->locallab.spots.at(pp->locallab.selspot).rewei || rewei->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sensitm = pe->locallab.spots.at(pp->locallab.selspot).sensitm || sensitm->getEditedState(); + // Retinex + pe->locallab.spots.at(pp->locallab.selspot).expreti = pe->locallab.spots.at(pp->locallab.selspot).expreti || !expreti->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).retinexMethod = pe->locallab.spots.at(pp->locallab.selspot).retinexMethod || retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pe->locallab.spots.at(pp->locallab.selspot).str = pe->locallab.spots.at(pp->locallab.selspot).str || str->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).chrrt = pe->locallab.spots.at(pp->locallab.selspot).chrrt || chrrt->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).neigh = pe->locallab.spots.at(pp->locallab.selspot).neigh || neigh->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).vart = pe->locallab.spots.at(pp->locallab.selspot).vart || vart->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sensih = pe->locallab.spots.at(pp->locallab.selspot).sensih || sensih->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).localTgaincurve = pe->locallab.spots.at(pp->locallab.selspot).localTgaincurve || !cTgainshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).inversret = pe->locallab.spots.at(pp->locallab.selspot).inversret || !inversret->get_inconsistent(); + // Sharpening + pe->locallab.spots.at(pp->locallab.selspot).expsharp = pe->locallab.spots.at(pp->locallab.selspot).expsharp || !expsharp->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).sharradius = pe->locallab.spots.at(pp->locallab.selspot).sharradius || sharradius->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sharamount = pe->locallab.spots.at(pp->locallab.selspot).sharamount || sharamount->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).shardamping = pe->locallab.spots.at(pp->locallab.selspot).shardamping || shardamping->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).shariter = pe->locallab.spots.at(pp->locallab.selspot).shariter || shariter->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sensisha = pe->locallab.spots.at(pp->locallab.selspot).sensisha || sensisha->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).inverssha = pe->locallab.spots.at(pp->locallab.selspot).inverssha || !inverssha->get_inconsistent(); + // Contrast by detail levels + pe->locallab.spots.at(pp->locallab.selspot).expcbdl = pe->locallab.spots.at(pp->locallab.selspot).expcbdl || !expcbdl->get_inconsistent(); + + for (int i = 0; i < 5; i++) { + pe->locallab.spots.at(pp->locallab.selspot).mult[i] = pe->locallab.spots.at(pp->locallab.selspot).mult[i] || multiplier[i]->getEditedState(); + } + + pe->locallab.spots.at(pp->locallab.selspot).chromacbdl = pe->locallab.spots.at(pp->locallab.selspot).chromacbdl || chromacbdl->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).threshold = pe->locallab.spots.at(pp->locallab.selspot).threshold || threshold->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sensicb = pe->locallab.spots.at(pp->locallab.selspot).sensicb || sensicb->getEditedState(); + // Denoise + pe->locallab.spots.at(pp->locallab.selspot).expdenoi = pe->locallab.spots.at(pp->locallab.selspot).expdenoi || !expdenoi->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).noiselumf = pe->locallab.spots.at(pp->locallab.selspot).noiselumf || noiselumf->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).noiselumc = pe->locallab.spots.at(pp->locallab.selspot).noiselumc || noiselumc->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).noiselumdetail = pe->locallab.spots.at(pp->locallab.selspot).noiselumdetail || noiselumdetail->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).noiselequal = pe->locallab.spots.at(pp->locallab.selspot).noiselequal || noiselequal->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).noisechrof = pe->locallab.spots.at(pp->locallab.selspot).noisechrof || noisechrof->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).noisechroc = pe->locallab.spots.at(pp->locallab.selspot).noisechroc || noisechroc->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).noisechrodetail = pe->locallab.spots.at(pp->locallab.selspot).noisechrodetail || noisechrodetail->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).adjblur = pe->locallab.spots.at(pp->locallab.selspot).adjblur || adjblur->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).bilateral = pe->locallab.spots.at(pp->locallab.selspot).bilateral || bilateral->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).sensiden = pe->locallab.spots.at(pp->locallab.selspot).sensiden || sensiden->getEditedState(); + // Others + pe->locallab.spots.at(pp->locallab.selspot).avoid = pe->locallab.spots.at(pp->locallab.selspot).avoid || !avoid->get_inconsistent(); + } + } + + // ParamsEdited update + if (pedited) { + pedited->locallab.enabled = pedited->locallab.enabled || !get_inconsistent(); + + if (pp->locallab.selspot < (int)pedited->locallab.spots.size()) { + // Control spot settings + /* + pedited->locallab.nbspot = se->nbspot; + pedited->locallab.selspot = se->selspot; + pedited->locallab.id = se->nbspot; + */ + pedited->locallab.spots.at(pp->locallab.selspot).name = pedited->locallab.spots.at(pp->locallab.selspot).name || se->name; + pedited->locallab.spots.at(pp->locallab.selspot).isvisible = pedited->locallab.spots.at(pp->locallab.selspot).isvisible || se->isvisible; + pedited->locallab.spots.at(pp->locallab.selspot).shape = pedited->locallab.spots.at(pp->locallab.selspot).shape || se->shape; + pedited->locallab.spots.at(pp->locallab.selspot).spotMethod = pedited->locallab.spots.at(pp->locallab.selspot).spotMethod || se->spotMethod; + pedited->locallab.spots.at(pp->locallab.selspot).sensiexclu = pedited->locallab.spots.at(pp->locallab.selspot).sensiexclu || se->sensiexclu; + pedited->locallab.spots.at(pp->locallab.selspot).struc = pedited->locallab.spots.at(pp->locallab.selspot).struc || se->struc; + pedited->locallab.spots.at(pp->locallab.selspot).shapeMethod = pedited->locallab.spots.at(pp->locallab.selspot).shapeMethod || se->shapeMethod; + pedited->locallab.spots.at(pp->locallab.selspot).locX = pedited->locallab.spots.at(pp->locallab.selspot).locX || se->locX; + pedited->locallab.spots.at(pp->locallab.selspot).locXL = pedited->locallab.spots.at(pp->locallab.selspot).locXL || se->locXL; + pedited->locallab.spots.at(pp->locallab.selspot).locY = pedited->locallab.spots.at(pp->locallab.selspot).locY || se->locY; + pedited->locallab.spots.at(pp->locallab.selspot).locYT = pedited->locallab.spots.at(pp->locallab.selspot).locYT || se->locYT; + pedited->locallab.spots.at(pp->locallab.selspot).centerX = pedited->locallab.spots.at(pp->locallab.selspot).centerX || se->centerX; + pedited->locallab.spots.at(pp->locallab.selspot).centerY = pedited->locallab.spots.at(pp->locallab.selspot).centerY || se->centerY; + pedited->locallab.spots.at(pp->locallab.selspot).circrad = pedited->locallab.spots.at(pp->locallab.selspot).circrad || se->circrad; + pedited->locallab.spots.at(pp->locallab.selspot).qualityMethod = pedited->locallab.spots.at(pp->locallab.selspot).qualityMethod || se->qualityMethod; + pedited->locallab.spots.at(pp->locallab.selspot).transit = pedited->locallab.spots.at(pp->locallab.selspot).transit || se->transit; + pedited->locallab.spots.at(pp->locallab.selspot).thresh = pedited->locallab.spots.at(pp->locallab.selspot).thresh || se->thresh; + pedited->locallab.spots.at(pp->locallab.selspot).iter = pedited->locallab.spots.at(pp->locallab.selspot).iter || se->iter; + // Color & Light + pedited->locallab.spots.at(pp->locallab.selspot).expcolor = pedited->locallab.spots.at(pp->locallab.selspot).expcolor || !expcolor->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).curvactiv = pedited->locallab.spots.at(pp->locallab.selspot).curvactiv || !curvactiv->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).lightness = pedited->locallab.spots.at(pp->locallab.selspot).lightness || lightness->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).contrast = pedited->locallab.spots.at(pp->locallab.selspot).contrast || contrast->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).chroma = pedited->locallab.spots.at(pp->locallab.selspot).chroma || chroma->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sensi = pedited->locallab.spots.at(pp->locallab.selspot).sensi || sensi->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod = pedited->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod || qualitycurveMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.spots.at(pp->locallab.selspot).llcurve = pedited->locallab.spots.at(pp->locallab.selspot).llcurve || !llshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).cccurve = pedited->locallab.spots.at(pp->locallab.selspot).cccurve || !ccshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).LHcurve = pedited->locallab.spots.at(pp->locallab.selspot).LHcurve || !LHshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).HHcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHcurve || !HHshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).invers = pedited->locallab.spots.at(pp->locallab.selspot).invers || !invers->get_inconsistent(); + // Exposure + pedited->locallab.spots.at(pp->locallab.selspot).expexpose = pedited->locallab.spots.at(pp->locallab.selspot).expexpose || !expexpose->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).expcomp = pedited->locallab.spots.at(pp->locallab.selspot).expcomp || expcomp->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).hlcompr = pedited->locallab.spots.at(pp->locallab.selspot).hlcompr || hlcompr->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).hlcomprthresh = pedited->locallab.spots.at(pp->locallab.selspot).hlcomprthresh || hlcomprthresh->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).black = pedited->locallab.spots.at(pp->locallab.selspot).black || black->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).shcompr = pedited->locallab.spots.at(pp->locallab.selspot).shcompr || shcompr->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).warm = pedited->locallab.spots.at(pp->locallab.selspot).warm || warm->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sensiex = pedited->locallab.spots.at(pp->locallab.selspot).sensiex || sensiex->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).excurve = pedited->locallab.spots.at(pp->locallab.selspot).excurve || !shapeexpos->isUnChanged(); + // Vibrance + pedited->locallab.spots.at(pp->locallab.selspot).expvibrance = pedited->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).saturated = pedited->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).pastels = pedited->locallab.spots.at(pp->locallab.selspot).pastels || pastels->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).psthreshold = pedited->locallab.spots.at(pp->locallab.selspot).psthreshold || psThreshold->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).protectskins = pedited->locallab.spots.at(pp->locallab.selspot).protectskins || !protectSkins->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).avoidcolorshift = pedited->locallab.spots.at(pp->locallab.selspot).avoidcolorshift || !avoidColorShift->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).pastsattog = pedited->locallab.spots.at(pp->locallab.selspot).pastsattog || !pastSatTog->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).sensiv = pedited->locallab.spots.at(pp->locallab.selspot).sensiv || sensiv->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).skintonescurve = pedited->locallab.spots.at(pp->locallab.selspot).skintonescurve || !skinTonesCurve->isUnChanged(); + // Blur & Noise + pedited->locallab.spots.at(pp->locallab.selspot).expblur = pedited->locallab.spots.at(pp->locallab.selspot).expblur || !expblur->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).radius = pedited->locallab.spots.at(pp->locallab.selspot).radius || radius->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).strength = pedited->locallab.spots.at(pp->locallab.selspot).strength || strength->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sensibn = pedited->locallab.spots.at(pp->locallab.selspot).sensibn || sensibn->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).blurMethod = pedited->locallab.spots.at(pp->locallab.selspot).blurMethod || blurMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.spots.at(pp->locallab.selspot).activlum = pedited->locallab.spots.at(pp->locallab.selspot).activlum || !activlum->get_inconsistent(); + // Tone Mapping + pedited->locallab.spots.at(pp->locallab.selspot).exptonemap = pedited->locallab.spots.at(pp->locallab.selspot).exptonemap || !exptonemap->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).stren = pedited->locallab.spots.at(pp->locallab.selspot).stren || stren->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).gamma = pedited->locallab.spots.at(pp->locallab.selspot).gamma || gamma->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).estop = pedited->locallab.spots.at(pp->locallab.selspot).estop || estop->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).scaltm = pedited->locallab.spots.at(pp->locallab.selspot).scaltm || scaltm->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).rewei = pedited->locallab.spots.at(pp->locallab.selspot).rewei || rewei->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sensitm = pedited->locallab.spots.at(pp->locallab.selspot).sensitm || sensitm->getEditedState(); + // Retinex + pedited->locallab.spots.at(pp->locallab.selspot).expreti = pedited->locallab.spots.at(pp->locallab.selspot).expreti || !expreti->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).retinexMethod = pedited->locallab.spots.at(pp->locallab.selspot).retinexMethod || retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.spots.at(pp->locallab.selspot).str = pedited->locallab.spots.at(pp->locallab.selspot).str || str->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).chrrt = pedited->locallab.spots.at(pp->locallab.selspot).chrrt || chrrt->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).neigh = pedited->locallab.spots.at(pp->locallab.selspot).neigh || neigh->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).vart = pedited->locallab.spots.at(pp->locallab.selspot).vart || vart->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sensih = pedited->locallab.spots.at(pp->locallab.selspot).sensih || sensih->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).localTgaincurve = pedited->locallab.spots.at(pp->locallab.selspot).localTgaincurve || !cTgainshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).inversret = pedited->locallab.spots.at(pp->locallab.selspot).inversret || !inversret->get_inconsistent(); + // Sharpening + pedited->locallab.spots.at(pp->locallab.selspot).expsharp = pedited->locallab.spots.at(pp->locallab.selspot).expsharp || !expsharp->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).sharradius = pedited->locallab.spots.at(pp->locallab.selspot).sharradius || sharradius->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sharamount = pedited->locallab.spots.at(pp->locallab.selspot).sharamount || sharamount->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).shardamping = pedited->locallab.spots.at(pp->locallab.selspot).shardamping || shardamping->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).shariter = pedited->locallab.spots.at(pp->locallab.selspot).shariter || shariter->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sensisha = pedited->locallab.spots.at(pp->locallab.selspot).sensisha || sensisha->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).inverssha = pedited->locallab.spots.at(pp->locallab.selspot).inverssha || !inverssha->get_inconsistent(); + // Contrast by detail levels + pedited->locallab.spots.at(pp->locallab.selspot).expcbdl = pedited->locallab.spots.at(pp->locallab.selspot).expcbdl || !expcbdl->get_inconsistent(); + + for (int i = 0; i < 5; i++) { + pedited->locallab.spots.at(pp->locallab.selspot).mult[i] = pedited->locallab.spots.at(pp->locallab.selspot).mult[i] || multiplier[i]->getEditedState(); + } + + pedited->locallab.spots.at(pp->locallab.selspot).chromacbdl = pedited->locallab.spots.at(pp->locallab.selspot).chromacbdl || chromacbdl->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).threshold = pedited->locallab.spots.at(pp->locallab.selspot).threshold || threshold->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sensicb = pedited->locallab.spots.at(pp->locallab.selspot).sensicb || sensicb->getEditedState(); + // Denoise + pedited->locallab.spots.at(pp->locallab.selspot).expdenoi = pedited->locallab.spots.at(pp->locallab.selspot).expdenoi || !expdenoi->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).noiselumf = pedited->locallab.spots.at(pp->locallab.selspot).noiselumf || noiselumf->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).noiselumc = pedited->locallab.spots.at(pp->locallab.selspot).noiselumc || noiselumc->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).noiselumdetail = pedited->locallab.spots.at(pp->locallab.selspot).noiselumdetail || noiselumdetail->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).noiselequal = pedited->locallab.spots.at(pp->locallab.selspot).noiselequal || noiselequal->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).noisechrof = pedited->locallab.spots.at(pp->locallab.selspot).noisechrof || noisechrof->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).noisechroc = pedited->locallab.spots.at(pp->locallab.selspot).noisechroc || noisechroc->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).noisechrodetail = pedited->locallab.spots.at(pp->locallab.selspot).noisechrodetail || noisechrodetail->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).adjblur = pedited->locallab.spots.at(pp->locallab.selspot).adjblur || adjblur->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).bilateral = pedited->locallab.spots.at(pp->locallab.selspot).bilateral || bilateral->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).sensiden = pedited->locallab.spots.at(pp->locallab.selspot).sensiden || sensiden->getEditedState(); + // Others + pedited->locallab.spots.at(pp->locallab.selspot).avoid = pedited->locallab.spots.at(pp->locallab.selspot).avoid || !avoid->get_inconsistent(); + } + } } // Update Locallab tools GUI @@ -1324,123 +1622,6 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) updateSpecificGUIState(); enableListener(); } - - if (pedited) { - pedited->locallab.enabled = !get_inconsistent(); - // Control spot settings - ControlSpotPanel::SpotEdited* const se = expsettings->getEditedStates(); - pedited->locallab.nbspot = se->addbutton || se->deletebutton; - pedited->locallab.selspot = se->treeview; - pedited->locallab.id = se->addbutton || se->deletebutton; - pedited->locallab.name = se->name; - pedited->locallab.isvisible = se->isvisible; - pedited->locallab.shape = se->shape; - pedited->locallab.spotMethod = se->spotMethod; - pedited->locallab.sensiexclu = se->sensiexclu; - pedited->locallab.struc = se->struc; - pedited->locallab.shapeMethod = se->shapeMethod; - pedited->locallab.locX = se->locX; - pedited->locallab.locXL = se->locXL; - pedited->locallab.locY = se->locY; - pedited->locallab.locYT = se->locYT; - pedited->locallab.centerX = se->centerX; - pedited->locallab.centerY = se->centerY; - pedited->locallab.circrad = se->circrad; - pedited->locallab.qualityMethod = se->qualityMethod; - pedited->locallab.transit = se->transit; - pedited->locallab.thresh = se->thresh; - pedited->locallab.iter = se->iter; - // Color & Light - pedited->locallab.expcolor = !expcolor->get_inconsistent(); - pedited->locallab.curvactiv = !curvactiv->get_inconsistent(); - pedited->locallab.lightness = lightness->getEditedState(); - pedited->locallab.contrast = contrast->getEditedState(); - pedited->locallab.chroma = chroma->getEditedState(); - pedited->locallab.sensi = sensi->getEditedState(); - pedited->locallab.qualitycurveMethod = qualitycurveMethod->get_active_text() != M("GENERAL_UNCHANGED"); - pedited->locallab.llcurve = !llshape->isUnChanged(); - pedited->locallab.cccurve = !ccshape->isUnChanged(); - pedited->locallab.LHcurve = !LHshape->isUnChanged(); - pedited->locallab.HHcurve = !HHshape->isUnChanged(); - pedited->locallab.invers = !invers->get_inconsistent(); - // Exposure - pedited->locallab.expexpose = !expexpose->get_inconsistent(); - pedited->locallab.expcomp = expcomp->getEditedState(); - pedited->locallab.hlcompr = hlcompr->getEditedState(); - pedited->locallab.hlcomprthresh = hlcomprthresh->getEditedState(); - pedited->locallab.black = black->getEditedState(); - pedited->locallab.shcompr = shcompr->getEditedState(); - pedited->locallab.warm = warm->getEditedState(); - pedited->locallab.sensiex = sensiex->getEditedState(); - pedited->locallab.excurve = !shapeexpos->isUnChanged(); - // Vibrance - pedited->locallab.expvibrance = !expvibrance->get_inconsistent(); - pedited->locallab.saturated = saturated->getEditedState(); - pedited->locallab.pastels = pastels->getEditedState(); - pedited->locallab.psthreshold = psThreshold->getEditedState(); - pedited->locallab.protectskins = !protectSkins->get_inconsistent(); - pedited->locallab.avoidcolorshift = !avoidColorShift->get_inconsistent(); - pedited->locallab.pastsattog = !pastSatTog->get_inconsistent(); - pedited->locallab.sensiv = sensiv->getEditedState(); - pedited->locallab.skintonescurve = !skinTonesCurve->isUnChanged(); - // Blur & Noise - pedited->locallab.expblur = !expblur->get_inconsistent(); - pedited->locallab.radius = radius->getEditedState(); - pedited->locallab.strength = strength->getEditedState(); - pedited->locallab.sensibn = sensibn->getEditedState(); - pedited->locallab.blurMethod = blurMethod->get_active_text() != M("GENERAL_UNCHANGED"); - pedited->locallab.activlum = !activlum->get_inconsistent(); - // Tone Mapping - pedited->locallab.exptonemap = !exptonemap->get_inconsistent(); - pedited->locallab.stren = stren->getEditedState(); - pedited->locallab.gamma = gamma->getEditedState(); - pedited->locallab.estop = estop->getEditedState(); - pedited->locallab.scaltm = scaltm->getEditedState(); - pedited->locallab.rewei = rewei->getEditedState(); - pedited->locallab.sensitm = sensitm->getEditedState(); - // Retinex - pedited->locallab.expreti = !expreti->get_inconsistent(); - pedited->locallab.retinexMethod = retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); - pedited->locallab.str = str->getEditedState(); - pedited->locallab.chrrt = chrrt->getEditedState(); - pedited->locallab.neigh = neigh->getEditedState(); - pedited->locallab.vart = vart->getEditedState(); - pedited->locallab.sensih = sensih->getEditedState(); - pedited->locallab.localTgaincurve = !cTgainshape->isUnChanged(); - pedited->locallab.inversret = !inversret->get_inconsistent(); - // Sharpening - pedited->locallab.expsharp = !expsharp->get_inconsistent(); - pedited->locallab.sharradius = sharradius->getEditedState(); - pedited->locallab.sharamount = sharamount->getEditedState(); - pedited->locallab.shardamping = shardamping->getEditedState(); - pedited->locallab.shariter = shariter->getEditedState(); - pedited->locallab.sensisha = sensisha->getEditedState(); - pedited->locallab.inverssha = !inverssha->get_inconsistent(); - // Contrast by detail levels - pedited->locallab.expcbdl = !expcbdl->get_inconsistent(); - - for (int i = 0; i < 5; i++) { - pedited->locallab.mult[i] = multiplier[i]->getEditedState(); - } - - pedited->locallab.chromacbdl = chromacbdl->getEditedState(); - pedited->locallab.threshold = threshold->getEditedState(); - pedited->locallab.sensicb = sensicb->getEditedState(); - // Denoise - pedited->locallab.expdenoi = !expdenoi->get_inconsistent(); - pedited->locallab.noiselumf = noiselumf->getEditedState(); - pedited->locallab.noiselumc = noiselumc->getEditedState(); - pedited->locallab.noiselumdetail = noiselumdetail->getEditedState(); - pedited->locallab.noiselequal = noiselequal->getEditedState(); - pedited->locallab.noisechrof = noisechrof->getEditedState(); - pedited->locallab.noisechroc = noisechroc->getEditedState(); - pedited->locallab.noisechrodetail = noisechrodetail->getEditedState(); - pedited->locallab.adjblur = adjblur->getEditedState(); - pedited->locallab.bilateral = bilateral->getEditedState(); - pedited->locallab.sensiden = sensiden->getEditedState(); - // Others - pedited->locallab.avoid = !avoid->get_inconsistent(); - } } void Locallab::protectskins_toggled() @@ -1828,6 +2009,7 @@ void Locallab::inversretChanged() } } +/* void Locallab::updateDefaultsValues(const rtengine::procparams::ProcParams* defParams, int id) { const LocallabParams::LocallabSpot* defSpot = new LocallabParams::LocallabSpot(); @@ -1901,86 +2083,137 @@ void Locallab::updateDefaultsValues(const rtengine::procparams::ProcParams* defP bilateral->setDefault((double)defSpot->bilateral); sensiden->setDefault((double)defSpot->sensiden); } +*/ -void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pedited) +void Locallab::setParamEditable(bool cond) +{ + printf("setParamEditable: %d\n", cond); + + // Update params editable state for controlspotpanel + expsettings->setParamEditable(cond); + + // Color & Light + expcolor->set_sensitive(cond); + // Exposure + expexpose->set_sensitive(cond); + // Vibrance + expvibrance->set_sensitive(cond); + // Blur & Noise + expblur->set_sensitive(cond); + // Tone Mapping + exptonemap->set_sensitive(cond); + // Retinex + expreti->set_sensitive(cond); + // Sharpening + expsharp->set_sensitive(cond); + // Contrast by detail levels + expcbdl->set_sensitive(cond); + // Denoise + expdenoi->set_sensitive(cond); + // Others + avoid->set_sensitive(cond); +} + +void Locallab::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited) +{ + defparams = defParams; + defpedited = pedited; + + if (pedited) { + pe = new ParamsEdited(*pedited); + } else { + pe = nullptr; + } +} + +void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pedited, int id) { printf("setDefaults\n"); - - // Store default ProcParams - defparams = defParams; + printf("defparams: %p\n", defparams); // Set default values and edited states for controlspotpanel - expsettings->setDefaults(defParams, pedited); + expsettings->setDefaults(defParams, pedited, id); - // Set default values for adjusters and threshold adjusters - if (defParams->locallab.selspot < (int)defParams->locallab.spots.size()) { - updateDefaultsValues(defParams, defParams->locallab.spots.at(defParams->locallab.selspot).id); - } else { - updateDefaultsValues(defParams); + // Find vector index of given spot id (index = -1 if not found) + int index = -1; + + for (int i = 0; i < (int)defParams->locallab.spots.size(); i++) { + if (defParams->locallab.spots.at(i).id == id) { + index = i; + + break; + } } + // Set default values for adjusters + const LocallabParams::LocallabSpot* defSpot = new LocallabParams::LocallabSpot(); + + if (index != -1 && index < (int)defParams->locallab.spots.size()) { + defSpot = &defParams->locallab.spots.at(index); + } + + // Color & Light + lightness->setDefault((double)defSpot->lightness); + contrast->setDefault((double)defSpot->contrast); + chroma->setDefault((double)defSpot->chroma); + sensi->setDefault((double)defSpot->sensi); + // Exposure + expcomp->setDefault((double)defSpot->expcomp); + hlcompr->setDefault((double)defSpot->hlcompr); + hlcomprthresh->setDefault((double)defSpot->hlcomprthresh); + black->setDefault((double)defSpot->black); + shcompr->setDefault((double)defSpot->shcompr); + warm->setDefault((double)defSpot->warm); + sensiex->setDefault((double)defSpot->sensiex); + // Vibrance + saturated->setDefault((double)defSpot->saturated); + pastels->setDefault((double)defSpot->pastels); + psThreshold->setDefault(defSpot->psthreshold); + sensiv->setDefault((double)defSpot->sensiv); + // Blur & Noise + radius->setDefault((double)defSpot->radius); + strength->setDefault((double)defSpot->strength); + sensibn->setDefault((double)defSpot->sensibn); + // Tone Mapping + stren->setDefault((double)defSpot->stren); + gamma->setDefault((double)defSpot->gamma); + estop->setDefault((double)defSpot->estop); + scaltm->setDefault((double)defSpot->scaltm); + rewei->setDefault((double)defSpot->rewei); + sensitm->setDefault((double)defSpot->sensitm); + // Retinex + str->setDefault((double)defSpot->str); + chrrt->setDefault((double)defSpot->chrrt); + neigh->setDefault((double)defSpot->neigh); + vart->setDefault((double)defSpot->vart); + sensih->setDefault((double)defSpot->sensih); + // Sharpening + sharradius->setDefault((double)defSpot->sharradius); + sharamount->setDefault((double)defSpot->sharamount); + shardamping->setDefault((double)defSpot->shardamping); + shariter->setDefault((double)defSpot->shariter); + sensisha->setDefault((double)defSpot->sensisha); + // Contrast by detail levels + for (int i = 0; i < 5; i++) { + multiplier[i]->setDefault(defSpot->mult[i]); + } + chromacbdl->setDefault((double)defSpot->chromacbdl); + threshold->setDefault(defSpot->threshold); + sensicb->setDefault((double)defSpot->sensicb); + // Denoise + noiselumf->setDefault((double)defSpot->noiselumf); + noiselumc->setDefault((double)defSpot->noiselumc); + noiselumdetail->setDefault((double)defSpot->noiselumdetail); + noiselequal->setDefault((double)defSpot->noiselequal); + noisechrof->setDefault((double)defSpot->noisechrof); + noisechroc->setDefault((double)defSpot->noisechroc); + noisechrodetail->setDefault((double)defSpot->noisechrodetail); + adjblur->setDefault((double)defSpot->adjblur); + bilateral->setDefault((double)defSpot->bilateral); + sensiden->setDefault((double)defSpot->sensiden); + // Set default edited states for adjusters and threshold adjusters - if (pedited) { - // Color & Light - lightness->setDefaultEditedState(pedited->locallab.lightness ? Edited : UnEdited); - contrast->setDefaultEditedState(pedited->locallab.contrast ? Edited : UnEdited); - chroma->setDefaultEditedState(pedited->locallab.chroma ? Edited : UnEdited); - sensi->setDefaultEditedState(pedited->locallab.sensi ? Edited : UnEdited); - // Exposure - expcomp->setDefaultEditedState(pedited->locallab.expcomp ? Edited : UnEdited); - hlcompr->setDefaultEditedState(pedited->locallab.hlcompr ? Edited : UnEdited); - hlcomprthresh->setDefaultEditedState(pedited->locallab.hlcomprthresh ? Edited : UnEdited); - black->setDefaultEditedState(pedited->locallab.black ? Edited : UnEdited); - shcompr->setDefaultEditedState(pedited->locallab.shcompr ? Edited : UnEdited); - warm->setDefaultEditedState(pedited->locallab.warm ? Edited : UnEdited); - sensiex->setDefaultEditedState(pedited->locallab.sensiex ? Edited : UnEdited); - // Vibrance - saturated->setDefaultEditedState(pedited->locallab.saturated ? Edited : UnEdited); - pastels->setDefaultEditedState(pedited->locallab.pastels ? Edited : UnEdited); - psThreshold->setDefaultEditedState(pedited->locallab.psthreshold ? Edited : UnEdited); - sensiv->setDefaultEditedState(pedited->locallab.sensiv ? Edited : UnEdited); - // Blur & Noise - radius->setDefaultEditedState(pedited->locallab.radius ? Edited : UnEdited); - strength->setDefaultEditedState(pedited->locallab.strength ? Edited : UnEdited); - sensibn->setDefaultEditedState(pedited->locallab.sensibn ? Edited : UnEdited); - // Tone Mapping - stren->setDefaultEditedState(pedited->locallab.stren ? Edited : UnEdited); - gamma->setDefaultEditedState(pedited->locallab.gamma ? Edited : UnEdited); - estop->setDefaultEditedState(pedited->locallab.estop ? Edited : UnEdited); - scaltm->setDefaultEditedState(pedited->locallab.scaltm ? Edited : UnEdited); - rewei->setDefaultEditedState(pedited->locallab.rewei ? Edited : UnEdited); - sensitm->setDefaultEditedState(pedited->locallab.sensitm ? Edited : UnEdited); - // Retinex - str->setDefaultEditedState(pedited->locallab.str ? Edited : UnEdited); - chrrt->setDefaultEditedState(pedited->locallab.chrrt ? Edited : UnEdited); - neigh->setDefaultEditedState(pedited->locallab.neigh ? Edited : UnEdited); - vart->setDefaultEditedState(pedited->locallab.vart ? Edited : UnEdited); - sensih->setDefaultEditedState(pedited->locallab.sensih ? Edited : UnEdited); - // Sharpening - sharradius->setDefaultEditedState(pedited->locallab.sharradius ? Edited : UnEdited); - sharamount->setDefaultEditedState(pedited->locallab.sharamount ? Edited : UnEdited); - shardamping->setDefaultEditedState(pedited->locallab.shardamping ? Edited : UnEdited); - shariter->setDefaultEditedState(pedited->locallab.shariter ? Edited : UnEdited); - sensisha->setDefaultEditedState(pedited->locallab.sensisha ? Edited : UnEdited); - // Contrast by detail levels - for (int i = 0; i < 5; i++) { - multiplier[i]->setDefaultEditedState(pedited->locallab.mult[i] ? Edited : UnEdited); - } - chromacbdl->setDefaultEditedState(pedited->locallab.chromacbdl ? Edited : UnEdited); - threshold->setDefaultEditedState(pedited->locallab.threshold ? Edited : UnEdited); - sensicb->setDefaultEditedState(pedited->locallab.sensicb ? Edited : UnEdited); - // Denoise - noiselumf->setDefaultEditedState(pedited->locallab.noiselumf ? Edited : UnEdited); - noiselumc->setDefaultEditedState(pedited->locallab.noiselumc ? Edited : UnEdited); - noiselumdetail->setDefaultEditedState(pedited->locallab.noiselumdetail ? Edited : UnEdited); - noiselequal->setDefaultEditedState(pedited->locallab.noiselequal ? Edited : UnEdited); - noisechrof->setDefaultEditedState(pedited->locallab.noisechrof ? Edited : UnEdited); - noisechroc->setDefaultEditedState(pedited->locallab.noisechroc ? Edited : UnEdited); - noisechrodetail->setDefaultEditedState(pedited->locallab.noisechrodetail ? Edited : UnEdited); - adjblur->setDefaultEditedState(pedited->locallab.adjblur ? Edited : UnEdited); - bilateral->setDefaultEditedState(pedited->locallab.bilateral ? Edited : UnEdited); - sensiden->setDefaultEditedState(pedited->locallab.sensiden ? Edited : UnEdited); - } else { + if (!pedited) { // Color & Light lightness->setDefaultEditedState(Irrelevant); contrast->setDefaultEditedState(Irrelevant); @@ -2040,6 +2273,72 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe adjblur->setDefaultEditedState(Irrelevant); bilateral->setDefaultEditedState(Irrelevant); sensiden->setDefaultEditedState(Irrelevant); + } else { + const LocallabParamsEdited::LocallabSpotEdited* defSpotState = new LocallabParamsEdited::LocallabSpotEdited(true); + + if (index != 1 && index < (int)pedited->locallab.spots.size()) { + defSpotState = &pedited->locallab.spots.at(index); + } + + // Color & Light + lightness->setDefaultEditedState(defSpotState->lightness ? Edited : UnEdited); + contrast->setDefaultEditedState(defSpotState->contrast ? Edited : UnEdited); + chroma->setDefaultEditedState(defSpotState->chroma ? Edited : UnEdited); + sensi->setDefaultEditedState(defSpotState->sensi ? Edited : UnEdited); + // Exposure + expcomp->setDefaultEditedState(defSpotState->expcomp ? Edited : UnEdited); + hlcompr->setDefaultEditedState(defSpotState->hlcompr ? Edited : UnEdited); + hlcomprthresh->setDefaultEditedState(defSpotState->hlcomprthresh ? Edited : UnEdited); + black->setDefaultEditedState(defSpotState->black ? Edited : UnEdited); + shcompr->setDefaultEditedState(defSpotState->shcompr ? Edited : UnEdited); + warm->setDefaultEditedState(defSpotState->warm ? Edited : UnEdited); + sensiex->setDefaultEditedState(defSpotState->sensiex ? Edited : UnEdited); + // Vibrance + saturated->setDefaultEditedState(defSpotState->saturated ? Edited : UnEdited); + pastels->setDefaultEditedState(defSpotState->pastels ? Edited : UnEdited); + psThreshold->setDefaultEditedState(defSpotState->psthreshold ? Edited : UnEdited); + sensiv->setDefaultEditedState(defSpotState->sensiv ? Edited : UnEdited); + // Blur & Noise + radius->setDefaultEditedState(defSpotState->radius ? Edited : UnEdited); + strength->setDefaultEditedState(defSpotState->strength ? Edited : UnEdited); + sensibn->setDefaultEditedState(defSpotState->sensibn ? Edited : UnEdited); + // Tone Mapping + stren->setDefaultEditedState(defSpotState->stren ? Edited : UnEdited); + gamma->setDefaultEditedState(defSpotState->gamma ? Edited : UnEdited); + estop->setDefaultEditedState(defSpotState->estop ? Edited : UnEdited); + scaltm->setDefaultEditedState(defSpotState->scaltm ? Edited : UnEdited); + rewei->setDefaultEditedState(defSpotState->rewei ? Edited : UnEdited); + sensitm->setDefaultEditedState(defSpotState->sensitm ? Edited : UnEdited); + // Retinex + str->setDefaultEditedState(defSpotState->str ? Edited : UnEdited); + chrrt->setDefaultEditedState(defSpotState->chrrt ? Edited : UnEdited); + neigh->setDefaultEditedState(defSpotState->neigh ? Edited : UnEdited); + vart->setDefaultEditedState(defSpotState->vart ? Edited : UnEdited); + sensih->setDefaultEditedState(defSpotState->sensih ? Edited : UnEdited); + // Sharpening + sharradius->setDefaultEditedState(defSpotState->sharradius ? Edited : UnEdited); + sharamount->setDefaultEditedState(defSpotState->sharamount ? Edited : UnEdited); + shardamping->setDefaultEditedState(defSpotState->shardamping ? Edited : UnEdited); + shariter->setDefaultEditedState(defSpotState->shariter ? Edited : UnEdited); + sensisha->setDefaultEditedState(defSpotState->sensisha ? Edited : UnEdited); + // Contrast by detail levels + for (int i = 0; i < 5; i++) { + multiplier[i]->setDefaultEditedState(defSpotState->mult[i] ? Edited : UnEdited); + } + chromacbdl->setDefaultEditedState(defSpotState->chromacbdl ? Edited : UnEdited); + threshold->setDefaultEditedState(defSpotState->threshold ? Edited : UnEdited); + sensicb->setDefaultEditedState(defSpotState->sensicb ? Edited : UnEdited); + // Denoise + noiselumf->setDefaultEditedState(defSpotState->noiselumf ? Edited : UnEdited); + noiselumc->setDefaultEditedState(defSpotState->noiselumc ? Edited : UnEdited); + noiselumdetail->setDefaultEditedState(defSpotState->noiselumdetail ? Edited : UnEdited); + noiselequal->setDefaultEditedState(defSpotState->noiselequal ? Edited : UnEdited); + noisechrof->setDefaultEditedState(defSpotState->noisechrof ? Edited : UnEdited); + noisechroc->setDefaultEditedState(defSpotState->noisechroc ? Edited : UnEdited); + noisechrodetail->setDefaultEditedState(defSpotState->noisechrodetail ? Edited : UnEdited); + adjblur->setDefaultEditedState(defSpotState->adjblur ? Edited : UnEdited); + bilateral->setDefaultEditedState(defSpotState->bilateral ? Edited : UnEdited); + sensiden->setDefaultEditedState(defSpotState->sensiden ? Edited : UnEdited); } } @@ -2500,66 +2799,74 @@ void Locallab::trimValues(rtengine::procparams::ProcParams * pp) void Locallab::setBatchMode(bool batchMode) { - ToolPanel::setBatchMode(batchMode); printf("BatchMode : %d\n", batchMode); - adjblur->showEditedCB(); + ToolPanel::setBatchMode(batchMode); + + // Set batch mode for controlspotpanel + expsettings->setBatchMode(batchMode); + + // Set batch mode for adjusters and threshold adjusters + // Color & Light lightness->showEditedCB(); contrast->showEditedCB(); chroma->showEditedCB(); - warm->showEditedCB(); + sensi->showEditedCB(); + // Exposure expcomp->showEditedCB(); - black->showEditedCB(); hlcompr->showEditedCB(); hlcomprthresh->showEditedCB(); + black->showEditedCB(); shcompr->showEditedCB(); - noiselumf->showEditedCB(); - noiselumc->showEditedCB(); - noiselumdetail->showEditedCB(); - noiselequal->showEditedCB(); - noisechrodetail->showEditedCB(); - bilateral->showEditedCB(); - sensiden->showEditedCB(); - noisechroc->showEditedCB(); - noiselumf->showEditedCB(); - sharradius->showEditedCB(); - sharamount->showEditedCB(); - shardamping->showEditedCB(); - shariter->showEditedCB(); - sensisha->showEditedCB(); - sensi->showEditedCB(); + warm->showEditedCB(); sensiex->showEditedCB(); - sensih->showEditedCB(); - sensicb->showEditedCB(); - sensibn->showEditedCB(); - sensitm->showEditedCB(); + // Vibrance + saturated->showEditedCB(); + pastels->showEditedCB(); + psThreshold->showEditedCB(); + sensiv->showEditedCB(); + // Blur & Noise radius->showEditedCB(); strength->showEditedCB(); + sensibn->showEditedCB(); + // Tone Mapping stren->showEditedCB(); gamma->showEditedCB(); estop->showEditedCB(); scaltm->showEditedCB(); rewei->showEditedCB(); + sensitm->showEditedCB(); + // Retinex str->showEditedCB(); + chrrt->showEditedCB(); neigh->showEditedCB(); vart->showEditedCB(); - LocalcurveEditorgainT->setBatchMode(batchMode); - llCurveEditorG->setBatchMode(batchMode); - chrrt->showEditedCB(); - + sensih->showEditedCB(); + // Sharpening + sharradius->showEditedCB(); + sharamount->showEditedCB(); + shardamping->showEditedCB(); + shariter->showEditedCB(); + sensisha->showEditedCB(); + // Contrast by detail levels for (int i = 0; i < 5; i++) { multiplier[i]->showEditedCB(); } - threshold->showEditedCB(); chromacbdl->showEditedCB(); - pastels->showEditedCB(); - saturated->showEditedCB(); - psThreshold->showEditedCB(); - sensiv->showEditedCB(); - - curveEditorGG->setBatchMode(batchMode); - + threshold->showEditedCB(); + sensicb->showEditedCB(); + // Denoise + noiselumf->showEditedCB(); + noiselumc->showEditedCB(); + noiselumdetail->showEditedCB(); + noiselequal->showEditedCB(); + noiselumf->showEditedCB(); + noisechroc->showEditedCB(); + noisechrodetail->showEditedCB(); + adjblur->showEditedCB(); + bilateral->showEditedCB(); + sensiden->showEditedCB(); } std::vector Locallab::getCurvePoints(ThresholdSelector* tAdjuster) const @@ -2751,7 +3058,7 @@ void Locallab::disableListener() avoidConn.block(true); } -void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, int index) +void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited, int index) { printf("updateLocallabGUI\n"); @@ -2880,6 +3187,154 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, int // Others avoid->set_active(pp->locallab.spots.at(index).avoid); + + if (pedited) { + if (index < (int)pedited->locallab.spots.size()) { + const LocallabParamsEdited::LocallabSpotEdited* spotState = &pedited->locallab.spots.at(index); + + // Control spot settings + ControlSpotPanel::SpotEdited* const se = new ControlSpotPanel::SpotEdited(); + + if (pedited->locallab.nbspot && pedited->locallab.id) { + se->nbspot = true; + } else { + se->nbspot = false; + } + + se->selspot = pedited->locallab.selspot; + se->name = spotState->name; + se->isvisible = spotState->isvisible; + se->shape = spotState->shape; + se->spotMethod = spotState->spotMethod; + se->sensiexclu = spotState->sensiexclu; + se->struc = spotState->struc; + se->shapeMethod = spotState->shapeMethod; + se->locX = spotState->locX; + se->locXL = spotState->locXL; + se->locY = spotState->locY; + se->locYT = spotState->locYT; + se->centerX = spotState->centerX; + se->centerY = spotState->centerY; + se->circrad = spotState->circrad; + se->qualityMethod = spotState->qualityMethod; + se->transit = spotState->transit; + se->thresh = spotState->thresh; + se->iter = spotState->iter; + expsettings->setEditedStates(se); + + // Color & Light + expcolor->set_inconsistent(!spotState->expcolor); + curvactiv->set_inconsistent(multiImage && !spotState->curvactiv); + lightness->setEditedState(spotState->lightness ? Edited : UnEdited); + contrast->setEditedState(spotState->contrast ? Edited : UnEdited); + chroma->setEditedState(spotState->chroma ? Edited : UnEdited); + sensi->setEditedState(spotState->sensi ? Edited : UnEdited); + + if (!spotState->qualitycurveMethod) { + qualitycurveMethod->set_active_text(M("GENERAL_UNCHANGED")); + } + + llshape->setUnChanged(!spotState->llcurve); + ccshape->setUnChanged(!spotState->cccurve); + LHshape->setUnChanged(!spotState->LHcurve); + HHshape->setUnChanged(!spotState->HHcurve); + invers->set_inconsistent(multiImage && !spotState->invers); + + // Exposure + expexpose->set_inconsistent(!spotState->expexpose); + expcomp->setEditedState(spotState->expcomp ? Edited : UnEdited); + hlcompr->setEditedState(spotState->hlcompr ? Edited : UnEdited); + hlcomprthresh->setEditedState(spotState->hlcomprthresh ? Edited : UnEdited); + black->setEditedState(spotState->black ? Edited : UnEdited); + warm->setEditedState(spotState->warm ? Edited : UnEdited); + shcompr->setEditedState(spotState->shcompr ? Edited : UnEdited); + sensiex->setEditedState(spotState->sensiex ? Edited : UnEdited); + shapeexpos->setUnChanged(!spotState->excurve); + + // Vibrance + expvibrance->set_inconsistent(!spotState->expvibrance); + saturated->setEditedState(spotState->saturated ? Edited : UnEdited); + pastels->setEditedState(spotState->pastels ? Edited : UnEdited); + psThreshold->setEditedState(spotState->psthreshold ? Edited : UnEdited); + protectSkins->set_inconsistent(multiImage && !spotState->protectskins); + avoidColorShift->set_inconsistent(multiImage && !spotState->avoidcolorshift); + pastSatTog->set_inconsistent(multiImage && !spotState->pastsattog); + sensiv->setEditedState(spotState->sensiv ? Edited : UnEdited); + skinTonesCurve->setUnChanged(!spotState->skintonescurve); + + // Blur & Noise + expblur->set_inconsistent(!spotState->expblur); + radius->setEditedState(spotState->radius ? Edited : UnEdited); + strength->setEditedState(spotState->strength ? Edited : UnEdited); + sensibn->setEditedState(spotState->sensibn ? Edited : UnEdited); + + if (!spotState->blurMethod) { + blurMethod->set_active_text(M("GENERAL_UNCHANGED")); + } + + activlum->set_inconsistent(multiImage && !spotState->activlum); + + // Tone Mapping + exptonemap->set_inconsistent(!spotState->exptonemap); + stren->setEditedState(spotState->stren ? Edited : UnEdited); + gamma->setEditedState(spotState->gamma ? Edited : UnEdited); + estop->setEditedState(spotState->estop ? Edited : UnEdited); + scaltm->setEditedState(spotState->scaltm ? Edited : UnEdited); + rewei->setEditedState(spotState->rewei ? Edited : UnEdited); + sensitm->setEditedState(spotState->sensitm ? Edited : UnEdited); + + // Retinex + expreti->set_inconsistent(!spotState->expreti); + + if (!spotState->retinexMethod) { + retinexMethod->set_active_text(M("GENERAL_UNCHANGED")); + } + + str->setEditedState(spotState->str ? Edited : UnEdited); + chrrt->setEditedState(spotState->chrrt ? Edited : UnEdited); + neigh->setEditedState(spotState->neigh ? Edited : UnEdited); + vart->setEditedState(spotState->vart ? Edited : UnEdited); + sensih->setEditedState(spotState->sensih ? Edited : UnEdited); + cTgainshape->setUnChanged(!spotState->localTgaincurve); + inversret->set_inconsistent(multiImage && !spotState->inversret); + + // Sharpening + expsharp->set_inconsistent(!spotState->expsharp); + sharradius->setEditedState(spotState->sharradius ? Edited : UnEdited); + sharamount->setEditedState(spotState->sharamount ? Edited : UnEdited); + shardamping->setEditedState(spotState->shardamping ? Edited : UnEdited); + shariter->setEditedState(spotState->shariter ? Edited : UnEdited); + sensisha->setEditedState(spotState->sensisha ? Edited : UnEdited); + inverssha->set_inconsistent(multiImage && !spotState->inverssha); + + // Contrast by detail levels + expcbdl->set_inconsistent(!spotState->expcbdl); + + for (int i = 0; i < 5; i++) { + multiplier[i]->setEditedState(spotState->mult[i] ? Edited : UnEdited); + } + + chromacbdl->setEditedState(spotState->chromacbdl ? Edited : UnEdited); + threshold->setEditedState(spotState->threshold ? Edited : UnEdited); + sensicb->setEditedState(spotState->sensicb ? Edited : UnEdited); + + // Denoise + expdenoi->set_inconsistent(!spotState->expdenoi); + noiselumf->setEditedState(spotState->noiselumf ? Edited : UnEdited); + noiselumc->setEditedState(spotState->noiselumc ? Edited : UnEdited); + noiselumdetail->setEditedState(spotState->noiselumdetail ? Edited : UnEdited); + noiselequal->setEditedState(spotState->noiselequal ? Edited : UnEdited); + noisechrof->setEditedState(spotState->noisechrof ? Edited : UnEdited); + noisechroc->setEditedState(spotState->noisechroc ? Edited : UnEdited); + noisechrodetail->setEditedState(spotState->noisechrodetail ? Edited : UnEdited); + adjblur->setEditedState(spotState->adjblur ? Edited : UnEdited); + bilateral->setEditedState(spotState->bilateral ? Edited : UnEdited); + sensiden->setEditedState(spotState->sensiden ? Edited : UnEdited); + + // Others + avoid->set_inconsistent(multiImage && !spotState->avoid); + } + } } } diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 5acb55d0c..bc8cec9cd 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -181,6 +181,16 @@ private: * When an other spot is selected, this default ProcParams is used to update adjusters default values */ const rtengine::ProcParams* defparams; + /** + * Used to store the default ParamsEdited when setDefaults function is called + * When an other spot is selected, this default ParamsEdited is used to update adjusters default edited state + */ + const ParamsEdited* defpedited; + /** + * Used to store the default ParamsEdited when setDefaults function is called + * This ParamsEdited is updated when control spots are modified and is used to update adjusters edited state + */ + ParamsEdited* pe; // Expander management functions void foldAllButMe(GdkEventButton* event, MyExpander *expander); @@ -217,9 +227,10 @@ private: void lumacontrastPlusPressed(); // Locallab GUI management function - void updateLocallabGUI(const rtengine::procparams::ProcParams* pp, int index); + void updateLocallabGUI(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited, int index); void updateSpecificGUIState(); - void updateDefaultsValues(const rtengine::procparams::ProcParams* defParams, int id = 0); + // void updateDefaultsValues(const rtengine::procparams::ProcParams* defParams, int id = 0); + void setParamEditable(bool cond); public: Locallab(); @@ -229,6 +240,7 @@ public: void read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr); void write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr); void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr); + void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited, int id); void setBatchMode(bool batchMode); void trimValues(rtengine::procparams::ProcParams* pp); void setListener(ToolPanelListener* tpl); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 869725f14..d08b153f0 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -329,117 +329,12 @@ void ParamsEdited::set(bool v) locallab.enabled = v; locallab.nbspot = v; locallab.selspot = v; - // Control spot settings locallab.id = v; - locallab.name = v; - locallab.isvisible = v; - locallab.shape = v; - locallab.spotMethod = v; - locallab.sensiexclu = v; - locallab.struc = v; - locallab.shapeMethod = v; - locallab.locX = v; - locallab.locXL = v; - locallab.locY = v; - locallab.locYT = v; - locallab.centerX = v; - locallab.centerY = v; - locallab.circrad = v; - locallab.qualityMethod = v; - locallab.transit = v; - locallab.thresh = v; - locallab.iter = v; - // Color & Light - locallab.expcolor = v; - locallab.curvactiv = v; - locallab.lightness = v; - locallab.contrast = v; - locallab.chroma = v; - locallab.sensi = v; - locallab.qualitycurveMethod = v; - locallab.llcurve = v; - locallab.cccurve = v; - locallab.LHcurve = v; - locallab.HHcurve = v; - locallab.invers = v; - // Exposure - locallab.expexpose = v; - locallab.expcomp = v; - locallab.hlcompr = v; - locallab.hlcomprthresh = v; - locallab.black = v; - locallab.shcompr = v; - locallab.warm = v; - locallab.sensiex = v; - locallab.excurve = v; - // Vibrance - locallab.expvibrance = v; - locallab.saturated = v; - locallab.pastels = v; - locallab.psthreshold = v; - locallab.protectskins = v; - locallab.avoidcolorshift = v; - locallab.pastsattog = v; - locallab.sensiv = v; - locallab.skintonescurve = v; - // Blur & Noise - locallab.expblur = v; - locallab.radius = v; - locallab.strength = v; - locallab.sensibn = v; - locallab.blurMethod = v; - locallab.activlum = v; - // Tone Mapping - locallab.exptonemap = v; - locallab.stren = v; - locallab.gamma = v; - locallab.estop = v; - locallab.scaltm = v; - locallab.rewei = v; - locallab.sensitm = v; - // Retinex - locallab.expreti = v; - locallab.retinexMethod = v; - locallab.str = v; - locallab.chrrt = v; - locallab.neigh = v; - locallab.vart = v; - locallab.sensih = v; - locallab.localTgaincurve = v; - locallab.inversret = v; - // Sharpening - locallab.expsharp = v; - locallab.sharradius = v; - locallab.sharamount = v; - locallab.shardamping = v; - locallab.shariter = v; - locallab.sensisha = v; - locallab.inverssha = v; - // Contrast by detail levels - locallab.expcbdl = v; - for (int i = 0; i < 5; i++) { - locallab.mult[i] = v; + for (size_t i = 0; i < locallab.spots.size(); i++) { + locallab.spots.at(i).set(v); } - locallab.chromacbdl = v; - locallab.threshold = v; - locallab.sensicb = v; - // Denoise - locallab.expdenoi = v; - locallab.noiselumf = v; - locallab.noiselumc = v; - locallab.noiselumdetail = v; - locallab.noiselequal = v; - locallab.noisechrof = v; - locallab.noisechroc = v; - locallab.noisechrodetail = v; - locallab.adjblur = v; - locallab.bilateral = v; - locallab.sensiden = v; - // Others - locallab.avoid = v; - pcvignette.enabled = v; pcvignette.strength = v; pcvignette.feather = v; @@ -700,6 +595,10 @@ void ParamsEdited::initFrom(const std::vector& const ProcParams& p = src[0]; + // Resize LocallabSpotEdited according to src[0] + locallab.spots.clear(); + locallab.spots.resize(p.locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); + for (size_t i = 1; i < src.size(); i++) { const ProcParams& other = src[i]; toneCurve.curve = toneCurve.curve && p.toneCurve.curve == other.toneCurve.curve; @@ -1004,117 +903,129 @@ void ParamsEdited::initFrom(const std::vector& locallab.nbspot = locallab.nbspot && p.locallab.nbspot == other.locallab.nbspot; locallab.selspot = locallab.selspot && p.locallab.selspot == other.locallab.selspot; - const std::vector& otherSpots = other.locallab.spots; - // Control spot settings - locallab.id = locallab.id && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::id); - locallab.name = locallab.name && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::name); - locallab.isvisible = locallab.isvisible && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::isvisible); - locallab.shape = locallab.shape && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::shape); - locallab.spotMethod = locallab.spotMethod && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::spotMethod); - locallab.sensiexclu = locallab.sensiexclu && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensiexclu); - locallab.struc = locallab.struc && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::struc); - locallab.shapeMethod = locallab.shapeMethod && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::shapeMethod); - locallab.locX = locallab.locX && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::locX); - locallab.locXL = locallab.locXL && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::locXL); - locallab.locY = locallab.locY && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::locY); - locallab.locYT = locallab.locYT && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::locYT); - locallab.centerX = locallab.centerX && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::centerX); - locallab.centerY = locallab.centerY && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::centerY); - locallab.circrad = locallab.circrad && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::circrad); - locallab.qualityMethod = locallab.qualityMethod && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::qualityMethod); - locallab.transit = locallab.transit && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::transit); - locallab.thresh = locallab.thresh && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::thresh); - locallab.iter = locallab.iter && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::iter); - // Color & Light - locallab.expcolor = locallab.expcolor && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expcolor); - locallab.curvactiv = locallab.curvactiv && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::curvactiv); - locallab.lightness = locallab.lightness && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::lightness); - locallab.contrast = locallab.contrast && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::contrast); - locallab.chroma = locallab.chroma && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::chroma); - locallab.sensi = locallab.sensi && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensi); - locallab.qualitycurveMethod = locallab.qualitycurveMethod && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::qualitycurveMethod); - locallab.llcurve = locallab.llcurve && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::llcurve); - locallab.cccurve = locallab.cccurve && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::cccurve); - locallab.LHcurve = locallab.LHcurve && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::LHcurve); - locallab.HHcurve = locallab.HHcurve && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::HHcurve); - locallab.invers = locallab.invers && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::invers); - // Exposure - locallab.expexpose = locallab.expexpose && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expexpose); - locallab.expcomp = locallab.expcomp && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expcomp); - locallab.hlcompr = locallab.hlcompr && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::hlcompr); - locallab.hlcomprthresh = locallab.hlcomprthresh && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::hlcomprthresh); - locallab.black = locallab.black && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::black); - locallab.shcompr = locallab.shcompr && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::shcompr); - locallab.warm = locallab.warm && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::warm); - locallab.sensiex = locallab.sensiex && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensiex); - locallab.excurve = locallab.excurve && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::excurve); - // Vibrance - locallab.expvibrance = locallab.expvibrance && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expvibrance); - locallab.saturated = locallab.saturated && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::saturated); - locallab.pastels = locallab.pastels && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::pastels); - locallab.psthreshold = locallab.psthreshold && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::psthreshold); - locallab.protectskins = locallab.protectskins && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::protectskins); - locallab.avoidcolorshift = locallab.avoidcolorshift && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::avoidcolorshift); - locallab.pastsattog = locallab.pastsattog && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::pastsattog); - locallab.sensiv = locallab.sensiv && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensiv); - locallab.skintonescurve = locallab.skintonescurve && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::skintonescurve); - // Blur & Noise - locallab.expblur = locallab.expblur && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expblur); - locallab.radius = locallab.radius && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::radius); - locallab.strength = locallab.strength && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::strength); - locallab.sensibn = locallab.sensibn && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensibn); - locallab.blurMethod = locallab.blurMethod && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::blurMethod); - locallab.activlum = locallab.activlum && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::activlum); - // Tone Mapping - locallab.exptonemap = locallab.exptonemap && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::exptonemap); - locallab.stren = locallab.stren && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::stren); - locallab.gamma = locallab.gamma && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::gamma); - locallab.estop = locallab.estop && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::estop); - locallab.scaltm = locallab.scaltm && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::scaltm); - locallab.rewei = locallab.rewei && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::rewei); - locallab.sensitm = locallab.sensitm && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensitm); - // Retinex - locallab.expreti = locallab.expreti && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expreti); - locallab.retinexMethod = locallab.retinexMethod && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::retinexMethod); - locallab.str = locallab.str && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::str); - locallab.chrrt = locallab.chrrt && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::chrrt); - locallab.neigh = locallab.neigh && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::neigh); - locallab.vart = locallab.vart && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::vart); - locallab.sensih = locallab.sensih && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensih); - locallab.localTgaincurve = locallab.localTgaincurve && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::localTgaincurve); - locallab.inversret = locallab.inversret && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::inversret); - // Sharpening - locallab.expsharp = locallab.expsharp && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expsharp); - locallab.sharradius = locallab.sharradius && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sharradius); - locallab.sharamount = locallab.sharamount && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sharamount); - locallab.shardamping = locallab.shardamping && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::shardamping); - locallab.shariter = locallab.shariter && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::shariter); - locallab.sensisha = locallab.sensisha && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensisha); - locallab.inverssha = locallab.inverssha && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::inverssha); - // Contrast by detail levels - locallab.expcbdl = locallab.expcbdl && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expcbdl); + if (locallab.nbspot) { + for (size_t j = 0; j < locallab.spots.size() && j < p.locallab.spots.size() && j < other.locallab.spots.size(); j++) { + const LocallabParams::LocallabSpot& pSpot = p.locallab.spots.at(j); + const LocallabParams::LocallabSpot& otherSpot = other.locallab.spots.at(j); + // Control spot settings + locallab.id = locallab.id && pSpot.id == otherSpot.id; + locallab.spots.at(j).name = locallab.spots.at(j).name && pSpot.name == otherSpot.name; + locallab.spots.at(j).isvisible = locallab.spots.at(j).isvisible && pSpot.isvisible == otherSpot.isvisible; + locallab.spots.at(j).shape = locallab.spots.at(j).shape && pSpot.shape == otherSpot.shape; + locallab.spots.at(j).spotMethod = locallab.spots.at(j).spotMethod && pSpot.spotMethod == otherSpot.spotMethod; + locallab.spots.at(j).sensiexclu = locallab.spots.at(j).sensiexclu && pSpot.sensiexclu == otherSpot.sensiexclu; + locallab.spots.at(j).struc = locallab.spots.at(j).struc && pSpot.struc == otherSpot.struc; + locallab.spots.at(j).shapeMethod = locallab.spots.at(j).shapeMethod && pSpot.shapeMethod == otherSpot.shapeMethod; + locallab.spots.at(j).locX = locallab.spots.at(j).locX && pSpot.locX == otherSpot.locX; + locallab.spots.at(j).locXL = locallab.spots.at(j).locXL && pSpot.locXL == otherSpot.locXL; + locallab.spots.at(j).locY = locallab.spots.at(j).locY && pSpot.locY == otherSpot.locY; + locallab.spots.at(j).locYT = locallab.spots.at(j).locYT && pSpot.locYT == otherSpot.locYT; + locallab.spots.at(j).centerX = locallab.spots.at(j).centerX && pSpot.centerX == otherSpot.centerX; + locallab.spots.at(j).centerY = locallab.spots.at(j).centerY && pSpot.centerY == otherSpot.centerY; + locallab.spots.at(j).circrad = locallab.spots.at(j).circrad && pSpot.circrad == otherSpot.circrad; + locallab.spots.at(j).qualityMethod = locallab.spots.at(j).qualityMethod && pSpot.qualityMethod == otherSpot.qualityMethod; + locallab.spots.at(j).transit = locallab.spots.at(j).transit && pSpot.transit == otherSpot.transit; + locallab.spots.at(j).thresh = locallab.spots.at(j).thresh && pSpot.thresh == otherSpot.thresh; + locallab.spots.at(j).iter = locallab.spots.at(j).iter && pSpot.iter == otherSpot.iter; + // Color & Light + locallab.spots.at(j).expcolor = locallab.spots.at(j).expcolor && pSpot.expcolor == otherSpot.expcolor; + locallab.spots.at(j).curvactiv = locallab.spots.at(j).curvactiv && pSpot.curvactiv == otherSpot.curvactiv; + locallab.spots.at(j).lightness = locallab.spots.at(j).lightness && pSpot.lightness == otherSpot.lightness; + locallab.spots.at(j).contrast = locallab.spots.at(j).contrast && pSpot.contrast == otherSpot.contrast; + locallab.spots.at(j).chroma = locallab.spots.at(j).chroma && pSpot.chroma == otherSpot.chroma; + locallab.spots.at(j).sensi = locallab.spots.at(j).sensi && pSpot.sensi == otherSpot.sensi; + locallab.spots.at(j).qualitycurveMethod = locallab.spots.at(j).qualitycurveMethod && pSpot.qualitycurveMethod == otherSpot.qualitycurveMethod; + locallab.spots.at(j).llcurve = locallab.spots.at(j).llcurve && pSpot.llcurve == otherSpot.llcurve; + locallab.spots.at(j).cccurve = locallab.spots.at(j).cccurve && pSpot.cccurve == otherSpot.cccurve; + locallab.spots.at(j).LHcurve = locallab.spots.at(j).LHcurve && pSpot.LHcurve == otherSpot.LHcurve; + locallab.spots.at(j).HHcurve = locallab.spots.at(j).HHcurve && pSpot.HHcurve == otherSpot.HHcurve; + locallab.spots.at(j).invers = locallab.spots.at(j).invers && pSpot.invers == otherSpot.invers; + // Exposure + locallab.spots.at(j).expexpose = locallab.spots.at(j).expexpose && pSpot.expexpose == otherSpot.expexpose; + locallab.spots.at(j).expcomp = locallab.spots.at(j).expcomp && pSpot.expcomp == otherSpot.expcomp; + locallab.spots.at(j).hlcompr = locallab.spots.at(j).hlcompr && pSpot.hlcompr == otherSpot.hlcompr; + locallab.spots.at(j).hlcomprthresh = locallab.spots.at(j).hlcomprthresh && pSpot.hlcomprthresh == otherSpot.hlcomprthresh; + locallab.spots.at(j).black = locallab.spots.at(j).black && pSpot.black == otherSpot.black; + locallab.spots.at(j).shcompr = locallab.spots.at(j).shcompr && pSpot.shcompr == otherSpot.shcompr; + locallab.spots.at(j).warm = locallab.spots.at(j).warm && pSpot.warm == otherSpot.warm; + locallab.spots.at(j).sensiex = locallab.spots.at(j).sensiex && pSpot.sensiex == otherSpot.sensiex; + locallab.spots.at(j).excurve = locallab.spots.at(j).excurve && pSpot.excurve == otherSpot.excurve; + // Vibrance + locallab.spots.at(j).expvibrance = locallab.spots.at(j).expvibrance && pSpot.expvibrance == otherSpot.expvibrance; + locallab.spots.at(j).saturated = locallab.spots.at(j).saturated && pSpot.saturated == otherSpot.saturated; + locallab.spots.at(j).pastels = locallab.spots.at(j).pastels && pSpot.pastels == otherSpot.pastels; + locallab.spots.at(j).psthreshold = locallab.spots.at(j).psthreshold && pSpot.psthreshold == otherSpot.psthreshold; + locallab.spots.at(j).protectskins = locallab.spots.at(j).protectskins && pSpot.protectskins == otherSpot.protectskins; + locallab.spots.at(j).avoidcolorshift = locallab.spots.at(j).avoidcolorshift && pSpot.avoidcolorshift == otherSpot.avoidcolorshift; + locallab.spots.at(j).pastsattog = locallab.spots.at(j).pastsattog && pSpot.pastsattog == otherSpot.pastsattog; + locallab.spots.at(j).sensiv = locallab.spots.at(j).sensiv && pSpot.sensiv == otherSpot.sensiv; + locallab.spots.at(j).skintonescurve = locallab.spots.at(j).skintonescurve && pSpot.skintonescurve == otherSpot.skintonescurve; + // Blur & Noise + locallab.spots.at(j).expblur = locallab.spots.at(j).expblur && pSpot.expblur == otherSpot.expblur; + locallab.spots.at(j).radius = locallab.spots.at(j).radius && pSpot.radius == otherSpot.radius; + locallab.spots.at(j).strength = locallab.spots.at(j).strength && pSpot.strength == otherSpot.strength; + locallab.spots.at(j).sensibn = locallab.spots.at(j).sensibn && pSpot.sensibn == otherSpot.sensibn; + locallab.spots.at(j).blurMethod = locallab.spots.at(j).blurMethod && pSpot.blurMethod == otherSpot.blurMethod; + locallab.spots.at(j).activlum = locallab.spots.at(j).activlum && pSpot.activlum == otherSpot.activlum; + // Tone Mapping + locallab.spots.at(j).exptonemap = locallab.spots.at(j).exptonemap && pSpot.exptonemap == otherSpot.exptonemap; + locallab.spots.at(j).stren = locallab.spots.at(j).stren && pSpot.stren == otherSpot.stren; + locallab.spots.at(j).gamma = locallab.spots.at(j).gamma && pSpot.gamma == otherSpot.gamma; + locallab.spots.at(j).estop = locallab.spots.at(j).estop && pSpot.estop == otherSpot.estop; + locallab.spots.at(j).scaltm = locallab.spots.at(j).scaltm && pSpot.scaltm == otherSpot.scaltm; + locallab.spots.at(j).rewei = locallab.spots.at(j).rewei && pSpot.rewei == otherSpot.rewei; + locallab.spots.at(j).sensitm = locallab.spots.at(j).sensitm && pSpot.sensitm == otherSpot.sensitm; + // Retinex + locallab.spots.at(j).expreti = locallab.spots.at(j).expreti && pSpot.expreti == otherSpot.expreti; + locallab.spots.at(j).retinexMethod = locallab.spots.at(j).retinexMethod && pSpot.retinexMethod == otherSpot.retinexMethod; + locallab.spots.at(j).str = locallab.spots.at(j).str && pSpot.str == otherSpot.str; + locallab.spots.at(j).chrrt = locallab.spots.at(j).chrrt && pSpot.chrrt == otherSpot.chrrt; + locallab.spots.at(j).neigh = locallab.spots.at(j).neigh && pSpot.neigh == otherSpot.neigh; + locallab.spots.at(j).vart = locallab.spots.at(j).vart && pSpot.vart == otherSpot.vart; + locallab.spots.at(j).sensih = locallab.spots.at(j).sensih && pSpot.sensih == otherSpot.sensih; + locallab.spots.at(j).localTgaincurve = locallab.spots.at(j).localTgaincurve && pSpot.localTgaincurve == otherSpot.localTgaincurve; + locallab.spots.at(j).inversret = locallab.spots.at(j).inversret &&pSpot.inversret == otherSpot.inversret; + // Sharpening + locallab.spots.at(j).expsharp = locallab.spots.at(j).expsharp && pSpot.expsharp == otherSpot.expsharp; + locallab.spots.at(j).sharradius = locallab.spots.at(j).sharradius && pSpot.sharradius == otherSpot.sharradius; + locallab.spots.at(j).sharamount = locallab.spots.at(j).sharamount && pSpot.sharamount == otherSpot.sharamount; + locallab.spots.at(j).shardamping = locallab.spots.at(j).shardamping && pSpot.shardamping == otherSpot.shardamping; + locallab.spots.at(j).shariter = locallab.spots.at(j).shariter && pSpot.shariter == otherSpot.shariter; + locallab.spots.at(j).sensisha = locallab.spots.at(j).sensisha && pSpot.sensisha == otherSpot.sensisha; + locallab.spots.at(j).inverssha = locallab.spots.at(j).inverssha && pSpot.inverssha == otherSpot.inverssha; + // Contrast by detail levels + locallab.spots.at(j).expcbdl = locallab.spots.at(j).expcbdl && pSpot.expcbdl == otherSpot.expcbdl; - for (int i = 0; i < 5; i++) { - locallab.mult[i] = locallab.mult[i] && p.locallab.compareSpotsByElemArray(otherSpots, &LocallabParams::LocallabSpot::mult, i); + for (int k = 0; k < 5; k++) { + locallab.spots.at(j).mult[k] = locallab.spots.at(j).mult[k] && pSpot.mult[k] == otherSpot.mult[k]; + } + + locallab.spots.at(j).chromacbdl = locallab.spots.at(j).chromacbdl && pSpot.chromacbdl == otherSpot.chromacbdl; + locallab.spots.at(j).threshold = locallab.spots.at(j).threshold && pSpot.threshold == otherSpot.threshold; + locallab.spots.at(j).sensicb = locallab.spots.at(j).sensicb && pSpot.sensicb == otherSpot.sensicb; + // Denoise + locallab.spots.at(j).expdenoi = locallab.spots.at(j).expdenoi && pSpot.expdenoi == otherSpot.expdenoi; + locallab.spots.at(j).noiselumf = locallab.spots.at(j).noiselumf && pSpot.noiselumf == otherSpot.noiselumf; + locallab.spots.at(j).noiselumc = locallab.spots.at(j).noiselumc && pSpot.noiselumc == otherSpot.noiselumc; + locallab.spots.at(j).noiselumdetail = locallab.spots.at(j).noiselumdetail && pSpot.noiselumdetail == otherSpot.noiselumdetail; + locallab.spots.at(j).noiselequal = locallab.spots.at(j).noiselequal && pSpot.noiselequal == otherSpot.noiselequal; + locallab.spots.at(j).noisechrof = locallab.spots.at(j).noisechrof && pSpot.noisechrof == otherSpot.noisechrof; + locallab.spots.at(j).noisechroc = locallab.spots.at(j).noisechroc && pSpot.noisechroc == otherSpot.noisechroc; + locallab.spots.at(j).noisechrodetail = locallab.spots.at(j).noisechrodetail && pSpot.noisechrodetail == otherSpot.noisechrodetail; + locallab.spots.at(j).adjblur = locallab.spots.at(j).adjblur && pSpot.adjblur == otherSpot.adjblur; + locallab.spots.at(j).bilateral = locallab.spots.at(j).bilateral && pSpot.bilateral == otherSpot.bilateral; + locallab.spots.at(j).sensiden = locallab.spots.at(j).sensiden && pSpot.sensiden == otherSpot.sensiden; + // Others + locallab.spots.at(j).avoid = locallab.spots.at(j).avoid && pSpot.avoid == otherSpot.avoid; + } } - locallab.chromacbdl = locallab.chromacbdl && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::chromacbdl); - locallab.threshold = locallab.threshold && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::threshold); - locallab.sensicb = locallab.sensicb && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensicb); - // Denoise - locallab.expdenoi = locallab.expdenoi && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::expdenoi); - locallab.noiselumf = locallab.noiselumf && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::noiselumf); - locallab.noiselumc = locallab.noiselumc && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::noiselumc); - locallab.noiselumdetail = locallab.noiselumdetail && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::noiselumdetail); - locallab.noiselequal = locallab.noiselequal && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::noiselequal); - locallab.noisechrof = locallab.noisechrof && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::noisechrof); - locallab.noisechroc = locallab.noisechroc && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::noisechroc); - locallab.noisechrodetail = locallab.noisechrodetail && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::noisechrodetail); - locallab.adjblur = locallab.adjblur && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::adjblur); - locallab.bilateral = locallab.bilateral && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::bilateral); - locallab.sensiden = locallab.sensiden && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::sensiden); - // Others - locallab.avoid = locallab.avoid && p.locallab.compareSpotsByElem(otherSpots, &LocallabParams::LocallabSpot::avoid); + if (!locallab.nbspot || !locallab.id) { + // locallab.id and locallab.spots are set to false because cannot be combined + locallab.id = false; + locallab.spots.clear(); + locallab.spots.resize(p.locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(false)); + } pcvignette.enabled = pcvignette.enabled && p.pcvignette.enabled == other.pcvignette.enabled; pcvignette.strength = pcvignette.strength && p.pcvignette.strength == other.pcvignette.strength; @@ -2477,408 +2388,424 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.enabled = mods.locallab.enabled; } - if (locallab.nbspot) { + if (locallab.nbspot || locallab.id) { // For locallab to work, id order needs to be maintained when adding or deleting spots + // Saving toEdit locallab temporarily + LocallabParams tmpLocallab = toEdit.locallab; + + // Removing all spots in toEdit and recreating spots based on mods id + toEdit.locallab.spots.clear(); + for (size_t i = 0; i < mods.locallab.spots.size(); i++) { + LocallabParams::LocallabSpot *newSpot = new LocallabParams::LocallabSpot(); + newSpot->id = mods.locallab.spots.at(i).id; + toEdit.locallab.spots.push_back(*newSpot); + } + + // Common spots in tmpLocallab and mods are restored in toEdit + for (size_t i = 0; i < toEdit.locallab.spots.size(); i++) { + for (size_t j = 0; j < tmpLocallab.spots.size(); j++) { + if (toEdit.locallab.spots.at(i).id == tmpLocallab.spots.at(j).id) { + toEdit.locallab.spots.at(i) = tmpLocallab.spots.at(j); + } + } + } + + // Updating nbspot accordingly toEdit.locallab.nbspot = mods.locallab.nbspot; - toEdit.locallab.spots.resize(toEdit.locallab.nbspot); } if (locallab.selspot) { toEdit.locallab.selspot = mods.locallab.selspot; } - const std::vector& modsSpots = mods.locallab.spots; - - // Control spot settings - if (locallab.id) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::id); - } - - if (locallab.name) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::name); - } - - if (locallab.isvisible) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::isvisible); - } - - if (locallab.shape) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::shape); - } - - if (locallab.spotMethod) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::spotMethod); - } - - if (locallab.sensiexclu) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensiexclu); - } - - if (locallab.struc) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::struc); - } - - if (locallab.shapeMethod) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::shapeMethod); - } - - if (locallab.locX) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::locX); - } - - if (locallab.locXL) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::locXL); - } - - if (locallab.locY) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::locY); - } - - if (locallab.locYT) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::locYT); - } - - if (locallab.centerX) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::centerX); - } - - if (locallab.centerY) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::centerY); - } - - if (locallab.circrad) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::circrad); - } - - if (locallab.qualityMethod) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::qualityMethod); - } - - if (locallab.transit) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::transit); - } - - if (locallab.thresh) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::thresh); - } - - if (locallab.iter) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::iter); - } - - // Color & Light - if (locallab.expcolor) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expcolor); - } - - if (locallab.curvactiv) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::curvactiv); - } - - if (locallab.lightness) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::lightness); - } - - if (locallab.contrast) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::contrast); - } - - if (locallab.chroma) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::chroma); - } - - if (locallab.sensi) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensi); - } - - if (locallab.qualitycurveMethod) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::qualitycurveMethod); - } - - if (locallab.llcurve) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::llcurve); - } - - if (locallab.cccurve) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::cccurve); - } - - if (locallab.LHcurve) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::LHcurve); - } - - if (locallab.HHcurve) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::HHcurve); - } - - if (locallab.invers) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::invers); - } - - // Exposure - if (locallab.expexpose) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expexpose); - } - - if (locallab.expcomp) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expcomp); - } - - if (locallab.hlcompr) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::hlcompr); - } - - if (locallab.hlcomprthresh) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::hlcomprthresh); - } - - if (locallab.black) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::black); - } - - if (locallab.shcompr) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::shcompr); - } - - if (locallab.warm) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::warm); - } - - if (locallab.sensiex) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensiex); - } - - if (locallab.excurve) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::excurve); - } - - // Vibrance - if (locallab.expvibrance) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expvibrance); - } - - if (locallab.saturated) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::saturated); - } - - if (locallab.pastels) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::pastels); - } - - if (locallab.psthreshold) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::psthreshold); - } - - if (locallab.protectskins) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::protectskins); - } - - if (locallab.avoidcolorshift) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::avoidcolorshift); - } - - if (locallab.pastsattog) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::pastsattog); - } - - if (locallab.sensiv) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensiv); - } - - if (locallab.skintonescurve) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::skintonescurve); - } - - // Blur & Noise - if (locallab.expblur) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expblur); - } - - if (locallab.radius) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::radius); - } - - if (locallab.strength) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::strength); - } - - if (locallab.sensibn) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensibn); - } - - if (locallab.blurMethod) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::blurMethod); - } - - if (locallab.activlum) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::activlum); - } - - // Tone Mapping - if (locallab.exptonemap) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::exptonemap); - } - - if (locallab.stren) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::stren); - } - - if (locallab.gamma) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::gamma); - } - - if (locallab.estop) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::estop); - } - - if (locallab.scaltm) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::scaltm); - } - - if (locallab.rewei) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::rewei); - } - - if (locallab.sensitm) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensitm); - } - - // Retinex - if (locallab.expreti) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expreti); - } - - if (locallab.retinexMethod) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::retinexMethod); - } - - if (locallab.str) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::str); - } - - if (locallab.chrrt) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::chrrt); - } - - if (locallab.neigh) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::neigh); - } - - if (locallab.vart) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::vart); - } - - if (locallab.sensih) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensih); - } - - if (locallab.localTgaincurve) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::localTgaincurve); - } - - if (locallab.inversret) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::inversret); - } - - // Sharpening - if (locallab.expsharp) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expsharp); - } - - if (locallab.sharradius) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sharradius); - } - - if (locallab.sharamount) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sharamount); - } - - if (locallab.shardamping) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::shardamping); - } - - if (locallab.shariter) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::shariter); - } - - if (locallab.sensisha) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensisha); - } - - if (locallab.inverssha) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::inverssha); - } - - // Contrast by detail levels - if (locallab.expcbdl) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expcbdl); - } - - for (int i = 0; i < 5; i++) { - if (locallab.mult[i]) { - toEdit.locallab.setSpotsByElemArray(modsSpots, &LocallabParams::LocallabSpot::mult, i); + for (size_t i = 0; i < toEdit.locallab.spots.size() && i < mods.locallab.spots.size() && i < locallab.spots.size(); i++) { + // Control spot settings + if (locallab.spots.at(i).name) { + toEdit.locallab.spots.at(i).name = mods.locallab.spots.at(i).name; } - } - if (locallab.chromacbdl) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::chromacbdl); - } + if (locallab.spots.at(i).isvisible) { + toEdit.locallab.spots.at(i).isvisible = mods.locallab.spots.at(i).isvisible; + } - if (locallab.threshold) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::threshold); - } + if (locallab.spots.at(i).shape) { + toEdit.locallab.spots.at(i).shape = mods.locallab.spots.at(i).shape; + } - if (locallab.sensicb) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensicb); - } + if (locallab.spots.at(i).spotMethod) { + toEdit.locallab.spots.at(i).spotMethod = mods.locallab.spots.at(i).spotMethod; + } - // Denoise - if (locallab.expdenoi) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::expdenoi); - } + if (locallab.spots.at(i).sensiexclu) { + toEdit.locallab.spots.at(i).sensiexclu = mods.locallab.spots.at(i).sensiexclu; + } - if (locallab.noiselumf) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::noiselumf); - } + if (locallab.spots.at(i).struc) { + toEdit.locallab.spots.at(i).struc = mods.locallab.spots.at(i).struc; + } - if (locallab.noiselumc) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::noiselumc); - } + if (locallab.spots.at(i).shapeMethod) { + toEdit.locallab.spots.at(i).shapeMethod = mods.locallab.spots.at(i).shapeMethod; + } - if (locallab.noiselumdetail) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::noiselumdetail); - } + if (locallab.spots.at(i).locX) { + toEdit.locallab.spots.at(i).locX = mods.locallab.spots.at(i).locX; + } - if (locallab.noiselequal) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::noiselequal); - } + if (locallab.spots.at(i).locXL) { + toEdit.locallab.spots.at(i).locXL = mods.locallab.spots.at(i).locXL; + } - if (locallab.noisechrof) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::noisechrof); - } + if (locallab.spots.at(i).locY) { + toEdit.locallab.spots.at(i).locY = mods.locallab.spots.at(i).locY; + } - if (locallab.noisechroc) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::noisechroc); - } + if (locallab.spots.at(i).locYT) { + toEdit.locallab.spots.at(i).locYT = mods.locallab.spots.at(i).locYT; + } - if (locallab.noisechrodetail) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::noisechrodetail); - } + if (locallab.spots.at(i).centerX) { + toEdit.locallab.spots.at(i).centerX = mods.locallab.spots.at(i).centerX; + } - if (locallab.adjblur) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::adjblur); - } + if (locallab.spots.at(i).centerY) { + toEdit.locallab.spots.at(i).centerY = mods.locallab.spots.at(i).centerY; + } - if (locallab.bilateral) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::bilateral); - } + if (locallab.spots.at(i).circrad) { + toEdit.locallab.spots.at(i).circrad = mods.locallab.spots.at(i).circrad; + } - if (locallab.sensiden) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::sensiden); - } + if (locallab.spots.at(i).qualityMethod) { + toEdit.locallab.spots.at(i).qualityMethod = mods.locallab.spots.at(i).qualityMethod; + } - // Others - if (locallab.avoid) { - toEdit.locallab.setSpotsByElem(modsSpots, &LocallabParams::LocallabSpot::avoid); + if (locallab.spots.at(i).transit) { + toEdit.locallab.spots.at(i).transit = mods.locallab.spots.at(i).transit; + } + + if (locallab.spots.at(i).thresh) { + toEdit.locallab.spots.at(i).thresh = mods.locallab.spots.at(i).thresh; + } + + if (locallab.spots.at(i).iter) { + toEdit.locallab.spots.at(i).iter = mods.locallab.spots.at(i).iter; + } + + // Color & Light + if (locallab.spots.at(i).expcolor) { + toEdit.locallab.spots.at(i).expcolor = mods.locallab.spots.at(i).expcolor; + } + + if (locallab.spots.at(i).curvactiv) { + toEdit.locallab.spots.at(i).curvactiv = mods.locallab.spots.at(i).curvactiv; + } + + if (locallab.spots.at(i).lightness) { + toEdit.locallab.spots.at(i).lightness = mods.locallab.spots.at(i).lightness; + } + + if (locallab.spots.at(i).contrast) { + toEdit.locallab.spots.at(i).contrast = mods.locallab.spots.at(i).contrast; + } + + if (locallab.spots.at(i).chroma) { + toEdit.locallab.spots.at(i).chroma = mods.locallab.spots.at(i).chroma; + } + + if (locallab.spots.at(i).sensi) { + toEdit.locallab.spots.at(i).sensi = mods.locallab.spots.at(i).sensi; + } + + if (locallab.spots.at(i).qualitycurveMethod) { + toEdit.locallab.spots.at(i).qualitycurveMethod = mods.locallab.spots.at(i).qualitycurveMethod; + } + + if (locallab.spots.at(i).llcurve) { + toEdit.locallab.spots.at(i).llcurve = mods.locallab.spots.at(i).llcurve; + } + + if (locallab.spots.at(i).cccurve) { + toEdit.locallab.spots.at(i).cccurve = mods.locallab.spots.at(i).cccurve; + } + + if (locallab.spots.at(i).LHcurve) { + toEdit.locallab.spots.at(i).LHcurve = mods.locallab.spots.at(i).LHcurve; + } + + if (locallab.spots.at(i).HHcurve) { + toEdit.locallab.spots.at(i).HHcurve = mods.locallab.spots.at(i).HHcurve; + } + + if (locallab.spots.at(i).invers) { + toEdit.locallab.spots.at(i).invers = mods.locallab.spots.at(i).invers; + } + + // Exposure + if (locallab.spots.at(i).expexpose) { + toEdit.locallab.spots.at(i).expexpose = mods.locallab.spots.at(i).expexpose; + } + + if (locallab.spots.at(i).expcomp) { + toEdit.locallab.spots.at(i).expcomp = mods.locallab.spots.at(i).expcomp; + } + + if (locallab.spots.at(i).hlcompr) { + toEdit.locallab.spots.at(i).hlcompr = mods.locallab.spots.at(i).hlcompr; + } + + if (locallab.spots.at(i).hlcomprthresh) { + toEdit.locallab.spots.at(i).hlcomprthresh = mods.locallab.spots.at(i).hlcomprthresh; + } + + if (locallab.spots.at(i).black) { + toEdit.locallab.spots.at(i).black = mods.locallab.spots.at(i).black; + } + + if (locallab.spots.at(i).shcompr) { + toEdit.locallab.spots.at(i).shcompr = mods.locallab.spots.at(i).shcompr; + } + + if (locallab.spots.at(i).warm) { + toEdit.locallab.spots.at(i).warm = mods.locallab.spots.at(i).warm; + } + + if (locallab.spots.at(i).sensiex) { + toEdit.locallab.spots.at(i).sensiex = mods.locallab.spots.at(i).sensiex; + } + + if (locallab.spots.at(i).excurve) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + // Vibrance + if (locallab.spots.at(i).expvibrance) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).saturated) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).pastels) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).psthreshold) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).protectskins) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).avoidcolorshift) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).pastsattog) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).sensiv) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).skintonescurve) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + // Blur & Noise + if (locallab.spots.at(i).expblur) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).radius) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).strength) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).sensibn) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).blurMethod) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + if (locallab.spots.at(i).activlum) { + toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; + } + + // Tone Mapping + if (locallab.spots.at(i).exptonemap) { + toEdit.locallab.spots.at(i).exptonemap = mods.locallab.spots.at(i).exptonemap; + } + + if (locallab.spots.at(i).stren) { + toEdit.locallab.spots.at(i).stren = mods.locallab.spots.at(i).stren; + } + + if (locallab.spots.at(i).gamma) { + toEdit.locallab.spots.at(i).gamma = mods.locallab.spots.at(i).gamma; + } + + if (locallab.spots.at(i).estop) { + toEdit.locallab.spots.at(i).estop = mods.locallab.spots.at(i).estop; + } + + if (locallab.spots.at(i).scaltm) { + toEdit.locallab.spots.at(i).scaltm = mods.locallab.spots.at(i).scaltm; + } + + if (locallab.spots.at(i).rewei) { + toEdit.locallab.spots.at(i).rewei = mods.locallab.spots.at(i).rewei; + } + + if (locallab.spots.at(i).sensitm) { + toEdit.locallab.spots.at(i).sensitm = mods.locallab.spots.at(i).sensitm; + } + + // Retinex + if (locallab.spots.at(i).expreti) { + toEdit.locallab.spots.at(i).expreti = mods.locallab.spots.at(i).expreti; + } + + if (locallab.spots.at(i).retinexMethod) { + toEdit.locallab.spots.at(i).retinexMethod = mods.locallab.spots.at(i).retinexMethod; + } + + if (locallab.spots.at(i).str) { + toEdit.locallab.spots.at(i).str = mods.locallab.spots.at(i).str; + } + + if (locallab.spots.at(i).chrrt) { + toEdit.locallab.spots.at(i).chrrt = mods.locallab.spots.at(i).chrrt; + } + + if (locallab.spots.at(i).neigh) { + toEdit.locallab.spots.at(i).neigh = mods.locallab.spots.at(i).neigh; + } + + if (locallab.spots.at(i).vart) { + toEdit.locallab.spots.at(i).vart = mods.locallab.spots.at(i).vart; + } + + if (locallab.spots.at(i).sensih) { + toEdit.locallab.spots.at(i).sensih = mods.locallab.spots.at(i).sensih; + } + + if (locallab.spots.at(i).localTgaincurve) { + toEdit.locallab.spots.at(i).localTgaincurve = mods.locallab.spots.at(i).localTgaincurve; + } + + if (locallab.spots.at(i).inversret) { + toEdit.locallab.spots.at(i).inversret = mods.locallab.spots.at(i).inversret; + } + + // Sharpening + if (locallab.spots.at(i).expsharp) { + toEdit.locallab.spots.at(i).expsharp = mods.locallab.spots.at(i).expsharp; + } + + if (locallab.spots.at(i).sharradius) { + toEdit.locallab.spots.at(i).sharradius = mods.locallab.spots.at(i).sharradius; + } + + if (locallab.spots.at(i).sharamount) { + toEdit.locallab.spots.at(i).sharamount = mods.locallab.spots.at(i).sharamount; + } + + if (locallab.spots.at(i).shardamping) { + toEdit.locallab.spots.at(i).shardamping = mods.locallab.spots.at(i).shardamping; + } + + if (locallab.spots.at(i).shariter) { + toEdit.locallab.spots.at(i).shariter = mods.locallab.spots.at(i).shariter; + } + + if (locallab.spots.at(i).sensisha) { + toEdit.locallab.spots.at(i).sensisha = mods.locallab.spots.at(i).sensisha; + } + + if (locallab.spots.at(i).inverssha) { + toEdit.locallab.spots.at(i).inverssha = mods.locallab.spots.at(i).inverssha; + } + + // Contrast by detail levels + if (locallab.spots.at(i).expcbdl) { + toEdit.locallab.spots.at(i).expcbdl = mods.locallab.spots.at(i).expcbdl; + } + + for (int j = 0; j < 5; j++) { + if (locallab.spots.at(i).mult[j]) { + toEdit.locallab.spots.at(i).mult[j] = mods.locallab.spots.at(i).mult[j]; + } + } + + if (locallab.spots.at(i).chromacbdl) { + toEdit.locallab.spots.at(i).chromacbdl = mods.locallab.spots.at(i).chromacbdl; + } + + if (locallab.spots.at(i).threshold) { + toEdit.locallab.spots.at(i).threshold = mods.locallab.spots.at(i).threshold; + } + + if (locallab.spots.at(i).sensicb) { + toEdit.locallab.spots.at(i).sensicb = mods.locallab.spots.at(i).sensicb; + } + + // Denoise + if (locallab.spots.at(i).expdenoi) { + toEdit.locallab.spots.at(i).expdenoi = mods.locallab.spots.at(i).expdenoi; + } + + if (locallab.spots.at(i).noiselumf) { + toEdit.locallab.spots.at(i).noiselumf = mods.locallab.spots.at(i).noiselumf; + } + + if (locallab.spots.at(i).noiselumc) { + toEdit.locallab.spots.at(i).noiselumc = mods.locallab.spots.at(i).noiselumc; + } + + if (locallab.spots.at(i).noiselumdetail) { + toEdit.locallab.spots.at(i).noiselumdetail = mods.locallab.spots.at(i).noiselumdetail; + } + + if (locallab.spots.at(i).noiselequal) { + toEdit.locallab.spots.at(i).noiselequal = mods.locallab.spots.at(i).noiselequal; + } + + if (locallab.spots.at(i).noisechrof) { + toEdit.locallab.spots.at(i).noisechrof = mods.locallab.spots.at(i).noisechrof; + } + + if (locallab.spots.at(i).noisechroc) { + toEdit.locallab.spots.at(i).noisechroc = mods.locallab.spots.at(i).noisechroc; + } + + if (locallab.spots.at(i).noisechrodetail) { + toEdit.locallab.spots.at(i).noisechrodetail = mods.locallab.spots.at(i).noisechrodetail; + } + + if (locallab.spots.at(i).adjblur) { + toEdit.locallab.spots.at(i).adjblur = mods.locallab.spots.at(i).adjblur; + } + + if (locallab.spots.at(i).bilateral) { + toEdit.locallab.spots.at(i).bilateral = mods.locallab.spots.at(i).bilateral; + } + + if (locallab.spots.at(i).sensiden) { + toEdit.locallab.spots.at(i).sensiden = mods.locallab.spots.at(i).sensiden; + } + + // Others + if (locallab.spots.at(i).avoid) { + toEdit.locallab.spots.at(i).avoid = mods.locallab.spots.at(i).avoid; + } } @@ -3794,3 +3721,224 @@ bool RetinexParamsEdited::isUnchanged() const { return enabled && retinexcolorspace && gammaretinex && gam && slope; } + +LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : + // Control spot settings + name(v), + isvisible(v), + shape(v), + spotMethod(v), + sensiexclu(v), + struc(v), + shapeMethod(v), + locX(v), + locXL(v), + locY(v), + locYT(v), + centerX(v), + centerY(v), + circrad(v), + qualityMethod(v), + transit(v), + thresh(v), + iter(v), + // Color & Light + expcolor(v), + curvactiv(v), + lightness(v), + contrast(v), + chroma(v), + sensi(v), + qualitycurveMethod(v), + llcurve(v), + cccurve(v), + LHcurve(v), + HHcurve(v), + invers(v), + // Exposure + expexpose(v), + expcomp(v), + hlcompr(v), + hlcomprthresh(v), + black(v), + shcompr(v), + warm(v), + sensiex(v), + excurve(v), + // Vibrance + expvibrance(v), + saturated(v), + pastels(v), + psthreshold(v), + protectskins(v), + avoidcolorshift(v), + pastsattog(v), + sensiv(v), + skintonescurve(v), + // Blur & Noise + expblur(v), + radius(v), + strength(v), + sensibn(v), + blurMethod(v), + activlum(v), + // Tone Mapping + exptonemap(v), + stren(v), + gamma(v), + estop(v), + scaltm(v), + rewei(v), + sensitm(v), + // Retinex + expreti(v), + retinexMethod(v), + str(v), + chrrt(v), + neigh(v), + vart(v), + sensih(v), + localTgaincurve(v), + inversret(v), + // Sharpening + expsharp(v), + sharradius(v), + sharamount(v), + shardamping(v), + shariter(v), + sensisha(v), + inverssha(v), + // Contrast by detail levels + expcbdl(v), + mult{v, v, v, v, v}, + chromacbdl(v), + threshold(v), + sensicb(v), + // Denoise + expdenoi(v), + noiselumf(v), + noiselumc(v), + noiselumdetail(v), + noiselequal(v), + noisechrof(v), + noisechroc(v), + noisechrodetail(v), + adjblur(v), + bilateral(v), + sensiden(v), + // Others + avoid(v) +{ +} + +void LocallabParamsEdited::LocallabSpotEdited::set(bool v) +{ + name = v; + isvisible = v; + shape = v; + spotMethod = v; + sensiexclu = v; + struc = v; + shapeMethod = v; + locX = v; + locXL = v; + locY = v; + locYT = v; + centerX = v; + centerY = v; + circrad = v; + qualityMethod = v; + transit = v; + thresh = v; + iter = v; + // Color & Light + expcolor = v; + curvactiv = v; + lightness = v; + contrast = v; + chroma = v; + sensi = v; + qualitycurveMethod = v; + llcurve = v; + cccurve = v; + LHcurve = v; + HHcurve = v; + invers = v; + // Exposure + expexpose = v; + expcomp = v; + hlcompr = v; + hlcomprthresh = v; + black = v; + shcompr = v; + warm = v; + sensiex = v; + excurve = v; + // Vibrance + expvibrance = v; + saturated = v; + pastels = v; + psthreshold = v; + protectskins = v; + avoidcolorshift = v; + pastsattog = v; + sensiv = v; + skintonescurve = v; + // Blur & Noise + expblur = v; + radius = v; + strength = v; + sensibn = v; + blurMethod = v; + activlum = v; + // Tone Mapping + exptonemap = v; + stren = v; + gamma = v; + estop = v; + scaltm = v; + rewei = v; + sensitm = v; + // Retinex + expreti = v; + retinexMethod = v; + str = v; + chrrt = v; + neigh = v; + vart = v; + sensih = v; + localTgaincurve = v; + inversret = v; + // Sharpening + expsharp = v; + sharradius = v; + sharamount = v; + shardamping = v; + shariter = v; + sensisha = v; + inverssha = v; + // Contrast by detail levels + expcbdl = v; + + for (int i = 0; i < 5; i++) { + mult[i] = v; + } + + chromacbdl = v; + threshold = v; + sensicb = v; + // Denoise + expdenoi = v; + noiselumf = v; + noiselumc = v; + noiselumdetail = v; + noiselequal = v; + noisechrof = v; + noisechroc = v; + noisechrodetail = v; + adjblur = v; + bilateral = v; + sensiden = v; + // Others + avoid = v; +} diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 5450fa77b..0ba2b12db 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -457,115 +457,123 @@ public: class LocallabParamsEdited { public: + struct LocallabSpotEdited { + // Control spot settings + bool name; + bool isvisible; + bool shape; + bool spotMethod; + bool sensiexclu; + bool struc; + bool shapeMethod; + bool locX; + bool locXL; + bool locY; + bool locYT; + bool centerX; + bool centerY; + bool circrad; + bool qualityMethod; + bool transit; + bool thresh; + bool iter; + // Color & Light + bool expcolor; + bool curvactiv; + bool lightness; + bool contrast; + bool chroma; + bool sensi; + bool qualitycurveMethod; + bool llcurve; + bool cccurve; + bool LHcurve; + bool HHcurve; + bool invers; + // Exposure + bool expexpose; + bool expcomp; + bool hlcompr; + bool hlcomprthresh; + bool black; + bool shcompr; + bool warm; + bool sensiex; + bool excurve; + // Vibrance + bool expvibrance; + bool saturated; + bool pastels; + bool psthreshold; + bool protectskins; + bool avoidcolorshift; + bool pastsattog; + bool sensiv; + bool skintonescurve; + // Blur & Noise + bool expblur; + bool radius; + bool strength; + bool sensibn; + bool blurMethod; + bool activlum; + // Tone Mapping + bool exptonemap; + bool stren; + bool gamma; + bool estop; + bool scaltm; + bool rewei; + bool sensitm; + // Retinex + bool expreti; + bool retinexMethod; + bool str; + bool chrrt; + bool neigh; + bool vart; + bool sensih; + bool localTgaincurve; + bool inversret; + // Sharpening + bool expsharp; + bool sharradius; + bool sharamount; + bool shardamping; + bool shariter; + bool sensisha; + bool inverssha; + // Contrast by detail levels + bool expcbdl; + bool mult[5]; + bool chromacbdl; + bool threshold; + bool sensicb; + // Denoise + bool expdenoi; + bool noiselumf; + bool noiselumc; + bool noiselumdetail; + bool noiselequal; + bool noisechrof; + bool noisechroc; + bool noisechrodetail; + bool adjblur; + bool bilateral; + bool sensiden; + // Others + bool avoid; + + LocallabSpotEdited(bool v); + + void set(bool v); + }; + bool enabled; bool nbspot; bool selspot; - // Control spot settings bool id; - bool name; - bool isvisible; - bool shape; - bool spotMethod; - bool sensiexclu; - bool struc; - bool shapeMethod; - bool locX; - bool locXL; - bool locY; - bool locYT; - bool centerX; - bool centerY; - bool circrad; - bool qualityMethod; - bool transit; - bool thresh; - bool iter; - // Color & Light - bool expcolor; - bool curvactiv; - bool lightness; - bool contrast; - bool chroma; - bool sensi; - bool qualitycurveMethod; - bool llcurve; - bool cccurve; - bool LHcurve; - bool HHcurve; - bool invers; - // Exposure - bool expexpose; - bool expcomp; - bool hlcompr; - bool hlcomprthresh; - bool black; - bool shcompr; - bool warm; - bool sensiex; - bool excurve; - // Vibrance - bool expvibrance; - bool saturated; - bool pastels; - bool psthreshold; - bool protectskins; - bool avoidcolorshift; - bool pastsattog; - bool sensiv; - bool skintonescurve; - // Blur & Noise - bool expblur; - bool radius; - bool strength; - bool sensibn; - bool blurMethod; - bool activlum; - // Tone Mapping - bool exptonemap; - bool stren; - bool gamma; - bool estop; - bool scaltm; - bool rewei; - bool sensitm; - // Retinex - bool expreti; - bool retinexMethod; - bool str; - bool chrrt; - bool neigh; - bool vart; - bool sensih; - bool localTgaincurve; - bool inversret; - // Sharpening - bool expsharp; - bool sharradius; - bool sharamount; - bool shardamping; - bool shariter; - bool sensisha; - bool inverssha; - // Contrast by detail levels - bool expcbdl; - bool mult[5]; - bool chromacbdl; - bool threshold; - bool sensicb; - // Denoise - bool expdenoi; - bool noiselumf; - bool noiselumc; - bool noiselumdetail; - bool noiselequal; - bool noisechrof; - bool noisechroc; - bool noisechrodetail; - bool adjblur; - bool bilateral; - bool sensiden; - // Others - bool avoid; + std::vector spots; }; class LensProfParamsEdited diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 95c380df7..8fbf47e39 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -422,6 +422,7 @@ void PartialPasteDlg::everythingToggled () ConnectionBlocker metaBlocker(metaConn); ConnectionBlocker rawBlocker(rawConn); ConnectionBlocker advancedBlocker(advancedConn); + ConnectionBlocker locallabBlocker(locallabConn); everything->set_inconsistent (false); @@ -434,6 +435,7 @@ void PartialPasteDlg::everythingToggled () meta->set_active(everything->get_active()); raw->set_active(everything->get_active()); advanced->set_active(everything->get_active()); + locallab->set_active(everything->get_active()); //toggle group children PartialPasteDlg::basicToggled (); @@ -444,6 +446,7 @@ void PartialPasteDlg::everythingToggled () PartialPasteDlg::metaToggled (); PartialPasteDlg::rawToggled (); PartialPasteDlg::advancedToggled (); + PartialPasteDlg::locallabToggled(); } void PartialPasteDlg::rawToggled () @@ -660,7 +663,9 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param { ParamsEdited falsePE; // falsePE is a workaround to set a group of ParamsEdited to false + falsePE.locallab.spots.resize(srcPP->locallab.nbspot, LocallabParamsEdited::LocallabSpotEdited(false)); ParamsEdited filterPE(true); // Contains the initial information about the loaded values + filterPE.locallab.spots.resize(srcPP->locallab.nbspot, LocallabParamsEdited::LocallabSpotEdited(true)); if (srcPE) { filterPE = *srcPE; diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index 0adfb85cb..4b4667d47 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -507,6 +507,9 @@ void ProfilePanel::load_clicked (GdkEventButton* event) if (!err) { if (!customCreated && fillMode->get_active()) { custom->pparams->setDefaults(); + + // Clearing all LocallabSpotEdited to be compliant with default pparams + custom->pedited->locallab.spots.clear(); } custom->set(true); @@ -578,16 +581,24 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) bool prevState = changeconn.block(true); if (!custom) { - custom = new PartialProfile (true); + custom = new PartialProfile (true); // custom pedited is initialized to false if (isLastSavedSelected()) { *custom->pparams = *lastsaved->pparams; + + // Setting LocallabSpotEdited number coherent with nbspot number in lastsaved->pparams + custom->pedited->locallab.spots.clear(); + custom->pedited->locallab.spots.resize(custom->pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(false)); } else { const ProfileStoreEntry* entry = profiles->getSelectedEntry(); if (entry) { const PartialProfile* partProfile = ProfileStore::getInstance()->getProfile (entry); *custom->pparams = *partProfile->pparams; + + // Setting LocallabSpotEdited number coherent with nbspot number in partProfile->pparams + custom->pedited->locallab.spots.clear(); + custom->pedited->locallab.spots.resize(custom->pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(false)); } } @@ -596,15 +607,26 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) } else { if (fillMode->get_active()) { custom->pparams->setDefaults(); + + // Clear all LocallabSpotEdited to be compliant with default pparams + custom->pedited->locallab.spots.clear(); } else if (!isCustomSelected ()) { if (isLastSavedSelected()) { *custom->pparams = *lastsaved->pparams; + + // Setting LocallabSpotEdited number coherent with nbspot number in lastsaved->pparams + custom->pedited->locallab.spots.clear(); + custom->pedited->locallab.spots.resize(custom->pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); } else { const ProfileStoreEntry* entry = profiles->getSelectedEntry(); if (entry) { const PartialProfile* partProfile = ProfileStore::getInstance()->getProfile (entry); *custom->pparams = *partProfile->pparams; + + // Setting LocallabSpotEdited number coherent with nbspot number in partProfile->pparams + custom->pedited->locallab.spots.clear(); + custom->pedited->locallab.spots.resize(custom->pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); } } } @@ -648,9 +670,17 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); } partialProfileDlg->applyPaste (custom->pparams, nullptr, &pp, nullptr); + + // Setting LocallabSpotEdited number coherent with nbspot number in custom->pparams + custom->pedited->locallab.spots.clear(); + custom->pedited->locallab.spots.resize(custom->pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); } else { // custom.pparams = clipboard.pparams non filtered *custom->pparams = pp; + + // Setting LocallabSpotEdited number coherent with nbspot number in custom->pparams + custom->pedited->locallab.spots.clear(); + custom->pedited->locallab.spots.resize(custom->pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); } } @@ -698,6 +728,10 @@ void ProfilePanel::selection_changed () if (s) { if (fillMode->get_active() && s->pedited) { ParamsEdited pe(true); + + // Setting LocallabSpotEdited number coherent with nbspot number in s->pparams + pe.locallab.spots.resize(s->pparams->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); + PartialProfile s2(s->pparams, &pe, false); changeTo (&s2, pse->label + "+"); } else { @@ -732,6 +766,10 @@ void ProfilePanel::procParamsChanged (rtengine::procparams::ProcParams* p, rteng } *custom->pparams = *p; + + // Setting LocallabSpotEdited number coherent with nbspot number in p + custom->pedited->locallab.spots.clear(); + custom->pedited->locallab.spots.resize(p->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); } /** @brief Initialize the Profile panel with a default profile, overridden by the last saved profile if provided @@ -763,6 +801,8 @@ void ProfilePanel::initProfile (const Glib::ustring& profileFullPath, ProcParams if (lastSaved) { ParamsEdited* pe = new ParamsEdited(true); + // Setting LocallabSpotEdited number coherent with lastSaved->locallab.nbspot (initialized at true such as pe) + pe->locallab.spots.resize(lastSaved->locallab.nbspot, new LocallabParamsEdited::LocallabSpotEdited(true)); // copying the provided last saved profile to ProfilePanel::lastsaved lastsaved = new PartialProfile(lastSaved, pe); } diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 68bd8987f..caa12a5e9 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -422,6 +422,7 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh { const bool needsReprocessing = pparams.toneCurve != pp.toneCurve + || pparams.locallab != pp.locallab || pparams.labCurve != pp.labCurve || pparams.localContrast != pp.localContrast || pparams.rgbCurves != pp.rgbCurves @@ -451,9 +452,12 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh || pparams.softlight != pp.softlight; { + printf("setProcParams: %d\n", needsReprocessing); + MyMutex::MyLock lock(mutex); if (pparams != pp) { + printf("recentlySaved\n"); cfs.recentlySaved = false; } else if (pparamsValid && !updateCacheNow) { // nothing to do @@ -466,8 +470,10 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh const int inTrash = getStage(); if (pe) { + printf("size: %d %d %d\n", (int)pe->locallab.spots.size(), pe->locallab.nbspot, pe->locallab.selspot); pe->combine(pparams, pp, true); } else { + printf("size: %d\n", (int)pp.locallab.spots.size()); pparams = pp; } diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index ad7772d12..06dc80d79 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -236,6 +236,11 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange notebookconn = toolPanelNotebook->signal_switch_page().connect( sigc::mem_fun(*this, &ToolPanelCoordinator::notebookPageChanged)); + // In batch mode, notebookPageChanged method is blocked because it's useless to display spots + if (batch) { + notebookconn.block(true); + } + for (auto toolPanel : toolPanels) { toolPanel->setListener(this); } @@ -385,6 +390,8 @@ void ToolPanelCoordinator::panelChanged(rtengine::ProcEvent event, const Glib::u toolPanel->write(params); } + printf("nbspot#1 %d %d\n", params->locallab.nbspot, (int)params->locallab.spots.size()); + // Compensate rotation on flip if (event == rtengine::EvCTHFlip || event == rtengine::EvCTVFlip) { if (fabs(params->rotate.degree) > 0.001) { @@ -456,6 +463,8 @@ void ToolPanelCoordinator::panelChanged(rtengine::ProcEvent event, const Glib::u } photoLoadedOnce = true; + + printf("nbspot#2 %d %d\n", params->locallab.nbspot, (int)params->locallab.spots.size()); } void ToolPanelCoordinator::profileChange(const PartialProfile *nparams, rtengine::ProcEvent event, const Glib::ustring& descr, const ParamsEdited* paramsEdited, bool fromLastSave) @@ -473,6 +482,12 @@ void ToolPanelCoordinator::profileChange(const PartialProfile *nparams, rtengine ProcParams *params = ipc->beginUpdateParams(); ProcParams *mergedParams = new ProcParams(); + printf("profileChanged 1\n"); + printf("nbspot: %d\n", params->locallab.nbspot); + for (size_t i = 0; i < params->locallab.spots.size(); i++) { + printf("id_%d = %d\n", (int)i, params->locallab.spots.at(i).id); + } + // Copy the current params as default values for the fusion *mergedParams = *params; @@ -501,6 +516,12 @@ void ToolPanelCoordinator::profileChange(const PartialProfile *nparams, rtengine *params = *mergedParams; delete mergedParams; + printf("profileChanged 2\n"); + printf("nbspot: %d\n", params->locallab.nbspot); + for (size_t i = 0; i < params->locallab.spots.size(); i++) { + printf("id_%d = %d\n", (int)i, params->locallab.spots.at(i).id); + } + tr = TR_NONE; if (params->coarse.rotate == 90) {