Auto-open curves on image reopen; see issue #724

This commit is contained in:
Oliver Duis
2011-06-07 19:21:02 +02:00
parent 46e433ed2f
commit 9d939bdf82
6 changed files with 28 additions and 0 deletions

View File

@@ -150,3 +150,16 @@ void CurveEditor::updateBackgroundHistogram (LUTu & hist) {
// Then call the curve editor group to eventually update the histogram // Then call the curve editor group to eventually update the histogram
subGroup->updateBackgroundHistogram (this); 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;
}

View File

@@ -72,6 +72,9 @@ class CurveEditor {
bool isUnChanged (); bool isUnChanged ();
void setUnChanged (bool uc); void setUnChanged (bool uc);
void updateBackgroundHistogram (LUTu & hist); 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<double>& p); void setCurve (const std::vector<double>& p);
virtual std::vector<double> getCurve () = 0; virtual std::vector<double> getCurve () = 0;
}; };

View File

@@ -95,6 +95,7 @@ protected:
public: public:
int getValUnchanged() { return valUnchanged; } int getValUnchanged() { return valUnchanged; }
int getValLinear() { return valLinear; }
virtual void updateBackgroundHistogram (CurveEditor* ce) {} virtual void updateBackgroundHistogram (CurveEditor* ce) {}
virtual void setColorProvider (ColorProvider* p) = 0; virtual void setColorProvider (ColorProvider* p) = 0;

View File

@@ -64,6 +64,11 @@ void HSVEqualizer::read (const ProcParams* pp, const ParamsEdited* pedited) {
sshape->setCurve (pp->hsvequalizer.scurve); sshape->setCurve (pp->hsvequalizer.scurve);
vshape->setCurve (pp->hsvequalizer.vcurve); 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 (); enableListener ();
} }

View File

@@ -132,6 +132,10 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
ashape->setCurve (pp->labCurve.acurve); ashape->setCurve (pp->labCurve.acurve);
bshape->setCurve (pp->labCurve.bcurve); 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 (); enableListener ();
} }

View File

@@ -133,6 +133,8 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
saturation->setValue (pp->toneCurve.saturation); saturation->setValue (pp->toneCurve.saturation);
shape->setCurve (pp->toneCurve.curve); shape->setCurve (pp->toneCurve.curve);
shape->openIfNonlinear();
enableListener (); enableListener ();
} }