From 778e9af9b7670bd346ed70f719956f9da6c0c958 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 2 May 2020 11:13:48 +0200 Subject: [PATCH] Added checkbutton in settings forced change in BW --- rtdata/languages/default | 2 ++ rtengine/iplocallab.cc | 7 ++++++- rtengine/procevents.h | 1 + rtengine/procparams.cc | 4 ++++ rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 3 ++- rtgui/controlspotpanel.cc | 36 ++++++++++++++++++++++++++++++++++++ rtgui/controlspotpanel.h | 5 +++++ rtgui/locallab.cc | 4 ++++ rtgui/paramsedited.cc | 7 +++++++ rtgui/paramsedited.h | 1 + 11 files changed, 69 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index ce27e20ae..b17eb315a 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1159,6 +1159,7 @@ HISTORY_MSG_918;Local - Residual wavelet highlights HISTORY_MSG_919;Local - Residual wavelet highlights threshold HISTORY_MSG_920;Local - Wavelet sigma LC HISTORY_MSG_921;Local - Wavelet Graduated sigma LC2 +HISTORY_MSG_922;Local - changes In Black and White HISTORY_MSG_CAT02PRESET;Cat02 automatic preset HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction @@ -2301,6 +2302,7 @@ TP_LOCALLAB_BLMED;Median TP_LOCALLAB_BLMETHOD_TOOLTIP;Normal - direct blur and noise with all settings.\nInverse - Inverse blur and noise without scope and without enhanced algorithm.\nSymmetric - inverse blur and noise with all settings. Be careful some results may be curious TP_LOCALLAB_BLNORM;Normal TP_LOCALLAB_BLSYM;Symmetric +TP_LOCALLAB_BLWH;All changes forced in Black and White TP_LOCALLAB_SPOTNAME;New Spot TP_LOCALLAB_BLUFR;Smooth - Blur - Grain - Denoise TP_LOCALLAB_BLUMETHOD_TOOLTIP;To blur the background and isolate the foreground:\n*Blur the background by a RT-spot fully covering the image (high values for scope and transition) - normal or inverse.\n*Isolate the foreground by one or more excluding RT-spot with the tools you want (increse scope), you can use a mask to enhance and amplify the effects.\n\nThis module can be used in additional noise reduction,including "median" and "Guided filter" diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 93c92b5f2..9eb147fcd 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -456,6 +456,7 @@ struct local_params { float residshathr; float residhi; float residhithr; + bool blwh; }; @@ -1253,6 +1254,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.residshathr = locallab.spots.at(sp).residshathr; lp.residhi = locallab.spots.at(sp).residhi; lp.residhithr = locallab.spots.at(sp).residhithr; + lp.blwh = locallab.spots.at(sp).blwh; } @@ -6467,7 +6469,6 @@ void ImProcFunctions::transit_shapedetect2(int call, int senstype, const LabImag int bfwr = bfw; bool reduH = false; bool reduW = false; - if (lp.blurcolmask >= 0.25f && lp.fftColorMask && call == 2) { optfft(N_fftwsize, bfh, bfw, bfhr, bfwr, reduH, reduW, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy); } @@ -6739,6 +6740,10 @@ void ImProcFunctions::transit_shapedetect2(int call, int senstype, const LabImag cla = bufexpfin->a[y][x] - original->a[y + ystart][x + xstart]; clb = bufexpfin->b[y][x] - original->b[y + ystart][x + xstart]; } + if(lp.blwh) { + cla = 0.f; + clb = 0.f; + } // const float previewint = settings->previewselection; diff --git a/rtengine/procevents.h b/rtengine/procevents.h index c1df2bfd6..05f438827 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -944,6 +944,7 @@ enum ProcEventCode { Evlocallabresidhithr = 918, Evlocallabsigmalc = 919, Evlocallabsigmalc2 = 920, + Evlocallabblwh = 921, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 522f65aa9..ac2c2d5b7 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2530,6 +2530,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : transitweak(1.0), transitgrad(0.0), avoid(false), + blwh(false), recurs(false), laplac(false), deltae(true), @@ -3642,6 +3643,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && transitweak == other.transitweak && transitgrad == other.transitgrad && avoid == other.avoid + && blwh == other.blwh && recurs == other.recurs && laplac == other.laplac && deltae == other.deltae @@ -5085,6 +5087,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->transitweak, "Locallab", "Transitweak_" + index_str, spot.transitweak, keyFile); saveToKeyfile(!pedited || spot_edited->transitgrad, "Locallab", "Transitgrad_" + index_str, spot.transitgrad, keyFile); saveToKeyfile(!pedited || spot_edited->avoid, "Locallab", "Avoid_" + index_str, spot.avoid, keyFile); + saveToKeyfile(!pedited || spot_edited->blwh, "Locallab", "Blwh_" + index_str, spot.blwh, keyFile); saveToKeyfile(!pedited || spot_edited->recurs, "Locallab", "Recurs_" + index_str, spot.recurs, keyFile); saveToKeyfile(!pedited || spot_edited->laplac, "Locallab", "Laplac_" + index_str, spot.laplac, keyFile); saveToKeyfile(!pedited || spot_edited->deltae, "Locallab", "Deltae_" + index_str, spot.deltae, keyFile); @@ -6677,6 +6680,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Transitweak_" + index_str, pedited, spot.transitweak, spotEdited.transitweak); assignFromKeyfile(keyFile, "Locallab", "Transitgrad_" + index_str, pedited, spot.transitgrad, spotEdited.transitgrad); assignFromKeyfile(keyFile, "Locallab", "Avoid_" + index_str, pedited, spot.avoid, spotEdited.avoid); + assignFromKeyfile(keyFile, "Locallab", "Blwh_" + index_str, pedited, spot.blwh, spotEdited.blwh); assignFromKeyfile(keyFile, "Locallab", "Recurs_" + index_str, pedited, spot.recurs, spotEdited.recurs); assignFromKeyfile(keyFile, "Locallab", "Laplac_" + index_str, pedited, spot.laplac, spotEdited.laplac); assignFromKeyfile(keyFile, "Locallab", "Deltae_" + index_str, pedited, spot.deltae, spotEdited.deltae); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 8441545b8..f86ba6656 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -985,6 +985,7 @@ struct LocallabParams { double transitweak; double transitgrad; bool avoid; + bool blwh; bool recurs; bool laplac; bool deltae; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 036222438..8b706cb17 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -947,7 +947,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabresidhi LUMINANCECURVE, // Evlocallabresidhithr LUMINANCECURVE, // Evlocallabsigmalc - LUMINANCECURVE // Evlocallabsigmalc2 + LUMINANCECURVE, // Evlocallabsigmalc2 + LUMINANCECURVE // Evlocallabblwh }; diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 0c1d81250..e7e4b3203 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -78,6 +78,7 @@ ControlSpotPanel::ControlSpotPanel(): lumask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LUMASK"), 0, 30, 1, 10))), avoid_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AVOID")))), + blwh_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_BLWH")))), recurs_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_RECURS")))), laplac_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LAPLACC")))), deltae_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_DELTAEC")))), @@ -357,6 +358,10 @@ ControlSpotPanel::ControlSpotPanel(): sigc::mem_fun(*this, &ControlSpotPanel::avoidChanged)); pack_start(*avoid_); + blwhConn_ = blwh_->signal_toggled().connect( + sigc::mem_fun(*this, &ControlSpotPanel::blwhChanged)); + pack_start(*blwh_); + recursConn_ = recurs_->signal_toggled().connect( sigc::mem_fun(*this, &ControlSpotPanel::recursChanged)); @@ -757,6 +762,7 @@ void ControlSpotPanel::load_ControlSpot_param() balanh_->setValue((double)row[spots_.balanh]); colorde_->setValue((double)row[spots_.colorde]); avoid_->set_active(row[spots_.avoid]); + blwh_->set_active(row[spots_.blwh]); recurs_->set_active(row[spots_.recurs]); laplac_->set_active(row[spots_.laplac]); deltae_->set_active(row[spots_.deltae]); @@ -1307,6 +1313,31 @@ void ControlSpotPanel::avoidChanged() } } +void ControlSpotPanel::blwhChanged() +{ + // printf("blwhChanged\n"); + + // Get selected control spot + const auto s = treeview_->get_selection(); + + if (!s->count_selected_rows()) { + return; + } + + const auto iter = s->get_selected(); + Gtk::TreeModel::Row row = *iter; + row[spots_.blwh] = blwh_->get_active(); + + // Raise event + if (listener) { + if (blwh_->get_active()) { + listener->panelChanged(Evlocallabblwh, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(Evlocallabblwh, M("GENERAL_DISABLED")); + } + } +} + void ControlSpotPanel::recursChanged() { // printf("recursChanged\n"); @@ -1467,6 +1498,7 @@ void ControlSpotPanel::disableParamlistener(bool cond) balanh_->block(cond); colorde_->block(cond); avoidConn_.block(cond); + blwhConn_.block(cond); recursConn_.block(cond); laplacConn_.block(cond); deltaeConn_.block(cond); @@ -1506,6 +1538,7 @@ void ControlSpotPanel::setParamEditable(bool cond) balanh_->set_sensitive(cond); colorde_->set_sensitive(cond); avoid_->set_sensitive(cond); + blwh_->set_sensitive(cond); recurs_->set_sensitive(cond); laplac_->set_sensitive(cond); deltae_->set_sensitive(cond); @@ -2156,6 +2189,7 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(const int index) r->scopemask = row[spots_.scopemask]; r->lumask = row[spots_.lumask]; r->avoid = row[spots_.avoid]; + r->blwh = row[spots_.blwh]; r->recurs = row[spots_.recurs]; r->laplac = row[spots_.laplac]; r->deltae = row[spots_.deltae]; @@ -2270,6 +2304,7 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot) row[spots_.balanh] = newSpot->balanh; row[spots_.colorde] = newSpot->colorde; row[spots_.avoid] = newSpot->avoid; + row[spots_.blwh] = newSpot->blwh; row[spots_.recurs] = newSpot->recurs; row[spots_.laplac] = newSpot->laplac; row[spots_.deltae] = newSpot->deltae; @@ -2379,6 +2414,7 @@ ControlSpotPanel::ControlSpots::ControlSpots() add(balanh); add(colorde); add(avoid); + add(blwh); add(recurs); add(laplac); add(deltae); diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index 0ae41e91b..02a4758c1 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -64,6 +64,7 @@ public: double balanh; double colorde; bool avoid; + bool blwh; bool recurs; bool laplac; bool deltae; @@ -208,6 +209,7 @@ private: void adjusterChanged(Adjuster* a, double newval); void avoidChanged(); + void blwhChanged(); void recursChanged(); void laplacChanged(); void deltaeChanged(); @@ -262,6 +264,7 @@ private: Gtk::TreeModelColumn balanh; Gtk::TreeModelColumn colorde; Gtk::TreeModelColumn avoid; + Gtk::TreeModelColumn blwh; Gtk::TreeModelColumn recurs; Gtk::TreeModelColumn laplac; Gtk::TreeModelColumn deltae; @@ -346,6 +349,8 @@ private: Gtk::CheckButton* const avoid_; sigc::connection avoidConn_; + Gtk::CheckButton* const blwh_; + sigc::connection blwhConn_; Gtk::CheckButton* const recurs_; sigc::connection recursConn_; Gtk::CheckButton* const laplac_; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index e329bdbf9..cb13f78be 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -303,6 +303,7 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit r->balanh = pp->locallab.spots.at(i).balanh; r->colorde = pp->locallab.spots.at(i).colorde; r->avoid = pp->locallab.spots.at(i).avoid; + r->blwh = pp->locallab.spots.at(i).blwh; r->recurs = pp->locallab.spots.at(i).recurs; r->laplac = pp->locallab.spots.at(i).laplac; r->deltae = pp->locallab.spots.at(i).deltae; @@ -471,6 +472,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->balanh = newSpot->balanh; r->colorde = newSpot->colorde; r->avoid = newSpot->avoid; + r->blwh = newSpot->blwh; r->recurs = newSpot->recurs; r->laplac = newSpot->laplac; r->deltae = newSpot->deltae; @@ -755,6 +757,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->balanh = newSpot->balanh; r->colorde = newSpot->colorde; r->avoid = newSpot->avoid; + r->blwh = newSpot->blwh; r->recurs = newSpot->recurs; r->laplac = newSpot->laplac; r->deltae = newSpot->deltae; @@ -896,6 +899,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).balanh = r->balanh; pp->locallab.spots.at(pp->locallab.selspot).colorde = r->colorde; pp->locallab.spots.at(pp->locallab.selspot).avoid = r->avoid; + pp->locallab.spots.at(pp->locallab.selspot).blwh = r->blwh; pp->locallab.spots.at(pp->locallab.selspot).recurs = r->recurs; pp->locallab.spots.at(pp->locallab.selspot).laplac = r->laplac; pp->locallab.spots.at(pp->locallab.selspot).deltae = r->deltae; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index af45f9335..c41e89bba 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1009,6 +1009,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).transitweak = locallab.spots.at(j).transitweak && pSpot.transitweak == otherSpot.transitweak; locallab.spots.at(j).transitgrad = locallab.spots.at(j).transitgrad && pSpot.transitgrad == otherSpot.transitgrad; locallab.spots.at(j).avoid = locallab.spots.at(j).avoid && pSpot.avoid == otherSpot.avoid; + locallab.spots.at(j).blwh = locallab.spots.at(j).blwh && pSpot.blwh == otherSpot.blwh; locallab.spots.at(j).recurs = locallab.spots.at(j).recurs && pSpot.recurs == otherSpot.recurs; locallab.spots.at(j).laplac = locallab.spots.at(j).laplac && pSpot.laplac == otherSpot.laplac; locallab.spots.at(j).deltae = locallab.spots.at(j).deltae && pSpot.deltae == otherSpot.deltae; @@ -3008,6 +3009,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).avoid = mods.locallab.spots.at(i).avoid; } + if (locallab.spots.at(i).blwh) { + toEdit.locallab.spots.at(i).blwh = mods.locallab.spots.at(i).blwh; + } + if (locallab.spots.at(i).recurs) { toEdit.locallab.spots.at(i).recurs = mods.locallab.spots.at(i).recurs; } @@ -5703,6 +5708,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : transitweak(v), transitgrad(v), avoid(v), + blwh(v), recurs(v), laplac(v), deltae(v), @@ -6140,6 +6146,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) transitweak = v; transitgrad = v; avoid = v; + blwh = v; recurs = v; laplac = v; deltae = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 5a1c40c4c..67107deca 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -413,6 +413,7 @@ public: bool transitweak; bool transitgrad; bool avoid; + bool blwh; bool recurs; bool laplac; bool deltae;