Move de-fish to distortion
This commit is contained in:
@@ -22,13 +22,19 @@
|
||||
|
||||
#include "rtimage.h"
|
||||
|
||||
#include "eventmapper.h"
|
||||
|
||||
#include "../rtengine/procparams.h"
|
||||
#include "../rtengine/refreshmap.h"
|
||||
|
||||
using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
Distortion::Distortion (): FoldableToolPanel(this, "distortion", M("TP_DISTORTION_LABEL"))
|
||||
{
|
||||
auto mapper = ProcEventMapper::getInstance();
|
||||
EvDistortionDefish = mapper->newEvent(TRANSFORM, "HISTORY_MSG_DISTORTION_DEFISH");
|
||||
EvDistortionDefishVoid = mapper->newEvent(M_VOID, "HISTORY_MSG_DISTORTION_DEFISH");
|
||||
|
||||
rlistener = nullptr;
|
||||
autoDistor = Gtk::manage (new Gtk::Button (M("GENERAL_AUTO")));
|
||||
@@ -45,11 +51,19 @@ Distortion::Distortion (): FoldableToolPanel(this, "distortion", M("TP_DISTORTIO
|
||||
|
||||
distor = Gtk::manage (new Adjuster (M("TP_DISTORTION_AMOUNT"), -0.5, 0.5, 0.001, 0, idistL, idistR));
|
||||
distor->setAdjusterListener (this);
|
||||
|
||||
distor->setLogScale(2, 0);
|
||||
|
||||
distor->show();
|
||||
pack_start (*distor);
|
||||
|
||||
defish = Gtk::manage(new Gtk::CheckButton(M("TP_DISTORTION_DEFISH")));
|
||||
defish->signal_toggled().connect(sigc::mem_fun(*this, &Distortion::defishChanged));
|
||||
defish->show();
|
||||
pack_start (*defish);
|
||||
|
||||
focal_length = Gtk::manage (new Adjuster (M("TP_DISTORTION_FOCAL_LENGTH"), 0.5, 25, 0.01, DistortionParams::DEFAULT_FOCAL_LENGTH));
|
||||
focal_length->setAdjusterListener (this);
|
||||
focal_length->show();
|
||||
pack_start(*focal_length);
|
||||
}
|
||||
|
||||
void Distortion::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
@@ -59,9 +73,12 @@ void Distortion::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
|
||||
if (pedited) {
|
||||
distor->setEditedState (pedited->distortion.amount ? Edited : UnEdited);
|
||||
focal_length->setEditedState (pedited->distortion.focal_length != DistortionParams::DEFAULT_FOCAL_LENGTH ? Edited : UnEdited);
|
||||
}
|
||||
|
||||
distor->setValue (pp->distortion.amount);
|
||||
defish->set_active(pp->distortion.defish);
|
||||
focal_length->setValue(pp->distortion.focal_length);
|
||||
|
||||
enableListener ();
|
||||
}
|
||||
@@ -70,9 +87,13 @@ void Distortion::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
{
|
||||
|
||||
pp->distortion.amount = distor->getValue ();
|
||||
pp->distortion.defish = defish->get_active ();
|
||||
pp->distortion.focal_length = focal_length->getValue ();
|
||||
|
||||
if (pedited) {
|
||||
pedited->distortion.amount = distor->getEditedState ();
|
||||
pedited->distortion.focal_length = focal_length->getEditedState ();
|
||||
pedited->distortion.defish = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +101,7 @@ void Distortion::setDefaults (const ProcParams* defParams, const ParamsEdited* p
|
||||
{
|
||||
|
||||
distor->setDefault (defParams->distortion.amount);
|
||||
focal_length->setDefault (defParams->distortion.focal_length);
|
||||
|
||||
if (pedited) {
|
||||
distor->setDefaultEditedState (pedited->distortion.amount ? Edited : UnEdited);
|
||||
@@ -118,9 +140,19 @@ void Distortion::idPressed ()
|
||||
}
|
||||
}
|
||||
|
||||
void Distortion::defishChanged()
|
||||
{
|
||||
if (listener) {
|
||||
listener->panelChanged(EvDistortionDefish, defish->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
|
||||
void Distortion::focalLengthChanged(Adjuster *a, const double newval)
|
||||
{
|
||||
}
|
||||
|
||||
void Distortion::setAdjusterBehavior (bool vadd)
|
||||
{
|
||||
|
||||
distor->setAddMode(vadd);
|
||||
}
|
||||
|
||||
@@ -128,4 +160,5 @@ void Distortion::trimValues (rtengine::procparams::ProcParams* pp)
|
||||
{
|
||||
|
||||
distor->trimValue(pp->distortion.amount);
|
||||
focal_length->trimValue(pp->distortion.focal_length);
|
||||
}
|
||||
|
Reference in New Issue
Block a user