Solving issue 1528: "HSV equalizer channels sometimes can't be switched properly"
This commit is contained in:
@@ -332,9 +332,9 @@ void DiagonalCurveEditorSubGroup::switchGUI() {
|
||||
customCurve->setPoints (dCurve->customCurveEd);
|
||||
customCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId());
|
||||
customCurve->setColoredBar(leftBar, bottomBar);
|
||||
customCurve->forceResize();
|
||||
parent->pack_start (*customCurveBox);
|
||||
customCurveBox->check_resize();
|
||||
customCurve->forceResize();
|
||||
break;
|
||||
case (DCT_Parametric):
|
||||
{
|
||||
@@ -362,17 +362,17 @@ void DiagonalCurveEditorSubGroup::switchGUI() {
|
||||
shcSelector->setBgGradient(bgGradient);
|
||||
shcSelector->setMargins( (leftBar ? MyCurve::getBarWidth()+CBAR_MARGIN : RADIUS), RADIUS );
|
||||
paramCurve->setColoredBar(leftBar, NULL);
|
||||
parent->pack_start (*paramCurveBox);
|
||||
paramCurve->forceResize();
|
||||
parent->pack_start (*paramCurveBox);
|
||||
break;
|
||||
}
|
||||
case (DCT_NURBS):
|
||||
NURBSCurve->setPoints (dCurve->NURBSCurveEd);
|
||||
NURBSCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId());
|
||||
NURBSCurve->setColoredBar(leftBar, bottomBar);
|
||||
NURBSCurve->forceResize();
|
||||
parent->pack_start (*NURBSCurveBox);
|
||||
NURBSCurveBox->check_resize();
|
||||
NURBSCurve->forceResize();
|
||||
break;
|
||||
default: // (DCT_Linear, DCT_Unchanged)
|
||||
// ... do nothing
|
||||
@@ -407,13 +407,13 @@ void DiagonalCurveEditorSubGroup::savePressed () {
|
||||
|
||||
int ix = 0;
|
||||
if (p[ix]==(double)(DCT_Linear))
|
||||
f << "Linear\n";
|
||||
f << "Linear" << std::endl;
|
||||
else if (p[ix]==(double)(DCT_Spline))
|
||||
f << "Spline\n";
|
||||
f << "Spline" << std::endl;
|
||||
else if (p[ix]==(double)(DCT_NURBS))
|
||||
f << "NURBS\n";
|
||||
f << "NURBS" << std::endl;
|
||||
else if (p[ix]==(double)(DCT_Parametric))
|
||||
f << "Parametric\n";
|
||||
f << "Parametric" << std::endl;
|
||||
if (p[ix]==(double)(DCT_Parametric)) {
|
||||
ix++;
|
||||
for (unsigned int i=0; i<p.size()-1; i++, ix++)
|
||||
|
@@ -171,9 +171,9 @@ void FlatCurveEditorSubGroup::switchGUI() {
|
||||
CPointsCurve->setPoints (dCurve->controlPointsCurveEd);
|
||||
CPointsCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId());
|
||||
CPointsCurve->setColoredBar(leftBar, bottomBar);
|
||||
CPointsCurve->forceResize();
|
||||
parent->pack_start (*CPointsCurveBox);
|
||||
CPointsCurveBox->check_resize();
|
||||
CPointsCurve->forceResize();
|
||||
break;
|
||||
default: // (DCT_Linear, DCT_Unchanged)
|
||||
// ... do nothing
|
||||
@@ -202,9 +202,9 @@ void FlatCurveEditorSubGroup::savePressed () {
|
||||
|
||||
int ix = 0;
|
||||
if (p[ix]==(double)(FCT_Linear))
|
||||
f << "Linear\n";
|
||||
f << "Linear" << std::endl;
|
||||
else if (p[ix]==(double)(FCT_MinMaxCPoints))
|
||||
f << "ControlPoints\n";
|
||||
f << "ControlPoints" << std::endl;
|
||||
ix++;
|
||||
for (unsigned int i=0; i<p.size()/2; i++, ix+=2)
|
||||
f << p[ix] << ' ' << p[ix+1] << std::endl;
|
||||
|
@@ -35,6 +35,7 @@ MyCurve::MyCurve () : listener(NULL) {
|
||||
colorProvider = NULL;
|
||||
sized = RS_Pending;
|
||||
snapToElmt = -100;
|
||||
curveIsDirty = true;
|
||||
|
||||
set_extension_events(Gdk::EXTENSION_EVENTS_ALL);
|
||||
add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK);
|
||||
|
@@ -81,7 +81,7 @@ class MyCurve : public Gtk::DrawingArea, public BackBuffer, public ColorCaller {
|
||||
* -2 : identity value
|
||||
* -1 : minimum value
|
||||
* [0;1000[ : control point that it's snapped to
|
||||
* >=1000 : moved control point which is snapped to to the line made by it neighbors
|
||||
* >=1000 : moved control point which snaps to the line made by its previous and next point
|
||||
*/
|
||||
int snapToElmt;
|
||||
bool snapTo;
|
||||
@@ -89,6 +89,7 @@ class MyCurve : public Gtk::DrawingArea, public BackBuffer, public ColorCaller {
|
||||
double snapToVal;
|
||||
MyCurveIdleHelper* mcih;
|
||||
enum ResizeState sized;
|
||||
bool curveIsDirty;
|
||||
|
||||
virtual std::vector<double> get_vector (int veclen) = 0;
|
||||
int getGraphMinSize() { return GRAPH_SIZE + RADIUS + 1; }
|
||||
@@ -107,6 +108,7 @@ class MyCurve : public Gtk::DrawingArea, public BackBuffer, public ColorCaller {
|
||||
void updateBackgroundHistogram (LUTu & hist) {return;} ;
|
||||
void forceResize() { sized = RS_Force; }
|
||||
void refresh();
|
||||
void setCurveDirty () { curveIsDirty = true; }
|
||||
void styleChanged (const Glib::RefPtr<Gtk::Style>& style);
|
||||
virtual std::vector<double> getPoints () = 0;
|
||||
virtual void setPoints (const std::vector<double>& p) = 0;
|
||||
|
@@ -126,6 +126,8 @@ void MyDiagonalCurve::interpolate () {
|
||||
curve.x.at(activeParam-1) = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
curveIsDirty = false;
|
||||
}
|
||||
|
||||
void MyDiagonalCurve::draw (int handle) {
|
||||
@@ -138,7 +140,7 @@ void MyDiagonalCurve::draw (int handle) {
|
||||
return;
|
||||
|
||||
// re-calculate curve if dimensions changed
|
||||
if (prevGraphW != graphW || prevGraphH != graphH || int(point.size()) != graphW-2)
|
||||
if (curveIsDirty || prevGraphW != graphW || prevGraphH != graphH || int(point.size()) != graphW-2)
|
||||
interpolate ();
|
||||
|
||||
Gtk::StateType state = !is_sensitive() ? Gtk::STATE_INSENSITIVE : Gtk::STATE_NORMAL;
|
||||
@@ -368,8 +370,10 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) {
|
||||
}
|
||||
sized = RS_Pending;
|
||||
// setDrawRectangle will allocate the backbuffer Surface
|
||||
if (setDrawRectangle(win, 0, 0, get_allocation().get_width(), get_allocation().get_height()))
|
||||
interpolate ();
|
||||
if (setDrawRectangle(win, 0, 0, get_allocation().get_width(), get_allocation().get_height())) {
|
||||
setDirty(true);
|
||||
curveIsDirty = true;
|
||||
}
|
||||
draw (lit_point);
|
||||
GdkRectangle *rectangle = &(event->expose.area);
|
||||
copySurface(win, rectangle);
|
||||
@@ -407,7 +411,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) {
|
||||
curve.x[closest_point] = clampedX;
|
||||
curve.y[closest_point] = clampedY;
|
||||
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
draw (closest_point);
|
||||
notifyListener ();
|
||||
@@ -449,7 +453,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) {
|
||||
if (curve.x.empty()) {
|
||||
curve.x.push_back (0);
|
||||
curve.y.push_back (0);
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
draw (lit_point);
|
||||
}
|
||||
@@ -598,7 +602,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) {
|
||||
|
||||
if (curve.x[grab_point] != prevPosX || curve.y[grab_point] != prevPosY) {
|
||||
// we recalculate the curve only if we have to
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
draw (lit_point);
|
||||
notifyListener ();
|
||||
@@ -751,6 +755,7 @@ void MyDiagonalCurve::setPoints (const std::vector<double>& p) {
|
||||
}
|
||||
activeParam = -1;
|
||||
}
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
queue_draw ();
|
||||
}
|
||||
@@ -818,7 +823,7 @@ void MyDiagonalCurve::reset() {
|
||||
curve.y.at(1) = 1.;
|
||||
grab_point = -1;
|
||||
lit_point = -1;
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
break;
|
||||
case DCT_Parametric :
|
||||
curve.x.resize(7);
|
||||
@@ -833,7 +838,7 @@ void MyDiagonalCurve::reset() {
|
||||
curve.x.at(6) = 0.00;
|
||||
grab_point = -1; // not sure that it's necessary
|
||||
lit_point = -1; // not sure that it's necessary
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@@ -25,8 +25,8 @@ MyFlatCurve::MyFlatCurve () {
|
||||
|
||||
graphW = get_allocation().get_width() - RADIUS * 2;
|
||||
graphH = get_allocation().get_height() - RADIUS * 2;
|
||||
prevGraphW = 0;
|
||||
prevGraphH = 0;
|
||||
prevGraphW = graphW;
|
||||
prevGraphH = graphH;
|
||||
lit_point = -1;
|
||||
closest_point = 0;
|
||||
buttonPressed = false;
|
||||
@@ -78,12 +78,14 @@ void MyFlatCurve::interpolate () {
|
||||
int nbPoints = graphW-2;
|
||||
point.resize (nbPoints);
|
||||
std::vector<double> vector = get_vector (nbPoints);
|
||||
for (int i = 0; i < int(point.size()); ++i) {
|
||||
for (int i = 0; i < nbPoints; ++i) {
|
||||
float currX = float(i)/float(nbPoints-1);
|
||||
point.at(i).setCoords(float(graphX)+1.5f+float(graphW-3)*currX, float(graphY)-1.5f-float(graphH-3)*float(vector.at(i)));
|
||||
}
|
||||
upoint.clear ();
|
||||
lpoint.clear ();
|
||||
|
||||
curveIsDirty = false;
|
||||
}
|
||||
|
||||
void MyFlatCurve::draw () {
|
||||
@@ -96,7 +98,7 @@ void MyFlatCurve::draw () {
|
||||
return;
|
||||
|
||||
// re-calculate curve if dimensions changed
|
||||
if (prevGraphW != graphW || prevGraphH != graphH || (int)point.size() != graphW-2)
|
||||
if (curveIsDirty || prevGraphW != graphW || prevGraphH != graphH || (int)point.size() != graphW-2)
|
||||
interpolate ();
|
||||
|
||||
double innerW = double(graphW-2);
|
||||
@@ -455,8 +457,10 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) {
|
||||
}
|
||||
sized = RS_Pending;
|
||||
// setDrawRectangle will allocate the backbuffer Surface
|
||||
if (setDrawRectangle(win, 0, 0, get_allocation().get_width(), get_allocation().get_height()))
|
||||
interpolate ();
|
||||
if (setDrawRectangle(win, 0, 0, get_allocation().get_width(), get_allocation().get_height())) {
|
||||
setDirty(true);
|
||||
curveIsDirty = true;
|
||||
}
|
||||
draw ();
|
||||
GdkRectangle *rectangle = &(event->expose.area);
|
||||
copySurface(win, rectangle);
|
||||
@@ -506,7 +510,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) {
|
||||
curve.leftTangent[closest_point] = 0.35;
|
||||
curve.rightTangent[closest_point] = 0.35;
|
||||
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
draw ();
|
||||
notifyListener ();
|
||||
@@ -595,7 +599,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) {
|
||||
curve.y.push_back (0.5);
|
||||
curve.leftTangent.push_back (0.3);
|
||||
curve.rightTangent.push_back (0.3);
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -798,7 +802,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) {
|
||||
}
|
||||
|
||||
if (curve.leftTangent[lit_point] != prevValue) {
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
draw ();
|
||||
notifyListener ();
|
||||
@@ -823,7 +827,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) {
|
||||
}
|
||||
|
||||
if (curve.rightTangent[lit_point] != prevValue) {
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
draw ();
|
||||
notifyListener ();
|
||||
@@ -1034,7 +1038,7 @@ void MyFlatCurve::movePoint(bool moveX, bool moveY) {
|
||||
|
||||
if (curve.x[lit_point] != prevPosX || curve.y[lit_point] != prevPosY) {
|
||||
// we recompute the curve only if we have to
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
draw ();
|
||||
notifyListener ();
|
||||
@@ -1216,6 +1220,7 @@ void MyFlatCurve::setPoints (const std::vector<double>& p) {
|
||||
curve.rightTangent.push_back (p[ix++]);
|
||||
}
|
||||
}
|
||||
curveIsDirty = true;
|
||||
setDirty(true);
|
||||
queue_draw ();
|
||||
}
|
||||
@@ -1233,7 +1238,7 @@ void MyFlatCurve::reset() {
|
||||
case FCT_MinMaxCPoints :
|
||||
defaultCurve();
|
||||
lit_point = -1;
|
||||
interpolate ();
|
||||
curveIsDirty = true;
|
||||
break;
|
||||
//case Parametric :
|
||||
// Nothing to do (?)
|
||||
@@ -1246,17 +1251,16 @@ void MyFlatCurve::reset() {
|
||||
|
||||
void MyFlatCurve::defaultCurve () {
|
||||
|
||||
curve.x.clear();
|
||||
curve.y.clear();
|
||||
curve.leftTangent.clear();
|
||||
curve.rightTangent.clear();
|
||||
curve.x.resize(6);
|
||||
curve.y.resize(6);
|
||||
curve.leftTangent.resize(6);
|
||||
curve.rightTangent.resize(6);
|
||||
|
||||
// Point for RGBCMY colors
|
||||
for (int i=0; i<6; i++) {
|
||||
curve.x.push_back((1./6.)*i);
|
||||
curve.y.push_back(0.5);
|
||||
curve.leftTangent.push_back(0.35);
|
||||
curve.rightTangent.push_back(0.35);
|
||||
curve.x.at(i) = (1./6.)*i;
|
||||
curve.y.at(i) = 0.5;
|
||||
curve.leftTangent.at(i) = 0.35;
|
||||
curve.rightTangent.at(i) = 0.35;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user