Issue 1858: "Defringe specific colors only" on behalf of J. Desmis
This commit is contained in:
@@ -26,6 +26,13 @@ using namespace rtengine::procparams;
|
||||
Defringe::Defringe () : Gtk::VBox(), FoldableToolPanel(this) {
|
||||
|
||||
set_border_width(4);
|
||||
std::vector<GradientMilestone> bottomMilestones;
|
||||
float R, G, B;
|
||||
for (int i=0; i<7; i++) {
|
||||
float x = float(i)*(1.0f/6.0);
|
||||
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
|
||||
bottomMilestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) );
|
||||
}
|
||||
|
||||
enabled = Gtk::manage (new Gtk::CheckButton (M("GENERAL_ENABLED")));
|
||||
enabled->set_active (false);
|
||||
@@ -38,6 +45,14 @@ Defringe::Defringe () : Gtk::VBox(), FoldableToolPanel(this) {
|
||||
hsep1->show ();
|
||||
pack_start (*hsep1);
|
||||
|
||||
curveEditorPF = new CurveEditorGroup (options.lastPFCurvesDir);
|
||||
curveEditorPF->setCurveListener (this);
|
||||
chshape = static_cast<FlatCurveEditor*>(curveEditorPF->addCurve(CT_Flat, M("TP_PFCURVE_CURVEEDITOR_CH")));
|
||||
chshape->setTooltip(M("TP_PFCURVE_CURVEEDITOR_CH_TOOLTIP"));
|
||||
chshape->setIdentityValue(0.);
|
||||
chshape->setBottomBarBgGradient(bottomMilestones);
|
||||
chshape->setCurveColorProvider(this, 1);
|
||||
|
||||
enaConn = enabled->signal_toggled().connect( sigc::mem_fun(*this, &Defringe::enabledChanged) );
|
||||
//edgConn = enabled->signal_toggled().connect( sigc::mem_fun(*this, &Defringe::edgeChanged) );
|
||||
|
||||
@@ -50,6 +65,24 @@ Defringe::Defringe () : Gtk::VBox(), FoldableToolPanel(this) {
|
||||
|
||||
pack_start (*radius);
|
||||
pack_start (*threshold);
|
||||
curveEditorPF->curveListComplete();
|
||||
|
||||
pack_start (*curveEditorPF, Gtk::PACK_SHRINK, 4);
|
||||
}
|
||||
|
||||
Defringe::~Defringe () {
|
||||
delete curveEditorPF;
|
||||
}
|
||||
|
||||
void Defringe::colorForValue (double valX, double valY, int callerId, ColorCaller *caller) {
|
||||
|
||||
float R, G, B;
|
||||
if (callerId == 1) { // ch
|
||||
Color::hsv2rgb01(float(valX), float(valY), 0.5f, R, G, B);
|
||||
}
|
||||
caller->ccRed = double(R);
|
||||
caller->ccGreen = double(G);
|
||||
caller->ccBlue = double(B);
|
||||
}
|
||||
|
||||
void Defringe::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||
@@ -57,33 +90,43 @@ void Defringe::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||
disableListener ();
|
||||
|
||||
if (pedited) {
|
||||
radius->setEditedState (pedited->defringe.radius ? Edited : UnEdited);
|
||||
threshold->setEditedState (pedited->defringe.threshold ? Edited : UnEdited);
|
||||
radius->setEditedState ( pedited->defringe.radius ? Edited : UnEdited);
|
||||
threshold->setEditedState ( pedited->defringe.threshold ? Edited : UnEdited);
|
||||
enabled->set_inconsistent (!pedited->defringe.enabled);
|
||||
chshape->setUnChanged (!pedited->defringe.huecurve);
|
||||
}
|
||||
|
||||
enaConn.block (true);
|
||||
enabled->set_active (pp->defringe.enabled);
|
||||
enaConn.block (false);
|
||||
|
||||
|
||||
lastEnabled = pp->defringe.enabled;
|
||||
|
||||
radius->setValue (pp->defringe.radius);
|
||||
threshold->setValue (pp->defringe.threshold);
|
||||
threshold->setValue (pp->defringe.threshold);
|
||||
chshape->setCurve (pp->defringe.huecurve);
|
||||
|
||||
enableListener ();
|
||||
}
|
||||
|
||||
|
||||
void Defringe::autoOpenCurve () {
|
||||
// WARNING: The following line won't work, since linear is a flat curve at 0.
|
||||
chshape->openIfNonlinear();
|
||||
}
|
||||
|
||||
void Defringe::write (ProcParams* pp, ParamsEdited* pedited) {
|
||||
|
||||
pp->defringe.radius = radius->getValue ();
|
||||
pp->defringe.radius = radius->getValue ();
|
||||
pp->defringe.threshold = (int)threshold->getValue ();
|
||||
pp->defringe.enabled = enabled->get_active();
|
||||
pp->defringe.enabled = enabled->get_active();
|
||||
pp->defringe.huecurve = chshape->getCurve ();
|
||||
|
||||
if (pedited) {
|
||||
pedited->defringe.radius = radius->getEditedState ();
|
||||
pedited->defringe.radius = radius->getEditedState ();
|
||||
pedited->defringe.threshold = threshold->getEditedState ();
|
||||
pedited->defringe.enabled = !enabled->get_inconsistent();
|
||||
pedited->defringe.enabled = !enabled->get_inconsistent();
|
||||
pedited->defringe.huecurve = !chshape->isUnChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,13 +137,17 @@ void Defringe::setDefaults (const ProcParams* defParams, const ParamsEdited* ped
|
||||
|
||||
if (pedited) {
|
||||
radius->setDefaultEditedState (pedited->defringe.radius ? Edited : UnEdited);
|
||||
threshold->setDefaultEditedState (pedited->defringe.threshold ? Edited : UnEdited);
|
||||
}
|
||||
threshold->setDefaultEditedState (pedited->defringe.threshold ? Edited : UnEdited);
|
||||
}
|
||||
else {
|
||||
radius->setDefaultEditedState (Irrelevant);
|
||||
threshold->setDefaultEditedState (Irrelevant);
|
||||
threshold->setDefaultEditedState (Irrelevant);
|
||||
}
|
||||
}
|
||||
void Defringe::curveChanged () {
|
||||
|
||||
if (listener && enabled->get_active()) listener->panelChanged (EvPFCurve, M("HISTORY_CUSTOMCURVE"));
|
||||
}
|
||||
|
||||
void Defringe::adjusterChanged (Adjuster* a, double newval) {
|
||||
|
||||
|
Reference in New Issue
Block a user