diff --git a/rtgui/bayerpreprocess.cc b/rtgui/bayerpreprocess.cc index 281271dbd..0720612fe 100644 --- a/rtgui/bayerpreprocess.cc +++ b/rtgui/bayerpreprocess.cc @@ -24,14 +24,14 @@ using namespace rtengine; using namespace rtengine::procparams; -BayerPreProcess::BayerPreProcess () : FoldableToolPanel(this, "bayerpreprocess", M("TP_PREPROCESS_LABEL"), true) +BayerPreProcess::BayerPreProcess() : FoldableToolPanel(this, "bayerpreprocess", M("TP_PREPROCESS_LABEL"), true) { auto m = ProcEventMapper::getInstance(); EvLineDenoiseDirection = m->newEvent(DARKFRAME, "HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION"); EvPDAFLinesFilter = m->newEvent(DARKFRAME, "HISTORY_MSG_PREPROCESS_PDAFLINESFILTER"); - lineDenoise = Gtk::manage(new Adjuster (M("TP_PREPROCESS_LINEDENOISE"), 0, 1000, 1, 0)); - lineDenoise->setAdjusterListener (this); + lineDenoise = Gtk::manage(new Adjuster(M("TP_PREPROCESS_LINEDENOISE"), 0, 1000, 1, 0)); + lineDenoise->setAdjusterListener(this); if (lineDenoise->delay < options.adjusterMaxDelay) { lineDenoise->delay = options.adjusterMaxDelay; @@ -39,8 +39,8 @@ BayerPreProcess::BayerPreProcess () : FoldableToolPanel(this, "bayerpreprocess", lineDenoise->show(); - greenEqThreshold = Gtk::manage(new Adjuster (M("TP_PREPROCESS_GREENEQUIL"), 0, 100, 1, 0)); - greenEqThreshold->setAdjusterListener (this); + greenEqThreshold = Gtk::manage(new Adjuster(M("TP_PREPROCESS_GREENEQUIL"), 0, 100, 1, 0)); + greenEqThreshold->setAdjusterListener(this); if (greenEqThreshold->delay < options.adjusterMaxDelay) { greenEqThreshold->delay = options.adjusterMaxDelay; @@ -57,15 +57,15 @@ BayerPreProcess::BayerPreProcess () : FoldableToolPanel(this, "bayerpreprocess", lineDenoiseDirection->append(M("TP_PREPROCESS_LINEDENOISE_DIRECTION_PDAF_LINES")); lineDenoiseDirection->show(); lineDenoiseDirection->signal_changed().connect(sigc::mem_fun(*this, &BayerPreProcess::lineDenoiseDirectionChanged)); - + hb->pack_start(*lineDenoiseDirection); - pack_start( *lineDenoise, Gtk::PACK_SHRINK, 4); + pack_start(*lineDenoise, Gtk::PACK_SHRINK, 4); pack_start(*hb, Gtk::PACK_SHRINK, 4); - pack_start( *Gtk::manage (new Gtk::HSeparator())); + pack_start(*Gtk::manage(new Gtk::HSeparator())); - pack_start( *greenEqThreshold, Gtk::PACK_SHRINK, 4); + pack_start(*greenEqThreshold, Gtk::PACK_SHRINK, 4); pdafLinesFilter = Gtk::manage(new Gtk::CheckButton((M("TP_PREPROCESS_PDAFLINESFILTER")))); pdafLinesFilter->show(); @@ -77,58 +77,64 @@ BayerPreProcess::BayerPreProcess () : FoldableToolPanel(this, "bayerpreprocess", void BayerPreProcess::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) { - disableListener (); + disableListener(); + + if (pedited) { + lineDenoise->setEditedState(pedited->raw.bayersensor.linenoise ? Edited : UnEdited); + greenEqThreshold->setEditedState(pedited->raw.bayersensor.greenEq ? Edited : UnEdited); - if(pedited ) { - lineDenoise->setEditedState( pedited->raw.bayersensor.linenoise ? Edited : UnEdited ); - greenEqThreshold->setEditedState( pedited->raw.bayersensor.greenEq ? Edited : UnEdited ); if (!pedited->raw.bayersensor.linenoiseDirection) { lineDenoiseDirection->set_active(3); } + pdafLinesFilter->set_inconsistent(!pedited->raw.bayersensor.pdafLinesFilter); } - lineDenoise->setValue (pp->raw.bayersensor.linenoise); - int d = int(pp->raw.bayersensor.linenoiseDirection)-1; + lineDenoise->setValue(pp->raw.bayersensor.linenoise); + int d = int(pp->raw.bayersensor.linenoiseDirection) - 1; + if (d == 4) { --d; } + lineDenoiseDirection->set_active(d); - greenEqThreshold->setValue (pp->raw.bayersensor.greenthresh); + greenEqThreshold->setValue(pp->raw.bayersensor.greenthresh); pdafLinesFilter->set_active(pp->raw.bayersensor.pdafLinesFilter); - enableListener (); + enableListener(); } -void BayerPreProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) +void BayerPreProcess::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) { pp->raw.bayersensor.linenoise = lineDenoise->getIntValue(); int d = lineDenoiseDirection->get_active_row_number() + 1; + if (d == 4) { ++d; } + pp->raw.bayersensor.linenoiseDirection = RAWParams::BayerSensor::LineNoiseDirection(d); pp->raw.bayersensor.greenthresh = greenEqThreshold->getIntValue(); pp->raw.bayersensor.pdafLinesFilter = pdafLinesFilter->get_active(); if (pedited) { - pedited->raw.bayersensor.linenoise = lineDenoise->getEditedState (); - pedited->raw.bayersensor.greenEq = greenEqThreshold->getEditedState (); + pedited->raw.bayersensor.linenoise = lineDenoise->getEditedState(); + pedited->raw.bayersensor.greenEq = greenEqThreshold->getEditedState(); pedited->raw.bayersensor.linenoise = lineDenoiseDirection->get_active_row_number() != 3; pedited->raw.bayersensor.pdafLinesFilter = !pdafLinesFilter->get_inconsistent(); } } -void BayerPreProcess::adjusterChanged (Adjuster* a, double newval) +void BayerPreProcess::adjusterChanged(Adjuster* a, double newval) { if (listener) { Glib::ustring value = a->getTextValue(); if (a == greenEqThreshold) { - listener->panelChanged (EvPreProcessGEquilThresh, value ); + listener->panelChanged(EvPreProcessGEquilThresh, value); } else if (a == lineDenoise) { - listener->panelChanged (EvPreProcessLineDenoise, value ); + listener->panelChanged(EvPreProcessLineDenoise, value); } } } @@ -139,9 +145,10 @@ void BayerPreProcess::adjusterAutoToggled(Adjuster* a, bool newval) void BayerPreProcess::setBatchMode(bool batchMode) { - ToolPanel::setBatchMode (batchMode); - lineDenoise->showEditedCB (); - greenEqThreshold->showEditedCB (); + ToolPanel::setBatchMode(batchMode); + lineDenoise->showEditedCB(); + greenEqThreshold->showEditedCB(); + if (batchMode) { lineDenoiseDirection->append(M("GENERAL_UNCHANGED")); } @@ -149,26 +156,26 @@ void BayerPreProcess::setBatchMode(bool batchMode) void BayerPreProcess::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited) { - lineDenoise->setDefault( defParams->raw.bayersensor.linenoise); - greenEqThreshold->setDefault (defParams->raw.bayersensor.greenthresh); + lineDenoise->setDefault(defParams->raw.bayersensor.linenoise); + greenEqThreshold->setDefault(defParams->raw.bayersensor.greenthresh); if (pedited) { - lineDenoise->setDefaultEditedState( pedited->raw.bayersensor.linenoise ? Edited : UnEdited); + lineDenoise->setDefaultEditedState(pedited->raw.bayersensor.linenoise ? Edited : UnEdited); greenEqThreshold->setDefaultEditedState(pedited->raw.bayersensor.greenEq ? Edited : UnEdited); } else { - lineDenoise->setDefaultEditedState( Irrelevant ); - greenEqThreshold->setDefaultEditedState(Irrelevant ); + lineDenoise->setDefaultEditedState(Irrelevant); + greenEqThreshold->setDefaultEditedState(Irrelevant); } } -void BayerPreProcess::setAdjusterBehavior (bool linedenoiseadd, bool greenequiladd) +void BayerPreProcess::setAdjusterBehavior(bool linedenoiseadd, bool greenequiladd) { lineDenoise->setAddMode(linedenoiseadd); greenEqThreshold->setAddMode(greenequiladd); } -void BayerPreProcess::trimValues (rtengine::procparams::ProcParams* pp) +void BayerPreProcess::trimValues(rtengine::procparams::ProcParams* pp) { lineDenoise->trimValue(pp->raw.bayersensor.linenoise);