1 /* 2 * This file is part of RawTherapee. 3 * 4 * RawTherapee is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * RawTherapee is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. 16 * 17 * 2014 Jacques Desmis <jdesmis@gmail.com> 18 */ 19 20 #pragma once 21 22 #include <gtkmm.h> 23 #include "adjuster.h" 24 #include "toolpanel.h" 25 #include "curvelistener.h" 26 #include "thresholdadjuster.h" 27 #include "colorprovider.h" 28 #include "guiutils.h" 29 30 class CurveEditor; 31 class CurveEditorGroup; 32 class DiagonalCurveEditor; 33 class EditDataProvider; 34 class FlatCurveEditor; 35 36 class Wavelet final : 37 public ToolParamBlock, 38 public ThresholdAdjusterListener, 39 public AdjusterListener, 40 public CurveListener, 41 public ColorProvider, 42 public rtengine::WaveletListener, 43 public FoldableToolPanel 44 { 45 public: 46 Wavelet (); 47 ~Wavelet () override; 48 49 bool wavComputed_ (); 50 void adjusterChanged(Adjuster* a, double newval) override; 51 void autoOpenCurve () override; 52 void curveChanged (CurveEditor* ce) override; 53 void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override; 54 void setAdjusterBehavior (bool multiplieradd, bool thresholdadd, bool threshold2add, bool thresadd, bool chroadd, bool chromaadd, bool contrastadd, bool skinadd, bool reschroadd, bool tmrsadd, bool resconadd, bool resconHadd, bool thradd, bool thrHadd, bool skyadd, bool edgradadd, bool edgvaladd, bool strengthadd, bool gammaadd, bool edgedetectadd, bool edgedetectthradd, bool edgedetectthr2add); 55 void setBatchMode (bool batchMode) override; 56 void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; 57 void setEditProvider (EditDataProvider *provider) override; 58 void updateToolState (std::vector<int> &tpOpen); 59 void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override; 60 void writeOptions (std::vector<int> &tpOpen); 61 62 void adjusterChanged(ThresholdAdjuster* a, double newBottom, double newTop) override; 63 void adjusterChanged(ThresholdAdjuster* a, double newBottomLeft, double newTopLeft, double newBottomRight, double newTopRight) override; 64 void adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop) override; 65 void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override; 66 void adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) override; 67 68 private: 69 void foldAllButMe (GdkEventButton* event, MyExpander *expander); 70 71 void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller) override; 72 void BAmethodChanged (); 73 void NPmethodChanged (); 74 void BackmethodChanged (); 75 void CHSLmethodChanged (); 76 void CHmethodChanged (); 77 void CLmethodChanged (); 78 void DirmethodChanged (); 79 void EDmethodChanged (); 80 void HSmethodChanged (); 81 void LmethodChanged (); 82 void MedgreinfChanged (); 83 void TMmethodChanged (); 84 void TilesmethodChanged (); 85 void avoidToggled (); 86 void cbenabToggled (); 87 void contrastMinusPressed (); 88 void contrastPlusPressed (); 89 void daubcoeffmethodChanged (); 90 void enabledChanged () override; 91 void linkedgToggled (); 92 void lipstToggled (); 93 void medianToggled (); 94 void medianlevToggled (); 95 void neutralPressed (); 96 void neutral_pressed (); 97 void neutralchPressed (); 98 void tmrToggled (); 99 void updatewavLabel (); 100 void wavChanged (double nlevel) override; 101 102 void HSmethodUpdateUI(); 103 void CHmethodUpdateUI(); 104 // void CHSLmethodChangedUI(); 105 void EDmethodUpdateUI(); 106 void NPmethodUpdateUI(); 107 void BAmethodUpdateUI(); 108 void TMmethodUpdateUI(); 109 // void BackmethodUpdateUI(); 110 void CLmethodUpdateUI(); 111 // void TilesmethodUpdateUI(); 112 // void daubcoeffmethodUpdateUI(); 113 // void MedgreinfUpdateUI(); 114 // void DirmethodUpdateUI(); 115 // void LmethodUpdateUI(); 116 void adjusterUpdateUI (Adjuster* a); 117 void enabledUpdateUI (); 118 void medianlevUpdateUI (); 119 void cbenabUpdateUI (); 120 void lipstUpdateUI (); 121 122 void enableToggled(MyExpander *expander); 123 124 CurveEditorGroup* const curveEditorG; 125 126 CurveEditorGroup* const CCWcurveEditorG; 127 CurveEditorGroup* const curveEditorRES; 128 CurveEditorGroup* const curveEditorGAM; 129 Gtk::HSeparator* const separatorNeutral; 130 Gtk::HSeparator* const separatoredge; 131 132 CurveEditorGroup* const opaCurveEditorG; 133 FlatCurveEditor* opacityShapeRG; 134 CurveEditorGroup* const opacityCurveEditorG; 135 FlatCurveEditor* opacityShapeBY; 136 CurveEditorGroup* const opacityCurveEditorW; 137 CurveEditorGroup* const opacityCurveEditorWL; 138 FlatCurveEditor* opacityShape; 139 FlatCurveEditor* opacityShapeWL; 140 FlatCurveEditor* hhshape; 141 FlatCurveEditor* Chshape; 142 DiagonalCurveEditor* clshape; 143 144 FlatCurveEditor* ccshape; 145 Gtk::CheckButton* const median; 146 Gtk::CheckButton* const medianlev; 147 Gtk::CheckButton* const linkedg; 148 Gtk::CheckButton* const cbenab; 149 Gtk::CheckButton* const lipst; 150 Gtk::CheckButton* const avoid; 151 Gtk::CheckButton* const tmr; 152 153 Gtk::Button* const neutralchButton; 154 Adjuster* correction[9]; 155 Adjuster* correctionch[9]; 156 Adjuster* const rescon; 157 Adjuster* const resconH; 158 Adjuster* const reschro; 159 Adjuster* const tmrs; 160 Adjuster* const gamma; 161 Adjuster* const sup; 162 Adjuster* const sky; 163 Adjuster* const thres; 164 Adjuster* const chroma; 165 Adjuster* const chro; 166 Adjuster* const contrast; 167 Adjuster* const thr; 168 Adjuster* const thrH; 169 Adjuster* const skinprotect; 170 Adjuster* const edgrad; 171 Adjuster* const edgval; 172 Adjuster* const edgthresh; 173 Adjuster* const strength; 174 Adjuster* const balance; 175 Adjuster* const iter; 176 Adjuster* greenlow; 177 Adjuster* bluelow; 178 Adjuster* greenmed; 179 Adjuster* bluemed; 180 Adjuster* greenhigh; 181 Adjuster* bluehigh; 182 183 ThresholdAdjuster* const hueskin; 184 ThresholdAdjuster* const hueskin2; 185 ThresholdAdjuster* const hllev; 186 ThresholdAdjuster* const bllev; 187 ThresholdAdjuster* const pastlev; 188 ThresholdAdjuster* const satlev; 189 ThresholdAdjuster* const edgcont; 190 ThresholdAdjuster* const level0noise; 191 ThresholdAdjuster* const level1noise; 192 ThresholdAdjuster* const level2noise; 193 ThresholdAdjuster* const level3noise; 194 195 Adjuster* const threshold; 196 Adjuster* const threshold2; 197 Adjuster* const edgedetect; 198 Adjuster* const edgedetectthr; 199 Adjuster* const edgedetectthr2; 200 Adjuster* const edgesensi; 201 Adjuster* const edgeampli; 202 MyComboBoxText* const Lmethod; 203 sigc::connection Lmethodconn; 204 MyComboBoxText* const CHmethod; 205 sigc::connection CHmethodconn; 206 MyComboBoxText* const CHSLmethod; 207 sigc::connection CHSLmethodconn; 208 MyComboBoxText* const EDmethod; 209 sigc::connection EDmethodconn; 210 MyComboBoxText* const BAmethod; 211 sigc::connection BAmethodconn; 212 MyComboBoxText* const NPmethod; 213 sigc::connection NPmethodconn; 214 MyComboBoxText* const TMmethod; 215 sigc::connection TMmethodconn; 216 MyComboBoxText* const HSmethod; 217 sigc::connection HSmethodconn; 218 MyComboBoxText* const CLmethod; 219 sigc::connection CLmethodconn; 220 MyComboBoxText* const Backmethod; 221 sigc::connection Backmethodconn; 222 MyComboBoxText* const Tilesmethod; 223 sigc::connection Tilesmethodconn; 224 MyComboBoxText* const daubcoeffmethod; 225 sigc::connection daubcoeffmethodconn; 226 MyComboBoxText* const Dirmethod; 227 sigc::connection Dirmethodconn; 228 MyComboBoxText* const Medgreinf; 229 sigc::connection MedgreinfConn; 230 Gtk::Frame* const chanMixerHLFrame; 231 Gtk::Frame* const chanMixerMidFrame; 232 Gtk::Frame* const chanMixerShadowsFrame; 233 234 Gtk::Label* const wavLabels; 235 Gtk::Label* const labmC; 236 Gtk::Label* const labmNP; 237 MyExpander* const expchroma; 238 MyExpander* const expcontrast; 239 MyExpander* const expedge; 240 MyExpander* const expfinal; 241 MyExpander* const expgamut; 242 MyExpander* const expnoise; 243 MyExpander* const expresid; 244 MyExpander* const expsettings; 245 MyExpander* const exptoning; 246 247 Gtk::HBox* const neutrHBox; 248 249 sigc::connection enableChromaConn, enableContrastConn, enableEdgeConn, enableFinalConn; 250 sigc::connection enableNoiseConn, enableResidConn, enableToningConn; 251 sigc::connection medianConn, avoidConn, tmrConn, medianlevConn, linkedgConn, lipstConn, cbenabConn, neutralconn; 252 sigc::connection neutralPressedConn; 253 sigc::connection contrastPlusPressedConn; 254 sigc::connection contrastMinusPressedConn; 255 sigc::connection neutralchPressedConn; 256 257 bool lastmedian, lastmedianlev, lastlinkedg, lastavoid, lastlipst, lasttmr, lastcbenab; 258 int nextnlevel; 259 260 IdleRegister idle_register; 261 }; 262