diff --git a/rtdata/languages/default b/rtdata/languages/default index 1611444a3..747602045 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1185,6 +1185,8 @@ 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_949;Local - Mask Common Wavelet curve +HISTORY_MSG_950;Local - Mask Common Threshold levels 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 7fe72099f..fe429d7d8 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -972,6 +972,8 @@ enum ProcEventCode { Evlocallabshadmask = 946, EvlocallabLmask_shape = 947, EvlocallabLLmask_shapewav = 948, + EvlocallabcsThresholdmask = 949, + NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 7fdf1e673..31173afeb 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3828,8 +3828,8 @@ LocallabParams::LocallabSpot::LocallabSpot() : 0.5, 0.35, 0.35 - } - + }, + csthresholdmask(0, 0, 6, 5, false) { } @@ -4324,7 +4324,8 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && shadmask == other.shadmask && HHhmask_curve == other.HHhmask_curve && Lmask_curve == other.Lmask_curve - && LLmask_curvewav == other.LLmask_curvewav; + && LLmask_curvewav == other.LLmask_curvewav + && csthresholdmask == other.csthresholdmask; } @@ -5843,6 +5844,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo 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); saveToKeyfile(!pedited || spot_edited->LLmask_curvewav, "Locallab", "LLmask_Curvewav_" + index_str, spot.LLmask_curvewav, keyFile); + saveToKeyfile(!pedited || spot_edited->csthresholdmask, "Locallab", "CSThresholdmask_" + index_str, spot.csthresholdmask.toVector(), keyFile); } } } @@ -7581,6 +7583,16 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Lmask_Curve_" + index_str, pedited, spot.Lmask_curve, spotEdited.Lmask_curve); assignFromKeyfile(keyFile, "Locallab", "LLmask_Curvewav_" + index_str, pedited, spot.LLmask_curvewav, spotEdited.LLmask_curvewav); + if (keyFile.has_key("Locallab", "CSThresholdmask_" + index_str)) { + const std::vector thresh = keyFile.get_integer_list("Locallab", "CSThresholdmask_" + index_str); + + if (thresh.size() >= 4) { + spot.csthresholdmask.setValues(thresh[0], thresh[1], min(thresh[2], 10), min(thresh[3], 10)); + } + + spotEdited.csthresholdmask = true; + } + if (spot.visimask) { spotEdited.visimask = true; } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index ecde2d41a..22a33d52a 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1445,6 +1445,7 @@ struct LocallabParams { std::vector HHhmask_curve; std::vector Lmask_curve; std::vector LLmask_curvewav; + Threshold csthresholdmask; LocallabSpot(); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 11ea7d5d6..03e37988f 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -975,7 +975,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabcontmask LUMINANCECURVE, // Evlocallabshadmask LUMINANCECURVE, // EvlocallabLmask_shape - LUMINANCECURVE // EvlocallabLLmask_shapewav + LUMINANCECURVE, // EvlocallabLLmask_shapewav + LUMINANCECURVE // EvlocallabcsThresholdmask + }; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 473ebf8be..17b31fac5 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -1200,8 +1200,8 @@ private: /* ==== LocallabMask ==== */ class LocallabMask: public Gtk::VBox, - public LocallabTool - + public LocallabTool, + public ThresholdAdjusterListener { private: Adjuster* const sensimask; @@ -1232,6 +1232,7 @@ private: DiagonalCurveEditor* const Lmask_shape; CurveEditorGroup* const mask2CurveEditorGwav; FlatCurveEditor* const LLmask_shapewav; + ThresholdAdjuster* const csThresholdmask; sigc::connection showmaskMethodConn, enamaskConn, toolmaskConn, fftmaskConn; @@ -1251,9 +1252,13 @@ public: void write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override; void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; + void adjusterChanged(ThresholdAdjuster* a, double newBottom, double newTop) override {}; // Not used + void adjusterChanged(ThresholdAdjuster* a, double newBottomLeft, double newTopLeft, double newBottomRight, double newTopRight) override {}; // Not used + void adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop) override {}; // Not used + void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override {}; // Not used + void adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) override; void curveChanged(CurveEditor* ce) override; -// void updateAutocompute(const float blackev, const float whiteev, const float sourceg, const float targetg); private: void enabledChanged() override; diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 2556c248a..8af2fa605 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -4759,7 +4759,8 @@ LocallabMask::LocallabMask(): mask2CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), Lmask_shape(static_cast(mask2CurveEditorG->addCurve(CT_Diagonal, "L(L)"))), mask2CurveEditorGwav(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVMASK"))), - LLmask_shapewav(static_cast(mask2CurveEditorGwav->addCurve(CT_Flat, "L(L)", nullptr, false, false))) + LLmask_shapewav(static_cast(mask2CurveEditorGwav->addCurve(CT_Flat, "L(L)", nullptr, false, false))), + csThresholdmask(Gtk::manage(new ThresholdAdjuster(M("TP_LOCALLAB_CSTHRESHOLDBLUR"), 0, 9, 0, 0, 6, 5, 0, false))) { // Parameter Mask common specific widgets @@ -4830,6 +4831,8 @@ LocallabMask::LocallabMask(): mask2CurveEditorGwav->setCurveListener(this); + csThresholdmask->setAdjusterListener(this); + LLmask_shapewav->setIdentityValue(0.); LLmask_shapewav->setResetCurve(FlatCurveType(defSpot.LLmask_curvewav.at(0)), defSpot.LLmask_curvewav); LLmask_shapewav->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); @@ -4871,6 +4874,7 @@ LocallabMask::LocallabMask(): 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 toolmaskBox->pack_start(*mask2CurveEditorGwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + toolmaskBox->pack_start(*csThresholdmask, Gtk::PACK_SHRINK, 0); toolmaskFrame->add(*toolmaskBox); maskmaskBox->pack_start(*toolmaskFrame); pack_start(*maskmaskBox); @@ -5014,6 +5018,7 @@ void LocallabMask::read(const rtengine::procparams::ProcParams* pp, const Params fftmask->set_active(spot.fftmask); Lmask_shape->setCurve(spot.Lmask_curve); LLmask_shapewav->setCurve(spot.LLmask_curvewav); + csThresholdmask->setValue(spot.csthresholdmask); } @@ -5060,6 +5065,7 @@ void LocallabMask::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.blurmask = blurmask->getValue(); spot.Lmask_curve = Lmask_shape->getCurve(); spot.LLmask_curvewav = LLmask_shapewav->getCurve(); + spot.csthresholdmask = csThresholdmask->getValue(); } @@ -5104,6 +5110,7 @@ void LocallabMask::setDefaults(const rtengine::procparams::ProcParams* defParams HHhmask_shape->setCurve(defSpot.HHhmask_curve); contmask->setDefault(defSpot.contmask); blurmask->setDefault(defSpot.blurmask); + csThresholdmask->setDefault(defSpot.csthresholdmask); } @@ -5123,6 +5130,7 @@ void LocallabMask::updateGUIToMode(const modeType new_type) mask_HCurveEditorG->hide(); // mask2CurveEditorG->hide(); mask2CurveEditorGwav->hide(); + csThresholdmask->hide(); } else { // Advanced widgets are shown in Expert mode @@ -5135,6 +5143,7 @@ void LocallabMask::updateGUIToMode(const modeType new_type) mask_HCurveEditorG->show(); // mask2CurveEditorG->show(); mask2CurveEditorGwav->show(); + csThresholdmask->show(); } } @@ -5159,6 +5168,7 @@ void LocallabMask::convertParamToNormal() HHhmask_shape->setCurve(defSpot.HHhmask_curve); // Lmask_shape->setCurve(defSpot.Lmask_curve); LLmask_shapewav->setCurve(defSpot.LLmask_curvewav); + csThresholdmask->setValue(defSpot.csthresholdmask); // Enable all listeners enableListener(); @@ -5215,6 +5225,8 @@ void LocallabMask::fftmaskChanged() } + + void LocallabMask::curveChanged(CurveEditor* ce) { if (isLocActivated && exp->getEnabled()) { @@ -5351,6 +5363,17 @@ void LocallabMask::adjusterChanged(Adjuster* a, double newval) } } +void LocallabMask::adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) +{ + if (isLocActivated && exp->getEnabled()) { + if (a == csThresholdmask) { + if (listener) { + listener->panelChanged(EvlocallabcsThresholdmask, + csThresholdmask->getHistoryString() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + } +} void LocallabMask::enabledChanged() { diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 407e67064..6349b84e0 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1501,6 +1501,7 @@ void ParamsEdited::initFrom(const std::vector& 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; locallab.spots.at(j).LLmask_curvewav = locallab.spots.at(j).LLmask_curvewav && pSpot.LLmask_curvewav == otherSpot.LLmask_curvewav; + locallab.spots.at(j).csthresholdmask = locallab.spots.at(j).csthresholdmask && pSpot.csthresholdmask == otherSpot.csthresholdmask; } } @@ -4899,6 +4900,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).LLmask_curvewav = mods.locallab.spots.at(i).LLmask_curvewav; } + if (locallab.spots.at(i).csthresholdmask) { + toEdit.locallab.spots.at(i).csthresholdmask = mods.locallab.spots.at(i).csthresholdmask; + } + } if (pcvignette.enabled) { @@ -6491,7 +6496,8 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : shadmask(v), HHhmask_curve(v), Lmask_curve(v), - LLmask_curvewav(v) + LLmask_curvewav(v), + csthresholdmask(v) { } @@ -6977,6 +6983,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) HHhmask_curve =(v); Lmask_curve =(v); LLmask_curvewav =(v); + csthresholdmask = v; } bool CaptureSharpeningParamsEdited::isUnchanged() const diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 7f82e128a..dea2a4a9f 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -859,6 +859,7 @@ public: bool HHhmask_curve; bool Lmask_curve; bool LLmask_curvewav; + bool csthresholdmask; LocallabSpotEdited(bool v);