From 8aca334bde6d6dbe4592d335b892b5ff4ecbc876 Mon Sep 17 00:00:00 2001 From: DrSlony Date: Thu, 9 Jul 2015 10:44:27 +0200 Subject: [PATCH] The Wavelet sub-tools are now foldable using right-click and memorized upon restart, and the Wavelet main tool is expanded by default --- rtgui/toolpanelcoord.cc | 11 +++++ rtgui/wavelet.cc | 106 ++++++++++++++++++++++++++++++++++++++-- rtgui/wavelet.h | 90 +++++++++++++++++++--------------- 3 files changed, 164 insertions(+), 43 deletions(-) diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index d9dabf971..5ccb3488e 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -440,6 +440,16 @@ void ToolPanelCoordinator::updateToolState() { for (size_t i=0; iset_expanded (options.tpOpen.at(i)); + + size_t sizeWavelet = options.tpOpen.size() - expList.size(); + if(sizeWavelet > 0) { + std::vector temp; + temp.resize(sizeWavelet); + for (size_t i=0; iupdateToolState(temp); + wavelet->setExpanded(true); + } } void ToolPanelCoordinator::readOptions () { @@ -453,6 +463,7 @@ void ToolPanelCoordinator::writeOptions () { options.tpOpen.clear (); for (size_t i=0; iget_expanded ()); + wavelet->writeOptions(options.tpOpen); } diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index fa0c7d030..9e403386a 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -5,7 +5,7 @@ * 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 @@ -18,7 +18,6 @@ */ #include "wavelet.h" -#include #include #include "edit.h" #include "guiutils.h" @@ -27,7 +26,7 @@ using namespace rtengine; using namespace rtengine::procparams; extern Options options; -Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), true, true) { +Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), true, true) { std::vector milestones; CurveListener::setMulti(true); nextnlevel=7.; @@ -56,14 +55,23 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), std::vector defaultCurve; expsettings = new MyExpander (false, M("TP_WAVELET_SETTINGS")); + expsettings->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButSettings) ); expcontrast = new MyExpander (false, M("TP_WAVELET_LEVF")); + expcontrast->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButContrast) ); expchroma = new MyExpander (false, M("TP_WAVELET_LEVCH")); + expchroma->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButChroma) ); exptoning = new MyExpander (false,M("TP_WAVELET_TON")); + exptoning->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButToning) ); expnoise = new MyExpander (false, M("TP_WAVELET_NOISE")); + expnoise->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButNoise) ); expedge = new MyExpander (false, M("TP_WAVELET_EDGE")); + expedge->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButEdge) ); expgamut = new MyExpander (false, M("TP_WAVELET_CONTR")); + expgamut->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButGamut) ); expresid = new MyExpander (false, M("TP_WAVELET_RESID")); + expresid->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButResid) ); expfinal = new MyExpander (false, M("TP_WAVELET_FINAL")); + expfinal->signal_button_release_event().connect_notify( sigc::mem_fun(this, &Wavelet::foldAllButFinal) ); // Wavelet Settings settingsVBox = Gtk::manage (new Gtk::VBox()); @@ -2621,3 +2629,95 @@ void Wavelet::contrastMinusPressed () { } } +void Wavelet::foldAllButSettings (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(expsettings); + } +} + +void Wavelet::foldAllButContrast (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(expcontrast); + } +} + +void Wavelet::foldAllButChroma (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(expchroma); + } +} + +void Wavelet::foldAllButToning (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(exptoning); + } +} + +void Wavelet::foldAllButNoise (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(expnoise); + } +} + +void Wavelet::foldAllButEdge (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(expedge); + } +} + +void Wavelet::foldAllButGamut (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(expgamut); + } +} + +void Wavelet::foldAllButResid (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(expresid); + } +} + +void Wavelet::foldAllButFinal (GdkEventButton* event) { + if (event->button == 3) { + foldAllButOne(expfinal); + } +} + +void Wavelet::foldAllButOne (MyExpander * whichOne) { + expsettings->set_expanded(expsettings == whichOne); + expcontrast->set_expanded(expcontrast == whichOne); + expchroma->set_expanded(expchroma == whichOne); + exptoning->set_expanded(exptoning == whichOne); + expnoise->set_expanded(expnoise == whichOne); + expedge->set_expanded(expedge == whichOne); + expgamut->set_expanded(expgamut == whichOne); + expresid->set_expanded(expresid == whichOne); + expfinal->set_expanded(expfinal == whichOne); +} + +void Wavelet::writeOptions(std::vector &tpOpen) { + tpOpen.push_back (expsettings->get_expanded ()); + tpOpen.push_back (expcontrast->get_expanded ()); + tpOpen.push_back (expchroma->get_expanded ()); + tpOpen.push_back (exptoning->get_expanded ()); + tpOpen.push_back (expnoise->get_expanded ()); + tpOpen.push_back (expedge->get_expanded ()); + tpOpen.push_back (expgamut->get_expanded ()); + tpOpen.push_back (expresid->get_expanded ()); + tpOpen.push_back (expfinal->get_expanded ()); +} + +void Wavelet::updateToolState(std::vector &tpOpen) { + if(tpOpen.size() == 9) { + expsettings->set_expanded(tpOpen.at(0)); + expcontrast->set_expanded(tpOpen.at(1)); + expchroma->set_expanded(tpOpen.at(2)); + exptoning->set_expanded(tpOpen.at(3)); + expnoise->set_expanded(tpOpen.at(4)); + expedge->set_expanded(tpOpen.at(5)); + expgamut->set_expanded(tpOpen.at(6)); + expresid->set_expanded(tpOpen.at(7)); + expfinal->set_expanded(tpOpen.at(8)); + } +} + diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index e9c4cae3e..28f4ef05c 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -69,7 +69,6 @@ protected: Gtk::CheckButton * median; Gtk::CheckButton * medianlev; Gtk::CheckButton * linkedg; -// Gtk::CheckButton * edgreinf; Gtk::CheckButton * cbenab; Gtk::CheckButton * lipst; Gtk::CheckButton * avoid; @@ -225,54 +224,65 @@ protected: double bl; public: - Wavelet (); virtual ~Wavelet (); - void curveChanged (CurveEditor* ce); - void setEditProvider (EditDataProvider *provider); - void autoOpenCurve (); - void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL); - void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL); - void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL); - void setBatchMode (bool batchMode); - void adjusterChanged2 (ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR); - 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); - + bool wavComputed_ (); + void adjusterChanged (ThresholdAdjuster* a, double newBottom, double newTop); void adjusterChanged (Adjuster* a, double newval); - void adjusterChanged (ThresholdAdjuster* a, double newBottom, double newTop); - + void adjusterChanged2 (ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR); + void autoOpenCurve (); + void curveChanged (CurveEditor* ce); + void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL); + 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); + void setBatchMode (bool batchMode); + void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL); + void setEditProvider (EditDataProvider *provider); + void updateToolState(std::vector &tpOpen); + void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL); + void writeOptions(std::vector &tpOpen); + +private: + void foldAllButSettings (GdkEventButton* event); + void foldAllButContrast (GdkEventButton* event); + void foldAllButChroma (GdkEventButton* event); + void foldAllButToning (GdkEventButton* event); + void foldAllButNoise (GdkEventButton* event); + void foldAllButEdge (GdkEventButton* event); + void foldAllButGamut (GdkEventButton* event); + void foldAllButResid (GdkEventButton* event); + void foldAllButFinal (GdkEventButton* event); + void foldAllButOne (MyExpander * whichOne); + + virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); + void BAmethodChanged (); + void BackmethodChanged (); + void CHSLmethodChanged (); + void CHmethodChanged (); + void CLmethodChanged (); + void DirmethodChanged (); + void EDmethodChanged (); + void HSmethodChanged (); + void LmethodChanged (); + void MedgreinfChanged (); + void TMmethodChanged (); + void TilesmethodChanged (); + void avoidToggled (); + void cbenabToggled (); + void contrastMinusPressed (); + void contrastPlusPressed (); + void daubcoeffmethodChanged (); void enabledChanged (); + void linkedgToggled (); + void lipstToggled (); void medianToggled (); void medianlevToggled (); - void linkedgToggled (); - void cbenabToggled (); - void lipstToggled (); - void avoidToggled (); - void tmrToggled (); void neutralPressed (); - void neutralchPressed (); - void contrastPlusPressed (); - void contrastMinusPressed (); - void LmethodChanged (); - void daubcoeffmethodChanged (); - void CHmethodChanged (); - void MedgreinfChanged (); - void CHSLmethodChanged (); - void EDmethodChanged (); - void BAmethodChanged (); - void TMmethodChanged (); - void HSmethodChanged (); - void CLmethodChanged (); - void BackmethodChanged (); - void TilesmethodChanged (); - void DirmethodChanged (); - virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); - void wavChanged (double nlevel); - bool wavComputed_ (); - void updatewavLabel (); void neutral_pressed (); - + void neutralchPressed (); + void tmrToggled (); + void updatewavLabel (); + void wavChanged (double nlevel); }; #endif