1 /* 2 * This file is part of RawTherapee. 3 * 4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com> 5 * 6 * RawTherapee is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * RawTherapee is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 #pragma once 20 21 #include <gtkmm.h> 22 23 #include "adjuster.h" 24 #include "colorprovider.h" 25 #include "curvelistener.h" 26 #include "guiutils.h" 27 #include "toolpanel.h" 28 29 class DiagonalCurveEditor; 30 class CurveEditorGroup; 31 class CurveEditor; 32 33 class ColorAppearance final : 34 public ToolParamBlock, 35 public AdjusterListener, 36 public FoldableToolPanel, 37 public rtengine::AutoCamListener, 38 public CurveListener, 39 public ColorProvider 40 { 41 public: 42 ColorAppearance (); 43 ~ColorAppearance () override; 44 45 void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override; 46 void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override; 47 void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; 48 void setBatchMode (bool batchMode) override; 49 void adjusterChanged (Adjuster* a, double newval) override; 50 void adjusterAutoToggled (Adjuster* a) override; 51 // void adjusterAdapToggled (Adjuster* a, bool newval); 52 void enabledChanged () override; 53 void surroundChanged (); 54 void surrsrcChanged (); 55 void wbmodelChanged (); 56 void algoChanged (); 57 void surrsource_toggled (); 58 void gamut_toggled (); 59 // void badpix_toggled (); 60 void datacie_toggled (); 61 void tonecie_toggled (); 62 // void sharpcie_toggled (); 63 void autoCamChanged (double ccam, double ccamout) override; 64 bool autoCamComputed_ (); 65 void adapCamChanged (double cadap) override; 66 bool adapCamComputed_ (); 67 void ybCamChanged (int yb) override; 68 bool ybCamComputed_ (); 69 70 void curveChanged (CurveEditor* ce) override; 71 void curveMode1Changed (); 72 bool curveMode1Changed_ (); 73 void curveMode2Changed (); 74 bool curveMode2Changed_ (); 75 void curveMode3Changed (); 76 bool curveMode3Changed_ (); 77 void neutral_pressed (); 78 79 void expandCurve (bool isExpanded); 80 bool isCurveExpanded (); 81 void autoOpenCurve () override; 82 83 void setAdjusterBehavior (bool degreeadd, bool adapscenadd, bool adaplumadd, bool badpixsladd, bool jlightadd, bool chromaadd, bool contrastadd, bool rstprotectionadd, bool qbrightadd, bool qcontrastadd, bool schromaadd, bool mchromaadd, bool colorhadd); 84 void trimValues (rtengine::procparams::ProcParams* pp) override; 85 void updateCurveBackgroundHistogram( 86 const LUTu& histToneCurve, 87 const LUTu& histLCurve, 88 const LUTu& histCCurve, 89 const LUTu& histLCAM, 90 const LUTu& histCCAM, 91 const LUTu& histRed, 92 const LUTu& histGreen, 93 const LUTu& histBlue, 94 const LUTu& histLuma, 95 const LUTu& histLRETI 96 ); 97 void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) override; 98 void updateToolState (std::vector<int> &tpOpen); 99 void writeOptions (std::vector<int> &tpOpen); 100 101 private: 102 bool bgTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip); 103 bool srTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip); 104 void foldAllButMe (GdkEventButton* event, MyExpander *expander); 105 106 Glib::RefPtr<Gtk::Tooltip> bgTTips; 107 Glib::RefPtr<Gtk::Tooltip> srTTips; 108 Glib::RefPtr<Gdk::Pixbuf> bgPixbuf; 109 Glib::RefPtr<Gdk::Pixbuf> srPixbuf; 110 111 Adjuster* degree; 112 Adjuster* adapscen; 113 Adjuster* ybscen; 114 Adjuster* adaplum; 115 Adjuster* degreeout; 116 Adjuster* badpixsl; 117 Adjuster* jlight; 118 Adjuster* qbright; 119 Adjuster* chroma; 120 Adjuster* schroma; 121 Adjuster* mchroma; 122 Adjuster* rstprotection; 123 Adjuster* contrast; 124 Adjuster* qcontrast; 125 Adjuster* colorh; 126 Adjuster* tempout; 127 Adjuster* greenout; 128 Adjuster* ybout; 129 Adjuster* tempsc; 130 Adjuster* greensc; 131 132 MyExpander* expadjust; 133 134 MyComboBoxText* toneCurveMode; 135 MyComboBoxText* toneCurveMode2; 136 MyComboBoxText* toneCurveMode3; 137 138 //Adjuster* edge; 139 Gtk::CheckButton* surrsource; 140 Gtk::CheckButton* gamut; 141 // Gtk::CheckButton* badpix; 142 Gtk::CheckButton* datacie; 143 Gtk::CheckButton* tonecie; 144 // Gtk::CheckButton* sharpcie; 145 Gtk::Button* neutral; 146 MyComboBoxText* surrsrc; 147 sigc::connection surrsrcconn; 148 149 MyComboBoxText* surround; 150 sigc::connection surroundconn; 151 MyComboBoxText* wbmodel; 152 sigc::connection wbmodelconn; 153 MyComboBoxText* algo; 154 sigc::connection algoconn; 155 sigc::connection surrconn; 156 sigc::connection gamutconn, datacieconn, tonecieconn /*,badpixconn , sharpcieconn*/; 157 sigc::connection tcmodeconn, tcmode2conn, tcmode3conn, neutralconn; 158 CurveEditorGroup* curveEditorG; 159 CurveEditorGroup* curveEditorG2; 160 CurveEditorGroup* curveEditorG3; 161 162 DiagonalCurveEditor* shape; 163 DiagonalCurveEditor* shape2; 164 DiagonalCurveEditor* shape3; 165 double nextCcam, nextCcamout, nextCadap; 166 int nextYbscn; 167 bool lastAutoDegree; 168 bool lastAutoAdapscen; 169 bool lastAutoDegreeout; 170 bool lastAutoybscen; 171 bool lastsurr; 172 bool lastgamut; 173 bool lastdatacie; 174 bool lasttonecie; 175 176 IdleRegister idle_register; 177 }; 178