diff --git a/rtdata/languages/default b/rtdata/languages/default index c8e7a7bf4..1611444a3 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1184,6 +1184,7 @@ HISTORY_MSG_944;Local - Mask Common FFT HISTORY_MSG_945;Local - Mask Common Blur radius HISTORY_MSG_946;Local - Mask Common contrast threshold HISTORY_MSG_947;Local - Mask Common shadows +HISTORY_MSG_948;Local - Mask Common Contrast curve HISTORY_MSG_CAT02PRESET;Cat02 automatic preset HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 9ed965ccd..01fb707d3 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -970,6 +970,7 @@ enum ProcEventCode { Evlocallabblurmask = 944, Evlocallabcontmask = 945, Evlocallabshadmask = 946, + EvlocallabLmask_shape = 947, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 20a976bde..0a8b6ff65 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3810,7 +3810,15 @@ LocallabParams::LocallabSpot::LocallabSpot() : 0.5, 0.35, 0.35 + }, + Lmask_curve{ + static_cast(DCT_NURBS), + 0.0, + 0.0, + 1.0, + 1.0 } + { } @@ -4303,7 +4311,8 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && gammask == other.gammask && slopmask == other.slopmask && shadmask == other.shadmask - && HHhmask_curve == other.HHhmask_curve; + && HHhmask_curve == other.HHhmask_curve + && Lmask_curve == other.Lmask_curve; } @@ -5820,6 +5829,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->slopmask, "Locallab", "Slopmask_" + index_str, spot.slopmask, keyFile); saveToKeyfile(!pedited || spot_edited->shadmask, "Locallab", "Shadmask_" + index_str, spot.shadmask, keyFile); saveToKeyfile(!pedited || spot_edited->HHhmask_curve, "Locallab", "HHhmask_Curve_" + index_str, spot.HHhmask_curve, keyFile); + saveToKeyfile(!pedited || spot_edited->Lmask_curve, "Locallab", "Lmask_Curve_" + index_str, spot.Lmask_curve, keyFile); } } } @@ -7555,6 +7565,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Slopmask_" + index_str, pedited, spot.slopmask, spotEdited.slopmask); assignFromKeyfile(keyFile, "Locallab", "Shadmask_" + index_str, pedited, spot.shadmask, spotEdited.shadmask); assignFromKeyfile(keyFile, "Locallab", "HHhmask_Curve_" + index_str, pedited, spot.HHhmask_curve, spotEdited.HHhmask_curve); + assignFromKeyfile(keyFile, "Locallab", "Lmask_Curve_" + index_str, pedited, spot.Lmask_curve, spotEdited.Lmask_curve); if (spot.visimask) { spotEdited.visimask = true; diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 0079433cc..258d69cf1 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1443,6 +1443,7 @@ struct LocallabParams { double slopmask; double shadmask; std::vector HHhmask_curve; + std::vector Lmask_curve; LocallabSpot(); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 7ddd1fc4c..f9fae6873 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -970,10 +970,11 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // EvLocallabtoolmask LUMINANCECURVE, // Evlocallabstrumaskmask LUMINANCECURVE, // EvlocallabHHhmask_shape - LUMINANCECURVE, // EvLocallabfftmask + LUMINANCECURVE, // EvLocallabfftmask LUMINANCECURVE, // Evlocallabblurmask - LUMINANCECURVE, // Evlocallabcontmask - LUMINANCECURVE // Evlocallabshadmask + LUMINANCECURVE, // Evlocallabcontmask + LUMINANCECURVE, // Evlocallabshadmask + LUMINANCECURVE // EvlocallabLmask_shape }; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index b65ac707b..9fa353fec 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -1228,6 +1228,8 @@ private: Adjuster* const shadmask; CurveEditorGroup* const mask_HCurveEditorG; FlatCurveEditor* const HHhmask_shape; + CurveEditorGroup* const mask2CurveEditorG; + DiagonalCurveEditor* const Lmask_shape; sigc::connection showmaskMethodConn, enamaskConn, toolmaskConn, fftmaskConn; @@ -1260,14 +1262,7 @@ private: void updateGUIToMode(const modeType new_type) override; void fftmaskChanged(); void updatemaskGUI3(); - - /* - void autocomputeToggled(); - void fullimageChanged(); - void AutograyChanged(); - - void updateLogGUI(); - */ + void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; }; diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 2246f9bea..003bb96bf 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -4755,7 +4755,9 @@ LocallabMask::LocallabMask(): shadmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHAMASKCOL"), 0, 100, 1, 0))), mask_HCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASKH"))), - HHhmask_shape(static_cast(mask_HCurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true))) + HHhmask_shape(static_cast(mask_HCurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true))), + mask2CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), + Lmask_shape(static_cast(mask2CurveEditorG->addCurve(CT_Diagonal, "L(L)"))) { // Parameter Mask common specific widgets @@ -4816,6 +4818,14 @@ LocallabMask::LocallabMask(): mask_HCurveEditorG->curveListComplete(); + mask2CurveEditorG->setCurveListener(this); + + Lmask_shape->setResetCurve(DiagonalCurveType(defSpot.Lmask_curve.at(0)), defSpot.Lmask_curve); + Lmask_shape->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + Lmask_shape->setLeftBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + + mask2CurveEditorG->curveListComplete(); + pack_start(*sensimask, Gtk::PACK_SHRINK, 0); pack_start(*blendmask, Gtk::PACK_SHRINK, 0); @@ -4849,6 +4859,7 @@ LocallabMask::LocallabMask(): toolmaskBox->pack_start(*slopmask, Gtk::PACK_SHRINK, 0); toolmaskBox->pack_start(*shadmask, Gtk::PACK_SHRINK, 0); toolmaskBox->pack_start(*mask_HCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + toolmaskBox->pack_start(*mask2CurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor toolmaskFrame->add(*toolmaskBox); maskmaskBox->pack_start(*toolmaskFrame); pack_start(*maskmaskBox); @@ -4887,6 +4898,8 @@ void LocallabMask::updateAdviceTooltips(const bool showTooltips) mask_HCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_HHMASK_TOOLTIP")); radmask->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); lapmask->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); + mask2CurveEditorG->set_tooltip_text(M("TP_LOCALLAB_WAVMASK_TOOLTIP")); + Lmask_shape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); } else { exp->set_tooltip_text(M("")); @@ -4899,6 +4912,8 @@ void LocallabMask::updateAdviceTooltips(const bool showTooltips) mask_HCurveEditorG->set_tooltip_text(M("")); radmask->set_tooltip_text(M("")); lapmask->set_tooltip_text(M("")); + mask2CurveEditorG->set_tooltip_text(M("")); + Lmask_shape->setTooltip(M("")); } } @@ -4906,6 +4921,7 @@ LocallabMask::~LocallabMask() { delete mask_CurveEditorG; delete mask_HCurveEditorG; + delete mask2CurveEditorG; } void LocallabMask::disableListener() @@ -4980,6 +4996,7 @@ void LocallabMask::read(const rtengine::procparams::ProcParams* pp, const Params shadmask->setValue(spot.shadmask); HHhmask_shape->setCurve(spot.HHhmask_curve); fftmask->set_active(spot.fftmask); + Lmask_shape->setCurve(spot.Lmask_curve); } @@ -5024,6 +5041,7 @@ void LocallabMask::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.fftmask = fftmask->get_active(); spot.contmask = contmask->getValue(); spot.blurmask = blurmask->getValue(); + spot.Lmask_curve = Lmask_shape->getCurve(); } @@ -5085,6 +5103,7 @@ void LocallabMask::updateGUIToMode(const modeType new_type) struFrame->hide(); blurFrame->hide(); mask_HCurveEditorG->hide(); +// mask2CurveEditorG->hide(); } else { // Advanced widgets are shown in Expert mode @@ -5095,6 +5114,7 @@ void LocallabMask::updateGUIToMode(const modeType new_type) struFrame->show(); blurFrame->show(); mask_HCurveEditorG->show(); +// mask2CurveEditorG->show(); } } @@ -5117,6 +5137,7 @@ void LocallabMask::convertParamToNormal() blurmask->setValue(defSpot.blurmask); contmask->setValue(defSpot.contmask); HHhmask_shape->setCurve(defSpot.HHhmask_curve); +// Lmask_shape->setCurve(defSpot.Lmask_curve); // Enable all listeners enableListener(); @@ -5137,6 +5158,22 @@ void LocallabMask::updatemaskGUI3() } +void LocallabMask::updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) +{ + idle_register.add( + [this, normHuer, normLumar, normChromar]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update mask background + CCmask_shape->updateLocallabBackground(normChromar); + LLmask_shape->updateLocallabBackground(normLumar); + HHmask_shape->updateLocallabBackground(normHuer); + HHhmask_shape->updateLocallabBackground(normHuer); + + return false; + } + ); +} void LocallabMask::fftmaskChanged() @@ -5189,6 +5226,13 @@ void LocallabMask::curveChanged(CurveEditor* ce) } } + if (ce == Lmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabLmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + } } diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 9fccd0637..0927b8ff5 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1499,6 +1499,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).slopmask = locallab.spots.at(j).slopmask && pSpot.slopmask == otherSpot.slopmask; locallab.spots.at(j).shadmask = locallab.spots.at(j).shadmask && pSpot.shadmask == otherSpot.shadmask; locallab.spots.at(j).HHhmask_curve = locallab.spots.at(j).HHhmask_curve && pSpot.HHhmask_curve == otherSpot.HHhmask_curve; + locallab.spots.at(j).Lmask_curve = locallab.spots.at(j).Lmask_curve && pSpot.Lmask_curve == otherSpot.Lmask_curve; } } @@ -4889,6 +4890,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).HHhmask_curve = mods.locallab.spots.at(i).HHhmask_curve; } + if (locallab.spots.at(i).Lmask_curve) { + toEdit.locallab.spots.at(i).Lmask_curve = mods.locallab.spots.at(i).Lmask_curve; + } + } if (pcvignette.enabled) { @@ -6479,7 +6484,8 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : gammask(v), slopmask(v), shadmask(v), - HHhmask_curve(v) + HHhmask_curve(v), + Lmask_curve(v) { } @@ -6963,6 +6969,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) slopmask = v; shadmask = v; HHhmask_curve =(v); + Lmask_curve =(v); } bool CaptureSharpeningParamsEdited::isUnchanged() const diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 52893d34d..b2c933afa 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -857,6 +857,7 @@ public: bool slopmask; bool shadmask; bool HHhmask_curve; + bool Lmask_curve; LocallabSpotEdited(bool v);