Used new CheckBox in rawcacorrection; don't zero red and blue when autoca is enabled

This commit is contained in:
heckflosse
2017-03-16 13:34:11 +01:00
parent a25a585673
commit bb518eeef8
5 changed files with 29 additions and 68 deletions

View File

@@ -18,7 +18,6 @@
*/
#include "rawcacorrection.h"
#include "guiutils.h"
#include <sstream>
#include "rtimage.h"
using namespace rtengine;
@@ -31,7 +30,8 @@ RAWCACorr::RAWCACorr () : FoldableToolPanel(this, "rawcacorrection", M("TP_CHROM
Gtk::Image* icablueL = Gtk::manage (new RTImage ("ajd-ca-blue1.png"));
Gtk::Image* icablueR = Gtk::manage (new RTImage ("ajd-ca-blue2.png"));
caAutocorrect = Gtk::manage(new Gtk::CheckButton((M("TP_RAWCACORR_AUTO"))));
caAutocorrect = Gtk::manage (new CheckBox(M("TP_RAWCACORR_AUTO"), multiImage));
caAutocorrect->setCheckBoxListener (this);
caStrength = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CASTR"), 2.0, 8.0, 0.5, 6.0));
caStrength->setAdjusterListener (this);
@@ -62,40 +62,35 @@ RAWCACorr::RAWCACorr () : FoldableToolPanel(this, "rawcacorrection", M("TP_CHROM
pack_start( *caRed, Gtk::PACK_SHRINK, 4);
pack_start( *caBlue, Gtk::PACK_SHRINK, 4);
caacsconn = caAutocorrect->signal_toggled().connect ( sigc::mem_fun(*this, &RAWCACorr::caCorrectionChanged), true);
}
void RAWCACorr::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
{
disableListener ();
caacsconn.block (true);
if(pedited ) {
caAutocorrect->set_inconsistent(!pedited->raw.caCorrection);
caAutocorrect->setEdited(pedited->raw.caCorrection);
caStrength->setEditedState( pedited->raw.caAutoStrength ? Edited : UnEdited );
caRed->setEditedState( pedited->raw.caRed ? Edited : UnEdited );
caBlue->setEditedState( pedited->raw.caBlue ? Edited : UnEdited );
}
lastCA = pp->raw.ca_autocorrect;
caStrength->set_sensitive(pp->raw.ca_autocorrect);
// disable Red and Blue sliders when caAutocorrect is enabled
caRed->set_sensitive(!pp->raw.ca_autocorrect);
caBlue->set_sensitive(!pp->raw.ca_autocorrect);
caAutocorrect->set_active(pp->raw.ca_autocorrect);
caAutocorrect->setValue(pp->raw.ca_autocorrect);
caStrength->setValue (pp->raw.caautostrength);
caRed->setValue (pp->raw.cared);
caBlue->setValue (pp->raw.cablue);
caacsconn.block (false);
enableListener ();
}
void RAWCACorr::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.ca_autocorrect = caAutocorrect->get_active();
pp->raw.ca_autocorrect = caAutocorrect->getLastActive();
pp->raw.caautostrength = caStrength->getValue();
pp->raw.cared = caRed->getValue();
pp->raw.cablue = caBlue->getValue();
@@ -125,6 +120,21 @@ void RAWCACorr::adjusterChanged (Adjuster* a, double newval)
}
}
void RAWCACorr::checkBoxToggled (CheckBox* c, CheckValue newval)
{
if (c == caAutocorrect) {
if (!batchMode) {
caStrength->set_sensitive(caAutocorrect->get_active ());
// disable Red and Blue sliders when caAutocorrect is enabled
caRed->set_sensitive(!caAutocorrect->get_active ());
caBlue->set_sensitive(!caAutocorrect->get_active ());
}
if (listener) {
listener->panelChanged (EvPreProcessAutoCA, caAutocorrect->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
}
}
}
void RAWCACorr::setBatchMode(bool batchMode)
{
ToolPanel::setBatchMode (batchMode);
@@ -150,52 +160,6 @@ void RAWCACorr::setDefaults(const rtengine::procparams::ProcParams* defParams, c
}
}
void RAWCACorr::caCorrectionChanged()
{
if (batchMode) {
if (caAutocorrect->get_inconsistent()) {
caAutocorrect->set_inconsistent (false);
caacsconn.block (true);
caAutocorrect->set_active (false);
caacsconn.block (false);
} else if (lastCA) {
caAutocorrect->set_inconsistent (true);
}
lastCA = caAutocorrect->get_active ();
}
/*else {
// For non batch mode, we disable the red and blue slider if caAutocorrect is true
if (caAutocorrect->get_active ()) {
caRed->set_sensitive(false);
caBlue->set_sensitive(false);
}
else {
caRed->set_sensitive(true);
caBlue->set_sensitive(true);
}
}*/
caStrength->set_sensitive(caAutocorrect->get_active ());
// disable Red and Blue sliders when caAutocorrect is enabled
caRed->set_sensitive(!caAutocorrect->get_active ());
caBlue->set_sensitive(!caAutocorrect->get_active ());
if (caAutocorrect->get_active ()) {
// set caRed and caBlue to 0 as RawImageSource::CA_correct_RT uses this as
// a condition for auto-CA correction. Alternative would be to change
// RawImageSource::CA_correct_RT and pass it ca_autocorrect value
caRed->setValue(0);
caBlue->setValue(0);
}
if (listener) {
listener->panelChanged (EvPreProcessAutoCA, caAutocorrect->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
}
}
void RAWCACorr::setAdjusterBehavior (bool caadd)
{

View File

@@ -21,19 +21,17 @@
#include <gtkmm.h>
#include "adjuster.h"
#include "checkbox.h"
#include "toolpanel.h"
#include "../rtengine/rawimage.h"
class RAWCACorr : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel
class RAWCACorr : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, public FoldableToolPanel
{
protected:
Gtk::CheckButton* caAutocorrect;
CheckBox* caAutocorrect;
Adjuster* caStrength;
Adjuster* caRed;
Adjuster* caBlue;
bool lastCA;
sigc::connection caacsconn;
public:
@@ -47,7 +45,7 @@ public:
void trimValues (rtengine::procparams::ProcParams* pp);
void adjusterChanged (Adjuster* a, double newval);
void caCorrectionChanged ();
void checkBoxToggled (CheckBox* c, CheckValue newval);
};
#endif