From b608ce7efbc9e49e2c35bd2aa0864649981b59be Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 28 Oct 2019 17:15:31 +0100 Subject: [PATCH] Clean and save code --- rtdata/languages/default | 2 + rtengine/FTblockDN.cc | 72 +---------------------------------- rtengine/dcrop.cc | 8 +++- rtengine/improccoordinator.cc | 22 ++++++++++- rtengine/improccoordinator.h | 2 + rtengine/improcfun.h | 2 +- rtengine/iplocallab.cc | 2 +- rtengine/procevents.h | 1 + rtengine/procparams.cc | 4 ++ rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 3 +- rtengine/simpleprocess.cc | 3 +- rtgui/controlspotpanel.cc | 48 +++++++++++++++++++++++ rtgui/controlspotpanel.h | 6 +++ rtgui/locallab.cc | 7 ++++ rtgui/paramsedited.cc | 7 ++++ rtgui/paramsedited.h | 1 + 17 files changed, 112 insertions(+), 79 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index b58bf2284..aabac4c05 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1032,6 +1032,7 @@ HISTORY_MSG_791;Local - Mask Short L curves HISTORY_MSG_792;Local - Mask Luminance Background HISTORY_MSG_793;Local - SH TRC gamma HISTORY_MSG_794;Local - SH TRC slope +HISTORY_MSG_795;Local - Mask save restore image HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2144,6 +2145,7 @@ TP_LOCALLAB_SH2;Equalizer TP_LOCALLAB_DETAILSH;Details TP_LOCALLAB_LMASK_LL_TOOLTIP;Give priority to action on midtones and high lights TP_LOCALLAB_LMASK_LEVEL_TOOLTIP;Give priority to action on midtones and high lights and by choosing the concerned wavelet levels +TP_LOCALLAB_SAVREST;Save - Restore Current Image TP_LOCALLAB_SCOPEMASK;Scope Mask DeltaE Image TP_LOCALLAB_SCOPEMASK_TOOLTIP;Enabled if Mask DeltaE Image is enabled.\nLow values avoid retouching selected area TP_LOCALLAB_MASFRAME;Mask diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index df90df849..fac02f47b 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -2695,7 +2695,7 @@ void ImProcFunctions::ShrinkAllL(const wavelet_decomposition &WaveletCoeffs_L, f float * sfave = buffer[0] + 32; float * sfaved = buffer[1] + 64; - float * blurBuffer = buffer[2] + 96; +// float * blurBuffer = buffer[2] + 96; const int W_L = WaveletCoeffs_L.level_W(level); const int H_L = WaveletCoeffs_L.level_H(level); @@ -2734,34 +2734,6 @@ void ImProcFunctions::ShrinkAllL(const wavelet_decomposition &WaveletCoeffs_L, f } - /* - float kinterm = epsi + noiseLCurve[xdivf(LLum, 15) * 500.f]; - kinterm *= 100.f; - kinterm += noiseluma; - lumcalc[ii][jj] = SQR((kinterm / 125.f) * (1.f + kinterm / 25.f)); - - //TO DO perhaps needs ci=urve for L ?? ==> same as in shrinkallab - float noisevarfc; - - float *nvc = nullptr; - nvc = new float[ H_ab * W_ab]; - - if ((local == 2 || local == 3) && variC && useNoiseCCurve) { - noisevarfc = variC[level]; - - for (int p = 0; p < H_ab * W_ab; p++) { - nvc[p] = 10.f * sqrt(variC[level]) * SQR(1.f + 4.f * noisevarchrom[p]); - } - - } else { - noisevarfc = noisevar_ab; - - for (int p = 0; p < H_ab * W_ab; p++) { - nvc[p] = noisevarchrom[p]; - } - - } - */ int i = 0; #ifdef __SSE2__ const vfloat levelFactorv = F2V(levelFactor); @@ -2802,48 +2774,6 @@ void ImProcFunctions::ShrinkAllL(const wavelet_decomposition &WaveletCoeffs_L, f } -/* - for (int i = 0; i < W_L * H_L; ++i) { - - float mag = SQR(WavCoeffs_L[dir][i]); - float shrinkfactor = mag / (mag + levelFactor * nvl[i] * xexpf(-mag / (9 * levelFactor * nvl[i])) + eps); - sfave[i] = shrinkfactor; - } - -#endif - boxblur(sfave, sfaved, blurBuffer, level + 2, level + 2, W_L, H_L); //increase smoothness by locally averaging shrinkage - delete [] nvl; - -#ifdef __SSE2__ - __m128 sfv; - - for (i = 0; i < W_L * H_L - 3; i += 4) { - sfv = LVFU(sfave[i]); - //use smoothed shrinkage unless local shrinkage is much less - _mm_storeu_ps(&WavCoeffs_L[dir][i], _mm_loadu_ps(&WavCoeffs_L[dir][i]) * (SQRV(LVFU(sfaved[i])) + SQRV(sfv)) / (LVFU(sfaved[i]) + sfv + epsv)); - } - - // few remaining pixels - for (; i < W_L * H_L; ++i) { - float sf = sfave[i]; - - //use smoothed shrinkage unless local shrinkage is much less - WavCoeffs_L[dir][i] *= (SQR(sfaved[i]) + SQR(sf)) / (sfaved[i] + sf + eps); - }//now luminance coefficients are denoised - -#else - - for (int i = 0; i < W_L * H_L; ++i) { - float sf = sfave[i]; - - //use smoothed shrinkage unless local shrinkage is much less - WavCoeffs_L[dir][i] *= (SQR(sfaved[i]) + SQR(sf)) / (sfaved[i] + sf + eps); - - }//now luminance coefficients are denoised - -#endif -} -*/ void ImProcFunctions::ShrinkAllAB(const wavelet_decomposition & WaveletCoeffs_L, const wavelet_decomposition & WaveletCoeffs_ab, float **buffer, int level, int dir, float * noisevarchrom, float noisevar_ab, const bool useNoiseCCurve, bool autoch, diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 8145f0dda..f726ab6d1 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1034,6 +1034,7 @@ void Crop::update(int todo) double cont = params.locallab.spots.at(sp).contrast; double huere, chromare, lumare, huerefblu, chromarefblu, lumarefblu, sobelre; + int lastsav; float avge; huerefblu = parent->huerefblurs[sp]; chromarefblu = parent->chromarefblurs[sp]; @@ -1043,6 +1044,9 @@ void Crop::update(int todo) lumare = parent->lumarefs[sp]; sobelre = parent->sobelrefs[sp]; avge = parent->avgs[sp]; + + lastsav = parent->lastsavrests[sp]; + float minCD; float maxCD; float mini; @@ -1075,7 +1079,7 @@ void Crop::update(int todo) loclmasCurvecolwav,lmasutilicolwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, - huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, + huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, parent->locallColorMask, parent->locallColorMaskinv, parent->locallExpMask, parent->locallExpMaskinv, parent->locallSHMask, parent->locallSHMaskinv, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask, parent->localltmMask, parent->locallblMask, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); if (parent->locallListener) { @@ -1101,7 +1105,7 @@ void Crop::update(int todo) loclmasCurvecolwav,lmasutilicolwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, - huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } lllocalcurve2.clear(); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 6009cc0d2..7a5b9d260 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -205,6 +205,7 @@ ImProcCoordinator::ImProcCoordinator() : lmasutilicolwav(false), LHutili(false), HHutili(false), + lastsavrests(500, -10000), huerefs(500, -100000.f), huerefblurs(500, -100000.f), chromarefblurs(500, -100000.f), @@ -220,6 +221,7 @@ ImProcCoordinator::ImProcCoordinator() : chromar(0), lumar(0), sobeler(0), + lastsav(0), avg(0), lastspotdup(false), locallColorMask(0), @@ -919,6 +921,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) float **shbuffer = nullptr; int sca = 1; double huere, chromare, lumare, huerefblu, chromarefblu, lumarefblu, sobelre; + // int lastsavee; float avge; for (int sp = 0; sp < params->locallab.nbspot && sp < (int)params->locallab.spots.size(); sp++) { @@ -1016,6 +1019,21 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } else { ipf.calc_ref(sp, nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge); } + /* + printf("lastorig=%i sp=%i\n", lastsavrests[sp], sp); + + if(params->locallab.spots.at(sp).savrest && (lastsavrests[sp] == 0)) { + lastsavrests[sp] = 2;//save image flag=2 + } else if(params->locallab.spots.at(sp).savrest && lastsavrests[sp] == 2){ + lastsavrests[sp] = 1; // let image save with no changes flag = 1 + } else if(!params->locallab.spots.at(sp).savrest && (lastsavrests[sp] == 2 || lastsavrests[sp] == 1)) { + lastsavrests[sp] = -1; // restore image only if image create, set flag -1 + } else if(!params->locallab.spots.at(sp).savrest && (lastsavrests[sp] != 2 && lastsavrests[sp] != 1)) { + lastsavrests[sp] = 0; // does nothing if image was not save + } + lastsav = lastsavrests[sp]; + printf("lastsav=%i sp=%i\n", lastsav, sp); + */ // printf("improc avg=%f\n", avg); huerblu = huerefblurs[sp] = huerefblu; @@ -1070,7 +1088,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) loclmasCurvecolwav,lmasutilicolwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, - huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, + huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, lastsav, locallColorMask, locallColorMaskinv, locallExpMask, locallExpMaskinv, locallSHMask, locallSHMaskinv, locallcbMask, locallretiMask, locallsoftMask, localltmMask, locallblMask, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); if (locallListener) { @@ -1095,7 +1113,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) loclmasCurvecolwav,lmasutilicolwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, - huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, lastsav, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } //recalculate references after diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 035f32d06..096e6a1d2 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -307,6 +307,7 @@ protected: bool lmasutilicolwav; bool LHutili; bool HHutili; + LUTu lastsavrests; LUTf huerefs; LUTf huerefblurs; LUTf chromarefblurs; @@ -316,6 +317,7 @@ protected: LUTf sobelrefs; LUTf avgs; double huer, huerblu, chromarblu, lumarblu, chromar, lumar, sobeler; + int lastsav; float avg; bool lastspotdup; int locallColorMask; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 93e9682df..d08bea13a 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -253,7 +253,7 @@ public: const LocwavCurve & loclmasCurvecolwav, bool & lmasutilicolwav, const LocwavCurve & locwavCurve, bool & locwavutili, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, - double & huerefblur, double &chromarefblur, double & lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, + double & huerefblur, double &chromarefblur, double & lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, int &lastsav, int llColorMask, int llColorMaskinv, int llExpMask, int llExpMaskinv, int llSHMask, int llSHMaskinv, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 44f0ecb3a..b78409c0f 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -7297,7 +7297,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o const LocwavCurve & loclmasCurvecolwav, bool & lmasutilicolwav, const LocwavCurve & locwavCurve, bool & locwavutili, bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, - double & huerefblur, double & chromarefblur, double & lumarefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref, + double & huerefblur, double & chromarefblur, double & lumarefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref, int &lastsav, int llColorMask, int llColorMaskinv, int llExpMask, int llExpMaskinv, int llSHMask, int llSHMaskinv, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 989c7aaf4..3d374ca98 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -821,6 +821,7 @@ enum ProcEventCode { EvLocallabSpotlumask = 791, EvlocallabgamSH = 792, EvlocallabsloSH = 793, + Evlocallabsavrest = 794, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index d5904eb6d..cebfb5713 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2435,6 +2435,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : laplac(false), deltae(true), shortc(false), + savrest(false), scopemask(60), lumask(10), // Color & Light @@ -2742,6 +2743,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && laplac == other.laplac && deltae == other.deltae && shortc == other.shortc + && savrest == other.savrest && scopemask == other.scopemask && lumask == other.lumask // Color & Light @@ -4044,6 +4046,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).laplac, "Locallab", "Laplac_" + std::to_string(i), spot.laplac, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).deltae, "Locallab", "Deltae_" + std::to_string(i), spot.deltae, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).shortc, "Locallab", "Shortc_" + std::to_string(i), spot.shortc, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).savrest, "Locallab", "Savrest_" + std::to_string(i), spot.savrest, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).scopemask, "Locallab", "Scopemask_" + std::to_string(i), spot.scopemask, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).lumask, "Locallab", "Lumask_" + std::to_string(i), spot.lumask, keyFile); // Color & Light @@ -5454,6 +5457,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Laplac_" + std::to_string(i), pedited, spot.laplac, spotEdited.laplac); assignFromKeyfile(keyFile, "Locallab", "Deltae_" + std::to_string(i), pedited, spot.deltae, spotEdited.deltae); assignFromKeyfile(keyFile, "Locallab", "Shortc_" + std::to_string(i), pedited, spot.shortc, spotEdited.shortc); + assignFromKeyfile(keyFile, "Locallab", "Savrest_" + std::to_string(i), pedited, spot.savrest, spotEdited.savrest); assignFromKeyfile(keyFile, "Locallab", "Scopemask_" + std::to_string(i), pedited, spot.scopemask, spotEdited.scopemask); assignFromKeyfile(keyFile, "Locallab", "Lumask_" + std::to_string(i), pedited, spot.lumask, spotEdited.lumask); // Color & Light diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 05781b146..408cd38b0 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -982,6 +982,7 @@ struct LocallabParams { bool laplac; bool deltae; bool shortc; + bool savrest; int scopemask; int lumask; // Color & Light diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 10baaf212..47abc0b67 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -820,7 +820,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallabshortc LUMINANCECURVE, //EvLocallabSpotlumask LUMINANCECURVE, //EvlocallabgamSH - LUMINANCECURVE //EvlocallabsloSH + LUMINANCECURVE, //EvlocallabsloSH + LUMINANCECURVE //Evlocallabsavrest }; namespace rtengine diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 95c978cb5..8a227ebed 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1236,6 +1236,7 @@ private: // Reference parameters computation double huere, chromare, lumare, huerefblu, chromarefblu, lumarefblu, sobelre; + int lastsav; float avge; if (params.locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reservView, reservView, 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge); @@ -1273,7 +1274,7 @@ private: loclmasCurvecolwav,lmasutilicolwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, - huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, lastsav, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 945a68fdf..72a09c2b3 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -75,6 +75,7 @@ ControlSpotPanel::ControlSpotPanel(): laplac_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LAPLACC")))), deltae_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_DELTAEC")))), shortc_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SHORTC")))), + savrest_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SAVREST")))), lastObject_(-1), nbSpotChanged_(false), @@ -251,6 +252,7 @@ ControlSpotPanel::ControlSpotPanel(): if(showtooltip) scopemask_->set_tooltip_text(M("TP_LOCALLAB_SCOPEMASK_TOOLTIP")); // if(showtooltip) lumask_->set_tooltip_text(M("TP_LOCALLAB_LUMASK_TOOLTIP")); if(showtooltip) shortc_->set_tooltip_text(M("TP_LOCALLAB_SHORTCMASK_TOOLTIP")); + if(showtooltip) savrest_->set_tooltip_text(M("TP_LOCALLAB_SAVREST_TOOLTIP")); transit_->setAdjusterListener(this); transitweak_->setAdjusterListener(this); transitgrad_->setAdjusterListener(this); @@ -293,10 +295,13 @@ ControlSpotPanel::ControlSpotPanel(): sigc::mem_fun(*this, &ControlSpotPanel::deltaeChanged)); shortcConn_ = shortc_->signal_toggled().connect( sigc::mem_fun(*this, &ControlSpotPanel::shortcChanged)); + savrestConn_ = savrest_->signal_toggled().connect( + sigc::mem_fun(*this, &ControlSpotPanel::savrestChanged)); maskBox->pack_start(*deltae_); maskBox->pack_start(*scopemask_); maskBox->pack_start(*shortc_); maskBox->pack_start(*lumask_); +// maskBox->pack_start(*savrest_); maskFrame->add(*maskBox); pack_start(*maskFrame); @@ -608,6 +613,7 @@ void ControlSpotPanel::load_ControlSpot_param() laplac_->set_active(row[spots_.laplac]); deltae_->set_active(row[spots_.deltae]); shortc_->set_active(row[spots_.shortc]); + savrest_->set_active(row[spots_.savrest]); } void ControlSpotPanel::controlspotChanged() @@ -1194,6 +1200,40 @@ void ControlSpotPanel::shortcChanged() } } +void ControlSpotPanel::savrestChanged() +{ + + // 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; + + if (multiImage) { + if (savrest_->get_inconsistent()) { + savrest_->set_inconsistent(false); + savrestConn_.block(true); + savrest_->set_active(false); + savrestConn_.block(false); + } + } + + row[spots_.savrest] = savrest_->get_active(); + + // Raise event + if (listener) { + if (savrest_->get_active()) { + listener->panelChanged(Evlocallabsavrest, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(Evlocallabsavrest, M("GENERAL_DISABLED")); + } + } +} + void ControlSpotPanel::disableParamlistener(bool cond) { @@ -1231,6 +1271,7 @@ void ControlSpotPanel::disableParamlistener(bool cond) laplacConn_.block(cond); deltaeConn_.block(cond); shortcConn_.block(cond); + savrestConn_.block(cond); } void ControlSpotPanel::setParamEditable(bool cond) @@ -1263,6 +1304,7 @@ void ControlSpotPanel::setParamEditable(bool cond) laplac_->set_sensitive(cond); deltae_->set_sensitive(cond); shortc_->set_sensitive(cond); + savrest_->set_sensitive(cond); } void ControlSpotPanel::addControlSpotCurve(Gtk::TreeModel::Row& row) @@ -1901,6 +1943,7 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(const int id) r->laplac = row[spots_.laplac]; r->deltae = row[spots_.deltae]; r->shortc = row[spots_.shortc]; + r->savrest = row[spots_.savrest]; return r; } @@ -2032,6 +2075,7 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot) row[spots_.laplac] = newSpot->laplac; row[spots_.deltae] = newSpot->deltae; row[spots_.shortc] = newSpot->shortc; + row[spots_.savrest] = newSpot->savrest; updateParamVisibility(); disableParamlistener(false); @@ -2082,6 +2126,7 @@ int ControlSpotPanel::updateControlSpot(SpotRow* spot) row[spots_.laplac] = spot->laplac; row[spots_.deltae] = spot->deltae; row[spots_.shortc] = spot->shortc; + row[spots_.savrest] = spot->savrest; updateControlSpotCurve(row); updateParamVisibility(); @@ -2178,6 +2223,7 @@ ControlSpotPanel::SpotEdited* ControlSpotPanel::getEditedStates() se->laplac = !laplac_->get_inconsistent(); se->deltae = !deltae_->get_inconsistent(); se->shortc = !shortc_->get_inconsistent(); + se->savrest = !savrest_->get_inconsistent(); return se; } @@ -2252,6 +2298,7 @@ void ControlSpotPanel::setEditedStates(SpotEdited* se) laplac_->set_inconsistent(multiImage && !se->laplac); deltae_->set_inconsistent(multiImage && !se->deltae); shortc_->set_inconsistent(multiImage && !se->shortc); + savrest_->set_inconsistent(multiImage && !se->savrest); // Update Control Spot GUI according to widgets edited states updateParamVisibility(); @@ -2415,6 +2462,7 @@ ControlSpotPanel::ControlSpots::ControlSpots() add(laplac); add(deltae); add(shortc); + add(savrest); } //----------------------------------------------------------------------------- diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index d21537221..1775a5744 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -71,6 +71,7 @@ public: bool laplac; bool deltae; bool shortc; + bool savrest; }; /** @@ -107,6 +108,7 @@ public: bool laplac; bool deltae; bool shortc; + bool savrest; }; /** @@ -276,6 +278,7 @@ private: void laplacChanged(); void deltaeChanged(); void shortcChanged(); + void savrestChanged(); void disableParamlistener(bool cond); @@ -328,6 +331,7 @@ private: Gtk::TreeModelColumn laplac; Gtk::TreeModelColumn deltae; Gtk::TreeModelColumn shortc; + Gtk::TreeModelColumn savrest; }; class RenameDialog: @@ -402,6 +406,8 @@ private: sigc::connection deltaeConn_; Gtk::CheckButton* const shortc_; sigc::connection shortcConn_; + Gtk::CheckButton* const savrest_; + sigc::connection savrestConn_; // Internal variables int lastObject_; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index ab301c8ef..84b37620b 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -2887,6 +2887,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) r->laplac = pp->locallab.spots.at(i).laplac; r->deltae = pp->locallab.spots.at(i).deltae; r->shortc = pp->locallab.spots.at(i).shortc; + r->savrest = pp->locallab.spots.at(i).savrest; expsettings->addControlSpot(r); } @@ -3019,6 +3020,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) r->laplac = newSpot->laplac; r->deltae = newSpot->deltae; r->shortc = newSpot->shortc; + r->savrest = newSpot->savrest; expsettings->addControlSpot(r); // ProcParams update @@ -3240,6 +3242,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) r->laplac = newSpot->laplac; r->deltae = newSpot->deltae; r->shortc = newSpot->shortc; + r->savrest = newSpot->savrest; expsettings->addControlSpot(r); // ProcParams update @@ -3359,6 +3362,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).laplac = r->laplac; pp->locallab.spots.at(pp->locallab.selspot).deltae = r->deltae; pp->locallab.spots.at(pp->locallab.selspot).shortc = r->shortc; + pp->locallab.spots.at(pp->locallab.selspot).savrest = r->savrest; // Color & Light pp->locallab.spots.at(pp->locallab.selspot).expcolor = expcolor->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).curvactiv = curvactiv->get_active(); @@ -3759,6 +3763,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).laplac = pe->locallab.spots.at(pp->locallab.selspot).laplac || se->laplac; pe->locallab.spots.at(pp->locallab.selspot).deltae = pe->locallab.spots.at(pp->locallab.selspot).deltae || se->deltae; pe->locallab.spots.at(pp->locallab.selspot).shortc = pe->locallab.spots.at(pp->locallab.selspot).shortc || se->shortc; + pe->locallab.spots.at(pp->locallab.selspot).savrest = pe->locallab.spots.at(pp->locallab.selspot).savrest || se->savrest; // 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(); @@ -4075,6 +4080,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).laplac = pedited->locallab.spots.at(pp->locallab.selspot).laplac || se->laplac; pedited->locallab.spots.at(pp->locallab.selspot).deltae = pedited->locallab.spots.at(pp->locallab.selspot).deltae || se->deltae; pedited->locallab.spots.at(pp->locallab.selspot).shortc = pedited->locallab.spots.at(pp->locallab.selspot).shortc || se->shortc; + pedited->locallab.spots.at(pp->locallab.selspot).savrest = pedited->locallab.spots.at(pp->locallab.selspot).savrest || se->savrest; // 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(); @@ -8800,6 +8806,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con se->laplac = spotState->laplac; se->deltae = spotState->deltae; se->shortc = spotState->shortc; + se->savrest = spotState->savrest; expsettings->setEditedStates(se); // Color & Light diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index c2ecbd773..6400adb7b 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -976,6 +976,7 @@ void ParamsEdited::initFrom(const std::vector& 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; locallab.spots.at(j).shortc = locallab.spots.at(j).shortc && pSpot.shortc == otherSpot.shortc; + locallab.spots.at(j).savrest = locallab.spots.at(j).savrest && pSpot.savrest == otherSpot.savrest; locallab.spots.at(j).scopemask = locallab.spots.at(j).scopemask && pSpot.scopemask == otherSpot.scopemask; locallab.spots.at(j).lumask = locallab.spots.at(j).lumask && pSpot.lumask == otherSpot.lumask; // Color & Light @@ -2830,6 +2831,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).shortc = mods.locallab.spots.at(i).shortc; } + if (locallab.spots.at(i).savrest) { + toEdit.locallab.spots.at(i).savrest = mods.locallab.spots.at(i).savrest; + } + // Color & Light if (locallab.spots.at(i).expcolor) { toEdit.locallab.spots.at(i).expcolor = mods.locallab.spots.at(i).expcolor; @@ -4873,6 +4878,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : laplac(v), deltae(v), shortc(v), + savrest(v), scopemask(v), lumask(v), // Color & Light @@ -5177,6 +5183,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) laplac = v; deltae = v; shortc = v; + savrest = v; scopemask = v; lumask = v; // Color & Light diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index da5fa427b..b15802ab7 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -394,6 +394,7 @@ public: bool laplac; bool deltae; bool shortc; + bool savrest; bool scopemask; bool lumask; // Color & Light