Fattal: added anchor parameter
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "fattaltonemap.h"
|
||||
#include "eventmapper.h"
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
|
||||
@@ -26,32 +27,41 @@ using namespace rtengine::procparams;
|
||||
|
||||
FattalToneMapping::FattalToneMapping(): FoldableToolPanel(this, "fattal", M("TP_TM_FATTAL_LABEL"), true, true)
|
||||
{
|
||||
auto m = ProcEventMapper::getInstance();
|
||||
EvTMFattalAnchor = m->newEvent(HDR, "HISTORY_MSG_TM_FATTAL_ANCHOR");
|
||||
|
||||
amount = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_AMOUNT"), 1., 100., 1., 30.));
|
||||
threshold = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_THRESHOLD"), -100., 100., 1., 0.0));
|
||||
anchor = Gtk::manage(new Adjuster(M("TP_TM_FATTAL_ANCHOR"), 1, 100, 1, 50));
|
||||
|
||||
amount->setAdjusterListener(this);
|
||||
threshold->setAdjusterListener(this);
|
||||
anchor->setAdjusterListener(this);
|
||||
|
||||
amount->show();
|
||||
threshold->show();
|
||||
anchor->show();
|
||||
|
||||
pack_start(*amount);
|
||||
pack_start(*threshold);
|
||||
pack_start(*anchor);
|
||||
}
|
||||
|
||||
void FattalToneMapping::read(const ProcParams *pp, const ParamsEdited *pedited)
|
||||
{
|
||||
disableListener();
|
||||
|
||||
if(pedited) {
|
||||
if (pedited) {
|
||||
threshold->setEditedState(pedited->fattal.threshold ? Edited : UnEdited);
|
||||
amount->setEditedState(pedited->fattal.amount ? Edited : UnEdited);
|
||||
anchor->setEditedState(pedited->fattal.anchor ? Edited : UnEdited);
|
||||
set_inconsistent(multiImage && !pedited->fattal.enabled);
|
||||
}
|
||||
|
||||
setEnabled(pp->fattal.enabled);
|
||||
threshold->setValue(pp->fattal.threshold);
|
||||
amount->setValue(pp->fattal.amount);
|
||||
anchor->setValue(pp->fattal.anchor);
|
||||
|
||||
enableListener();
|
||||
}
|
||||
@@ -60,11 +70,13 @@ void FattalToneMapping::write(ProcParams *pp, ParamsEdited *pedited)
|
||||
{
|
||||
pp->fattal.threshold = threshold->getValue();
|
||||
pp->fattal.amount = amount->getValue();
|
||||
pp->fattal.anchor = anchor->getValue();
|
||||
pp->fattal.enabled = getEnabled();
|
||||
|
||||
if(pedited) {
|
||||
pedited->fattal.threshold = threshold->getEditedState();
|
||||
pedited->fattal.amount = amount->getEditedState();
|
||||
pedited->fattal.anchor = anchor->getEditedState();
|
||||
pedited->fattal.enabled = !get_inconsistent();
|
||||
}
|
||||
}
|
||||
@@ -73,13 +85,16 @@ void FattalToneMapping::setDefaults(const ProcParams *defParams, const ParamsEdi
|
||||
{
|
||||
threshold->setDefault(defParams->fattal.threshold);
|
||||
amount->setDefault(defParams->fattal.amount);
|
||||
anchor->setDefault(defParams->fattal.anchor);
|
||||
|
||||
if(pedited) {
|
||||
threshold->setDefaultEditedState(pedited->fattal.threshold ? Edited : UnEdited);
|
||||
amount->setDefaultEditedState(pedited->fattal.amount ? Edited : UnEdited);
|
||||
anchor->setDefaultEditedState(pedited->fattal.anchor ? Edited : UnEdited);
|
||||
} else {
|
||||
threshold->setDefaultEditedState(Irrelevant);
|
||||
amount->setDefaultEditedState(Irrelevant);
|
||||
anchor->setDefaultEditedState(Irrelevant);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +105,8 @@ void FattalToneMapping::adjusterChanged(Adjuster* a, double newval)
|
||||
listener->panelChanged(EvTMFattalThreshold, a->getTextValue());
|
||||
} else if(a == amount) {
|
||||
listener->panelChanged(EvTMFattalAmount, a->getTextValue());
|
||||
} else if(a == anchor) {
|
||||
listener->panelChanged(EvTMFattalAnchor, a->getTextValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,11 +130,13 @@ void FattalToneMapping::setBatchMode(bool batchMode)
|
||||
|
||||
threshold->showEditedCB();
|
||||
amount->showEditedCB();
|
||||
anchor->showEditedCB();
|
||||
}
|
||||
|
||||
void FattalToneMapping::setAdjusterBehavior (bool alphaAdd, bool betaAdd)
|
||||
void FattalToneMapping::setAdjusterBehavior(bool amountAdd, bool thresholdAdd, bool anchorAdd)
|
||||
{
|
||||
threshold->setAddMode(alphaAdd);
|
||||
amount->setAddMode(betaAdd);
|
||||
amount->setAddMode(amountAdd);
|
||||
threshold->setAddMode(thresholdAdd);
|
||||
anchor->setAddMode(anchorAdd);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user