diff --git a/rtgui/curveeditor.cc b/rtgui/curveeditor.cc index 65668ee55..8b5f2591a 100644 --- a/rtgui/curveeditor.cc +++ b/rtgui/curveeditor.cc @@ -150,3 +150,16 @@ void CurveEditor::updateBackgroundHistogram (LUTu & hist) { // Then call the curve editor group to eventually update the histogram subGroup->updateBackgroundHistogram (this); } + +// Open up the curve if it has modifications and it's not already opened +// Returns: is it non-linear? +bool CurveEditor::openIfNonlinear() { + bool nonLinear = tempCurve[0] != subGroup->getValLinear(); + + if (nonLinear && !curveType->get_active()) { + // Will toggle the event doing the display + curveType->set_active( true ); + } + + return nonLinear; +} \ No newline at end of file diff --git a/rtgui/curveeditor.h b/rtgui/curveeditor.h index 94632283f..5c6732389 100644 --- a/rtgui/curveeditor.h +++ b/rtgui/curveeditor.h @@ -72,6 +72,9 @@ class CurveEditor { bool isUnChanged (); void setUnChanged (bool uc); void updateBackgroundHistogram (LUTu & hist); + + bool openIfNonlinear(); // Open up the curve if it has modifications and it's not already opened + void setCurve (const std::vector& p); virtual std::vector getCurve () = 0; }; diff --git a/rtgui/curveeditorgroup.h b/rtgui/curveeditorgroup.h index 136f9901b..1a6235522 100644 --- a/rtgui/curveeditorgroup.h +++ b/rtgui/curveeditorgroup.h @@ -95,6 +95,7 @@ protected: public: int getValUnchanged() { return valUnchanged; } + int getValLinear() { return valLinear; } virtual void updateBackgroundHistogram (CurveEditor* ce) {} virtual void setColorProvider (ColorProvider* p) = 0; diff --git a/rtgui/hsvequalizer.cc b/rtgui/hsvequalizer.cc index 15eb35fd4..0b0a1cdff 100644 --- a/rtgui/hsvequalizer.cc +++ b/rtgui/hsvequalizer.cc @@ -64,6 +64,11 @@ void HSVEqualizer::read (const ProcParams* pp, const ParamsEdited* pedited) { sshape->setCurve (pp->hsvequalizer.scurve); vshape->setCurve (pp->hsvequalizer.vcurve); + // Open up the first curve if selected + bool active = hshape->openIfNonlinear(); + if (!active) sshape->openIfNonlinear(); + if (!active) vshape->openIfNonlinear(); + enableListener (); } diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index 8fddcefda..c01738f65 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -132,6 +132,10 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) { ashape->setCurve (pp->labCurve.acurve); bshape->setCurve (pp->labCurve.bcurve); + // Open up the first curve if selected + bool active = lshape->openIfNonlinear(); + if (!active) ashape->openIfNonlinear(); + if (!active) bshape->openIfNonlinear(); enableListener (); } diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 9a77d24ce..c2bfc6b87 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -133,6 +133,8 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) { saturation->setValue (pp->toneCurve.saturation); shape->setCurve (pp->toneCurve.curve); + shape->openIfNonlinear(); + enableListener (); }