Bugfix: CurveEditor were possibly displayed one above the other (introduced by the previous changeset)

This commit is contained in:
natureh
2012-08-17 01:52:48 +02:00
parent 9c66911c99
commit 98c121883e
10 changed files with 65 additions and 1 deletions

View File

@@ -231,7 +231,7 @@ void CurveEditor::setBottomBarBgGradient (const std::vector<GradientMilestone> &
} }
void CurveEditor::refresh () { void CurveEditor::refresh () {
subGroup->switchGUI(); subGroup->refresh(this);
} }
void CurveEditor::setCurveColorProvider(ColorProvider* cp, int callerId) { void CurveEditor::setCurveColorProvider(ColorProvider* cp, int callerId) {

View File

@@ -114,6 +114,7 @@ public:
int getValLinear() { return valLinear; } int getValLinear() { return valLinear; }
virtual void updateBackgroundHistogram (CurveEditor* ce) {} virtual void updateBackgroundHistogram (CurveEditor* ce) {}
virtual void switchGUI() = 0; virtual void switchGUI() = 0;
virtual void refresh(CurveEditor *curveToRefresh) = 0;
protected: protected:

View File

@@ -238,6 +238,29 @@ DiagonalCurveEditor* DiagonalCurveEditorSubGroup::addCurve(Glib::ustring curveLa
return newCE; return newCE;
} }
/*
* Force the resize of the curve editor, if the displayed one is the requested one
*/
void DiagonalCurveEditorSubGroup::refresh(CurveEditor *curveToRefresh) {
if (curveToRefresh != NULL && curveToRefresh == static_cast<DiagonalCurveEditor*>(parent->displayedCurve)) {
switch((DiagonalCurveType)(curveToRefresh->curveType->getSelected())) {
case (DCT_Spline):
customCurve->refresh();
break;
case (DCT_Parametric):
paramCurve->refresh();
shcSelector->refresh();
break;
case (DCT_NURBS):
NURBSCurve->refresh();
break;
default: // (DCT_Linear, DCT_Unchanged)
// ... do nothing
break;
}
}
}
/* /*
* Switch the editor widgets to the currently edited curve * Switch the editor widgets to the currently edited curve
*/ */

View File

@@ -65,6 +65,7 @@ public:
DiagonalCurveEditor* addCurve(Glib::ustring curveLabel = ""); DiagonalCurveEditor* addCurve(Glib::ustring curveLabel = "");
virtual void updateBackgroundHistogram (CurveEditor* ce); virtual void updateBackgroundHistogram (CurveEditor* ce);
void switchGUI(); void switchGUI();
void refresh(CurveEditor *curveToRefresh);
protected: protected:
void storeCurveValues (CurveEditor* ce, const std::vector<double>& p); void storeCurveValues (CurveEditor* ce, const std::vector<double>& p);

View File

@@ -83,6 +83,22 @@ FlatCurveEditor* FlatCurveEditorSubGroup::addCurve(Glib::ustring curveLabel, boo
return newCE; return newCE;
} }
/*
* Force the resize of the curve editor, if the displayed one is the requested one
*/
void FlatCurveEditorSubGroup::refresh(CurveEditor *curveToRefresh) {
if (curveToRefresh != NULL && curveToRefresh == static_cast<FlatCurveEditor*>(parent->displayedCurve)) {
switch(FlatCurveType(curveToRefresh->curveType->getSelected())) {
case (FCT_MinMaxCPoints):
CPointsCurve->refresh();
break;
default: // (DCT_Linear, DCT_Unchanged)
// ... do nothing
break;
}
}
}
/* /*
* Switch the editor widgets to the currently edited curve * Switch the editor widgets to the currently edited curve
*/ */
@@ -311,6 +327,7 @@ bool FlatCurveEditorSubGroup::curveReset(int cType) {
return false; return false;
break; break;
} }
return true;
} }
/*void FlatCurveEditorSubGroup::updateBackgroundHistogram (CurveEditor* ce) { /*void FlatCurveEditorSubGroup::updateBackgroundHistogram (CurveEditor* ce) {

View File

@@ -43,6 +43,7 @@ public:
FlatCurveEditor* addCurve(Glib::ustring curveLabel = "", bool periodic = true); FlatCurveEditor* addCurve(Glib::ustring curveLabel = "", bool periodic = true);
//virtual void updateBackgroundHistogram (CurveEditor* ce); //virtual void updateBackgroundHistogram (CurveEditor* ce);
void switchGUI(); void switchGUI();
void refresh(CurveEditor *curveToRefresh);
protected: protected:
void storeCurveValues (CurveEditor* ce, const std::vector<double>& p); void storeCurveValues (CurveEditor* ce, const std::vector<double>& p);

View File

@@ -100,3 +100,15 @@ void MyCurve::styleChanged (const Glib::RefPtr<Gtk::Style>& style) {
queue_draw (); queue_draw ();
} }
void MyCurve::refresh() {
if (leftBar != NULL)
leftBar->setDirty(true);
if (bottomBar != NULL)
bottomBar->setDirty(true);
setDirty(true);
Glib::RefPtr<Gdk::Window> win = get_window();
if (win)
win->invalidate(true);
}

View File

@@ -106,6 +106,7 @@ class MyCurve : public Gtk::DrawingArea, public BackBuffer, public ColorCaller {
void notifyListener (); void notifyListener ();
void updateBackgroundHistogram (LUTu & hist) {return;} ; void updateBackgroundHistogram (LUTu & hist) {return;} ;
void forceResize() { sized = RS_Force; } void forceResize() { sized = RS_Force; }
void refresh();
void styleChanged (const Glib::RefPtr<Gtk::Style>& style); void styleChanged (const Glib::RefPtr<Gtk::Style>& style);
virtual std::vector<double> getPoints () = 0; virtual std::vector<double> getPoints () = 0;
virtual void setPoints (const std::vector<double>& p) = 0; virtual void setPoints (const std::vector<double>& p) = 0;

View File

@@ -237,3 +237,10 @@ bool SHCSelector::reset () { // : movingPosition(-1), cl(NULL) {
} }
return false; return false;
} }
void SHCSelector::refresh() {
setDirty(true);
Glib::RefPtr<Gdk::Window> win = get_window();
if (win)
win->invalidate(true);
}

View File

@@ -66,6 +66,7 @@ class SHCSelector : public Gtk::DrawingArea, public ColoredBar {
bool on_motion_notify_event (GdkEventMotion* event); bool on_motion_notify_event (GdkEventMotion* event);
void styleChanged (const Glib::RefPtr<Gtk::Style>& style); void styleChanged (const Glib::RefPtr<Gtk::Style>& style);
bool reset (); bool reset ();
void refresh();
}; };
#endif #endif