From fc6e4ceaf1d6280653999d8d92a5dc71a4669f5e Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Sat, 19 Jan 2019 14:11:12 +0100 Subject: [PATCH] Improve mask visibility selection in GUI --- rtdata/languages/default | 3 + rtengine/dcrop.cc | 10 +- rtengine/improccoordinator.cc | 15 +- rtengine/improccoordinator.h | 14 +- rtengine/improcfun.h | 2 +- rtengine/iplocallab.cc | 78 ++++------ rtengine/procevents.h | 2 + rtengine/procparams.cc | 25 ++-- rtengine/procparams.h | 6 +- rtengine/refreshmap.cc | 46 +++--- rtengine/rtengine.h | 2 + rtengine/simpleprocess.cc | 3 +- rtgui/locallab.cc | 272 ++++++++++++++++++---------------- rtgui/locallab.h | 36 +++-- rtgui/paramsedited.cc | 38 ++--- rtgui/paramsedited.h | 6 +- rtgui/toolpanelcoord.cc | 14 +- 17 files changed, 309 insertions(+), 263 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index a51999ede..8c74c43cb 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -864,6 +864,8 @@ HISTORY_MSG_608;Local - Color Mask L HISTORY_MSG_609;Local - Exp Mask C HISTORY_MSG_610;Local - Exp Mask L HISTORY_MSG_611;Local - Color Mask H +HISTORY_MSG_612;Local - Use Color Mask +HISTORY_MSG_613;Local - Use Exp Mask HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2029,6 +2031,7 @@ TP_LOCALLAB_SENSICB;Scope TP_LOCALLAB_SENSIBN;Scope TP_LOCALLAB_SENSIS_TOOLTIP;Adjust scope of action:\nSmall values limit action to colors very similar to those under the center spot.\nHigh values let the tool act upon a wider range of colors.\nValues smaller than 20 lead to a better algorithm. TP_LOCALLAB_SETTINGS;Settings +TP_LOCALLAB_ENABLE_MASK;Enable mask TP_LOCALLAB_SHOW;Mask and modifications TP_LOCALLAB_SHOWMASKCOL_TOOLTIP;Display modifications.\nBeware, you can only view one modification (color and light or Exposure).\nYou must put 'Display modification' to 'none' or 'Usemask' to enabled the other show.\n\nUse Mask is before algorihtm shape detection TP_LOCALLAB_SHOWMNONE;None diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index cca4fd2ec..21d86e2b2 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -951,8 +951,14 @@ void Crop::update(int todo) hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, sca); - parent->ipf.Lab_Local(1, sp, parent->sobelrefs, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, - loclhCurve, lochhCurve, locccmasCurve, locllmasCurve, lochhmasCurve, locccmasexpCurve, locllmasexpCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, huere, chromare, lumare, sobelre); + // Locallab mask are only shown for selected spot + if (sp == parent->params.locallab.selspot) { + parent->ipf.Lab_Local(1, sp, parent->sobelrefs, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, + loclhCurve, lochhCurve, locccmasCurve, locllmasCurve, lochhmasCurve, locccmasexpCurve, locllmasexpCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, huere, chromare, lumare, sobelre, parent->locallColorMask, parent->locallExpMask); + } else { + parent->ipf.Lab_Local(1, sp, parent->sobelrefs, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, + loclhCurve, lochhCurve, locccmasCurve, locllmasCurve, lochhmasCurve, locccmasexpCurve, locllmasexpCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, huere, chromare, lumare, sobelre, 0, 0); + } lllocalcurve2.clear(); cclocalcurve2.clear(); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 267c95aea..9a80c45f0 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -119,7 +119,9 @@ ImProcCoordinator::ImProcCoordinator() chromar(0), lumar(0), sobeler(0), - lastspotdup(false), + lastspotdup(false), + locallColorMask(0), + locallExpMask(0), retistrsav(nullptr) {} @@ -827,11 +829,16 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // Locallab tools computation /* Notes: - * - maxspot, huerefs, centerx and centery aren't used in Lab_Local (only for printf) so values aren't important * - shbuffer is used as nullptr */ - ipf.Lab_Local(3, sp, sobelrefs, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, locccmasCurve, locllmasCurve, lochhmasCurve, locccmasexpCurve, locllmasexpCurve, - LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, huer, chromar, lumar, sobeler); + // Locallab mask are only shown for selected spot + if (sp == params.locallab.selspot) { + ipf.Lab_Local(3, sp, sobelrefs, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, locccmasCurve, locllmasCurve, lochhmasCurve, locccmasexpCurve, locllmasexpCurve, + LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, huer, chromar, lumar, sobeler, locallColorMask, locallExpMask); + } else { + ipf.Lab_Local(3, sp, sobelrefs, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, locccmasCurve, locllmasCurve, lochhmasCurve, locccmasexpCurve, locllmasexpCurve, + LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, huer, chromar, lumar, sobeler, 0, 0); + } if (params.locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reserv, reserv, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index d835e5100..661be70c9 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -254,12 +254,8 @@ protected: LUTf sobelrefs; double huer, huerblu, chromar, lumar, sobeler; bool lastspotdup; - - - - - - + int locallColorMask; + int locallExpMask; public: @@ -331,6 +327,12 @@ public: updaterThreadStart.unlock(); } + void setLocallabMaskVisibility (int locallColorMask, int locallExpMask) override + { + this->locallColorMask = locallColorMask; + this->locallExpMask = locallExpMask; + } + void setProgressListener (ProgressListener* pl) override { plistener = pl; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 35adef0d6..15f47e350 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -289,7 +289,7 @@ public: void calc_ref(int sp, LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huerefblur, double &huere, double &chromare, double &lumare, double &sobelref, LUTu & histogram); void copy_ref(LabImage* spotbuffer, LabImage* original, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp, double &huerefspot, double &chromarefspot, double &lumarefspot); void paste_ref(LabImage* spotbuffer, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp); - void Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const LocCCmaskCurve & locccmasCurve, const LocLLmaskCurve & locllmasCurve, const LocHHmaskCurve & lochhmasCurve, const LocCCmaskexpCurve & locccmasexpCurve, const LocLLmaskexpCurve & locllmasexpCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, LUTf & lightCurveloc, double & huerefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref); + void Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const LocCCmaskCurve & locccmasCurve, const LocLLmaskCurve & locllmasCurve, const LocHHmaskCurve & lochhmasCurve, const LocCCmaskexpCurve & locccmasexpCurve, const LocLLmaskexpCurve & locllmasexpCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, LUTf & lightCurveloc, double & huerefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, int llColorMask, int llExpMask); void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk); void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); void InverseBlurNoise_Local(const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 09a616ebc..bbb64ac4c 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -220,8 +220,8 @@ struct local_params { int war; float adjch; int shapmet; - - + bool enaColorMask; + bool enaExpMask; }; static void SobelCannyLuma(float **sobelL, float **luma, int bfw, int bfh, float radius) @@ -337,7 +337,7 @@ static void SobelCannyLuma(float **sobelL, float **luma, int bfw, int bfh, float -static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locallab, struct local_params& lp) +static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locallab, struct local_params& lp, int llColorMask, int llExpMask) { int w = oW; int h = oH; @@ -389,30 +389,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.qualcurvemet = 5; } - if (locallab.spots.at(sp).showmaskcolMethod == "none") { - lp.showmaskcolmet = 0; - } else if (locallab.spots.at(sp).showmaskcolMethod == "color") { - lp.showmaskcolmet = 1; - } else if (locallab.spots.at(sp).showmaskcolMethod == "colormask") { - lp.showmaskcolmet = 2; - } else if (locallab.spots.at(sp).showmaskcolMethod == "mask") { - lp.showmaskcolmet = 3; - } else if (locallab.spots.at(sp).showmaskcolMethod == "showmask") { - lp.showmaskcolmet = 4; - } - - if (locallab.spots.at(sp).showmaskexpMethod == "none") { - lp.showmaskexpmet = 0; - } else if (locallab.spots.at(sp).showmaskexpMethod == "expo") { - lp.showmaskexpmet = 1; - } else if (locallab.spots.at(sp).showmaskexpMethod == "expomask") { - lp.showmaskexpmet = 2; - } else if (locallab.spots.at(sp).showmaskexpMethod == "mask") { - lp.showmaskexpmet = 3; - } else if (locallab.spots.at(sp).showmaskexpMethod == "showmask") { - lp.showmaskexpmet = 4; - } - + lp.showmaskcolmet = llColorMask; + lp.showmaskexpmet = llExpMask; + lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llColorMask == 0 && llExpMask == 0; // Color & Light mask is deactivated if Exposure mask is visible + lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0; // Exposure mask is deactivated if Color & Light mask is visible if (locallab.spots.at(sp).blurMethod == "norm") { lp.blurmet = 0; @@ -558,7 +538,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.threshol = thresho; lp.chromacb = chromcbdl; - lp.colorena = locallab.spots.at(sp).expcolor; + lp.colorena = locallab.spots.at(sp).expcolor && llExpMask == 0; // Color & Light tool is deactivated if Exposure mask is visible lp.blurena = locallab.spots.at(sp).expblur; lp.tonemapena = locallab.spots.at(sp).exptonemap; lp.retiena = locallab.spots.at(sp).expreti; @@ -572,7 +552,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.past = chromaPastel; lp.satur = chromaSatur; - lp.exposena = locallab.spots.at(sp).expexpose; + lp.exposena = locallab.spots.at(sp).expexpose && llColorMask == 0; // Exposure tool is deactivated if Color & Light mask is visible lp.cut_past = cupas; lp.blac = locallab.spots.at(sp).black; lp.shcomp = locallab.spots.at(sp).shcompr; @@ -5109,7 +5089,7 @@ void ImProcFunctions::Expo_vibr_Local(float moddE, float powdE, int senstype, La LabImage *origblurmask = nullptr; float radius = 3.f / sk; - bool usemask = lp.showmaskexpmet >= 2 && senstype == 1; + bool usemask = (lp.showmaskexpmet >= 2 || lp.enaExpMask) && senstype == 1; if (usemask) { origblurmask = new LabImage(GW, GH); @@ -5638,7 +5618,7 @@ void ImProcFunctions::Expo_vibr_Local(float moddE, float powdE, int senstype, La } delete origblur; - if (lp.showmaskcolmet >= 2 && senstype == 1) { + if ((lp.showmaskcolmet >= 2 || lp.enaColorMask) && senstype == 1) { delete origblurmask; } @@ -5736,7 +5716,7 @@ void ImProcFunctions::ColorLight_Local(float moddE, float powdE, int call, LabIm float radius = 3.f / sk; - if (lp.showmaskcolmet >= 2) { + if (lp.showmaskcolmet >= 2 || lp.enaColorMask) { origblurmask = new LabImage(GW, GH); #ifdef _OPENMP @@ -5843,7 +5823,7 @@ void ImProcFunctions::ColorLight_Local(float moddE, float powdE, int call, LabIm float rhuemask = 0.f; float rchromask = 0.f; float rLmask = 0.f; - if (lp.showmaskcolmet >= 2) { + if (lp.showmaskcolmet >= 2 || lp.enaColorMask) { rhuemask = xatan2f(origblurmask->b[y][x], origblurmask->a[y][x]); rchromask = sqrt(SQR(origblurmask->b[y][x]) + SQR(origblurmask->a[y][x])) / 327.68f; rLmask = origblurmask->L[y][x] / 327.68f; @@ -6553,7 +6533,7 @@ void ImProcFunctions::ColorLight_Local(float moddE, float powdE, int call, LabIm } delete origblur; - if (lp.showmaskcolmet >= 2) { + if (lp.showmaskcolmet >= 2 || lp.enaColorMask) { delete origblurmask; } } @@ -7056,7 +7036,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform if (params->locallab.enabled) { //always calculate hueref, chromaref, lumaref before others operations use in normal mode for all modules exceprt denoise struct local_params lp; - calcLocalParams(sp, oW, oH, params->locallab, lp); + calcLocalParams(sp, oW, oH, params->locallab, lp, 0, 0); int begy = lp.yc - lp.lyT; int begx = lp.xc - lp.lxL; int yEn = lp.yc + lp.ly; @@ -7579,7 +7559,7 @@ void ImProcFunctions::fftw_denoise(int GW, int GH, int max_numblox_W, int min_nu void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbuffer, LabImage * original, LabImage * transformed, LabImage * reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const LocCCmaskCurve & locccmasCurve, const LocLLmaskCurve & locllmasCurve, const LocHHmaskCurve & lochhmasCurve, const LocCCmaskexpCurve & locccmasexpCurve, const LocLLmaskexpCurve & locllmasexpCurve, - bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref) + bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref, int llColorMask, int llExpMask) { //general call of others functions : important return hueref, chromaref, lumaref if (params->locallab.enabled) { @@ -7594,7 +7574,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu int del = 3; // to avoid crash with [loy - begy] and [lox - begx] and bfh bfw // with gtk2 [loy - begy-1] [lox - begx -1 ] and del = 1 struct local_params lp; - calcLocalParams(sp, oW, oH, params->locallab, lp); + calcLocalParams(sp, oW, oH, params->locallab, lp, llColorMask, llExpMask); const float radius = lp.rad / (sk * 1.4f); //0 to 70 ==> see skip int strred = (lp.strucc - 1); @@ -10771,7 +10751,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu //local color and light - if (!lp.inv && (lp.chro != 0 || lp.ligh != 0.f || lp.cont != 0 || lp.qualcurvemet != 0 || lp.showmaskcolmet >= 2) && lp.colorena) { // || lllocalcurve)) { //interior ellipse renforced lightness and chroma //locallutili + if (!lp.inv && (lp.chro != 0 || lp.ligh != 0.f || lp.cont != 0 || lp.qualcurvemet != 0 || lp.showmaskcolmet >= 2 || lp.enaColorMask) && lp.colorena) { // || lllocalcurve)) { //interior ellipse renforced lightness and chroma //locallutili float hueplus = hueref + dhue; float huemoins = hueref - dhue; @@ -10883,7 +10863,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu float kmaskHa = 0; float kmaskHb = 0; - if (lp.showmaskcolmet >= 2) { + if (lp.showmaskcolmet >= 2 || lp.enaColorMask) { if (locllmasCurve) { valLL = (float)(locllmasCurve[500.f * (bufcolorig->L[loy - begy][lox - begx]) / 32768.f]); valLL = 1.f - valLL; @@ -10928,7 +10908,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu float radiusb = 3.f / sk; - if (lp.showmaskcolmet >= 2) { + if (lp.showmaskcolmet >= 2 || lp.enaColorMask) { #ifdef _OPENMP #pragma omp parallel @@ -10944,7 +10924,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu originalmask = new LabImage(GWm, GHm); - if (lp.showmaskcolmet == 2 || lp.showmaskcolmet == 3) { + if (lp.showmaskcolmet == 2 || lp.enaColorMask) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) @@ -10976,7 +10956,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu } } } - } else if (lp.showmaskcolmet == 4) { + } else if (lp.showmaskcolmet == 3) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -11009,7 +10989,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu - if (lp.showmaskcolmet != 4) { + if (lp.showmaskcolmet != 3 || lp.enaColorMask) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -11149,7 +11129,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu - if (lp.exposena && (lp.expcomp != 0.f || lp.war != 0 || lp.showmaskexpmet >= 2 || (exlocalcurve && localexutili))) { //interior ellipse renforced lightness and chroma //locallutili + if (lp.exposena && (lp.expcomp != 0.f || lp.war != 0 || lp.showmaskexpmet >= 2 || lp.enaExpMask || (exlocalcurve && localexutili))) { //interior ellipse renforced lightness and chroma //locallutili float hueplus = hueref + dhuev; float huemoins = hueref - dhuev; @@ -11252,7 +11232,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu float valCC = 0.f; float2 sincosval; - if (lp.showmaskexpmet >= 2) { + if (lp.showmaskexpmet >= 2 || lp.enaExpMask) { if (locllmasexpCurve) { valLL = (float)(locllmasexpCurve[500.f * (bufexporig->L[loy - begy][lox - begx]) / 32768.f]); valLL = 1.f - valLL; @@ -11275,7 +11255,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu float radiusb = 3.f / sk; - if (lp.showmaskexpmet >= 2) { + if (lp.showmaskexpmet >= 2 || lp.enaExpMask) { #ifdef _OPENMP #pragma omp parallel @@ -11291,7 +11271,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu originalmask = new LabImage(GWm, GHm); - if (lp.showmaskexpmet == 2 || lp.showmaskexpmet == 3) { + if (lp.showmaskexpmet == 2 || lp.enaExpMask) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) @@ -11323,7 +11303,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu } } } - } else if (lp.showmaskexpmet == 4) { + } else if (lp.showmaskexpmet == 3) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -11355,7 +11335,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu } - if (lp.showmaskexpmet != 4) { + if (lp.showmaskexpmet != 3 || lp.enaExpMask) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 98299dbfd..519c49eac 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -638,6 +638,8 @@ enum ProcEventCode { EvlocallabCCmaskexpshape = 608, EvlocallabLLmaskexpshape = 609, EvlocallabHHmaskshape = 610, + EvLocallabEnaColorMask = 611, + EvLocallabEnaExpMask = 612, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 2a5715401..33ba6085f 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2363,15 +2363,15 @@ LocallabParams::LocallabSpot::LocallabSpot() : chroma(0), sensi(19), qualitycurveMethod("none"), - showmaskcolMethod("none"), llcurve{(double)DCT_NURBS, 0.0, 0.0, 1.0, 1.0}, cccurve{(double)DCT_NURBS, 0.0, 0.0, 1.0, 1.0}, LHcurve{(double)FCT_MinMaxCPoints, 0.0, 0.50, 0.35, 0.35, 0.166, 0.50, 0.35, 0.35, 0.333, 0.50, 0.35, 0.35, 0.50, 0.50, 0.35, 0.35, 0.666, 0.50, 0.35, 0.35, 0.833, 0.50, 0.35, 0.35}, HHcurve{(double)FCT_MinMaxCPoints, 0.0, 0.50, 0.35, 0.35, 0.166, 0.50, 0.35, 0.35, 0.333, 0.50, 0.35, 0.35, 0.50, 0.50, 0.35, 0.35, 0.666, 0.50, 0.35, 0.35, 0.833, 0.50, 0.35, 0.35}, + invers(false), + enaColorMask(false), CCmaskcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, LLmaskcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, HHmaskcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, - invers(false), // Exposure expexpose(false), expcomp(0), @@ -2382,10 +2382,9 @@ LocallabParams::LocallabSpot::LocallabSpot() : warm(0), sensiex(19), excurve{(double)DCT_NURBS, 0.0, 0.0, 1.0, 1.0}, - showmaskexpMethod("none"), + enaExpMask(false), CCmaskexpcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, LLmaskexpcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, - // Vibrance expvibrance(false), saturated(0), @@ -2499,15 +2498,15 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && chroma == other.chroma && sensi == other.sensi && qualitycurveMethod == other.qualitycurveMethod - && showmaskcolMethod == other.showmaskcolMethod && llcurve == other.llcurve && cccurve == other.cccurve && LHcurve == other.LHcurve && HHcurve == other.HHcurve + && invers == other.invers + && enaColorMask == other.enaColorMask && CCmaskcurve == other.CCmaskcurve && LLmaskcurve == other.LLmaskcurve && HHmaskcurve == other.HHmaskcurve - && invers == other.invers // Exposure && expexpose == other.expexpose && expcomp == other.expcomp @@ -2518,7 +2517,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && warm == other.warm && sensiex == other.sensiex && excurve == other.excurve - && showmaskexpMethod == other.showmaskexpMethod + && enaExpMask == other.enaExpMask && CCmaskexpcurve == other.CCmaskexpcurve && LLmaskexpcurve == other.LLmaskexpcurve // Vibrance @@ -3587,15 +3586,15 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo 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).showmaskcolMethod, "Locallab", "ShowmaskcolMethod_" + std::to_string(i), spot.showmaskcolMethod, 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); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enaColorMask, "Locallab", "EnaColorMask_" + std::to_string(i), spot.enaColorMask, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskcurve, "Locallab", "CCmaskCurve_" + std::to_string(i), spot.CCmaskcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskcurve, "Locallab", "LLmaskCurve_" + std::to_string(i), spot.LLmaskcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskcurve, "Locallab", "HHmaskCurve_" + std::to_string(i), spot.HHmaskcurve, 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); @@ -3606,7 +3605,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo 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); - saveToKeyfile(!pedited || pedited->locallab.spots.at(i).showmaskexpMethod, "Locallab", "ShowmaskexpMethod_" + std::to_string(i), spot.showmaskexpMethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enaExpMask, "Locallab", "EnaExpMask_" + std::to_string(i), spot.enaExpMask, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskexpcurve, "Locallab", "CCmaskexpCurve_" + std::to_string(i), spot.CCmaskexpcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskexpcurve, "Locallab", "LLmaskexpCurve_" + std::to_string(i), spot.LLmaskexpcurve, keyFile); // Vibrance @@ -4802,15 +4801,15 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) 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", "ShowmaskcolMethod_" + std::to_string(i), pedited, spot.showmaskcolMethod, spotEdited.showmaskcolMethod); 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); + assignFromKeyfile(keyFile, "Locallab", "EnaColorMask_" + std::to_string(i), pedited, spot.enaColorMask, spotEdited.enaColorMask); assignFromKeyfile(keyFile, "Locallab", "CCmaskCurve_" + std::to_string(i), pedited, spot.CCmaskcurve, spotEdited.CCmaskcurve); assignFromKeyfile(keyFile, "Locallab", "LLmaskCurve_" + std::to_string(i), pedited, spot.LLmaskcurve, spotEdited.LLmaskcurve); assignFromKeyfile(keyFile, "Locallab", "HHmaskCurve_" + std::to_string(i), pedited, spot.HHmaskcurve, spotEdited.HHmaskcurve); - 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, spotEdited.expexpose); assignFromKeyfile(keyFile, "Locallab", "Expcomp_" + std::to_string(i), pedited, spot.expcomp, spotEdited.expcomp); @@ -4821,7 +4820,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) 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); - assignFromKeyfile(keyFile, "Locallab", "ShowmaskexpMethod_" + std::to_string(i), pedited, spot.showmaskexpMethod, spotEdited.showmaskexpMethod); + assignFromKeyfile(keyFile, "Locallab", "EnaExpMask_" + std::to_string(i), pedited, spot.enaExpMask, spotEdited.enaExpMask); assignFromKeyfile(keyFile, "Locallab", "CCmaskexpCurve_" + std::to_string(i), pedited, spot.CCmaskexpcurve, spotEdited.CCmaskexpcurve); assignFromKeyfile(keyFile, "Locallab", "LLmaskexpCurve_" + std::to_string(i), pedited, spot.LLmaskexpcurve, spotEdited.LLmaskexpcurve); // Vibrance diff --git a/rtengine/procparams.h b/rtengine/procparams.h index bf8d32af9..8ad43c472 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -960,15 +960,15 @@ struct LocallabParams { int chroma; int sensi; Glib::ustring qualitycurveMethod; - Glib::ustring showmaskcolMethod; std::vector llcurve; std::vector cccurve; std::vector LHcurve; std::vector HHcurve; + bool invers; + bool enaColorMask; std::vector CCmaskcurve; std::vector LLmaskcurve; std::vector HHmaskcurve; - bool invers; // Exposure bool expexpose; int expcomp; @@ -979,7 +979,7 @@ struct LocallabParams { int warm; int sensiex; std::vector excurve; - Glib::ustring showmaskexpMethod; + bool enaExpMask; std::vector CCmaskexpcurve; std::vector LLmaskexpcurve; // Vibrance diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 089533f53..e0616c645 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -523,7 +523,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { 0, // unused LUMINANCECURVE, // EvLocallabSpotCreated LUMINANCECURVE, // EvLocallabSpotDeleted - M_VOID, // EvLocallabSpotSelected + LUMINANCECURVE, // EvLocallabSpotSelected M_VOID, // EvLocallabSpotName M_VOID, // EvLocallabSpotVisibility LUMINANCECURVE, // EvLocallabSpotShape @@ -617,27 +617,29 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabadjblur LUMINANCECURVE, // Evlocallabbilateral LUMINANCECURVE, // Evlocallabsensiden - LUMINANCECURVE, // Evlocallabavoid - LUMINANCECURVE, // Evlocallabsharcontrast - LUMINANCECURVE, //EvLocenacontrast - LUMINANCECURVE, //Evlocallablcradius - LUMINANCECURVE, //Evlocallablcamount - LUMINANCECURVE, //Evlocallablcdarkness - LUMINANCECURVE, //Evlocallablclightness - LUMINANCECURVE, //Evlocallabsensilc - LUMINANCECURVE, //Evlocallabdehaz - LUMINANCECURVE, //EvLocenasoft - LUMINANCECURVE, //EvLocallabstreng - LUMINANCECURVE, //EvLocallabsensisf - LUMINANCECURVE, //Evlocallabsharblur - LUMINANCECURVE, //EvLocenalabregion - LUMINANCECURVE, //EvlocallabshowmaskcolMethod - LUMINANCECURVE, //EvlocallabshowmaskexpMethod - LUMINANCECURVE, //EvlocallabCCmaskshape - LUMINANCECURVE, //EvlocallabLLmaskshape - LUMINANCECURVE, //EvlocallabCCmaskexpshape - LUMINANCECURVE, //EvlocallabLLmaskexpshape - LUMINANCECURVE //EvlocallabHHmaskshape + LUMINANCECURVE, // Evlocallabavoid + LUMINANCECURVE, // Evlocallabsharcontrast + LUMINANCECURVE, // EvLocenacontrast + LUMINANCECURVE, // Evlocallablcradius + LUMINANCECURVE, // Evlocallablcamount + LUMINANCECURVE, // Evlocallablcdarkness + LUMINANCECURVE, // Evlocallablclightness + LUMINANCECURVE, // Evlocallabsensilc + LUMINANCECURVE, // Evlocallabdehaz + LUMINANCECURVE, // EvLocenasoft + LUMINANCECURVE, // EvLocallabstreng + LUMINANCECURVE, // EvLocallabsensisf + LUMINANCECURVE, // Evlocallabsharblur + LUMINANCECURVE, // EvLocenalabregion + LUMINANCECURVE, // EvlocallabshowmaskcolMethod + LUMINANCECURVE, // EvlocallabshowmaskexpMethod + LUMINANCECURVE, // EvlocallabCCmaskshape + LUMINANCECURVE, // EvlocallabLLmaskshape + LUMINANCECURVE, // EvlocallabCCmaskexpshape + LUMINANCECURVE, // EvlocallabLLmaskexpshape + LUMINANCECURVE, // EvlocallabHHmaskshape + LUMINANCECURVE, // EvLocallabEnaColorMask + LUMINANCECURVE // EvLocallabEnaExpMask }; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index fa6b3d7f6..cded632e1 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -484,6 +484,8 @@ public: virtual void updateUnLock() = 0; + virtual void setLocallabMaskVisibility(int locallColorMask, int locallExpMask) = 0; + /** Creates and returns a Crop instance that acts as a window on the image * @param editDataProvider pointer to the EditDataProvider that communicates with the EditSubscriber * @return a pointer to the Crop object that handles the image data trough its own pipeline */ diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 183c995c5..377ce28c1 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1141,8 +1141,9 @@ private: hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, 1); + // No Locallab mask is shown in exported picture ipf.Lab_Local(2, sp, sobelrefs, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, locccmasCurve, locllmasCurve, lochhmasCurve, locccmasexpCurve, locllmasexpCurve, - LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, huere, chromare, lumare, sobelre); + LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, huere, chromare, lumare, sobelre, 0, 0); // Clear local curves lllocalcurve.clear(); diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 055ed98e7..89b7c78f7 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -143,6 +143,9 @@ Locallab::Locallab(): // Color & Light curvactiv(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_CURV")))), invers(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), + enaColorMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), + // Exposure + enaExpMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), // Vibrance protectSkins(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PROTECTSKINS")))), avoidColorShift(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_AVOIDCOLORSHIFT")))), @@ -176,6 +179,9 @@ Locallab::Locallab(): 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")))), + transLabels(Gtk::manage (new Gtk::Label ("---"))), + transLabels2(Gtk::manage (new Gtk::Label ("---"))), + maskcolFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW")))), // Others defparams(nullptr), @@ -225,16 +231,6 @@ Locallab::Locallab(): qualitycurveMethod->set_active(0); qualitycurveMethod->set_tooltip_markup(M("TP_LOCALLAB_CURVEMETHOD_TOOLTIP")); qualitycurveMethodConn = qualitycurveMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::qualitycurveMethodChanged)); - - showmaskcolMethod->append(M("TP_LOCALLAB_SHOWMNONE")); - showmaskcolMethod->append(M("TP_LOCALLAB_SHOWMODIF")); - showmaskcolMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); - showmaskcolMethod->append(M("TP_LOCALLAB_USEMASK")); - showmaskcolMethod->append(M("TP_LOCALLAB_SHOWMASK")); - - showmaskcolMethod->set_active(0); - showmaskcolMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); - showmaskcolMethodConn = showmaskcolMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskcolMethodChanged)); llCurveEditorG->setCurveListener(this); @@ -290,10 +286,21 @@ Locallab::Locallab(): HHshape->setBottomBarBgGradient(mHHshape); llCurveEditorG->curveListComplete(); - maskCurveEditorG->setCurveListener(this); inversConn = invers->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversChanged)); - transLabels = Gtk::manage (new Gtk::Label ("---")); + + showmaskcolMethod->append(M("TP_LOCALLAB_SHOWMNONE")); + showmaskcolMethod->append(M("TP_LOCALLAB_SHOWMODIF")); + showmaskcolMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); + showmaskcolMethod->append(M("TP_LOCALLAB_SHOWMASK")); + + showmaskcolMethod->set_active(0); + showmaskcolMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); + showmaskcolMethodConn = showmaskcolMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskcolMethodChanged)); + + enaColorMaskConn = enaColorMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaColorMaskChanged)); + + maskCurveEditorG->setCurveListener(this); CCmaskshape = static_cast(maskCurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false)); CCmaskshape->setIdentityValue(0.); @@ -334,13 +341,12 @@ Locallab::Locallab(): colorBox->pack_start(*qualcurvbox); colorBox->pack_start(*llCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor colorBox->pack_start(*invers); - maskcolFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW"))); maskcolFrame->set_label_align(0.025, 0.5); ToolParamBlock* const maskcolBox = Gtk::manage(new ToolParamBlock()); maskcolBox->pack_start(*transLabels, Gtk::PACK_SHRINK, 4); maskcolBox->pack_start(*showmaskcolMethod, Gtk::PACK_SHRINK, 0); + maskcolBox->pack_start(*enaColorMask, Gtk::PACK_SHRINK, 0); maskcolBox->pack_start(*maskCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - maskcolFrame->add(*maskcolBox); colorBox->pack_start(*maskcolFrame); @@ -381,24 +387,25 @@ Locallab::Locallab(): shapeexpos->setLeftBarBgGradient(mshapeexpos); curveEditorG->curveListComplete(); - maskexpCurveEditorG->setCurveListener(this); - transLabels2 = Gtk::manage (new Gtk::Label ("---")); + + enaExpMaskConn = enaExpMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaExpMaskChanged)); + showmaskexpMethod->append(M("TP_LOCALLAB_SHOWMNONE")); showmaskexpMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmaskexpMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); - showmaskexpMethod->append(M("TP_LOCALLAB_USEMASK")); showmaskexpMethod->append(M("TP_LOCALLAB_SHOWMASK")); showmaskexpMethod->set_active(0); showmaskexpMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); showmaskexpMethodConn = showmaskexpMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskexpMethodChanged)); + maskexpCurveEditorG->setCurveListener(this); + CCmaskexpshape = static_cast(maskexpCurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false)); CCmaskexpshape->setIdentityValue(0.); CCmaskexpshape->setResetCurve(FlatCurveType(defSpot.CCmaskexpcurve.at(0)), defSpot.CCmaskexpcurve); CCmaskexpshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); CCmaskexpshape->setBottomBarColorProvider(this, 7); - const ColorToningParams default_params; LLmaskexpshape = static_cast(maskexpCurveEditorG->addCurve(CT_Flat, "L(L)", nullptr, false, false)); LLmaskexpshape->setIdentityValue(0.); @@ -407,17 +414,7 @@ Locallab::Locallab(): LLmaskexpshape->setBottomBarBgGradient(mllshape); maskexpCurveEditorG->curveListComplete(); - - - maskexpFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW"))); - maskexpFrame->set_label_align(0.025, 0.5); - ToolParamBlock* const maskexpBox = Gtk::manage(new ToolParamBlock()); - maskexpBox->pack_start(*transLabels2, Gtk::PACK_SHRINK, 4); - maskexpBox->pack_start(*showmaskexpMethod, Gtk::PACK_SHRINK, 0); - maskexpBox->pack_start(*maskexpCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - maskexpFrame->add(*maskexpBox); - ToolParamBlock* const exposeBox = Gtk::manage(new ToolParamBlock()); exposeBox->pack_start(*expcomp); exposeBox->pack_start(*hlcompr); @@ -427,6 +424,14 @@ Locallab::Locallab(): exposeBox->pack_start(*warm); exposeBox->pack_start(*sensiex); exposeBox->pack_start(*curveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + Gtk::Frame* const maskexpFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW"))); + maskexpFrame->set_label_align(0.025, 0.5); + ToolParamBlock* const maskexpBox = Gtk::manage(new ToolParamBlock()); + maskexpBox->pack_start(*transLabels2, Gtk::PACK_SHRINK, 4); + maskexpBox->pack_start(*enaExpMask, Gtk::PACK_SHRINK, 0); + maskexpBox->pack_start(*showmaskexpMethod, Gtk::PACK_SHRINK, 0); + maskexpBox->pack_start(*maskexpCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + maskexpFrame->add(*maskexpBox); exposeBox->pack_start(*maskexpFrame); expexpose->add(*exposeBox); @@ -1483,27 +1488,16 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) } else if (qualitycurveMethod->get_active_row_number() == 2) { pp->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod = "enh"; } - - if (showmaskcolMethod->get_active_row_number() == 0) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskcolMethod = "none"; - } else if (showmaskcolMethod->get_active_row_number() == 1) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskcolMethod = "color"; - } else if (showmaskcolMethod->get_active_row_number() == 2) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskcolMethod = "colormask"; - } else if (showmaskcolMethod->get_active_row_number() == 3) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskcolMethod = "mask"; - } else if (showmaskcolMethod->get_active_row_number() == 4) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskcolMethod = "showmask"; - } pp->locallab.spots.at(pp->locallab.selspot).llcurve = llshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).cccurve = ccshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).LHcurve = LHshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).HHcurve = HHshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).invers = invers->get_active(); + pp->locallab.spots.at(pp->locallab.selspot).enaColorMask = enaColorMask->get_active(); pp->locallab.spots.at(pp->locallab.selspot).CCmaskcurve = CCmaskshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).LLmaskcurve = LLmaskshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).HHmaskcurve = HHmaskshape->getCurve(); - pp->locallab.spots.at(pp->locallab.selspot).invers = invers->get_active(); // Exposure pp->locallab.spots.at(pp->locallab.selspot).expexpose = expexpose->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).expcomp = expcomp->getIntValue(); @@ -1514,20 +1508,9 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).warm = warm->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).sensiex = sensiex->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).excurve = shapeexpos->getCurve(); - if (showmaskexpMethod->get_active_row_number() == 0) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod = "none"; - } else if (showmaskexpMethod->get_active_row_number() == 1) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod = "expo"; - } else if (showmaskexpMethod->get_active_row_number() == 2) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod = "expomask"; - } else if (showmaskexpMethod->get_active_row_number() == 3) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod = "mask"; - } else if (showmaskexpMethod->get_active_row_number() == 4) { - pp->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod = "showmask"; - } + pp->locallab.spots.at(pp->locallab.selspot).enaExpMask = enaExpMask->get_active(); pp->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve = LLmaskexpshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve = CCmaskexpshape->getCurve(); - // Vibrance pp->locallab.spots.at(pp->locallab.selspot).expvibrance = expvibrance->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).saturated = saturated->getIntValue(); @@ -1659,15 +1642,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) 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).showmaskcolMethod = pe->locallab.spots.at(pp->locallab.selspot).showmaskcolMethod || showmaskcolMethod->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(); + pe->locallab.spots.at(pp->locallab.selspot).enaColorMask = pe->locallab.spots.at(pp->locallab.selspot).enaColorMask || !enaColorMask->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).CCmaskcurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskcurve || !CCmaskshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).LLmaskcurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskcurve || !LLmaskshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).HHmaskcurve = pe->locallab.spots.at(pp->locallab.selspot).HHmaskcurve || !HHmaskshape->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(); @@ -1678,7 +1661,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) 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(); - pe->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod = pe->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod || showmaskexpMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pe->locallab.spots.at(pp->locallab.selspot).enaExpMask = pe->locallab.spots.at(pp->locallab.selspot).enaExpMask || !enaExpMask->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve || !CCmaskexpshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve || !LLmaskexpshape->isUnChanged(); // Vibrance @@ -1799,15 +1782,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) 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).showmaskcolMethod = pedited->locallab.spots.at(pp->locallab.selspot).showmaskcolMethod || showmaskcolMethod->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(); + pedited->locallab.spots.at(pp->locallab.selspot).enaColorMask = pedited->locallab.spots.at(pp->locallab.selspot).enaColorMask || !enaColorMask->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).CCmaskcurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskcurve || !CCmaskshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).LLmaskcurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskcurve || !LLmaskshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).HHmaskcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHmaskcurve || !HHmaskshape->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(); @@ -1818,7 +1801,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) 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(); - pedited->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod = pedited->locallab.spots.at(pp->locallab.selspot).showmaskexpMethod || showmaskexpMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.spots.at(pp->locallab.selspot).enaExpMask = pedited->locallab.spots.at(pp->locallab.selspot).enaExpMask || !enaExpMask->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskexpcurve || !CCmaskexpshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskexpcurve || !LLmaskexpshape->isUnChanged(); // Vibrance @@ -2129,8 +2112,6 @@ void Locallab::blurMethodChanged() } } - - void Locallab::qualitycurveMethodChanged() { // printf("qualitycurveMethodChanged\n"); @@ -2144,29 +2125,95 @@ void Locallab::qualitycurveMethodChanged() void Locallab::showmaskcolMethodChanged() { - if((showmaskcolMethod->get_active_row_number() == 1 || showmaskcolMethod->get_active_row_number() == 2 || showmaskcolMethod->get_active_row_number() == 4) && expcolor->getEnabled()) { - showmaskexpMethod->set_active(0); - expexpose->setEnabled(false); - } + // printf("showmaskcolMethodChanged\n"); + + // When one mask state is changed, other masks are deactivated + disableListener(); + showmaskexpMethod->set_active(0); + enableListener(); - if (getEnabled() && expcolor->getEnabled()) { - if (listener) { - listener->panelChanged(EvlocallabshowmaskcolMethod , showmaskcolMethod->get_active_text()); - } + if (listener) { + listener->panelChanged(EvlocallabshowmaskcolMethod, ""); } } void Locallab::showmaskexpMethodChanged() { + // printf("showmaskexpMethodChanged\n"); + + // When one mask state is changed, other masks are deactivated + disableListener(); + showmaskcolMethod->set_active(0); + enableListener(); - if((showmaskexpMethod->get_active_row_number() == 1 || showmaskexpMethod->get_active_row_number() == 2 || showmaskexpMethod->get_active_row_number() == 4) && expexpose->getEnabled()) { - showmaskcolMethod->set_active(0); - expcolor->setEnabled(false); + if (listener) { + listener->panelChanged(EvlocallabshowmaskexpMethod, ""); } - +} + +void Locallab::resetMaskVisibility() +{ + // printf("resetMaskVisibility\n"); + + disableListener(); + showmaskcolMethod->set_active(0); + showmaskexpMethod->set_active(0); + enableListener(); +} + +Locallab::llMaskVisibility* Locallab::getMaskVisibility() +{ + llMaskVisibility* maskStruct = new llMaskVisibility(); + maskStruct->colorMask = showmaskcolMethod->get_active_row_number(); + maskStruct->expMask = showmaskexpMethod->get_active_row_number(); + + return maskStruct; +} + +void Locallab::enaColorMaskChanged() +{ + // printf("enaColorMaskChanged\n"); + + if (multiImage) { + if (enaColorMask->get_inconsistent()) { + enaColorMask->set_inconsistent(false); + enaColorMaskConn.block(true); + enaColorMask->set_active(false); + enaColorMaskConn.block(false); + } + } + + if (getEnabled() && expcolor->getEnabled()) { + if (listener) { + if (enaColorMask->get_active()) { + listener->panelChanged(EvLocallabEnaColorMask, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(EvLocallabEnaColorMask, M("GENERAL_DISABLED")); + } + } + } +} + +void Locallab::enaExpMaskChanged() +{ + // printf("enaExpMaskChanged\n"); + + if (multiImage) { + if (enaExpMask->get_inconsistent()) { + enaExpMask->set_inconsistent(false); + enaExpMaskConn.block(true); + enaExpMask->set_active(false); + enaExpMaskConn.block(false); + } + } + if (getEnabled() && expexpose->getEnabled()) { if (listener) { - listener->panelChanged(EvlocallabshowmaskexpMethod , showmaskexpMethod->get_active_text()); + if (enaExpMask->get_active()) { + listener->panelChanged(EvLocallabEnaExpMask, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(EvLocallabEnaExpMask, M("GENERAL_DISABLED")); + } } } } @@ -2192,6 +2239,7 @@ void Locallab::inversChanged() qualitycurveMethod->show(); labqualcurv->show(); maskcolFrame->show(); + showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode } else if (invers->get_active()) { sensi->show(); llCurveEditorG->hide(); @@ -2206,6 +2254,9 @@ void Locallab::inversChanged() qualitycurveMethod->show(); labqualcurv->show(); maskcolFrame->show(); + if (batchMode) { + showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode + } } if (getEnabled() && expcolor->getEnabled()) { @@ -3206,13 +3257,14 @@ void Locallab::setBatchMode(bool batchMode) // Set batch mode for comboBoxText // Color & Light qualitycurveMethod->append(M("GENERAL_UNCHANGED")); - showmaskcolMethod->append(M("GENERAL_UNCHANGED")); - //Exposure - showmaskexpMethod->append(M("GENERAL_UNCHANGED")); // Blur & Noise blurMethod->append(M("GENERAL_UNCHANGED")); // Retinex retinexMethod->append(M("GENERAL_UNCHANGED")); + + // In batch mode, being able to change mask visibility is useless + showmaskcolMethod->hide(); + showmaskexpMethod->hide(); } std::vector Locallab::getCurvePoints(ThresholdSelector* tAdjuster) const @@ -3348,9 +3400,11 @@ void Locallab::enableListener() curvactivConn.block(false); qualitycurveMethodConn.block(false); inversConn.block(false); + enaColorMaskConn.block(false); showmaskcolMethodConn.block(false); // Exposure enableexposeConn.block(false); + enaExpMaskConn.block(false); showmaskexpMethodConn.block(false); // Vibrance enablevibranceConn.block(false); @@ -3392,10 +3446,12 @@ void Locallab::disableListener() enablecolorConn.block(true); curvactivConn.block(true); qualitycurveMethodConn.block(true); - showmaskcolMethodConn.block(true); inversConn.block(true); + enaColorMaskConn.block(true); + showmaskcolMethodConn.block(true); // Exposure enableexposeConn.block(true); + enaExpMaskConn.block(true); showmaskexpMethodConn.block(true); // Vibrance enablevibranceConn.block(true); @@ -3456,25 +3512,15 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con qualitycurveMethod->set_active(5); } - if (pp->locallab.spots.at(index).showmaskcolMethod == "none") { - showmaskcolMethod->set_active(0); - } else if (pp->locallab.spots.at(index).showmaskcolMethod == "color") { - showmaskcolMethod->set_active(1); - } else if (pp->locallab.spots.at(index).showmaskcolMethod == "colormask") { - showmaskcolMethod->set_active(2); - } else if (pp->locallab.spots.at(index).showmaskcolMethod == "mask") { - showmaskcolMethod->set_active(3); - } else if (pp->locallab.spots.at(index).showmaskcolMethod == "showmask") { - showmaskcolMethod->set_active(4); - } llshape->setCurve(pp->locallab.spots.at(index).llcurve); ccshape->setCurve(pp->locallab.spots.at(index).cccurve); LHshape->setCurve(pp->locallab.spots.at(index).LHcurve); HHshape->setCurve(pp->locallab.spots.at(index).HHcurve); + invers->set_active(pp->locallab.spots.at(index).invers); + enaColorMask->set_active(pp->locallab.spots.at(index).enaColorMask); CCmaskshape->setCurve(pp->locallab.spots.at(index).CCmaskcurve); LLmaskshape->setCurve(pp->locallab.spots.at(index).LLmaskcurve); HHmaskshape->setCurve(pp->locallab.spots.at(index).HHmaskcurve); - invers->set_active(pp->locallab.spots.at(index).invers); // Exposure expexpose->setEnabled(pp->locallab.spots.at(index).expexpose); @@ -3486,17 +3532,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con warm->setValue(pp->locallab.spots.at(index).warm); sensiex->setValue(pp->locallab.spots.at(index).sensiex); shapeexpos->setCurve(pp->locallab.spots.at(index).excurve); - if (pp->locallab.spots.at(index).showmaskexpMethod == "none") { - showmaskexpMethod->set_active(0); - } else if (pp->locallab.spots.at(index).showmaskexpMethod == "expo") { - showmaskexpMethod->set_active(1); - } else if (pp->locallab.spots.at(index).showmaskexpMethod == "expormask") { - showmaskexpMethod->set_active(2); - } else if (pp->locallab.spots.at(index).showmaskexpMethod == "mask") { - showmaskexpMethod->set_active(3); - } else if (pp->locallab.spots.at(index).showmaskexpMethod == "showmask") { - showmaskexpMethod->set_active(4); - } + enaExpMask->set_active(pp->locallab.spots.at(index).enaExpMask); CCmaskexpshape->setCurve(pp->locallab.spots.at(index).CCmaskexpcurve); LLmaskexpshape->setCurve(pp->locallab.spots.at(index).LLmaskexpcurve); @@ -3655,18 +3691,17 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con if (!spotState->qualitycurveMethod) { qualitycurveMethod->set_active_text(M("GENERAL_UNCHANGED")); } - if (!spotState->showmaskcolMethod) { - showmaskcolMethod->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); + enaColorMask->set_inconsistent(multiImage && !spotState->enaColorMask); CCmaskshape->setUnChanged(!spotState->CCmaskcurve); LLmaskshape->setUnChanged(!spotState->LLmaskcurve); HHmaskshape->setUnChanged(!spotState->HHmaskcurve); - invers->set_inconsistent(multiImage && !spotState->invers); + // Exposure expexpose->set_inconsistent(!spotState->expexpose); @@ -3678,9 +3713,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con shcompr->setEditedState(spotState->shcompr ? Edited : UnEdited); sensiex->setEditedState(spotState->sensiex ? Edited : UnEdited); shapeexpos->setUnChanged(!spotState->excurve); - if (!spotState->showmaskexpMethod) { - showmaskexpMethod->set_active_text(M("GENERAL_UNCHANGED")); - } + enaExpMask->set_inconsistent(multiImage && !spotState->enaExpMask); CCmaskexpshape->setUnChanged(!spotState->CCmaskexpcurve); LLmaskexpshape->setUnChanged(!spotState->LLmaskexpcurve); @@ -3792,7 +3825,6 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con void Locallab::updateSpecificGUIState() { - // Update Color & Light GUI according to invers button state (to be compliant with inversChanged function) if (multiImage && invers->get_inconsistent()) { sensi->show(); llCurveEditorG->show(); @@ -3800,13 +3832,14 @@ void Locallab::updateSpecificGUIState() qualitycurveMethod->show(); labqualcurv->show(); maskcolFrame->show(); + showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode } else if (invers->get_active()) { sensi->show(); llCurveEditorG->hide(); curvactiv->hide(); qualitycurveMethod->hide(); - maskcolFrame->hide(); labqualcurv->hide(); + maskcolFrame->hide(); } else { sensi->show(); llCurveEditorG->show(); @@ -3814,6 +3847,9 @@ void Locallab::updateSpecificGUIState() qualitycurveMethod->show(); labqualcurv->show(); maskcolFrame->show(); + if (batchMode) { + showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode + } } // Update Exposure GUI according to black adjuster state (to be compliant with adjusterChanged function) @@ -3852,22 +3888,6 @@ void Locallab::updateSpecificGUIState() } else { strength->show(); } - - //update showmethod - if (multiImage && showmaskcolMethod->get_active_text() == M("GENERAL_UNCHANGED")) { - showmaskexpMethod->set_active(0); - } else if((showmaskcolMethod->get_active_row_number() == 1 || showmaskcolMethod->get_active_row_number() == 2 || showmaskcolMethod->get_active_row_number() == 4)) { - showmaskexpMethod->set_active(0); - expexpose->setEnabled(false); - } - - if (multiImage && showmaskexpMethod->get_active_text() == M("GENERAL_UNCHANGED")) { - showmaskcolMethod->set_active(0); - } else if((showmaskexpMethod->get_active_row_number() == 1 || showmaskexpMethod->get_active_row_number() == 2 || showmaskexpMethod->get_active_row_number() == 4)) { - showmaskcolMethod->set_active(0); - expcolor->setEnabled(false); - } - // Update Retinex GUI according to inversret button state (to be compliant with inversretChanged function) if (multiImage && inversret->get_inconsistent()) { diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 02489deed..f9fdd0b02 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -72,7 +72,6 @@ private: FlatCurveEditor* CCmaskshape; FlatCurveEditor* LLmaskshape; FlatCurveEditor* HHmaskshape; - // Exposure CurveEditorGroup* const curveEditorG; CurveEditorGroup* const maskexpCurveEditorG; @@ -160,7 +159,11 @@ private: // Color & Light Gtk::CheckButton* const curvactiv; Gtk::CheckButton* const invers; - sigc::connection curvactivConn, inversConn; + Gtk::CheckButton* const enaColorMask; + sigc::connection curvactivConn, inversConn, enaColorMaskConn; + // Exposure + Gtk::CheckButton* const enaExpMask; + sigc::connection enaExpMaskConn; // Vibrance Gtk::CheckButton* const protectSkins; Gtk::CheckButton* const avoidColorShift; @@ -188,7 +191,6 @@ private: //Exposure MyComboBoxText* const showmaskexpMethod; sigc::connection showmaskexpMethodConn; - // Blur & Noise MyComboBoxText* const blurMethod; sigc::connection blurMethodConn; @@ -208,10 +210,7 @@ private: sigc::connection lumacontrastMinusPressedConn, lumaneutralPressedConn, lumacontrastPlusPressedConn; Gtk::Label* transLabels; Gtk::Label* transLabels2; - - //Frame Gtk::Frame* maskcolFrame; - Gtk::Frame* maskexpFrame; // Others /** @@ -238,10 +237,9 @@ private: // Color & Light void curvactivChanged(); void inversChanged(); - void showmaskcolMethodChanged(); - //Exposure - void showmaskexpMethodChanged(); - + void enaColorMaskChanged(); + // Exposure + void enaExpMaskChanged(); // Vibrance void protectskins_toggled(); void avoidcolorshift_toggled(); @@ -258,6 +256,9 @@ private: // ComboBox event functions // Color & Light void qualitycurveMethodChanged(); + void showmaskcolMethodChanged(); + //Exposure + void showmaskexpMethodChanged(); // Blur & Noise void blurMethodChanged(); // Retinex @@ -330,9 +331,18 @@ public: void disableListener(); void writeOptions(std::vector &tpOpen); void updateToolState(std::vector &tpOpen); - void refChanged (double huer, double lumar, double chromar); - bool refComputed_ (); - void updateLabel (); + void refChanged(double huer, double lumar, double chromar); + bool refComputed_(); + void updateLabel(); + + // Mask visibility management functions + struct llMaskVisibility { + int colorMask; + int expMask; + }; + + void resetMaskVisibility(); + llMaskVisibility* getMaskVisibility(); // EditProvider management function void setEditProvider(EditDataProvider* provider); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 4dd0009cb..b9aebdee0 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -949,15 +949,15 @@ void ParamsEdited::initFrom(const std::vector& 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).showmaskcolMethod = locallab.spots.at(j).showmaskcolMethod && pSpot.showmaskcolMethod == otherSpot.showmaskcolMethod; 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; + locallab.spots.at(j).enaColorMask = locallab.spots.at(j).enaColorMask && pSpot.enaColorMask == otherSpot.enaColorMask; locallab.spots.at(j).CCmaskcurve = locallab.spots.at(j).CCmaskcurve && pSpot.CCmaskcurve == otherSpot.CCmaskcurve; locallab.spots.at(j).LLmaskcurve = locallab.spots.at(j).LLmaskcurve && pSpot.LLmaskcurve == otherSpot.LLmaskcurve; locallab.spots.at(j).HHmaskcurve = locallab.spots.at(j).HHmaskcurve && pSpot.HHmaskcurve == otherSpot.HHmaskcurve; - 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; @@ -968,7 +968,7 @@ void ParamsEdited::initFrom(const std::vector& 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; - locallab.spots.at(j).showmaskexpMethod = locallab.spots.at(j).showmaskexpMethod && pSpot.showmaskexpMethod == otherSpot.showmaskexpMethod; + locallab.spots.at(j).enaExpMask = locallab.spots.at(j).enaExpMask && pSpot.enaExpMask == otherSpot.enaExpMask; locallab.spots.at(j).CCmaskexpcurve = locallab.spots.at(j).CCmaskexpcurve && pSpot.CCmaskexpcurve == otherSpot.CCmaskexpcurve; locallab.spots.at(j).LLmaskexpcurve = locallab.spots.at(j).LLmaskexpcurve && pSpot.LLmaskexpcurve == otherSpot.LLmaskexpcurve; // Vibrance @@ -2579,10 +2579,6 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).qualitycurveMethod = mods.locallab.spots.at(i).qualitycurveMethod; } - if (locallab.spots.at(i).showmaskcolMethod) { - toEdit.locallab.spots.at(i).showmaskcolMethod = mods.locallab.spots.at(i).showmaskcolMethod; - } - if (locallab.spots.at(i).llcurve) { toEdit.locallab.spots.at(i).llcurve = mods.locallab.spots.at(i).llcurve; } @@ -2599,6 +2595,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng 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; + } + + if (locallab.spots.at(i).enaColorMask) { + toEdit.locallab.spots.at(i).enaColorMask = mods.locallab.spots.at(i).enaColorMask; + } + if (locallab.spots.at(i).CCmaskcurve) { toEdit.locallab.spots.at(i).CCmaskcurve = mods.locallab.spots.at(i).CCmaskcurve; } @@ -2611,10 +2615,6 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).HHmaskcurve = mods.locallab.spots.at(i).HHmaskcurve; } - 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; @@ -2652,8 +2652,8 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).excurve = mods.locallab.spots.at(i).excurve; } - if (locallab.spots.at(i).showmaskexpMethod) { - toEdit.locallab.spots.at(i).showmaskexpMethod = mods.locallab.spots.at(i).showmaskexpMethod; + if (locallab.spots.at(i).enaExpMask) { + toEdit.locallab.spots.at(i).enaExpMask = mods.locallab.spots.at(i).enaExpMask; } if (locallab.spots.at(i).CCmaskexpcurve) { @@ -3916,15 +3916,15 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : chroma(v), sensi(v), qualitycurveMethod(v), - showmaskcolMethod(v), llcurve(v), cccurve(v), LHcurve(v), HHcurve(v), + invers(v), + enaColorMask(v), CCmaskcurve(v), LLmaskcurve(v), HHmaskcurve(v), - invers(v), // Exposure expexpose(v), expcomp(v), @@ -3935,7 +3935,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : warm(v), sensiex(v), excurve(v), - showmaskexpMethod(v), + enaExpMask(v), CCmaskexpcurve(v), LLmaskexpcurve(v), // Vibrance @@ -4048,15 +4048,15 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) chroma = v; sensi = v; qualitycurveMethod = v; - showmaskcolMethod = v; llcurve = v; cccurve = v; LHcurve = v; HHcurve = v; + invers = v; + enaColorMask = v; CCmaskcurve = v; LLmaskcurve = v; HHmaskcurve = v; - invers = v; // Exposure expexpose = v; expcomp = v; @@ -4067,7 +4067,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) warm = v; sensiex = v; excurve = v; - showmaskexpMethod = v; + enaExpMask = v; CCmaskexpcurve = v; LLmaskexpcurve = v; // Vibrance diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 12d688ada..01abca089 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -488,15 +488,15 @@ public: bool chroma; bool sensi; bool qualitycurveMethod; - bool showmaskcolMethod; bool llcurve; bool cccurve; bool LHcurve; bool HHcurve; + bool invers; + bool enaColorMask; bool CCmaskcurve; bool LLmaskcurve; bool HHmaskcurve; - bool invers; // Exposure bool expexpose; bool expcomp; @@ -507,7 +507,7 @@ public: bool warm; bool sensiex; bool excurve; - bool showmaskexpMethod; + bool enaExpMask; bool CCmaskexpcurve; bool LLmaskexpcurve; // Vibrance diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 93847846a..753ad0e18 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -28,7 +28,7 @@ using namespace rtengine::procparams; -ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favoritePanelSW(nullptr), hasChanged (false), editDataProvider (nullptr) +ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favoritePanelSW(nullptr), hasChanged (false), editDataProvider (nullptr), photoLoadedOnce(false) { favoritePanel = Gtk::manage (new ToolVBox ()); @@ -457,6 +457,12 @@ void ToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, const resize->write(params); } + // Manage Locallab mask visibility + if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskexpMethod) { + Locallab::llMaskVisibility* maskStruc = locallab->getMaskVisibility(); + ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->expMask); + } + ipc->endUpdateParams(changeFlags); // starts the IPC processing hasChanged = true; @@ -559,6 +565,12 @@ void ToolPanelCoordinator::profileChange( gradient->updateGeometry(params->gradient.centerX, params->gradient.centerY, params->gradient.feather, params->gradient.degree, fw, fh); } + // Reset Locallab mask visibility when a picture is loaded + if (event == rtengine::EvPhotoLoaded) { + locallab->resetMaskVisibility(); + ipc->setLocallabMaskVisibility(0, 0); + } + // start the IPC processing if (filterRawRefresh) { ipc->endUpdateParams(rtengine::RefreshMapper::getInstance()->getAction(event) & ALLNORAW);