diff --git a/CMakeLists.txt b/CMakeLists.txt index 6de75e748..d673f8e8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -637,14 +637,8 @@ else() endif() # Get compiler name and version. - get_filename_component(COMPILER_INFO ${CMAKE_C_COMPILER} NAME_WE) - set(COMPILER_INFO "${COMPILER_INFO} ${CMAKE_C_COMPILER_VERSION}") -if(NOT APPLE) - execute_process( - COMMAND gcc -dumpversion - OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) - set(COMPILER_INFO "gcc ${GCC_VERSION}") -endif() +get_filename_component(COMPILER_INFO ${CMAKE_C_COMPILER} NAME_WE) +set(COMPILER_INFO "${COMPILER_INFO} ${CMAKE_C_COMPILER_VERSION}") # Get C++ and linker flags for rtengine (the GUI's C++ flags may have fewer # flags): diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index d541234cf..1483d7cc5 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -1929,7 +1929,7 @@ TP_LOCALLAB_EXPRETITOOLS;Outils Retinex avancés TP_LOCALLAB_EXPSHARP_TOOLTIP;RT-Spot minimum 39*39.\nUtiliser de basses valeurs de transition et de hautes valeurs de transition affaiblissement et Etendue pour simuler un petit RT-spot. TP_LOCALLAB_EXPTOOL;Outils exposition TP_LOCALLAB_EXPTRC;Courbe de réponse Tonale - TRC -TP_LOCALLAB_EXP_TOOLNAME;Atténuation contraste -Compression Dynamique & Exposition- 10 +TP_LOCALLAB_EXP_TOOLNAME;Atténuation Contraste -Compression Dynamique & Exposition- 10 TP_LOCALLAB_FATAMOUNT;Quantité TP_LOCALLAB_FATANCHOR;Ancre TP_LOCALLAB_FATANCHORA;Décalage @@ -1987,10 +1987,10 @@ TP_LOCALLAB_LABGRIDMERG;Arrière plan TP_LOCALLAB_LABGRID_VALUES;Haut(a)=%1 Haut(b)=%2\nBas(a)=%3 Bas(b)=%4 TP_LOCALLAB_LABSTRUM;Masque Structure TP_LOCALLAB_LAPLACC;ΔØ Masque Laplacien résoud PDE -TP_LOCALLAB_LAPLACE;Δ - Laplacien seuil ΔE -TP_LOCALLAB_LAPLACEXP;∆ - Laplacian seuil -TP_LOCALLAB_LAPMASKCOL;∆ - Laplacian seuil masque -TP_LOCALLAB_LAPRAD_TOOLTIP;Eviter d'utiliser Radius and Laplace Seuil en même temps.\nLaplacien seuil reduit le contraste, artéfacts, adoucit le résultat (si PDE réglages activé). +TP_LOCALLAB_LAPLACE;Laplacien seuil ΔE +TP_LOCALLAB_LAPLACEXP;Laplacien seuil +TP_LOCALLAB_LAPMASKCOL;Laplacien seuil masque +TP_LOCALLAB_LAPRAD_TOOLTIP;Eviter d'utiliser Radius and Laplace Seuil en même temps.\nLaplacien seuil reduit le contraste, artéfacts, adoucit le résultat. TP_LOCALLAB_LAP_MASK_TOOLTIP;Résoud PDE (Equation aux dérivées partielles) pour tous les masques Laplacien.\nSi activé Laplacien masque seuil reduit les artéfacts et adoucit les résultats.\nSi désactivé réponse linaire. TP_LOCALLAB_LC_FFTW_TOOLTIP;FFT améliore la qualité et autorise de grands rayons, mais accroît les temps de traitement.\nCe temps dépends de la surface devant être traitée.\nA utiliser de préférences pour de grands rayons.\n\nLes Dimensions peuvent être réduites de quelques pixels pour optimiser FFTW.\nCette optimisation peut réduire le temps de traitement d'un facteur de 1.5 à 10.\n TP_LOCALLAB_LC_TOOLNAME;Constrast Local & Ondelettes (Défauts) - 7 @@ -2004,7 +2004,7 @@ TP_LOCALLAB_LIGHTN_TOOLTIP;En mode inverse: selection = -100 force la luminance TP_LOCALLAB_LIGHTRETI;Luminosité TP_LOCALLAB_LINEAR;Linéarité TP_LOCALLAB_LIST_NAME;Ajoute un outil au spot courant... -TP_LOCALLAB_LIST_TOOLTIP;Choisir un outil et ensuite son niveau de complexité "Normal" ou "Expert".\nLe nombre traduit la place de l'outil dans le processus de chaque RT-Spot +TP_LOCALLAB_LIST_TOOLTIP;Vous pouvez choisir 3 niveaux de complexité pour chaque outil: Basic, Normal & Avancé.\nLe réglage par défaut est Basic mais il peut être changé dans Préférences.\nVous pouvez aussi changer ce niveau pour chaque outil en cours. TP_LOCALLAB_LMASK_LEVEL_TOOLTIP;Donne priorité à l'action sur les tons moyens et hautes lumières en choisissant les niveaux concernés d'ondelettes TP_LOCALLAB_LMASK_LL_TOOLTIP;Give priority to action on midtones and high lights TP_LOCALLAB_LOCCONT;Masque Flou @@ -2083,8 +2083,8 @@ TP_LOCALLAB_MERTWO;Soustrait TP_LOCALLAB_METHOD_TOOLTIP;'Enhanced + chroma denoise' significantly increases processing times.\nBut reduce artifacts. TP_LOCALLAB_MLABEL;Récupère les données Min=%1 Max=%2 (Clip - décalage) TP_LOCALLAB_MLABEL_TOOLTIP;'Doit être' près de min=0 max=32768 (log mode) mais d'autres valeurs sont possibles.\nVous pouvez agir sur les données récupérées (CLIP) et décalage pour normaliser.\n\nRécupère les données image sans mélange. -TP_LOCALLAB_MODE_EXPERT;Expert -TP_LOCALLAB_MODE_NORMAL;Normal +TP_LOCALLAB_MODE_EXPERT;Avancé +TP_LOCALLAB_MODE_NORMAL;Standard TP_LOCALLAB_MRFIV;Arrière plan TP_LOCALLAB_MRFOU;Spot précédent TP_LOCALLAB_MRONE;Rien @@ -2112,7 +2112,7 @@ TP_LOCALLAB_ORIGLC;Fusion seulement avec image originale TP_LOCALLAB_ORRETILAP_TOOLTIP;Agit sur un deuxième seuil Laplacien, pour prendre en compte ΔE pour différencier l'action nottament avec l'arrière plan (différent de Etendue) TP_LOCALLAB_ORRETISTREN_TOOLTIP;Aagit sur un seuil Laplacien, plus grande est l'action, plus les différences de contraste seront réduites TP_LOCALLAB_PASTELS2;Vibrance -TP_LOCALLAB_PDE;Atténuation de contraste - Compression dynamique +TP_LOCALLAB_PDE;Atténuation de Contraste - Compression dynamique TP_LOCALLAB_PDEFRA;Contraste atténuation ƒ TP_LOCALLAB_PDEFRAME_TOOLTIP;PDE IPOL - algorithme personnel adapté de IPOL à Rawtherapee: conduit à des résultats très variés et a besoin de différents réglages que Standard (Noir négatif, gamma < 1,...)\nPeut être utils pour des iamges sous-exposées ou avec une étendue dynamique importante.\n TP_LOCALLAB_PREVIEW;Prévisualisation ΔE @@ -2219,8 +2219,8 @@ TP_LOCALLAB_SHOWPOISSON;Poisson (pde ƒ) TP_LOCALLAB_SHOWR;Masque et modifications TP_LOCALLAB_SHOWREF;Prévisualisation ΔE TP_LOCALLAB_SHOWS;Masque et modifications -TP_LOCALLAB_SHOWSTRUC;Montrer Spot structure (expert) -TP_LOCALLAB_SHOWSTRUCEX;Montrer Spot structure (expert) +TP_LOCALLAB_SHOWSTRUC;Montrer Spot structure (avancé) +TP_LOCALLAB_SHOWSTRUCEX;Montrer Spot structure (avancé) TP_LOCALLAB_SHOWT;Masque et modifications TP_LOCALLAB_SHOWVI;Masque et modifications TP_LOCALLAB_SHRESFRA;Ombres/Lumières @@ -2255,7 +2255,7 @@ TP_LOCALLAB_STRRETI_TOOLTIP;Si force Retinex < 0.2 seul Dehaze est activé.\nSi TP_LOCALLAB_STRUC;Structure TP_LOCALLAB_STRUCCOL;Structure TP_LOCALLAB_STRUCCOL1;Spot Structure -TP_LOCALLAB_STRUCT_TOOLTIP;Utilise l'algorithme de Sobel pour prendre en compte la structure dans la détection de forme.\nvous pouvez prévisualiser avec "masque et modifications - Montrer structure spot".\n\nPeut être utilisé avec masques (expert) structure, flouter, ondelettes pour améliorer la détection de bords.\n\nA besoin de réglages sans-masque pour êtrre activé (luminosité, exposition...) +TP_LOCALLAB_STRUCT_TOOLTIP;Utilise l'algorithme de Sobel pour prendre en compte la structure dans la détection de forme.\nvous pouvez prévisualiser avec "masque et modifications - Montrer structure spot".\n\nPeut être utilisé avec masques (avancé) structure, flouter, ondelettes pour améliorer la détection de bords.\n\nA besoin de réglages sans-masque pour êtrre activé (luminosité, exposition...) TP_LOCALLAB_STRUMASKCOL;Structure masque force TP_LOCALLAB_STRUMASK_TOOLTIP;Génère un masque structure qui va différencier les aplats et reliefs.\nSi structure masque comme outil est activé, ce masque est untilisé en plus des autres outils (gamma, slope, courbe contraste ...) TP_LOCALLAB_STYPE;Forme méthode diff --git a/rtdata/languages/default b/rtdata/languages/default index e49372201..1bcc1ab51 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1087,7 +1087,7 @@ HISTORY_MSG_841;Local - LC curve HISTORY_MSG_842;Local - Contrast Threshold Mask blur HISTORY_MSG_843;Local - Radius Mask blur HISTORY_MSG_844;Local - Color Mask fftw -HISTORY_MSG_845;Local - Encoding log +HISTORY_MSG_845;Local - log encoding HISTORY_MSG_846;Local - Encoding auto HISTORY_MSG_847;Local - Source Gray HISTORY_MSG_848;Local - Source Gray auto @@ -1133,8 +1133,8 @@ HISTORY_MSG_888;Local - Contrast Wavelet Balance Threshold HISTORY_MSG_889;Local - Contrast Wavelet Graduated Strength HISTORY_MSG_890;Local - Contrast Wavelet Graduated angle HISTORY_MSG_891;Local - Contrast Wavelet Graduated -HISTORY_MSG_892;Local - Encoding log Graduated Strength -HISTORY_MSG_893;Local - Encoding log Graduated angle +HISTORY_MSG_892;Local - Log Encoding Graduated Strength +HISTORY_MSG_893;Local - Log Encoding Graduated angle HISTORY_MSG_894;Local - Color Preview dE HISTORY_MSG_897;Local - Contrast Wavelet ES strength HISTORY_MSG_898;Local - Contrast Wavelet ES radius @@ -1196,6 +1196,7 @@ HISTORY_MSG_953;Local - Mask Common blend chroma HISTORY_MSG_954;Local - Show-hide tools HISTORY_MSG_955;Local - Enable Spot HISTORY_MSG_956;Local - CH Curve +HISTORY_MSG_957;Local - Tool complexity mode HISTORY_MSG_BLSHAPE;Blur by level HISTORY_MSG_BLURCWAV;Blur chroma HISTORY_MSG_BLURWAV;Blur luminance @@ -1604,8 +1605,9 @@ PREFERENCES_CLUTSCACHE_LABEL;Maximum number of cached CLUTs PREFERENCES_CLUTSDIR;HaldCLUT directory PREFERENCES_CMMBPC;Black point compensation PREFERENCES_COMPLEXITYLOC;Default complexity for Local Adjustments -PREFERENCES_COMPLEXITY_EXP;Expert -PREFERENCES_COMPLEXITY_NORM;Normal +PREFERENCES_COMPLEXITY_EXP;Advanced +PREFERENCES_COMPLEXITY_NORM;Standard +PREFERENCES_COMPLEXITY_SIMP;Basic PREFERENCES_CROP;Crop Editing PREFERENCES_CROP_AUTO_FIT;Automatically zoom to fit the crop PREFERENCES_CROP_GUIDES;Guides shown when not editing the crop @@ -2364,7 +2366,7 @@ TP_LOCALLAB_BLMETHOD_TOOLTIP;Normal - direct blur and noise with all settings.\n TP_LOCALLAB_BLNOI_EXP;Blur & Noise TP_LOCALLAB_BLNORM;Normal TP_LOCALLAB_BLSYM;Symmetric -TP_LOCALLAB_BLUFR;Smooth - Blur - Grain - Denoise +TP_LOCALLAB_BLUFR;Blur - Grain & Denoise TP_LOCALLAB_BLUMETHOD_TOOLTIP;To blur the background and isolate the foreground:\n*Blur the background by a RT-spot fully covering the image (high values for scope and transition) - normal or inverse.\n*Isolate the foreground by one or more excluding RT-spot with the tools you want (increse scope).\n\nThis module can be used in additional noise reduction,including "median" and "Guided filter" TP_LOCALLAB_BLUR;Gaussian Blur - Noise - Grain TP_LOCALLAB_BLURCBDL;Blur levels 0-1-2-3-4 @@ -2374,7 +2376,7 @@ TP_LOCALLAB_BLURLC;Luminance Only TP_LOCALLAB_BLURLEVELFRA;Blur Levels TP_LOCALLAB_BLURMASK_TOOLTIP;Generate a blur mask, take into account the structure with the contrast threshold Mask Blur slider. TP_LOCALLAB_BLURRESIDFRA;Blur Residual -TP_LOCALLAB_BLUR_TOOLNAME;Smooth Blur Gain & Denoise - 1 +TP_LOCALLAB_BLUR_TOOLNAME;Blur Grain & Denoise - 1 TP_LOCALLAB_BLWH;All changes forced in Black and White TP_LOCALLAB_BLWH_TOOLTIP;Force color change composante "a" and "b" to zero.\nUsefull when the user chooses black and white processes, or film. TP_LOCALLAB_BUTTON_ADD;Add @@ -2386,7 +2388,7 @@ TP_LOCALLAB_CBDL;Contrast by detail levels TP_LOCALLAB_CBDLCLARI_TOOLTIP;Takes the midtones and enhance them. TP_LOCALLAB_CBDL_ADJ_TOOLTIP;Acts as a wavelet tools.\nThe first level (0) acts on 2x2 details.\nThe last level (5) acts on 64x64 details. TP_LOCALLAB_CBDL_THRES_TOOLTIP;Prevent the sharpening of noise -TP_LOCALLAB_CBDL_TOOLNAME;CBDL (Defects) - 2 +TP_LOCALLAB_CBDL_TOOLNAME;CBDL - 2 TP_LOCALLAB_CENTER_X;Center X TP_LOCALLAB_CENTER_Y;Center Y TP_LOCALLAB_CH;Curves CL - LC @@ -2415,7 +2417,7 @@ TP_LOCALLAB_COLORDEPREV_TOOLTIP;Button Preview ΔE needs that only one tool is e TP_LOCALLAB_COLORDE_TOOLTIP;Show preview selection ΔE in blue if negative and in green if positive.\n\nMask and modifications (show modifications without mask): show real modifications if positive, show enhanced modifications (only luminance) with blue and yellow if negative. TP_LOCALLAB_COLORSCOPE;Scope Color Tools TP_LOCALLAB_COLORSCOPE_TOOLTIP;Use a common Scope for Color and light, Shadows highlight, Vibrance.\nOthers tools have their specific scope. -TP_LOCALLAB_COLOR_TOOLNAME;Color&Light (Defects) - 11 +TP_LOCALLAB_COLOR_TOOLNAME;Color & Light - 11 TP_LOCALLAB_COL_NAME;Name TP_LOCALLAB_COL_VIS;Status TP_LOCALLAB_COMPFRA;Levels Directional Contrast @@ -2505,13 +2507,13 @@ TP_LOCALLAB_EXPMERGEFILE_TOOLTIP;Allows various possibilities to blend image (as TP_LOCALLAB_EXPMETHOD_TOOLTIP;Standard : use an algorithm similar as main Exposure but in L*a*b* and taking account of deltaE.\n\nContrast attenuator : use another algorithm also with deltaE and with Poisson equation to solve Laplacian in Fourier space.\nContrast attenuator, Dynamic range compression and Standard can be combined.\nFFTW Fourier Transform is optimized in size to reduce processing time.\nReduce artifacts and noise. TP_LOCALLAB_EXPNOISEMETHOD_TOOLTIP;Apply a median before Laplace transform to prevent artifacts (noise).\nYou can also use "Denoise" tool. TP_LOCALLAB_EXPOSE;Dynamic Range Compr. & Exposure -//TP_LOCALLAB_EXPOSURE_TOOLTIP;In some cases (strong shadows ..) you can use others modules "Shadows Highlights", "Tone equalizer", "TRC", "Encoding Log"... +//TP_LOCALLAB_EXPOSURE_TOOLTIP;In some cases (strong shadows ..) you can use others modules "Shadows Highlights", "Tone equalizer", "TRC", "Log Encoding"... TP_LOCALLAB_EXPOSURE_TOOLTIP;Modify exposure in L*a*b space using Laplacian PDE algorithms to take into account dE and minimize artifacts. TP_LOCALLAB_EXPRETITOOLS;Advanced Retinex Tools TP_LOCALLAB_EXPSHARP_TOOLTIP;RT-Spot minimum 39*39.\nUse low transition values and high decay transition values and scope to simulate small RT-spot. TP_LOCALLAB_EXPTOOL;Tools exposure TP_LOCALLAB_EXPTRC;Tone Response Curve - TRC -TP_LOCALLAB_EXP_TOOLNAME;Contrast attenuator -Dynamic Range Compression & Exposure- 10 +TP_LOCALLAB_EXP_TOOLNAME;Contrast Attenuator -Dynamic Range Compression & Exposure- 10 TP_LOCALLAB_FATAMOUNT;Amount TP_LOCALLAB_FATANCHOR;Anchor TP_LOCALLAB_FATANCHORA;Offset @@ -2536,7 +2538,7 @@ TP_LOCALLAB_GAMSH;Gamma TP_LOCALLAB_GRADANG;Gradient angle TP_LOCALLAB_GRADANG_TOOLTIP;Rotation angle in degrees : -180 0 +180 TP_LOCALLAB_GRADFRA;Graduated Filter Mask -TP_LOCALLAB_GRADGEN_TOOLTIP;Graduated filter is supplied with Color and Light & merge file, Exposure & mask, Shadows Highlight, Vibrance, Encoding log.\n\nVibrance, Color and Light & merge file, are provided with GF luminance, chrominance, Hue.\nFeather is located in settings. +TP_LOCALLAB_GRADGEN_TOOLTIP;Graduated filter is supplied with Color and Light & merge file, Exposure & mask, Shadows Highlight, Vibrance, Log Encoding.\n\nVibrance, Color and Light & merge file, are provided with GF luminance, chrominance, Hue.\nFeather is located in settings. TP_LOCALLAB_GRADLOGFRA;Graduated Filter Luminance TP_LOCALLAB_GRADSTR;Gradient strength TP_LOCALLAB_GRADSTRAB_TOOLTIP;Filter chroma strength @@ -2569,13 +2571,13 @@ TP_LOCALLAB_LABGRIDMERG;Background TP_LOCALLAB_LABGRID_VALUES;High(a)=%1 High(b)=%2\nLow(a)=%3 Low(b)=%4 TP_LOCALLAB_LABSTRUM;Mask Structure TP_LOCALLAB_LAPLACC;ΔØ Mask Laplacian solve PDE -TP_LOCALLAB_LAPLACE;Δ - Laplacian threshold ΔE -TP_LOCALLAB_LAPLACEXP;∆ - Laplacian threshold -TP_LOCALLAB_LAPMASKCOL;∆ - Laplacian threshold mask -TP_LOCALLAB_LAPRAD_TOOLTIP;Avoid using Radius and Laplace Threshold (expert) simultaneously.\nLaplacian threshold reduce contrast, artifacts, smooth result. +TP_LOCALLAB_LAPLACE;Laplacian threshold ΔE +TP_LOCALLAB_LAPLACEXP;Laplacian threshold +TP_LOCALLAB_LAPMASKCOL;Laplacian threshold mask +TP_LOCALLAB_LAPRAD_TOOLTIP;Avoid using Radius and Laplace Threshold (advanced) simultaneously.\nLaplacian threshold reduce contrast, artifacts, smooth result. TP_LOCALLAB_LAP_MASK_TOOLTIP;Solve PDE for all Laplacian masks.\nIf enabled Laplacian threshold mask reduce artifacts and smooth result.\nIf disabled linear response. TP_LOCALLAB_LC_FFTW_TOOLTIP;FFT improve quality and allow big radius, but increases the treatment time.\nThe treatment time depends on the surface to be treated.\nTo be used preferably for large radius.\n\nDimensions can be reduced by a few pixels to optimize FFTW.\nThis optimization can reduce the treatment time by a factor of 1.5 to 10.\n -TP_LOCALLAB_LC_TOOLNAME;Local Constrast & Wavelet (Defects) - 7 +TP_LOCALLAB_LC_TOOLNAME;Local Contrast & Wavelets - 7 TP_LOCALLAB_LEVELBLUR;Maximum Blur levels TP_LOCALLAB_LEVELLOCCONTRAST_TOOLTIP;On the abscissa local contrast (near concept luminance). On the ordinate, amplification or reduction local contrast. TP_LOCALLAB_LEVELWAV;Ψ Wavelets Levels @@ -2586,17 +2588,17 @@ TP_LOCALLAB_LIGHTN_TOOLTIP;In inverse mode: selection = -100 force luminance to TP_LOCALLAB_LIGHTRETI;Lightness TP_LOCALLAB_LINEAR;Linearity TP_LOCALLAB_LIST_NAME;Add tool to current spot... -TP_LOCALLAB_LIST_TOOLTIP;Choose a tool and then its level of complexity "Normal" or "Expert".\nThe number reflects the place of the tool in the process of each RT-Spot +TP_LOCALLAB_LIST_TOOLTIP;You can select 3 levels of complexity for each tool: Basic, Standard & Advanced.\nThe default setting for all tools is Basic but this can be changed in the Preferences window.\nYou can also change the level of complexity on a per-tool basis while you are editing TP_LOCALLAB_LMASK_LEVEL_TOOLTIP;Give priority to action on midtones and high lights and by choosing the concerned wavelet levels TP_LOCALLAB_LMASK_LL_TOOLTIP;Give priority to action on midtones and high lights TP_LOCALLAB_LOCCONT;Unsharp Mask -TP_LOCALLAB_LOC_CONTRAST;Local contrast -Wavelet-defects +TP_LOCALLAB_LOC_CONTRAST;Local contrast & Wavelets TP_LOCALLAB_LOC_CONTRASTPYR;Ψ Pyramid 1: TP_LOCALLAB_LOC_CONTRASTPYR2;Ψ Pyramid 2: TP_LOCALLAB_LOC_CONTRASTPYR2LAB;Contrast by Levels- Tone Mapping - Dir.Contrast TP_LOCALLAB_LOC_CONTRASTPYRLAB;Graduated Filter - Edge Sharpness - Blur -TP_LOCALLAB_LOC_RESIDPYR;Residual Image Main -TP_LOCALLAB_LOG;Encoding log +TP_LOCALLAB_LOC_RESIDPYR;Residual Image (Main) +TP_LOCALLAB_LOG;Log Encoding TP_LOCALLAB_LOGAUTO;Automatic TP_LOCALLAB_LOGAUTO_TOOLTIP;Pressing this button will bring an evaluation of dynamic range and Source Gray point (if "Automatic" Source gray enabled).\nTo be able to touch up the automatic values, press the button again TP_LOCALLAB_LOGBASE_TOOLTIP;Default = 2.\nValues less than 2 reduce the action of the algorithm, the shadows are darker, the highlights are brighter.\nValues greater than 2 change the action of the algorithm, the shadows are grayer the highlights are more washed out @@ -2608,7 +2610,7 @@ TP_LOCALLAB_LOGLIN;Logarithm mode TP_LOCALLAB_LOGPFRA;Relative Exposure Levels TP_LOCALLAB_LOGSRCGREY_TOOLTIP;Estimated gray point value of the image, early in the process TP_LOCALLAB_LOGTARGGREY_TOOLTIP;You can change this value to adapt it to your taste. -TP_LOCALLAB_LOG_TOOLNAME;Encoding log - 0 +TP_LOCALLAB_LOG_TOOLNAME;Log Encoding - 0 TP_LOCALLAB_LUM;Curves LL - CC TP_LOCALLAB_LUMADARKEST;Darkest TP_LOCALLAB_LUMASK;Luminance Background Mask @@ -2617,7 +2619,8 @@ TP_LOCALLAB_LUMAWHITESEST;Whiteest TP_LOCALLAB_LUMFRA;L*a*b* standard TP_LOCALLAB_LUMONLY;Luminance only TP_LOCALLAB_MASKCOM;Common Color Mask -TP_LOCALLAB_MASKCOM_TOOLTIP;These masks works as all tools, they take into account scope color.\nThey are different from others masks which complete a tool (Color and Light, Exposure...) +TP_LOCALLAB_MASKCOM_TOOLTIP;A tool in its own right.\nCan be used to adjust the image appearance (chrominance, luminance, contrast) and texture as a function of Scope. +//These masks works as all tools, they take into account scope color.\nThey are different from others masks which complete a tool (Color and Light, Exposure...) TP_LOCALLAB_MASFRAME;Mask and Merge TP_LOCALLAB_MASFRAME_TOOLTIP;For all masks.\nTake into account deltaE image to avoid retouching the selection area when sliders gamma mask, slope mask, chroma mask and curves contrast , levels contrasts, and mask blur, structure(if enabled tool) are used.\nDisabled in Inverse TP_LOCALLAB_MASK;Mask @@ -2666,8 +2669,9 @@ TP_LOCALLAB_MERTWO;Substract TP_LOCALLAB_METHOD_TOOLTIP;'Enhanced + chroma denoise' significantly increases processing times.\nBut reduce artifacts. TP_LOCALLAB_MLABEL;Restored datas Min=%1 Max=%2 (Clip - Offset) TP_LOCALLAB_MLABEL_TOOLTIP;'Should be' near min=0 max=32768 (log mode) but others values are possible.\nYou can act on Clip Restored datas and Offset to normalize.\n\nRestored image with no mixture. -TP_LOCALLAB_MODE_EXPERT;Expert -TP_LOCALLAB_MODE_NORMAL;Normal +TP_LOCALLAB_MODE_EXPERT;Advanced +TP_LOCALLAB_MODE_NORMAL;Standard +TP_LOCALLAB_MODE_SIMPLE;Basic TP_LOCALLAB_MRFIV;Background TP_LOCALLAB_MRFOU;Previous Spot TP_LOCALLAB_MRONE;None @@ -2695,12 +2699,12 @@ TP_LOCALLAB_ORIGLC;Merge only with original image TP_LOCALLAB_ORRETILAP_TOOLTIP;Acts on a second Laplacian threshold, to take into account ΔE to differentiate the action especially with the background (different from Scope) TP_LOCALLAB_ORRETISTREN_TOOLTIP;Acts on the Laplacian threshold, the greater the action, the more the differences in contrast will be reduced TP_LOCALLAB_PASTELS2;Vibrance -TP_LOCALLAB_PDE;Contrast attenuator - Dynamic Range compression -TP_LOCALLAB_PDEFRA;Contrast attenuator ƒ +TP_LOCALLAB_PDE;Contrast Attenuator - Dynamic Range compression +TP_LOCALLAB_PDEFRA;Contrast Attenuator ƒ TP_LOCALLAB_PDEFRAME_TOOLTIP;PDE IPOL - personal algorithm adapted from IPOL to Rawtherapee: lead to very different results and needs differents settings that Standard (negative black, gamma < 1,...)\nMay be usefull for low exposure or high dynamic range.\n TP_LOCALLAB_PREVIEW;Preview ΔE -TP_LOCALLAB_PREVHIDE;Hide all settings -TP_LOCALLAB_PREVSHOW;Show all settings +TP_LOCALLAB_PREVHIDE;Hide additional settings +TP_LOCALLAB_PREVSHOW;Show additional settings TP_LOCALLAB_PROXI;ΔE decay TP_LOCALLAB_QUALCURV_METHOD;Curves type TP_LOCALLAB_QUAL_METHOD;Global quality @@ -2723,7 +2727,7 @@ TP_LOCALLAB_RESIDHI;Highlights TP_LOCALLAB_RESIDHITHR;Highlights threshold TP_LOCALLAB_RESIDSHA;Shadows TP_LOCALLAB_RESIDSHATHR;Shadows threshold -TP_LOCALLAB_RETI;Dehaze - Retinex Strong contrast +TP_LOCALLAB_RETI;Dehaze - Retinex TP_LOCALLAB_RETIFRA;Retinex TP_LOCALLAB_RETIM;Original Retinex TP_LOCALLAB_RETITOOLFRA;Retinex Tools @@ -2763,8 +2767,9 @@ TP_LOCALLAB_SH1;Shadows Highlights TP_LOCALLAB_SH2;Equalizer TP_LOCALLAB_SHADEX;Shadows TP_LOCALLAB_SHADEXCOMP;Shadows compression & tonal width -TP_LOCALLAB_SHADHIGH;ShadowsHighlight - Tone equalizer -TP_LOCALLAB_SHADOWHIGHLIGHT_TOOLTIP;Can be used instead - or in complement - of exposure module in difficult cases.\nThe use of Denoise may be necessary : lightening the shadows.\n\nCan be used as graduated filter (increase Scope) +TP_LOCALLAB_SHADHIGH;Shadows/Highlights-Tone equalizer +TP_LOCALLAB_SHADOWHIGHLIGHT_TOOLTIP;Adjust shadows & highlights either with shadows & highlights sliders or with a tone equalizer.\nCan be used instead of, or in conjunction with the Exposure module.\nCan also be used as a graduated filter. +//Can be used instead - or in complement - of exposure module in difficult cases.\nThe use of Denoise may be necessary : lightening the shadows.\n\nCan be used as graduated filter (increase Scope) TP_LOCALLAB_SHAMASKCOL;Shadows mask TP_LOCALLAB_SHAPETYPE;Shape RT-spot area TP_LOCALLAB_SHAPE_TOOLTIP;Elipse is normal mode.\nRectangle can be used in some cases, for example to work in full image in conjonction with delimiters outside preview, transition = 100.\n\nPolygone - Beziers are waiting for GUI... @@ -2802,13 +2807,13 @@ TP_LOCALLAB_SHOWPOISSON;Poisson (pde ƒ) TP_LOCALLAB_SHOWR;Mask and modifications TP_LOCALLAB_SHOWREF;Preview ΔE TP_LOCALLAB_SHOWS;Mask and modifications -TP_LOCALLAB_SHOWSTRUC;Show structure Spot(expert) -TP_LOCALLAB_SHOWSTRUCEX;Show structure Spot(expert) +TP_LOCALLAB_SHOWSTRUC;Show structure Spot(advanced) +TP_LOCALLAB_SHOWSTRUCEX;Show structure Spot(advanced) TP_LOCALLAB_SHOWT;Mask and modifications TP_LOCALLAB_SHOWVI;Mask and modifications TP_LOCALLAB_SHRESFRA;Shadows/Highlights TP_LOCALLAB_SHTRC_TOOLTIP;Modifies the tones of the image by acting on a TRC (Tone Response Curve).\nGamma acts mainly on light tones.\nSlope acts mainly on dark tones -TP_LOCALLAB_SH_TOOLNAME;Shadows Highlight & Tone Equalizer - 5 +TP_LOCALLAB_SH_TOOLNAME;Shadows Highlights & Tone Equalizer - 5 TP_LOCALLAB_SIGMAWAV;Attenuation Response TP_LOCALLAB_SIM;Simple TP_LOCALLAB_SLOMASKCOL;Slope mask @@ -2822,7 +2827,7 @@ TP_LOCALLAB_SOFTRETI;Reduce artifact ΔE TP_LOCALLAB_SOFTRETI_TOOLTIP;Take into account deltaE to improve Transmission map TP_LOCALLAB_SOFT_TOOLNAME;Soft Light & Original Retinex - 6 TP_LOCALLAB_SOURCE_GRAY;Value -TP_LOCALLAB_SPECCASE; Specific cases +TP_LOCALLAB_SPECCASE;Specific cases TP_LOCALLAB_SPECIAL;Special use of RGB curves TP_LOCALLAB_SPECIAL_TOOLTIP;Only for this RGB curve, disabled (or reduce effects) of Scope, mask...for example, if you want to have a negative effect. TP_LOCALLAB_SPOTNAME;New Spot @@ -2838,7 +2843,7 @@ TP_LOCALLAB_STRRETI_TOOLTIP;if Strength Retinex < 0.2 only Dehaze is enabled.\ni TP_LOCALLAB_STRUC;Structure TP_LOCALLAB_STRUCCOL;Structure TP_LOCALLAB_STRUCCOL1;Structure Spot -TP_LOCALLAB_STRUCT_TOOLTIP;Use Sobel algorithm to take into account structure in shape detection.\nyou can have a preview by activating "mask and modifications - Show structure spot".\n\nCan be used in conjunction with masks (expert) structure, blur, wavelet to improve edge detection.\n\nNeeds maskless adjustments to be activated (lightness, exposure...) +TP_LOCALLAB_STRUCT_TOOLTIP;Use Sobel algorithm to take into account structure in shape detection.\nyou can have a preview by activating "mask and modifications - Show structure spot".\n\nCan be used in conjunction with masks (advanced) structure, blur, wavelet to improve edge detection.\n\nNeeds maskless adjustments to be activated (lightness, exposure...) TP_LOCALLAB_STRUMASKCOL;Structure mask strength TP_LOCALLAB_STRUMASK_TOOLTIP;Generate a structure mask with difference between surface areas and reliefs.\nIf structure mask as tool is enabled, this mask is used in addition to the other tools (gamma, slope, contrast curve ...) TP_LOCALLAB_STYPE;Shape method @@ -2858,7 +2863,8 @@ TP_LOCALLAB_TM_MASK;Use transmission map TP_LOCALLAB_TONEMAPESTOP_TOOLTIP;This parameter affects sensitivity to edges.\n The greater it is the more likely an illumination change is to be considered an "edge".\n If set to zero tone mapping will have an effect similar to unsharp masking. TP_LOCALLAB_TONEMAPGAM_TOOLTIP;Gamma moves the action of tone-mapping to shadows or highlights. TP_LOCALLAB_TONEMAPREWEI_TOOLTIP;In some cases tone mapping may result in a cartoonish appearance, and in some rare cases soft but wide halos may appear.\n Increasing the number of reweighting iterates will help fight some of these problems. -TP_LOCALLAB_TONEMAP_TOOLTIP;Tone Mapping - main menu must be disabled +TP_LOCALLAB_TONEMAP_TOOLTIP;Same as the tone mapping tool in the main menu.\nThe main menu tool must be de-activated if this tool is used. +//Tone Mapping - main menu must be disabled TP_LOCALLAB_TONEMASCALE_TOOLTIP;This control gives meaning to the difference between "local" and "global" contrast.\nThe greater it is the larger a detail needs to be in order to be boosted TP_LOCALLAB_TONE_TOOLNAME;Tone Mapping - 4 TP_LOCALLAB_TOOLCOL;Structure mask as tool @@ -2876,15 +2882,16 @@ TP_LOCALLAB_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscis TP_LOCALLAB_USEMASK;Use mask TP_LOCALLAB_VART;Variance (contrast) TP_LOCALLAB_VIBRANCE;Vibrance - Warm & Cool +TP_LOCALLAB_VIBRA_TOOLTIP;Adjust vibrance (essentially the same as the global adjustment).\nCarry out the equivalent of a white-balance adjustment using a CIECAM algorithm. TP_LOCALLAB_VIB_TOOLNAME;Vibrance - Warm & Cool - 3 TP_LOCALLAB_SOFT_TOOLNAME;Soft Light & Original Retinex - 6 -TP_LOCALLAB_BLUR_TOOLNAME;Smooth Blur Gain & Denoise - 1 +TP_LOCALLAB_BLUR_TOOLNAME;Smooth Blur Grain & Denoise - 1 TP_LOCALLAB_TONE_TOOLNAME;Tone Mapping - 4 TP_LOCALLAB_RET_TOOLNAME;Dehaze & Retinex - 9 TP_LOCALLAB_SHARP_TOOLNAME;Sharpening - 8 -TP_LOCALLAB_LC_TOOLNAME;Local Constrast & Wavelet (Defects) - 7 -TP_LOCALLAB_CBDL_TOOLNAME;CBDL (Defects) - 2 -TP_LOCALLAB_LOG_TOOLNAME;Encoding log - 0 +TP_LOCALLAB_LC_TOOLNAME;Local Contrast & Wavelet - 7 +TP_LOCALLAB_CBDL_TOOLNAME;CBDL - 2 +TP_LOCALLAB_LOG_TOOLNAME;Log Encoding - 0 TP_LOCALLAB_MASKCOM_TOOLNAME;Common Color Mask - 13 TP_LOCALLAB_VIS_TOOLTIP;Click to show/hide selected Control Spot.\nCtrl+click to show/hide all Control Spot. TP_LOCALLAB_WAMASKCOL;Ψ Mask Wavelet level diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index a166ecf15..ffd4f89ed 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -273,11 +273,7 @@ void CLASS derror() if (feof(ifp)) fprintf (stderr,_("Unexpected end of file\n")); else -#ifdef WIN32 - fprintf (stderr,_("Corrupt data near 0x%I64x\n"), (INT64) ftello(ifp)); -#else fprintf (stderr,_("Corrupt data near 0x%llx\n"), (INT64) ftello(ifp)); -#endif } data_error++; /*RT Issue 2467 longjmp (failure, 1);*/ @@ -2050,9 +2046,8 @@ void CLASS phase_one_load_raw_c() } else if ((col & 7) == 0) { for (int i = 0; i < 2; i++) { int j; - for (j = 0; j < 5 && !ph1_bits(1); j++) - ; - if (j--) { + for (j = 0; j < 5 && !ph1_bits(1); j++) ; + if (j--) { len[i] = length[j * 2 + ph1_bits(1)]; } } @@ -6207,8 +6202,8 @@ void CLASS parse_exif (int base) case 36867: case 36868: get_timestamp(0); break; case 37377: if ((expo = -getreal(type)) < 128) - tiff_ifd[tiff_nifds-1].shutter = - shutter = pow (2, expo); break; + tiff_ifd[tiff_nifds-1].shutter = shutter = pow (2, expo); + break; case 37378: aperture = pow (2, getreal(type)/2); break; case 37386: focal_len = getreal(type); break; case 37500: parse_makernote (base, 0); break; @@ -7093,7 +7088,8 @@ void CLASS apply_tiff() load_flags = 24; if (!strcmp(make,"SONY") && tiff_bps < 14 && tiff_ifd[raw].bytes == raw_width*raw_height*2) - tiff_bps = 14; if (tiff_ifd[raw].bytes*5 == raw_width*raw_height*8) { + tiff_bps = 14; + if (tiff_ifd[raw].bytes*5 == raw_width*raw_height*8) { load_flags = 81; tiff_bps = 12; } slr: @@ -7166,7 +7162,8 @@ void CLASS apply_tiff() // load_raw = &CLASS packed_load_raw; load_raw = &CLASS nikon_14bit_load_raw; } else - load_raw = &CLASS nikon_load_raw; break; + load_raw = &CLASS nikon_load_raw; + break; case 65535: load_raw = &CLASS pentax_load_raw; break; case 65000: diff --git a/rtengine/iimage.h b/rtengine/iimage.h index cd8aa9a9e..663795238 100644 --- a/rtengine/iimage.h +++ b/rtengine/iimage.h @@ -1809,9 +1809,6 @@ public: * @return The mutex */ virtual MyMutex& getMutex () = 0; virtual cmsHPROFILE getProfile () const = 0; - /** @brief Returns the bits per pixel of the image. - * @return The bits per pixel of the image */ - virtual int getBitsPerPixel () const = 0; /** @brief Saves the image to file. It autodetects the format (jpg, tif, png are supported). * @param fname is the name of the file @return the error code, 0 if none */ @@ -1836,8 +1833,6 @@ public: /** @brief Sets the progress listener if you want to follow the progress of the image saving operations (optional). * @param pl is the pointer to the class implementing the ProgressListener interface */ virtual void setSaveProgressListener (ProgressListener* pl) = 0; - /** @brief Free the image */ - virtual void free () = 0; }; /** @brief This class represents an image having a float pixel planar representation. diff --git a/rtengine/image16.cc b/rtengine/image16.cc index 07fc66fad..1a9130b5d 100644 --- a/rtengine/image16.cc +++ b/rtengine/image16.cc @@ -258,10 +258,10 @@ void Image16::getStdImage(const ColorTemp &ctemp, int tran, Imagefloat* image, P lineB[dst_x] = CLIP(bm * btot); } else { // computing a special factor for this incomplete sub-region - float area = src_sub_width * src_sub_height; - lineR[dst_x] = CLIP(rm2 * rtot / area); - lineG[dst_x] = CLIP(gm2 * gtot / area); - lineB[dst_x] = CLIP(bm2 * btot / area); + float larea = src_sub_width * src_sub_height; + lineR[dst_x] = CLIP(rm2 * rtot / larea); + lineG[dst_x] = CLIP(gm2 * gtot / larea); + lineB[dst_x] = CLIP(bm2 * btot / larea); } } } @@ -295,21 +295,6 @@ void Image16::getStdImage(const ColorTemp &ctemp, int tran, Imagefloat* image, P #undef GCLIP } -Image8* Image16::to8() const -{ - Image8* img8 = new Image8(width, height); - - for (int h = 0; h < height; ++h) { - for (int w = 0; w < width; ++w) { - img8->r(h, w) = uint16ToUint8Rounded(r(h, w)); - img8->g(h, w) = uint16ToUint8Rounded(g(h, w)); - img8->b(h, w) = uint16ToUint8Rounded(b(h, w)); - } - } - - return img8; -} - // Parallelized transformation; create transform with cmsFLAGS_NOCACHE! void Image16::ExecCMSTransform(cmsHTRANSFORM hTransform) { diff --git a/rtengine/image16.h b/rtengine/image16.h index de9288f2d..de9718708 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -40,8 +40,6 @@ public: Image16* copy() const; - Image8* to8() const; - void getStdImage(const ColorTemp &ctemp, int tran, Imagefloat* image, PreviewProps pp) const override; const char* getType() const override @@ -67,11 +65,6 @@ public: return getEmbeddedProfile(); } - int getBitsPerPixel() const override - { - return 8 * sizeof(unsigned short); - } - int saveToFile(const Glib::ustring &fname) const override { return save(fname); @@ -97,10 +90,6 @@ public: setProgressListener(pl); } - void free() override - { - delete this; - } void ExecCMSTransform(cmsHTRANSFORM hTransform); /* void ExecCMSTransform(cmsHTRANSFORM hTransform, const LabImage &labImage, int cx, int cy); */ diff --git a/rtengine/image8.h b/rtengine/image8.h index c11d9d7fc..dd3be5d9b 100644 --- a/rtengine/image8.h +++ b/rtengine/image8.h @@ -64,11 +64,6 @@ public: return getEmbeddedProfile (); } - int getBitsPerPixel () const override - { - return 8 * sizeof(unsigned char); - } - int saveToFile (const Glib::ustring &fname) const override { return save (fname); @@ -94,11 +89,6 @@ public: setProgressListener (pl); } - void free () override - { - delete this; - } - }; } diff --git a/rtengine/imagefloat.cc b/rtengine/imagefloat.cc index f905134a0..d9ac841eb 100644 --- a/rtengine/imagefloat.cc +++ b/rtengine/imagefloat.cc @@ -288,10 +288,10 @@ void Imagefloat::getStdImage (const ColorTemp &ctemp, int tran, Imagefloat* imag lineB[dst_x] = CLIP0(bm * btot); } else { // computing a special factor for this incomplete sub-region - float area = src_sub_width * src_sub_height; - lineR[dst_x] = CLIP0(rm2 * rtot / area); - lineG[dst_x] = CLIP0(gm2 * gtot / area); - lineB[dst_x] = CLIP0(bm2 * btot / area); + float larea = src_sub_width * src_sub_height; + lineR[dst_x] = CLIP0(rm2 * rtot / larea); + lineG[dst_x] = CLIP0(gm2 * gtot / larea); + lineB[dst_x] = CLIP0(bm2 * btot / larea); } } } @@ -327,53 +327,15 @@ void Imagefloat::getStdImage (const ColorTemp &ctemp, int tran, Imagefloat* imag #endif } -Image8* -Imagefloat::to8() const -{ - Image8* img8 = new Image8(width, height); -#ifdef _OPENMP - #pragma omp parallel for schedule(static) -#endif - - for (int h = 0; h < height; ++h) { - for (int w = 0; w < width; ++w) { - img8->r(h, w) = uint16ToUint8Rounded(CLIP(r(h, w))); - img8->g(h, w) = uint16ToUint8Rounded(CLIP(g(h, w))); - img8->b(h, w) = uint16ToUint8Rounded(CLIP(b(h, w))); - } - } - - return img8; -} - -Image16* -Imagefloat::to16() const -{ - Image16* img16 = new Image16(width, height); -#ifdef _OPENMP - #pragma omp parallel for schedule(static) -#endif - - for (int h = 0; h < height; ++h) { - for (int w = 0; w < width; ++w) { - img16->r(h, w) = CLIP(r(h, w)); - img16->g(h, w) = CLIP(g(h, w)); - img16->b(h, w) = CLIP(b(h, w)); - } - } - - return img16; -} - void Imagefloat::normalizeFloat(float srcMinVal, float srcMaxVal) { - float scale = MAXVALF / (srcMaxVal - srcMinVal); - int w = width; - int h = height; + const float scale = MAXVALF / (srcMaxVal - srcMinVal); + const int w = width; + const int h = height; #ifdef _OPENMP - #pragma omp parallel for firstprivate(w, h, srcMinVal, scale) schedule(dynamic, 5) + #pragma omp parallel for schedule(dynamic, 5) #endif for (int y = 0; y < h; y++) { @@ -389,11 +351,11 @@ void Imagefloat::normalizeFloat(float srcMinVal, float srcMaxVal) void Imagefloat::normalizeFloatTo1() { - int w = width; - int h = height; + const int w = width; + const int h = height; #ifdef _OPENMP - #pragma omp parallel for firstprivate(w, h) schedule(dynamic, 5) + #pragma omp parallel for schedule(dynamic, 5) #endif for (int y = 0; y < h; y++) { @@ -409,11 +371,11 @@ void Imagefloat::normalizeFloatTo1() void Imagefloat::normalizeFloatTo65535() { - int w = width; - int h = height; + const int w = width; + const int h = height; #ifdef _OPENMP - #pragma omp parallel for firstprivate(w, h) schedule(dynamic, 5) + #pragma omp parallel for schedule(dynamic, 5) #endif for (int y = 0; y < h; y++) { @@ -425,59 +387,6 @@ void Imagefloat::normalizeFloatTo65535() } } -void Imagefloat::calcCroppedHistogram(const ProcParams ¶ms, float scale, LUTu & hist) -{ - - hist.clear(); - - // Set up factors to calc the lightness - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params.icm.workingProfile); - - float facRed = wprof[1][0]; - float facGreen = wprof[1][1]; - float facBlue = wprof[1][2]; - - - // calc pixel size - int x1, x2, y1, y2; - params.crop.mapToResized(width, height, scale, x1, x2, y1, y2); - -#ifdef _OPENMP - #pragma omp parallel -#endif - { - LUTu histThr(65536); - histThr.clear(); -#ifdef _OPENMP - #pragma omp for nowait -#endif - - for (int y = y1; y < y2; y++) { - for (int x = x1; x < x2; x++) { - int i = (int)(facRed * r(y, x) + facGreen * g(y, x) + facBlue * b(y, x)); - - if (i < 0) { - i = 0; - } else if (i > 65535) { - i = 65535; - } - - histThr[i]++; - } - } - -#ifdef _OPENMP - #pragma omp critical -#endif - { - for(int i = 0; i <= 0xffff; i++) { - hist[i] += histThr[i]; - } - } - } - -} - // Parallelized transformation; create transform with cmsFLAGS_NOCACHE! void Imagefloat::ExecCMSTransform(cmsHTRANSFORM hTransform) { diff --git a/rtengine/imagefloat.h b/rtengine/imagefloat.h index c7000d4b8..3362afcda 100644 --- a/rtengine/imagefloat.h +++ b/rtengine/imagefloat.h @@ -45,9 +45,6 @@ public: Imagefloat* copy () const; - Image8* to8() const; - Image16* to16() const; - void getStdImage (const ColorTemp &ctemp, int tran, Imagefloat* image, PreviewProps pp) const override; const char* getType () const override @@ -72,10 +69,6 @@ public: { return getEmbeddedProfile (); } - int getBitsPerPixel () const override - { - return 8 * sizeof(float); - } int saveToFile (const Glib::ustring &fname) const override { return save (fname); @@ -96,10 +89,6 @@ public: { setProgressListener (pl); } - void free () override - { - delete this; - } inline uint16_t DNG_FloatToHalf(float f) const { @@ -220,7 +209,6 @@ public: void normalizeFloat(float srcMinVal, float srcMaxVal) override; void normalizeFloatTo1(); void normalizeFloatTo65535(); - void calcCroppedHistogram(const ProcParams ¶ms, float scale, LUTu & hist); void ExecCMSTransform(cmsHTRANSFORM hTransform); void ExecCMSTransform(cmsHTRANSFORM hTransform, const LabImage &labImage, int cx, int cy); }; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index a7f73a19a..1da11ab4e 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -865,8 +865,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if ((todo & M_RGBCURVE) || (todo & M_CROP)) { - // if (hListener) oprevi->calcCroppedHistogram(params, scale, histCropped); - //complexCurve also calculated pre-curves histogram depending on crop CurveFactory::complexCurve(params->toneCurve.expcomp, params->toneCurve.black / 65535.0, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 48f2cbc92..ba911b879 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -390,7 +390,7 @@ public: std::unique_ptr buildMeaLut(const float inVals[11], const float mea[10], float& lutFactor); void Aver(const float* HH_Coeffs, int datalen, float &averagePlus, float &averageNeg, float &max, float &min, int numThreads); void Sigma(const float* HH_Coeffs, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg, int numThreads); - void calckoe(const float* const* WavCoeffs_LL, float gradw, float tloww, float ** koeLi, int level, int dir, int W_L, int H_L, float edd, float &maxkoeLi, float **tmC = nullptr); + void calckoe(const float* WavCoeffs_LL, float gradw, float tloww, float *koeLi, int level, int W_L, int H_L, float edd, float &maxkoeLi, float **tmC, bool multiThread = false); void Median_Denoise(float **src, float **dst, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); void Median_Denoise(float **src, float **dst, float upperBound, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 2c86db032..cfd4a271e 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -3724,6 +3724,13 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw fftwf_free(data_fft04); fftwf_free(data_tmp04); } + if (show == 2) { + for (int y = 0; y < bfh ; y++) { + for (int x = 0; x < bfw; x++) { + datashow[y * bfw + x] = data_fft[y * bfw + x]; + } + } + } /* solve the Poisson PDE in Fourier space */ /* 1. / (float) (bfw * bfh)) is the DCT normalisation term, see libfftw */ @@ -7402,7 +7409,7 @@ BENCHFUN CompressDR(wav_L0, W_L, H_L, Compression, DetailBoost); } - if ((lp.residsha != 0.f || lp.residhi != 0.f)) { + if ((lp.residsha < 0.f || lp.residhi < 0.f)) { float tran = 5.f;//transition shadow if (lp.residshathr > (100.f - tran)) { @@ -7439,6 +7446,31 @@ BENCHFUN } } + if ((lp.residsha > 0.f || lp.residhi > 0.f)) { + const std::unique_ptr temp(new LabImage(W_L, H_L)); +#ifdef _OPENMP + #pragma omp parallel for if (multiThread) +#endif + + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + temp->L[i][j] = wav_L0[i * W_L + j]; + } + } + + ImProcFunctions::shadowsHighlights(temp.get(), true, 1, lp.residhi, lp.residsha , 40, sk, lp.residhithr, lp.residshathr); + +#ifdef _OPENMP + #pragma omp parallel for if (multiThread) +#endif + + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + wav_L0[i * W_L + j] = temp->L[i][j]; + } + } + } + if (contrast != 0.) { double avedbl = 0.0; // use double precision for large summations @@ -7515,9 +7547,9 @@ BENCHFUN float eddlipampl = 1.f + lp.basew / 50.f; int W_L = wdspot->level_W(0);//provisory W_L H_L int H_L = wdspot->level_H(0); + float *koeLi[12]; float maxkoeLi[12] = {0.f}; - float *beta = new float[W_L * H_L]; float *koeLibuffer = new float[12 * H_L * W_L]; //12 @@ -7525,65 +7557,21 @@ BENCHFUN koeLi[i] = &koeLibuffer[i * W_L * H_L]; } - for (int j = 0; j < 12; j++) { - for (int i = 0; i < W_L * H_L; i++) { - koeLi[j][i] = 0.f; - } - } - array2D tmC(W_L, H_L); float gradw = lp.gradw; float tloww = lp.tloww; -//StopWatch Stop1("test"); for (int lvl = 0; lvl < 4; lvl++) { for (int dir = 1; dir < 4; dir++) { const int W_L = wdspot->level_W(lvl); const int H_L = wdspot->level_H(lvl); float* const* wav_L = wdspot->level_coeffs(lvl); - if (lvl == 3 && dir == 3) { - const float effect = lp.sigmaed; - constexpr float offset = 1.f; - float mea[10]; - calceffect(lvl, mean, sigma, mea, effect, offset); - -#ifdef _OPENMP - #pragma omp parallel for if(multiThread) -#endif - for (int co = 0; co < H_L * W_L; co++) { - const float WavCL = std::fabs(wav_L[dir][co]); - - if (WavCL < mea[0]) { - beta[co] = 0.05f; - } else if (WavCL < mea[1]) { - beta[co] = 0.2f; - } else if (WavCL < mea[2]) { - beta[co] = 0.7f; - } else if (WavCL < mea[3]) { - beta[co] = 1.f; //standard - } else if (WavCL < mea[4]) { - beta[co] = 1.f; - } else if (WavCL < mea[5]) { - beta[co] = 0.8f; //+sigma - } else if (WavCL < mea[6]) { - beta[co] = 0.5f; - } else if (WavCL < mea[7]) { - beta[co] = 0.3f; - } else if (WavCL < mea[8]) { - beta[co] = 0.2f; // + 2 sigma - } else if (WavCL < mea[9]) { - beta[co] = 0.1f; - } else { - beta[co] = 0.05f; - } - } - } - calckoe(wav_L, gradw, tloww, koeLi, lvl, dir, W_L, H_L, edd, maxkoeLi[lvl * 3 + dir - 1], tmC); + calckoe(wav_L[dir], gradw, tloww, koeLi[lvl * 3 + dir - 1], lvl, W_L, H_L, edd, maxkoeLi[lvl * 3 + dir - 1], tmC, true); // return convolution KoeLi and maxkoeLi of level 0 1 2 3 and Dir Horiz, Vert, Diag } } + tmC.free(); -//Stop1.stop(); float aamp = 1.f + lp.thigw / 100.f; const float alipinfl = (eddlipampl - 1.f) / (1.f - eddlipinfl); @@ -7743,6 +7731,14 @@ BENCHFUN constexpr float da_abssd = (maxampd - abssd) / 0.333f; constexpr float db_abssd = maxampd - da_abssd; constexpr float am = (abssd - bbssd) / 0.666f; + const float effect = lp.sigmaed; + constexpr float offset = 1.f; + float mea[10]; + calceffect(lvl, mean, sigma, mea, effect, offset); + float lutFactor; + const float inVals[] = {0.05f, 0.2f, 0.7f, 1.f, 1.f, 0.8f, 0.5f, 0.3f, 0.2f, 0.1f, 0.05f}; + const auto meaLut = buildMeaLut(inVals, mea, lutFactor); + for (int dir = 1; dir < 4; dir++) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 16) if(multiThread) @@ -7800,7 +7796,7 @@ BENCHFUN } edge = std::max(edge * kinterm, 1.f); - wav_L[dir][k] *= 1.f + (edge - 1.f) * beta[k]; + wav_L[dir][k] *= 1.f + (edge - 1.f) * (*meaLut)[std::fabs(wav_L[dir][k]) * lutFactor]; } } } @@ -7810,8 +7806,6 @@ BENCHFUN if (koeLibuffer) { delete [] koeLibuffer; } - - delete[] beta; } //edge sharpness end diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index c2798af77..21fffb76c 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -2217,7 +2217,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * for (int dir = 1; dir < 4; dir++) { const float* const* WavCoeffs_LL = WaveletCoeffs_L.level_coeffs(lvl); float tempkoeli = 0.f; - calckoe (WavCoeffs_LL, gradw, tloww, koeLi, lvl , dir, W_L, H_L, edd, tempkoeli, tmC); + calckoe (WavCoeffs_LL[dir], gradw, tloww, koeLi[lvl * 3 + dir - 1], lvl, W_L, H_L, edd, tempkoeli, tmC); maxkoeLi[lvl * 3 + dir - 1] = tempkoeli ; // return convolution KoeLi and maxkoeLi of level 0 1 2 3 and Dir Horiz, Vert, Diag } @@ -2645,13 +2645,11 @@ BENCHFUN } } -void ImProcFunctions::calckoe (const float* const* WavCoeffs_LL, float gradw, float tloww, float *koeLi[12], int level, int dir, int W_L, int H_L, float edd, float &maxkoeLi, float **tmC) +void ImProcFunctions::calckoe (const float* WavCoeffs, float gradw, float tloww, float *koeLi, int level, int W_L, int H_L, float edd, float &maxkoeLi, float **tmC, bool multiThread) { - int borderL = 2; - - if (tloww < 30.f) { - borderL = 1; + const int borderL = tloww < 75.f ? 1 : 2; + if (tloww < 75.f) { // I calculate coefficients with r size matrix 3x3 r=1 ; 5x5 r=2; 7x7 r=3 /* float k[2*r][2*r]; @@ -2663,123 +2661,144 @@ void ImProcFunctions::calckoe (const float* const* WavCoeffs_LL, float gradw, fl //I could also use Gauss.h for 3x3 // If necessary I can put a 7x7 matrix */ - for (int i = 1; i < H_L - 1; i++) { //sigma=0.55 - for (int j = 1; j < W_L - 1; j++) { - tmC[i][j] = (8.94f * WavCoeffs_LL[dir][i * W_L + j] + 1.71f * (WavCoeffs_LL[dir][(i - 1) * W_L + j] + 1.71f * WavCoeffs_LL[dir][(i + 1) * W_L + j] - + 1.71f * WavCoeffs_LL[dir][i * W_L + j + 1] + 1.71f * WavCoeffs_LL[dir][i * W_L + j - 1]) + 0.33f * WavCoeffs_LL[dir][(i - 1) * W_L + j - 1] - + 0.33f * WavCoeffs_LL[dir][(i - 1) * W_L + j + 1] + 0.33f * WavCoeffs_LL[dir][(i + 1) * W_L + j - 1] + 0.33f * WavCoeffs_LL[dir][(i + 1) * W_L + j + 1]) * 0.0584795f; - // apply to each direction Wavelet level : horizontal / vertiacle / diagonal - - - } + float c0, c1, c2, mult; + if (tloww < 30.f) { //sigma=0.55 + c0 = 8.94f; + c1 = 1.71f; + c2 = 0.33f; + mult = 0.0584795f; + } else if (tloww < 50.f) { //sigma=0.85 + c0 = 4.0091f; + c1 = 2.0068f; + c2 = 1.0045f; + mult = 0.062288f; + } else { //sigma=1.1 + c0 = 3.025f; + c1 = 2.001f; + c2 = 1.323f; + mult = 0.06127f; } - } else if (tloww < 50.f) { - borderL = 1; - - for (int i = 1; i < H_L - 1; i++) { //sigma=0.85 - for (int j = 1; j < W_L - 1; j++) { - tmC[i][j] = (4.0091f * WavCoeffs_LL[dir][i * W_L + j] + 2.0068f * (WavCoeffs_LL[dir][(i - 1) * W_L + j] + 2.0068f * WavCoeffs_LL[dir][(i + 1) * W_L + j] - + 2.0068f * WavCoeffs_LL[dir][i * W_L + j + 1] + 2.0068f * WavCoeffs_LL[dir][i * W_L + j - 1]) + 1.0045f * WavCoeffs_LL[dir][(i - 1) * W_L + j - 1] - + 1.0045f * WavCoeffs_LL[dir][(i - 1) * W_L + j + 1] + 1.0045f * WavCoeffs_LL[dir][(i + 1) * W_L + j - 1] + 1.0045f * WavCoeffs_LL[dir][(i + 1) * W_L + j + 1]) * 0.062288f; - // apply to each direction Wavelet level : horizontal / vertiacle / diagonal - - - } - } - } - - - else if (tloww < 75.f) { - borderL = 1; - + c0 *= mult; + c1 *= mult; + c2 *= mult; +#ifdef _OPENMP + #pragma omp parallel for if(multiThread) +#endif for (int i = 1; i < H_L - 1; i++) { - for (int j = 1; j < W_L - 1; j++) { //sigma=1.1 - tmC[i][j] = (3.025f * WavCoeffs_LL[dir][i * W_L + j] + 2.001f * (WavCoeffs_LL[dir][(i - 1) * W_L + j] + 2.001f * WavCoeffs_LL[dir][(i + 1) * W_L + j] - + 2.001f * WavCoeffs_LL[dir][i * W_L + j + 1] + 2.001f * WavCoeffs_LL[dir][i * W_L + j - 1]) + 1.323f * WavCoeffs_LL[dir][(i - 1) * W_L + j - 1] - + 1.323f * WavCoeffs_LL[dir][(i - 1) * W_L + j + 1] + 1.323f * WavCoeffs_LL[dir][(i + 1) * W_L + j - 1] + 1.323f * WavCoeffs_LL[dir][(i + 1) * W_L + j + 1]) * 0.06127f; + for (int j = 1; j < W_L - 1; j++) { + tmC[i][j] = c0 * WavCoeffs[i * W_L + j] + + c1 * ((WavCoeffs[(i - 1) * W_L + j] + WavCoeffs[(i + 1) * W_L + j]) + (WavCoeffs[i * W_L + j + 1] + WavCoeffs[i * W_L + j - 1])) + + c2 * ((WavCoeffs[(i - 1) * W_L + j - 1] + WavCoeffs[(i - 1) * W_L + j + 1]) + (WavCoeffs[(i + 1) * W_L + j - 1] + WavCoeffs[(i + 1) * W_L + j + 1])); } } - } - - else if (tloww >= 75.f) { - borderL = 2; - + } else { if (level > 1) { // do not activate 5x5 if level 0 or 1 + // Gaussian 1.1 + // 0.5 2 3 2 0.5 + // 2 7 10 7 2 + // 3 10 15 10 3 + // 2 7 10 7 2 + // 0.5 2 3 2 0.5 + // divi 113 + //Gaussian 1.4 + // 2 4 5 4 2 + // 4 9 12 9 4 + // 5 12 15 12 5 + // 4 9 12 9 4 + // 2 4 5 4 2 + // divi 159 + float c0, c1, c2, c3, c4, c5, mult; + if (tloww < 85.f) { //sigma=1.1 + c0 = 15.f; + c1 = 10.f; + c2 = 7.f; + c3 = 3.f; + c4 = 2.f; + c5 = 0.5f; + mult = 0.0088495f; + } else { //sigma=1.4 + c0 = 15.f; + c1 = 12.f; + c2 = 9.f; + c3 = 5.f; + c4 = 4.f; + c5 = 2.f; + mult = 0.0062893f; + } + c0 *= mult; + c1 *= mult; + c2 *= mult; + c3 *= mult; + c4 *= mult; + c5 *= mult; +#ifdef _OPENMP + #pragma omp parallel for if(multiThread) +#endif for (int i = 2; i < H_L - 2; i++) { for (int j = 2; j < W_L - 2; j++) { - // Gaussian 1.1 - // 0.5 2 3 2 0.5 - // 2 7 10 7 2 - // 3 10 15 10 3 - // 2 7 10 7 2 - // 0.5 2 3 2 0.5 - // divi 113 - //Gaussian 1.4 - // 2 4 5 4 2 - // 4 9 12 9 4 - // 5 12 15 12 5 - // 4 9 12 9 4 - // 2 4 5 4 2 - // divi 159 - if (tloww < 85.f) { //sigma=1.1 - tmC[i][j] = (15.f * WavCoeffs_LL[dir][i * W_L + j] + 10.f * WavCoeffs_LL[dir][(i - 1) * W_L + j] + 10.f * WavCoeffs_LL[dir][(i + 1) * W_L + j] - + 10.f * WavCoeffs_LL[dir][i * W_L + j + 1] + 10.f * WavCoeffs_LL[dir][i * W_L + j - 1] + 7.f * WavCoeffs_LL[dir][(i - 1) * W_L + j - 1] - + 7.f * WavCoeffs_LL[dir][(i - 1) * W_L + j + 1] + 7.f * WavCoeffs_LL[dir][(i + 1) * W_L + j - 1] + 7.f * WavCoeffs_LL[dir][(i + 1) * W_L + j + 1] - + 3.f * WavCoeffs_LL[dir][(i - 2) * W_L + j] + 3.f * WavCoeffs_LL[dir][(i + 2) * W_L + j] + 3.f * WavCoeffs_LL[dir][i * W_L + j - 2] + 3.f * WavCoeffs_LL[dir][i * W_L + j + 2] - + 2.f * WavCoeffs_LL[dir][(i - 2) * W_L + j - 1] + 2.f * WavCoeffs_LL[dir][(i - 2) * W_L + j + 1] + 2.f * WavCoeffs_LL[dir][(i + 2) * W_L + j + 1] + 2.f * WavCoeffs_LL[dir][(i + 2) * W_L + j - 1] - + 2.f * WavCoeffs_LL[dir][(i - 1) * W_L + j - 2] + 2.f * WavCoeffs_LL[dir][(i - 1) * W_L + j + 2] + 2.f * WavCoeffs_LL[dir][(i + 1) * W_L + j + 2] + 2.f * WavCoeffs_LL[dir][(i + 1) * W_L + j - 2] - + 0.5f * WavCoeffs_LL[dir][(i - 2) * W_L + j - 2] + 0.5f * WavCoeffs_LL[dir][(i - 2) * W_L + j + 2] + 0.5f * WavCoeffs_LL[dir][(i + 2) * W_L + j - 2] + 0.5f * WavCoeffs_LL[dir][(i + 2) * W_L + j + 2] - ) * 0.0088495f; - - } - - else {//sigma=1.4 - tmC[i][j] = (15.f * WavCoeffs_LL[dir][i * W_L + j] + 12.f * WavCoeffs_LL[dir][(i - 1) * W_L + j] + 12.f * WavCoeffs_LL[dir][(i + 1) * W_L + j] - + 12.f * WavCoeffs_LL[dir][i * W_L + j + 1] + 12.f * WavCoeffs_LL[dir][i * W_L + j - 1] + 9.f * WavCoeffs_LL[dir][(i - 1) * W_L + j - 1] - + 9.f * WavCoeffs_LL[dir][(i - 1) * W_L + j + 1] + 9.f * WavCoeffs_LL[dir][(i + 1) * W_L + j - 1] + 9.f * WavCoeffs_LL[dir][(i + 1) * W_L + j + 1] - + 5.f * WavCoeffs_LL[dir][(i - 2) * W_L + j] + 5.f * WavCoeffs_LL[dir][(i + 2) * W_L + j] + 5.f * WavCoeffs_LL[dir][i * W_L + j - 2] + 5.f * WavCoeffs_LL[dir][i * W_L + j + 2] - + 4.f * WavCoeffs_LL[dir][(i - 2) * W_L + j - 1] + 4.f * WavCoeffs_LL[dir][(i - 2) * W_L + j + 1] + 4.f * WavCoeffs_LL[dir][(i + 2) * W_L + j + 1] + 4.f * WavCoeffs_LL[dir][(i + 2) * W_L + j - 1] - + 4.f * WavCoeffs_LL[dir][(i - 1) * W_L + j - 2] + 4.f * WavCoeffs_LL[dir][(i - 1) * W_L + j + 2] + 4.f * WavCoeffs_LL[dir][(i + 1) * W_L + j + 2] + 4.f * WavCoeffs_LL[dir][(i + 1) * W_L + j - 2] - + 2.f * WavCoeffs_LL[dir][(i - 2) * W_L + j - 2] + 2.f * WavCoeffs_LL[dir][(i - 2) * W_L + j + 2] + 2.f * WavCoeffs_LL[dir][(i + 2) * W_L + j - 2] + 2.f * WavCoeffs_LL[dir][(i + 2) * W_L + j + 2] - ) * 0.0062893f; - } - - - // apply to each direction Wavelet level : horizontal / vertiacle / diagonal + tmC[i][j] = c0 * WavCoeffs[i * W_L + j] + + c1 * ((WavCoeffs[(i - 1) * W_L + j] + WavCoeffs[(i + 1) * W_L + j]) + (WavCoeffs[i * W_L + j + 1] + WavCoeffs[i * W_L + j - 1])) + + c2 * ((WavCoeffs[(i - 1) * W_L + j - 1] + WavCoeffs[(i - 1) * W_L + j + 1]) + (WavCoeffs[(i + 1) * W_L + j - 1] + WavCoeffs[(i + 1) * W_L + j + 1])) + + c3 * ((WavCoeffs[(i - 2) * W_L + j] + WavCoeffs[(i + 2) * W_L + j]) + (WavCoeffs[i * W_L + j - 2] + WavCoeffs[i * W_L + j + 2])) + + c4 * ((WavCoeffs[(i - 2) * W_L + j - 1] + WavCoeffs[(i - 2) * W_L + j + 1]) + (WavCoeffs[(i + 2) * W_L + j + 1] + WavCoeffs[(i + 2) * W_L + j - 1]) + + (WavCoeffs[(i - 1) * W_L + j - 2] + WavCoeffs[(i - 1) * W_L + j + 2]) + (WavCoeffs[(i + 1) * W_L + j + 2] + WavCoeffs[(i + 1) * W_L + j - 2])) + + c5 * ((WavCoeffs[(i - 2) * W_L + j - 2] + WavCoeffs[(i - 2) * W_L + j + 2]) + (WavCoeffs[(i + 2) * W_L + j - 2] + WavCoeffs[(i + 2) * W_L + j + 2])); } } + } else { +#ifdef _OPENMP + #pragma omp parallel for if(multiThread) +#endif + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + koeLi[i * W_L + j] = 0.f; + } + } + return; } - } - float thr = 40.f; //avoid artifact eg. noise...to test - float thr2 = 1.5f * edd; //edd can be modified in option ed_detect - thr2 += gradw / 30.f; //to test - float diffFactor = (gradw / 100.f); - - for (int i = 0; i < H_L; i++) { + // fill borders with 1.f + int ii = 0; + for (; ii < borderL; ii++) { for (int j = 0; j < W_L; j++) { - koeLi[level * 3 + dir - 1][i * W_L + j] = 1.f; + koeLi[ii * W_L + j] = 1.f; } } + for (; ii < H_L - borderL; ii++) { + for (int j = 0; j < borderL; j++) { + koeLi[ii * W_L + j] = 1.f; + } + for (int j = W_L - borderL; j < W_L; j++) { + koeLi[ii * W_L + j] = 1.f; + } + } + for (; ii < H_L; ii++) { + for (int j = 0; j < W_L; j++) { + koeLi[ii * W_L + j] = 1.f; + } + } + + constexpr float thr = 40.f; //avoid artifact eg. noise...to test + const float thr2 = 1.5f * edd + gradw / 30.f; //edd can be modified in option ed_detect + const float diffFactor = gradw / 100.f; for (int i = borderL; i < H_L - borderL; i++) { for (int j = borderL; j < W_L - borderL; j++) { // my own algo : probably a little false, but simpler as Lipschitz ! // Thr2 = maximum of the function ==> Lipsitch says = probably edge - float temp = rtengine::max(std::fabs(WavCoeffs_LL[dir][i * W_L + j]), thr); - koeLi[level * 3 + dir - 1][i * W_L + j] = rtengine::min(thr2, std::fabs(tmC[i][j] / temp)); // limit maxi + float temp = rtengine::max(std::fabs(WavCoeffs[i * W_L + j]), thr); + koeLi[i * W_L + j] = rtengine::min(thr2, std::fabs(tmC[i][j] / temp)); // limit maxi //it will be more complicated to calculate both Wh and Wv, but we have also Wd==> pseudo Lipschitz - if (koeLi[level * 3 + dir - 1][i * W_L + j] > maxkoeLi) { - maxkoeLi = koeLi[level * 3 + dir - 1][i * W_L + j]; + if (koeLi[i * W_L + j] > maxkoeLi) { + maxkoeLi = koeLi[i * W_L + j]; } - float diff = maxkoeLi - koeLi[level * 3 + dir - 1][i * W_L + j]; + float diff = maxkoeLi - koeLi[i * W_L + j]; diff *= diffFactor; - koeLi[level * 3 + dir - 1][i * W_L + j] = maxkoeLi - diff; + koeLi[i * W_L + j] = maxkoeLi - diff; } } - } void ImProcFunctions::finalContAllL(float* const* WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, const cont_params &cp, diff --git a/rtengine/procevents.h b/rtengine/procevents.h index dbdd5161f..b64748d22 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -946,7 +946,7 @@ enum ProcEventCode { Evlocallabsigmalc2 = 920, Evlocallabblwh = 921, EvlocallabcomplexityWithRefresh = 922, - EvlocallabcomplexityWithoutRefresh = 923, + // EvlocallabcomplexityWithoutRefresh = 923, EvLocallabSpotcolorscope = 924, EvlocallabshowmasktypMethod = 925, Evlocallabshadmaskblsha = 926, diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 3d1f3e071..acad7d34d 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2656,7 +2656,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : // Color & Light visicolor(false), expcolor(false), - complexcolor(0), + complexcolor(2), curvactiv(false), lightness(0), contrast(0), @@ -3293,7 +3293,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : scaltm(1.0), rewei(0), satur(0.), - sensitm(30), + sensitm(60), softradiustm(0.0), amount(95.), equiltm(true), diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 4b48d7740..1be81a7de 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -950,7 +950,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabsigmalc2 LUMINANCECURVE, // Evlocallabblwh LUMINANCECURVE, // EvlocallabcomplexityWithRefresh - M_VOID, // EvlocallabcomplexityWithoutRefresh + 0, // can be reused LUMINANCECURVE, // EvLocallabSpotcolorscope LUMINANCECURVE, // EvlocallabshowmasktypMethod LUMINANCECURVE, // Evlocallabshadmaskblsha @@ -982,7 +982,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabblendmaskab LUMINANCECURVE, // EvLocallabSpotprevMethod LUMINANCECURVE, // Evlocallabactiv - LUMINANCECURVE // EvlocallabCHshape + LUMINANCECURVE, // EvlocallabCHshape }; diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index 142374213..6f8c0e83a 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -36,7 +36,7 @@ double one2one(double val) } } -Adjuster::Adjuster ( +Adjuster::Adjuster( Glib::ustring vlabel, double vmin, double vmax, @@ -45,21 +45,20 @@ Adjuster::Adjuster ( Gtk::Image *imgIcon1, Gtk::Image *imgIcon2, double2double_fun slider2value, - double2double_fun value2slider) - - : - + double2double_fun value2slider +) : adjustmentName(std::move(vlabel)), grid(nullptr), label(nullptr), imageIcon1(imgIcon1), automatic(nullptr), adjusterListener(nullptr), + spinChange(options.adjusterMinDelay, options.adjusterMaxDelay), + sliderChange(options.adjusterMinDelay, options.adjusterMaxDelay), editedCheckBox(nullptr), afterReset(false), blocked(false), addMode(false), - eventPending(false), vMin(vmin), vMax(vmax), vStep(vstep), @@ -67,8 +66,7 @@ Adjuster::Adjuster ( logPivot(0), logAnchorMiddle(false), value2slider(value2slider ? value2slider : &one2one), - slider2value(slider2value ? slider2value : &one2one), - delay(options.adjusterMinDelay) + slider2value(slider2value ? slider2value : &one2one) { set_hexpand(true); @@ -155,8 +153,27 @@ Adjuster::Adjuster ( defaultVal = ctorDefaultVal = shapeValue(vdefault); editedState = defEditedState = Irrelevant; - sliderChange = slider->signal_value_changed().connect( sigc::mem_fun(*this, &Adjuster::sliderChanged) ); - spinChange = spin->signal_value_changed().connect( sigc::mem_fun(*this, &Adjuster::spinChanged), true); + spinChange.connect( + spin->signal_value_changed(), + sigc::mem_fun(*this, &Adjuster::spinChanged), + [this]() + { + sliderChange.block(true); + setSliderValue(addMode ? spin->get_value() : this->value2slider(spin->get_value())); + sliderChange.block(false); + } + ); + sliderChange.connect( + slider->signal_value_changed(), + sigc::mem_fun(*this, &Adjuster::sliderChanged), + [this]() + { + spinChange.block(); + const double v = shapeValue(getSliderValue()); + spin->set_value(addMode ? v : this->slider2value(v)); + spinChange.unblock(); + } + ); reset->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &Adjuster::resetPressed) ); show_all(); @@ -165,9 +182,8 @@ Adjuster::Adjuster ( Adjuster::~Adjuster () { - sliderChange.block(true); - spinChange.block(true); - delayConnection.block(true); + sliderChange.block(); + spinChange.block(); adjusterListener = nullptr; } @@ -211,8 +227,6 @@ void Adjuster::throwOnButtonRelease(bool throwOnBRelease) buttonReleaseSpin.disconnect(); } } - - eventPending = false; } void Adjuster::setDefault (double def) @@ -239,9 +253,7 @@ void Adjuster::sliderReleased (GdkEventButton* event) { if ((event != nullptr) && (event->button == 1)) { - if (delayConnection.connected()) { - delayConnection.disconnect(); - } + sliderChange.cancel(); notifyListener(); } @@ -250,10 +262,8 @@ void Adjuster::sliderReleased (GdkEventButton* event) void Adjuster::spinReleased (GdkEventButton* event) { - if ((event != nullptr) && delay == 0) { - if (delayConnection.connected()) { - delayConnection.disconnect(); - } + if (event) { + spinChange.cancel(); notifyListener(); } @@ -351,31 +361,15 @@ void Adjuster::setAddMode(bool addM) } } -void Adjuster::spinChanged () +void Adjuster::spinChanged() { - if (delayConnection.connected()) { - delayConnection.disconnect(); - } - - sliderChange.block(true); - setSliderValue(addMode ? spin->get_value() : value2slider(spin->get_value())); - sliderChange.block(false); - - if (delay == 0) { - if (adjusterListener && !blocked) { - if (!buttonReleaseSlider.connected() || afterReset) { - eventPending = false; - if (automatic) { - setAutoValue(false); - } - adjusterListener->adjusterChanged(this, spin->get_value()); - } else { - eventPending = true; + if (adjusterListener && !blocked) { + if (!buttonReleaseSlider.connected() || afterReset) { + if (automatic) { + setAutoValue(false); } + adjusterListener->adjusterChanged(this, spin->get_value()); } - } else { - eventPending = true; - delayConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Adjuster::notifyListener), delay); } if (editedState == UnEdited) { @@ -393,31 +387,13 @@ void Adjuster::spinChanged () void Adjuster::sliderChanged () { - - if (delayConnection.connected()) { - delayConnection.disconnect(); - } - - spinChange.block(true); - const double v = shapeValue(getSliderValue()); - spin->set_value(addMode ? v : slider2value(v)); - spinChange.block(false); - - if (delay == 0 || afterReset) { - if (adjusterListener && !blocked) { - if (!buttonReleaseSlider.connected() || afterReset) { - eventPending = false; - if (automatic) { - setAutoValue(false); - } - adjusterListener->adjusterChanged(this, spin->get_value()); - } else { - eventPending = true; + if (adjusterListener && !blocked) { + if (!buttonReleaseSlider.connected() || afterReset) { + if (automatic) { + setAutoValue(false); } + adjusterListener->adjusterChanged(this, spin->get_value()); } - } else { - eventPending = true; - delayConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Adjuster::notifyListener), delay); } if (!afterReset && editedState == UnEdited) { @@ -435,12 +411,12 @@ void Adjuster::sliderChanged () void Adjuster::setValue (double a) { - spinChange.block(true); + spinChange.block(); sliderChange.block(true); spin->set_value(shapeValue(a)); setSliderValue(addMode ? shapeValue(a) : value2slider(shapeValue(a))); sliderChange.block(false); - spinChange.block(false); + spinChange.unblock(); afterReset = false; } @@ -455,16 +431,13 @@ void Adjuster::setAutoValue (bool a) bool Adjuster::notifyListener () { - - if (eventPending && adjusterListener != nullptr && !blocked) { + if (adjusterListener != nullptr && !blocked) { if (automatic) { setAutoValue(false); } adjusterListener->adjusterChanged(this, spin->get_value()); } - eventPending = false; - return false; } @@ -555,8 +528,6 @@ void Adjuster::editedToggled () } adjusterListener->adjusterChanged(this, spin->get_value()); } - - eventPending = false; } void Adjuster::trimValue (double &val) const @@ -706,3 +677,9 @@ bool Adjuster::getAddMode() const { return addMode; } + +void Adjuster::setDelay(unsigned int min_delay_ms, unsigned int max_delay_ms) +{ + spinChange.setDelay(min_delay_ms, max_delay_ms); + sliderChange.setDelay(min_delay_ms, max_delay_ms); +} diff --git a/rtgui/adjuster.h b/rtgui/adjuster.h index 143268786..abafbd730 100644 --- a/rtgui/adjuster.h +++ b/rtgui/adjuster.h @@ -19,6 +19,7 @@ #pragma once #include "editedstate.h" +#include "delayed.h" #include "guiutils.h" class Adjuster; @@ -35,7 +36,6 @@ typedef double(*double2double_fun)(double val); class Adjuster final : public Gtk::Grid { - protected: Glib::ustring adjustmentName; Gtk::Grid* grid; @@ -46,9 +46,8 @@ protected: Gtk::Button* reset; Gtk::CheckButton* automatic; AdjusterListener* adjusterListener; - sigc::connection delayConnection; - sigc::connection spinChange; - sigc::connection sliderChange; + DelayedConnection<> spinChange; + DelayedConnection<> sliderChange; sigc::connection editedChange; sigc::connection autoChange; sigc::connection buttonReleaseSlider; @@ -62,7 +61,6 @@ protected: bool afterReset; bool blocked; bool addMode; - bool eventPending; double vMin; double vMax; double vStep; @@ -78,11 +76,18 @@ protected: void setSliderValue(double val); public: - - int delay; - - Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1 = nullptr, Gtk::Image *imgIcon2 = nullptr, double2double_fun slider2value = nullptr, double2double_fun value2slider = nullptr); - ~Adjuster () override; + Adjuster( + Glib::ustring vlabel, + double vmin, + double vmax, + double vstep, + double vdefault, + Gtk::Image *imgIcon1 = nullptr, + Gtk::Image *imgIcon2 = nullptr, + double2double_fun slider2value = nullptr, + double2double_fun value2slider = nullptr + ); + ~Adjuster() override; // Add an "Automatic" checkbox next to the reset button. void addAutoButton(const Glib::ustring &tooltip = ""); @@ -127,4 +132,5 @@ public: void trimValue (float &val) const; void trimValue (int &val) const; void setLogScale(double base, double pivot, bool anchorMiddle = false); + void setDelay(unsigned int min_delay_ms, unsigned int max_delay_ms = 0); }; diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 8b4583877..3b6bb73ed 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -699,7 +699,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady(rtengine::IImagefloat* img) err = img->saveAsJPEG (fname, saveFormat.jpegQuality, saveFormat.jpegSubSamp); } - img->free (); + delete img; if (err) { throw Glib::FileError(Glib::FileError::FAILED, M("MAIN_MSG_CANNOTSAVE") + "\n" + fname); diff --git a/rtgui/bayerpreprocess.cc b/rtgui/bayerpreprocess.cc index 0c01213e7..2a1896d80 100644 --- a/rtgui/bayerpreprocess.cc +++ b/rtgui/bayerpreprocess.cc @@ -37,18 +37,14 @@ BayerPreProcess::BayerPreProcess() : FoldableToolPanel(this, "bayerpreprocess", lineDenoise = Gtk::manage(new Adjuster(M("TP_PREPROCESS_LINEDENOISE"), 0, 1000, 1, 0)); lineDenoise->setAdjusterListener(this); - if (lineDenoise->delay < options.adjusterMaxDelay) { - lineDenoise->delay = options.adjusterMaxDelay; - } + lineDenoise->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); lineDenoise->show(); greenEqThreshold = Gtk::manage(new Adjuster(M("TP_PREPROCESS_GREENEQUIL"), 0, 100, 1, 0)); greenEqThreshold->setAdjusterListener(this); - if (greenEqThreshold->delay < options.adjusterMaxDelay) { - greenEqThreshold->delay = options.adjusterMaxDelay; - } + greenEqThreshold->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); greenEqThreshold->show(); diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index 66053a338..07c3a9970 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -60,9 +60,7 @@ BayerProcess::BayerProcess () : dualDemosaicContrast->setAdjusterListener(this); dualDemosaicContrast->addAutoButton(M("TP_RAW_DUALDEMOSAICAUTOCONTRAST_TOOLTIP")); dualDemosaicContrast->setAutoValue(true); - if (dualDemosaicContrast->delay < options.adjusterMaxDelay) { - dualDemosaicContrast->delay = options.adjusterMaxDelay; - } + dualDemosaicContrast->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); dualDemosaicContrast->show(); dualDemosaicOptions->pack_start(*dualDemosaicContrast); @@ -72,9 +70,7 @@ BayerProcess::BayerProcess () : border = Gtk::manage(new Adjuster(M("TP_RAW_BORDER"), 0, 16, 1, 4)); border->setAdjusterListener (this); - if (border->delay < options.adjusterMaxDelay) { - border->delay = options.adjusterMaxDelay; - } + border->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); border->show(); borderbox->pack_start(*border); @@ -96,22 +92,17 @@ BayerProcess::BayerProcess () : ccSteps = Gtk::manage (new Adjuster (M("TP_RAW_FALSECOLOR"), 0, 5, 1, 0 )); ccSteps->setAdjusterListener (this); - if (ccSteps->delay < options.adjusterMaxDelay) { - ccSteps->delay = options.adjusterMaxDelay; - } + ccSteps->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); ccSteps->show(); pack_start( *ccSteps, Gtk::PACK_SHRINK, 4); - dcbOptions = Gtk::manage (new Gtk::VBox ()); dcbIterations = Gtk::manage (new Adjuster (M("TP_RAW_DCBITERATIONS"), 0, 5, 1, 2)); dcbIterations->setAdjusterListener (this); - if (dcbIterations->delay < options.adjusterMaxDelay) { - dcbIterations->delay = options.adjusterMaxDelay; - } + dcbIterations->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); dcbIterations->show(); dcbEnhance = Gtk::manage (new CheckBox(M("TP_RAW_DCBENHANCE"), multiImage)); @@ -126,9 +117,7 @@ BayerProcess::BayerProcess () : lmmseIterations->setAdjusterListener (this); lmmseIterations->set_tooltip_markup (M("TP_RAW_LMMSE_TOOLTIP")); - if (lmmseIterations->delay < options.adjusterMaxDelay) { - lmmseIterations->delay = options.adjusterMaxDelay; - } + lmmseIterations->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); lmmseIterations->show(); lmmseOptions->pack_start(*lmmseIterations); @@ -209,9 +198,7 @@ BayerProcess::BayerProcess () : pixelShiftSigma->set_tooltip_text (M("TP_RAW_PIXELSHIFTSIGMA_TOOLTIP")); pixelShiftSigma->setAdjusterListener (this); - if (pixelShiftSigma->delay < options.adjusterMaxDelay) { - pixelShiftSigma->delay = options.adjusterMaxDelay; - } + pixelShiftSigma->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); pixelShiftSigma->show(); pixelShiftOptions->pack_start(*pixelShiftSigma); @@ -221,9 +208,7 @@ BayerProcess::BayerProcess () : pixelShiftSmooth->set_tooltip_text (M("TP_RAW_PIXELSHIFTSMOOTH_TOOLTIP")); pixelShiftSmooth->setAdjusterListener (this); - if (pixelShiftSmooth->delay < options.adjusterMaxDelay) { - pixelShiftSmooth->delay = options.adjusterMaxDelay; - } + pixelShiftSmooth->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); pixelShiftSmooth->show(); pixelShiftOptions->pack_start(*pixelShiftSmooth); @@ -232,9 +217,7 @@ BayerProcess::BayerProcess () : pixelShiftEperIso->set_tooltip_text(M("TP_RAW_PIXELSHIFTEPERISO_TOOLTIP")); pixelShiftEperIso->setAdjusterListener (this); - if (pixelShiftEperIso->delay < options.adjusterMaxDelay) { - pixelShiftEperIso->delay = options.adjusterMaxDelay; - } + pixelShiftEperIso->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); pixelShiftEperIso->show(); pixelShiftOptions->pack_start(*pixelShiftEperIso); diff --git a/rtgui/bayerrawexposure.cc b/rtgui/bayerrawexposure.cc index 9d8f9fff8..bb3c3a48a 100644 --- a/rtgui/bayerrawexposure.cc +++ b/rtgui/bayerrawexposure.cc @@ -31,33 +31,25 @@ BayerRAWExposure::BayerRAWExposure () : FoldableToolPanel(this, "bayerrawexposur PexBlack1 = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_1"), -2048, 2048, 1.0, 0)); //black level PexBlack1->setAdjusterListener (this); - if (PexBlack1->delay < options.adjusterMaxDelay) { - PexBlack1->delay = options.adjusterMaxDelay; - } + PexBlack1->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); PexBlack1->show(); PexBlack2 = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_2"), -2048, 2048, 1.0, 0)); //black level PexBlack2->setAdjusterListener (this); - if (PexBlack2->delay < options.adjusterMaxDelay) { - PexBlack2->delay = options.adjusterMaxDelay; - } + PexBlack2->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); PexBlack2->show(); PexBlack3 = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_3"), -2048, 2048, 1.0, 0)); //black level PexBlack3->setAdjusterListener (this); - if (PexBlack3->delay < options.adjusterMaxDelay) { - PexBlack3->delay = options.adjusterMaxDelay; - } + PexBlack3->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); PexBlack3->show(); PexBlack0 = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_0"), -2048, 2048, 1.0, 0)); //black level PexBlack0->setAdjusterListener (this); - if (PexBlack0->delay < options.adjusterMaxDelay) { - PexBlack0->delay = options.adjusterMaxDelay; - } + PexBlack0->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); PexBlack0->show(); PextwoGreen = Gtk::manage(new CheckBox(M("TP_RAWEXPOS_TWOGREEN"), multiImage));// two green diff --git a/rtgui/bqentryupdater.cc b/rtgui/bqentryupdater.cc index 61683e158..7115447c2 100644 --- a/rtgui/bqentryupdater.cc +++ b/rtgui/bqentryupdater.cc @@ -146,7 +146,7 @@ void BatchQueueEntryUpdater::processThread () } memcpy(current.oimg, img->getData(), prevw * prevh * 3); - img->free(); + delete img; } } diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index bdbe3de3a..934f922ae 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -244,9 +244,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" degree = Gtk::manage (new Adjuster (M ("TP_COLORAPP_CIECAT_DEGREE"), 0., 100., 1., 90.)); - if (degree->delay < options.adjusterMaxDelay) { - degree->delay = options.adjusterMaxDelay; - } + degree->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); degree->throwOnButtonRelease(); degree->addAutoButton (M ("TP_COLORAPP_CAT02ADAPTATION_TOOLTIP")); @@ -325,9 +323,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" // adapscen = Gtk::manage (new Adjuster (M ("TP_COLORAPP_ABSOLUTELUMINANCE"), 0.01, 16384., 0.001, 2000.)); // EV -7 ==> EV 17 adapscen = Gtk::manage (new Adjuster (M ("TP_COLORAPP_ABSOLUTELUMINANCE"), MINLA0, MAXLA0, 0.01, 1997.4, NULL, NULL, &wbSlider2la, &wbla2Slider)); - if (adapscen->delay < options.adjusterMaxDelay) { - adapscen->delay = options.adjusterMaxDelay; - } + adapscen->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); adapscen->throwOnButtonRelease(); adapscen->addAutoButton(); @@ -335,9 +331,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" ybscen = Gtk::manage (new Adjuster (M ("TP_COLORAPP_MEANLUMINANCE"), 1, 90, 1, 18)); - if (ybscen->delay < options.adjusterMaxDelay) { - ybscen->delay = options.adjusterMaxDelay; - } + ybscen->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); ybscen->throwOnButtonRelease(); ybscen->addAutoButton(); @@ -386,9 +380,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" jlight = Gtk::manage (new Adjuster (M ("TP_COLORAPP_LIGHT"), -100.0, 100.0, 0.1, 0.)); - if (jlight->delay < options.adjusterMaxDelay) { - jlight->delay = options.adjusterMaxDelay; - } + jlight->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); jlight->throwOnButtonRelease(); jlight->set_tooltip_markup (M ("TP_COLORAPP_LIGHT_TOOLTIP")); @@ -396,9 +388,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" qbright = Gtk::manage (new Adjuster (M ("TP_COLORAPP_BRIGHT"), -100.0, 100.0, 0.1, 0.)); - if (qbright->delay < options.adjusterMaxDelay) { - qbright->delay = options.adjusterMaxDelay; - } + qbright->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); qbright->throwOnButtonRelease(); qbright->set_tooltip_markup (M ("TP_COLORAPP_BRIGHT_TOOLTIP")); @@ -406,9 +396,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" chroma = Gtk::manage (new Adjuster (M ("TP_COLORAPP_CHROMA"), -100.0, 100.0, 0.1, 0.)); - if (chroma->delay < options.adjusterMaxDelay) { - chroma->delay = options.adjusterMaxDelay; - } + chroma->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); chroma->throwOnButtonRelease(); chroma->set_tooltip_markup (M ("TP_COLORAPP_CHROMA_TOOLTIP")); @@ -417,9 +405,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" schroma = Gtk::manage (new Adjuster (M ("TP_COLORAPP_CHROMA_S"), -100.0, 100.0, 0.1, 0.)); - if (schroma->delay < options.adjusterMaxDelay) { - schroma->delay = options.adjusterMaxDelay; - } + schroma->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); schroma->throwOnButtonRelease(); schroma->set_tooltip_markup (M ("TP_COLORAPP_CHROMA_S_TOOLTIP")); @@ -427,9 +413,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" mchroma = Gtk::manage (new Adjuster (M ("TP_COLORAPP_CHROMA_M"), -100.0, 100.0, 0.1, 0.)); - if (mchroma->delay < options.adjusterMaxDelay) { - mchroma->delay = options.adjusterMaxDelay; - } + mchroma->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); mchroma->throwOnButtonRelease(); mchroma->set_tooltip_markup (M ("TP_COLORAPP_CHROMA_M_TOOLTIP")); @@ -437,9 +421,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" rstprotection = Gtk::manage ( new Adjuster (M ("TP_COLORAPP_RSTPRO"), 0., 100., 0.1, 0.) ); - if (rstprotection->delay < options.adjusterMaxDelay) { - rstprotection->delay = options.adjusterMaxDelay; - } + rstprotection->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); rstprotection->throwOnButtonRelease(); rstprotection->set_tooltip_markup (M ("TP_COLORAPP_RSTPRO_TOOLTIP")); @@ -447,9 +429,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" contrast = Gtk::manage (new Adjuster (M ("TP_COLORAPP_CONTRAST"), -100.0, 100.0, 0.1, 0.)); - if (contrast->delay < options.adjusterMaxDelay) { - contrast->delay = options.adjusterMaxDelay; - } + contrast->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); contrast->throwOnButtonRelease(); contrast->set_tooltip_markup (M ("TP_COLORAPP_CONTRAST_TOOLTIP")); @@ -457,9 +437,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" qcontrast = Gtk::manage (new Adjuster (M ("TP_COLORAPP_CONTRAST_Q"), -100.0, 100.0, 0.1, 0.)); - if (qcontrast->delay < options.adjusterMaxDelay) { - qcontrast->delay = options.adjusterMaxDelay; - } + qcontrast->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); qcontrast->throwOnButtonRelease(); qcontrast->set_tooltip_markup (M ("TP_COLORAPP_CONTRAST_Q_TOOLTIP")); @@ -468,9 +446,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" colorh = Gtk::manage (new Adjuster (M ("TP_COLORAPP_HUE"), -100.0, 100.0, 0.1, 0.)); - if (colorh->delay < options.adjusterMaxDelay) { - colorh->delay = options.adjusterMaxDelay; - } + colorh->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); colorh->throwOnButtonRelease(); colorh->set_tooltip_markup (M ("TP_COLORAPP_HUE_TOOLTIP")); @@ -618,9 +594,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" // adaplum = Gtk::manage (new Adjuster (M ("TP_COLORAPP_ABSOLUTELUMINANCE"), 0.1, 16384., 0.1, 16.)); adaplum = Gtk::manage (new Adjuster (M ("TP_COLORAPP_ABSOLUTELUMINANCE"), MINLA0, MAXLA0, 0.01, 16, NULL, NULL, &wbSlider2la, &wbla2Slider)); - if (adaplum->delay < options.adjusterMaxDelay) { - adaplum->delay = options.adjusterMaxDelay; - } + adaplum->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); adaplum->throwOnButtonRelease(); adaplum->set_tooltip_markup (M ("TP_COLORAPP_VIEWING_ABSOLUTELUMINANCE_TOOLTIP")); @@ -631,9 +605,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" degreeout = Gtk::manage (new Adjuster (M ("TP_COLORAPP_CIECAT_DEGREE"), 0., 100., 1., 90.)); - if (degreeout->delay < options.adjusterMaxDelay) { - degreeout->delay = options.adjusterMaxDelay; - } + degreeout->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); degreeout->throwOnButtonRelease(); degreeout->addAutoButton (M ("TP_COLORAPP_CAT02ADAPTATION_TOOLTIP")); @@ -694,9 +666,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" */ badpixsl = Gtk::manage (new Adjuster (M ("TP_COLORAPP_BADPIXSL"), 0, 2, 1, 0)); - if (badpixsl->delay < options.adjusterMaxDelay) { - badpixsl->delay = options.adjusterMaxDelay; - } + badpixsl->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); badpixsl->throwOnButtonRelease(); badpixsl->set_tooltip_markup (M ("TP_COLORAPP_BADPIXSL_TOOLTIP")); diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index ddf917149..77bc31638 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -488,11 +488,11 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR pack_start(*labRegionBox, Gtk::PACK_EXPAND_WIDGET, 4); - labRegionSaturation->delay = options.adjusterMaxDelay; - labRegionSlope->delay = options.adjusterMaxDelay; - labRegionOffset->delay = options.adjusterMaxDelay; - labRegionPower->delay = options.adjusterMaxDelay; - labRegionMaskBlur->delay = options.adjusterMaxDelay; + labRegionSaturation->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); + labRegionSlope->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); + labRegionOffset->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); + labRegionPower->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); + labRegionMaskBlur->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); //------------------------------------------------------------------------ show_all(); diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 89e851e2e..0b66eb986 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -95,6 +95,7 @@ ControlSpotPanel::ControlSpotPanel(): preview_(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), ctboxshape(Gtk::manage(new Gtk::HBox())), + ctboxshapemethod(Gtk::manage(new Gtk::HBox())), controlPanelListener(nullptr), lastObject_(-1), @@ -250,7 +251,7 @@ ControlSpotPanel::ControlSpotPanel(): pack_start(*excluFrame); - Gtk::HBox* const ctboxshapemethod = Gtk::manage(new Gtk::HBox()); +// Gtk::HBox* const ctboxshapemethod = Gtk::manage(new Gtk::HBox()); Gtk::Label* const labelshapemethod = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_STYPE") + ":")); ctboxshapemethod->pack_start(*labelshapemethod, Gtk::PACK_SHRINK, 4); @@ -914,6 +915,7 @@ void ControlSpotPanel::prevMethodChanged() expMaskMerge_->hide(); circrad_->hide(); ctboxshape->hide(); + shapeMethod_->set_active(0); } else { // Excluding case expTransGrad_->show(); @@ -1730,6 +1732,25 @@ void ControlSpotPanel::setParamEditable(bool cond) savrest_->set_sensitive(cond); complexMethod_->set_sensitive(cond); wavMethod_->set_sensitive(cond); + preview_->set_sensitive(cond); + + if (!cond) { + // Reset complex parameters visibility to default state + expTransGrad_->hide(); + expShapeDetect_->hide(); + expSpecCases_->hide(); + expMaskMerge_->hide(); + circrad_->hide(); + ctboxshape->hide(); + excluFrame->hide(); +// ctboxshapemethod->hide(); + locX_->hide(); + locXL_->hide(); + locY_->hide(); + locYT_->hide(); + centerX_->hide(); + centerY_->hide(); + } } void ControlSpotPanel::setDefaultExpanderVisibility() diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index 81a79fb61..720bdf0c1 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -419,6 +419,7 @@ private: sigc::connection previewConn_; Gtk::HBox* const ctboxshape; + Gtk::HBox* const ctboxshapemethod; // Internal variables ControlPanelListener* controlPanelListener; diff --git a/rtgui/delayed.h b/rtgui/delayed.h new file mode 100644 index 000000000..b57d7300b --- /dev/null +++ b/rtgui/delayed.h @@ -0,0 +1,240 @@ +/* + * This file is part of RawTherapee. + * + * Copyright (C) 2020 Flössie + * + * RawTherapee is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * RawTherapee is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RawTherapee. If not, see . + */ + +#pragma once + +#include +#include +#include + +#include +#include + +#include "../rtengine/noncopyable.h" + +namespace delayed_helper +{ + + // C++14 + + // See https://gist.github.com/ntessore/dc17769676fb3c6daa1f + template + struct index_sequence + { + }; + + template + struct make_index_sequence : + make_index_sequence + { + }; + + template + struct make_index_sequence<0, Is...> : + index_sequence + { + }; + + // C++17 + + // See https://aherrmann.github.io/programming/2016/02/28/unpacking-tuples-in-cpp14/ + template + void apply_impl(F f, T t, index_sequence) + { + f(std::get(t)...); + } + + template + void apply(F f, T t) + { + apply_impl(f, t, make_index_sequence{}>{}); + } + +} + +template +class DelayedCall final : + public rtengine::NonCopyable +{ +public: + DelayedCall(std::function _function, unsigned int _min_delay_ms, unsigned int _max_delay_ms = 0) : + function(_function), + min_delay_ms(_min_delay_ms), + max_delay_ms(_max_delay_ms) + { + } + + DelayedCall(unsigned int _min_delay_ms, unsigned int _max_delay_ms = 0) : + DelayedCall({}, _min_delay_ms, _max_delay_ms) + { + } + + void setFunction(std::function function) + { + this->function = function; + } + + void operator ()(Ts... ts) + { + if (!function) { + return; + } + + if (!min_delay_ms) { + function(ts...); + return; + } + + params = std::make_tuple(ts...); + + min_timeout.disconnect(); + min_timeout = Glib::signal_timeout().connect(sigc::mem_fun(*this, &DelayedCall::onMinTimeout), min_delay_ms); + + if (max_delay_ms && !max_timeout.connected()) { + max_timeout = Glib::signal_timeout().connect(sigc::mem_fun(*this, &DelayedCall::onMaxTimeout), max_delay_ms); + } + } + + void cancel() + { + min_timeout.disconnect(); + max_timeout.disconnect(); + } + +private: + bool onMinTimeout() + { + max_timeout.disconnect(); + if (function) { + delayed_helper::apply(function, params); + } + return false; + } + + bool onMaxTimeout() + { + min_timeout.disconnect(); + if (function) { + delayed_helper::apply(function, params); + } + return false; + } + + std::function function; + + unsigned int min_delay_ms; + unsigned int max_delay_ms; + + sigc::connection min_timeout; + sigc::connection max_timeout; + + std::tuple params; +}; + +template +class DelayedConnection final : + public rtengine::NonCopyable +{ +public: + DelayedConnection(unsigned int _min_delay_ms, unsigned int _max_delay_ms = 0) : + min_delay_ms(_min_delay_ms), + max_delay_ms(_max_delay_ms) + { + } + + void connect(Glib::SignalProxy signal, const sigc::slot& slot, const sigc::slot& immediate_slot = {}) + { + this->slot = slot; + this->immediate_slot = immediate_slot; + this->signal = signal.connect(sigc::mem_fun(*this, &DelayedConnection::onSignal)); + } + + void block(bool value = true) + { + signal.block(value); + } + + void unblock() + { + signal.unblock(); + } + + void cancel() + { + min_timeout.disconnect(); + max_timeout.disconnect(); + } + + void setDelay(unsigned int min_delay_ms, unsigned int max_delay_ms = 0) + { + this->min_delay_ms = min_delay_ms; + this->max_delay_ms = max_delay_ms; + + min_timeout.disconnect(); + max_timeout.disconnect(); + } + +private: + void onSignal(Ts... ts) + { + if (immediate_slot) { + immediate_slot(ts...); + } + + if (!min_delay_ms) { + slot(ts...); + return; + } + + params = std::make_tuple(ts...); + + min_timeout.disconnect(); + min_timeout = Glib::signal_timeout().connect(sigc::mem_fun(*this, &DelayedConnection::onMinTimeout), min_delay_ms); + + if (max_delay_ms && !max_timeout.connected()) { + max_timeout = Glib::signal_timeout().connect(sigc::mem_fun(*this, &DelayedConnection::onMaxTimeout), max_delay_ms); + } + } + + bool onMinTimeout() + { + max_timeout.disconnect(); + delayed_helper::apply(slot, params); + return false; + } + + bool onMaxTimeout() + { + min_timeout.disconnect(); + delayed_helper::apply(slot, params); + return false; + } + + unsigned int min_delay_ms; + unsigned int max_delay_ms; + + sigc::connection signal; + sigc::connection min_timeout; + sigc::connection max_timeout; + + sigc::slot slot; + sigc::slot immediate_slot; + + std::tuple params; +}; diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 594965ee6..d3d339783 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1797,7 +1797,7 @@ bool EditorPanel::idle_saveImage (ProgressConnector *pc, bool EditorPanel::idle_imageSaved (ProgressConnector *pc, rtengine::IImagefloat* img, Glib::ustring fname, SaveFormat sf, rtengine::procparams::ProcParams &pparams) { - img->free (); + delete img; if (! pc->returnValue() ) { openThm->imageDeveloped (); @@ -1997,7 +1997,7 @@ bool EditorPanel::saveImmediately (const Glib::ustring &filename, const SaveForm err = 1; } - img->free(); + delete img; return !err; } @@ -2059,7 +2059,7 @@ bool EditorPanel::idle_sendToGimp ( ProgressConnector *p } if (tries == 1000) { - img->free (); + delete img; return false; } @@ -2080,7 +2080,7 @@ bool EditorPanel::idle_sendToGimp ( ProgressConnector *p bool EditorPanel::idle_sentToGimp (ProgressConnector *pc, rtengine::IImagefloat* img, Glib::ustring filename) { - img->free (); + delete img; int errore = pc->returnValue(); setProgressState(false); delete pc; diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 3129e93e2..cbe31726d 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -230,7 +230,7 @@ void FileBrowserEntry::updateImage(rtengine::IImage8* img, double scale, const r --feih->pending; } - img->free(); + delete img; return false; } @@ -276,7 +276,7 @@ void FileBrowserEntry::_updateImage(rtengine::IImage8* img, double s, const rten landscape = newLandscape; - img->free(); + delete img; if (parent) { if (rotated) { diff --git a/rtgui/filmnegative.cc b/rtgui/filmnegative.cc index 1b105a3ec..d70c2a067 100644 --- a/rtgui/filmnegative.cc +++ b/rtgui/filmnegative.cc @@ -36,9 +36,7 @@ Adjuster* createExponentAdjuster(AdjusterListener* listener, const Glib::ustring adj->setAdjusterListener(listener); adj->setLogScale(6, 1, true); - if (adj->delay < options.adjusterMaxDelay) { - adj->delay = options.adjusterMaxDelay; - } + adj->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); adj->show(); return adj; diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 7433fd4de..69d14c463 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -47,9 +47,7 @@ FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_L flatFieldBlurRadius = Gtk::manage(new Adjuster (M("TP_FLATFIELD_BLURRADIUS"), 0, 200, 2, 32)); flatFieldBlurRadius->setAdjusterListener (this); - if (flatFieldBlurRadius->delay < options.adjusterMaxDelay) { - flatFieldBlurRadius->delay = options.adjusterMaxDelay; - } + flatFieldBlurRadius->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); flatFieldBlurRadius->show(); @@ -67,9 +65,7 @@ FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_L flatFieldClipControl->setAdjusterListener(this); flatFieldClipControl->addAutoButton(""); - if (flatFieldClipControl->delay < options.adjusterMaxDelay) { - flatFieldClipControl->delay = options.adjusterMaxDelay; - } + flatFieldClipControl->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); flatFieldClipControl->show(); flatFieldClipControl->set_tooltip_markup (M("TP_FLATFIELD_CLIPCONTROL_TOOLTIP")); diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 236f5af02..e589ed9ba 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -33,7 +33,36 @@ using namespace rtengine; // // // HistogramPanel -HistogramPanel::HistogramPanel () : panel_listener(nullptr) +HistogramPanel::HistogramPanel () : + pointer_moved_delayed_call( + [this](bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int r, int g, int b) + { + bool update_hist_area; + + if (!validPos) { + // do something to un-show vertical bars + if (histogramRGBArea) { + histogramRGBArea->updateBackBuffer(-1, -1, -1); + } + update_hist_area = histogramArea->updatePointer(-1, -1, -1); + } else { + // do something to show vertical bars + if (histogramRGBArea) { + histogramRGBArea->updateBackBuffer(r, g, b, profile, profileW); + } + update_hist_area = histogramArea->updatePointer(r, g, b, profile, profileW); + } + if (histogramRGBArea) { + histogramRGBArea->queue_draw(); + } + if (update_hist_area) { + histogramArea->queue_draw(); + } + }, + 50, + 100 + ), + panel_listener(nullptr) { setExpandAlignProperties(this, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); set_name("HistogramPanel"); @@ -233,6 +262,8 @@ HistogramPanel::HistogramPanel () : panel_listener(nullptr) HistogramPanel::~HistogramPanel () { + pointer_moved_delayed_call.cancel(); + delete redImage; delete greenImage; delete blueImage; @@ -463,27 +494,7 @@ void HistogramPanel::setHistRGBInvalid () void HistogramPanel::pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw) { - bool update_hist_area; - - if (!validPos) { - // do something to un-show vertical bars - if (histogramRGBArea) { - histogramRGBArea->updateBackBuffer(-1, -1, -1); - } - update_hist_area = histogramArea->updatePointer(-1, -1, -1); - } else { - // do something to show vertical bars - if (histogramRGBArea) { - histogramRGBArea->updateBackBuffer(r, g, b, profile, profileW); - } - update_hist_area = histogramArea->updatePointer(r, g, b, profile, profileW); - } - if (histogramRGBArea) { - histogramRGBArea->queue_draw(); - } - if (update_hist_area) { - histogramArea->queue_draw(); - } + pointer_moved_delayed_call(validPos, profile, profileW, r, g, b); } /* @@ -572,7 +583,6 @@ HistogramRGBArea::HistogramRGBArea () : needLuma(options.histogramLuma), needChroma(options.histogramChroma), rawMode(options.histogramRAW), showMode(options.histogramBar), barDisplayed(options.histogramBar), parent(nullptr) { - get_style_context()->add_class("drawingarea"); set_name("HistogramRGBArea"); diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index bda65df0c..b2a656161 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -24,6 +24,7 @@ #include +#include "delayed.h" #include "guiutils.h" #include "pointermotionlistener.h" @@ -243,6 +244,8 @@ public: class HistogramPanel final : public Gtk::Grid, public PointerMotionListener, public DrawModeListener, public rtengine::NonCopyable { +private: + DelayedCall pointer_moved_delayed_call; protected: diff --git a/rtgui/iccprofilecreator.cc b/rtgui/iccprofilecreator.cc index c9639f70b..3f1ed4089 100644 --- a/rtgui/iccprofilecreator.cc +++ b/rtgui/iccprofilecreator.cc @@ -151,9 +151,7 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow) aGamma = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_GAMMA"), 1, 3.5, 0.00001, 2.4)); setExpandAlignProperties(aGamma, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); - if (aGamma->delay < options.adjusterMaxDelay) { - aGamma->delay = options.adjusterMaxDelay; - } + aGamma->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); aGamma->show(); mainGrid->attach(*aGamma, 1, 3, 1, 1); //gamma @@ -161,9 +159,7 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow) aSlope = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_SLOPE"), 0, 15, 0.00001, 12.92310)); setExpandAlignProperties(aSlope, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); - if (aSlope->delay < options.adjusterMaxDelay) { - aSlope->delay = options.adjusterMaxDelay; - } + aSlope->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); aSlope->show(); mainGrid->attach(*aSlope, 1, 4, 1, 1); //slope @@ -328,7 +324,7 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow) close->signal_clicked().connect(sigc::mem_fun(*this, &ICCProfileCreator::closePressed)); get_action_area()->pack_start(*close); - //--------------- Show childrens + //--------------- Show children show_all_children(); diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 3e3c0508c..920924c6c 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -214,13 +214,9 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha wGamma->setAdjusterListener(this); wSlope->setAdjusterListener(this); - if (wGamma->delay < options.adjusterMaxDelay) { - wGamma->delay = options.adjusterMaxDelay; - } + wGamma->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); - if (wSlope->delay < options.adjusterMaxDelay) { - wSlope->delay = options.adjusterMaxDelay; - } + wSlope->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); wFrame->add(*wProfVBox); diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index 0c35b5bba..42574d15c 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - * 2019 Pierre Cabrera + * 2019-2020 Pierre Cabrera */ #include "locallabtools.h" @@ -149,7 +149,8 @@ LocallabTool::LocallabTool(Gtk::Box* content, Glib::ustring toolName, Glib::ustr if (needMode) { complexity->append(M("TP_LOCALLAB_MODE_EXPERT")); complexity->append(M("TP_LOCALLAB_MODE_NORMAL")); - complexity->set_active(0); + complexity->append(M("TP_LOCALLAB_MODE_SIMPLE")); + complexity->set_active(2); complexity->setPreferredWidth(100, -1); complexityConn = complexity->signal_changed().connect(sigc::mem_fun(*this, &LocallabTool::complexityModeChanged)); titleBox->pack_end(*complexity, Gtk::PACK_SHRINK, 2); @@ -201,9 +202,15 @@ void LocallabTool::addLocallabTool(bool raiseEvent) if (complexity->get_active_row_number() == Normal) { convertParamToNormal(); updateGUIToMode(Normal); - } else { + } else if (complexity->get_active_row_number() == Expert) { updateGUIToMode(Expert); + } else if (complexity->get_active_row_number() == Simple) { + convertParamToNormal(); + updateGUIToMode(Normal); + convertParamToSimple(); + updateGUIToMode(Simple); } + } if (listener) { @@ -253,7 +260,7 @@ void LocallabTool::refChanged(const double huer, const double lumar, const doubl // Hue reference normalization (between 0 and 1) double normHuer = huer; float h = Color::huelab_to_huehsv2(normHuer); - // h += 1.f / 6.f; + // h += 1.f / 6.f; if (h > 1.f) { h -= 1.f; @@ -359,25 +366,42 @@ void LocallabTool::foldThemAll(GdkEventButton* event) void LocallabTool::complexityModeChanged() { - if (complexity->get_active_row_number() == Normal) { // New selected mode is Normal one + if (complexity->get_active_row_number() == Simple) { // New selected mode is Simple one + const bool maskPreviewActivated = isMaskViewActive(); + + // Convert tool widget parameters + convertParamToNormal(); // From Expert mode to Normal mode + convertParamToSimple(); // From Normal mode to Simple mode + // Update GUI based on new mode + updateGUIToMode(Simple); + + if (maskPreviewActivated) { + // This event is called to transmit reset mask state + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } + } + + if (listener && isLocActivated) { + listener->panelChanged(EvlocallabcomplexityWithRefresh, + M("TP_LOCALLAB_MODE_SIMPLE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } else if (complexity->get_active_row_number() == Normal) { // New selected mode is Normal one // Convert tool widget parameters convertParamToNormal(); - // Update GUI based on new mode updateGUIToMode(Normal); - // Raise event with refreshing - if (listener) { + if (listener && isLocActivated) { listener->panelChanged(EvlocallabcomplexityWithRefresh, M("TP_LOCALLAB_MODE_NORMAL") + " (" + escapeHtmlChars(spotName) + ")"); } - } else { // New selected mode is Expert one + } else if (complexity->get_active_row_number() == Expert) { // New selected mode is Expert one // Update GUI based on new mode updateGUIToMode(Expert); - // Raise event without refreshing - if (listener) { - listener->panelChanged(EvlocallabcomplexityWithoutRefresh, + if (listener && isLocActivated) { + listener->panelChanged(EvlocallabcomplexityWithRefresh, M("TP_LOCALLAB_MODE_EXPERT") + " (" + escapeHtmlChars(spotName) + ")"); } } @@ -389,10 +413,10 @@ LocallabColor::LocallabColor(): // Color & Light specific widgets lumFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LUMFRA")))), - curvactiv(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_CURV")))), lightness(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LIGHTNESS"), -100, 500, 1, 0))), contrast(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTRAST"), -100, 100, 1, 0))), chroma(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMA"), -100, 150, 1, 0))), + curvactiv(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_CURV")))), gridFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LABGRID")))), labgrid(Gtk::manage(new LabGrid(EvLocallabLabGridValue, M("TP_LOCALLAB_LABGRID_VALUES")))), gridMethod(Gtk::manage(new MyComboBoxText())), @@ -418,10 +442,10 @@ LocallabColor::LocallabColor(): lcshape(static_cast(clCurveEditorG->addCurve(CT_Diagonal, "L(C)"))), HCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_HLH"))), LHshape(static_cast(HCurveEditorG->addCurve(CT_Flat, "L(H)", nullptr, false, true))), - H2CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_HLH"))), - HHshape(static_cast(H2CurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true))), H3CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_HLH"))), CHshape(static_cast(H3CurveEditorG->addCurve(CT_Flat, "C(H)", nullptr, false, true))), + H2CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_HLH"))), + HHshape(static_cast(H2CurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true))), rgbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_RGB"))), toneMethod(Gtk::manage(new MyComboBoxText())), rgbshape(static_cast(rgbCurveEditorG->addCurve(CT_Diagonal, "", toneMethod))), @@ -479,7 +503,6 @@ LocallabColor::LocallabColor(): const LocallabParams::LocallabSpot defSpot; // Parameter Color & Light specific widgets - curvactivConn = curvactiv->signal_toggled().connect(sigc::mem_fun(*this, &LocallabColor::curvactivChanged)); lumFrame->set_label_align(0.025, 0.5); lightness->setAdjusterListener(this); @@ -488,6 +511,8 @@ LocallabColor::LocallabColor(): chroma->setAdjusterListener(this); + curvactivConn = curvactiv->signal_toggled().connect(sigc::mem_fun(*this, &LocallabColor::curvactivChanged)); + gridFrame->set_label_align(0.025, 0.5); gridMethod->append(M("TP_LOCALLAB_GRIDONE")); @@ -566,16 +591,6 @@ LocallabColor::LocallabColor(): HCurveEditorG->curveListComplete(); - H2CurveEditorG->setCurveListener(this); - - HHshape->setIdentityValue(0.); - HHshape->setResetCurve(FlatCurveType(defSpot.HHcurve.at(0)), defSpot.HHcurve); - HHshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); - HHshape->setCurveColorProvider(this, 3); - HHshape->setBottomBarBgGradient(six_shape); - - H2CurveEditorG->curveListComplete(); - H3CurveEditorG->setCurveListener(this); CHshape->setIdentityValue(0.); @@ -586,6 +601,16 @@ LocallabColor::LocallabColor(): H3CurveEditorG->curveListComplete(); + H2CurveEditorG->setCurveListener(this); + + HHshape->setIdentityValue(0.); + HHshape->setResetCurve(FlatCurveType(defSpot.HHcurve.at(0)), defSpot.HHcurve); + HHshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); + HHshape->setCurveColorProvider(this, 3); + HHshape->setBottomBarBgGradient(six_shape); + + H2CurveEditorG->curveListComplete(); + rgbCurveEditorG->setCurveListener(this); toneMethod->append(M("TP_EXPOSURE_TCMODE_STANDARD")); @@ -607,7 +632,7 @@ LocallabColor::LocallabColor(): setExpandAlignProperties(expmaskcol1, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); merMethod->append(M("TP_LOCALLAB_MRONE")); -// merMethod->append(M("TP_LOCALLAB_MRTWO")); + // merMethod->append(M("TP_LOCALLAB_MRTWO")); merMethod->append(M("TP_LOCALLAB_MRTHR")); merMethod->append(M("TP_LOCALLAB_MRFOU")); merMethod->append(M("TP_LOCALLAB_MRFIV")); @@ -699,7 +724,6 @@ LocallabColor::LocallabColor(): blendmaskcol->setAdjusterListener(this); - // radmaskcol->setLogScale(10, -10); radmaskcol->setAdjusterListener(this); lapmaskcol->setAdjusterListener(this); @@ -716,7 +740,6 @@ LocallabColor::LocallabColor(): HHhmaskshape->setIdentityValue(0.); HHhmaskshape->setResetCurve(FlatCurveType(defSpot.HHhmaskcurve.at(0)), defSpot.HHhmaskcurve); -// HHhmaskshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); HHhmaskshape->setCurveColorProvider(this, 2); HHhmaskshape->setBottomBarColorProvider(this, 2); @@ -741,17 +764,16 @@ LocallabColor::LocallabColor(): csThresholdcol->setAdjusterListener(this); // Add Color & Light specific widgets to GUI - Gtk::Frame* const superFrame = Gtk::manage(new Gtk::Frame()); - superFrame->set_label_align(0.025, 0.5); - // superFrame->set_label_widget(*curvactiv); ToolParamBlock* const lumBox = Gtk::manage(new ToolParamBlock()); lumBox->pack_start(*lightness); lumBox->pack_start(*contrast); lumBox->pack_start(*chroma); lumFrame->add(*lumBox); pack_start(*lumFrame); + Gtk::Frame* const superFrame = Gtk::manage(new Gtk::Frame()); + superFrame->set_label_align(0.025, 0.5); + // superFrame->set_label_widget(*curvactiv); ToolParamBlock* const superBox = Gtk::manage(new ToolParamBlock()); - ToolParamBlock* const gridBox = Gtk::manage(new ToolParamBlock()); gridBox->pack_start(*labgrid); gridBox->pack_start(*gridMethod); @@ -760,7 +782,7 @@ LocallabColor::LocallabColor(): superBox->pack_start(*gridFrame); superFrame->add(*superBox); pack_start(*superFrame); -// pack_start(*sensi); + // pack_start(*sensi); pack_start(*structcol); pack_start(*blurcolde); pack_start(*softradiuscol); @@ -852,8 +874,8 @@ LocallabColor::~LocallabColor() delete llCurveEditorG; delete clCurveEditorG; delete HCurveEditorG; - delete H2CurveEditorG; delete H3CurveEditorG; + delete H2CurveEditorG; delete rgbCurveEditorG; delete maskCurveEditorG; delete maskHCurveEditorG; @@ -897,13 +919,13 @@ void LocallabColor::updateAdviceTooltips(const bool showTooltips) if (showTooltips) { lumFrame->set_tooltip_text(M("TP_LOCALLAB_EXPCOLOR_TOOLTIP")); lightness->set_tooltip_text(M("TP_LOCALLAB_LIGHTN_TOOLTIP")); - contrast->set_tooltip_text(M(" ")); - chroma->set_tooltip_text(M(" ")); - structcol->set_tooltip_text(M("TP_LOCALLAB_STRUCT_TOOLTIP")); sensi->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); + structcol->set_tooltip_text(M("TP_LOCALLAB_STRUCT_TOOLTIP")); strcol->set_tooltip_text(M("TP_LOCALLAB_GRADGEN_TOOLTIP")); angcol->set_tooltip_text(M("TP_LOCALLAB_GRADANG_TOOLTIP")); qualitycurveMethod->set_tooltip_markup(M("TP_LOCALLAB_CURVEMETHOD_TOOLTIP")); + special->set_tooltip_text(M("TP_LOCALLAB_SPECIAL_TOOLTIP")); + expmaskcol1->set_tooltip_text(M("TP_LOCALLAB_EXPMERGEFILE_TOOLTIP")); mercol->set_tooltip_text(M("TP_LOCALLAB_MERGEMER_TOOLTIP")); opacol->set_tooltip_text(M("TP_LOCALLAB_MERGEOPA_TOOLTIP")); conthrcol->set_tooltip_text(M("TP_LOCALLAB_MERGEOPA_TOOLTIP")); @@ -912,20 +934,44 @@ void LocallabColor::updateAdviceTooltips(const bool showTooltips) CCmaskshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmaskshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmaskshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); - radmaskcol->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); - lapmaskcol->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); - Lmaskshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); - LLmaskcolshapewav->setTooltip(M("TP_LOCALLAB_LMASK_LEVEL_TOOLTIP")); - expmaskcol1->set_tooltip_text(M("TP_LOCALLAB_EXPMERGEFILE_TOOLTIP")); - blendmaskcol->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); struFrame->set_tooltip_text(M("TP_LOCALLAB_STRUMASK_TOOLTIP")); blurFrame->set_tooltip_text(M("TP_LOCALLAB_BLURMASK_TOOLTIP")); + blendmaskcol->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); + radmaskcol->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); + lapmaskcol->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); maskHCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_HHMASK_TOOLTIP")); - mask2CurveEditorGwav->set_tooltip_text(M("TP_LOCALLAB_WAVMASK_TOOLTIP")); mask2CurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); - special->set_tooltip_text(M("TP_LOCALLAB_SPECIAL_TOOLTIP")); + Lmaskshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); + mask2CurveEditorGwav->set_tooltip_text(M("TP_LOCALLAB_WAVMASK_TOOLTIP")); + LLmaskcolshapewav->setTooltip(M("TP_LOCALLAB_LMASK_LEVEL_TOOLTIP")); } else { - exp->set_tooltip_text(""); + lumFrame->set_tooltip_text(""); + lightness->set_tooltip_text(""); + sensi->set_tooltip_text(""); + structcol->set_tooltip_text(""); + strcol->set_tooltip_text(""); + angcol->set_tooltip_text(""); + qualitycurveMethod->set_tooltip_text(""); + special->set_tooltip_text(""); + expmaskcol1->set_tooltip_text(""); + mercol->set_tooltip_text(""); + opacol->set_tooltip_text(""); + conthrcol->set_tooltip_text(""); + gridmerFrame->set_tooltip_text(""); + expmaskcol->set_tooltip_text(""); + CCmaskshape->setTooltip(""); + LLmaskshape->setTooltip(""); + HHmaskshape->setTooltip(""); + struFrame->set_tooltip_text(""); + blurFrame->set_tooltip_text(""); + blendmaskcol->set_tooltip_text(""); + radmaskcol->set_tooltip_text(""); + lapmaskcol->set_tooltip_text(""); + maskHCurveEditorG->set_tooltip_text(""); + mask2CurveEditorG->set_tooltip_text(""); + Lmaskshape->setTooltip(""); + mask2CurveEditorGwav->set_tooltip_text(""); + LLmaskcolshapewav->setTooltip(""); } } @@ -992,10 +1038,10 @@ void LocallabColor::read(const rtengine::procparams::ProcParams* pp, const Param exp->setEnabled(spot.expcolor); complexity->set_active(spot.complexcolor); - curvactiv->set_active(spot.curvactiv); lightness->setValue(spot.lightness); contrast->setValue(spot.contrast); chroma->setValue(spot.chroma); + curvactiv->set_active(spot.curvactiv); labgrid->setParams(spot.labgridALow / LocallabParams::LABGRIDL_CORR_MAX, spot.labgridBLow / LocallabParams::LABGRIDL_CORR_MAX, spot.labgridAHigh / LocallabParams::LABGRIDL_CORR_MAX, @@ -1048,8 +1094,8 @@ void LocallabColor::read(const rtengine::procparams::ProcParams* pp, const Param if (spot.merMethod == "mone") { merMethod->set_active(0); -// } else if (spot.merMethod == "mtwo") { -// merMethod->set_active(1); + // } else if (spot.merMethod == "mtwo") { + // merMethod->set_active(1); } else if (spot.merMethod == "mthr") { merMethod->set_active(1); } else if (spot.merMethod == "mfou") { @@ -1161,10 +1207,10 @@ void LocallabColor::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pe spot.visicolor = exp->get_visible(); spot.complexcolor = complexity->get_active_row_number(); - spot.curvactiv = curvactiv->get_active(); spot.lightness = lightness->getIntValue(); spot.contrast = contrast->getIntValue(); spot.chroma = chroma->getIntValue(); + spot.curvactiv = curvactiv->get_active(); labgrid->getParams(spot.labgridALow, spot.labgridBLow, spot.labgridAHigh, @@ -1220,8 +1266,8 @@ void LocallabColor::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pe if (merMethod->get_active_row_number() == 0) { spot.merMethod = "mone"; -// } else if (merMethod->get_active_row_number() == 1) { -// spot.merMethod = "mtwo"; + // } else if (merMethod->get_active_row_number() == 1) { + // spot.merMethod = "mtwo"; } else if (merMethod->get_active_row_number() == 1) { spot.merMethod = "mthr"; } else if (merMethod->get_active_row_number() == 2) { @@ -1686,14 +1732,13 @@ void LocallabColor::convertParamToNormal() // Set hidden GUI widgets in Normal mode to default spot values blurcolde->setValue((double)defSpot.blurcolde); structcol->setValue((double)defSpot.structcol); - // softradiuscol->setValue(defSpot.softradiuscol); strcolab->setValue(defSpot.strcolab); strcolh->setValue(defSpot.strcolh); clshape->setCurve(defSpot.clcurve); lcshape->setCurve(defSpot.lccurve); LHshape->setCurve(defSpot.LHcurve); - HHshape->setCurve(defSpot.HHcurve); CHshape->setCurve(defSpot.CHcurve); + HHshape->setCurve(defSpot.HHcurve); if (defSpot.toneMethod == "one") { toneMethod->set_active(0); @@ -1710,8 +1755,8 @@ void LocallabColor::convertParamToNormal() if (defSpot.merMethod == "mone") { merMethod->set_active(0); -// } else if (defSpot.merMethod == "mtwo") { -// merMethod->set_active(1); + // } else if (defSpot.merMethod == "mtwo") { + // merMethod->set_active(1); } else if (defSpot.merMethod == "mthr") { merMethod->set_active(1); } else if (defSpot.merMethod == "mfou") { @@ -1795,66 +1840,128 @@ void LocallabColor::convertParamToNormal() updateColorGUI3(); } +void LocallabColor::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + softradiuscol->setValue(defSpot.softradiuscol); + strcol->setValue(defSpot.strcol); + angcol->setValue(defSpot.angcol); + + if (defSpot.qualitycurveMethod == "none") { + qualitycurveMethod->set_active(0); + } else if (defSpot.qualitycurveMethod == "std") { + qualitycurveMethod->set_active(1); + } + + llshape->setCurve(defSpot.llcurve); + ccshape->setCurve(defSpot.cccurve); + showmaskcolMethod->set_active(0); + showmaskcolMethodinv->set_active(0); + enaColorMask->set_active(defSpot.enaColorMask); + CCmaskshape->setCurve(defSpot.CCmaskcurve); + LLmaskshape->setCurve(defSpot.LLmaskcurve); + HHmaskshape->setCurve(defSpot.HHmaskcurve); + blendmaskcol->setValue((double)defSpot.blendmaskcol); + radmaskcol->setValue(defSpot.radmaskcol); + chromaskcol->setValue(defSpot.chromaskcol); + Lmaskshape->setCurve(defSpot.Lmaskcurve); + + // Enable all listeners + enableListener(); +} + void LocallabColor::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - blurcolde->hide(); - softradiuscol->show(); - strcolab->hide(); - strcolh->hide(); - clCurveEditorG->hide(); - HCurveEditorG->hide(); - H2CurveEditorG->hide(); - H3CurveEditorG->hide(); - rgbCurveEditorG->hide(); - special->hide(); - expmaskcol1->hide(); - struFrame->hide(); - blurFrame->hide(); - lapmaskcol->hide(); - gammaskcol->hide(); - slomaskcol->hide(); - shadmaskcol->hide(); - maskHCurveEditorG->hide(); - mask2CurveEditorGwav->hide(); - csThresholdcol->hide(); - structcol->hide(); - } else { - // Advanced widgets are shown in Expert mode - blurcolde->show(); - structcol->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + structcol->hide(); + blurcolde->hide(); + softradiuscol->hide(); + expgradcol->hide(); + expcurvcol->hide(); + expmaskcol1->hide(); + expmaskcol->hide(); - if (!invers->get_active()) { // Keep widget hidden when invers is toggled + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + structcol->hide(); + blurcolde->hide(); + strcolab->hide(); + strcolh->hide(); + clCurveEditorG->hide(); + HCurveEditorG->hide(); + H3CurveEditorG->hide(); + H2CurveEditorG->hide(); + rgbCurveEditorG->hide(); + special->hide(); + expmaskcol1->hide(); + struFrame->hide(); + blurFrame->hide(); + lapmaskcol->hide(); + gammaskcol->hide(); + slomaskcol->hide(); + shadmaskcol->hide(); + maskHCurveEditorG->hide(); + mask2CurveEditorGwav->hide(); + csThresholdcol->hide(); + // Specific Simple mode widgets are shown in Normal mode softradiuscol->show(); - } - strcolab->show(); - strcolh->show(); + if (!invers->get_active()) { // Keep widget hidden when invers is toggled + expgradcol->show(); + } - if (!invers->get_active()) { // Keep widgets hidden when invers is toggled - clCurveEditorG->show(); - HCurveEditorG->show(); - H3CurveEditorG->show(); - } + expcurvcol->show(); + expmaskcol->show(); - H2CurveEditorG->show(); - rgbCurveEditorG->show(); - special->show(); + break; - if (!invers->get_active()) { // Keep widget hidden when invers is toggled - expmaskcol1->show(); - } + case Expert: + // Show widgets hidden in Normal and Simple mode + structcol->show(); + blurcolde->show(); - struFrame->show(); - blurFrame->show(); - lapmaskcol->show(); - gammaskcol->show(); - slomaskcol->show(); - shadmaskcol->show(); - maskHCurveEditorG->show(); - mask2CurveEditorGwav->show(); - csThresholdcol->show(); + if (!invers->get_active()) { // Keep widget hidden when invers is toggled + softradiuscol->show(); + expgradcol->show(); + } + + strcolab->show(); + strcolh->show(); + expcurvcol->show(); + + if (!invers->get_active()) { // Keep widgets hidden when invers is toggled + clCurveEditorG->show(); + HCurveEditorG->show(); + H3CurveEditorG->show(); + } + + H2CurveEditorG->show(); + rgbCurveEditorG->show(); + special->show(); + + if (!invers->get_active()) { // Keep widget hidden when invers is toggled + expmaskcol1->show(); + } + + expmaskcol->show(); + struFrame->show(); + blurFrame->show(); + lapmaskcol->show(); + gammaskcol->show(); + slomaskcol->show(); + shadmaskcol->show(); + maskHCurveEditorG->show(); + mask2CurveEditorGwav->show(); + csThresholdcol->show(); } } @@ -1864,13 +1971,12 @@ void LocallabColor::updateMaskBackground(const double normChromar, const double [this, normHuer, normLumar, normChromar]() -> bool { GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected - // Update mask background and H curves + // Update mask background CCmaskshape->updateLocallabBackground(normChromar); LLmaskshape->updateLocallabBackground(normLumar); HHmaskshape->updateLocallabBackground(normHuer); HHhmaskshape->updateLocallabBackground(normHuer); Lmaskshape->updateLocallabBackground(normLumar); - //H curves HHshape->updateLocallabBackground(normHuer); CHshape->updateLocallabBackground(normHuer); LHshape->updateLocallabBackground(normHuer); @@ -1878,7 +1984,7 @@ void LocallabColor::updateMaskBackground(const double normChromar, const double ccshape->updateLocallabBackground(normChromar); clshape->updateLocallabBackground(normLumar); lcshape->updateLocallabBackground(normChromar); - + return false; } ); @@ -1911,11 +2017,16 @@ void LocallabColor::gridMethodChanged() void LocallabColor::inversChanged() { - updateColorGUI1(); // Update GUI according to invers button state + const bool maskPreviewActivated = isMaskViewActive(); - // This event is called to transmit potentially reset mask state - if (listener) { - listener->panelChanged(EvlocallabshowmaskMethod, ""); + // Update GUI according to invers button state + updateColorGUI1(); + + if (maskPreviewActivated) { + // This event is called to transmit reset mask state + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } } if (isLocActivated && exp->getEnabled()) { @@ -2094,18 +2205,20 @@ void LocallabColor::updateColorGUI1() blurcol->hide(); } else { gridFrame->show(); - structcol->show(); - if (mode == Normal) { // Keep widget hidden in Normal mode - softradiuscol->show(); - structcol->hide(); + if (mode == Expert) { // Keep widget hidden in Normal and Simple mode + structcol->show(); + } + + if (mode == Expert || mode == Normal) { // Keep widget hidden in Simple mode + softradiuscol->show(); + expgradcol->show(); } - expgradcol->show(); labqualcurv->show(); qualitycurveMethod->show(); - if (mode == Normal) { // Keep widgets hidden in Normal mode + if (mode == Expert) { // Keep widgets hidden in Normal and Simple mode clCurveEditorG->show(); HCurveEditorG->show(); H3CurveEditorG->show(); @@ -2136,17 +2249,18 @@ void LocallabColor::updateColorGUI2() conthrcol->hide(); gridmerFrame->hide(); break; -/* - case 1: - invers->set_sensitive(false); - H2CurveEditorG->set_sensitive(true); - rgbCurveEditorG->set_sensitive(true); - special->set_sensitive(true); - mask7->hide(); - conthrcol->hide(); - gridmerFrame->hide(); - break; -*/ + + /* + case 1: + invers->set_sensitive(false); + H2CurveEditorG->set_sensitive(true); + rgbCurveEditorG->set_sensitive(true); + special->set_sensitive(true); + mask7->hide(); + conthrcol->hide(); + gridmerFrame->hide(); + break; + */ case 1: invers->set_sensitive(false); H2CurveEditorG->set_sensitive(true); @@ -2212,7 +2326,7 @@ LocallabExposure::LocallabExposure(): structexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), blurexpde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), exptoolexp(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_EXPTOOL")))), - expcomp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_EXPCOMP"), MINEXP, MAXEXP, 0.01, 0.))), + expcomp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_EXPCOMP"), MINEXP, MAXEXP, 0.01, 0.))), black(Gtk::manage(new Adjuster(M("TP_EXPOSURE_BLACKLEVEL"), -16384, 32768, 10, 0))), hlcompr(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 20))), hlcomprthresh(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 0))), @@ -2289,8 +2403,6 @@ LocallabExposure::LocallabExposure(): setExpandAlignProperties(exptoolexp, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - // expcomp->setLogScale(10, 0); - expcomp->setAdjusterListener(this); black->setAdjusterListener(this); @@ -2367,7 +2479,6 @@ LocallabExposure::LocallabExposure(): blendmaskexp->setAdjusterListener(this); - //radmaskexp->setLogScale(10, -10); radmaskexp->setAdjusterListener(this); lapmaskexp->setAdjusterListener(this); @@ -2419,7 +2530,6 @@ LocallabExposure::LocallabExposure(): pack_start(*structexp); pack_start(*blurexpde); ToolParamBlock* const toolBox = Gtk::manage(new ToolParamBlock()); -// toolBox->pack_start(*expcomp); toolBox->pack_start(*black); toolBox->pack_start(*hlcompr); toolBox->pack_start(*hlcomprthresh); @@ -2492,32 +2602,56 @@ void LocallabExposure::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { exp->set_tooltip_text(M("TP_LOCALLAB_EXPOSURE_TOOLTIP")); - expcomp->set_tooltip_text(M("TP_LOCALLAB_EXPCOMP_TOOLTIP")); expMethod->set_tooltip_text(M("TP_LOCALLAB_EXPMETHOD_TOOLTIP")); - structexp->set_tooltip_text(M("TP_LOCALLAB_STRUCT_TOOLTIP")); pdeFrame->set_tooltip_text(M("TP_LOCALLAB_PDEFRAME_TOOLTIP")); laplacexp->set_tooltip_text(M("TP_LOCALLAB_EXPLAP_TOOLTIP")); + linear->set_tooltip_text(M("TP_LOCALLAB_EXPLAPLIN_TOOLTIP")); balanexp->set_tooltip_text(M("TP_LOCALLAB_EXPLAPBAL_TOOLTIP")); gamm->set_tooltip_text(M("TP_LOCALLAB_EXPLAPGAMM_TOOLTIP")); - linear->set_tooltip_text(M("TP_LOCALLAB_EXPLAPLIN_TOOLTIP")); exnoiseMethod->set_tooltip_text(M("TP_LOCALLAB_EXPNOISEMETHOD_TOOLTIP")); fatFrame->set_tooltip_text(M("TP_LOCALLAB_FATFRAME_TOOLTIP")); + expcomp->set_tooltip_text(M("TP_LOCALLAB_EXPCOMP_TOOLTIP")); sensiex->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); + structexp->set_tooltip_text(M("TP_LOCALLAB_STRUCT_TOOLTIP")); + expchroma->set_tooltip_text(M("TP_LOCALLAB_EXPCHROMA_TOOLTIP")); shapeexpos->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_TONES_TOOLTIP")); strexp->set_tooltip_text(M("TP_LOCALLAB_GRADGEN_TOOLTIP")); expmaskexp->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP")); CCmaskexpshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmaskexpshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmaskexpshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + blendmaskexp->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); radmaskexp->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); lapmaskexp->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); strmaskexp->set_tooltip_text(M("TP_LOCALLAB_GRADGEN_TOOLTIP")); - Lmaskexpshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); - blendmaskexp->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); mask2expCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); - expchroma->set_tooltip_text(M("TP_LOCALLAB_EXPCHROMA_TOOLTIP")); + Lmaskexpshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); } else { exp->set_tooltip_text(""); + expMethod->set_tooltip_text(""); + pdeFrame->set_tooltip_text(""); + laplacexp->set_tooltip_text(""); + linear->set_tooltip_text(""); + balanexp->set_tooltip_text(""); + gamm->set_tooltip_text(""); + exnoiseMethod->set_tooltip_text(""); + fatFrame->set_tooltip_text(""); + expcomp->set_tooltip_text(""); + sensiex->set_tooltip_text(""); + structexp->set_tooltip_text(""); + expchroma->set_tooltip_text(""); + shapeexpos->setTooltip(""); + strexp->set_tooltip_text(""); + expmaskexp->set_tooltip_text(""); + CCmaskexpshape->setTooltip(""); + LLmaskexpshape->setTooltip(""); + HHmaskexpshape->setTooltip(""); + blendmaskexp->set_tooltip_text(""); + radmaskexp->set_tooltip_text(""); + lapmaskexp->set_tooltip_text(""); + strmaskexp->set_tooltip_text(""); + mask2expCurveEditorG->set_tooltip_text(""); + Lmaskexpshape->setTooltip(""); } } @@ -3029,18 +3163,38 @@ void LocallabExposure::convertParamToNormal() disableListener(); // Set hidden GUI widgets in Normal mode to default spot values + structexp->setValue((double)defSpot.structexp); blurexpde->setValue((double)defSpot.blurexpde); lapmaskexp->setValue(defSpot.lapmaskexp); gammaskexp->setValue(defSpot.gammaskexp); slomaskexp->setValue(defSpot.slomaskexp); strmaskexp->setValue(defSpot.strmaskexp); angmaskexp->setValue(defSpot.angmaskexp); - structexp->setValue((double)defSpot.structexp); - // laplacexp->setValue(defSpot.laplacexp); - // linear->setValue(defSpot.linear); - // balanexp->setValue(defSpot.balanexp); - // gamm->setValue(defSpot.gamm); + // Enable all listeners + enableListener(); +} + +void LocallabExposure::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + strexp->setValue(defSpot.strexp); + angexp->setValue(defSpot.angexp); + softradiusexp->setValue(defSpot.softradiusexp); + enaExpMask->set_active(defSpot.enaExpMask); + enaExpMaskaft->set_active(defSpot.enaExpMaskaft); + CCmaskexpshape->setCurve(defSpot.CCmaskexpcurve); + LLmaskexpshape->setCurve(defSpot.CCmaskexpcurve); + HHmaskexpshape->setCurve(defSpot.HHmaskexpcurve); + blendmaskexp->setValue((double)defSpot.blendmaskexp); + radmaskexp->setValue(defSpot.radmaskexp); + chromaskexp->setValue(defSpot.chromaskexp); + Lmaskexpshape->setCurve(defSpot.Lmaskexpcurve); // Enable all listeners enableListener(); @@ -3048,24 +3202,54 @@ void LocallabExposure::convertParamToNormal() void LocallabExposure::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - lapmaskexp->hide(); - gammaskexp->hide(); - slomaskexp->hide(); - gradFramemask->hide(); - blurexpde->hide(); - structexp->hide(); - // pdeFrame->hide(); - } else { - // Advanced widgets are shown in Expert mode - lapmaskexp->show(); - gammaskexp->show(); - slomaskexp->show(); - gradFramemask->show(); - blurexpde->show(); - structexp->show(); - // pdeFrame->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + structexp->hide(); + blurexpde->hide(); + expgradexp->hide(); + softradiusexp->hide(); + expmaskexp->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + structexp->hide(); + blurexpde->hide(); + lapmaskexp->hide(); + gammaskexp->hide(); + slomaskexp->hide(); + gradFramemask->hide(); + + // Specific Simple mode widgets are shown in Normal mode + if (!inversex->get_active()) { // Keep widget hidden when invers is toggled + expgradexp->show(); + softradiusexp->show(); + } + + expmaskexp->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + if (!inversex->get_active()) { // Keep widget hidden when invers is toggled + structexp->show(); + } + + blurexpde->show(); + + if (!inversex->get_active()) { // Keep widget hidden when invers is toggled + expgradexp->show(); + softradiusexp->show(); + } + + expmaskexp->show(); + lapmaskexp->show(); + gammaskexp->show(); + slomaskexp->show(); + gradFramemask->show(); } } @@ -3111,19 +3295,18 @@ void LocallabExposure::exnoiseMethodChanged() void LocallabExposure::inversexChanged() { + const bool maskPreviewActivated = isMaskViewActive(); + // Update exposure GUI according to inversex button state updateExposureGUI3(); - // This event is called to transmit potentially reset mask state - if (listener) { - listener->panelChanged(EvlocallabshowmaskMethod, ""); + if (maskPreviewActivated) { + // This event is called to transmit reset mask state + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } } - if (inversex->get_active()) { - expcomp->setLabel(M("TP_LOCALLAB_EXPCOMPINV")); - } else { - expcomp->setLabel(M("TP_LOCALLAB_EXPCOMP")); - } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (inversex->get_active()) { @@ -3229,6 +3412,8 @@ void LocallabExposure::updateExposureGUI2() void LocallabExposure::updateExposureGUI3() { + const int mode = complexity->get_active_row_number(); + // Update exposure GUI according to inversex button state if (inversex->get_active()) { expMethod->hide(); @@ -3244,9 +3429,6 @@ void LocallabExposure::updateExposureGUI3() updateExposureGUI2(); } - //structexp->hide(); - // shadex->hide(); - shadex->show(); softradiusexp->hide(); expgradexp->hide(); showmaskexpMethod->hide(); @@ -3257,11 +3439,13 @@ void LocallabExposure::updateExposureGUI3() showmaskexpMethodinv->show(); } else { expMethod->show(); - //structexp->show(); expcomp->setLabel(M("TP_LOCALLAB_EXPCOMP")); - shadex->show(); - softradiusexp->show(); - expgradexp->show(); + + if (mode == Expert || mode == Normal) { // Keep widgets hidden in Simple mode + softradiusexp->show(); + expgradexp->show(); + } + showmaskexpMethodinv->hide(); // Reset hidden mask combobox showmaskexpMethodConninv.block(true); @@ -3339,8 +3523,8 @@ LocallabShadow::LocallabShadow(): shMethod->set_active(0); shMethodConn = shMethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabShadow::shMethodChanged)); - for (unsigned int i = 0; i < multipliersh.size(); i++) { - multipliersh[i]->setAdjusterListener(this); + for (const auto multiplier : multipliersh) { + multiplier->setAdjusterListener(this); } detailSH->setAdjusterListener(this); @@ -3411,7 +3595,6 @@ LocallabShadow::LocallabShadow(): blendmaskSH->setAdjusterListener(this); - //radmaskSH->setLogScale(10, -10); radmaskSH->setAdjusterListener(this); lapmaskSH->setAdjusterListener(this); @@ -3439,8 +3622,8 @@ LocallabShadow::LocallabShadow(): // Add Shadow highlight specific widgets to GUI pack_start(*shMethod); - for (int i = 0; i < 5; ++i) { - pack_start(*multipliersh[i]); + for (const auto multiplier : multipliersh) { + pack_start(*multiplier); } pack_start(*detailSH); @@ -3449,9 +3632,8 @@ LocallabShadow::LocallabShadow(): pack_start(*shadows); pack_start(*s_tonalwidth); pack_start(*sh_radius); -// pack_start(*sensihs); + // pack_start(*sensihs); pack_start(*blurSHde); -// Gtk::Frame* const gamFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GAMFRA"))); gamFrame->set_label_align(0.025, 0.5); ToolParamBlock* const gammBox = Gtk::manage(new ToolParamBlock()); gammBox->pack_start(*gamSH); @@ -3480,7 +3662,7 @@ LocallabShadow::LocallabShadow(): fatSHBox->pack_start(*fatamountSH); fatSHBox->pack_start(*fatanchorSH); fatSHFrame->add(*fatSHBox); -// maskSHBox->pack_start(*fatSHFrame); + // maskSHBox->pack_start(*fatSHFrame); expmasksh->add(*maskSHBox, false); pack_start(*expmasksh, false, false); } @@ -3518,23 +3700,42 @@ void LocallabShadow::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { exp->set_tooltip_text(M("TP_LOCALLAB_SHADOWHIGHLIGHT_TOOLTIP")); + + for (const auto multiplier : multipliersh) { + multiplier->set_tooltip_text(M("TP_LOCALLAB_MULTIPL_TOOLTIP")); + } + + gamSH->set_tooltip_text(M("TP_LOCALLAB_SHTRC_TOOLTIP")); + sloSH->set_tooltip_text(M("TP_LOCALLAB_SHTRC_TOOLTIP")); strSH->set_tooltip_text(M("TP_LOCALLAB_GRADGEN_TOOLTIP")); expmasksh->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP")); CCmaskSHshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmaskSHshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmaskSHshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + blendmaskSH->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); radmaskSH->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); lapmaskSH->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); - LmaskSHshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); - for (unsigned int i = 0; i < multipliersh.size(); i++) { - multipliersh[i]->set_tooltip_text(M("TP_LOCALLAB_MULTIPL_TOOLTIP")); - } - gamSH->set_tooltip_text(M("TP_LOCALLAB_SHTRC_TOOLTIP")); - sloSH->set_tooltip_text(M("TP_LOCALLAB_SHTRC_TOOLTIP")); - blendmaskSH->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); mask2SHCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); + LmaskSHshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); } else { exp->set_tooltip_text(""); + + for (const auto multiplier : multipliersh) { + multiplier->set_tooltip_text(""); + } + + gamSH->set_tooltip_text(""); + sloSH->set_tooltip_text(""); + strSH->set_tooltip_text(""); + expmasksh->set_tooltip_text(""); + CCmaskSHshape->setTooltip(""); + LLmaskSHshape->setTooltip(""); + HHmaskSHshape->setTooltip(""); + blendmaskSH->set_tooltip_text(""); + radmaskSH->set_tooltip_text(""); + lapmaskSH->set_tooltip_text(""); + mask2SHCurveEditorG->set_tooltip_text(""); + LmaskSHshape->setTooltip(""); } } @@ -3950,22 +4151,83 @@ void LocallabShadow::convertParamToNormal() enableListener(); } +void LocallabShadow::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + gamSH->setValue(defSpot.gamSH); + sloSH->setValue(defSpot.sloSH); + strSH->setValue(defSpot.strSH); + angSH->setValue(defSpot.angSH); + showmaskSHMethod->set_active(0); + showmaskSHMethodinv->set_active(0); + enaSHMask->set_active(defSpot.enaSHMask); + CCmaskSHshape->setCurve(defSpot.CCmaskSHcurve); + LLmaskSHshape->setCurve(defSpot.LLmaskSHcurve); + HHmaskSHshape->setCurve(defSpot.HHmaskSHcurve); + blendmaskSH->setValue((double)defSpot.blendmaskSH); + radmaskSH->setValue(defSpot.radmaskSH); + chromaskSH->setValue(defSpot.chromaskSH); + LmaskSHshape->setCurve(defSpot.LmaskSHcurve); + + // Enable all listeners + enableListener(); +} + void LocallabShadow::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - blurSHde->hide(); - lapmaskSH->hide(); - gammaskSH->hide(); - slomaskSH->hide(); - fatSHFrame->hide(); - } else { - // Advanced widgets are shown in Expert mode - blurSHde->show(); - lapmaskSH->show(); - gammaskSH->show(); - slomaskSH->show(); - fatSHFrame->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + blurSHde->hide(); + gamFrame->hide(); + expgradsh->hide(); + expmasksh->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + blurSHde->hide(); + lapmaskSH->hide(); + gammaskSH->hide(); + slomaskSH->hide(); + fatSHFrame->hide(); + + // Specific Simple mode widgets are shown in Normal mode + if (shMethod->get_active_row_number() != 0) { // Keep widget hidden when shMethod is equal to 0 + gamFrame->show(); + } + + if (!inverssh->get_active()) { // Keep widget hidden when inverssh is toggled + expgradsh->show(); + } + + expmasksh->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + blurSHde->show(); + + if (shMethod->get_active_row_number() != 0) { // Keep widget hidden when shMethod is equal to 0 + gamFrame->show(); + } + + if (!inverssh->get_active()) { // Keep widget hidden when inverssh is toggled + expgradsh->show(); + } + + expmasksh->show(); + lapmaskSH->show(); + gammaskSH->show(); + slomaskSH->show(); + fatSHFrame->show(); } } @@ -4002,12 +4264,16 @@ void LocallabShadow::shMethodChanged() void LocallabShadow::inversshChanged() { + const bool maskPreviewActivated = isMaskViewActive(); + // Update shadow highlight GUI according to inverssh button state updateShadowGUI1(); - // This event is called to transmit potentially reset mask state - if (listener) { - listener->panelChanged(EvlocallabshowmaskMethod, ""); + if (maskPreviewActivated) { + // This event is called to transmit reset mask state + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } } if (isLocActivated && exp->getEnabled()) { @@ -4074,6 +4340,8 @@ void LocallabShadow::enaSHMaskChanged() void LocallabShadow::updateShadowGUI1() { + const int mode = complexity->get_active_row_number(); + // Update shadow highlight GUI according to inverssh button state if (inverssh->get_active()) { expgradsh->hide(); @@ -4084,7 +4352,10 @@ void LocallabShadow::updateShadowGUI1() showmaskSHMethodConn.block(false); showmaskSHMethodinv->show(); } else { - expgradsh->show(); + if (mode == Expert || mode == Normal) { // Keep widget hidden in Simple mode + expgradsh->show(); + } + showmaskSHMethod->show(); showmaskSHMethodinv->hide(); // Reset hidden mask combobox @@ -4096,11 +4367,14 @@ void LocallabShadow::updateShadowGUI1() void LocallabShadow::updateShadowGUI2() { + const int mode = complexity->get_active_row_number(); + // Update shadow highlight GUI according to shMethod combobox state if (shMethod->get_active_row_number() == 0) { - for (int i = 0; i < 5; i++) { - multipliersh[i]->hide(); + for (const auto multiplier : multipliersh) { + multiplier->hide(); } + gamFrame->hide(); detailSH->hide(); highlights->show(); @@ -4109,10 +4383,13 @@ void LocallabShadow::updateShadowGUI2() s_tonalwidth->show(); sh_radius->show(); } else if (shMethod->get_active_row_number() == 1) { - for (int i = 0; i < 5; i++) { - multipliersh[i]->show(); + for (const auto multiplier : multipliersh) { + multiplier->show(); + } + + if (mode == Expert || mode == Normal) { // Keep widget hidden in Simple mode + gamFrame->show(); } - gamFrame->show(); detailSH->show(); highlights->hide(); @@ -4245,7 +4522,6 @@ LocallabVibrance::LocallabVibrance(): blendmaskvib->setAdjusterListener(this); - //radmaskvib->setLogScale(10, -10); radmaskvib->setAdjusterListener(this); lapmaskvib->setAdjusterListener(this); @@ -4272,7 +4548,7 @@ LocallabVibrance::LocallabVibrance(): pack_start(*protectSkins, Gtk::PACK_SHRINK, 0); pack_start(*avoidColorShift, Gtk::PACK_SHRINK, 0); pack_start(*pastSatTog, Gtk::PACK_SHRINK, 0); -// pack_start(*sensiv, Gtk::PACK_SHRINK, 0); + // pack_start(*sensiv, Gtk::PACK_SHRINK, 0); pack_start(*curveEditorGG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor ToolParamBlock* const gradvibBox = Gtk::manage(new ToolParamBlock()); gradvibBox->pack_start(*strvib); @@ -4323,17 +4599,27 @@ void LocallabVibrance::getMaskView(int &colorMask, int &colorMaskinv, int &expMa void LocallabVibrance::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { + exp->set_tooltip_text(M("TP_LOCALLAB_VIBRA_TOOLTIP")); warm->set_tooltip_text(M("TP_LOCALLAB_WARM_TOOLTIP")); strvib->set_tooltip_text(M("TP_LOCALLAB_GRADGEN_TOOLTIP")); expmaskvib->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP")); CCmaskvibshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmaskvibshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmaskvibshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); - Lmaskvibshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); blendmaskvib->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); mask2vibCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); + Lmaskvibshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); } else { exp->set_tooltip_text(""); + warm->set_tooltip_text(""); + strvib->set_tooltip_text(""); + expmaskvib->set_tooltip_text(""); + CCmaskvibshape->setTooltip(""); + LLmaskvibshape->setTooltip(""); + HHmaskvibshape->setTooltip(""); + blendmaskvib->set_tooltip_text(""); + mask2vibCurveEditorG->set_tooltip_text(""); + Lmaskvibshape->setTooltip(""); } } @@ -4737,36 +5023,83 @@ void LocallabVibrance::convertParamToNormal() updateVibranceGUI(); } +void LocallabVibrance::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + strvib->setValue(defSpot.strvib); + angvib->setValue(defSpot.angvib); + showmaskvibMethod->set_active(0); + enavibMask->set_active(defSpot.enavibMask); + CCmaskvibshape->setCurve(defSpot.CCmaskvibcurve); + LLmaskvibshape->setCurve(defSpot.LLmaskvibcurve); + HHmaskvibshape->setCurve(defSpot.HHmaskvibcurve); + blendmaskvib->setValue((double)defSpot.blendmaskvib); + radmaskvib->setValue(defSpot.radmaskvib); + chromaskvib->setValue(defSpot.chromaskvib); + Lmaskvibshape->setCurve(defSpot.Lmaskvibcurve); + + // Enable all listener + enableListener(); +} + void LocallabVibrance::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - saturated->hide(); - pastels->setLabel(M("TP_LOCALLAB_PASTELS2")); - psThreshold->hide(); - protectSkins->hide(); - avoidColorShift->hide(); - pastSatTog->hide(); - curveEditorGG->hide(); - strvibab->hide(); - strvibh->hide(); - lapmaskvib->hide(); - gammaskvib->hide(); - slomaskvib->hide(); - } else { - // Advanced widgets are shown in Expert mode - saturated->show(); - pastels->setLabel(M("TP_VIBRANCE_PASTELS")); - psThreshold->show(); - protectSkins->show(); - avoidColorShift->show(); - pastSatTog->show(); - curveEditorGG->show(); - strvibab->show(); - strvibh->show(); - lapmaskvib->show(); - gammaskvib->show(); - slomaskvib->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + saturated->hide(); + pastels->setLabel(M("TP_LOCALLAB_PASTELS2")); + psThreshold->hide(); + protectSkins->hide(); + avoidColorShift->hide(); + pastSatTog->hide(); + curveEditorGG->hide(); + expgradvib->hide(); + expmaskvib->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + saturated->hide(); + pastels->setLabel(M("TP_LOCALLAB_PASTELS2")); + psThreshold->hide(); + protectSkins->hide(); + avoidColorShift->hide(); + pastSatTog->hide(); + curveEditorGG->hide(); + strvibab->hide(); + strvibh->hide(); + lapmaskvib->hide(); + gammaskvib->hide(); + slomaskvib->hide(); + // Specific Simple mode widgets are shown in Normal mode + expgradvib->show(); + expmaskvib->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + saturated->show(); + pastels->setLabel(M("TP_VIBRANCE_PASTELS")); + psThreshold->show(); + protectSkins->show(); + avoidColorShift->show(); + pastSatTog->show(); + curveEditorGG->show(); + expgradvib->show(); + strvibab->show(); + strvibh->show(); + expmaskvib->show(); + lapmaskvib->show(); + gammaskvib->show(); + slomaskvib->show(); } } @@ -4902,7 +5235,6 @@ LocallabSoft::LocallabSoft(): showmasksoftMethod->append(M("TP_LOCALLAB_SHOWNORMAL")); showmasksoftMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmasksoftMethod->set_active(0); -// showmasksoftMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKSOFT_TOOLTIP")); showmasksoftMethodConn = showmasksoftMethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabSoft::showmasksoftMethodChanged)); streng->setAdjusterListener(this); @@ -4942,14 +5274,15 @@ void LocallabSoft::getMaskView(int &colorMask, int &colorMaskinv, int &expMask, void LocallabSoft::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { - exp->set_tooltip_markup(M("TP_LOCALLAB_SOFTMETHOD_TOOLTIP")); - //softMethod->set_tooltip_markup(M("TP_LOCALLAB_SOFTMETHOD_TOOLTIP")); - // ctboxsoftmethod->set_tooltip_markup(M("TP_LOCALLAB_ORRETISTEP_TOOLTIP")); + exp->set_tooltip_markup(M("TP_LOCALLAB_SOFTMETHOD_TOOLTIP")); showmasksoftMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKSOFT_TOOLTIP")); streng->set_tooltip_text(M("TP_LOCALLAB_ORRETISTREN_TOOLTIP")); laplace->set_tooltip_text(M("TP_LOCALLAB_ORRETILAP_TOOLTIP")); } else { exp->set_tooltip_text(""); + showmasksoftMethod->set_tooltip_text(""); + streng->set_tooltip_text(""); + laplace->set_tooltip_text(""); } } @@ -5076,6 +5409,58 @@ void LocallabSoft::adjusterChanged(Adjuster* a, double newval) } } +void LocallabSoft::complexityModeChanged() +{ + if (complexity->get_active_row_number() == Simple) { // New selected mode is Simple one + const bool maskPreviewActivated = isMaskViewActive(); + + // Convert tool widget parameters + convertParamToNormal(); // From Expert mode to Normal mode + convertParamToSimple(); // From Normal mode to Simple mode + // Update GUI based on new mode + updateGUIToMode(Simple); + + if (maskPreviewActivated) { + // This event is called to transmit reset mask state + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } + } + + if (listener && isLocActivated) { + listener->panelChanged(EvlocallabcomplexityWithRefresh, + M("TP_LOCALLAB_MODE_SIMPLE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } else if (complexity->get_active_row_number() == Normal) { // New selected mode is Normal one + const bool maskPreviewActivated = isMaskViewActive(); + + // Convert tool widget parameters + convertParamToNormal(); + // Update GUI based on new mode + updateGUIToMode(Normal); + + if (maskPreviewActivated) { + // This event is called to transmit reset mask state + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } + } + + if (listener && isLocActivated) { + listener->panelChanged(EvlocallabcomplexityWithRefresh, + M("TP_LOCALLAB_MODE_NORMAL") + " (" + escapeHtmlChars(spotName) + ")"); + } + } else if (complexity->get_active_row_number() == Expert) { // New selected mode is Expert one + // Update GUI based on new mode + updateGUIToMode(Expert); + + if (listener && isLocActivated) { + listener->panelChanged(EvlocallabcomplexityWithRefresh, + M("TP_LOCALLAB_MODE_EXPERT") + " (" + escapeHtmlChars(spotName) + ")"); + } + } +} + void LocallabSoft::enabledChanged() { if (isLocActivated) { @@ -5099,6 +5484,20 @@ void LocallabSoft::convertParamToNormal() disableListener(); // Set hidden GUI widgets in Normal mode to default spot values + showmasksoftMethod->set_active(0); + + // Enable all listeners + enableListener(); +} + +void LocallabSoft::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values if (defSpot.softMethod == "soft") { softMethod->set_active(0); } else if (defSpot.softMethod == "reti") { @@ -5115,23 +5514,44 @@ void LocallabSoft::convertParamToNormal() void LocallabSoft::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - softMethod->hide(); - } else { - // Advanced widgets are shown in Expert mode - softMethod->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + softMethod->hide(); + ctboxsoftmethod->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + ctboxsoftmethod->hide(); + // Specific Simple mode widgets are shown in Normal mode + softMethod->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + softMethod->show(); + + if (softMethod->get_active_row_number() != 0) { // Keep widget hidden when softMethod is equal to 0 + ctboxsoftmethod->show(); + } } } void LocallabSoft::softMethodChanged() { + const bool maskPreviewActivated = isMaskViewActive(); + // Update soft light GUI according to softMethod combobox updateSoftGUI(); - // This event is called to transmit potentially reset mask state - if (listener) { - listener->panelChanged(EvlocallabshowmaskMethod, ""); + if (maskPreviewActivated) { + // This event is called to transmit reset mask state + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } } if (isLocActivated && exp->getEnabled()) { @@ -5157,6 +5577,8 @@ void LocallabSoft::showmasksoftMethodChanged() void LocallabSoft::updateSoftGUI() { // Update soft light GUI according to softMethod combobox + const int comp = complexity->get_active_row_number(); + if (softMethod->get_active_row_number() == 0) { ctboxsoftmethod->hide(); // Reset hidden mask combobox @@ -5165,7 +5587,10 @@ void LocallabSoft::updateSoftGUI() showmasksoftMethodConn.block(false); laplace->hide(); } else { - ctboxsoftmethod->show(); + if (comp == Expert) { // Keep widget hidden in Simple and Normal mode + ctboxsoftmethod->show(); + } + laplace->show(); } } @@ -5332,7 +5757,6 @@ LocallabBlur::LocallabBlur(): showmaskblMethod->append(M("TP_LOCALLAB_SHOWMODIF")); showmaskblMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); showmaskblMethod->append(M("TP_LOCALLAB_SHOWMASK")); -// showmaskblMethod->append(M("TP_LOCALLAB_SHOWREF")); showmaskblMethod->set_active(0); showmaskblMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); showmaskblMethodConn = showmaskblMethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabBlur::showmaskblMethodChanged)); @@ -5474,10 +5898,10 @@ LocallabBlur::LocallabBlur(): LocallabBlur::~LocallabBlur() { + delete LocalcurveEditorwavden; delete maskblCurveEditorG; delete mask2blCurveEditorG; delete mask2blCurveEditorGwav; - delete LocalcurveEditorwavden; } bool LocallabBlur::isMaskViewActive() @@ -5508,17 +5932,33 @@ void LocallabBlur::updateAdviceTooltips(const bool showTooltips) wavshapeden->setTooltip(M("TP_LOCALLAB_WASDEN_TOOLTIP")); noiselumc->set_tooltip_text(M("TP_LOCALLAB_NOISECHROC_TOOLTIP")); expmaskbl->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP")); + showmaskblMethodtyp->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKTYP_TOOLTIP")); CCmaskblshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmaskblshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmaskblshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + blendmaskbl->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); radmaskbl->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); lapmaskbl->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); Lmaskblshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); LLmaskblshapewav->setTooltip(M("TP_LOCALLAB_LMASK_LEVEL_TOOLTIP")); - blendmaskbl->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); - showmaskblMethodtyp->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKTYP_TOOLTIP")); } else { - exp->set_tooltip_text(""); + expblnoise->set_tooltip_text(""); + radius->set_tooltip_text(""); + sensibn->set_tooltip_text(""); + blurMethod->set_tooltip_text(""); + expdenoise->set_tooltip_text(""); + wavshapeden->setTooltip(""); + noiselumc->set_tooltip_text(""); + expmaskbl->set_tooltip_text(""); + showmaskblMethodtyp->set_tooltip_text(""); + CCmaskblshape->setTooltip(""); + LLmaskblshape->setTooltip(""); + HHmaskblshape->setTooltip(""); + blendmaskbl->set_tooltip_text(""); + radmaskbl->set_tooltip_text(""); + lapmaskbl->set_tooltip_text(""); + Lmaskblshape->setTooltip(""); + LLmaskblshapewav->setTooltip(""); } } @@ -5625,15 +6065,6 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params chroMethod->set_active(2); } - - if (spot.showmaskblMethodtyp == "blur") { - showmaskblMethodtyp ->set_active(0); - } else if (spot.showmaskblMethodtyp == "nois") { - showmaskblMethodtyp->set_active(1); - } else if (spot.showmaskblMethodtyp == "all") { - showmaskblMethodtyp->set_active(2); - } - activlum->set_active(spot.activlum); wavshapeden->setCurve(spot.locwavcurveden); noiselumf0->setValue(spot.noiselumf0); @@ -5649,6 +6080,15 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params adjblur->setValue((double)spot.adjblur); bilateral->setValue((double)spot.bilateral); sensiden->setValue((double)spot.sensiden); + + if (spot.showmaskblMethodtyp == "blur") { + showmaskblMethodtyp ->set_active(0); + } else if (spot.showmaskblMethodtyp == "nois") { + showmaskblMethodtyp->set_active(1); + } else if (spot.showmaskblMethodtyp == "all") { + showmaskblMethodtyp->set_active(2); + } + enablMask->set_active(spot.enablMask); CCmaskblshape->setCurve(spot.CCmaskblcurve); LLmaskblshape->setCurve(spot.LLmaskblcurve); @@ -5738,15 +6178,6 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.chroMethod = "all"; } - - if (showmaskblMethodtyp->get_active_row_number() == 0) { - spot.showmaskblMethodtyp = "blur"; - } else if (showmaskblMethodtyp->get_active_row_number() == 1) { - spot.showmaskblMethodtyp = "nois"; - } else if (showmaskblMethodtyp->get_active_row_number() == 2) { - spot.showmaskblMethodtyp = "all"; - } - spot.activlum = activlum->get_active(); spot.locwavcurveden = wavshapeden->getCurve(); spot.noiselumf0 = noiselumf0->getValue(); @@ -5762,6 +6193,15 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.adjblur = adjblur->getIntValue(); spot.bilateral = bilateral->getIntValue(); spot.sensiden = sensiden->getIntValue(); + + if (showmaskblMethodtyp->get_active_row_number() == 0) { + spot.showmaskblMethodtyp = "blur"; + } else if (showmaskblMethodtyp->get_active_row_number() == 1) { + spot.showmaskblMethodtyp = "nois"; + } else if (showmaskblMethodtyp->get_active_row_number() == 2) { + spot.showmaskblMethodtyp = "all"; + } + spot.enablMask = enablMask->get_active(); spot.LLmaskblcurve = LLmaskblshape->getCurve(); spot.CCmaskblcurve = CCmaskblshape->getCurve(); @@ -6056,7 +6496,7 @@ void LocallabBlur::adjusterChanged(Adjuster* a, double newval) shadmaskblsha->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); } } - + } } @@ -6144,8 +6584,6 @@ void LocallabBlur::convertParamToNormal() strumaskbl->setValue(defSpot.strumaskbl); toolbl->set_active(defSpot.toolbl); lapmaskbl->setValue(defSpot.lapmaskbl); -// gammaskbl->setValue(defSpot.gammaskbl); -// slomaskbl->setValue(defSpot.slomaskbl); shadmaskbl->setValue((double)defSpot.shadmaskbl); shadmaskblsha->setValue((double)defSpot.shadmaskblsha); LLmaskblshapewav->setCurve(defSpot.LLmaskblcurvewav); @@ -6155,35 +6593,79 @@ void LocallabBlur::convertParamToNormal() enableListener(); } +void LocallabBlur::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + showmaskblMethod->set_active(0); + + if (defSpot.showmaskblMethodtyp == "blur") { + showmaskblMethodtyp ->set_active(0); + } else if (defSpot.showmaskblMethodtyp == "nois") { + showmaskblMethodtyp->set_active(1); + } else if (defSpot.showmaskblMethodtyp == "all") { + showmaskblMethodtyp->set_active(2); + } + + enablMask->set_active(defSpot.enablMask); + CCmaskblshape->setCurve(defSpot.CCmaskblcurve); + LLmaskblshape->setCurve(defSpot.LLmaskblcurve); + HHmaskblshape->setCurve(defSpot.HHmaskblcurve); + blendmaskbl->setValue((double)defSpot.blendmaskbl); + radmaskbl->setValue(defSpot.radmaskbl); + chromaskbl->setValue(defSpot.chromaskbl); + gammaskbl->setValue(defSpot.gammaskbl); + slomaskbl->setValue(defSpot.slomaskbl); + Lmaskblshape->setCurve(defSpot.Lmasklccurve); + + // Enable all listeners + enableListener(); +} + void LocallabBlur::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - fftwbl->hide(); - strumaskbl->hide(); - toolbl->hide(); - lapmaskbl->hide(); - gammaskbl->show(); - slomaskbl->show(); - shadmaskbl->hide(); - shadmaskblsha->hide(); - mask2blCurveEditorGwav->hide(); - csThresholdblur->hide(); - } else { - // Advanced widgets are shown in Expert mode - if (blMethod->get_active_row_number() == 0) { // Keep widget hidden when blMethod is > 0 - fftwbl->show(); - } + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + fftwbl->hide(); + expmaskbl->hide(); - strumaskbl->show(); - toolbl->show(); - lapmaskbl->show(); - gammaskbl->show(); - slomaskbl->show(); - shadmaskbl->show(); - shadmaskblsha->show(); - mask2blCurveEditorGwav->show(); - csThresholdblur->show(); + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + fftwbl->hide(); + strumaskbl->hide(); + toolbl->hide(); + lapmaskbl->hide(); + shadmaskbl->hide(); + shadmaskblsha->hide(); + mask2blCurveEditorGwav->hide(); + csThresholdblur->hide(); + // Specific Simple mode widgets are shown in Normal mode + expmaskbl->show(); + + break; + + case Expert: + + // Show widgets hidden in Normal and Simple mode + if (blMethod->get_active_row_number() == 0) { // Keep widget hidden when blMethod is > 0 + fftwbl->show(); + } + + expmaskbl->show(); + strumaskbl->show(); + toolbl->show(); + lapmaskbl->show(); + shadmaskbl->show(); + shadmaskblsha->show(); + mask2blCurveEditorGwav->show(); + csThresholdblur->show(); } } @@ -6334,8 +6816,13 @@ void LocallabBlur::toolblChanged() void LocallabBlur::updateBlurGUI() { + const int mode = complexity->get_active_row_number(); + if (blMethod->get_active_row_number() == 0) { - fftwbl->show(); + if (mode == Expert) { // Keep widget hidden in Normal and Simple mode + fftwbl->show(); + } + radius->show(); strength->show(); grainFrame->show(); diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index a43e76fe8..8b5152968 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - * 2019 Pierre Cabrera + * 2019-2020 Pierre Cabrera */ #ifndef _LOCALLABTOOLS_H_ #define _LOCALLABTOOLS_H_ @@ -52,7 +52,8 @@ protected: // LocallabTool mode enumeration enum modeType { Expert = 0, - Normal = 1 + Normal = 1, + Simple = 2 }; // LocallabTool parameters @@ -162,7 +163,8 @@ private: // To be implemented virtual void enabledChanged() {}; - virtual void convertParamToNormal() {}; // Only necessary when using mode + virtual void convertParamToNormal() {}; // From Expert mode to Normal mode; Only necessary when using mode + virtual void convertParamToSimple() {}; // From Normal mode to Simple mode; Only necessary when using mode virtual void updateGUIToMode(const modeType new_type) {}; // Only necessary when using mode }; @@ -175,10 +177,10 @@ class LocallabColor: private: // Color & Light specific widgets Gtk::Frame* const lumFrame; - Gtk::CheckButton* const curvactiv; Adjuster* const lightness; Adjuster* const contrast; Adjuster* const chroma; + Gtk::CheckButton* const curvactiv; Gtk::Frame* const gridFrame; LabGrid* const labgrid; MyComboBoxText* const gridMethod; @@ -204,10 +206,10 @@ private: DiagonalCurveEditor* const lcshape; CurveEditorGroup* const HCurveEditorG; FlatCurveEditor* const LHshape; - CurveEditorGroup* const H2CurveEditorG; - FlatCurveEditor* const HHshape; CurveEditorGroup* const H3CurveEditorG; FlatCurveEditor* const CHshape; + CurveEditorGroup* const H2CurveEditorG; + FlatCurveEditor* const HHshape; CurveEditorGroup* const rgbCurveEditorG; MyComboBoxText* const toneMethod; DiagonalCurveEditor* const rgbshape; @@ -283,6 +285,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -388,6 +391,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -473,6 +477,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -557,6 +562,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -603,8 +609,11 @@ public: void adjusterChanged(Adjuster* a, double newval) override; private: + void complexityModeChanged(); + void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void softMethodChanged(); @@ -708,6 +717,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -784,6 +794,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -874,6 +885,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -907,6 +919,7 @@ private: Adjuster* const sharradius; Adjuster* const sensisha; Gtk::CheckButton* const inverssha; + Gtk::Frame* const sharFrame; MyComboBoxText* const showmasksharMethod; sigc::connection inversshaConn, showmasksharMethodConn; @@ -930,6 +943,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void inversshaChanged(); @@ -952,8 +966,8 @@ private: Adjuster* const sigmalc; CurveEditorGroup* const LocalcurveEditorwav; FlatCurveEditor* const wavshape; - Adjuster* const levelwav; ThresholdAdjuster* const csThreshold; + Adjuster* const levelwav; MyExpander* const expresidpyr; Adjuster* const residcont; Adjuster* const residchro; @@ -1058,6 +1072,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -1089,8 +1104,8 @@ class LocallabCBDL: public LocallabTool { private: - const std::array multiplier; Gtk::Frame* const levFrame; + const std::array multiplier; Adjuster* const chromacbdl; Adjuster* const threshold; Adjuster* const clarityml; @@ -1143,6 +1158,7 @@ public: private: void enabledChanged() override; void convertParamToNormal() override; + void convertParamToSimple() override; void updateGUIToMode(const modeType new_type) override; void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; @@ -1212,7 +1228,6 @@ private: Adjuster* const blendmask; Adjuster* const blendmaskab; Adjuster* const softradiusmask; - MyComboBoxText* const showmask_Method; Gtk::CheckButton* const enamask; CurveEditorGroup* const mask_CurveEditorG; @@ -1226,7 +1241,7 @@ private: Gtk::CheckButton* const fftmask; Adjuster* const contmask; Adjuster* const blurmask; - + Gtk::Frame* const toolmaskFrame; Adjuster* const radmask; Adjuster* const lapmask; Adjuster* const chromask; @@ -1269,18 +1284,22 @@ public: void adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) override; void curveChanged(CurveEditor* ce) override; - private: + void complexityModeChanged(); + void enabledChanged() override; + void convertParamToNormal() override; + void convertParamToSimple() override; + void updateGUIToMode(const modeType new_type) override; + + void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; + void showmask_MethodChanged(); void enamaskChanged(); void toolmaskChanged(); - void convertParamToNormal() override; - void updateGUIToMode(const modeType new_type) override; void fftmaskChanged(); - void updatemaskGUI3(); - void updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) override; + + void updateMaskGUI(); }; - #endif diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 91d1b08a6..a025d5791 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - * 2019 Pierre Cabrera + * 2019-2020 Pierre Cabrera */ #include "locallabtools.h" @@ -127,7 +127,7 @@ LocallabTone::LocallabTone(): scaltm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCALTM"), 0.1, 10.0, 0.01, 1.0))), rewei(Gtk::manage(new Adjuster(M("TP_LOCALLAB_REWEI"), 0, 3, 1, 0))), softradiustm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 0.))), - sensitm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 30))), + sensitm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), expmasktm(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOWT")))), showmasktmMethod(Gtk::manage(new MyComboBoxText())), enatmMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), @@ -205,7 +205,6 @@ LocallabTone::LocallabTone(): lapmasktm->setAdjusterListener(this); - //radmasktm->setLogScale(10, -10); radmasktm->setAdjusterListener(this); chromasktm->setAdjusterListener(this); @@ -275,23 +274,38 @@ void LocallabTone::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { exp->set_tooltip_text(M("TP_LOCALLAB_TONEMAP_TOOLTIP")); - estop->set_tooltip_text(M("TP_LOCALLAB_TONEMAPESTOP_TOOLTIP")); - rewei->set_tooltip_text(M("TP_LOCALLAB_TONEMAPREWEI_TOOLTIP")); - scaltm->set_tooltip_text(M("TP_LOCALLAB_TONEMASCALE_TOOLTIP")); - gamma->set_tooltip_text(M("TP_LOCALLAB_TONEMAPGAM_TOOLTIP")); equiltm->set_tooltip_text(M("TP_LOCALLAB_EQUILTM_TOOLTIP")); + gamma->set_tooltip_text(M("TP_LOCALLAB_TONEMAPGAM_TOOLTIP")); + estop->set_tooltip_text(M("TP_LOCALLAB_TONEMAPESTOP_TOOLTIP")); + scaltm->set_tooltip_text(M("TP_LOCALLAB_TONEMASCALE_TOOLTIP")); + rewei->set_tooltip_text(M("TP_LOCALLAB_TONEMAPREWEI_TOOLTIP")); sensitm->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); expmasktm->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP")); CCmasktmshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmasktmshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmasktmshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + blendmasktm->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); lapmasktm->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); radmasktm->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); - Lmasktmshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); - blendmasktm->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); mask2tmCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); + Lmasktmshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); } else { exp->set_tooltip_text(""); + equiltm->set_tooltip_text(""); + gamma->set_tooltip_text(""); + estop->set_tooltip_text(""); + scaltm->set_tooltip_text(""); + rewei->set_tooltip_text(""); + sensitm->set_tooltip_text(""); + expmasktm->set_tooltip_text(""); + CCmasktmshape->setTooltip(""); + LLmasktmshape->setTooltip(""); + HHmasktmshape->setTooltip(""); + blendmasktm->set_tooltip_text(""); + lapmasktm->set_tooltip_text(""); + radmasktm->set_tooltip_text(""); + mask2tmCurveEditorG->set_tooltip_text(""); + Lmasktmshape->setTooltip(""); } } @@ -440,6 +454,7 @@ void LocallabTone::adjusterChanged(Adjuster* a, double newval) { if (isLocActivated && exp->getEnabled() && listener) { const auto spName = " (" + escapeHtmlChars(spotName) + ")"; + if (a == amount) { listener->panelChanged(Evlocallabamount, amount->getTextValue() + spName); } else if (a == stren) { @@ -478,6 +493,7 @@ void LocallabTone::curveChanged(CurveEditor* ce) { if (isLocActivated && exp->getEnabled() && listener) { const auto spName = M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"; + if (ce == CCmasktmshape) { listener->panelChanged(EvlocallabCCmasktmshape, spName); } else if (ce == LLmasktmshape) { @@ -494,7 +510,7 @@ void LocallabTone::enabledChanged() { if (isLocActivated && listener) { listener->panelChanged(EvLocenatonemap, (exp->getEnabled() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED")) - + " (" + escapeHtmlChars(spotName) + ")"); + + " (" + escapeHtmlChars(spotName) + ")"); } } @@ -517,24 +533,63 @@ void LocallabTone::convertParamToNormal() enableListener(); } +void LocallabTone::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + showmasktmMethod->set_active(0); + enatmMask->set_active(defSpot.enatmMask); + enatmMaskaft->set_active(defSpot.enatmMaskaft); + CCmasktmshape->setCurve(defSpot.CCmasktmcurve); + LLmasktmshape->setCurve(defSpot.LLmasktmcurve); + HHmasktmshape->setCurve(defSpot.HHmasktmcurve); + blendmasktm->setValue((double)defSpot.blendmasktm); + radmasktm->setValue(defSpot.radmasktm); + chromasktm->setValue(defSpot.chromasktm); + Lmasktmshape->setCurve(defSpot.Lmasktmcurve); + + // Enable all listeners + enableListener(); +} + void LocallabTone::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - gamma->hide(); - satur->hide(); - rewei->hide(); - lapmasktm->hide(); - gammasktm->hide(); - slomasktm->hide(); - } else { - // Advanced widgets are shown in Expert mode - gamma->show(); - satur->show(); - rewei->show(); - lapmasktm->show(); - gammasktm->show(); - slomasktm->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + gamma->hide(); + satur->hide(); + rewei->hide(); + expmasktm->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + gamma->hide(); + satur->hide(); + rewei->hide(); + lapmasktm->hide(); + gammasktm->hide(); + slomasktm->hide(); + // Specific Simple mode widgets are shown in Normal mode + expmasktm->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + gamma->show(); + satur->show(); + rewei->show(); + expmasktm->show(); + lapmasktm->show(); + gammasktm->show(); + slomasktm->show(); } } @@ -909,18 +964,18 @@ void LocallabRetinex::getMaskView(int &colorMask, int &colorMaskinv, int &expMas void LocallabRetinex::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { + loglin->set_tooltip_text(M("TP_LOCALLAB_RETI_LOGLIN_TOOLTIP")); sensih->set_tooltip_text(M("TP_LOCALLAB_SENSIH_TOOLTIP")); fftwreti->set_tooltip_text(M("TP_LOCALLAB_RETI_FFTW_TOOLTIP")); - loglin->set_tooltip_text(M("TP_LOCALLAB_RETI_LOGLIN_TOOLTIP")); + equilret->set_tooltip_text(M("TP_LOCALLAB_EQUILTM_TOOLTIP")); + neigh->set_tooltip_text(M("TP_LOCALLAB_RETI_NEIGH_VART_TOOLTIP")); + vart->set_tooltip_text(M("TP_LOCALLAB_RETI_NEIGH_VART_TOOLTIP")); scalereti->set_tooltip_text(M("TP_LOCALLAB_RETI_SCALE_TOOLTIP")); limd->set_tooltip_text(M("TP_LOCALLAB_RETI_LIMDOFFS_TOOLTIP")); offs->set_tooltip_text(M("TP_LOCALLAB_RETI_LIMDOFFS_TOOLTIP")); - cliptm->set_tooltip_text(M("TP_LOCALLAB_RETI_LIMDOFFS_TOOLTIP")); - lightnessreti->set_tooltip_text(M("TP_LOCALLAB_RETI_LIGHTDARK_TOOLTIP")); darkness->set_tooltip_text(M("TP_LOCALLAB_RETI_LIGHTDARK_TOOLTIP")); - neigh->set_tooltip_text(M("TP_LOCALLAB_RETI_NEIGH_VART_TOOLTIP")); - vart->set_tooltip_text(M("TP_LOCALLAB_RETI_NEIGH_VART_TOOLTIP")); - equilret->set_tooltip_text(M("TP_LOCALLAB_EQUILTM_TOOLTIP")); + lightnessreti->set_tooltip_text(M("TP_LOCALLAB_RETI_LIGHTDARK_TOOLTIP")); + cliptm->set_tooltip_text(M("TP_LOCALLAB_RETI_LIMDOFFS_TOOLTIP")); softradiusret->set_tooltip_text(M("TP_LOCALLAB_GUIDFILTER_TOOLTIP")); cTtransshape->setTooltip(M("TP_LOCALLAB_TRANSMISSION_TOOLTIP")); mMLabels->set_tooltip_markup(M("TP_LOCALLAB_MLABEL_TOOLTIP")); @@ -931,14 +986,40 @@ void LocallabRetinex::updateAdviceTooltips(const bool showTooltips) CCmaskretishape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmaskretishape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmaskretishape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + blendmaskreti->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); radmaskreti->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); lapmaskreti->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); - Lmaskretishape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); - blendmaskreti->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); mask2retiCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); - } else { - exp->set_tooltip_text(""); - } + Lmaskretishape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); + } else { + loglin->set_tooltip_text(""); + sensih->set_tooltip_text(""); + fftwreti->set_tooltip_text(""); + equilret->set_tooltip_text(""); + neigh->set_tooltip_text(""); + vart->set_tooltip_text(""); + scalereti->set_tooltip_text(""); + limd->set_tooltip_text(""); + offs->set_tooltip_text(""); + darkness->set_tooltip_text(""); + lightnessreti->set_tooltip_text(""); + cliptm->set_tooltip_text(""); + softradiusret->set_tooltip_text(""); + cTtransshape->setTooltip(""); + mMLabels->set_tooltip_text(""); + transLabels->set_tooltip_text(""); + cTgainshape->setTooltip(""); + expmaskreti->set_tooltip_text(""); + enaretiMasktmap->set_tooltip_text(""); + CCmaskretishape->setTooltip(""); + LLmaskretishape->setTooltip(""); + HHmaskretishape->setTooltip(""); + blendmaskreti->set_tooltip_text(""); + radmaskreti->set_tooltip_text(""); + lapmaskreti->set_tooltip_text(""); + mask2retiCurveEditorG->set_tooltip_text(""); + Lmaskretishape->setTooltip(""); + } } void LocallabRetinex::setDefaultExpanderVisibility() @@ -1397,6 +1478,7 @@ void LocallabRetinex::convertParamToNormal() softradiusret->setValue(defSpot.softradiusret); cTtransshape->setCurve(defSpot.localTtranscurve); cTgainshape->setCurve(defSpot.localTgaincurve); + showmaskretiMethod->set_active(0); enaretiMask->set_active(defSpot.enaretiMask); enaretiMasktmap->set_active(defSpot.enaretiMasktmap); CCmaskretishape->setCurve(defSpot.CCmaskreticurve); @@ -1423,16 +1505,45 @@ void LocallabRetinex::convertParamToNormal() updateRetinexGUI3(); } +void LocallabRetinex::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + lumonly->set_active(defSpot.lumonly); + + // Enable all listeners + enableListener(); +} + void LocallabRetinex::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - retiFrame->hide(); - retitoolFrame->hide(); - } else { - // Advanced widgets are shown in Expert mode - retiFrame->show(); - retitoolFrame->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + lumonly->hide(); + retiFrame->hide(); + retitoolFrame->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + retiFrame->hide(); + retitoolFrame->hide(); + // Specific Simple mode widgets are shown in Normal mode + lumonly->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + lumonly->show(); + retiFrame->show(); + retitoolFrame->show(); } } @@ -1567,9 +1678,18 @@ void LocallabRetinex::enaretiMasktmapChanged() void LocallabRetinex::inversretChanged() { + const bool maskPreviewActivated = isMaskViewActive(); + // Update Retinex GUI according to inversret button state updateRetinexGUI2(); + if (maskPreviewActivated) { + // This event is called to transmit reset mask state + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } + } + if (isLocActivated && exp->getEnabled()) { if (listener) { if (inversret->get_active()) { @@ -1604,6 +1724,9 @@ void LocallabRetinex::updateRetinexGUI2() // Update Retinex GUI according to inversret button state if (inversret->get_active()) { expmaskreti->hide(); + showmaskretiMethodConn.block(true); + showmaskretiMethod->set_active(0); + showmaskretiMethodConn.block(false); } else { expmaskreti->show(); } @@ -1631,6 +1754,7 @@ LocallabSharp::LocallabSharp(): sharradius(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHARRADIUS"), 0.4, 2.5, 0.01, 0.75))), sensisha(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 40))), inverssha(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), + sharFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHARFRAME")))), showmasksharMethod(Gtk::manage(new MyComboBoxText())) { // Parameter Sharpening specific widgets @@ -1666,7 +1790,6 @@ LocallabSharp::LocallabSharp(): pack_start(*shariter); pack_start(*sensisha); pack_start(*inverssha); - Gtk::Frame* const sharFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHARFRAME"))); sharFrame->set_label_align(0.025, 0.5); ToolParamBlock* const sharfBox = Gtk::manage(new ToolParamBlock()); sharfBox->pack_start(*showmasksharMethod); @@ -1698,6 +1821,7 @@ void LocallabSharp::updateAdviceTooltips(const bool showTooltips) sensisha->set_tooltip_text(M("TP_LOCALLAB_SENSIS_TOOLTIP")); } else { exp->set_tooltip_text(""); + sensisha->set_tooltip_text(""); } } @@ -1874,31 +1998,66 @@ void LocallabSharp::convertParamToNormal() disableListener(); // Set hidden GUI widgets in Normal mode to default spot values - shardamping->setValue((double)defSpot.shardamping); - shariter->setValue((double)defSpot.shariter); + sharcontrast->setValue((double)defSpot.sharcontrast); sharblur->setValue(defSpot.sharblur); sharamount->setValue(defSpot.sharamount); + shardamping->setValue((double)defSpot.shardamping); + shariter->setValue((double)defSpot.shariter); // Enable all listeners enableListener(); } +void LocallabSharp::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + showmasksharMethod->set_active(0); + + // Enable all listeners + enableListener(); + + // Update GUI based on converted widget parameters: +} + void LocallabSharp::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - shardamping->hide(); - shariter->hide(); - sharblur->hide(); - sharcontrast->hide(); - sharamount->hide(); - } else { - // Advanced widgets are shown in Expert mode - shardamping->show(); - shariter->show(); - sharblur->hide(); - sharcontrast->hide(); - sharamount->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + sharcontrast->hide(); + sharblur->hide(); + sharamount->hide(); + shardamping->hide(); + shariter->hide(); + sharFrame->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + sharcontrast->hide(); + sharblur->hide(); + sharamount->hide(); + shardamping->hide(); + shariter->hide(); + // Specific Simple mode widgets are shown in Normal mode + sharFrame->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + sharcontrast->show(); + sharblur->show(); + sharamount->show(); + shardamping->show(); + shariter->show(); + sharFrame->show(); } } @@ -1943,8 +2102,8 @@ LocallabContrast::LocallabContrast(): sigmalc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMAWAV"), 0.2, 2.5, 0.01, 1.))), LocalcurveEditorwav(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAV"))), wavshape(static_cast(LocalcurveEditorwav->addCurve(CT_Flat, "", nullptr, false, false))), - levelwav(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LEVELWAV"), 1, 9, 1, 4))), csThreshold(Gtk::manage(new ThresholdAdjuster(M("TP_LOCALLAB_CSTHRESHOLD"), 0, 9, 0, 0, 6, 6, 0, false))), + levelwav(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LEVELWAV"), 1, 9, 1, 4))), expresidpyr(Gtk::manage(new MyExpander(false, Gtk::manage(new Gtk::HBox())))), residcont(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDCONT"), -100, 100, 1, 0))), residchro(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDCHRO"), -100., 100., 1., 0.))), @@ -2048,10 +2207,10 @@ LocallabContrast::LocallabContrast(): LocalcurveEditorwav->curveListComplete(); - levelwav->setAdjusterListener(this); - csThreshold->setAdjusterListener(this); + levelwav->setAdjusterListener(this); + Gtk::HBox* const LresTitleHBox = Gtk::manage(new Gtk::HBox()); Gtk::Label* const LresLabel = Gtk::manage(new Gtk::Label()); LresLabel->set_markup(Glib::ustring("") + escapeHtmlChars(M("TP_LOCALLAB_LOC_RESIDPYR")) + Glib::ustring("")); @@ -2251,7 +2410,6 @@ LocallabContrast::LocallabContrast(): blendmasklc->setAdjusterListener(this); - // radmasklc->setLogScale(10, -10); radmasklc->setAdjusterListener(this); chromasklc->setAdjusterListener(this); @@ -2265,28 +2423,23 @@ LocallabContrast::LocallabContrast(): mask2lcCurveEditorG->curveListComplete(); // Add Local contrast specific widgets to GUI - ToolParamBlock* const coBox = Gtk::manage(new ToolParamBlock()); - coBox->pack_start(*sigmalc); - coBox->pack_start(*LocalcurveEditorwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - // pack_start(*levelwav); - coBox->pack_start(*csThreshold); - contFrame->add(*coBox); - pack_start(*localcontMethod); pack_start(*lcradius); pack_start(*lcamount); pack_start(*lcdarkness); pack_start(*lclightness); - pack_start(*contFrame); -// pack_start(*sigmalc); -// pack_start(*LocalcurveEditorwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + ToolParamBlock* const coBox = Gtk::manage(new ToolParamBlock()); + coBox->pack_start(*sigmalc); + coBox->pack_start(*LocalcurveEditorwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + coBox->pack_start(*csThreshold); + contFrame->add(*coBox); + pack_start(*contFrame); // pack_start(*levelwav); -// pack_start(*csThreshold); - Gtk::Frame* const shresFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHRESFRA"))); - shresFrame->set_label_align(0.025, 0.5); ToolParamBlock* const resiBox = Gtk::manage(new ToolParamBlock()); resiBox->pack_start(*residcont); resiBox->pack_start(*residchro); + Gtk::Frame* const shresFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHRESFRA"))); + shresFrame->set_label_align(0.025, 0.5); ToolParamBlock* const shresBox = Gtk::manage(new ToolParamBlock()); shresBox->pack_start(*residsha); shresBox->pack_start(*residshathr); @@ -2366,22 +2519,22 @@ LocallabContrast::LocallabContrast(): expcontrastpyr->add(*blurcontBox, false); pack_start(*expcontrastpyr); ToolParamBlock* const blurcontBox2 = Gtk::manage(new ToolParamBlock()); - Gtk::Frame* const contFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CONTFRA"))); - contFrame->set_label_align(0.025, 0.5); + Gtk::Frame* const contFrame2 = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CONTFRA"))); + contFrame2->set_label_align(0.025, 0.5); + contFrame2->set_label_widget(*wavcont); Gtk::VBox* const contlevBox = Gtk::manage(new Gtk::VBox()); contlevBox->set_spacing(2); - contFrame->set_label_widget(*wavcont); contlevBox->pack_start(*sigma); contlevBox->pack_start(*offset); contlevBox->pack_start(*chromalev); contlevBox->pack_start(*LocalcurveEditorwavcon, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - contFrame->add(*contlevBox); - blurcontBox2->pack_start(*contFrame); + contFrame2->add(*contlevBox); + blurcontBox2->pack_start(*contFrame2); Gtk::Frame* const compreFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_COMPREFRA"))); compreFrame->set_label_align(0.025, 0.5); + compreFrame->set_label_widget(*wavcompre); Gtk::VBox* const compreBox = Gtk::manage(new Gtk::VBox()); compreBox->set_spacing(2); - compreFrame->set_label_widget(*wavcompre); compreBox->pack_start(*LocalcurveEditorwavcompre, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor compreBox->pack_start(*sigmadr); compreBox->pack_start(*threswav); @@ -2390,9 +2543,9 @@ LocallabContrast::LocallabContrast(): blurcontBox2->pack_start(*compreFrame); Gtk::Frame* const compFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_COMPFRA"))); compFrame->set_label_align(0.025, 0.5); + compFrame->set_label_widget(*wavcomp); Gtk::VBox* const compBox = Gtk::manage(new Gtk::VBox()); compBox->set_spacing(2); - compFrame->set_label_widget(*wavcomp); compBox->pack_start(*sigmadc); compBox->pack_start(*deltad); compBox->pack_start(*LocalcurveEditorwavcomp, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor @@ -2449,30 +2602,52 @@ void LocallabContrast::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { contFrame->set_tooltip_text(M("TP_LOCALLAB_EXPCONTRAST_TOOLTIP")); - levelwav->set_tooltip_markup(M("TP_LOCALLAB_LEVELWAV_TOOLTIP")); LocalcurveEditorwav->set_tooltip_markup(M("TP_LOCALLAB_LEVELLOCCONTRAST_TOOLTIP")); - wavgradl->set_tooltip_text(M("TP_LOCALLAB_WAVGRAD_TOOLTIP")); + levelwav->set_tooltip_markup(M("TP_LOCALLAB_LEVELWAV_TOOLTIP")); clariFrame->set_tooltip_markup(M("TP_LOCALLAB_CLARI_TOOLTIP")); clarisoft->set_tooltip_markup(M("TP_LOCALLAB_CLARISOFT_TOOLTIP")); + expcontrastpyr->set_tooltip_text(M("TP_LOCALLAB_EXPCONTRASTPYR_TOOLTIP")); + wavgradl->set_tooltip_text(M("TP_LOCALLAB_WAVGRAD_TOOLTIP")); wavedg->set_tooltip_text(M("TP_LOCALLAB_WAVEEDG_TOOLTIP")); wavblur->set_tooltip_text(M("TP_LOCALLAB_WAVBLUR_TOOLTIP")); + chromablu->set_tooltip_text(M("TP_LOCALLAB_CHROMABLU_TOOLTIP")); + expcontrastpyr2->set_tooltip_text(M("TP_LOCALLAB_EXPCONTRASTPYR_TOOLTIP")); wavcont->set_tooltip_text(M("TP_LOCALLAB_WAVCONTF_TOOLTIP")); + chromalev->set_tooltip_text(M("TP_LOCALLAB_CHROMABLU_TOOLTIP")); wavcompre->set_tooltip_text(M("TP_LOCALLAB_WAVCOMPRE_TOOLTIP")); wavcomp->set_tooltip_text(M("TP_LOCALLAB_WAVCOMP_TOOLTIP")); - chromablu->set_tooltip_text(M("TP_LOCALLAB_CHROMABLU_TOOLTIP")); - chromalev->set_tooltip_text(M("TP_LOCALLAB_CHROMABLU_TOOLTIP")); fftwlc->set_tooltip_text(M("TP_LOCALLAB_LC_FFTW_TOOLTIP")); expmasklc->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP")); CCmasklcshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmasklcshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmasklcshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); - Lmasklcshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); - expcontrastpyr->set_tooltip_text(M("TP_LOCALLAB_EXPCONTRASTPYR_TOOLTIP")); - expcontrastpyr2->set_tooltip_text(M("TP_LOCALLAB_EXPCONTRASTPYR_TOOLTIP")); blendmasklc->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); mask2lcCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); + Lmasklcshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); } else { - exp->set_tooltip_text(""); + contFrame->set_tooltip_text(""); + LocalcurveEditorwav->set_tooltip_text(""); + levelwav->set_tooltip_text(""); + clariFrame->set_tooltip_text(""); + clarisoft->set_tooltip_text(""); + expcontrastpyr->set_tooltip_text(""); + wavgradl->set_tooltip_text(""); + wavedg->set_tooltip_text(""); + wavblur->set_tooltip_text(""); + chromablu->set_tooltip_text(""); + expcontrastpyr2->set_tooltip_text(""); + wavcont->set_tooltip_text(""); + chromalev->set_tooltip_text(""); + wavcompre->set_tooltip_text(""); + wavcomp->set_tooltip_text(""); + fftwlc->set_tooltip_text(""); + expmasklc->set_tooltip_text(""); + CCmasklcshape->setTooltip(""); + LLmasklcshape->setTooltip(""); + HHmasklcshape->setTooltip(""); + blendmasklc->set_tooltip_text(""); + mask2lcCurveEditorG->set_tooltip_text(""); + Lmasklcshape->setTooltip(""); } } @@ -2551,7 +2726,7 @@ void LocallabContrast::read(const rtengine::procparams::ProcParams* pp, const Pa fftwlc->set_active(spot.fftwlc); // Update Local contrast GUI according to fftwlc button state - // Note: Contrary to the others, shall be called before setting 'lcradius' value + // Note: Contrary to the others, shall be called before setting lcradius value updateContrastGUI3(); lcradius->setValue((double)spot.lcradius); lcamount->setValue(spot.lcamount); @@ -2559,8 +2734,8 @@ void LocallabContrast::read(const rtengine::procparams::ProcParams* pp, const Pa lclightness->setValue(spot.lclightness); sigmalc->setValue(spot.sigmalc); wavshape->setCurve(spot.locwavcurve); - levelwav->setValue((double)spot.levelwav); csThreshold->setValue(spot.csthreshold); + levelwav->setValue((double)spot.levelwav); residcont->setValue(spot.residcont); residchro->setValue(spot.residchro); residsha->setValue(spot.residsha); @@ -2676,8 +2851,8 @@ void LocallabContrast::write(rtengine::procparams::ProcParams* pp, ParamsEdited* spot.lclightness = lclightness->getValue(); spot.sigmalc = sigmalc->getValue(); spot.locwavcurve = wavshape->getCurve(); - spot.levelwav = levelwav->getIntValue(); spot.csthreshold = csThreshold->getValue(); + spot.levelwav = levelwav->getIntValue(); spot.residcont = residcont->getValue(); spot.residchro = residchro->getValue(); spot.residsha = residsha->getValue(); @@ -3239,13 +3414,96 @@ void LocallabContrast::convertParamToNormal() disableListener(); // Set hidden GUI widgets in Normal mode to default spot values + origlc->set_active(defSpot.origlc); + wavgradl->set_active(defSpot.wavgradl); + sigmalc2->setValue(defSpot.sigmalc2); + strwav->setValue(defSpot.strwav); + angwav->setValue(defSpot.angwav); + wavedg->set_active(defSpot.wavedg); + strengthw->setValue(defSpot.strengthw); + sigmaed->setValue(defSpot.sigmaed); + wavshapeedg->setCurve(defSpot.locedgwavcurve); + gradw->setValue(defSpot.gradw); + waveshow->set_active(defSpot.waveshow); + radiusw->setValue(defSpot.radiusw); + detailw->setValue(defSpot.detailw); + + if (defSpot.localedgMethod == "fir") { + localedgMethod->set_active(0); + } else if (defSpot.localedgMethod == "sec") { + localedgMethod->set_active(1); + } else if (defSpot.localedgMethod == "thr") { + localedgMethod->set_active(2); + } + + tloww->setValue(defSpot.tloww); + thigw->setValue(defSpot.thigw); + edgw->setValue(defSpot.edgw); + basew->setValue(defSpot.basew); + + if (defSpot.localneiMethod == "none") { + localneiMethod->set_active(0); + } else if (defSpot.localneiMethod == "low") { + localneiMethod->set_active(1); + } else if (defSpot.localneiMethod == "high") { + localneiMethod->set_active(2); + } + + wavblur->set_active(defSpot.wavblur); + levelblur->setValue(defSpot.levelblur); + sigmabl->setValue(defSpot.sigmabl); + chromablu->setValue(defSpot.chromablu); + wavshapelev->setCurve(defSpot.loclevwavcurve); + residblur->setValue(defSpot.residblur); + blurlc->set_active(defSpot.blurlc); + wavcont->set_active(defSpot.wavcont); + sigma->setValue(defSpot.sigma); + offset->setValue(defSpot.offset); + chromalev->setValue(defSpot.chromalev); + wavshapecon->setCurve(defSpot.locconwavcurve); + wavcompre->set_active(defSpot.wavcompre); + wavshapecompre->setCurve(defSpot.loccomprewavcurve); + sigmadr->setValue(defSpot.sigmadr); + threswav->setValue(defSpot.threswav); + residcomp->setValue(defSpot.residcomp); + wavcomp->set_active(defSpot.wavcomp); + sigmadc->setValue(defSpot.sigmadc); + deltad->setValue(defSpot.deltad); + wavshapecomp->setCurve(defSpot.loccompwavcurve); + fatres->setValue(defSpot.fatres); + fftwlc->set_active(defSpot.fftwlc); + + // Enable all listeners + enableListener(); + + // Update GUI based on converted widget parameters: + // - Update Local contrast GUI according to fftwlc button state + updateContrastGUI3(); +} + +void LocallabContrast::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values if (defSpot.localcontMethod == "loc") { localcontMethod->set_active(0); } else if (defSpot.localcontMethod == "wav") { localcontMethod->set_active(1); } - fftwlc->set_active(defSpot.fftwlc); + showmasklcMethod->set_active(0); + enalcMask->set_active(defSpot.enalcMask); + CCmasklcshape->setCurve(defSpot.CCmasklccurve); + LLmasklcshape->setCurve(defSpot.LLmasklccurve); + HHmasklcshape->setCurve(defSpot.HHmasklccurve); + blendmasklc->setValue((double)defSpot.blendmasklc); + radmasklc->setValue(defSpot.radmasklc); + chromasklc->setValue(defSpot.chromasklc); + Lmasklcshape->setCurve(defSpot.Lmasklccurve); // Enable all listeners enableListener(); @@ -3253,20 +3511,49 @@ void LocallabContrast::convertParamToNormal() // Update GUI based on converted widget parameters: // - Update Local contrast GUI according to localcontMethod combobox value updateContrastGUI1(); - // - Update Local contrast GUI according to fftwlc button state - updateContrastGUI3(); } void LocallabContrast::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - localcontMethod->hide(); - fftwlc->hide(); - } else { - // Advanced widgets are shown in Expert mode - localcontMethod->show(); - fftwlc->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + localcontMethod->hide(); + origlc->hide(); + expcontrastpyr->hide(); + expcontrastpyr2->hide(); + fftwlc->hide(); + expmasklc->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + origlc->hide(); + expcontrastpyr->hide(); + expcontrastpyr2->hide(); + fftwlc->hide(); + // Specific Simple mode widgets are shown in Normal mode + localcontMethod->show(); + expmasklc->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + localcontMethod->show(); + origlc->show(); + + if (localcontMethod->get_active_row_number() != 0) { // Keep widgets hidden when localcontMethod is equal to 0 + expcontrastpyr->show(); + expcontrastpyr2->show(); + } + + if (localcontMethod->get_active_row_number() != 1) { // Keep widget hidden when localcontMethod is equal to 1 + fftwlc->show(); + } + + expmasklc->show(); } } @@ -3505,6 +3792,8 @@ void LocallabContrast::enalcMaskChanged() void LocallabContrast::updateContrastGUI1() { + const int mode = complexity->get_active_row_number(); + // Update Local contrast GUI according to localcontMethod combobox value if (localcontMethod->get_active_row_number() == 0) { lcradius->show(); @@ -3512,33 +3801,33 @@ void LocallabContrast::updateContrastGUI1() lcdarkness->show(); lclightness->show(); contFrame->hide(); - sigmalc->hide(); - LocalcurveEditorwav->hide(); levelwav->hide(); - csThreshold->hide(); expresidpyr->hide(); clariFrame->hide(); expcontrastpyr->hide(); expcontrastpyr2->hide(); - fftwlc->show(); + + if (mode == Expert) { // Keep widget hidden in Normal and Simple mode + fftwlc->show(); + } } else if (localcontMethod->get_active_row_number() == 1) { lcradius->hide(); lcamount->hide(); lcdarkness->hide(); lclightness->hide(); contFrame->show(); - sigmalc->show(); - LocalcurveEditorwav->show(); levelwav->show(); - csThreshold->show(); expresidpyr->show(); clariFrame->show(); - expcontrastpyr->show(); - expcontrastpyr2->show(); + + if (mode == Expert) { // Keep widget hidden in Normal and Simple mode + expcontrastpyr->show(); + expcontrastpyr2->show(); + } + fftwlc->hide(); } } - void LocallabContrast::updateContrastGUI2() { // Update Local contrast GUI according to waveshow button state @@ -3568,6 +3857,7 @@ LocallabCBDL::LocallabCBDL(): LocallabTool(this, M("TP_LOCALLAB_CBDL_TOOLNAME"), M("TP_LOCALLAB_CBDL"), true), // CBDL specific widgets + levFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LEVFRA")))), multiplier([]() -> std::array { std::array res = {}; @@ -3587,7 +3877,6 @@ LocallabCBDL::LocallabCBDL(): return res; } ()), - levFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LEVFRA")))), chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0., 1.5, 0.01, 0.))), threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 1., 0.01, 0.2))), clarityml(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARITYML"), 0.1, 100., 0.1, 0.1))), @@ -3664,7 +3953,6 @@ LocallabCBDL::LocallabCBDL(): blendmaskcb->setAdjusterListener(this); - // radmaskcb->setLogScale(10, -10); radmaskcb->setAdjusterListener(this); lapmaskcb->setAdjusterListener(this); @@ -3706,7 +3994,7 @@ LocallabCBDL::LocallabCBDL(): levBox->pack_start(*chromacbdl); levBox->pack_start(*threshold); levFrame->add(*levBox); - pack_start(*levFrame); + pack_start(*levFrame); Gtk::Frame* const residFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_RESID"))); residFrame->set_label_align(0.025, 0.5); ToolParamBlock* const residBox = Gtk::manage(new ToolParamBlock()); @@ -3759,24 +4047,44 @@ void LocallabCBDL::updateAdviceTooltips(const bool showTooltips) { if (showTooltips) { levFrame->set_tooltip_text(M("TP_LOCALLAB_EXPCBDL_TOOLTIP")); + for (const auto adj : multiplier) { adj->set_tooltip_text(M("TP_LOCALLAB_CBDL_ADJ_TOOLTIP")); } - threshold->set_tooltip_text(M("TP_LOCALLAB_CBDL_THRES_TOOLTIP")); + chromacbdl->set_tooltip_text(M("TP_LOCALLAB_CHROMACB_TOOLTIP")); + threshold->set_tooltip_text(M("TP_LOCALLAB_CBDL_THRES_TOOLTIP")); clarityml->set_tooltip_text(M("TP_LOCALLAB_CBDLCLARI_TOOLTIP")); sensicb->set_tooltip_text(M("TP_LOCALLAB_SENSIH_TOOLTIP")); expmaskcb->set_tooltip_markup(M("TP_LOCALLAB_MASK_TOOLTIP")); CCmaskcbshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); LLmaskcbshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); HHmaskcbshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + blendmaskcb->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); radmaskcb->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); lapmaskcb->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); - Lmaskcbshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); - blendmaskcb->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); mask2cbCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); + Lmaskcbshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); } else { - exp->set_tooltip_text(""); + levFrame->set_tooltip_text(""); + + for (const auto adj : multiplier) { + adj->set_tooltip_text(""); + } + + chromacbdl->set_tooltip_text(""); + threshold->set_tooltip_text(""); + clarityml->set_tooltip_text(""); + sensicb->set_tooltip_text(""); + expmaskcb->set_tooltip_text(""); + CCmaskcbshape->setTooltip(""); + LLmaskcbshape->setTooltip(""); + HHmaskcbshape->setTooltip(""); + blendmaskcb->set_tooltip_text(""); + radmaskcb->set_tooltip_text(""); + lapmaskcb->set_tooltip_text(""); + mask2cbCurveEditorG->set_tooltip_text(""); + Lmaskcbshape->setTooltip(""); } } @@ -4089,14 +4397,55 @@ void LocallabCBDL::convertParamToNormal() enableListener(); } +void LocallabCBDL::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + softradiuscb->setValue(defSpot.softradiuscb); + showmaskcbMethod->set_active(0); + enacbMask->set_active(defSpot.enacbMask); + CCmaskcbshape->setCurve(defSpot.CCmaskcbcurve); + LLmaskcbshape->setCurve(defSpot.LLmaskcbcurve); + HHmaskcbshape->setCurve(defSpot.HHmaskcbcurve); + blendmaskcb->setValue((double)defSpot.blendmaskcb); + radmaskcb->setValue(defSpot.radmaskcb); + chromaskcb->setValue(defSpot.chromaskcb); + gammaskcb->setValue(defSpot.gammaskcb); + slomaskcb->setValue(defSpot.slomaskcb); + Lmaskcbshape->setCurve(defSpot.Lmaskcbcurve); + + // Enable all listers + enableListener(); +} + void LocallabCBDL::updateGUIToMode(const modeType new_type) { - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - lapmaskcb->hide(); - } else { - // Advanced widgets are shown in Expert mode - lapmaskcb->show(); + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + softradiuscb->hide(); + expmaskcb->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + lapmaskcb->hide(); + // Specific Simple mode widgets are shown in Normal mode + softradiuscb->show(); + expmaskcb->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + softradiuscb->show(); + expmaskcb->show(); + lapmaskcb->show(); } } @@ -4259,17 +4608,22 @@ void LocallabLog::updateAdviceTooltips(const bool showTooltips) autocompute->set_tooltip_text(M("TP_LOCALLAB_LOGAUTO_TOOLTIP")); blackEv->set_tooltip_text(M("TP_LOCALLAB_LOGBLACKWHEV_TOOLTIP")); whiteEv->set_tooltip_text(M("TP_LOCALLAB_LOGBLACKWHEV_TOOLTIP")); - // Autogray->set_tooltip_text(M("TP_LOCALLAB_LOGAUTOGREY_TOOLTIP")); - Autogray->set_tooltip_text(M("")); sourceGray->set_tooltip_text(M("TP_LOCALLAB_LOGSRCGREY_TOOLTIP")); targetGray->set_tooltip_text(M("TP_LOCALLAB_LOGTARGGREY_TOOLTIP")); - // detail->set_tooltip_text(M("TP_LOCALLAB_LOGDET_TOOLTIP")); - detail->set_tooltip_text(M("")); baselog->set_tooltip_text(M("TP_LOCALLAB_LOGBASE_TOOLTIP")); strlog->set_tooltip_text(M("TP_LOCALLAB_GRADGEN_TOOLTIP")); anglog->set_tooltip_text(M("TP_LOCALLAB_GRADANG_TOOLTIP")); } else { - exp->set_tooltip_text(M("")); + exp->set_tooltip_text(""); + logPFrame->set_tooltip_text(""); + autocompute->set_tooltip_text(""); + blackEv->set_tooltip_text(""); + whiteEv->set_tooltip_text(""); + sourceGray->set_tooltip_text(""); + targetGray->set_tooltip_text(""); + baselog->set_tooltip_text(""); + strlog->set_tooltip_text(""); + anglog->set_tooltip_text(""); } } @@ -4537,12 +4891,10 @@ void LocallabLog::updateLogGUI() blackEv->set_sensitive(false); whiteEv->set_sensitive(false); sourceGray->set_sensitive(false); - // targetGray->set_sensitive(true); } else { blackEv->set_sensitive(true); whiteEv->set_sensitive(true); sourceGray->set_sensitive(true); - // targetGray->set_sensitive(true); } } @@ -4551,19 +4903,17 @@ void LocallabLog::updateLogGUI() LocallabMask::LocallabMask(): LocallabTool(this, M("TP_LOCALLAB_MASKCOM_TOOLNAME"), M("TP_LOCALLAB_MASKCOM"), false), - // Comon mask specific widgets + // Common mask specific widgets sensimask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), blendmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKMASK"), -100., 100., 0.1, -10.))), blendmaskab(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKMASKAB"), -100., 100., 0.1, -10.))), softradiusmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.5, 1.))), - showmask_Method(Gtk::manage(new MyComboBoxText())), enamask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), mask_CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASKCOL"))), CCmask_shape(static_cast(mask_CurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false))), LLmask_shape(static_cast(mask_CurveEditorG->addCurve(CT_Flat, "L(L)", nullptr, false, false))), HHmask_shape(static_cast(mask_CurveEditorG->addCurve(CT_Flat, "LC(H)", nullptr, false, true))), - struFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LABSTRUM")))), strumaskmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUMASKCOL"), 0., 200., 0.1, 0.))), toolmask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TOOLCOL")))), @@ -4571,14 +4921,13 @@ LocallabMask::LocallabMask(): fftmask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FFTCOL_MASK")))), contmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTCOL"), 0., 200., 0.5, 0.))), blurmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURCOL"), 0.2, 100., 0.5, 0.2))), - + toolmaskFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_TOOLMASK")))), radmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 0.))), lapmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LAPMASKCOL"), 0.0, 100.0, 0.1, 0.))), chromask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), gammask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.25, 4.0, 0.01, 1.))), slopmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), shadmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHAMASKCOL"), 0, 100, 1, 0))), - mask_HCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASKH"))), HHhmask_shape(static_cast(mask_HCurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true))), mask2CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), @@ -4589,142 +4938,154 @@ LocallabMask::LocallabMask(): gradFramemask(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GRADFRA")))), str_mask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -2., 2., 0.05, 0.))), ang_mask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180., 180., 0.1, 0.))) - { + const LocallabParams::LocallabSpot defSpot; + // Parameter Mask common specific widgets - const LocallabParams::LocallabSpot defSpot; - - sensimask->setAdjusterListener(this); - blendmask->setLogScale(10, 0); - blendmaskab->setLogScale(10, 0); - blendmask->setAdjusterListener(this); - blendmaskab->setAdjusterListener(this); - // softradiusmask->setLogScale(10, -10); - softradiusmask->setAdjusterListener(this); - showmask_Method->append(M("TP_LOCALLAB_SHOWMNONE")); - showmask_Method->append(M("TP_LOCALLAB_SHOWMODIFMASK")); - showmask_Method->append(M("TP_LOCALLAB_SHOWMASK")); - showmask_Method->append(M("TP_LOCALLAB_SHOWREF")); - showmask_Method->set_active(0); - showmask_Method->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); - showmask_MethodConn = showmask_Method->signal_changed().connect(sigc::mem_fun(*this, &LocallabMask::showmask_MethodChanged)); - enamaskConn = enamask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabMask::enamaskChanged)); - mask_CurveEditorG->setCurveListener(this); + sensimask->setAdjusterListener(this); - CCmask_shape->setIdentityValue(0.); - CCmask_shape->setResetCurve(FlatCurveType(defSpot.CCmask_curve.at(0)), defSpot.CCmask_curve); - CCmask_shape->setBottomBarColorProvider(this, 1); + blendmask->setLogScale(10, 0); + blendmask->setAdjusterListener(this); - LLmask_shape->setIdentityValue(0.); - LLmask_shape->setResetCurve(FlatCurveType(defSpot.LLmask_curve.at(0)), defSpot.LLmask_curve); - LLmask_shape->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + blendmaskab->setLogScale(10, 0); + blendmaskab->setAdjusterListener(this); - HHmask_shape->setIdentityValue(0.); - HHmask_shape->setResetCurve(FlatCurveType(defSpot.HHmask_curve.at(0)), defSpot.HHmask_curve); - HHmask_shape->setCurveColorProvider(this, 2); - HHmask_shape->setBottomBarColorProvider(this, 2); + softradiusmask->setAdjusterListener(this); - mask_CurveEditorG->curveListComplete(); + showmask_Method->append(M("TP_LOCALLAB_SHOWMNONE")); + showmask_Method->append(M("TP_LOCALLAB_SHOWMODIFMASK")); + showmask_Method->append(M("TP_LOCALLAB_SHOWMASK")); + showmask_Method->append(M("TP_LOCALLAB_SHOWREF")); + showmask_Method->set_active(0); + showmask_Method->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); + showmask_MethodConn = showmask_Method->signal_changed().connect(sigc::mem_fun(*this, &LocallabMask::showmask_MethodChanged)); - struFrame->set_label_align(0.025, 0.5); + enamaskConn = enamask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabMask::enamaskChanged)); - strumaskmask->setAdjusterListener(this); + mask_CurveEditorG->setCurveListener(this); - toolmaskConn = toolmask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabMask::toolmaskChanged)); - blurFrame->set_label_align(0.025, 0.5); + CCmask_shape->setIdentityValue(0.); + CCmask_shape->setResetCurve(FlatCurveType(defSpot.CCmask_curve.at(0)), defSpot.CCmask_curve); + CCmask_shape->setBottomBarColorProvider(this, 1); - fftmaskConn = fftmask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabMask::fftmaskChanged)); - contmask->setAdjusterListener(this); + LLmask_shape->setIdentityValue(0.); + LLmask_shape->setResetCurve(FlatCurveType(defSpot.LLmask_curve.at(0)), defSpot.LLmask_curve); + LLmask_shape->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); - blurmask->setAdjusterListener(this); + HHmask_shape->setIdentityValue(0.); + HHmask_shape->setResetCurve(FlatCurveType(defSpot.HHmask_curve.at(0)), defSpot.HHmask_curve); + HHmask_shape->setCurveColorProvider(this, 2); + HHmask_shape->setBottomBarColorProvider(this, 2); - radmask->setAdjusterListener(this); - lapmask->setAdjusterListener(this); - chromask->setAdjusterListener(this); - gammask->setAdjusterListener(this); - slopmask->setAdjusterListener(this); - shadmask->setAdjusterListener(this); + mask_CurveEditorG->curveListComplete(); - mask_HCurveEditorG->setCurveListener(this); + struFrame->set_label_align(0.025, 0.5); - HHhmask_shape->setIdentityValue(0.); - HHhmask_shape->setResetCurve(FlatCurveType(defSpot.HHhmask_curve.at(0)), defSpot.HHhmask_curve); - HHhmask_shape->setCurveColorProvider(this, 2); - HHhmask_shape->setBottomBarColorProvider(this, 2); + strumaskmask->setAdjusterListener(this); - mask_HCurveEditorG->curveListComplete(); + toolmaskConn = toolmask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabMask::toolmaskChanged)); - mask2CurveEditorG->setCurveListener(this); + blurFrame->set_label_align(0.025, 0.5); - Lmask_shape->setResetCurve(DiagonalCurveType(defSpot.Lmask_curve.at(0)), defSpot.Lmask_curve); - Lmask_shape->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); - Lmask_shape->setLeftBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + fftmaskConn = fftmask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabMask::fftmaskChanged)); - mask2CurveEditorG->curveListComplete(); + contmask->setAdjusterListener(this); - mask2CurveEditorGwav->setCurveListener(this); + blurmask->setAdjusterListener(this); - csThresholdmask->setAdjusterListener(this); + toolmaskFrame->set_label_align(0.025, 0.5); - LLmask_shapewav->setIdentityValue(0.); - LLmask_shapewav->setResetCurve(FlatCurveType(defSpot.LLmask_curvewav.at(0)), defSpot.LLmask_curvewav); - LLmask_shapewav->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + radmask->setAdjusterListener(this); - mask2CurveEditorGwav->curveListComplete(); + lapmask->setAdjusterListener(this); - pack_start(*sensimask, Gtk::PACK_SHRINK, 0); - pack_start(*blendmask, Gtk::PACK_SHRINK, 0); - pack_start(*blendmaskab, Gtk::PACK_SHRINK, 0); - pack_start(*softradiusmask, Gtk::PACK_SHRINK, 0); - ToolParamBlock* const maskmaskBox = Gtk::manage(new ToolParamBlock()); - maskmaskBox->pack_start(*showmask_Method, Gtk::PACK_SHRINK, 4); - maskmaskBox->pack_start(*mask_CurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - maskmaskBox->pack_start(*enamask, Gtk::PACK_SHRINK, 0); + chromask->setAdjusterListener(this); - ToolParamBlock* const strumBox = Gtk::manage(new ToolParamBlock()); - strumBox->pack_start(*strumaskmask); - strumBox->pack_start(*toolmask); - - struFrame->add(*strumBox); - maskmaskBox->pack_start(*struFrame, Gtk::PACK_SHRINK, 0); + gammask->setAdjusterListener(this); - ToolParamBlock* const blurmBox = Gtk::manage(new ToolParamBlock()); - blurmBox->pack_start(*fftmask, Gtk::PACK_SHRINK, 0); - blurmBox->pack_start(*contmask); - blurmBox->pack_start(*blurmask); - blurFrame->add(*blurmBox); - maskmaskBox->pack_start(*blurFrame, Gtk::PACK_SHRINK, 0); + slopmask->setAdjusterListener(this); + shadmask->setAdjusterListener(this); - gradFramemask->set_label_align(0.025, 0.5); + mask_HCurveEditorG->setCurveListener(this); - str_mask->setAdjusterListener(this); + HHhmask_shape->setIdentityValue(0.); + HHhmask_shape->setResetCurve(FlatCurveType(defSpot.HHhmask_curve.at(0)), defSpot.HHhmask_curve); + HHhmask_shape->setCurveColorProvider(this, 2); + HHhmask_shape->setBottomBarColorProvider(this, 2); - ang_mask->setAdjusterListener(this); - ang_mask->set_tooltip_text(M("TP_LOCALLAB_GRADANG_TOOLTIP")); - ToolParamBlock* const gradmaskBox = Gtk::manage(new ToolParamBlock()); - gradmaskBox->pack_start(*str_mask); - gradmaskBox->pack_start(*ang_mask); - gradFramemask->add(*gradmaskBox); + mask_HCurveEditorG->curveListComplete(); - Gtk::Frame* const toolmaskFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_TOOLMASK"))); - toolmaskFrame->set_label_align(0.025, 0.5); - ToolParamBlock* const toolmaskBox = Gtk::manage(new ToolParamBlock()); - - toolmaskBox->pack_start(*radmask, Gtk::PACK_SHRINK, 0); - toolmaskBox->pack_start(*lapmask, Gtk::PACK_SHRINK, 0); - toolmaskBox->pack_start(*chromask, Gtk::PACK_SHRINK, 0); - toolmaskBox->pack_start(*gammask, Gtk::PACK_SHRINK, 0); - toolmaskBox->pack_start(*slopmask, Gtk::PACK_SHRINK, 0); - toolmaskBox->pack_start(*shadmask, Gtk::PACK_SHRINK, 0); - toolmaskBox->pack_start(*mask_HCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - toolmaskBox->pack_start(*mask2CurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - toolmaskBox->pack_start(*mask2CurveEditorGwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor - toolmaskBox->pack_start(*csThresholdmask, Gtk::PACK_SHRINK, 0); - toolmaskBox->pack_start(*gradFramemask, Gtk::PACK_SHRINK, 0); - toolmaskFrame->add(*toolmaskBox); - maskmaskBox->pack_start(*toolmaskFrame); - pack_start(*maskmaskBox); + mask2CurveEditorG->setCurveListener(this); + + Lmask_shape->setResetCurve(DiagonalCurveType(defSpot.Lmask_curve.at(0)), defSpot.Lmask_curve); + Lmask_shape->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + Lmask_shape->setLeftBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + + mask2CurveEditorG->curveListComplete(); + + mask2CurveEditorGwav->setCurveListener(this); + + LLmask_shapewav->setIdentityValue(0.); + LLmask_shapewav->setResetCurve(FlatCurveType(defSpot.LLmask_curvewav.at(0)), defSpot.LLmask_curvewav); + LLmask_shapewav->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + + mask2CurveEditorGwav->curveListComplete(); + + csThresholdmask->setAdjusterListener(this); + + gradFramemask->set_label_align(0.025, 0.5); + + str_mask->setAdjusterListener(this); + + ang_mask->setAdjusterListener(this); + ang_mask->set_tooltip_text(M("TP_LOCALLAB_GRADANG_TOOLTIP")); + + // Add Common mask specific widgets to GUI + pack_start(*sensimask); + pack_start(*blendmask); + pack_start(*blendmaskab); + pack_start(*softradiusmask); + pack_start(*showmask_Method); + pack_start(*enamask); + pack_start(*mask_CurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + ToolParamBlock* const strumBox = Gtk::manage(new ToolParamBlock()); + strumBox->pack_start(*strumaskmask); + strumBox->pack_start(*toolmask); + struFrame->add(*strumBox); + pack_start(*struFrame); + ToolParamBlock* const blurmBox = Gtk::manage(new ToolParamBlock()); + blurmBox->pack_start(*fftmask, Gtk::PACK_SHRINK, 0); + blurmBox->pack_start(*contmask); + blurmBox->pack_start(*blurmask); + blurFrame->add(*blurmBox); + pack_start(*blurFrame); + ToolParamBlock* const toolmaskBox = Gtk::manage(new ToolParamBlock()); + toolmaskBox->pack_start(*radmask, Gtk::PACK_SHRINK, 0); + toolmaskBox->pack_start(*lapmask, Gtk::PACK_SHRINK, 0); + toolmaskBox->pack_start(*chromask, Gtk::PACK_SHRINK, 0); + toolmaskBox->pack_start(*gammask, Gtk::PACK_SHRINK, 0); + toolmaskBox->pack_start(*slopmask, Gtk::PACK_SHRINK, 0); + toolmaskBox->pack_start(*shadmask, Gtk::PACK_SHRINK, 0); + toolmaskBox->pack_start(*mask_HCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + toolmaskBox->pack_start(*mask2CurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + toolmaskBox->pack_start(*mask2CurveEditorGwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + toolmaskBox->pack_start(*csThresholdmask, Gtk::PACK_SHRINK, 0); + ToolParamBlock* const gradmaskBox = Gtk::manage(new ToolParamBlock()); + gradmaskBox->pack_start(*str_mask); + gradmaskBox->pack_start(*ang_mask); + gradFramemask->add(*gradmaskBox); + toolmaskBox->pack_start(*gradFramemask, Gtk::PACK_SHRINK, 0); + toolmaskFrame->add(*toolmaskBox); + pack_start(*toolmaskFrame); +} + +LocallabMask::~LocallabMask() +{ + delete mask_CurveEditorG; + delete mask_HCurveEditorG; + delete mask2CurveEditorG; + delete mask2CurveEditorGwav; } bool LocallabMask::isMaskViewActive() @@ -4732,13 +5093,10 @@ bool LocallabMask::isMaskViewActive() return ((showmask_Method->get_active_row_number() != 0)); } - void LocallabMask::resetMaskView() { showmask_MethodConn.block(true); - showmask_Method->set_active(0); - showmask_MethodConn.block(false); } @@ -4758,60 +5116,52 @@ void LocallabMask::updateAdviceTooltips(const bool showTooltips) LLmask_shape->setTooltip(M("TP_LOCALLAB_CURVEEDITORM_CC_TOOLTIP")); HHmask_shape->setTooltip(M("TP_LOCALLAB_CURVEEDITORM_CC_TOOLTIP")); struFrame->set_tooltip_text(M("TP_LOCALLAB_STRUMASK_TOOLTIP")); - mask_HCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_HHMASK_TOOLTIP")); radmask->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); lapmask->set_tooltip_text(M("TP_LOCALLAB_LAPRAD_TOOLTIP")); + mask_HCurveEditorG->set_tooltip_text(M("TP_LOCALLAB_HHMASK_TOOLTIP")); mask2CurveEditorG->set_tooltip_text(M("TP_LOCALLAB_WAVMASK_TOOLTIP")); Lmask_shape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); mask2CurveEditorGwav->set_tooltip_text(M("TP_LOCALLAB_WAVMASK_TOOLTIP")); LLmask_shapewav->setTooltip(M("TP_LOCALLAB_LMASK_LEVEL_TOOLTIP")); } else { - exp->set_tooltip_text(M("")); + exp->set_tooltip_text(""); + sensimask->set_tooltip_text(""); + blendmask->set_tooltip_text(""); + blendmaskab->set_tooltip_text(""); + CCmask_shape->setTooltip(""); + LLmask_shape->setTooltip(""); + HHmask_shape->setTooltip(""); + struFrame->set_tooltip_text(""); + radmask->set_tooltip_text(""); + lapmask->set_tooltip_text(""); + mask_HCurveEditorG->set_tooltip_text(""); + mask2CurveEditorG->set_tooltip_text(""); + Lmask_shape->setTooltip(""); + mask2CurveEditorGwav->set_tooltip_text(""); + LLmask_shapewav->setTooltip(""); } } -LocallabMask::~LocallabMask() -{ - delete mask_CurveEditorG; - delete mask_HCurveEditorG; - delete mask2CurveEditorG; - delete mask2CurveEditorGwav; -} - void LocallabMask::disableListener() { LocallabTool::disableListener(); + showmask_MethodConn.block(true); enamaskConn.block(true); toolmaskConn.block(true); fftmaskConn.block(true); - } void LocallabMask::enableListener() { LocallabTool::enableListener(); + showmask_MethodConn.block(false); enamaskConn.block(false); toolmaskConn.block(false); fftmaskConn.block(false); - } -void LocallabMask::showmask_MethodChanged() -{ - - // If mask preview is activated, deactivate all other tool mask preview - if (locToolListener) { - locToolListener->resetOtherMaskView(this); - } - - if (listener) { - listener->panelChanged(EvlocallabshowmaskMethod, ""); - } -} - - void LocallabMask::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) { // Disable all listeners @@ -4829,35 +5179,34 @@ void LocallabMask::read(const rtengine::procparams::ProcParams* pp, const Params exp->setEnabled(spot.expmask); complexity->set_active(spot.complexmask); - - sensimask->setValue(spot.sensimask); - contmask->setValue(spot.contmask); - updatemaskGUI3(); - blurmask->setValue(spot.blurmask); - + sensimask->setValue((double)spot.sensimask); blendmask->setValue(spot.blendmask); blendmaskab->setValue(spot.blendmaskab); - softradiusmask->setValue(spot.softradiusmask); + softradiusmask->setValue(spot.softradiusmask); enamask->set_active(spot.enamask); CCmask_shape->setCurve(spot.CCmask_curve); LLmask_shape->setCurve(spot.LLmask_curve); HHmask_shape->setCurve(spot.HHmask_curve); strumaskmask->setValue(spot.strumaskmask); toolmask->set_active(spot.toolmask); + fftmask->set_active(spot.fftmask); + contmask->setValue(spot.contmask); + // Update Common mask GUI according to fftmask button state + // Note: Contrary to the others, shall be called before setting blurmask value + updateMaskGUI(); + blurmask->setValue(spot.blurmask); radmask->setValue(spot.radmask); lapmask->setValue(spot.lapmask); chromask->setValue(spot.chromask); gammask->setValue(spot.gammask); slopmask->setValue(spot.slopmask); shadmask->setValue(spot.shadmask); - str_mask->setValue(spot.str_mask); - ang_mask->setValue(spot.ang_mask); HHhmask_shape->setCurve(spot.HHhmask_curve); - fftmask->set_active(spot.fftmask); Lmask_shape->setCurve(spot.Lmask_curve); LLmask_shapewav->setCurve(spot.LLmask_curvewav); csThresholdmask->setValue(spot.csthresholdmask); - + str_mask->setValue((double)spot.str_mask); + ang_mask->setValue((double)spot.ang_mask); } // Enable all listeners @@ -4866,7 +5215,6 @@ void LocallabMask::read(const rtengine::procparams::ProcParams* pp, const Params // Update GUI according to complexity mode updateGUIToMode(static_cast(complexity->get_active_row_number())); - // Note: No need to manage pedited as batch mode is deactivated for Locallab } @@ -4891,44 +5239,26 @@ void LocallabMask::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.HHmask_curve = HHmask_shape->getCurve(); spot.strumaskmask = strumaskmask->getValue(); spot.toolmask = toolmask->get_active(); + spot.fftmask = fftmask->get_active(); + spot.contmask = contmask->getValue(); + spot.blurmask = blurmask->getValue(); spot.radmask = radmask->getValue(); spot.lapmask = lapmask->getValue(); spot.chromask = chromask->getValue(); spot.gammask = gammask->getValue(); spot.slopmask = slopmask->getValue(); spot.shadmask = shadmask->getValue(); - spot.str_mask = str_mask->getIntValue(); - spot.ang_mask = ang_mask->getIntValue(); spot.HHhmask_curve = HHhmask_shape->getCurve(); - spot.fftmask = fftmask->get_active(); - spot.contmask = contmask->getValue(); - spot.blurmask = blurmask->getValue(); spot.Lmask_curve = Lmask_shape->getCurve(); spot.LLmask_curvewav = LLmask_shapewav->getCurve(); spot.csthresholdmask = csThresholdmask->getValue(); - + spot.str_mask = str_mask->getIntValue(); + spot.ang_mask = ang_mask->getIntValue(); } // Note: No need to manage pedited as batch mode is deactivated for Locallab } -void LocallabMask::enamaskChanged() -{ - if (isLocActivated && exp->getEnabled()) { - if (listener) { - if (enamask->get_active()) { - listener->panelChanged(EvLocallabEnaMask, - M("GENERAL_ENABLED") + " (" + escapeHtmlChars(spotName) + ")"); - } else { - listener->panelChanged(EvLocallabEnaMask, - M("GENERAL_DISABLED") + " (" + escapeHtmlChars(spotName) + ")"); - } - } - } -} - - - void LocallabMask::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited) { const int index = defParams->locallab.selspot; @@ -4938,200 +5268,26 @@ void LocallabMask::setDefaults(const rtengine::procparams::ProcParams* defParams // Set default value for adjuster widgets sensimask->setDefault((double)defSpot.sensimask); - strumaskmask->setDefault(defSpot.strumaskmask); - toolmask->set_active(defSpot.toolmask); blendmask->setDefault(defSpot.blendmask); blendmaskab->setDefault(defSpot.blendmaskab); - softradiusmask->setDefault((double)defSpot.softradiusmask); + softradiusmask->setDefault(defSpot.softradiusmask); + strumaskmask->setDefault(defSpot.strumaskmask); + contmask->setDefault(defSpot.contmask); + blurmask->setDefault(defSpot.blurmask); radmask->setDefault(defSpot.radmask); lapmask->setDefault(defSpot.lapmask); chromask->setDefault(defSpot.chromask); - lapmask->setDefault(defSpot.lapmask); + gammask->setDefault(defSpot.lapmask); slopmask->setDefault(defSpot.slopmask); shadmask->setDefault(defSpot.shadmask); - str_mask->setDefault(defSpot.str_mask); - ang_mask->setDefault(defSpot.ang_mask); - HHhmask_shape->setCurve(defSpot.HHhmask_curve); - contmask->setDefault(defSpot.contmask); - blurmask->setDefault(defSpot.blurmask); csThresholdmask->setDefault(defSpot.csthresholdmask); - + str_mask->setDefault((double)defSpot.str_mask); + ang_mask->setDefault((double)defSpot.ang_mask); } // Note: No need to manage pedited as batch mode is deactivated for Locallab } -void LocallabMask::updateGUIToMode(const modeType new_type) -{ - if (new_type == Normal) { - // Advanced widgets are hidden in Normal mode - lapmask->hide(); - gammask->hide(); - slopmask->hide(); - shadmask->hide(); - str_mask->hide(); - ang_mask->hide(); - struFrame->hide(); - blurFrame->hide(); - gradFramemask->hide(); - mask_HCurveEditorG->hide(); -// mask2CurveEditorG->hide(); - mask2CurveEditorGwav->hide(); - csThresholdmask->hide(); - softradiusmask->hide(); - } else { - // Advanced widgets are shown in Expert mode - lapmask->show(); - gammask->show(); - slopmask->show(); - shadmask->show(); - str_mask->show(); - ang_mask->show(); - struFrame->show(); - blurFrame->show(); - gradFramemask->show(); - mask_HCurveEditorG->show(); -// mask2CurveEditorG->show(); - mask2CurveEditorGwav->show(); - csThresholdmask->show(); - softradiusmask->show(); - - } -} - -void LocallabMask::convertParamToNormal() -{ - const LocallabParams::LocallabSpot defSpot; - - // Disable all listeners - disableListener(); - - softradiusmask->setValue(defSpot.softradiusmask); - lapmask->setValue(defSpot.lapmask); - gammask->setValue(defSpot.gammask); - slopmask->setValue(defSpot.slopmask); - shadmask->setValue(defSpot.shadmask); - str_mask->setValue(defSpot.str_mask); - ang_mask->setValue(defSpot.ang_mask); - strumaskmask->setValue(defSpot.strumaskmask); - toolmask->set_active(defSpot.toolmask); - fftmask->set_active(defSpot.fftmask); - blurmask->setValue(defSpot.blurmask); - contmask->setValue(defSpot.contmask); - HHhmask_shape->setCurve(defSpot.HHhmask_curve); -// Lmask_shape->setCurve(defSpot.Lmask_curve); - LLmask_shapewav->setCurve(defSpot.LLmask_curvewav); - csThresholdmask->setValue(defSpot.csthresholdmask); - updatemaskGUI3(); - // Enable all listeners - enableListener(); - -} - -void LocallabMask::updatemaskGUI3() -{ - const double temp = blurmask->getValue(); - - if (fftmask->get_active()) { - blurmask->setLimits(0.2, 1000., 0.5, 0.2); - } else { - blurmask->setLimits(0.2, 100., 0.5, 0.2); - } - - blurmask->setValue(temp); - -} - -void LocallabMask::updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) -{ - idle_register.add( - [this, normHuer, normLumar, normChromar]() -> bool { - GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected - - // Update mask background - CCmask_shape->updateLocallabBackground(normChromar); - LLmask_shape->updateLocallabBackground(normLumar); - HHmask_shape->updateLocallabBackground(normHuer); - HHhmask_shape->updateLocallabBackground(normHuer); - Lmask_shape->updateLocallabBackground(normLumar); - - return false; - } - ); -} - - -void LocallabMask::fftmaskChanged() -{ - updatemaskGUI3(); // Update GUI according to fftmask button state - - if (isLocActivated && exp->getEnabled()) { - if (listener) { - if (fftmask->get_active()) { - listener->panelChanged(EvLocallabfftmask, - M("GENERAL_ENABLED") + " (" + escapeHtmlChars(spotName) + ")"); - } else { - listener->panelChanged(EvLocallabfftmask, - M("GENERAL_DISABLED") + " (" + escapeHtmlChars(spotName) + ")"); - } - } - } -} - - - - -void LocallabMask::curveChanged(CurveEditor* ce) -{ - if (isLocActivated && exp->getEnabled()) { - - if (ce == CCmask_shape) { - if (listener) { - listener->panelChanged(EvlocallabCCmask_shape, - M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); - } - } - - if (ce == LLmask_shape) { - if (listener) { - listener->panelChanged(EvlocallabLLmask_shape, - M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); - } - } - - if (ce == HHmask_shape) { - if (listener) { - listener->panelChanged(EvlocallabHHmask_shape, - M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); - } - } - - if (ce == HHhmask_shape) { - if (listener) { - listener->panelChanged(EvlocallabHHhmask_shape, - M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); - } - } - - if (ce == Lmask_shape) { - if (listener) { - listener->panelChanged(EvlocallabLmask_shape, - M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); - } - } - - if (ce == LLmask_shapewav) { - if (listener) { - listener->panelChanged(EvlocallabLLmask_shapewav, - M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); - } - } - - } -} - - - void LocallabMask::adjusterChanged(Adjuster* a, double newval) { if (isLocActivated && exp->getEnabled()) { @@ -5143,6 +5299,27 @@ void LocallabMask::adjusterChanged(Adjuster* a, double newval) } } + if (a == blendmask) { + if (listener) { + listener->panelChanged(Evlocallabblendmask, + blendmask->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == blendmaskab) { + if (listener) { + listener->panelChanged(Evlocallabblendmaskab, + blendmaskab->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == softradiusmask) { + if (listener) { + listener->panelChanged(Evlocallabsoftradiusmask, + softradiusmask->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + if (a == strumaskmask) { if (listener) { listener->panelChanged(Evlocallabstrumaskmask, @@ -5164,28 +5341,6 @@ void LocallabMask::adjusterChanged(Adjuster* a, double newval) } } - - if (a == blendmask) { - if (listener) { - listener->panelChanged(Evlocallabblendmask, - blendmask->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); - } - } - - if (a == blendmaskab) { - if (listener) { - listener->panelChanged(Evlocallabblendmaskab, - blendmaskab->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); - } - } - - if (a == softradiusmask) { - if (listener) { - listener->panelChanged(Evlocallabsoftradiusmask, - softradiusmask->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); - } - } - if (a == radmask) { if (listener) { listener->panelChanged(Evlocallabradmask, @@ -5257,6 +5412,88 @@ void LocallabMask::adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int ne } } +void LocallabMask::curveChanged(CurveEditor* ce) +{ + if (isLocActivated && exp->getEnabled()) { + if (ce == CCmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabCCmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (ce == LLmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabLLmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (ce == HHmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabHHmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (ce == HHhmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabHHhmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (ce == Lmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabLmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (ce == LLmask_shapewav) { + if (listener) { + listener->panelChanged(EvlocallabLLmask_shapewav, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + } +} + +void LocallabMask::complexityModeChanged() +{ + if (complexity->get_active_row_number() == Simple) { // New selected mode is Simple one + // Convert tool widget parameters + convertParamToNormal(); // From Expert mode to Normal mode + convertParamToSimple(); // From Normal mode to Simple mode + // Update GUI based on new mode + updateGUIToMode(Simple); + + if (listener && isLocActivated) { + listener->panelChanged(EvlocallabcomplexityWithRefresh, + M("TP_LOCALLAB_MODE_SIMPLE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } else if (complexity->get_active_row_number() == Normal) { // New selected mode is Normal one + // Convert tool widget parameters + convertParamToNormal(); + // Update GUI based on new mode + updateGUIToMode(Normal); + + if (listener && isLocActivated) { + listener->panelChanged(EvlocallabcomplexityWithRefresh, + M("TP_LOCALLAB_MODE_NORMAL") + " (" + escapeHtmlChars(spotName) + ")"); + } + } else if (complexity->get_active_row_number() == Expert) { // New selected mode is Expert one + // Update GUI based on new mode + updateGUIToMode(Expert); + + if (listener && isLocActivated) { + listener->panelChanged(EvlocallabcomplexityWithRefresh, + M("TP_LOCALLAB_MODE_EXPERT") + " (" + escapeHtmlChars(spotName) + ")"); + } + } +} + void LocallabMask::enabledChanged() { if (isLocActivated) { @@ -5272,6 +5509,146 @@ void LocallabMask::enabledChanged() } } +void LocallabMask::convertParamToNormal() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden GUI widgets in Normal mode to default spot values + softradiusmask->setValue(defSpot.softradiusmask); + strumaskmask->setValue(defSpot.strumaskmask); + toolmask->set_active(defSpot.toolmask); + fftmask->set_active(defSpot.fftmask); + contmask->setValue(defSpot.contmask); + blurmask->setValue(defSpot.blurmask); + lapmask->setValue(defSpot.lapmask); + gammask->setValue(defSpot.gammask); + slopmask->setValue(defSpot.slopmask); + shadmask->setValue(defSpot.shadmask); + HHhmask_shape->setCurve(defSpot.HHhmask_curve); + LLmask_shapewav->setCurve(defSpot.LLmask_curvewav); + csThresholdmask->setValue(defSpot.csthresholdmask); + str_mask->setValue((double)defSpot.str_mask); + ang_mask->setValue((double)defSpot.ang_mask); + + // Enable all listeners + enableListener(); + + // Update GUI based on converted widget parameters: + // - Update Common mask GUI according to fftmask button state + updateMaskGUI(); +} + +void LocallabMask::convertParamToSimple() +{ + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + // Set hidden specific GUI widgets in Simple mode to default spot values + radmask->setValue(defSpot.radmask); + chromask->setValue(defSpot.chromask); + Lmask_shape->setCurve(defSpot.Lmask_curve); + + // Enable all listeners + enableListener(); +} + +void LocallabMask::updateGUIToMode(const modeType new_type) +{ + switch (new_type) { + case Simple: + // Expert and Normal mode widgets are hidden in Simple mode + softradiusmask->hide(); + struFrame->hide(); + blurFrame->hide(); + toolmaskFrame->hide(); + + break; + + case Normal: + // Expert mode widgets are hidden in Normal mode + softradiusmask->hide(); + struFrame->hide(); + blurFrame->hide(); + lapmask->hide(); + gammask->hide(); + slopmask->hide(); + shadmask->hide(); + mask_HCurveEditorG->hide(); + mask2CurveEditorGwav->hide(); + csThresholdmask->hide(); + gradFramemask->hide(); + // Specific Simple mode widgets are shown in Normal mode + toolmaskFrame->show(); + + break; + + case Expert: + // Show widgets hidden in Normal and Simple mode + softradiusmask->hide(); + struFrame->hide(); + blurFrame->hide(); + toolmaskFrame->hide(); + lapmask->hide(); + gammask->hide(); + slopmask->hide(); + shadmask->hide(); + mask_HCurveEditorG->hide(); + mask2CurveEditorGwav->hide(); + csThresholdmask->hide(); + gradFramemask->hide(); + } +} + +void LocallabMask::updateMaskBackground(const double normChromar, const double normLumar, const double normHuer) +{ + idle_register.add( + [this, normHuer, normLumar, normChromar]() -> bool { + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + + // Update mask background + CCmask_shape->updateLocallabBackground(normChromar); + LLmask_shape->updateLocallabBackground(normLumar); + HHmask_shape->updateLocallabBackground(normHuer); + HHhmask_shape->updateLocallabBackground(normHuer); + Lmask_shape->updateLocallabBackground(normLumar); + + return false; + } + ); +} + +void LocallabMask::showmask_MethodChanged() +{ + // If mask preview is activated, deactivate all other tool mask preview + if (locToolListener) { + locToolListener->resetOtherMaskView(this); + } + + if (listener) { + listener->panelChanged(EvlocallabshowmaskMethod, ""); + } +} + +void LocallabMask::enamaskChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (enamask->get_active()) { + listener->panelChanged(EvLocallabEnaMask, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(spotName) + ")"); + } else { + listener->panelChanged(EvLocallabEnaMask, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + } +} + void LocallabMask::toolmaskChanged() { if (isLocActivated && exp->getEnabled()) { @@ -5286,3 +5663,34 @@ void LocallabMask::toolmaskChanged() } } } + +void LocallabMask::fftmaskChanged() +{ + // Update Common mask GUI according to fftmask button state + updateMaskGUI(); + + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (fftmask->get_active()) { + listener->panelChanged(EvLocallabfftmask, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(spotName) + ")"); + } else { + listener->panelChanged(EvLocallabfftmask, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + } +} + +void LocallabMask::updateMaskGUI() +{ + const double temp = blurmask->getValue(); + + if (fftmask->get_active()) { + blurmask->setLimits(0.2, 1000., 0.5, 0.2); + } else { + blurmask->setLimits(0.2, 100., 0.5, 0.2); + } + + blurmask->setValue(temp); +} diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index c60cba070..feef93564 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -832,7 +832,7 @@ int processLineParams ( int argc, char **argv ) } ii->decreaseRef(); - resultImage->free(); + delete resultImage; } if (imgParams) { diff --git a/rtgui/navigator.cc b/rtgui/navigator.cc index 619ea0cfd..9397cfc67 100644 --- a/rtgui/navigator.cc +++ b/rtgui/navigator.cc @@ -26,8 +26,50 @@ using namespace rtengine; -Navigator::Navigator () : currentRGBUnit(options.navRGBUnit), currentHSVUnit(options.navHSVUnit) +Navigator::Navigator() : + pointer_moved_delayed_call(50, 100), + currentRGBUnit(options.navRGBUnit), + currentHSVUnit(options.navHSVUnit) { + pointer_moved_delayed_call.setFunction( + [this](bool validPos, Glib::ustring profile, Glib::ustring profileW, int x, int y, int r, int g, int b, bool isRaw) + { + if (!validPos) { + setInvalid (x, y); + } else { + Glib::ustring s1, s2, s3; + + position->set_text (Glib::ustring::compose ("x: %1, y: %2", x, y)); + + getRGBText (r, g, b, s1, s2, s3, isRaw); + R->set_text (s1); + G->set_text (s2); + B->set_text (s3); + if (isRaw) { + H->set_text ("--"); + S->set_text ("--"); + V->set_text ("--"); + LAB_L->set_text ("--"); + LAB_A->set_text ("--"); + LAB_B->set_text ("--"); + } else { + float h, s, v; + float LAB_a, LAB_b, LAB_l; + Color::rgb2hsv01(r / 255.f, g / 255.f, b / 255.f, h, s, v); + getHSVText (h, s, v, s1, s2, s3); + H->set_text (s1); + S->set_text (s2); + V->set_text (s3); + + Color::rgb2lab01(profile, profileW, r / 255.f, g / 255.f, b / 255.f, LAB_l, LAB_a, LAB_b, options.rtSettings.HistogramWorking); // TODO: Really sure this function works? + getLABText (LAB_l, LAB_a, LAB_b, s1, s2, s3); + LAB_L->set_text (s1); + LAB_A->set_text (s2); + LAB_B->set_text (s3); + } + } + } + ); set_label (M("MAIN_MSG_NAVIGATOR")); Gtk::VBox* mbox = Gtk::manage (new Gtk::VBox ()); @@ -202,6 +244,11 @@ Navigator::Navigator () : currentRGBUnit(options.navRGBUnit), currentHSVUnit(opt show_all (); } +Navigator::~Navigator() +{ + pointer_moved_delayed_call.cancel(); +} + void Navigator::setInvalid (int fullWidth, int fullHeight) { if (fullWidth > 0 && fullHeight > 0) { @@ -278,41 +325,7 @@ void Navigator::getLABText (float l, float a, float b, Glib::ustring &sL, Glib:: // if !validPos then x/y contain the full image size void Navigator::pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw) { - - if (!validPos) { - setInvalid (x, y); - } else { - Glib::ustring s1, s2, s3; - - position->set_text (Glib::ustring::compose ("x: %1, y: %2", x, y)); - - getRGBText (r, g, b, s1, s2, s3, isRaw); - R->set_text (s1); - G->set_text (s2); - B->set_text (s3); - if (isRaw) { - H->set_text ("--"); - S->set_text ("--"); - V->set_text ("--"); - LAB_L->set_text ("--"); - LAB_A->set_text ("--"); - LAB_B->set_text ("--"); - } else { - float h, s, v; - float LAB_a, LAB_b, LAB_l; - Color::rgb2hsv01(r / 255.f, g / 255.f, b / 255.f, h, s, v); - getHSVText (h, s, v, s1, s2, s3); - H->set_text (s1); - S->set_text (s2); - V->set_text (s3); - - Color::rgb2lab01(profile, profileW, r / 255.f, g / 255.f, b / 255.f, LAB_l, LAB_a, LAB_b, options.rtSettings.HistogramWorking); // TODO: Really sure this function works? - getLABText (LAB_l, LAB_a, LAB_b, s1, s2, s3); - LAB_L->set_text (s1); - LAB_A->set_text (s2); - LAB_B->set_text (s3); - } - } + pointer_moved_delayed_call(validPos, profile, profileW, x, y, r, g, b, isRaw); } void Navigator::cycleUnitsRGB (GdkEventButton *event) { diff --git a/rtgui/navigator.h b/rtgui/navigator.h index e9d40e309..4c2a3fd32 100644 --- a/rtgui/navigator.h +++ b/rtgui/navigator.h @@ -20,6 +20,7 @@ #include +#include "delayed.h" #include "options.h" #include "pointermotionlistener.h" @@ -33,6 +34,8 @@ class Navigator final : typedef const double (*TMatrix)[3]; private: + DelayedCall pointer_moved_delayed_call; + Options::NavigatorUnit currentRGBUnit; Options::NavigatorUnit currentHSVUnit; void cycleUnitsRGB (GdkEventButton *event); @@ -53,7 +56,8 @@ protected: public: PreviewWindow* previewWindow; - Navigator (); + Navigator(); + ~Navigator() override; // pointermotionlistener interface // void pointerMoved (bool validPos, int x, int y, int r, int g, int b); diff --git a/rtgui/options.cc b/rtgui/options.cc index 79c62efa7..5e1685b20 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -452,7 +452,7 @@ void Options::setDefaults() histogramDrawMode = 0; histogramScopeType = 0; curvebboxpos = 1; - complexity = 1; + complexity = 2; prevdemo = PD_Sidecar; rgbDenoiseThreadLimit = 0; diff --git a/rtgui/pdsharpening.cc b/rtgui/pdsharpening.cc index 8bbf19620..1b98fd3ac 100644 --- a/rtgui/pdsharpening.cc +++ b/rtgui/pdsharpening.cc @@ -81,10 +81,10 @@ PdSharpening::PdSharpening() : dradiusOffset->setAdjusterListener(this); diter->setAdjusterListener(this); - contrast->delay = std::max(contrast->delay, options.adjusterMaxDelay); - dradius->delay = std::max(dradius->delay, options.adjusterMaxDelay); - dradiusOffset->delay = std::max(dradiusOffset->delay, options.adjusterMaxDelay); - diter->delay = std::max(diter->delay, options.adjusterMaxDelay); + contrast->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); + dradius->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); + dradiusOffset->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); + diter->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); } PdSharpening::~PdSharpening() diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index aba30fbf2..a6a19774b 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -10,8 +10,8 @@ * * RawTherapee is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . @@ -946,7 +946,8 @@ Gtk::Widget* Preferences::getGeneralPanel() setExpandAlignProperties(complexitylocal, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); complexitylocal->append(M("PREFERENCES_COMPLEXITY_EXP")); complexitylocal->append(M("PREFERENCES_COMPLEXITY_NORM")); - complexitylocal->set_active(1); + complexitylocal->append(M("PREFERENCES_COMPLEXITY_SIMP")); + complexitylocal->set_active(2); workflowGrid->attach_next_to(*complexityL, *curveBBoxPosL, Gtk::POS_BOTTOM, 1, 1); workflowGrid->attach_next_to(*complexitylocal, *curveBBoxPosC, Gtk::POS_BOTTOM, 1, 1); diff --git a/rtgui/preprocess.cc b/rtgui/preprocess.cc index 4a663ad07..f33a87a28 100644 --- a/rtgui/preprocess.cc +++ b/rtgui/preprocess.cc @@ -46,9 +46,7 @@ PreProcess::PreProcess () : FoldableToolPanel(this, "preprocess", M("TP_PREPROCE hdThreshold->set_tooltip_markup (M("TP_RAW_HD_TOOLTIP")); hdThreshold->setAdjusterListener (this); - if (hdThreshold->delay < options.adjusterMaxDelay) { - hdThreshold->delay = options.adjusterMaxDelay; - } + hdThreshold->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); hdThreshold->show(); pack_start( *hdThreshold, Gtk::PACK_SHRINK, 4); diff --git a/rtgui/previewhandler.cc b/rtgui/previewhandler.cc index 1dad0676e..76def26b4 100644 --- a/rtgui/previewhandler.cc +++ b/rtgui/previewhandler.cc @@ -110,7 +110,7 @@ void PreviewHandler::delImage(IImage8* i) oldImg->getMutex().unlock(); } - i->free(); + delete i; pih->phandler->previewImgMutex.lock(); pih->phandler->previewImg.clear(); pih->phandler->previewImgMutex.unlock(); diff --git a/rtgui/rawcacorrection.cc b/rtgui/rawcacorrection.cc index 9e5c592ef..58c7995f9 100644 --- a/rtgui/rawcacorrection.cc +++ b/rtgui/rawcacorrection.cc @@ -47,24 +47,18 @@ RAWCACorr::RAWCACorr () : FoldableToolPanel(this, "rawcacorrection", M("TP_RAWCA caAutoiterations->setAdjusterListener (this); caAutoiterations->set_tooltip_markup(M("TP_RAWCACORR_AUTOIT_TOOLTIP")); - if (caAutoiterations->delay < options.adjusterMaxDelay) { - caAutoiterations->delay = options.adjusterMaxDelay; - } + caAutoiterations->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); caRed = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CARED"), -4.0, 4.0, 0.1, 0, icaredL, icaredR)); caRed->setAdjusterListener (this); - if (caRed->delay < options.adjusterMaxDelay) { - caRed->delay = options.adjusterMaxDelay; - } + caRed->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); caRed->show(); caBlue = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CABLUE"), -8.0, 8.0, 0.1, 0, icablueL, icablueR)); caBlue->setAdjusterListener (this); - if (caBlue->delay < options.adjusterMaxDelay) { - caBlue->delay = options.adjusterMaxDelay; - } + caBlue->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); caBlue->show(); diff --git a/rtgui/rawexposure.cc b/rtgui/rawexposure.cc index 7548bf4be..7b5ecabc9 100644 --- a/rtgui/rawexposure.cc +++ b/rtgui/rawexposure.cc @@ -33,9 +33,7 @@ RAWExposure::RAWExposure () : FoldableToolPanel(this, "rawexposure", M("TP_EXPOS PexPos = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_LINEAR"), 0.1, 16.0, 0.01, 1)); PexPos->setAdjusterListener (this); - if (PexPos->delay < options.adjusterMaxDelay) { - PexPos->delay = options.adjusterMaxDelay; - } + PexPos->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); PexPos->show(); pack_start( *PexPos, Gtk::PACK_SHRINK, 4);//exposi diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index feab8e6a5..ec250d69b 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -502,112 +502,58 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL") str->setAdjusterListener (this); - - if (str->delay < 200) { - str->delay = 200; - } + str->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); scal->setAdjusterListener (this); - - if (scal->delay < 200) { - scal->delay = 200; - } + scal->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); iter->setAdjusterListener (this); - - if (iter->delay < 200) { - iter->delay = 200; - } + iter->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); grad->setAdjusterListener (this); - - if (grad->delay < 200) { - grad->delay = 200; - } + grad->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); grads->setAdjusterListener (this); - - if (grads->delay < 200) { - grads->delay = 200; - } + grads->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); gam->setAdjusterListener (this); - - if (gam->delay < 500) { - gam->delay = 500; - } + gam->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay) * 2.5f); slope->setAdjusterListener (this); - - if (slope->delay < 500) { - slope->delay = 500; - } + slope->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay) * 2.5f); neigh->setAdjusterListener (this); - - if (neigh->delay < 200) { - neigh->delay = 200; - } + neigh->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); offs->setAdjusterListener (this); - - if (offs->delay < 200) { - offs->delay = 200; - } + offs->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); vart->setAdjusterListener (this); - - if (vart->delay < 200) { - vart->delay = 200; - } + offs->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); limd->setAdjusterListener (this); - - if (limd->delay < 200) { - limd->delay = 200; - } + limd->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); highl->setAdjusterListener (this); - - if (highl->delay < 200) { - highl->delay = 200; - } + highl->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); radius->setAdjusterListener (this); - - if (radius->delay < 200) { - radius->delay = 200; - } + radius->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); highlights->setAdjusterListener (this); - - if (highlights->delay < 200) { - highlights->delay = 200; - } + highlights->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); h_tonalwidth->setAdjusterListener (this); - - if (h_tonalwidth->delay < 200) { - h_tonalwidth->delay = 200; - } + h_tonalwidth->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); shadows->setAdjusterListener (this); - - if (shadows->delay < 200) { - shadows->delay = 200; - } + shadows->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); s_tonalwidth->setAdjusterListener (this); - - if (s_tonalwidth->delay < 200) { - s_tonalwidth->delay = 200; - } + s_tonalwidth->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); skal->setAdjusterListener (this); - - if (skal->delay < 200) { - skal->delay = 200; - } + skal->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); disableListener(); retinexColorSpaceChanged(); diff --git a/rtgui/sharpenedge.cc b/rtgui/sharpenedge.cc index f4415bb15..552169fc1 100644 --- a/rtgui/sharpenedge.cc +++ b/rtgui/sharpenedge.cc @@ -36,16 +36,12 @@ SharpenEdge::SharpenEdge () : FoldableToolPanel(this, "sharpenedge", M("TP_SHARP passes = Gtk::manage(new Adjuster (M("TP_SHARPENEDGE_PASSES"), 1, 4, 1, 2)); passes->setAdjusterListener (this); - if (passes->delay < options.adjusterMaxDelay) { - passes->delay = options.adjusterMaxDelay; - } + passes->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); amount = Gtk::manage(new Adjuster (M("TP_SHARPENEDGE_AMOUNT"), 0, 100, 1, 50)); amount->setAdjusterListener (this); - if (amount->delay < options.adjusterMaxDelay) { - amount->delay = options.adjusterMaxDelay; - } + amount->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); threechannels = Gtk::manage(new Gtk::CheckButton((M("TP_SHARPENEDGE_THREE"))));// L + a + b threechannels->set_active (false); diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index a371bad88..db63c68be 100644 --- a/rtgui/xtransprocess.cc +++ b/rtgui/xtransprocess.cc @@ -79,9 +79,7 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP dualDemosaicContrast->addAutoButton(M("TP_RAW_DUALDEMOSAICAUTOCONTRAST_TOOLTIP")); dualDemosaicContrast->setAutoValue(true); - if (dualDemosaicContrast->delay < options.adjusterMaxDelay) { - dualDemosaicContrast->delay = options.adjusterMaxDelay; - } + dualDemosaicContrast->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); dualDemosaicContrast->show(); dualDemosaicOptions->pack_start(*dualDemosaicContrast); @@ -91,9 +89,7 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP border = Gtk::manage(new Adjuster(M("TP_RAW_BORDER"), 0, 16, 1, 7)); border->setAdjusterListener (this); - if (border->delay < options.adjusterMaxDelay) { - border->delay = options.adjusterMaxDelay; - } + border->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); border->show(); borderbox->pack_start(*border); @@ -103,9 +99,7 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP ccSteps = Gtk::manage (new Adjuster (M("TP_RAW_FALSECOLOR"), 0, 5, 1, 0 )); ccSteps->setAdjusterListener (this); - if (ccSteps->delay < options.adjusterMaxDelay) { - ccSteps->delay = options.adjusterMaxDelay; - } + ccSteps->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); ccSteps->show(); pack_start( *ccSteps, Gtk::PACK_SHRINK, 4); diff --git a/rtgui/xtransrawexposure.cc b/rtgui/xtransrawexposure.cc index 28059e69c..655a036c7 100644 --- a/rtgui/xtransrawexposure.cc +++ b/rtgui/xtransrawexposure.cc @@ -33,25 +33,19 @@ XTransRAWExposure::XTransRAWExposure () : FoldableToolPanel(this, "xtransrawexpo PexBlackRed = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_RED"), -2048, 2048, 1.0, 0)); //black level PexBlackRed->setAdjusterListener (this); - if (PexBlackRed->delay < options.adjusterMaxDelay) { - PexBlackRed->delay = options.adjusterMaxDelay; - } + PexBlackRed->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); PexBlackRed->show(); PexBlackGreen = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_GREEN"), -2048, 2048, 1.0, 0)); //black level PexBlackGreen->setAdjusterListener (this); - if (PexBlackGreen->delay < options.adjusterMaxDelay) { - PexBlackGreen->delay = options.adjusterMaxDelay; - } + PexBlackGreen->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); PexBlackGreen->show(); PexBlackBlue = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_BLUE"), -2048, 2048, 1.0, 0)); //black level PexBlackBlue->setAdjusterListener (this); - if (PexBlackBlue->delay < options.adjusterMaxDelay) { - PexBlackBlue->delay = options.adjusterMaxDelay; - } + PexBlackBlue->setDelay(std::max(options.adjusterMinDelay, options.adjusterMaxDelay)); PexBlackBlue->show();